Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
user
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hooloo
mp
user
Commits
94101c65
Commit
94101c65
authored
Aug 30, 2022
by
宋冰琦
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复部分样式效果
parent
ba44218c
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
228 additions
and
47 deletions
+228
-47
components/OrderQrCode/index.vue
+2
-1
components/Ticket/index.vue
+27
-11
components/menuAssembly/index.vue
+21
-10
components/shopCar/shopCar.vue
+43
-5
menuSubPackage/pages/goodsDetail/goodsDetail.vue
+37
-0
mineSubPackage/pages/userInfo/index.vue
+40
-8
orderSubPackage/pages/orderInfo/index.vue
+2
-1
orderSubPackage/pages/settlement/index.vue
+3
-3
pages/menu/menu.vue
+4
-7
pages/mine/mine.vue
+9
-1
request/mine/index.js
+11
-0
request/user/index.js
+29
-0
static/imgs/jiantouhui.png
+0
-0
No files found.
components/OrderQrCode/index.vue
View file @
94101c65
...
...
@@ -27,7 +27,7 @@
<view
class=
"right"
@
click=
"goShow()"
>
<view
class=
"Text"
>
<view>
查看实景演示
</view>
<image
class=
"arrow"
:style=
"
{'height':'18rpx','width':'10rpx'}" :src="'../../static/imgs/jiantouh
e
i.png'" />
<image
class=
"arrow"
:style=
"
{'height':'18rpx','width':'10rpx'}" :src="'../../static/imgs/jiantouh
u
i.png'" />
</view>
</view>
</view>
...
...
@@ -311,6 +311,7 @@ export default {
.right
{
display
:
flex
;
margin-left
:
8
rpx
;
margin-bottom
:
2
rpx
;
.Text
{
font-size
:
20
rpx
;
...
...
components/Ticket/index.vue
View file @
94101c65
...
...
@@ -4,6 +4,7 @@
<view
class=
"partOne"
>
<view
class=
"one_left"
>
<view
class=
"type"
:style=
"[typeBackground]"
>
{{
info
.
typeDesc
}}
</view>
<view
class=
"type_copy"
></view>
<view
class=
"price"
>
<view
class=
"price_box"
:style=
"[priceColor]"
v-if=
"info.couponType===1"
>
<view
class=
"num"
>
{{
info
.
price
}}
</view>
...
...
@@ -212,13 +213,26 @@ export default {
text-align
:
center
;
height
:
28
rpx
;
overflow
:
hidden
;
display
:
inline-block
;
font-size
:
20
rpx
;
font-family
:
PingFangSC-Regular
,
PingFang
SC
;
font-weight
:
400
;
background
:
var
(
--type-background
);
color
:
#FFFFFF
;
line-height
:
28
rpx
;
float
:
left
;
white-space
:
nowrap
;
}
.type_copy
{
padding
:
2
rpx
10
rpx
;
max-width
:
154
rpx
;
text-align
:
center
;
height
:
28
rpx
;
overflow
:
hidden
;
font-size
:
20
rpx
;
font-family
:
PingFangSC-Regular
,
PingFang
SC
;
font-weight
:
400
;
color
:
#FFFFFF
;
line-height
:
28
rpx
;
white-space
:
nowrap
;
}
.price
{
...
...
@@ -231,7 +245,7 @@ export default {
line-height
:
74
rpx
;
margin
:
0
auto
;
text-align
:
center
;
margin-top
:
30
rpx
;
margin-top
:
28
rpx
;
.price_box
{
...
...
@@ -283,7 +297,7 @@ export default {
font-family
:
PingFangSC-Medium
,
PingFang
SC
;
font-weight
:
500
;
color
:
var
(
color
);
line-height
:
40
rpx
;
line-height
:
38
rpx
;
white-space
:
nowrap
;
}
.time
{
...
...
@@ -344,7 +358,7 @@ export default {
margin-right
:
32
rpx
;
.more_info
{
padding-bottom
:
8
rpx
;
padding-top
:
8
rpx
;
padding-top
:
6
rpx
;
display
:
flex
;
justify-content
:
flex-start
;
align-items
:
center
;
...
...
@@ -396,8 +410,8 @@ export default {
}
.tap
{
border
:
1px
solid
#DFDFDF
;
width
:
102
rpx
;
height
:
102
rpx
;
width
:
99
rpx
;
height
:
99
rpx
;
border-radius
:
50%
;
top
:
15
rpx
;
right
:
15
rpx
;
...
...
@@ -405,11 +419,11 @@ export default {
.tap_innew
{
position
:
relative
;
border
:
1px
solid
#DFDFDF
;
width
:
8
8
rpx
;
height
:
8
8
rpx
;
width
:
8
5
rpx
;
height
:
8
5
rpx
;
border-radius
:
50%
;
top
:
7
rpx
;
left
:
7
rpx
;
left
:
5.5
rpx
;
transform
:
rotate
(
25deg
);
.text
{
width
:
100%
;
...
...
@@ -450,9 +464,10 @@ export default {
radial-gradient
(
circle
at
left
bottom
,
transparent
17
rpx
,
#FFFFFF
0
)
bottom
right
/
511
rpx
51%
no-repeat
;
filter
:
drop-shadow
(
-1px
3px
3px
rgba
(
102
,
102
,
102
,
0.1000
));
.part_top
{
margin-top
:
39
.6
rpx
;
margin-top
:
42
.6
rpx
;
margin-left
:
31.11
rpx
;
margin-right
:
30
rpx
;
line-height
:
32
rpx
;
font-size
:
20
rpx
;
font-family
:
PingFangSC-Regular
,
PingFang
SC
;
font-weight
:
400
;
...
...
@@ -460,10 +475,11 @@ export default {
}
.part_bottom
{
margin-top
:
1
6
rpx
;
margin-top
:
1
9
rpx
;
margin-left
:
31.11
rpx
;
margin-right
:
30
rpx
;
margin-bottom
:
40
rpx
;
line-height
:
32
rpx
;
font-size
:
20
rpx
;
font-family
:
PingFangSC-Regular
,
PingFang
SC
;
font-weight
:
400
;
...
...
components/menuAssembly/index.vue
View file @
94101c65
...
...
@@ -100,6 +100,8 @@ export default {
buied
(
val
)
{
if
(
val
){
this
.
heightStyle
[
'--scroll-height'
]
=
(
this
.
taBarHeight
+
122
)
+
'rpx'
this
.
initScroll
()
}
else
{
this
.
heightStyle
[
'--scroll-height'
]
=
(
this
.
taBarHeight
+
22
)
+
'rpx'
}
...
...
@@ -107,6 +109,7 @@ export default {
},
computed
:{
classifyData
(){
this
.
scrollTop
=
0
let
categorys
=
this
.
$store
.
state
.
menu
.
setMenuCategorys
.
length
!=
0
?
JSON
.
parse
(
JSON
.
stringify
(
this
.
$store
.
state
.
menu
.
setMenuCategorys
)):[]
// if(categorys.length!=0){
// const lastGood = 1
...
...
@@ -126,14 +129,7 @@ export default {
this
.
categoryId
=
categorys
[
0
].
id
;
}
}
this
.
$nextTick
(()
=>
{
const
query
=
uni
.
createSelectorQuery
().
in
(
this
);
query
.
selectAll
(
'.box'
).
boundingClientRect
(
data
=>
{
this
.
categoryPostion
=
data
}).
exec
();
})
this
.
initScroll
()
// console.log(categorys)
// categorys[0]?categorys[0].icon = 'https://s1.ax1x.com/2022/08/05/vnHQw6.jpg':''
// categorys[1]?categorys[1].icon = 'https://s1.ax1x.com/2022/08/05/vnHQw6.jpg':''
...
...
@@ -159,6 +155,20 @@ export default {
});
},
methods
:
{
initScroll
()
{
this
.
scrollLeftTop
=
0
this
.
scrollTop
=
0
const
timer
=
setTimeout
(()
=>
{
this
.
$nextTick
(()
=>
{
const
query
=
uni
.
createSelectorQuery
().
in
(
this
);
query
.
selectAll
(
'.box'
).
boundingClientRect
(
data
=>
{
console
.
log
(
data
,
'data'
)
this
.
categoryPostion
=
data
clearTimeout
(
timer
)
}).
exec
();
})
},
1000
);
},
async
imagesHeight
(
list
,
index
)
{
// return
let
i
=
0
...
...
@@ -243,7 +253,8 @@ export default {
scroll
(
e
)
{
if
(
!
this
.
scrolled
)
return
;
const
{
categoryPostion
}
=
this
;
const
[
el
]
=
categoryPostion
.
filter
(
item
=>
item
.
top
-
e
.
target
.
scrollTop
>=
20
);
const
[
el
]
=
categoryPostion
.
filter
(
item
=>
(
item
.
top
)
-
(
e
.
target
.
scrollTop
)
>=
20
);
console
.
log
(
el
,
'-------------------'
,
e
.
target
.
scrollTop
)
if
(
el
)
this
.
categoryId
=
el
.
id
},
categoryClickMain
(
id
)
{
...
...
@@ -251,7 +262,7 @@ export default {
this
.
categoryId
=
id
;
this
.
categoryPostion
.
forEach
(
item
=>
{
if
(
item
.
id
==
id
)
{
this
.
scrollTop
=
item
.
top
-
32
0
this
.
scrollTop
=
this
.
buied
?
item
.
top
-
320
:
item
.
top
-
27
0
}
});
...
...
components/shopCar/shopCar.vue
View file @
94101c65
...
...
@@ -2,7 +2,7 @@
<view
catchtouchmove=
"return"
>
<u-popup
:show=
"showShopCar && goods.length"
mode=
"bottom"
:round=
"5"
:overlay=
"true"
:closeOnClickOverlay=
"true"
@
close=
"closeT"
zIndex=
"10071"
>
<view
class=
"shop-car"
:style=
"
{'padding-bottom':
bottomPadding+'r
px'}">
<view
class=
"shop-car"
:style=
"
{'padding-bottom':
Utils.getPx(bottomPadding)+'
px'}">
<view
class=
"header"
>
<text
class=
"left"
>
购物袋
</text>
<text
class=
"right"
@
click=
"clearCar"
><text
class=
"delete-icon"
></text>
清空购物车
</text>
...
...
@@ -122,10 +122,11 @@ export default {
},
mounted
()
{
this
.
animation
=
uni
.
createAnimation
()
this
.
BottomSafeHeight
=
uni
.
getStorageSync
(
'BottomSafeHeight'
)
||
10
this
.
bottomPadding
=
this
.
BottomSafeHeight
+
132
this
.
BottomSafeHeight
=
uni
.
getStorageSync
(
'BottomSafeHeight'
)
||
50
console
.
log
(
this
.
BottomSafeHeight
,
'this.BottomSafeHeight'
)
this
.
bottomPadding
=
205
this
.
shopCar
=
uni
.
getStorageSync
(
'shopCar'
)
this
.
shopCar
=
uni
.
getStorageSync
(
'shopCar'
)
+
4
if
(
!
this
.
userms
){
User
.
wxLoginAndGetOpenid
(
true
).
then
(
loginInfo
=>
{
this
.
loginInfo
=
loginInfo
...
...
@@ -175,6 +176,7 @@ export default {
},
//跳转到结算
saveReserve
(
e
)
{
const
settleMentFunc
=
()
=>
{
if
(
this
.
totalPrice
<
0
||
this
.
totalNum
<=
0
)
{
this
.
showToast
({
title
:
'请选择商品'
,
icon
:
'error'
})
return
;
...
...
@@ -191,6 +193,42 @@ export default {
}
}
return
;
}
uni
.
authorize
({
scope
:
'scope.userLocation'
,
success
:
()
=>
{
//1.1 允许授权
console
.
log
(
"允许授权位置"
);
settleMentFunc
()
},
fail
:
(
err
)
=>
{
//1.2 拒绝授权
wx
.
exitMiniProgram
({
success
:
(
res
)
=>
{
}
})
console
.
log
(
"获取位置失败"
)
uni
.
showModal
({
content
:
'检测到您没打开地理位置权限,是否去设置打开?'
,
confirmText
:
"确认"
,
cancelText
:
'取消'
,
success
:
(
res
)
=>
{
if
(
res
.
confirm
)
{
uni
.
openSetting
({
//opensetting是调起设置页面的
success
:
(
res
)
=>
{
console
.
log
(
res
)
if
(
res
.
authSetting
[
'scope.userLocation'
]
==
true
){
//判断res.authsetting的值是true还是false
settleMentFunc
()
}
else
{
// console.log("什么也不做");
}
}
})
}
else
{
console
.
log
(
'取消'
);
return
false
;
}
}
})
}
})
return
},
// 付款前未登录发起授权
loginByPhoneNumber
(
e
)
{
...
...
@@ -307,7 +345,7 @@ export default {
flex-direction
:
column
;
.header
{
padding
:
24.87
rpx
31.78
rpx
22.3
rpx
31.54
rpx
;
padding
:
35
rpx
31.78
rpx
35
rpx
31.54
rpx
;
display
:
flex
;
border-bottom
:
0.1px
solid
#F4F4F4
;
...
...
menuSubPackage/pages/goodsDetail/goodsDetail.vue
View file @
94101c65
...
...
@@ -326,6 +326,7 @@ export default {
}
},
async
getallNum
(
e
)
{
const
settleMentFunc
=
async
()
=>
{
let
Authorization
=
uni
.
getStorageSync
(
'Authorization'
);
if
(
!
Authorization
)
{
this
.
loginByPhoneNumber
(
e
);
...
...
@@ -353,6 +354,42 @@ export default {
Utils
.
addGoods
(
goods
)
uni
.
navigateTo
({
url
:
`/orderSubPackage/pages/settlement/index?buyType=1&goodsList=1`
})
}
}
uni
.
authorize
({
scope
:
'scope.userLocation'
,
success
:
()
=>
{
//1.1 允许授权
console
.
log
(
"允许授权位置"
);
settleMentFunc
()
},
fail
:
(
err
)
=>
{
//1.2 拒绝授权
wx
.
exitMiniProgram
({
success
:
(
res
)
=>
{
}
})
console
.
log
(
"获取位置失败"
)
uni
.
showModal
({
content
:
'检测到您没打开地理位置权限,是否去设置打开?'
,
confirmText
:
"确认"
,
cancelText
:
'取消'
,
success
:
(
res
)
=>
{
if
(
res
.
confirm
)
{
uni
.
openSetting
({
//opensetting是调起设置页面的
success
:
(
res
)
=>
{
console
.
log
(
res
)
if
(
res
.
authSetting
[
'scope.userLocation'
]
==
true
){
//判断res.authsetting的值是true还是false
settleMentFunc
()
}
else
{
// console.log("什么也不做");
}
}
})
}
else
{
console
.
log
(
'取消'
);
return
false
;
}
}
})
}
})
return
},
async
getMenuList
()
{
const
shopId
=
uni
.
getStorageSync
(
'shopData'
).
id
...
...
mineSubPackage/pages/userInfo/index.vue
View file @
94101c65
...
...
@@ -6,7 +6,7 @@
</view>
<view
class=
"page"
:style=
"
{'padding-top':(systemBarHeight.statusBarHeight+systemBarHeight.navigationBarHeight)+'px'}">
<view
class=
"avatarBox"
>
<image
class=
"avatar"
:src=
"userInfo.avatarUrl"
/>
<image
class=
"avatar"
@
click=
"editAvatar"
:src=
"userInfo.avatarUrl"
/>
</view>
<view
class=
"infoBox"
>
<view
class=
"infoItem name"
>
...
...
@@ -150,6 +150,7 @@ export default {
},
async
onLoad
(
option
)
{
const
{
info
}
=
option
if
(
info
){
const
{
avatarUrl
,
gender
=
0
,
nickName
=
'点点'
}
=
info
?
JSON
.
parse
(
decodeURIComponent
(
info
)):{}
const
{
data
}
=
await
Mine
.
getUserInfo
()
const
{
birthday
,
createTime
,
id
,
phone
,
sex
,
userName
}
=
data
.
data
...
...
@@ -169,9 +170,20 @@ export default {
const
{...
result
}
=
this
.
userInfoStorage
const
sendData
=
{
...
result
,
avatarUrl
avatarUrl
:
''
,
canEditBirthday
:
this
.
canEditBirthday
}
Store
.
commit
(
'setUserInfo'
,
sendData
);
}
else
{
const
{
avatarUrl
,
birthday
,
id
,
phone
,
sex
,
customerName
,
canEditBirthday
}
=
this
.
userInfoStorage
this
.
canEditBirthday
=
canEditBirthday
this
.
userInfo
.
avatarUrl
=
avatarUrl
this
.
userInfo
.
sex
=
sex
?
1
:
0
this
.
userInfo
.
name
=
customerName
this
.
userInfo
.
birthday
=
birthday
this
.
userInfo
.
id
=
id
this
.
userInfo
.
phone
=
phone
}
},
methods
:{
...
...
@@ -189,6 +201,20 @@ export default {
}
this
.
timerShow
=
false
},
editAvatar
(
e
)
{
wx
.
getUserProfile
({
desc
:
'用于完善用户资料'
,
success
:(
res
)
=>
{
const
{
userInfo
}
=
res
const
Info
=
{
avatarUrl
:
userInfo
.
avatarUrl
,
nickName
:
userInfo
.
nickName
}
this
.
userInfo
.
avatarUrl
=
Info
.
avatarUrl
this
.
userInfo
.
name
=
Info
.
nickName
}
})
},
openTimer
()
{
this
.
birthdayModalShow
=
false
this
.
timerShow
=
true
...
...
@@ -217,17 +243,23 @@ export default {
id
}
console
.
log
(
sendData
)
await
Mine
.
editUserAvatar
({
avatarUrl
:
avatarUrl
,
id
})
const
{
data
}
=
await
Mine
.
editUserInfo
(
sendData
)
const
{
code
=
0
}
=
data
if
(
code
===
200
){
const
data
=
{
...
result
,
customerName
:
name
,
avatarUrl
avatarUrl
,
canEditBirthday
:
this
.
canEditBirthday
,
sex
}
Store
.
commit
(
'setUserInfo'
,
data
);
uni
.
setStorage
({
key
:
'userInfo'
,
data
:
data
});
this
.
showToast
({
title
:
'保存成功'
})
wx
.
navigateBack
({
delta
:
1
});
}
}
}
...
...
@@ -391,7 +423,7 @@ export default {
.saveBtn
{
width
:
670
rpx
;
height
:
9
6
rpx
;
height
:
9
8
rpx
;
margin
:
0
auto
;
margin-top
:
32
rpx
;
...
...
@@ -399,8 +431,8 @@ export default {
background
:
#0050F6
;
border-radius
:
2px
;
font-size
:
32
rpx
;
height
:
9
6
rpx
;
line-height
:
9
6
rpx
;
height
:
9
8
rpx
;
line-height
:
9
8
rpx
;
font-family
:
PingFangSC-Regular
,
PingFang
SC
;
font-weight
:
400
;
color
:
#FFFFFF
;
...
...
@@ -409,8 +441,8 @@ export default {
background
:
#0050F6
;
border-radius
:
2px
;
font-size
:
32
rpx
;
height
:
9
6
rpx
;
line-height
:
9
6
rpx
;
height
:
9
8
rpx
;
line-height
:
9
8
rpx
;
font-family
:
PingFangSC-Regular
,
PingFang
SC
;
font-weight
:
400
;
color
:
#FFFFFF
;
...
...
orderSubPackage/pages/orderInfo/index.vue
View file @
94101c65
...
...
@@ -41,7 +41,7 @@
<view
class=
"right"
@
click=
"goShow()"
>
<view
class=
"Text"
>
<view>
查看实景演示
</view>
<image
class=
"arrow"
:style=
"
{'height':'18rpx','width':'10rpx'}" :src="'../../../static/imgs/jiantouh
e
i.png'" />
<image
class=
"arrow"
:style=
"
{'height':'18rpx','width':'10rpx'}" :src="'../../../static/imgs/jiantouh
u
i.png'" />
</view>
</view>
</view>
...
...
@@ -595,6 +595,7 @@ export default {
.right
{
display
:
flex
;
margin-left
:
8
rpx
;
margin-bottom
:
1
rpx
;
.Text
{
font-size
:
20
rpx
;
...
...
orderSubPackage/pages/settlement/index.vue
View file @
94101c65
...
...
@@ -175,7 +175,7 @@ export default {
const
{
q
}
=
option
;
// console.log(q);
if
(
q
)
{
console
.
log
(
'扫码进入'
)
console
.
log
(
'扫码进入'
,
q
)
uni
.
setStorageSync
(
"selectFlag"
,
false
)
this
.
getMessageFlag
()
this
.
saveGetTicket
()
...
...
@@ -481,8 +481,8 @@ export default {
}
else
{
list
=
uni
.
getStorageSync
(
'goodsList'
).
filter
((
v
)
=>
v
.
flag
==
true
);
}
const
shopInfo
=
uni
.
getStorageSync
(
'shopData'
)
const
{
lat
,
lng
}
=
shopInfo
const
location
=
uni
.
getStorageSync
(
"location"
)
const
{
lat
,
lng
}
=
location
// sendMsgFlag1:下单成功通知
// sendMsgFlag2:订单状态变更通知
// sendMsgFlag3:取餐提醒
...
...
pages/menu/menu.vue
View file @
94101c65
...
...
@@ -172,7 +172,6 @@ export default {
},
methods
:
{
getShopMenus
(
params
)
{
$EventBus
.
$off
(
'getMenuList'
);
$EventBus
.
$on
(
'getMenuList'
,
(
data
)
=>
{
if
(
this
.
shopInfo
&&
this
.
shopInfo
.
id
!=
data
.
id
)
{
...
...
@@ -185,16 +184,14 @@ export default {
this
.
getMenuList
(
data
.
id
);
this
.
getHomeOrder
(
data
.
id
)
// 判断店铺是否在范围内
const
location
=
uni
.
getStorageSync
(
"location"
)
const
shopInfo
=
uni
.
getStorageSync
(
"shopInfo"
)
const
{
lat
:
latloc
,
lng
:
lngloc
}
=
location
const
{
lat
:
latshop
,
lng
:
lngshop
,
distanceLimit
}
=
JSON
.
parse
(
shopInfo
)
const
distance
=
Utils
.
getDistances
(
latloc
,
lngloc
,
latshop
,
lngshop
)
const
{
distanceLimit
,
realDistance
}
=
JSON
.
parse
(
shopInfo
)
const
distance
=
realDistance
/
1000
if
(
!
distanceLimit
){
this
.
isInRange
=
true
}
else
{
console
.
log
(
parseInt
(
distance
.
distance_str
)
<
parseInt
(
distanceLimit
))
this
.
isInRange
=
parseInt
(
distance
.
distance_str
)
<
parseInt
(
distanceLimit
)
console
.
log
(
parseInt
(
distance
),
parseInt
(
distanceLimit
),
JSON
.
parse
(
shopInfo
))
this
.
isInRange
=
parseInt
(
distance
)
<
parseInt
(
distanceLimit
)
}
uni
.
setStorageSync
(
"isInRange"
,
this
.
isInRange
)
});
...
...
pages/mine/mine.vue
View file @
94101c65
...
...
@@ -134,7 +134,11 @@ export default {
getPhoneNumber
(
e
)
{
if
(
e
.
detail
.
errMsg
==
'getPhoneNumber:ok'
)
{
e
.
loginInfo
=
this
.
loginInfo
User
.
getPhoneNumber
(
e
);
User
.
getPhoneNumber
(
e
,
async
()
=>
{
const
{
data
:
couponData
}
=
await
User
.
getCouponNum
()
this
.
tickNum
=
couponData
?.
data
||
0
});
}
else
if
(
e
.
detail
.
errMsg
==
"getPhoneNumber:fail user deny"
)
{
this
.
showToast
({
title
:
'已拒绝手机号授权'
,
icon
:
'error'
})
}
...
...
@@ -148,6 +152,9 @@ export default {
page
==
'order'
&&
uni
.
switchTab
({
url
:
'/pages/order/order'
})
page
==
'msg'
&&
uni
.
navigateTo
({
url
:
'/mineSubPackage/pages/msg/index'
})
if
(
page
==
'userInfo'
){
if
(
this
.
userInfo
.
avatarUrl
){
uni
.
navigateTo
({
url
:
'/mineSubPackage/pages/userInfo/index'
})
}
else
{
wx
.
getUserProfile
({
desc
:
'用于完善用户资料'
,
success
:(
res
)
=>
{
...
...
@@ -164,6 +171,7 @@ export default {
}
}
}
}
}
</
script
>
...
...
request/mine/index.js
View file @
94101c65
...
...
@@ -75,5 +75,16 @@ export default {
.
catch
((
err
)
=>
{
context
.
showToast
({
title
:
'服务器错误'
,
icon
:
'none'
});
});
},
// 更改用户头像
editUserAvatar
(
data
)
{
return
uni
.
$u
.
http
.
post
(
`/system/customer/update/avatar-url`
,
data
)
.
then
((
res
)
=>
{
return
res
;
})
.
catch
((
err
)
=>
{
context
.
showToast
({
title
:
'服务器错误'
,
icon
:
'none'
});
});
}
};
request/user/index.js
View file @
94101c65
...
...
@@ -136,6 +136,34 @@ export default {
}
})
},
// 获取用户信息
getUserInfo
(
data
)
{
return
uni
.
$u
.
http
.
get
(
`/system/customer/detail`
,
{})
.
then
((
res
)
=>
{
console
.
log
(
res
,
data
)
const
{
birthday
,
createTime
,
id
,
phone
,
sex
,
userName
,
avatarUrl
}
=
res
.
data
.
data
const
sendData
=
{
...
data
,
avatarUrl
:
avatarUrl
,
sex
:
sex
?
1
:
0
,
customerName
:
userName
,
phone
:
phone
.
substr
(
0
,
3
)
+
"****"
+
phone
.
substr
(
7
),
id
:
id
}
if
(
!
birthday
){
sendData
.
canEditBirthday
=
true
sendData
.
birthday
=
new
Date
(
createTime
.
replace
(
/-/g
,
'/'
)).
valueOf
()
}
else
{
sendData
.
canEditBirthday
=
false
sendData
.
birthday
=
Date
.
parse
(
birthday
)
}
Store
.
commit
(
'setUserInfo'
,
sendData
);
})
.
catch
((
err
)
=>
{
context
.
showToast
({
title
:
'服务器错误'
,
icon
:
'none'
});
});
},
onLogin
(
loginInfo
,
iv
,
data
,
callback
)
{
this
.
loginDecrypt
({
loginInfo
:
JSON
.
parse
(
loginInfo
),
iv
,
data
}).
then
(
res
=>
{
const
{
statusCode
,
data
}
=
res
;
...
...
@@ -146,6 +174,7 @@ export default {
uni
.
setStorage
({
key
:
'userInfo'
,
data
:
data
});
Store
.
commit
(
'setUserInfo'
,
data
);
Store
.
commit
(
'setAuthorization'
,
token
);
this
.
getUserInfo
(
data
)
if
(
callback
)
return
callback
();
}
...
...
static/imgs/jiantouhui.png
0 → 100644
View file @
94101c65
832 Bytes
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment