Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
wangxiaolu-promotion-wechat
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
sfa
wangxiaolu-promotion-wechat
Commits
dbd687b1
提交
dbd687b1
authored
3月 06, 2025
作者:
lidongxu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
'1'
上级
782ec655
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
235 行增加
和
114 行删除
+235
-114
index.js
api/home/index.js
+10
-0
id解释.txt
id解释.txt
+4
-0
pages.json
pages.json
+4
-2
index.vue
pages/home/index.vue
+52
-32
login.vue
pages/login.vue
+90
-32
register.vue
pages/register.vue
+24
-20
start.vue
pages/start.vue
+2
-2
index.vue
pages/work/index.vue
+32
-14
map.js
store/modules/map.js
+1
-2
user.js
store/modules/user.js
+10
-7
common.js
utils/common.js
+4
-1
request.js
utils/request.js
+2
-2
没有找到文件。
api/home/index.js
浏览文件 @
dbd687b1
...
@@ -61,3 +61,12 @@ export function getPromotionPhotoRecordAPI(id) {
...
@@ -61,3 +61,12 @@ export function getPromotionPhotoRecordAPI(id) {
url
:
`/activity/temporary/query/today/
${
id
}
`
url
:
`/activity/temporary/query/today/
${
id
}
`
})
})
}
}
// 促销员是否能下班判断(尝试提交审批通过后台判断响应正确即可调用下班打卡)
// id:促销员 id
export
function
getOnWorkCardStatusAPI
(
id
)
{
return
request
({
url
:
`/activity/temporary/core/reported/approve/submit/
${
id
}
`
,
method
:
'PUT'
})
}
\ No newline at end of file
id解释.txt
0 → 100644
浏览文件 @
dbd687b1
促销员 ID:
促销任务上报 ID:
计划 ID:
\ No newline at end of file
pages.json
浏览文件 @
dbd687b1
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
{
{
"path"
:
"pages/work/index"
,
"path"
:
"pages/work/index"
,
"style"
:
{
"style"
:
{
"navigationBarTitleText"
:
"
今日销售记录
"
"navigationBarTitleText"
:
"
上传推广照片
"
}
}
},
},
{
{
...
@@ -60,7 +60,8 @@
...
@@ -60,7 +60,8 @@
"van-button"
:
"wxcomponents/@vant/weapp/button/index"
,
"van-button"
:
"wxcomponents/@vant/weapp/button/index"
,
"van-icon"
:
"wxcomponents/@vant/weapp/icon/index"
,
"van-icon"
:
"wxcomponents/@vant/weapp/icon/index"
,
"van-image"
:
"wxcomponents/@vant/weapp/image/index"
,
"van-image"
:
"wxcomponents/@vant/weapp/image/index"
,
"van-uploader"
:
"wxcomponents/@vant/weapp/uploader/index"
"van-uploader"
:
"wxcomponents/@vant/weapp/uploader/index"
,
"van-checkbox"
:
"wxcomponents/@vant/weapp/checkbox/index"
}
}
}
}
}
}
\ No newline at end of file
pages/home/index.vue
浏览文件 @
dbd687b1
...
@@ -61,7 +61,7 @@
...
@@ -61,7 +61,7 @@
<div
class=
"line"
>
<div
class=
"line"
>
<van-button
class=
"btn_item"
<van-button
class=
"btn_item"
type=
"primary"
type=
"primary"
v-if=
"onWorkRecord.clockInTime && !onWorkRecord.noonClockOutTime"
v-if=
"onWorkRecord.clockInTime && !onWorkRecord.noonClockOutTime
&& !onWorkRecord.clockOutTime
"
@
click=
"attendanceClickFn(2)"
>
午休卡
</van-button>
@
click=
"attendanceClickFn(2)"
>
午休卡
</van-button>
<view
class=
"clock_item"
<view
class=
"clock_item"
v-else-if=
"onWorkRecord.noonClockOutTime"
>
v-else-if=
"onWorkRecord.noonClockOutTime"
>
...
@@ -105,7 +105,7 @@
...
@@ -105,7 +105,7 @@
fit=
"cover"
fit=
"cover"
round
/>
round
/>
<view
class=
"mark"
>
<view
class=
"mark"
>
<view
class=
"mark_text"
>
午休
卡-已打
</view>
<view
class=
"mark_text"
>
下班
卡-已打
</view>
<view
class=
"mark_time"
>
{{ onWorkRecord.clockOutTime }}
</view>
<view
class=
"mark_time"
>
{{ onWorkRecord.clockOutTime }}
</view>
</view>
</view>
</view>
</view>
...
@@ -119,7 +119,7 @@
...
@@ -119,7 +119,7 @@
<
script
>
<
script
>
import
{
getAttendanceDetailAPI
,
addAttendanceAPI
,
getAttendanceListAPI
,
getProStoreAPI
,
getPlanListAPI
,
getOnWorkCardAPI
,
createOnWorkPlanAPI
,
getOnWorkRecordAPI
}
from
'@/api'
import
{
getAttendanceDetailAPI
,
addAttendanceAPI
,
getAttendanceListAPI
,
getProStoreAPI
,
getPlanListAPI
,
getOnWorkCardAPI
,
createOnWorkPlanAPI
,
getOnWorkRecordAPI
,
getOnWorkCardStatusAPI
}
from
'@/api'
import
{
checkStartLessEndTime
,
parseTime
,
isSameDay
,
zeroTo24
,
checkTimeIsBetween
}
from
'@/utils/common'
import
{
checkStartLessEndTime
,
parseTime
,
isSameDay
,
zeroTo24
,
checkTimeIsBetween
}
from
'@/utils/common'
import
{
uploadFile
}
from
'@/api/common/upload'
import
{
uploadFile
}
from
'@/api/common/upload'
import
QQMapWX
from
'../../libs/qqmap-wx-jssdk1.2/qqmap-wx-jssdk.js'
import
QQMapWX
from
'../../libs/qqmap-wx-jssdk1.2/qqmap-wx-jssdk.js'
...
@@ -127,6 +127,7 @@ import QQMapWX from '../../libs/qqmap-wx-jssdk1.2/qqmap-wx-jssdk.js'
...
@@ -127,6 +127,7 @@ import QQMapWX from '../../libs/qqmap-wx-jssdk1.2/qqmap-wx-jssdk.js'
import
config
from
'@/config'
import
config
from
'@/config'
import
storage
from
'@/utils/storage'
import
storage
from
'@/utils/storage'
import
constant
from
'@/utils/constant'
import
constant
from
'@/utils/constant'
import
{
v4
as
uuidv4
}
from
'uuid'
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
...
@@ -190,7 +191,6 @@ export default {
...
@@ -190,7 +191,6 @@ export default {
});
});
qqmapsdk
.
reverseGeocoder
({
qqmapsdk
.
reverseGeocoder
({
success
:
function
(
ress
)
{
success
:
function
(
ress
)
{
console
.
log
(
'地址'
,
ress
)
const
{
result
:
{
ad_info
:
{
province
,
city
,
district
,
location
:
{
lat
,
lng
}
},
formatted_addresses
:
{
recommend
}
}
}
=
ress
const
{
result
:
{
ad_info
:
{
province
,
city
,
district
,
location
:
{
lat
,
lng
}
},
formatted_addresses
:
{
recommend
}
}
}
=
ress
_this
.
address
=
recommend
;
_this
.
address
=
recommend
;
_this
.
lat
=
lat
_this
.
lat
=
lat
...
@@ -242,7 +242,24 @@ export default {
...
@@ -242,7 +242,24 @@ export default {
this
.
$modal
.
msgError
(
'请选择计划'
)
this
.
$modal
.
msgError
(
'请选择计划'
)
return
return
}
}
// 判断是否到了上班打卡时间
if
(
type
===
1
)
{
const
{
clockInTime
}
=
planObj
const
time
=
parseTime
(
new
Date
(
clockInTime
),
'{h}:{m}:{s}'
)
const
isClock
=
checkStartLessEndTime
(
time
,
parseTime
(
new
Date
(),
'{h}:{m}:{s}'
))
if
(
!
isClock
)
{
this
.
$modal
.
msgError
(
'未到上班打卡时间'
)
return
}
}
// 判断是否能下班
if
(
type
===
4
)
{
// 下班先提交促销上班看看是否通过后台校验
await
getOnWorkCardStatusAPI
(
this
.
onWorkRecord
.
reportedId
)
}
// 前置条件过滤完毕,走打卡流程
const
photoUrl
=
await
this
.
pickerPhoto
(
type
)
// 拍照
const
photoUrl
=
await
this
.
pickerPhoto
(
type
)
// 拍照
const
{
id
,
name
}
=
this
.
$store
.
getters
.
user
const
{
id
,
name
}
=
this
.
$store
.
getters
.
user
...
@@ -260,16 +277,22 @@ export default {
...
@@ -260,16 +277,22 @@ export default {
clockCity
:
this
.
addressObj
.
city
,
// 城市
clockCity
:
this
.
addressObj
.
city
,
// 城市
clockArea
:
this
.
addressObj
.
area
,
// 区域
clockArea
:
this
.
addressObj
.
area
,
// 区域
}
}
try
{
try
{
// 打卡
const
res
=
await
getOnWorkCardAPI
(
attObj
)
if
(
type
===
1
)
{
if
(
type
===
1
)
{
// 创建上报记录
// 创建上报记录-才算完成打卡
await
this
.
createOnWorkPlanFn
()
const
res
=
await
createOnWorkPlanAPI
({
activityReportedId
:
planObj
.
id
,
temporaryId
:
this
.
$store
.
getters
.
user
.
id
,
// 促销员 ID
temporaryName
:
this
.
$store
.
getters
.
user
.
name
,
// 促销员姓名
})
console
.
log
(
res
)
}
}
// 打卡
// await getOnWorkCardAPI(attObj)
this
.
$modal
.
msgSuccess
(
'打卡成功'
)
this
.
$modal
.
msgSuccess
(
'打卡成功'
)
console
.
log
(
'考勤打卡记录'
,
res
)
wx
.
showTabBar
({
animation
:
true
})
}
catch
(
err
)
{
}
catch
(
err
)
{
this
.
$modal
.
msgError
(
err
.
msg
)
this
.
$modal
.
msgError
(
err
.
msg
)
}
}
...
@@ -296,47 +319,42 @@ export default {
...
@@ -296,47 +319,42 @@ export default {
success
:
async
(
res
)
=>
{
success
:
async
(
res
)
=>
{
// 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
// 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
const
tempFilePaths
=
res
.
tempFilePaths
;
const
tempFilePaths
=
res
.
tempFilePaths
;
console
.
log
(
tempFilePaths
[
0
]);
// 输出图片路径
const
date
=
new
Date
()
const
result
=
await
uploadFile
(
`planAndPhoto/
${
this
.
phone
}
/clock/
${
type
}
.png`
,
tempFilePaths
[
0
])
const
year
=
date
.
getFullYear
()
const
month
=
date
.
getMonth
()
+
1
const
day
=
date
.
getDate
()
const
result
=
await
uploadFile
(
`clockAndPromotion/
${
year
}
-
${
month
}
/
${
day
}
/
${
this
.
phone
}
/clock/
${
uuidv4
()}
.png`
,
tempFilePaths
[
0
])
resolve
(
result
)
resolve
(
result
)
}
}
});
});
})
})
},
},
// 创建活动上报记录
async
createOnWorkPlanFn
()
{
const
res
=
await
createOnWorkPlanAPI
({
temporaryId
:
this
.
$store
.
getters
.
user
.
id
,
// 促销员 ID
temporaryName
:
this
.
$store
.
getters
.
user
.
name
,
// 促销员姓名
// "tgscPhotoUrls":[],
// "tgscChangePhotoUrls":[],
// "tghdPhotoUrls":[],
// "tghdChangePhotoUrls":[],
// "tgcjPhotoUrls":[],
// "tgcjChangePhotoUrls":[]
})
console
.
log
(
res
)
},
// 获取促销员任务列表
// 获取促销员任务列表
async
getOnWorkRecordFn
()
{
async
getOnWorkRecordFn
()
{
const
res
=
await
getOnWorkRecordAPI
(
this
.
$store
.
getters
.
user
.
id
)
const
res
=
await
getOnWorkRecordAPI
(
this
.
$store
.
getters
.
user
.
id
)
if
(
!
res
.
data
)
return
this
.
isLoading
=
false
// 没有打过卡
if
(
!
res
.
data
)
{
wx
.
hideTabBar
()
return
this
.
isLoading
=
false
}
this
.
planList
=
[
res
.
data
.
storeName
]
this
.
planList
=
[
res
.
data
.
storeName
]
this
.
plan
=
res
.
data
.
storeName
this
.
plan
=
res
.
data
.
storeName
// 上班打卡时间格式化成时分秒
// 上班打卡时间格式化成时分秒
if
(
res
.
data
.
clockInTime
)
{
if
(
res
.
data
.
clockInTime
)
{
res
.
data
.
clockInTime
=
parseTime
(
res
.
data
.
clockInTime
,
'{h}:{m
}:{s}'
)
res
.
data
.
clockInTime
=
parseTime
(
new
Date
(
res
.
data
.
clockInTime
),
'{h}:{i
}:{s}'
)
}
}
if
(
res
.
data
.
noonClockOutTime
)
{
if
(
res
.
data
.
noonClockOutTime
)
{
res
.
data
.
noonClockOutTime
=
parseTime
(
res
.
data
.
noonClockOutTime
,
'{h}:{m
}:{s}'
)
res
.
data
.
noonClockOutTime
=
parseTime
(
new
Date
(
res
.
data
.
noonClockOutTime
),
'{h}:{i
}:{s}'
)
}
}
if
(
res
.
data
.
noonClockInTime
)
{
if
(
res
.
data
.
noonClockInTime
)
{
res
.
data
.
noonClockInTime
=
parseTime
(
res
.
data
.
noonClockInTime
,
'{h}:{m
}:{s}'
)
res
.
data
.
noonClockInTime
=
parseTime
(
new
Date
(
res
.
data
.
noonClockInTime
),
'{h}:{i
}:{s}'
)
}
}
if
(
res
.
data
.
clockOutTime
)
{
if
(
res
.
data
.
clockOutTime
)
{
res
.
data
.
clockOutTime
=
parseTime
(
res
.
data
.
clockOutTime
,
'{h}:{m
}:{s}'
)
res
.
data
.
clockOutTime
=
parseTime
(
new
Date
(
res
.
data
.
clockOutTime
),
'{h}:{i
}:{s}'
)
}
}
this
.
onWorkRecord
=
res
.
data
this
.
onWorkRecord
=
res
.
data
console
.
log
(
this
.
onWorkRecord
)
this
.
isLoading
=
false
this
.
isLoading
=
false
}
}
}
}
...
@@ -391,6 +409,7 @@ export default {
...
@@ -391,6 +409,7 @@ export default {
width
:
250rpx
;
width
:
250rpx
;
height
:
250rpx
;
height
:
250rpx
;
border-radius
:
50%
;
border-radius
:
50%
;
font-size
:
32rpx
;
}
}
::v-deep
.van-button--primary
{
::v-deep
.van-button--primary
{
...
@@ -420,9 +439,10 @@ export default {
...
@@ -420,9 +439,10 @@ export default {
align-items
:
center
;
align-items
:
center
;
color
:
white
;
color
:
white
;
flex-direction
:
column
;
flex-direction
:
column
;
font-size
:
32rpx
;
.mark_time
{
.mark_time
{
font-size
:
2
4
rpx
;
font-size
:
2
6
rpx
;
}
}
}
}
...
...
pages/login.vue
浏览文件 @
dbd687b1
...
@@ -9,27 +9,56 @@
...
@@ -9,27 +9,56 @@
<view
class=
"login-form-content"
>
<view
class=
"login-form-content"
>
<!-- 登录按钮 -->
<!-- 登录按钮 -->
<view
class=
"action-btn"
>
<view
class=
"action-btn"
>
<view
class=
"mark-btn"
@
click=
"loginMark"
v-if=
"!agreeProtocol"
></view>
<button
open-type=
"getPhoneNumber"
<button
open-type=
"getPhoneNumber"
@
getphonenumber=
"getPhoneNumber"
@
getphonenumber=
"getPhoneNumber"
class=
"login-btn cu-btn block bg-blue lg round"
>
手机号登录
</button>
class=
"login-btn cu-btn block bg-blue lg round"
>
手机号登录
</button>
</view>
</view>
<view
class=
"xieyi text-center"
>
<view
class=
"xieyi text-center"
>
<text
class=
"text-grey1"
>
登录即代表同意
</text>
<van-checkbox
:value=
"agreeProtocol"
@
change=
"agreeFn"
></van-checkbox>
<text
class=
"text-grey1"
>
阅读并同意协议
</text>
<text
@
click=
"$refs.agreementDialog.open()"
<text
@
click=
"$refs.agreementDialog.open()"
class=
"text-blue"
>
《用户协议》
</text>
class=
"text-blue"
>
《用户协议》
</text>
</view>
</view>
</view>
</view>
<uni-popup
ref=
"agreementDialog"
<uni-popup
ref=
"agreementDialog"
mask-click
type=
"dialog"
>
type=
"dialog"
>
<uni-popup-dialog
type=
"info"
<uni-popup-dialog
type=
"info"
confirmText=
"同意"
confirmText=
"同意"
:showClose=
"false"
@
confirm=
"dialogConfirm"
title=
"用户协议"
>
title=
"小卤通 小程序隐私保护指引"
>
<p>
本指引是小卤通小程序开发者 北京王小卤网络科技有限公司(以下简称“开发者”)为处理你的个人信息而制定。
</p>
<h4>
开发者处理的信息
</h4>
<p>
根据法律规定,开发者仅处理实现小程序功能所必要的信息。
</p>
<ul
class=
"agreement_ul"
>
<ul
class=
"agreement_ul"
>
<li>
1.当前小程序仅限王小卤-促销员活动上报使用
</li>
<li>
为了注册促销员账号,开发者将在获取你的明示同意后,收集你的微信昵称、头像。
</li>
<li>
2.小程序需经您同意,获取您的手机号登录当前系统
</li>
<li>
为了锁定上下班打卡地点,开发者将在获取你的明示同意后,收集你的位置信息。
</li>
<li>
3.您的手机号仅用于系统登录,领导联系"
</li>
<li>
开发者 收集你选中的照片或视频信息,用于上传推广照片。
</li>
<li>
为了拍摄推广照片,开发者将在获取你的明示同意后,访问你的摄像头。
</li>
<li>
为了使用手机号注册/登录小程序,开发者将在获取你的明示同意后,收集你的手机号。
</li>
</ul>
</ul>
<h4>
第三方插件信息/SDK信息
</h4>
<p>
关于你的个人信息,你可以通过以下方式与开发者联系,行使查阅、复制、更正、删除等法定权利。
若你在小程序中注册了账号,你可以通过以下方式与开发者联系,申请注销你在小程序中使用的账号。在受理你的申请后,开发者承诺在十五个工作日内完成核查和处理,并按照法律法规要求处理你的相关信息。
</p>
<ul
class=
"agreement_ul"
>
<li>
邮箱:liqiulin@wangxiaolu.com.cn
</li>
</ul>
<h4>
你的权益
</h4>
<p>
关于你的个人信息,你可以通过以下方式与开发者联系,行使查阅、复制、更正、删除等法定权利。
</p>
<h4>
开发者对信息的存储
</h4>
<p>
开发者将会在本指引所明示的用途内使用收集的信息
如开发者使用你的信息超出本指引目的或合理范围,开发者必须在变更使用目的或范围前,再次以小程序通知方式告知并征得你的明示同意。
</p>
<h4>
信息的使用规则
</h4>
<p>
开发者将会在本指引所明示的用途内使用收集的信息
开发者承诺,不会对外公开披露你的信息,如必须公开披露时,开发者应当向你告知公开披露的目的、披露信息的类型及可能涉及的信息,并征得你的单独同意。
</p>
<h4>
信息对外提供
</h4>
<p>
邮箱 : liqiulin@wangxiaolu.com.cn
</p>
<p>
更新日期:2025-02-26
</p>
<p>
生效日期:2025-02-26
</p>
</uni-popup-dialog>
</uni-popup-dialog>
</uni-popup>
</uni-popup>
</view>
</view>
...
@@ -43,57 +72,59 @@ import constant from '../utils/constant';
...
@@ -43,57 +72,59 @@ import constant from '../utils/constant';
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
globalConfig
:
getApp
().
globalData
.
config
globalConfig
:
getApp
().
globalData
.
config
,
agreeProtocol
:
false
}
}
},
},
methods
:
{
methods
:
{
loginMark
()
{
this
.
$modal
.
msgError
(
'请先勾选同意协议'
)
},
// 手机号登录
// 手机号登录
async
getPhoneNumber
(
e
)
{
async
getPhoneNumber
(
e
)
{
// 判断是否提供手机号
if
(
!
e
.
detail
.
code
)
{
return
this
.
$modal
.
msgError
(
"请选择手机号登录"
)
}
this
.
$modal
.
loading
(
"登录中,请耐心等待..."
)
this
.
$modal
.
loading
(
"登录中,请耐心等待..."
)
// 通过微信小程序 API 获取手机号
// 通过微信小程序 API 获取手机号
const
[
,
phoneRes
]
=
await
uni
.
request
({
const
[
err
,
{
data
:
{
phone_info
:
{
phoneNumber
}
}
}
]
=
await
uni
.
request
({
url
:
`https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=
${
getWxAccessToken
()}
`
,
url
:
`https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=
${
getWxAccessToken
()}
`
,
method
:
'POST'
,
method
:
'POST'
,
data
:
{
data
:
{
code
:
e
.
detail
.
code
code
:
e
.
detail
.
code
}
}
})
})
if
(
err
)
return
this
.
$modal
.
msgError
(
'微信 API 获取手机号出错'
)
// 调用微信登录接口,获取 openID
// 调用微信登录接口,获取 openID
const
openId
=
await
this
.
$store
.
dispatch
(
'
WxLogin
'
)
const
openId
=
await
this
.
$store
.
dispatch
(
'
getOpenId
'
)
// 调用
后台接口,判断手机号是否注册过
// 调用
自己后台登录接口
// 注册过跳转到首页打卡,否则去注册页面
const
loginRes
=
await
this
.
$store
.
dispatch
(
'Login'
,
{
phoneNumber
,
openId
})
const
res
=
await
this
.
$store
.
dispatch
(
'Login'
,
{
phoneNumber
:
phoneRes
.
data
.
phone_info
.
phoneNumber
,
openId
:
openId
}
)
storage
.
set
(
constant
.
loginPhone
,
phoneNumber
)
//
未注册过跳转到注册信息页面
//
手机号从未注册过-需要填写资料完成注册
if
(
r
es
.
code
===
3004
)
{
if
(
loginR
es
.
code
===
3004
)
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
$tab
.
reLaunch
(
'/pages/register'
)
this
.
$tab
.
reLaunch
(
'/pages/register'
)
},
1500
)
},
1500
)
}
else
{
}
else
{
// 之前注册提交过资料,直接登录成功去首页
this
.
$tab
.
reLaunch
(
'/pages/home/index'
)
this
.
$tab
.
reLaunch
(
'/pages/home/index'
)
}
}
storage
.
set
(
constant
.
loginPhone
,
phoneRes
.
data
.
phone_info
.
phoneNumber
)
this
.
$modal
.
closeLoading
()
this
.
$modal
.
closeLoading
()
},
},
fail
:
function
()
{
// 同意协议
console
.
log
(
'后端解密手机号失败'
);
dialogConfirm
()
{
this
.
agreeProtocol
=
true
},
agreeFn
(
e
)
{
this
.
agreeProtocol
=
e
.
detail
}
}
},
}
// // 登录成功后,处理函数
// async loginSuccess(result) {
// // 设置用户信息
// await this.$store.dispatch('GetInfo')
// await this.getAuth()
// this.$tab.reLaunch('/pages/home/index')
// },
// 登录成功后,开始获取各种权限
// async getAuth() {
// // 获取地址位置
// return this.$store.dispatch('GetLocation')
// }
}
}
</
script
>
</
script
>
...
@@ -109,6 +140,17 @@ page {
...
@@ -109,6 +140,17 @@ page {
}
}
}
}
.uni-popup-dialog
{
height
:
70vh
;
overflow
:
scroll
;
.uni-dialog-content
{
display
:
flex
;
flex-direction
:
column
!
important
;
}
}
.normal-login-container
{
.normal-login-container
{
width
:
100%
;
width
:
100%
;
...
@@ -130,6 +172,20 @@ page {
...
@@ -130,6 +172,20 @@ page {
margin-top
:
15%
;
margin-top
:
15%
;
width
:
80%
;
width
:
80%
;
.action-btn
{
position
:
relative
;
.mark-btn
{
position
:
absolute
;
left
:
0
;
top
:
0
;
width
:
100%
;
height
:
100%
;
background-color
:
transparent
;
z-index
:
10000
;
}
}
.input-item
{
.input-item
{
margin
:
20px
auto
;
margin
:
20px
auto
;
background-color
:
#f5f6f7
;
background-color
:
#f5f6f7
;
...
@@ -164,6 +220,8 @@ page {
...
@@ -164,6 +220,8 @@ page {
.xieyi
{
.xieyi
{
color
:
#333
;
color
:
#333
;
margin-top
:
20px
;
margin-top
:
20px
;
display
:
flex
;
justify-content
:
center
;
}
}
.login-code
{
.login-code
{
...
...
pages/register.vue
浏览文件 @
dbd687b1
...
@@ -43,14 +43,15 @@
...
@@ -43,14 +43,15 @@
</view>
</view>
</uni-forms-item>
</uni-forms-item>
<button
class=
"bg-blue register-btn"
<button
class=
"bg-blue register-btn"
@
click=
"submit('valiForm')"
>
注册完成
</button>
@
click=
"submit('valiForm')"
>
提交注册
</button>
</uni-forms>
</uni-forms>
<view
class=
"reg-info"
>
{{
phone
}}
首次注册,补充资料完成注册
</view>
</view>
</view>
</
template
>
</
template
>
<
script
>
<
script
>
import
{
mapGetters
}
from
'vuex'
import
{
uploadFile
,
submitUserInfoAPI
,
loginAPI
}
from
'../api'
import
{
uploadFile
,
submitUserInfoAPI
,
loginAPI
}
from
'../api'
import
{
v4
as
uuidv4
}
from
'uuid'
import
storage
from
'../utils/storage'
import
storage
from
'../utils/storage'
import
constant
from
'../utils/constant'
import
constant
from
'../utils/constant'
...
@@ -58,8 +59,6 @@ export default {
...
@@ -58,8 +59,6 @@ export default {
created
()
{
created
()
{
this
.
phone
=
storage
.
get
(
constant
.
loginPhone
)
this
.
phone
=
storage
.
get
(
constant
.
loginPhone
)
this
.
openId
=
storage
.
get
(
constant
.
loginOpenId
)
this
.
openId
=
storage
.
get
(
constant
.
loginOpenId
)
// this.formData.avatarUrl = this.user.avatarUrl
// this.formData.name = this.user.nickName
},
},
data
()
{
data
()
{
return
{
return
{
...
@@ -90,25 +89,24 @@ export default {
...
@@ -90,25 +89,24 @@ export default {
}
}
}
}
},
},
computed
:
{
...
mapGetters
([
'user'
])
},
methods
:
{
methods
:
{
// 选择了头像
// 选择了头像
async
chooseavatarFn
(
obj
)
{
async
chooseavatarFn
(
obj
)
{
this
.
formData
.
avatarUrl
=
await
uploadFile
(
`avatarAndIdentify/
${
this
.
phone
}
/
${
this
.
phone
}
-avatar.png`
,
obj
.
detail
.
avatarUrl
)
this
.
formData
.
avatarUrl
=
await
uploadFile
(
`avatarAndIdentify/
${
this
.
phone
}
/
${
uuidv4
()
}
-avatar.png`
,
obj
.
detail
.
avatarUrl
)
},
},
// 选择了身份证
// 选择了身份证
-正面
async
selectIdenPhotoFrontFn
(
obj
)
{
async
selectIdenPhotoFrontFn
(
obj
)
{
this
.
formData
.
idenFrontUrl
=
await
uploadFile
(
`avatarAndIdentify/
${
this
.
phone
}
/
${
this
.
phone
}
-frontId.png`
,
obj
.
tempFiles
[
0
]
.
path
)
this
.
formData
.
idenFrontUrl
=
await
uploadFile
(
`avatarAndIdentify/
${
this
.
phone
}
/
${
uuidv4
()}
-frontId.png`
,
obj
.
tempFiles
[
0
]?
.
path
)
},
},
async
selectIdenPhotoBackFn
(
obj
){
// 选择了身份证-背面
this
.
formData
.
idenBackUrl
=
await
uploadFile
(
`avatarAndIdentify/
${
this
.
phone
}
/
${
this
.
phone
}
-backId.png`
,
obj
.
tempFiles
[
0
].
path
)
async
selectIdenPhotoBackFn
(
obj
)
{
this
.
formData
.
idenBackUrl
=
await
uploadFile
(
`avatarAndIdentify/
${
this
.
phone
}
/
${
uuidv4
()}
-backId.png`
,
obj
.
tempFiles
[
0
]?.
path
)
},
},
// 注册完成
submit
(
ref
)
{
submit
(
ref
)
{
this
.
$refs
[
ref
].
validate
().
then
(
async
res
=>
{
this
.
$refs
[
ref
].
validate
().
then
(
async
res
=>
{
//
TODO: 后面需要后台提供促销员信息注册接口
//
手机号首次需要调用此接口注册-拿到后台 token(以后调用后台登录接口才能通过拿到 token)
const
result
=
await
submitUserInfoAPI
({
await
submitUserInfoAPI
({
avatarUrl
:
this
.
formData
.
avatarUrl
,
avatarUrl
:
this
.
formData
.
avatarUrl
,
openId
:
storage
.
get
(
constant
.
loginOpenId
),
openId
:
storage
.
get
(
constant
.
loginOpenId
),
name
:
this
.
formData
.
name
,
name
:
this
.
formData
.
name
,
...
@@ -125,13 +123,12 @@ export default {
...
@@ -125,13 +123,12 @@ export default {
this
.
$store
.
commit
(
'SET_TOKEN'
,
data
.
token
)
this
.
$store
.
commit
(
'SET_TOKEN'
,
data
.
token
)
this
.
$store
.
commit
(
'SET_USER'
,
data
.
user
)
this
.
$store
.
commit
(
'SET_USER'
,
data
.
user
)
uni
.
showToast
({
this
.
$modal
.
msgSuccess
(
"注册成功"
)
title
:
`注册成功`
// 申请地理位置权限
})
// await this.$store.dispatch('GetLocation')
await
this
.
$store
.
dispatch
(
'GetLocation'
)
this
.
$tab
.
switchTab
(
'/pages/home/index'
)
this
.
$tab
.
switchTab
(
'/pages/home/index'
)
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
console
.
log
(
'err'
,
err
)
;
console
.
log
(
'err'
,
err
)
})
})
}
}
}
}
...
@@ -193,8 +190,15 @@ page {
...
@@ -193,8 +190,15 @@ page {
}
}
}
}
.register-btn
{
.register-btn
{
border-radius
:
50rpx
;
border-radius
:
50rpx
;
}
}
// 注册提示信息
.reg-info
{
text-align
:
center
;
margin-top
:
30rpx
;
font-size
:
30rpx
;
}
}
}
</
style
>
</
style
>
pages/start.vue
浏览文件 @
dbd687b1
...
@@ -9,9 +9,9 @@
...
@@ -9,9 +9,9 @@
export
default
{
export
default
{
mounted
()
{
mounted
()
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
// 跳转到登录页面
this
.
$tab
.
redirectTo
(
'/pages/login'
)
this
.
$tab
.
redirectTo
(
'/pages/login'
)
},
1500
)
wx
.
hideTabBar
()
},
2000
)
}
}
}
}
</
script
>
</
script
>
...
...
pages/work/index.vue
浏览文件 @
dbd687b1
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<view
class=
"store_name"
>
{{
storeName
}}
</view>
<view
class=
"store_name"
>
{{
storeName
}}
</view>
</view>
</view>
<view
class=
"title title_back"
>
推广试吃照片(最少 4 张)
</view>
<view
class=
"title title_back"
>
推广试吃照片(最少 4 张)
</view>
<van-uploader
preview-size=
"1
70
rpx"
<van-uploader
preview-size=
"1
87.5
rpx"
name=
"img"
name=
"img"
accept=
"image"
accept=
"image"
:capture=
"['camera']"
:capture=
"['camera']"
...
@@ -12,14 +12,14 @@
...
@@ -12,14 +12,14 @@
@
after-read=
"afterTry"
@
after-read=
"afterTry"
@
delete=
"deleteTry"
/>
@
delete=
"deleteTry"
/>
<view
class=
"title title_back"
>
推广互动照片(最少 4 张)
</view>
<view
class=
"title title_back"
>
推广互动照片(最少 4 张)
</view>
<van-uploader
preview-size=
"1
70
rpx"
<van-uploader
preview-size=
"1
87.5
rpx"
accept=
"image"
accept=
"image"
:capture=
"['camera']"
:capture=
"['camera']"
:file-list=
"afterInterFileList"
:file-list=
"afterInterFileList"
@
after-read=
"afterInter"
@
after-read=
"afterInter"
@
delete=
"deleteInter"
/>
@
delete=
"deleteInter"
/>
<view
class=
"title title_back"
>
推广成交照片(最少 4 张)
</view>
<view
class=
"title title_back"
>
推广成交照片(最少 4 张)
</view>
<van-uploader
preview-size=
"1
70
rpx"
<van-uploader
preview-size=
"1
87.5
rpx"
accept=
"image"
accept=
"image"
:capture=
"['camera']"
:capture=
"['camera']"
:file-list=
"afterDealFileList"
:file-list=
"afterDealFileList"
...
@@ -50,24 +50,24 @@ export default {
...
@@ -50,24 +50,24 @@ export default {
// 获取促销员任务列表
// 获取促销员任务列表
async
getOnWorkRecordFn
()
{
async
getOnWorkRecordFn
()
{
const
res
=
await
getOnWorkRecordAPI
(
this
.
$store
.
getters
.
user
.
id
)
const
res
=
await
getOnWorkRecordAPI
(
this
.
$store
.
getters
.
user
.
id
)
this
.
storeName
=
res
.
data
.
storeName
this
.
storeName
=
res
.
data
?
.
storeName
this
.
activityReportedId
=
res
.
data
.
reportedId
// 活动上报 ID
this
.
activityReportedId
=
res
.
data
?
.
reportedId
// 活动上报 ID
},
},
// 获取推广照片列表
// 获取推广照片列表
async
getPromotionPhotoFn
()
{
async
getPromotionPhotoFn
()
{
const
res
=
await
getPromotionPhotoRecordAPI
(
this
.
$store
.
getters
.
user
.
id
)
const
res
=
await
getPromotionPhotoRecordAPI
(
this
.
$store
.
getters
.
user
.
id
)
this
.
afterTryFileList
=
res
.
data
.
tgscPhotoUrls
?.
map
(
o
=>
({
this
.
afterTryFileList
=
res
.
data
?
res
.
data
.
tgscPhotoUrls
?.
map
(
o
=>
({
url
:
o
,
url
:
o
,
type
:
'image'
type
:
'image'
}))
}))
:
[]
this
.
afterInterFileList
=
res
.
data
.
tghdPhotoUrls
?.
map
(
o
=>
({
this
.
afterInterFileList
=
res
.
data
?
res
.
data
.
tghdPhotoUrls
?.
map
(
o
=>
({
url
:
o
,
url
:
o
,
type
:
'image'
type
:
'image'
}))
}))
:
[]
this
.
afterDealFileList
=
res
.
data
.
tgcjPhotoUrls
?.
map
(
o
=>
({
this
.
afterDealFileList
=
res
.
data
?
res
.
data
.
tgcjPhotoUrls
?.
map
(
o
=>
({
url
:
o
,
url
:
o
,
type
:
'image'
type
:
'image'
}))
}))
:
[]
},
},
// 推广试吃
// 推广试吃
async
afterTry
(
event
)
{
async
afterTry
(
event
)
{
...
@@ -121,7 +121,7 @@ export default {
...
@@ -121,7 +121,7 @@ export default {
console
.
log
(
res
)
console
.
log
(
res
)
},
},
deleteTry
(
event
)
{
deleteTry
(
event
)
{
this
.
afterTryFileList
.
splice
(
event
.
detail
.
index
,
1
)
this
.
afterTryFileList
.
splice
(
event
.
detail
.
index
,
1
)
this
.
submitPhoto
()
this
.
submitPhoto
()
},
},
// 前端删除照片
// 前端删除照片
...
@@ -156,6 +156,24 @@ export default {
...
@@ -156,6 +156,24 @@ export default {
}
}
}
}
::v-deep
.van-uploader
{
width
:
100%
;
.van-uploader__wrapper
{
width
:
100%
;
.van-uploader__preview
{
margin
:
0
!
important
;
}
.van-uploader__upload
{
margin
:
0
!
important
;
}
}
}
.wrap
{
.wrap
{
background-color
:
white
;
background-color
:
white
;
min-height
:
100vh
;
min-height
:
100vh
;
...
@@ -163,14 +181,14 @@ export default {
...
@@ -163,14 +181,14 @@ export default {
flex-direction
:
column
;
flex-direction
:
column
;
.store_name
{
.store_name
{
font-size
:
30
rpx
;
font-size
:
28
rpx
;
display
:
inline-block
;
display
:
inline-block
;
color
:
#7b7b7b
;
color
:
#7b7b7b
;
padding-left
:
30rpx
;
padding-left
:
30rpx
;
}
}
.title
{
.title
{
font-size
:
2
8
rpx
;
font-size
:
2
6
rpx
;
padding
:
10px
;
padding
:
10px
;
}
}
...
...
store/modules/map.js
浏览文件 @
dbd687b1
import
storage
from
'@/utils/storage'
import
storage
from
'@/utils/storage'
import
constant
from
'@/utils/constant'
import
constant
from
'@/utils/constant'
import
{
reverseGeocoding
}
from
'@/api'
import
$modal
from
'@/plugins/modal'
import
$modal
from
'@/plugins/modal'
const
location
=
{
const
location
=
{
...
@@ -17,7 +16,7 @@ const location = {
...
@@ -17,7 +16,7 @@ const location = {
},
},
actions
:
{
actions
:
{
// 获取本机位置信息
// 获取本机位置信息
(暂时用不上了-使用腾讯 SDK 直接获取位置)
GetLocation
({
commit
})
{
GetLocation
({
commit
})
{
// getLocation 获取经纬度
// getLocation 获取经纬度
// chooseLocation 让用户在地图手选位置
// chooseLocation 让用户在地图手选位置
...
...
store/modules/user.js
浏览文件 @
dbd687b1
...
@@ -49,26 +49,29 @@ const user = {
...
@@ -49,26 +49,29 @@ const user = {
actions
:
{
actions
:
{
// 微信登录(获取 openId)
// 微信登录(获取 openId)
WxLogin
({
commit
})
{
getOpenId
({
commit
})
{
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
// 调用微信登录接口,获取一次性 code
// 调用微信登录接口,获取一次性 code
const
[,
loginRes
]
=
await
uni
.
login
({
const
[
loginErr
,
loginRes
]
=
await
uni
.
login
({
provider
:
'weixin'
provider
:
'weixin'
})
})
// 通过 code 获取永久唯一身份标识 openid
// 通过 code 获取永久唯一身份标识 openid
const
[,
openRes
]
=
await
uni
.
request
({
const
[
openErr
,
openRes
]
=
await
uni
.
request
({
url
:
`https://api.weixin.qq.com/sns/jscode2session?appid=
${
config
.
wxAppId
}
&secret=
${
config
.
wxSecret
}
&js_code=
${
loginRes
.
code
}
&grant_type=authorization_code`
url
:
`https://api.weixin.qq.com/sns/jscode2session?appid=
${
config
.
wxAppId
}
&secret=
${
config
.
wxSecret
}
&js_code=
${
loginRes
.
code
}
&grant_type=authorization_code`
});
});
commit
(
'SET_OPENID'
,
openRes
.
data
.
openid
)
if
(
loginErr
||
openErr
)
{
resolve
(
openRes
.
data
.
openid
)
reject
(
loginErr
||
openErr
)
}
else
{
commit
(
'SET_OPENID'
,
openRes
.
data
.
openid
)
resolve
(
openRes
.
data
.
openid
)
}
})
})
},
},
// 手机号+openId 促销员登录,获取 token 和个人信息
// 手机号+openId 促销员登录,获取 token 和个人信息
Login
({
commit
},
{
phoneNumber
,
openId
})
{
Login
({
commit
},
{
phoneNumber
,
openId
})
{
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
const
{
data
}
=
await
loginAPI
({
const
{
data
}
=
await
loginAPI
({
phone
:
phoneNumber
,
phone
:
phoneNumber
,
...
...
utils/common.js
浏览文件 @
dbd687b1
...
@@ -99,7 +99,10 @@ export function parseTime(time, pattern) {
...
@@ -99,7 +99,10 @@ export function parseTime(time, pattern) {
if
((
typeof
time
===
'string'
)
&&
(
/^
[
0-9
]
+$/
.
test
(
time
)))
{
if
((
typeof
time
===
'string'
)
&&
(
/^
[
0-9
]
+$/
.
test
(
time
)))
{
time
=
parseInt
(
time
)
time
=
parseInt
(
time
)
}
else
if
(
typeof
time
===
'string'
)
{
}
else
if
(
typeof
time
===
'string'
)
{
time
=
time
.
replace
(
new
RegExp
(
/-/gm
),
'/'
).
replace
(
'T'
,
' '
).
replace
(
new
RegExp
(
/
\.[\d]{3}
/gm
),
''
);
// 移除时区信息,将时间字符串转换为 UTC 时间
time
=
time
.
replace
(
'T'
,
' '
).
replace
(
/
\.\d
+
\+
00:00$/
,
''
);
date
=
new
Date
(
Date
.
UTC
(...
time
.
split
(
/
[
- :
]
/
)));
}
}
if
((
typeof
time
===
'number'
)
&&
(
time
.
toString
().
length
===
10
))
{
if
((
typeof
time
===
'number'
)
&&
(
time
.
toString
().
length
===
10
))
{
time
=
time
*
1000
time
=
time
*
1000
...
...
utils/request.js
浏览文件 @
dbd687b1
...
@@ -51,7 +51,6 @@ const request = config => {
...
@@ -51,7 +51,6 @@ const request = config => {
toast
(
msg
)
toast
(
msg
)
reject
(
'500'
)
reject
(
'500'
)
}
else
if
(
code
!==
200
)
{
}
else
if
(
code
!==
200
)
{
// toast(msg)
if
(
code
===
3017
)
{
if
(
code
===
3017
)
{
console
.
log
(
'登录状态 token 过期了'
)
console
.
log
(
'登录状态 token 过期了'
)
// 重新登录
// 重新登录
...
@@ -59,9 +58,10 @@ const request = config => {
...
@@ -59,9 +58,10 @@ const request = config => {
// 重新请求
// 重新请求
request
(
config
)
request
(
config
)
}
else
if
(
code
===
3004
)
{
}
else
if
(
code
===
3004
)
{
// 账号未注册(在登录页面有跳转判断
// 账号未注册(在登录页面有跳转判断
)
resolve
(
res
)
resolve
(
res
)
}
else
{
}
else
{
toast
(
msg
)
reject
(
code
)
reject
(
code
)
}
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论