hh-doctor-sdk 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/apis/api-host-define.js +69 -0
- package/components/apis/consultation-reply-api.js +21 -0
- package/components/apis/dicom-api.js +31 -0
- package/components/apis/family-api.js +20 -0
- package/components/apis/file-upload-api.js +35 -0
- package/components/apis/order-app-api.js +206 -0
- package/components/apis/stat-log-api.js +42 -0
- package/components/apis/video-chat-log-api.js +47 -0
- package/components/apis/video-message-api.js +88 -0
- package/components/consultation/detail/behaviors/chat-cell-base-behaviors.js +29 -0
- package/components/consultation/detail/behaviors/consultation-behaviors.js +60 -0
- package/components/consultation/detail/behaviors/consultation-chat-behaviors.js +321 -0
- package/components/consultation/detail/behaviors/consultation-header-media-behaviors.js +176 -0
- package/components/consultation/detail/behaviors/consultation-header-text-behaviors.js +325 -0
- package/components/consultation/detail/behaviors/consultation-reply-behaviors.js +67 -0
- package/components/consultation/detail/consultation-detail-page.js +219 -0
- package/components/consultation/detail/consultation-detail-page.json +10 -0
- package/components/consultation/detail/consultation-detail-page.wxml +65 -0
- package/components/consultation/detail/consultation-detail-page.wxss +51 -0
- package/components/consultation/detail/widget/case-image-filter.js +47 -0
- package/components/consultation/detail/widget/chat-base-cell/chat-base-cell.js +31 -0
- package/components/consultation/detail/widget/chat-base-cell/chat-base-cell.json +4 -0
- package/components/consultation/detail/widget/chat-base-cell/chat-base-cell.wxml +17 -0
- package/components/consultation/detail/widget/chat-base-cell/chat-base-cell.wxss +9 -0
- package/components/consultation/detail/widget/chat-bottom/chat-bottom.js +100 -0
- package/components/consultation/detail/widget/chat-bottom/chat-bottom.json +4 -0
- package/components/consultation/detail/widget/chat-bottom/chat-bottom.wxml +24 -0
- package/components/consultation/detail/widget/chat-bottom/chat-bottom.wxss +54 -0
- package/components/consultation/detail/widget/chat-bottom/chat-menu-builder.js +131 -0
- package/components/consultation/detail/widget/chat-cell-template/chat-cell-template.wxml +173 -0
- package/components/consultation/detail/widget/chat-cell.wxss +394 -0
- package/components/consultation/detail/widget/detail-media/detail-media.js +47 -0
- package/components/consultation/detail/widget/detail-media/detail-media.json +4 -0
- package/components/consultation/detail/widget/detail-media/detail-media.wxml +12 -0
- package/components/consultation/detail/widget/detail-media/detail-media.wxss +57 -0
- package/components/consultation/detail/widget/detail-text/detail-text.js +31 -0
- package/components/consultation/detail/widget/detail-text/detail-text.json +4 -0
- package/components/consultation/detail/widget/detail-text/detail-text.wxml +6 -0
- package/components/consultation/detail/widget/detail-text/detail-text.wxss +14 -0
- package/components/consultation/evaluate/evaluate-page.js +157 -0
- package/components/consultation/evaluate/evaluate-page.json +3 -0
- package/components/consultation/evaluate/evaluate-page.wxml +42 -0
- package/components/consultation/evaluate/evaluate-page.wxss +103 -0
- package/components/consultation/list/behaviors/consultation-list-base-behaviors.js +144 -0
- package/components/consultation/list/consultation-list-page.js +84 -0
- package/components/consultation/list/consultation-list-page.json +5 -0
- package/components/consultation/list/consultation-list-page.wxml +53 -0
- package/components/consultation/list/consultation-list-page.wxss +105 -0
- package/components/consultation/reply/behaviors/reply-base-behaviors.js +175 -0
- package/components/consultation/reply/consultation-reply-page.js +251 -0
- package/components/consultation/reply/consultation-reply-page.json +6 -0
- package/components/consultation/reply/consultation-reply-page.wxml +103 -0
- package/components/consultation/reply/consultation-reply-page.wxss +169 -0
- package/components/consultation/reply/widget/audio-record-view/audio-record-view.js +144 -0
- package/components/consultation/reply/widget/audio-record-view/audio-record-view.json +4 -0
- package/components/consultation/reply/widget/audio-record-view/audio-record-view.wxml +27 -0
- package/components/consultation/reply/widget/audio-record-view/audio-record-view.wxss +197 -0
- package/components/hh-doctor.js +36 -0
- package/components/hh-navigation.js +87 -0
- package/components/public/app-config.js +13 -0
- package/components/public/behaviors/order-base-behaviors.js +53 -0
- package/components/public/cache-data.js +134 -0
- package/components/public/doctor-loader.js +60 -0
- package/components/public/im-manager.js +135 -0
- package/components/public/pdf-viewer.js +59 -0
- package/components/public/stat-log.js +13 -0
- package/components/static/Agora_Miniapp_SDK_for_WeChat.js +2 -0
- package/components/static/trtc-wx.js +2 -0
- package/components/uikit/css/common.wxss +23 -0
- package/components/uikit/custom-bottom-pop/custom-bottom-pop.js +37 -0
- package/components/uikit/custom-bottom-pop/custom-bottom-pop.json +4 -0
- package/components/uikit/custom-bottom-pop/custom-bottom-pop.wxml +9 -0
- package/components/uikit/custom-bottom-pop/custom-bottom-pop.wxss +79 -0
- package/components/uikit/date-time-picker/date-time-picker.js +115 -0
- package/components/uikit/web-view-page/web-view-page.js +87 -0
- package/components/uikit/web-view-page/web-view-page.json +3 -0
- package/components/uikit/web-view-page/web-view-page.wxml +6 -0
- package/components/uikit/web-view-page/web-view-page.wxss +1 -0
- package/components/utils/checksumUtils.js +56 -0
- package/components/utils/common-utils.js +59 -0
- package/components/utils/dateUtils.js +142 -0
- package/components/utils/eventBus.js +77 -0
- package/components/utils/httpUtils.js +123 -0
- package/components/utils/number-utils.js +48 -0
- package/components/utils/permission-utils.js +164 -0
- package/components/video-chat/agora-rtc/agora-player/agora-player.js +106 -0
- package/components/video-chat/agora-rtc/agora-player/agora-player.json +4 -0
- package/components/video-chat/agora-rtc/agora-player/agora-player.wxml +24 -0
- package/components/video-chat/agora-rtc/agora-player/agora-player.wxss +1 -0
- package/components/video-chat/agora-rtc/agora-pusher/agora-pusher.js +92 -0
- package/components/video-chat/agora-rtc/agora-pusher/agora-pusher.json +4 -0
- package/components/video-chat/agora-rtc/agora-pusher/agora-pusher.wxml +22 -0
- package/components/video-chat/agora-rtc/agora-pusher/agora-pusher.wxss +1 -0
- package/components/video-chat/agora-rtc/agora-rtc.js +391 -0
- package/components/video-chat/agora-rtc/agora-rtc.json +7 -0
- package/components/video-chat/agora-rtc/agora-rtc.wxml +39 -0
- package/components/video-chat/agora-rtc/agora-rtc.wxss +1 -0
- package/components/video-chat/callback/callback.js +39 -0
- package/components/video-chat/callback/callback.json +4 -0
- package/components/video-chat/callback/callback.wxml +29 -0
- package/components/video-chat/callback/callback.wxss +26 -0
- package/components/video-chat/calling/calling.js +75 -0
- package/components/video-chat/calling/calling.json +4 -0
- package/components/video-chat/calling/calling.wxml +32 -0
- package/components/video-chat/calling/calling.wxss +45 -0
- package/components/video-chat/controller/controller.js +86 -0
- package/components/video-chat/controller/controller.json +4 -0
- package/components/video-chat/controller/controller.wxml +73 -0
- package/components/video-chat/controller/controller.wxss +71 -0
- package/components/video-chat/remote-player/remote-player.js +42 -0
- package/components/video-chat/remote-player/remote-player.json +4 -0
- package/components/video-chat/remote-player/remote-player.wxml +37 -0
- package/components/video-chat/remote-player/remote-player.wxss +1 -0
- package/components/video-chat/video-chat.js +297 -0
- package/components/video-chat/video-chat.json +7 -0
- package/components/video-chat/video-chat.wxml +56 -0
- package/components/video-chat/video-chat.wxss +97 -0
- package/components/video-chat-page/behaviors/chat-files-behaviors.js +243 -0
- package/components/video-chat-page/behaviors/chat-log-behaviors.js +90 -0
- package/components/video-chat-page/behaviors/chat-sound-behaviors.js +60 -0
- package/components/video-chat-page/behaviors/video-chat-behaviors.js +524 -0
- package/components/video-chat-page/case-group-view/case-group-view.js +38 -0
- package/components/video-chat-page/case-group-view/case-group-view.json +4 -0
- package/components/video-chat-page/case-group-view/case-group-view.wxml +32 -0
- package/components/video-chat-page/case-group-view/case-group-view.wxss +44 -0
- package/components/video-chat-page/video-chat-defines.js +39 -0
- package/components/video-chat-page/video-chat-page.js +212 -0
- package/components/video-chat-page/video-chat-page.json +14 -0
- package/components/video-chat-page/video-chat-page.wxml +88 -0
- package/components/video-chat-page/video-chat-page.wxss +45 -0
- package/package.json +18 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
.custom-popup {
|
|
2
|
+
position: absolute;
|
|
3
|
+
left: 0;
|
|
4
|
+
bottom: 0;
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: 100%;
|
|
7
|
+
background: rgba(0, 0, 0, 0.5);
|
|
8
|
+
z-index: 999;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.default-hide {
|
|
12
|
+
display: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.custom-popup.show {
|
|
16
|
+
animation: slideBGtUp 0.5s ease-in both;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.custom-popup.hide {
|
|
20
|
+
animation: slideBGDown 0.5s ease-in both;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@keyframes slideBGtUp {
|
|
24
|
+
from {
|
|
25
|
+
background: transparent;
|
|
26
|
+
}
|
|
27
|
+
to {
|
|
28
|
+
background: rgba(0, 0, 0, 0.5);
|
|
29
|
+
visibility: visible;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@keyframes slideBGDown {
|
|
34
|
+
from {
|
|
35
|
+
background: rgba(0, 0, 0, 0.5);
|
|
36
|
+
}
|
|
37
|
+
to {
|
|
38
|
+
background: transparent;
|
|
39
|
+
visibility: hidden;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.custom-popup-container {
|
|
44
|
+
position: absolute;
|
|
45
|
+
left: 0;
|
|
46
|
+
bottom: 0;
|
|
47
|
+
width: 100%;
|
|
48
|
+
overflow: hidden;
|
|
49
|
+
z-index: 9999;
|
|
50
|
+
background: #ffffff;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.custom-popup-container.show {
|
|
54
|
+
transform-origin: bottom; /* 设置动画的变换原点为底部 */
|
|
55
|
+
animation: slideIn 0.6s ease-in-out both; /* 添加弹窗动画 */
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.custom-popup-container.hide {
|
|
59
|
+
transform-origin: bottom; /* 设置动画的变换原点为底部 */
|
|
60
|
+
animation: slideOut 0.6s ease-in-out both; /* 添加弹窗动画 */
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@keyframes slideIn {
|
|
64
|
+
from {
|
|
65
|
+
bottom: -100%;
|
|
66
|
+
}
|
|
67
|
+
to {
|
|
68
|
+
bottom: 0;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@keyframes slideOut {
|
|
73
|
+
from {
|
|
74
|
+
bottom: 0;
|
|
75
|
+
}
|
|
76
|
+
to {
|
|
77
|
+
bottom: -100%;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
function withData(param) {
|
|
2
|
+
return param < 10 ? '0' + param : '' + param;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
function getLoopArray(start, end) {
|
|
6
|
+
var start = start || 0;
|
|
7
|
+
var end = end || 1;
|
|
8
|
+
var array = [];
|
|
9
|
+
for (var i = start; i <= end; i++) {
|
|
10
|
+
array.push(withData(i))
|
|
11
|
+
}
|
|
12
|
+
return array;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 获取月份中日期数据
|
|
17
|
+
* @param {*} year 当前所选择年份
|
|
18
|
+
* @param {*} month 当前所选择月份
|
|
19
|
+
*/
|
|
20
|
+
function getMonthDay(year, month) {
|
|
21
|
+
var flag = year % 400 == 0 || (year % 4 == 0 && year % 100 != 0),
|
|
22
|
+
array = null;
|
|
23
|
+
|
|
24
|
+
switch (month) {
|
|
25
|
+
case '01':
|
|
26
|
+
case '03':
|
|
27
|
+
case '05':
|
|
28
|
+
case '07':
|
|
29
|
+
case '08':
|
|
30
|
+
case '10':
|
|
31
|
+
case '12':
|
|
32
|
+
array = getLoopArray(1, 31)
|
|
33
|
+
break;
|
|
34
|
+
case '04':
|
|
35
|
+
case '06':
|
|
36
|
+
case '09':
|
|
37
|
+
case '11':
|
|
38
|
+
array = getLoopArray(1, 30)
|
|
39
|
+
break;
|
|
40
|
+
case '02':
|
|
41
|
+
array = flag ? getLoopArray(1, 29) : getLoopArray(1, 28)
|
|
42
|
+
break;
|
|
43
|
+
default:
|
|
44
|
+
array = '月份格式不正确,请重新输入!'
|
|
45
|
+
}
|
|
46
|
+
return array;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function getNewDateArray() {
|
|
50
|
+
// 当前时间的处理
|
|
51
|
+
var newDate = new Date()
|
|
52
|
+
var year = withData(newDate.getFullYear()),
|
|
53
|
+
mont = withData(newDate.getMonth() + 1),
|
|
54
|
+
date = withData(newDate.getDate()),
|
|
55
|
+
hour = withData(newDate.getHours()),
|
|
56
|
+
minu = withData(newDate.getMinutes()),
|
|
57
|
+
seco = withData(newDate.getSeconds())
|
|
58
|
+
|
|
59
|
+
return [year, mont, date, hour, minu, seco];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 构建日期时间选择器初始数据
|
|
64
|
+
* @param {*} startYear 开始年份
|
|
65
|
+
* @param {*} endYear 结束年份
|
|
66
|
+
* @param {*} date 初始选中日期时间
|
|
67
|
+
*/
|
|
68
|
+
function dateTimePicker(startYear, endYear, date) {
|
|
69
|
+
// 返回默认显示的数组和联动数组的声明
|
|
70
|
+
var dateTime = []
|
|
71
|
+
var dateTimeArray = [
|
|
72
|
+
[],
|
|
73
|
+
[],
|
|
74
|
+
[],
|
|
75
|
+
[],
|
|
76
|
+
[],
|
|
77
|
+
[]
|
|
78
|
+
]
|
|
79
|
+
var start = startYear || 1978;
|
|
80
|
+
var end = endYear || 2100;
|
|
81
|
+
// 默认开始显示数据
|
|
82
|
+
var defaultDate = date ? [...date.split(' ')[0].split('-'), ...date.split(' ')[1].split(':')] : getNewDateArray()
|
|
83
|
+
// 处理联动列表数据
|
|
84
|
+
// 年月日 时分秒
|
|
85
|
+
dateTimeArray[0] = getLoopArray(start, end)
|
|
86
|
+
dateTimeArray[1] = getLoopArray(1, 12)
|
|
87
|
+
dateTimeArray[2] = getMonthDay(defaultDate[0], defaultDate[1])
|
|
88
|
+
dateTimeArray[3] = getLoopArray(0, 23)
|
|
89
|
+
dateTimeArray[4] = getLoopArray(0, 59)
|
|
90
|
+
dateTimeArray[5] = getLoopArray(0, 59)
|
|
91
|
+
|
|
92
|
+
// 默认选中数据的索引存储
|
|
93
|
+
dateTimeArray.forEach((current, index) => {
|
|
94
|
+
dateTime.push(current.indexOf(defaultDate[index]))
|
|
95
|
+
})
|
|
96
|
+
return {
|
|
97
|
+
dateTimeArray: dateTimeArray,
|
|
98
|
+
dateTime: dateTime
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function dateTime(dateTimeArray, date) {
|
|
103
|
+
var dateTime = []
|
|
104
|
+
var defaultDate = date ? [...date.split(' ')[0].split('-'), ...date.split(' ')[1].split(':')] : getNewDateArray()
|
|
105
|
+
dateTimeArray.forEach((current, index) => {
|
|
106
|
+
dateTime.push(current.indexOf(defaultDate[index]))
|
|
107
|
+
})
|
|
108
|
+
return dateTime
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
module.exports = {
|
|
112
|
+
dateTimePicker: dateTimePicker,
|
|
113
|
+
getMonthDay: getMonthDay,
|
|
114
|
+
dateTime: dateTime
|
|
115
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// components/uikit/web-view-page.js
|
|
2
|
+
Page({
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 页面的初始数据
|
|
7
|
+
*/
|
|
8
|
+
data: {
|
|
9
|
+
url: ''
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 生命周期函数--监听页面加载
|
|
14
|
+
*/
|
|
15
|
+
onLoad(options) {
|
|
16
|
+
wx.showLoading({
|
|
17
|
+
title: '加载中...',
|
|
18
|
+
})
|
|
19
|
+
const url = decodeURIComponent(options.url || '')
|
|
20
|
+
this.setData({
|
|
21
|
+
url: url
|
|
22
|
+
})
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 生命周期函数--监听页面初次渲染完成
|
|
27
|
+
*/
|
|
28
|
+
onReady() {
|
|
29
|
+
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* 生命周期函数--监听页面显示
|
|
34
|
+
*/
|
|
35
|
+
onShow() {
|
|
36
|
+
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 生命周期函数--监听页面隐藏
|
|
41
|
+
*/
|
|
42
|
+
onHide() {
|
|
43
|
+
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* 生命周期函数--监听页面卸载
|
|
48
|
+
*/
|
|
49
|
+
onUnload() {
|
|
50
|
+
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* 页面相关事件处理函数--监听用户下拉动作
|
|
55
|
+
*/
|
|
56
|
+
onPullDownRefresh() {
|
|
57
|
+
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* 页面上拉触底事件的处理函数
|
|
62
|
+
*/
|
|
63
|
+
onReachBottom() {
|
|
64
|
+
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* 用户点击右上角分享
|
|
69
|
+
*/
|
|
70
|
+
onShareAppMessage() {
|
|
71
|
+
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
_bindMessage(data) {
|
|
75
|
+
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
_bindLoad(data) {
|
|
79
|
+
const url = data.detail.src
|
|
80
|
+
wx.hideLoading()
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
_bindError(data) {
|
|
84
|
+
wx.hideLoading()
|
|
85
|
+
wx.navigateBack()
|
|
86
|
+
}
|
|
87
|
+
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/* components/uikit/web-view-page.wxss */
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
//SHA1 加密
|
|
2
|
+
function encodeUTF8(s) {
|
|
3
|
+
var i, r = [], c, x;
|
|
4
|
+
for (i = 0; i < s.length; i++)
|
|
5
|
+
if ((c = s.charCodeAt(i)) < 0x80) r.push(c);
|
|
6
|
+
else if (c < 0x800) r.push(0xC0 + (c >> 6 & 0x1F), 0x80 + (c & 0x3F));
|
|
7
|
+
else {
|
|
8
|
+
if ((x = c ^ 0xD800) >> 10 == 0) //对四字节UTF-16转换为Unicode
|
|
9
|
+
c = (x << 10) + (s.charCodeAt(++i) ^ 0xDC00) + 0x10000,
|
|
10
|
+
r.push(0xF0 + (c >> 18 & 0x7), 0x80 + (c >> 12 & 0x3F));
|
|
11
|
+
else r.push(0xE0 + (c >> 12 & 0xF));
|
|
12
|
+
r.push(0x80 + (c >> 6 & 0x3F), 0x80 + (c & 0x3F));
|
|
13
|
+
};
|
|
14
|
+
return r;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// 字符串加密成 hex 字符串
|
|
18
|
+
function sha1(s) {
|
|
19
|
+
var data = new Uint8Array(encodeUTF8(s))
|
|
20
|
+
var i, j, t;
|
|
21
|
+
var l = ((data.length + 8) >>> 6 << 4) + 16, s = new Uint8Array(l << 2);
|
|
22
|
+
s.set(new Uint8Array(data.buffer)), s = new Uint32Array(s.buffer);
|
|
23
|
+
for (t = new DataView(s.buffer), i = 0; i < l; i++)s[i] = t.getUint32(i << 2);
|
|
24
|
+
s[data.length >> 2] |= 0x80 << (24 - (data.length & 3) * 8);
|
|
25
|
+
s[l - 1] = data.length << 3;
|
|
26
|
+
var w = [], f = [
|
|
27
|
+
function () { return m[1] & m[2] | ~m[1] & m[3]; },
|
|
28
|
+
function () { return m[1] ^ m[2] ^ m[3]; },
|
|
29
|
+
function () { return m[1] & m[2] | m[1] & m[3] | m[2] & m[3]; },
|
|
30
|
+
function () { return m[1] ^ m[2] ^ m[3]; }
|
|
31
|
+
], rol = function (n, c) { return n << c | n >>> (32 - c); },
|
|
32
|
+
k = [1518500249, 1859775393, -1894007588, -899497514],
|
|
33
|
+
m = [1732584193, -271733879, null, null, -1009589776];
|
|
34
|
+
m[2] = ~m[0], m[3] = ~m[1];
|
|
35
|
+
for (i = 0; i < s.length; i += 16) {
|
|
36
|
+
var o = m.slice(0);
|
|
37
|
+
for (j = 0; j < 80; j++)
|
|
38
|
+
w[j] = j < 16 ? s[i + j] : rol(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1),
|
|
39
|
+
t = rol(m[0], 5) + f[j / 20 | 0]() + m[4] + w[j] + k[j / 20 | 0] | 0,
|
|
40
|
+
m[1] = rol(m[1], 30), m.pop(), m.unshift(t);
|
|
41
|
+
for (j = 0; j < 5; j++)m[j] = m[j] + o[j] | 0;
|
|
42
|
+
};
|
|
43
|
+
t = new DataView(new Uint32Array(m).buffer);
|
|
44
|
+
for (var i = 0; i < 5; i++)m[i] = t.getUint32(i << 2);
|
|
45
|
+
|
|
46
|
+
var hex = Array.prototype.map.call(new Uint8Array(new Uint32Array(m).buffer), function (e) {
|
|
47
|
+
return (e < 16 ? "0" : "") + e.toString(16);
|
|
48
|
+
}).join("");
|
|
49
|
+
|
|
50
|
+
return hex;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
module.exports = {
|
|
54
|
+
sha1: sha1 //导出
|
|
55
|
+
}
|
|
56
|
+
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** 解析文本中的超链接 */
|
|
2
|
+
function findLinkFromText(text, typeText, typeUrl) {
|
|
3
|
+
let linkArr = []
|
|
4
|
+
let reg = /[http|https|wxapp|dicom]+:\/\/[\w|\-|_|.|~|!|\*|'|\(|\)|;|:|@|&|=|+|\$|,|\/|\?|#|\[|\]|%]*/g
|
|
5
|
+
let link = reg.exec(text)
|
|
6
|
+
while (link) {
|
|
7
|
+
linkArr.push(link[0]);
|
|
8
|
+
link = reg.exec(text)
|
|
9
|
+
}
|
|
10
|
+
let txtArr = ''
|
|
11
|
+
if (typeText) {
|
|
12
|
+
txtArr = text.split(typeText)
|
|
13
|
+
txtArr.splice(1, 0, typeText)
|
|
14
|
+
} else {
|
|
15
|
+
txtArr = text.split(reg)
|
|
16
|
+
}
|
|
17
|
+
let arr = []
|
|
18
|
+
for (let i = 0; i < txtArr.length; i++) {
|
|
19
|
+
if (typeText && typeText == txtArr[i]) {
|
|
20
|
+
if (typeUrl) {
|
|
21
|
+
arr.push({
|
|
22
|
+
type: 'link',
|
|
23
|
+
value: typeUrl,
|
|
24
|
+
name: typeText
|
|
25
|
+
})
|
|
26
|
+
} else {
|
|
27
|
+
arr.push({
|
|
28
|
+
type: 'light',
|
|
29
|
+
value: txtArr[i],
|
|
30
|
+
name: typeText
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
} else if (txtArr[i]) {
|
|
34
|
+
arr.push({
|
|
35
|
+
type: 'text',
|
|
36
|
+
name: txtArr[i]
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
if (i < linkArr.length) {
|
|
40
|
+
arr.push({
|
|
41
|
+
type: 'link',
|
|
42
|
+
value: linkArr[i],
|
|
43
|
+
name: linkArr[i]
|
|
44
|
+
})
|
|
45
|
+
// getLinkName(linkArr[i])
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return arr
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function getLinkName(link) {
|
|
52
|
+
if (link.toLowerCase().startsWith('wxapp://')) return '点此打开'
|
|
53
|
+
if (link.toLowerCase().startsWith('dicom://upload/guide')) return '点击查看如何上传'
|
|
54
|
+
return '点此前往'
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
module.exports = {
|
|
58
|
+
findLinkFromText
|
|
59
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
function getHommizationTime(time) {
|
|
2
|
+
//var d = new Date(time);
|
|
3
|
+
if (!time) return '';
|
|
4
|
+
var timeText = getTimeRegion(time) + ' ' + getHourMinute(time);
|
|
5
|
+
|
|
6
|
+
if (isToday(time)) {
|
|
7
|
+
|
|
8
|
+
return timeText;
|
|
9
|
+
} else if (isYestoday(time)) {
|
|
10
|
+
return '昨天' + timeText;
|
|
11
|
+
} else {
|
|
12
|
+
return getYearMonthDate(time) + timeText;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function isToday(time) {
|
|
17
|
+
var d = getDayStart();
|
|
18
|
+
return time >= d;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function isYestoday(time) {
|
|
22
|
+
var d = getDayStart();
|
|
23
|
+
var y = getDayStart() - 24 * 3600 * 1000;
|
|
24
|
+
return time >= y && time < d;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function getTimeRegion(time) {
|
|
28
|
+
var date = new Date(time);
|
|
29
|
+
var hour = date.getHours();
|
|
30
|
+
if (hour < 6) {
|
|
31
|
+
return '凌晨';
|
|
32
|
+
} else if (hour >= 6 && hour < 11) {
|
|
33
|
+
return '上午';
|
|
34
|
+
} else if (hour >= 11 && hour < 13) {
|
|
35
|
+
return '中午';
|
|
36
|
+
} else if (hour >= 13 && hour < 18) {
|
|
37
|
+
return '下午';
|
|
38
|
+
} else {
|
|
39
|
+
return '晚上';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function getHourMinute(time) {
|
|
44
|
+
var date = new Date(time);
|
|
45
|
+
var hour = date.getHours();
|
|
46
|
+
var minute = date.getMinutes();
|
|
47
|
+
if (hour >= 13) {
|
|
48
|
+
hour -= 12;
|
|
49
|
+
}
|
|
50
|
+
return hour + ':' + formatNumber(minute);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function getYearMonthDate(time) {
|
|
54
|
+
var date = new Date(time);
|
|
55
|
+
var year = date.getFullYear();
|
|
56
|
+
var month = date.getMonth() + 1;
|
|
57
|
+
var day = date.getDate();
|
|
58
|
+
return year + '-' + month + '-' + day;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function getDayStart(date) {
|
|
62
|
+
if (!date) {
|
|
63
|
+
date = new Date();
|
|
64
|
+
}
|
|
65
|
+
var year = date.getFullYear();
|
|
66
|
+
var month = date.getMonth();
|
|
67
|
+
var day = date.getDate();
|
|
68
|
+
var start = new Date(year, month, day, 0, 0, 0);
|
|
69
|
+
return start.getTime();
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
function formatNumber(n) {
|
|
73
|
+
n = n.toString()
|
|
74
|
+
return n[1] ? n : '0' + n
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* 计时格式
|
|
79
|
+
* @param {*} s 秒数
|
|
80
|
+
*/
|
|
81
|
+
function formatTimeLength(s) {
|
|
82
|
+
var h = parseInt(s / 3600);
|
|
83
|
+
var m1 = s % 3600;
|
|
84
|
+
var m = parseInt(m1 / 60);
|
|
85
|
+
s = m1 % 60;
|
|
86
|
+
if (h > 0) {
|
|
87
|
+
return formatNumber(h) + ':' + formatNumber(m) + ':' + formatNumber(s);
|
|
88
|
+
} else {
|
|
89
|
+
return formatNumber(m) + ':' + formatNumber(s);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
function format(d, fmt) {
|
|
94
|
+
var o = {
|
|
95
|
+
"M+": d.getMonth() + 1, //月份
|
|
96
|
+
"d+": d.getDate(), //日
|
|
97
|
+
"h+": d.getHours(), //小时
|
|
98
|
+
"m+": d.getMinutes(), //分
|
|
99
|
+
"s+": d.getSeconds(), //秒
|
|
100
|
+
"q+": Math.floor((d.getMonth() + 3) / 3), //季度
|
|
101
|
+
"S": d.getMilliseconds() //毫秒
|
|
102
|
+
};
|
|
103
|
+
if (/(y+)/.test(fmt)) {
|
|
104
|
+
fmt = fmt.replace(RegExp.$1, (d.getFullYear() + "").substr(4 - RegExp.$1.length));
|
|
105
|
+
}
|
|
106
|
+
for (var k in o)
|
|
107
|
+
if (new RegExp("(" + k + ")").test(fmt))
|
|
108
|
+
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
|
|
109
|
+
return fmt;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* 显示xx之前
|
|
114
|
+
* @param {*} millSeconds 毫秒时间戳
|
|
115
|
+
*/
|
|
116
|
+
function dateStringFromNow(millSeconds) {
|
|
117
|
+
const current = new Date().getTime()
|
|
118
|
+
const time = Number.parseFloat((current - millSeconds) / 1000)
|
|
119
|
+
if (time / 60.0 < 1) {
|
|
120
|
+
return '刚刚'
|
|
121
|
+
} else if (time / 3600.0 < 1) {
|
|
122
|
+
return `${Number.parseInt(time/60)}分钟前`;
|
|
123
|
+
} else if (time / 86400.0 < 1) {
|
|
124
|
+
return `${Number.parseInt(time/3600)}小时前`
|
|
125
|
+
} else if (time / 604800.0 < 1) {
|
|
126
|
+
return `${Number.parseInt(time/86400)}天前`
|
|
127
|
+
} else if (time / 2419200.0 <= 1) {
|
|
128
|
+
return `${Number.parseInt(time/604800)}周前`
|
|
129
|
+
} else {
|
|
130
|
+
return `${Number.parseInt(time/2419200)}月前`
|
|
131
|
+
}
|
|
132
|
+
return ''
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
//对外公开接口
|
|
136
|
+
module.exports = {
|
|
137
|
+
getHommizationTime: getHommizationTime,
|
|
138
|
+
getDayStart: getDayStart,
|
|
139
|
+
formatTimeLength: formatTimeLength,
|
|
140
|
+
format: format,
|
|
141
|
+
dateStringFromNow
|
|
142
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
var _key = -1
|
|
2
|
+
const _map = new Map()
|
|
3
|
+
const eventBus = {
|
|
4
|
+
post: function ({
|
|
5
|
+
params: params,
|
|
6
|
+
event: event
|
|
7
|
+
}) {
|
|
8
|
+
for (var eventMap of _map) {
|
|
9
|
+
for (var obj of eventMap[1]) {
|
|
10
|
+
if (obj[0] === event) {
|
|
11
|
+
obj[1](params)
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
off: function ({
|
|
17
|
+
key: key
|
|
18
|
+
}) {
|
|
19
|
+
_map.delete(key)
|
|
20
|
+
},
|
|
21
|
+
on: function ({
|
|
22
|
+
key: key,
|
|
23
|
+
event: event,
|
|
24
|
+
listener: listener
|
|
25
|
+
}) {
|
|
26
|
+
var eventMap = _map[key]
|
|
27
|
+
if (!eventMap) {
|
|
28
|
+
eventMap = new Map()
|
|
29
|
+
_map.set(key, eventMap)
|
|
30
|
+
}
|
|
31
|
+
eventMap.set(event, listener)
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
newKey: function (params) {
|
|
35
|
+
_key++
|
|
36
|
+
return _key
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
module.exports = {
|
|
41
|
+
eventBus
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
### 使用全局事件监测工具说明
|
|
46
|
+
|
|
47
|
+
#### 1. 在app.js的onLaunch中注册事件监听到wx的上下文
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
onLaunch: function (options) {
|
|
51
|
+
wx.eventBus = require('./components/utils/eventBus').eventBus
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
#### 2. 在需要监测通知的地方注册监听
|
|
56
|
+
|
|
57
|
+
> 注册事件使用的唯一标识最好使用`wx.eventBus.newKey()`生成并记录在本地用于在不用监听注册通知的时候进行注销监听使用
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
this.messageEventKey = wx.eventBus.newKey() // 事件注册使用的唯一标识key
|
|
61
|
+
wx.eventBus.on({
|
|
62
|
+
key: this.messageEventKey,
|
|
63
|
+
event: "监听事件的名称", // 例如newMessage
|
|
64
|
+
'listener': (params) => {
|
|
65
|
+
// 在这里处理通知事件
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
#### 3. 在不用监听通知的时候进行注销
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
wx.eventBus.off({
|
|
74
|
+
key: this.messageEventKey
|
|
75
|
+
})
|
|
76
|
+
```
|
|
77
|
+
*/
|