Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
L
learn-online
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
learn-online
Commits
d4406440
提交
d4406440
authored
12月 01, 2020
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修复修改密码成功没有提示的问题;修复消息已读未读状态错误的问题;
上级
de0d539f
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
32 行增加
和
12 行删除
+32
-12
MsgApi.js
learnOnline/apiService/MsgApi.js
+14
-3
message.js
learnOnline/pages/learnSystem/message/message.js
+7
-4
message.wxml
learnOnline/pages/learnSystem/message/message.wxml
+1
-1
password.js
learnOnline/pages/login/password.js
+10
-4
没有找到文件。
learnOnline/apiService/MsgApi.js
浏览文件 @
d4406440
...
...
@@ -4,14 +4,14 @@ const util = require('../utils/util.js')
*/
/* 获取我的消息信息 */
const
getMyMsg
=
(
callback
)
=>
{
const
getMyMsg
=
callback
=>
{
util
.
requestApi
({
url
:
util
.
config
.
URL_PATH1
+
'/v2/education/message/my'
,
callback
:
function
(
res
)
{
let
list
=
Array
.
isArray
(
res
.
data
)
?
res
.
data
:
res
.
data
.
list
||
[]
let
json
=
list
.
map
(
function
(
_
,
i
)
{
return
{
isRead
:
false
,
isRead
:
_
.
status
===
1
,
id
:
_
.
id
,
text
:
_
.
message_body
,
time
:
_
.
created_time
,
...
...
@@ -22,6 +22,17 @@ const getMyMsg = (callback) => {
}
})
}
// 读消息
const
readMessage
=
(
messageId
,
callback
)
=>
{
util
.
requestApi
({
url
:
util
.
config
.
URL_PATH1
+
`/v2/education/message/
${
messageId
}
`
,
method
:
'POST'
,
callback
:
function
(
res
)
{
callback
(
res
.
data
)
}
})
}
module
.
exports
=
{
getMyMsg
:
getMyMsg
getMyMsg
:
getMyMsg
,
readMessage
}
learnOnline/pages/learnSystem/message/message.js
浏览文件 @
d4406440
...
...
@@ -21,7 +21,7 @@ Page({
*/
onLoad
:
function
(
options
)
{
wx
.
showLoading
({
title
:
'页面加载中...'
,
mask
:
true
})
MsgApi
.
getMyMsg
(
(
json
)
=>
{
MsgApi
.
getMyMsg
(
json
=>
{
this
.
setData
({
msgList
:
json
})
wx
.
hideLoading
()
})
...
...
@@ -49,7 +49,7 @@ Page({
// 显示顶部刷新图标
wx
.
showNavigationBarLoading
()
wx
.
showLoading
({
title
:
'更新中...'
,
mask
:
true
})
MsgApi
.
getMyMsg
(
(
json
)
=>
{
MsgApi
.
getMyMsg
(
json
=>
{
this
.
setData
({
msgList
:
json
.
list
})
wx
.
hideLoading
()
// 隐藏导航栏加载框
...
...
@@ -70,10 +70,14 @@ Page({
* 是否可以打开查看消息
*/
canishow
:
function
(
e
)
{
let
i
=
e
.
currentTarget
.
dataset
.
index
const
{
index
:
i
,
id
}
=
e
.
currentTarget
.
dataset
let
cname
=
'msgList['
+
i
+
'].isShow'
this
.
setData
({
[
cname
]:
!
this
.
data
.
msgList
[
i
].
isShow
})
cname
=
'msgList['
+
i
+
'].isRead'
!
this
.
data
.
msgList
[
i
].
isRead
&&
MsgApi
.
readMessage
(
id
,
res
=>
{
console
.
log
(
res
)
})
this
.
setData
({
[
cname
]:
true
})
/* 如果需要,再调用已读接口 */
},
...
...
@@ -81,7 +85,6 @@ Page({
* 滚动到底部,加载更多数据
*/
loadmore
:
function
()
{
let
_that
=
this
wx
.
showLoading
({
title
:
'数据加载中...'
,
mask
:
true
})
setTimeout
(
function
()
{
wx
.
showToast
({
title
:
'没有更多了'
,
icon
:
'none'
})
...
...
learnOnline/pages/learnSystem/message/message.wxml
浏览文件 @
d4406440
<!--pages/learnSystem/message/message.wxml-->
<scroll-view class='msg-scroll' scroll-y bindscrolltolower="loadmore">
<block wx:for='{{msgList}}' wx:key='{{index}}'>
<view class='item-msg' bindtap='canishow' data-index='{{index}}'>
<view class='item-msg' bindtap='canishow' data-index='{{index}}'
data-id="{{item.id}}"
>
<view class='flag {{item.isRead ? "read" : ""}}'>{{item.isRead ? '已读' : 'new'}}</view>
<rich-text class='text {{item.isShow ? "" : "on"}}' nodes="{{item.text}}"></rich-text>
<view class='ellipsis {{item.isShow ? "on" : ""}}'>....</view>
...
...
learnOnline/pages/login/password.js
浏览文件 @
d4406440
...
...
@@ -36,16 +36,22 @@ Page({
},
// 修改成功
handleSuccess
(
data
)
{
wx
.
setStorage
({
key
:
'token'
,
data
:
data
.
TGC
})
wx
.
switchTab
({
url
:
'/pages/learnSystem/home/home'
})
wx
.
showModal
({
content
:
'密码修改成功'
,
showCancel
:
false
,
confirmText
:
'去登录'
,
success
(
res
)
{
wx
.
navigateTo
({
url
:
'/pages/login/index'
})
}
})
},
// 发送验证码
handleSendCode
()
{
if
(
this
.
data
.
disabled
)
{
return
}
if
(
!
/^1
[
3-9
][
0-9
]{9}
$/
.
test
(
this
.
data
.
account
))
{
wx
.
showToast
({
title
:
'请输入手机号'
,
icon
:
'none'
})
if
(
!
(
/^1
[
3-9
]\d{9}
$/
.
test
(
this
.
data
.
account
)
||
/@/
.
test
(
this
.
data
.
account
)
))
{
wx
.
showToast
({
title
:
'请输入
邮箱或
手机号'
,
icon
:
'none'
})
return
}
this
.
handleSendCodeRequest
()
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论