Commit f8fa8239699e65624275133110bd4b47a60d2354
1 parent
a94ef64ba6
Exists in
dev_wjl
and in
1 other branch
fleat:消息通知开发完成
Showing 18 changed files with 630 additions and 45 deletions
- littleApp_child/app.js
- littleApp_child/app.json
- littleApp_child/packageA/pages/messageContent/messageContent.js
- littleApp_child/packageA/pages/messageContent/messageContent.json
- littleApp_child/packageA/pages/messageContent/messageContent.wxml
- littleApp_child/packageA/pages/messageContent/messageContent.wxss
- littleApp_child/packageA/pages/messageNotification/messageNotification.js
- littleApp_child/packageA/pages/messageNotification/messageNotification.json
- littleApp_child/packageA/pages/messageNotification/messageNotification.wxml
- littleApp_child/packageA/pages/messageNotification/messageNotification.wxss
- littleApp_child/pages/chatHis/chatHis.js
- littleApp_child/pages/home/home.js
- littleApp_child/pages/home/home.wxml
- littleApp_child/pages/home/home.wxss
- littleApp_child/pages/login/login.js
- littleApp_child/source/xiaox.png
- littleApp_child/utils/apiFile.js
- littleApp_child/utils/network_util.js
littleApp_child/app.js
View file @
f8fa823
... | ... | @@ -25,7 +25,7 @@ |
25 | 25 | this.globalData.token = userToken |
26 | 26 | this.globalData.userId = userId |
27 | 27 | this.globalData.currentId = userId[0] |
28 | - console.log(userToken) | |
28 | + // console.log(userToken) | |
29 | 29 | |
30 | 30 | // wx.navigateTo({ |
31 | 31 | // url: 'pages/BloodSugerHome/BloodSugerHome' |
32 | 32 | |
... | ... | @@ -67,13 +67,13 @@ |
67 | 67 | //聊天 |
68 | 68 | WebIM.conn.listen({ |
69 | 69 | onOpened: function (message) { |
70 | - console.log("登录成功") | |
70 | + // console.log("登录成功") | |
71 | 71 | wx.setStorageSync('isHxOpend', true) |
72 | 72 | // WebIM.conn.setPresence() |
73 | 73 | // WebIM.conn.getRoster(rosters) |
74 | 74 | }, |
75 | 75 | onPresence: function (message) { |
76 | - console.log('onPresence', message) | |
76 | + // console.log('onPresence', message) | |
77 | 77 | var pages = getCurrentPages() |
78 | 78 | if (message.type == "unsubscribe") { |
79 | 79 | pages[0].moveFriend(message) |
... | ... | @@ -98,7 +98,7 @@ |
98 | 98 | // } |
99 | 99 | }, |
100 | 100 | onTextMessage(message){ |
101 | - console.log("onTextMessage", message); | |
101 | + // console.log("onTextMessage", message); | |
102 | 102 | var page = that.getRoomPage(); |
103 | 103 | if(message){ |
104 | 104 | if(onMessageError(message)){ |
105 | 105 | |
106 | 106 | |
... | ... | @@ -133,17 +133,17 @@ |
133 | 133 | key: messageFrom + myName, |
134 | 134 | data: that.globalData.unrederMsg[messageFrom + myName], |
135 | 135 | success: function () { |
136 | - console.log('setStorage success') | |
136 | + // console.log('setStorage success') | |
137 | 137 | disp.fire("em.xmpp.unreadspot", message); |
138 | 138 | } |
139 | 139 | }) |
140 | - console.log('消息打印',messageFrom + myName,that.globalData.unrederMsg[messageFrom + myName]) | |
140 | + // console.log('消息打印',messageFrom + myName,that.globalData.unrederMsg[messageFrom + myName]) | |
141 | 141 | } |
142 | 142 | } |
143 | 143 | } |
144 | 144 | }, |
145 | 145 | onEmojiMessage: function (message) { |
146 | - console.log("onEmojiMessage", message); | |
146 | + // console.log("onEmojiMessage", message); | |
147 | 147 | if(message){ |
148 | 148 | if(onMessageError(message)){ |
149 | 149 | msgStorage.saveReceiveMsg(message, msgType.EMOJI); |
... | ... | @@ -151,7 +151,7 @@ |
151 | 151 | } |
152 | 152 | }, |
153 | 153 | onPictureMessage(message){ |
154 | - console.log("onPictureMessage", message); | |
154 | + // console.log("onPictureMessage", message); | |
155 | 155 | var page = that.getRoomPage() |
156 | 156 | if(message){ |
157 | 157 | if(onMessageError(message)){ |
... | ... | @@ -186,7 +186,7 @@ |
186 | 186 | key: messageFrom + myName, |
187 | 187 | data: that.globalData.unrederMsg[messageFrom + myName], |
188 | 188 | success: function () { |
189 | - console.log('setStorage success') | |
189 | + // console.log('setStorage success') | |
190 | 190 | disp.fire("em.xmpp.unreadspot", message); |
191 | 191 | } |
192 | 192 | }) |
... | ... | @@ -195,7 +195,7 @@ |
195 | 195 | } |
196 | 196 | }, |
197 | 197 | onAudioMessage: function ( message ) { |
198 | - console.log("onAudioMessage", message); | |
198 | + // console.log("onAudioMessage", message); | |
199 | 199 | var page = that.getRoomPage() |
200 | 200 | if(message){ |
201 | 201 | if(onMessageError(message)){ |
... | ... | @@ -232,7 +232,7 @@ |
232 | 232 | key: messageFrom + myName, |
233 | 233 | data: that.globalData.unrederMsg[messageFrom+ myName], |
234 | 234 | success: function () { |
235 | - console.log('setStorage success') | |
235 | + // console.log('setStorage success') | |
236 | 236 | disp.fire("em.xmpp.unreadspot", message); |
237 | 237 | } |
238 | 238 | }) |
... | ... | @@ -242,7 +242,7 @@ |
242 | 242 | }, |
243 | 243 | // 各种异常 |
244 | 244 | onError(error){ |
245 | - console.log(error) | |
245 | + // console.log(error) | |
246 | 246 | // 16: server-side close the websocket connection |
247 | 247 | if(error.type == WebIM.statusCode.WEBIM_CONNCTION_DISCONNECTED && !logout){ |
248 | 248 | if(WebIM.conn.autoReconnectNumTotal < WebIM.conn.autoReconnectNumMax){ |
... | ... | @@ -282,7 +282,7 @@ |
282 | 282 | disp.fire("em.xmpp.error.tokenErr"); |
283 | 283 | } |
284 | 284 | if (error.type == 'socket_error') {///sendMsgError |
285 | - console.log('socket_errorsocket_error', error) | |
285 | + // console.log('socket_errorsocket_error', error) | |
286 | 286 | wx.showToast({ |
287 | 287 | title: "网络已断开", |
288 | 288 | icon: 'none', |
... | ... | @@ -310,6 +310,7 @@ |
310 | 310 | wx.getUserInfo({ |
311 | 311 | success: function (res) { |
312 | 312 | that.globalData.userInfo = res.userInfo |
313 | + // console.log(res.userInfo,'res.userInfo'); | |
313 | 314 | typeof cb == "function" && cb(that.globalData.userInfo) |
314 | 315 | } |
315 | 316 | }) |
littleApp_child/app.json
View file @
f8fa823
... | ... | @@ -56,7 +56,9 @@ |
56 | 56 | "pages/article/article", |
57 | 57 | "pages/preDocumented/preDocumented", |
58 | 58 | "pages/serviceNotice/serviceNotice", |
59 | - "pages/eatAddress/eatAddress" | |
59 | + "pages/eatAddress/eatAddress", | |
60 | + "pages/messageNotification/messageNotification", | |
61 | + "pages/messageContent/messageContent" | |
60 | 62 | ] |
61 | 63 | } |
62 | 64 | ], |
littleApp_child/packageA/pages/messageContent/messageContent.js
View file @
f8fa823
1 | +// packageA/pages/messageContent/messageContent.js | |
2 | + | |
3 | +var networkUtil = require('../../../utils/network_util.js') | |
4 | +var api = require('../../../utils/apiFile.js') | |
5 | +Page({ | |
6 | + | |
7 | + /** | |
8 | + * 页面的初始数据 | |
9 | + */ | |
10 | + data: { | |
11 | + setObject:{} | |
12 | + }, | |
13 | + | |
14 | + /** | |
15 | + * 生命周期函数--监听页面加载 | |
16 | + */ | |
17 | + onLoad({id}) { | |
18 | + networkUtil.showLoading() | |
19 | + if (id) { | |
20 | + this.getmessageContent(id) | |
21 | + } | |
22 | + }, | |
23 | + getmessageContent:function(id){ | |
24 | + const _that = this | |
25 | + networkUtil._get(api.getBabyMsgById,{ | |
26 | + msgId:id | |
27 | + },function (res) { | |
28 | + console.log(res,'res'); | |
29 | + _that.setData({ | |
30 | + setObject:res.data.object | |
31 | + }) | |
32 | + wx.hideToast(); | |
33 | + }, function (res) { | |
34 | + networkUtil.showErrorToast(res.errormsg) | |
35 | + }) | |
36 | + }, | |
37 | + /** | |
38 | + * 生命周期函数--监听页面初次渲染完成 | |
39 | + */ | |
40 | + onReady() { | |
41 | + | |
42 | + }, | |
43 | + | |
44 | + /** | |
45 | + * 生命周期函数--监听页面显示 | |
46 | + */ | |
47 | + onShow() { | |
48 | + | |
49 | + }, | |
50 | + | |
51 | + /** | |
52 | + * 生命周期函数--监听页面隐藏 | |
53 | + */ | |
54 | + onHide() { | |
55 | + | |
56 | + }, | |
57 | + | |
58 | + /** | |
59 | + * 生命周期函数--监听页面卸载 | |
60 | + */ | |
61 | + onUnload() { | |
62 | + | |
63 | + }, | |
64 | + | |
65 | + /** | |
66 | + * 页面相关事件处理函数--监听用户下拉动作 | |
67 | + */ | |
68 | + onPullDownRefresh() { | |
69 | + | |
70 | + }, | |
71 | + | |
72 | + /** | |
73 | + * 页面上拉触底事件的处理函数 | |
74 | + */ | |
75 | + onReachBottom() { | |
76 | + | |
77 | + }, | |
78 | + | |
79 | + /** | |
80 | + * 用户点击右上角分享 | |
81 | + */ | |
82 | + onShareAppMessage() { | |
83 | + | |
84 | + } | |
85 | +}) |
littleApp_child/packageA/pages/messageContent/messageContent.json
View file @
f8fa823
littleApp_child/packageA/pages/messageContent/messageContent.wxml
View file @
f8fa823
1 | +<!--pages/messageContent/Count.wxml--> | |
2 | +<view class="title"> | |
3 | + <view> | |
4 | + <block > | |
5 | + <view>{{setObject.title}}</view> | |
6 | + </block> | |
7 | + </view> | |
8 | +</view> | |
9 | + | |
10 | +<view class="time-read"> | |
11 | + <text class="time">{{setObject.createdStr}}</text> | |
12 | + <view class="read" wx:if="{{true}}"> | |
13 | + 阅读量:<text>{{setObject.readNum}}</text> | |
14 | + </view> | |
15 | +</view> | |
16 | + | |
17 | + | |
18 | +<!-- penner图 --> | |
19 | +<view class="penner" wx:if="{{setObject.img}}"> | |
20 | + <image src="{{setObject.img}}" mode=""/> | |
21 | +</view> | |
22 | + | |
23 | +<!-- 内容 --> | |
24 | +<view class="content"> | |
25 | + <view class="content1"> | |
26 | + {{setObject.content}} | |
27 | + </view> | |
28 | +</view> |
littleApp_child/packageA/pages/messageContent/messageContent.wxss
View file @
f8fa823
1 | +/* packageA/pages/messageContent/messageContent.wxss */ | |
2 | + | |
3 | +/* pages/messageContent/Count.wxss */ | |
4 | +.title { | |
5 | + margin: 56rpx 36rpx 30rpx; | |
6 | + font-family: Adobe Heiti Std; | |
7 | + font-size: 34rpx; | |
8 | + color: #333333; | |
9 | + line-height: 46rpx; | |
10 | + text-align: justifyLeft; | |
11 | + font-style: normal; | |
12 | + text-transform: none; | |
13 | +} | |
14 | +.time-read{ | |
15 | + display: flex; | |
16 | + margin: 0 36rpx; | |
17 | + font-family: SourceHanSansCN, SourceHanSansCN; | |
18 | + font-weight: 400; | |
19 | + font-size: 24rpx; | |
20 | + color: #999999; | |
21 | + text-align: justifyLeft; | |
22 | + font-style: normal; | |
23 | + text-transform: none; | |
24 | +} | |
25 | +.time-read .time{ | |
26 | + margin-right: 59rpx; | |
27 | +} | |
28 | + | |
29 | +.penner{ | |
30 | + margin: 45rpx 31rpx; | |
31 | + width: 690rpx; | |
32 | + height: 294rpx; | |
33 | + background: #7F7F7F; | |
34 | + border-radius: 10rpx 10rpx 10rpx 10rpx; | |
35 | +} | |
36 | + | |
37 | +.penner image{ | |
38 | + width: 100%; | |
39 | + height: 100%; | |
40 | +} | |
41 | +.content{ | |
42 | + margin: 20rpx 30rpx; | |
43 | + font-family: SourceHanSansCN, SourceHanSansCN; | |
44 | + font-weight: 400; | |
45 | + font-size: 28rpx; | |
46 | + color: #333333; | |
47 | + font-style: normal; | |
48 | + text-transform: none; | |
49 | +} | |
50 | + | |
51 | +.content .content1{ | |
52 | + margin-bottom: 50rpx; | |
53 | +} |
littleApp_child/packageA/pages/messageNotification/messageNotification.js
View file @
f8fa823
1 | +// pages/messageNotification/message.js | |
2 | + | |
3 | +// 网络请求工具类 | |
4 | +var networkUtil = require('../../../utils/network_util.js') | |
5 | +var api = require('../../../utils/apiFile.js') | |
6 | +Page({ | |
7 | + | |
8 | + /** | |
9 | + * 页面的初始数据 | |
10 | + */ | |
11 | + data: { | |
12 | + notificationList:[], // 消息通知列表 | |
13 | + currentPage: 1, // 当前页码 | |
14 | + limit: 10, // 每页显示的数据条数 | |
15 | + hasMoreData: true, // 是否有更多数据可加载 | |
16 | + babyId:null, | |
17 | + formattedDate:null | |
18 | + }, | |
19 | + | |
20 | + //获取消息通知 | |
21 | + getNotificationList:function(){ | |
22 | + | |
23 | + }, | |
24 | + | |
25 | + // 下拉加载 | |
26 | + loadMore:function(){ | |
27 | + const self = this; | |
28 | + if (!self.data.hasMoreData) { | |
29 | + return; // 如果没有更多数据,不执行任何操作 | |
30 | + } | |
31 | + // 使用 setData 更新页面状态为正在加载 | |
32 | + self.setData({ | |
33 | + isLoading: true | |
34 | + }); | |
35 | + networkUtil._get(api.getMsgList, { | |
36 | + page: self.data.currentPage, | |
37 | + limit: self.data.limit, | |
38 | + babyId:self.data.babyId, | |
39 | + }, function(res) { | |
40 | + if (res.data && res.data.data.length > 0) { | |
41 | + const newData = self.data.notificationList.concat(res.data.data); | |
42 | + | |
43 | + | |
44 | + | |
45 | + self.setData({ | |
46 | + notificationList: newData, | |
47 | + currentPage: self.data.currentPage + 1, | |
48 | + isLoading: false | |
49 | + }); | |
50 | + // 判断是否还有更多数据 | |
51 | + const hasMoreData = res.data.pageInfo.page < res.data.pageInfo.lastPage | |
52 | + // 更新页面数据(假设你在微信小程序或其他使用setData方法的框架中) | |
53 | + self.setData({ | |
54 | + hasMoreData: hasMoreData | |
55 | + }); | |
56 | + | |
57 | + wx.hideToast(); | |
58 | + } else { | |
59 | + // 如果没有返回数据,表示没有更多数据了 | |
60 | + self.setData({ | |
61 | + hasMoreData: false, | |
62 | + isLoading: false | |
63 | + }); | |
64 | + } | |
65 | + }, function(res) { | |
66 | + networkUtil.showErrorToast(res.errormsg); | |
67 | + wx.hideToast(); | |
68 | + }); | |
69 | + }, | |
70 | + | |
71 | + // 跳转 | |
72 | + messageBtn:function(e){ | |
73 | + const id = e.currentTarget.dataset.index | |
74 | + if(id){ | |
75 | + setTimeout(() =>{ | |
76 | + wx.navigateTo({ | |
77 | + url: `/packageA/pages/messageContent/messageContent?id=${id}`, | |
78 | + }) | |
79 | + },100) | |
80 | + } else { | |
81 | + return | |
82 | + } | |
83 | + }, | |
84 | + // 快速预约课程 | |
85 | + goAddQuestion: function(e) { | |
86 | + networkUtil.showLoading(); | |
87 | + var self = this; | |
88 | + wx.showModal({ | |
89 | + title: '提示', | |
90 | + confirmText: '线上', | |
91 | + content:`您目前是要线上预约还是现场预约?`, | |
92 | + cancelText: '现场', | |
93 | + success(res) { | |
94 | + if (res.confirm) { | |
95 | + var param = { courseId: e.target.dataset.id, type: 1 }; | |
96 | + networkUtil._get(api.orderCourse, param, function(res) { | |
97 | + if (res.data.errorcode == 0) { | |
98 | + networkUtil.showToast('预约成功'); | |
99 | + self.loadMore(); | |
100 | + } | |
101 | + }, | |
102 | + function(res) { | |
103 | + networkUtil.showErrorToast(res.errormsg); | |
104 | + wx.hideToast(); | |
105 | + }); | |
106 | + } else if (res.cancel) { | |
107 | + var param = { courseId: e.target.dataset.id, type: 2 }; | |
108 | + networkUtil._get(api.orderCourse, param, function(res) { | |
109 | + // console.log(ress,'res'); | |
110 | + if (res.data.errorcode == 0) { | |
111 | + networkUtil.showToast('预约成功'); | |
112 | + self.loadMore(); | |
113 | + } | |
114 | + } | |
115 | + , function(res) { | |
116 | + networkUtil.showErrorToast(res.errormsg); | |
117 | + wx.hideToast(); | |
118 | + } | |
119 | + ); | |
120 | + } | |
121 | + } | |
122 | + }); | |
123 | + }, | |
124 | + /** | |
125 | + * 生命周期函数--监听页面加载 | |
126 | + */ | |
127 | + onLoad(options) { | |
128 | + networkUtil.showLoading() | |
129 | + this.setData({ | |
130 | + babyId:wx.getStorageSync('erid') | |
131 | + }) | |
132 | + }, | |
133 | + | |
134 | + /** | |
135 | + * 生命周期函数--监听页面初次渲染完成 | |
136 | + */ | |
137 | + onReady() { | |
138 | + | |
139 | + }, | |
140 | + | |
141 | + /** | |
142 | + * 生命周期函数--监听页面显示 | |
143 | + */ | |
144 | + onShow() { | |
145 | + this.loadMore() | |
146 | + | |
147 | + }, | |
148 | + | |
149 | + /** | |
150 | + * 生命周期函数--监听页面隐藏 | |
151 | + */ | |
152 | + onHide() { | |
153 | + | |
154 | + }, | |
155 | + | |
156 | + /** | |
157 | + * 生命周期函数--监听页面卸载 | |
158 | + */ | |
159 | + onUnload() { | |
160 | + | |
161 | + }, | |
162 | + | |
163 | + /** | |
164 | + * 页面相关事件处理函数--监听用户下拉动作 | |
165 | + */ | |
166 | + onPullDownRefresh() { | |
167 | + | |
168 | + }, | |
169 | + | |
170 | + /** | |
171 | + * 页面上拉触底事件的处理函数 | |
172 | + */ | |
173 | + onReachBottom() { | |
174 | + | |
175 | + }, | |
176 | + | |
177 | + /** | |
178 | + * 用户点击右上角分享 | |
179 | + */ | |
180 | + onShareAppMessage() { | |
181 | + | |
182 | + } | |
183 | +}) |
littleApp_child/packageA/pages/messageNotification/messageNotification.json
View file @
f8fa823
littleApp_child/packageA/pages/messageNotification/messageNotification.wxml
View file @
f8fa823
1 | +<!--packageA/pages/messageNotification/messageNotification.wxml--> | |
2 | +<!-- <text>packageA/pages/messageNotification/messageNotification.wxml</text> --> | |
3 | + | |
4 | + | |
5 | +<scroll-view scroll-y="true" bindscrolltolower="loadMore" style="height: 100vh;"> | |
6 | + <view class="messageNotification"> | |
7 | + <!-- --> | |
8 | + <!-- --> | |
9 | + | |
10 | + <view bind:tap="messageBtn" data-index="{{item.id}}" wx:for="{{notificationList}}" wx:for-item="item" | |
11 | + wx:for-index="index" | |
12 | + wx:key="index" class="messageNotification-item" | |
13 | + > | |
14 | + <view class="head"> | |
15 | + <view class="notice"> | |
16 | + <view class="notice-title tile-color" wx:if="{{true}}">通知</view> | |
17 | + <text class="text"></text> | |
18 | + </view> | |
19 | + <view class="time"> | |
20 | + {{item.createdStr}} | |
21 | + </view> | |
22 | + </view> | |
23 | + <view class="content"> | |
24 | + <view class="title-head" style="display: flex; justify-content: space-between; align-items: center;"> | |
25 | + <view> | |
26 | + <text>{{item.title}}</text> | |
27 | + </view> | |
28 | + </view> | |
29 | + <view class="title-content"> | |
30 | + {{item.content}} | |
31 | + </view> | |
32 | + </view> | |
33 | + </view> | |
34 | +</view> | |
35 | + | |
36 | +</scroll-view> |
littleApp_child/packageA/pages/messageNotification/messageNotification.wxss
View file @
f8fa823
1 | +/* packageA/pages/messageNotification/messageNotification.wxss */ | |
2 | + | |
3 | +.messageNotification { | |
4 | + width: 100vw; | |
5 | + height: 100vh; | |
6 | + background-color: #F2F2F2; | |
7 | +} | |
8 | + | |
9 | +.messageNotification .messageNotification-item{ | |
10 | + width: 690rpx; | |
11 | + margin: 28rpx 30rpx; | |
12 | + background: #FFFFFF; | |
13 | + border-radius: 6rpx 6rpx 6rpx 6rpx; | |
14 | + } | |
15 | + | |
16 | + .messageNotification-item .head{ | |
17 | + height: 100rpx; | |
18 | + display: flex; | |
19 | + align-items: center; | |
20 | + justify-content: space-between; | |
21 | + border-bottom: 2rpx solid #F4F4F4; | |
22 | + padding: 0 36rpx; | |
23 | + } | |
24 | + | |
25 | + .head .time{ | |
26 | + font-family: SourceHanSansSC, SourceHanSansSC; | |
27 | + font-weight: 400; | |
28 | + font-size: 22rpx; | |
29 | + color: #636363; | |
30 | + line-height: 0rpx; | |
31 | + text-align: left; | |
32 | + font-style: normal; | |
33 | + text-transform: none; | |
34 | + } | |
35 | + | |
36 | + .messageNotification-item .notice{ | |
37 | + position: relative; | |
38 | + } | |
39 | + | |
40 | + .notice .text { | |
41 | + position: absolute; | |
42 | + top: 10rpx; | |
43 | + left: -20rpx; | |
44 | + width: 10rpx; | |
45 | + height: 10rpx; | |
46 | + background: #FF2727; | |
47 | + border-radius: 5rpx 5rpx 5rpx 5rpx | |
48 | + } | |
49 | + | |
50 | + .notice .notice-title { | |
51 | + font-family: SourceHanSansSC, SourceHanSansSC; | |
52 | + font-weight: 400; | |
53 | + font-size: 22rpx; | |
54 | + color: #FFFFFF; | |
55 | + width: 56rpx; | |
56 | + height: 31rpx; | |
57 | + line-height: 31rpx; | |
58 | + text-align: center; | |
59 | + } | |
60 | + .notice .tile-color{ | |
61 | + background: #FF6D89; | |
62 | + border-radius: 3rpx 3rpx 3rpx 3rpx; | |
63 | + } | |
64 | + .notice .tile-color1 { | |
65 | + background: #FD992F; | |
66 | + border-radius: 3rpx 3rpx 3rpx 3rpx; | |
67 | + } | |
68 | + | |
69 | + .messageNotification-item .content{ | |
70 | + padding: 30rpx; | |
71 | + | |
72 | + } | |
73 | + | |
74 | + .content .title-head{ | |
75 | + font-family: SourceHanSansSC, SourceHanSansSC; | |
76 | + font-weight: 400; | |
77 | + font-size: 28rpx; | |
78 | + color: #0B0B0B; | |
79 | + margin-bottom: 20rpx; | |
80 | + font-style: normal; | |
81 | + text-transform: none; | |
82 | + } | |
83 | + .content .title-content{ | |
84 | + font-family: SourceHanSansSC, SourceHanSansSC; | |
85 | + font-weight: 400; | |
86 | + font-size: 24rpx; | |
87 | + color: #999999; | |
88 | + font-style: normal; | |
89 | + text-transform: none; | |
90 | + display: -webkit-box; | |
91 | + -webkit-line-clamp: 3; /* 设置最大行数 */ | |
92 | + -webkit-box-orient: vertical; /* 设置为垂直方向 */ | |
93 | + overflow: hidden; /* 超出部分隐藏 */ | |
94 | + } |
littleApp_child/pages/chatHis/chatHis.js
View file @
f8fa823
littleApp_child/pages/home/home.js
View file @
f8fa823
... | ... | @@ -29,6 +29,7 @@ |
29 | 29 | Page({ |
30 | 30 | /*---------属性变量--------*/ |
31 | 31 | data: { |
32 | + MsgCount:null, | |
32 | 33 | isLogin: '', |
33 | 34 | item_big_height: 0, |
34 | 35 | item_small: 0, |
35 | 36 | |
... | ... | @@ -84,11 +85,14 @@ |
84 | 85 | riskBase: false, |
85 | 86 | //是否开通疾病指导 |
86 | 87 | riskDise:false, |
87 | - hospitalId1:null | |
88 | + hospitalId1:null, | |
89 | + userInfoDate:{}, | |
90 | + erid:null | |
88 | 91 | }, |
89 | 92 | /*---------生命周期--------*/ |
90 | 93 | onLoad: function(options) { |
91 | - console.log(options,'options1121'); | |
94 | + // console.log(app.globalData,'options1121'); | |
95 | + this.getUserInfo(app.globalData.token) | |
92 | 96 | hospitalId = options.hospitalId; |
93 | 97 | this.calculatePageSize() |
94 | 98 | this.setData({ |
95 | 99 | |
... | ... | @@ -123,10 +127,34 @@ |
123 | 127 | } |
124 | 128 | |
125 | 129 | }, |
130 | + setNotification:function(){ | |
131 | + const _that = this | |
132 | + networkUtil._get(api.getMsgList,{ | |
133 | + page: 1, | |
134 | + limit: 20, | |
135 | + babyId:_that.data.erid, | |
136 | + },function (res) { | |
137 | + if (res.data.data.length > 0 ) { | |
138 | + wx.navigateTo({ | |
139 | + url: '/packageA/pages/messageNotification/messageNotification', | |
140 | + }) | |
141 | + } else { | |
142 | + wx.showModal({ | |
143 | + title: '提示', | |
144 | + content: '当前没有医院活动通知', | |
145 | + showCancel: false, | |
146 | + }) | |
147 | + } | |
148 | + }, function (res) { | |
149 | + networkUtil.showErrorToast(res.errormsg) | |
150 | + }) | |
151 | + | |
152 | + | |
153 | + }, | |
126 | 154 | onShow: function() { |
127 | 155 | // 生命周期函数--监听页面显示 |
128 | 156 | if (wx.getStorageSync("access_token") != null&&wx.getStorageSync("access_token")) { |
129 | - console.log(wx.getStorageSync("access_token")) | |
157 | + // console.log(wx.getStorageSync("access_token")) | |
130 | 158 | this.connectWebIM() |
131 | 159 | |
132 | 160 | } |
... | ... | @@ -146,6 +174,23 @@ |
146 | 174 | // 移除监听 |
147 | 175 | event.remove('likeChanged', this); |
148 | 176 | }, |
177 | + | |
178 | + getBabyMsgCountByIdNum:function(id){ | |
179 | + const _that = this | |
180 | + networkUtil._get(api.getBabyMsgCountById,{ | |
181 | + babyId:id | |
182 | + },function (res) { | |
183 | + // console.log(res.data.object,'res1111'); | |
184 | + _that.setData({ | |
185 | + MsgCount:res.data.object | |
186 | + }) | |
187 | + wx.hideToast(); | |
188 | + }, function (res) { | |
189 | + networkUtil.showErrorToast(res.errormsg) | |
190 | + }) | |
191 | + }, | |
192 | + | |
193 | + | |
149 | 194 | /*---------交互--------*/ |
150 | 195 | // 下拉刷新回调接口 |
151 | 196 | onPullDownRefresh: function() { |
... | ... | @@ -266,7 +311,7 @@ |
266 | 311 | toBefore() { |
267 | 312 | var index = this.data.babyIndex |
268 | 313 | index-- |
269 | - console.log('index', index) | |
314 | + // console.log('index', index) | |
270 | 315 | var left = true |
271 | 316 | var right = true |
272 | 317 | if (index == 0) { |
... | ... | @@ -283,7 +328,7 @@ |
283 | 328 | toAfter() { |
284 | 329 | var index = this.data.babyIndex |
285 | 330 | index++ |
286 | - console.log('index', index) | |
331 | + // console.log('index', index) | |
287 | 332 | var left = true |
288 | 333 | var right = true |
289 | 334 | if (index == app.globalData.userId.length - 1) { |
... | ... | @@ -419,7 +464,7 @@ |
419 | 464 | var self = this |
420 | 465 | var param = {} |
421 | 466 | networkUtil._get(api.goods, param, function(res) { |
422 | - console.log(res) | |
467 | + // console.log(res) | |
423 | 468 | res.data.data.map(function(item) { |
424 | 469 | if (item.id == 7) { |
425 | 470 | if (item.status == 1) { |
... | ... | @@ -442,7 +487,7 @@ |
442 | 487 | }) |
443 | 488 | }, |
444 | 489 | getAccessToken() { |
445 | - console.log('getAccessToken') | |
490 | + // console.log('getAccessToken') | |
446 | 491 | var that = this |
447 | 492 | var token = ''; |
448 | 493 | var options = { |
... | ... | @@ -450,7 +495,7 @@ |
450 | 495 | user: wx.getStorageSync('hxName'), |
451 | 496 | pwd: wx.getStorageSync('hxPassWord'), |
452 | 497 | success: function (res) { |
453 | - console.log("conn success:", res); | |
498 | + // console.log("conn success:", res); | |
454 | 499 | wx.setStorageSync("access_token", res.data.access_token) |
455 | 500 | token = res.data.access_token |
456 | 501 | }, |
... | ... | @@ -474,7 +519,7 @@ |
474 | 519 | }) |
475 | 520 | }, |
476 | 521 | connectWebIM() { |
477 | - console.log('开始连接') | |
522 | + // console.log('开始连接') | |
478 | 523 | //WebIM.conn.close() |
479 | 524 | var that = this |
480 | 525 | var options = { |
... | ... | @@ -512,7 +557,7 @@ |
512 | 557 | param.type = 2 |
513 | 558 | } |
514 | 559 | networkUtil._get(api.userInfo + app.globalData.currentId, param, function(res) { |
515 | - console.log('获取用户信息', res) | |
560 | + // console.log('获取用户信息1212', res) | |
516 | 561 | if (res.data.data.bzstatus==1){ |
517 | 562 | self.data.riskBase=true; |
518 | 563 | }else{ |
... | ... | @@ -556,7 +601,12 @@ |
556 | 601 | 'hospitalId':app.globalData.userInfo.hospitalId |
557 | 602 | } |
558 | 603 | networkUtil._post(api.getBabyBuildPidInfo,param,function(res){ |
559 | - console.log(res.data.data) | |
604 | + wx.setStorageSync('erid',res.data.data.id) | |
605 | + self.getBabyMsgCountByIdNum(res.data.data.id) | |
606 | + // self.setNotification(res.data.data.id) | |
607 | + self.setData({ | |
608 | + erid:res.data.data.id | |
609 | + }) | |
560 | 610 | app.globalData.encoded = res.data.data.encoded; |
561 | 611 | app.globalData.openDisease = res.data.data.openDisease; |
562 | 612 | if(res.data.data.openDisease == '2'){ |
... | ... | @@ -584,7 +634,7 @@ |
584 | 634 | limit: 100, |
585 | 635 | days: days |
586 | 636 | }, function(res) { |
587 | - console.log('获取文章信息', res.data.list) | |
637 | + // console.log('获取文章信息', res.data.list) | |
588 | 638 | artCache[self.data.babyIndex] = res.data.list |
589 | 639 | self.setArtInfo(res.data.list) |
590 | 640 | }, function(res) { |
... | ... | @@ -598,6 +648,7 @@ |
598 | 648 | app.globalData.userInfo = data |
599 | 649 | self.setData({ |
600 | 650 | userData: data, |
651 | + userInfoDate:data, | |
601 | 652 | tourist: getApp().globalData.tourist |
602 | 653 | }) |
603 | 654 | }, |
... | ... | @@ -611,7 +662,7 @@ |
611 | 662 | }, |
612 | 663 | // 文章点赞 |
613 | 664 | articleLike(e) { |
614 | - console.log(e) | |
665 | + // console.log(e) | |
615 | 666 | var self = this |
616 | 667 | // 已经点赞 |
617 | 668 | if (e.currentTarget.dataset.islike == 1) { |
... | ... | @@ -633,7 +684,7 @@ |
633 | 684 | }, |
634 | 685 | // 标签页面 |
635 | 686 | clickLabel(e) { |
636 | - console.log(e) | |
687 | + // console.log(e) | |
637 | 688 | wx.navigateTo({ |
638 | 689 | url: '../articleLists/articleLists?category=' + e.currentTarget.dataset.categary, |
639 | 690 | }) |
... | ... | @@ -666,8 +717,8 @@ |
666 | 717 | }, |
667 | 718 | // 获取验证码 |
668 | 719 | getVerifyCode: function(e) { |
669 | - console.log("name:" + name) | |
670 | - console.log("phone:" + phone) | |
720 | + // console.log("name:" + name) | |
721 | + // console.log("phone:" + phone) | |
671 | 722 | // name = '小向阳' |
672 | 723 | // phone = '18202810912' |
673 | 724 | if (timeCount < 60) { |
674 | 725 | |
675 | 726 | |
... | ... | @@ -758,14 +809,14 @@ |
758 | 809 | } |
759 | 810 | if (getApp().globalData.openInfo.mpid) { |
760 | 811 | param.gzopenid = getApp().globalData.openInfo.mpid |
761 | - console.log('绑定mpid', param) | |
812 | + // console.log('绑定mpid', param) | |
762 | 813 | } |
763 | 814 | if (getApp().globalData.openInfo.childCode) { |
764 | 815 | param.jscode = getApp().globalData.openInfo.childCode |
765 | - console.log('绑定code', param) | |
816 | + // console.log('绑定code', param) | |
766 | 817 | } |
767 | 818 | networkUtil._get(api.verifyCode, param, function(res) { |
768 | - console.log(res) | |
819 | + // console.log(res) | |
769 | 820 | self.loginSuccess(res.data) |
770 | 821 | }, function(res) { |
771 | 822 | networkUtil.showErrorToast(res.errormsg) |
... | ... | @@ -829,7 +880,7 @@ |
829 | 880 | doctorId:this.data.userData.disData.doctorId |
830 | 881 | } |
831 | 882 | wx.setStorageSync('serviceId',serviceId) |
832 | - console.log(nameList) | |
883 | + // console.log(nameList) | |
833 | 884 | wx.navigateTo({ |
834 | 885 | url: '../consulting/consulting?username='+ JSON.stringify(nameList) |
835 | 886 | }) |
... | ... | @@ -843,6 +894,7 @@ |
843 | 894 | 'hospitalId':app.globalData.userInfo.hospitalId |
844 | 895 | } |
845 | 896 | networkUtil._post(api.getBabyBuildPidInfo,param,function(res){ |
897 | + // console.log(res,'res1212112'); | |
846 | 898 | if (res.data.data) { |
847 | 899 | wx.navigateTo({url: '/packageA/pages/graph/graph?id=' + res.data.data.id }) |
848 | 900 | } |
... | ... | @@ -881,7 +933,6 @@ |
881 | 933 | memberId:this.data.userData.disData.memberId, |
882 | 934 | doctorId:this.data.userData.disData.doctorId |
883 | 935 | } |
884 | - console.log(nameList) | |
885 | 936 | wx.navigateTo({ |
886 | 937 | url: '../doctorLists/doctorLists?username='+ JSON.stringify(nameList), |
887 | 938 | }) |
... | ... | @@ -907,7 +958,7 @@ |
907 | 958 | var myName = wx.getStorageSync("hxName"); |
908 | 959 | WebIM.conn.listRooms({ |
909 | 960 | success: function(rooms){ |
910 | - console.log(rooms) | |
961 | + // console.log(rooms) | |
911 | 962 | rooms.map((item) => { |
912 | 963 | wx.getStorage({ |
913 | 964 | key: item.roomId + myName, |
... | ... | @@ -916,7 +967,7 @@ |
916 | 967 | if(unreadMas){ |
917 | 968 | num += unreadMas.length; |
918 | 969 | } |
919 | - console.log(num) | |
970 | + // console.log(num) | |
920 | 971 | that.setData({unTotleReadCount:num}) |
921 | 972 | } |
922 | 973 | }) |
littleApp_child/pages/home/home.wxml
View file @
f8fa823
... | ... | @@ -13,7 +13,10 @@ |
13 | 13 | |
14 | 14 | <view class="TopBar" style='height:{{tourist == false ? 212 : 152}}px'> |
15 | 15 | <!--头像--> |
16 | - | |
16 | + <view class="Notification" bind:tap="setNotification" wx:if="{{userData.hospitalId == 666668}}"> | |
17 | + <image src="../../source/xiaox.png" mode=""/> | |
18 | + <text style="color: #fff;" wx:if="{{MsgCount !== 0 || MsgCount == null }}">{{MsgCount || ''}}</text> | |
19 | + </view> | |
17 | 20 | <image class="avatar" bindtap="tapAvatar" src="{{userData.avatar.medium ? userData.avatar.medium : ''}}" background-size="cover"></image> |
18 | 21 | <!--用户名--> |
19 | 22 | <!-- <view class="top_name" wx:if="{{babys.length > 1}}"> |
... | ... | @@ -110,7 +113,7 @@ |
110 | 113 | <image src="../../source/icon_consult@2x.png" style="{{item_small}}" class="foundation_item_small_image"></image> |
111 | 114 | <view class="foundation_item_small_text">专家咨询</view> |
112 | 115 | </navigator> |
113 | - <navigator class="foundation_item_small" bind:tap="goGraph"> | |
116 | + <navigator wx:if="{{userData.hospitalId !== 666668}}" class="foundation_item_small" bind:tap="goGraph"> | |
114 | 117 | <image src="../../source/graph.jpg" style="{{item_small}}" class="foundation_item_small_image"></image> |
115 | 118 | <view class="foundation_item_small_text">身高体重曲线</view> |
116 | 119 | </navigator> |
... | ... | @@ -122,7 +125,7 @@ |
122 | 125 | <image src="../../source/jianchajilu.png" style="{{item_small}}" class="foundation_item_small_image"></image> |
123 | 126 | <view class="foundation_item_small_text">中医指导文章</view> |
124 | 127 | </navigator> |
125 | - <navigator class="foundation_item_small" bind:tap="goServiceNotice"> | |
128 | + <navigator wx:if="{{userData.hospitalId !== 666668}}" class="foundation_item_small" bind:tap="goServiceNotice"> | |
126 | 129 | <image src="../../source/jianchajilu.png" style="{{item_small}}" class="foundation_item_small_image"></image> |
127 | 130 | <view class="foundation_item_small_text">服务名目通知</view> |
128 | 131 | </navigator> |
littleApp_child/pages/home/home.wxss
View file @
f8fa823
... | ... | @@ -352,4 +352,32 @@ |
352 | 352 | .navigator_class { |
353 | 353 | width: 100%; |
354 | 354 | } |
355 | + | |
356 | + | |
357 | + | |
358 | +/* 消息通知 */ | |
359 | +.Notification{ | |
360 | + position: absolute; | |
361 | + width: 54rpx; | |
362 | + height: 54rpx; | |
363 | + top: 40rpx; | |
364 | + right: 40rpx; | |
365 | +} | |
366 | + | |
367 | +.Notification image { | |
368 | +width: 100%; | |
369 | +height: 100%; | |
370 | +} | |
371 | +.Notification text { | |
372 | + position: absolute; | |
373 | + top: -20rpx; | |
374 | + right: -14rpx; | |
375 | + width: 40rpx; | |
376 | + height: 40rpx; | |
377 | + background: #CF3350; | |
378 | + border-radius: 50%; | |
379 | + font-size: 30rpx; | |
380 | + text-align: center; | |
381 | + line-height: 40rpx; | |
382 | +} |
littleApp_child/pages/login/login.js
View file @
f8fa823
... | ... | @@ -87,11 +87,11 @@ |
87 | 87 | var param = { code: e.detail.value.code, phone: phone } |
88 | 88 | if (getApp().globalData.openInfo.mpid) { |
89 | 89 | param.gzopenid = getApp().globalData.openInfo.mpid |
90 | - console.log('绑定mpid', param) | |
90 | + // console.log('绑定mpid', param) | |
91 | 91 | } |
92 | 92 | if (getApp().globalData.openInfo.childCode) { |
93 | 93 | param.jscode = getApp().globalData.openInfo.childCode |
94 | - console.log('绑定code', param) | |
94 | + // console.log('绑定code', param) | |
95 | 95 | } |
96 | 96 | networkUtil._get(api.verifyCode, param, function (res) { |
97 | 97 | console.log(res) |
littleApp_child/source/xiaox.png
View file @
f8fa823
2.77 KB
littleApp_child/utils/apiFile.js
View file @
f8fa823
... | ... | @@ -114,6 +114,12 @@ |
114 | 114 | // 身长体重曲线 |
115 | 115 | getGraphEcharts: '/queryBabyCurve', |
116 | 116 | // 中医指导文章 |
117 | - getArticle: 'baby/queryArticle' | |
117 | + getArticle: 'baby/queryArticle', | |
118 | + // 消息列表 | |
119 | + getMsgList:'babyMsgList', | |
120 | + // 通知详情 | |
121 | + getBabyMsgById :'getBabyMsgById', | |
122 | + // 消息记录 | |
123 | + getBabyMsgCountById:'getBabyMsgCountById' | |
118 | 124 | } |