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
e23f1624
Commit
e23f1624
authored
Jun 11, 2022
by
songbingqi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复我的页面未读消息的展示
parent
0eef35e2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
8 deletions
+48
-8
pages/mine/mine.vue
+35
-4
request/mine/index.js
+10
-0
request/user/index.js
+3
-4
No files found.
pages/mine/mine.vue
View file @
e23f1624
...
...
@@ -40,7 +40,8 @@
<h3>
我的消息
</h3>
<view
class=
"dec"
>
点击查看我的消息
</view>
</view>
<view
@
click=
"goToPage('msg')"
class=
"right"
>
<view
@
click=
"goToPage('msg')"
class=
"right msg"
>
<div
class=
"unread_number"
v-if=
"UnreadNumber"
>
{{
UnreadNumber
}}
</div>
<image
class=
"right_img"
src=
"../../static/imgs/myMail.png"
></image>
</view>
</view>
...
...
@@ -60,6 +61,7 @@
<
script
>
import
User
from
'@/request/user'
import
Mine
from
'@/request/mine'
export
default
{
onLoad
()
{
...
...
@@ -69,9 +71,15 @@ export default {
})
}
},
onShow
()
{
if
(
this
.
userms
){
this
.
getMessageCount
()
}
},
data
()
{
return
{
loginInfo
:
""
loginInfo
:
""
,
UnreadNumber
:
""
}
},
computed
:
{
...
...
@@ -88,19 +96,24 @@ export default {
getPhoneNumber
(
e
)
{
if
(
e
.
detail
.
errMsg
==
'getPhoneNumber:ok'
)
{
e
.
loginInfo
=
this
.
loginInfo
User
.
getPhoneNumber
(
e
);
User
.
getPhoneNumber
(
e
,
this
.
getMessageCount
);
}
else
if
(
e
.
detail
.
errMsg
==
"getPhoneNumber:fail user deny"
)
{
uni
.
showToast
({
title
:
'已拒绝手机号授权'
,
icon
:
'error'
})
}
},
goToPage
(
page
)
{
if
(
!
this
.
userms
)
{
this
.
loginBy
PhoneNumber
(
page
)
this
.
get
PhoneNumber
(
page
)
return
}
page
==
'order'
&&
uni
.
switchTab
({
url
:
'/pages/order/order'
})
page
==
'coupon'
&&
uni
.
showToast
({
title
:
'功能未开放!'
,
icon
:
'none'
});
page
==
'msg'
&&
uni
.
navigateTo
({
url
:
'/mineSubPackage/pages/msg/index'
})
},
async
getMessageCount
()
{
const
{
data
}
=
await
Mine
.
getMessageCount
()
const
num
=
data
?
data
.
data
:
''
this
.
UnreadNumber
=
num
}
}
}
...
...
@@ -239,6 +252,24 @@ export default {
&.two
{
margin-top
:
15
rpx
;
.msg{
position
:
relative
;
.unread_number{
background-color
:
#ff73bf
;
width
:
25
rpx
;
height
:
25
rpx
;
font-size
:
15
rpx
;
color
:
white
;
line-height
:
25
rpx
;
text-align
:
center
;
border-radius
:
25
rpx
;
font-weight
:
bolder
;
position
:
absolute
;
right
:
-10
rpx
;
top
:
-10
rpx
;
}
}
}
.left
{
...
...
request/mine/index.js
View file @
e23f1624
...
...
@@ -20,4 +20,14 @@ export default {
uni
.
showToast
({
title
:
'服务器错误'
,
icon
:
'none'
});
});
},
getMessageCount
()
{
return
uni
.
$u
.
http
.
get
(
'/app/getMessageCount'
,
{})
.
then
((
res
)
=>
{
return
res
;
})
.
catch
((
err
)
=>
{
uni
.
showToast
({
title
:
'服务器错误'
,
icon
:
'none'
});
});
}
};
request/user/index.js
View file @
e23f1624
...
...
@@ -123,17 +123,16 @@ export default {
const
data
=
res
.
detail
.
encryptedData
wx
.
checkSession
({
success
:
(
res
)
=>
{
console
.
log
(
'seeon未过期'
)
console
.
log
(
'see
i
on未过期'
)
this
.
onLogin
(
loginInfo
,
iv
,
data
,
callback
)
},
fail
:
(
res
)
=>
{
console
.
log
(
'seeon已过期'
)
console
.
log
(
'see
i
on已过期'
)
this
.
wxLoginAndGetOpenid
(
true
).
then
(
loginInfo
=>
{
this
.
onLogin
(
loginInfo
,
iv
,
data
,
callback
)
})
}
})
// this.uniLogin(res.detail, callback);
},
onLogin
(
loginInfo
,
iv
,
data
,
callback
)
{
this
.
loginDecrypt
({
loginInfo
:
JSON
.
parse
(
loginInfo
),
iv
,
data
}).
then
(
res
=>
{
...
...
@@ -146,7 +145,7 @@ export default {
Store
.
commit
(
'setUserInfo'
,
data
);
Store
.
commit
(
'setAuthorization'
,
token
);
if
(
callback
)
callback
();
return
callback
();
}
}).
catch
((
err
)
=>
{
uni
.
showToast
({
...
...
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