作者 朱振飞

测试

1 -//app.js  
2 -import md5 from 'utils/md5.js';  
3 -App({  
4 - post: function(url, data) {  
5 - wx.showNavigationBarLoading()  
6 - wx.showLoading({  
7 - title: '加载中',  
8 - })  
9 - var promise = new Promise((resolve, reject) => {  
10 - let that = this;  
11 - let postData = data;  
12 - let baseUrl = 'https://insurance.w.broteam.cn/';  
13 - wx.request({  
14 - url: baseUrl + url,  
15 - data: postData,  
16 - method: 'POST',  
17 - header: {  
18 - 'content-type': 'application/x-www-form-urlencoded'  
19 - },  
20 - success: function(res) {  
21 - resolve(res)  
22 - wx.hideLoading()  
23 - wx.hideNavigationBarLoading()  
24 - },  
25 - fail: function(e) {  
26 - reject('');  
27 - wx.hideLoading()  
28 - wx.hideNavigationBarLoading()  
29 - wx.showModal({  
30 - title: '',  
31 - content: res.data.msg,  
32 - showCancel: false  
33 - })  
34 - }  
35 - })  
36 - });  
37 - return promise;  
38 - console.log(promise)  
39 - },  
40 - formCollect(id) {  
41 - let url = 'sign/formid'  
42 - let params = {  
43 - formid: id,  
44 - openid: wx.getStorageSync('openId')  
45 - }  
46 - this.post(url, params).then((res) => {  
47 - console.log(res)  
48 - }).catch((errMsg) => {  
49 -  
50 - })  
51 - },  
52 - nowDate() {  
53 - let date = new Date();  
54 - let month = date.getMonth() + 1;  
55 - let day = date.getDate();  
56 - return date.getFullYear() + '-' + (month > 9 ? month : ('0' + month)) + '-' + (day > 9 ? day : ('0' + day));  
57 - },  
58 - initDate(a) {  
59 - let date1 = new Date();  
60 - let time1 = date1.getFullYear() + "-" + (date1.getMonth() + 1) + "-" + date1.getDate();  
61 - let date2 = new Date(date1);  
62 - date2.setDate(date1.getDate() + a);  
63 - let time2 = date2.getFullYear() + "-" + (date2.getMonth() + 1) + "-" + date2.getDate();  
64 - return time2;  
65 - },  
66 - // 数组移除指定元素  
67 - arryRemove(arr, item) {  
68 - return arr.filter(function(ele) {  
69 - return ele != item;  
70 - })  
71 - },  
72 - strTime(strtime) {  
73 - let str = 'bronet' + strtime + 'beijing'  
74 - return md5(md5(str))  
75 - },  
76 - globalData: {  
77 - userInfo: null,  
78 - OpenId: '', //用户openid  
79 - UserId: '', //用户userid  
80 - UserType: '', //用户类型(2为普通会员,3为顾问,4为推广)  
81 - checkstatus: '', //分享参数(0为无分享参数,1为保单分享,2为注册分享,3为文章分享)  
82 - UserStatus: '', //用户状态(1初次登录需要授权操作,2多次登录不需要授权)  
83 - PublishId: '', //如果是保单分享返回保单id  
84 - NewsId: '', //如果是文章分享返回文章id  
85 - temp_UserType:'',  
86 - user_index:''  
87 - }  
88 -})  
1 -{  
2 - "pages": [  
3 -  
4 - "pages/start/start",  
5 - "pages/index/verigyCode/verigyCode",  
6 - "pages/index/summaryList2/summaryList2",  
7 - "pages/index/register/register",  
8 - "pages/about/about",  
9 - "pages/index/personalPolicyList/personalPolicyList",  
10 - "pages/index/agreement/agreement",  
11 - "pages/index/browseRecordDetail/browseRecordDetail",  
12 - "pages/index/consultantList/consultantList",  
13 - "pages/index/periodicReviews/periodicReviews",  
14 - "pages/index/CustomerManagement/CustomerManagement",  
15 - "pages/index/ArticleDetails/ArticleDetails",  
16 - "pages/index/reportList/reportList",  
17 - "pages/index/reportList2/reportList2",  
18 - "pages/index/editProfile/editProfile",  
19 - "pages/index/editProfile2/editProfile2",  
20 - "pages/index/policyList/policyList",  
21 - "pages/index/policyListDetail/policyListDetail",  
22 - "pages/index/policyManage/policyManage",  
23 - "pages/index/addListDetail/addListDetail",  
24 - "pages/index/personInfo/personInfo",  
25 - "pages/index/addNewFamily/addNewFamily",  
26 - "pages/index/smartRemind/smartRemind",  
27 - "pages/index/VipRecharge/VipRecharge",  
28 - "pages/index/twoCode/twoCode",  
29 - "pages/index/share/share",  
30 - "pages/index/inviteList/inviteList",  
31 - "pages/index/payWay/payWay",  
32 - "pages/index/addLog/addLog",  
33 - "pages/index/remind/remind",  
34 - "pages/index/summaryList/summaryList",  
35 - "pages/index/learnShare/learnShare",  
36 - "pages/index/EntryInformation2/EntryInformation2",  
37 - "pages/index/EntryInformation/EntryInformation",  
38 - "pages/index/Program/Program",  
39 - "pages/index/Suggest/Suggest",  
40 - "pages/index/articleBrowseRecord/articleBrowseRecord",  
41 - "pages/index/browseRecord/browseRecord",  
42 - "pages/index/TB/TB",  
43 - "pages/index/index",  
44 - "pages/personalCenter/personalCenter"  
45 - ],  
46 - "window": {  
47 - "backgroundTextStyle": "light",  
48 - "navigationBarBackgroundColor": "#0286FF",  
49 - "navigationBarTitleText": "保单体检专家",  
50 - "navigationBarTextStyle": "white"  
51 - },  
52 - "tabBar": {  
53 - "color": "#666666",  
54 - "selectedColor": "#487AFF",  
55 - "borderStyle": "black",  
56 - "backgroundColor": "#fff",  
57 - "list": [  
58 - {  
59 - "pagePath": "pages/index/index",  
60 - "text": "首页",  
61 - "iconPath": "/images/nav01@2x.png",  
62 - "selectedIconPath": "/images/nav02@2x.png"  
63 - },  
64 - {  
65 - "pagePath": "pages/about/about",  
66 - "text": "关于",  
67 - "iconPath": "/images/nav03@2x.png",  
68 - "selectedIconPath": "/images/nav04@2x.png"  
69 - },  
70 - {  
71 - "pagePath": "pages/personalCenter/personalCenter",  
72 - "text": "我的",  
73 - "iconPath": "/images/nav05@2x.png",  
74 - "selectedIconPath": "/images/nav06@2x.png"  
75 - }  
76 - ]  
77 - }  
78 -}  
1 -.no_data {  
2 - color: #999;  
3 - font-size: 36rpx;  
4 - text-align: center;  
5 - width: 100%;  
6 - height: 100%;  
7 - position: fixed;  
8 - left: 0;  
9 - top: 0;  
10 - display: flex;  
11 - align-items: center;  
12 - justify-content: center;  
13 -}  
14 -  
15 -button {  
16 - border-radius: 0;  
17 -}  
18 -  
19 -button::after {  
20 - border: 0;  
21 - border-radius: 0;  
22 -}  
23 -  
24 -/* iconfont */  
25 -  
26 -@font-face {  
27 - font-family: 'iconfont'; /* project id 926819 */  
28 - src: url('//at.alicdn.com/t/font_926819_0pzhvmpbjahd.eot');  
29 - src: url('//at.alicdn.com/t/font_926819_0pzhvmpbjahd.eot?#iefix') format('embedded-opentype'),  
30 - url('//at.alicdn.com/t/font_926819_0pzhvmpbjahd.woff2') format('woff2'),  
31 - url('//at.alicdn.com/t/font_926819_0pzhvmpbjahd.woff') format('woff'),  
32 - url('//at.alicdn.com/t/font_926819_0pzhvmpbjahd.ttf') format('truetype'),  
33 - url('//at.alicdn.com/t/font_926819_0pzhvmpbjahd.svg#iconfont') format('svg');  
34 -}  
35 -  
36 -.iconfont {  
37 - font-family: "iconfont" !important;  
38 - font-size: 16px;  
39 - font-style: normal;  
40 - -webkit-font-smoothing: antialiased;  
41 - -moz-osx-font-smoothing: grayscale;  
42 -}  
43 -  
44 -.icon-chongzhi:before {  
45 - content: "\e606";  
46 -}  
47 -  
48 -.icon-bi:before {  
49 - content: "\e60a";  
50 -}  
51 -  
52 -.icon-renzheng:before {  
53 - content: "\e646";  
54 -}  
55 -  
56 -.icon-anquan:before {  
57 - content: "\e63c";  
58 -}  
59 -  
60 -.icon-listpress:before {  
61 - content: "\e627";  
62 -}  
63 -  
64 -.icon-xiala1:before {  
65 - content: "\e61c";  
66 -}  
67 -  
68 -.icon-baodanyuhetong:before {  
69 - content: "\e642";  
70 -}  
71 -  
72 -.icon-shu:before {  
73 - content: "\e645";  
74 -}  
75 -  
76 -.icon-fenxiang2:before {  
77 - content: "\e620";  
78 -}  
79 -  
80 -.icon-fangxingxuanzhongfill:before {  
81 - content: "\e721";  
82 -}  
83 -  
84 -.icon-bianji:before {  
85 - content: "\e6b4";  
86 -}  
87 -  
88 -.icon-zhaoxiangji1:before {  
89 - content: "\e663";  
90 -}  
91 -  
92 -.icon-xuanzhong2:before {  
93 - content: "\e62b";  
94 -}  
95 -  
96 -.icon-guanyuwomen:before {  
97 - content: "\e61e";  
98 -}  
99 -  
100 -.icon-ren-copy:before {  
101 - content: "\e600";  
102 -}  
103 -  
104 -.icon-xuanzhong:before {  
105 - content: "\e61a";  
106 -}  
107 -  
108 -.icon-artboard61:before {  
109 - content: "\e788";  
110 -}  
111 -  
112 -.icon-jinru:before {  
113 - content: "\e618";  
114 -}  
115 -  
116 -.icon-kehu:before {  
117 - content: "\e613";  
118 -}  
119 -  
120 -.icon-jiating1:before {  
121 - content: "\e81d";  
122 -}  
123 -  
124 -.icon-wuuiconxiangjifangda:before {  
125 - content: "\e623";  
126 -}  
127 -  
128 -.icon-guwen:before {  
129 - content: "\e61d";  
130 -}  
131 -  
132 -.icon-tianjia:before {  
133 - content: "\e648";  
134 -}  
135 -  
136 -.icon-xiala:before {  
137 - content: "\e619";  
138 -}  
139 -  
140 -.icon-icon-test:before {  
141 - content: "\e72e";  
142 -}  
143 -  
144 -.icon-fangkuang:before {  
145 - content: "\e629";  
146 -}  
147 -  
148 -.icon-jiating:before {  
149 - content: "\e73d";  
150 -}  
151 -  
152 -.icon-jiaoyijilu:before {  
153 - content: "\e638";  
154 -}  
155 -  
156 -.icon-jinbi:before {  
157 - content: "\e672";  
158 -}  
159 -  
160 -.icon-bianji1:before {  
161 - content: "\e68a";  
162 -}  
163 -  
164 -.icon-mingdanguanli:before {  
165 - content: "\e658";  
166 -}  
167 -  
168 -.icon-renzheng1:before {  
169 - content: "\e62a";  
170 -}  
171 -  
172 -.icon-dkw_wode-:before {  
173 - content: "\e60e";  
174 -}  
175 -  
176 -.icon-guanbi2:before {  
177 - content: "\e60f";  
178 -}  
179 -  
180 -.icon-wenjian:before {  
181 - content: "\e67d";  
182 -}  
183 -  
184 -.icon-xuanzhongyuandian:before {  
185 - content: "\e624";  
186 -}  
187 -  
188 -.icon-sousuo:before {  
189 - content: "\e617";  
190 -}  
191 -  
192 -.icon-xuanze:before {  
193 - content: "\e6c3";  
194 -}  
195 -  
196 -.icon-sousuo1:before {  
197 - content: "\e632";  
198 -}  
199 -  
200 -.icon-yuan:before {  
201 - content: "\e622";  
202 -}  
203 -  
204 -.icon-YDUI-naozhong:before {  
205 - content: "\e65d";  
206 -}  
207 -  
208 -.icon-ren:before {  
209 - content: "\e6d9";  
210 -}  
211 -  
212 -.icon-ziliao:before {  
213 - content: "\e603";  
214 -}  
215 -  
216 -.icon-kehuguanli-copy-copy:before {  
217 - content: "\e63a";  
218 -}  
219 -  
220 -.icon-add:before {  
221 - content: "\e604";  
222 -}  
223 -  
224 -.icon-baodanxinxi:before {  
225 - content: "\e602";  
226 -}  
227 -  
228 -.icon-hengxian1:before {  
229 - content: "\e626";  
230 -}  
231 -  
232 -.icon-riqi:before {  
233 - content: "\ea1a";  
234 -}  
235 -  
236 -.icon-tijian:before {  
237 - content: "\e605";  
238 -}  
239 -  
240 -.icon-hengxian:before {  
241 - content: "\e657";  
242 -}  
243 -  
244 -.icon-gouwuche:before {  
245 - content: "\e609";  
246 -}  
247 -  
248 -.icon-yaoqing:before {  
249 - content: "\e60b";  
250 -}  
251 -  
252 -.icon-guanbi:before {  
253 - content: "\e621";  
254 -}  
255 -  
256 -.icon-xiazai:before {  
257 - content: "\e625";  
258 -}  
259 -  
260 -.icon-fenxiang:before {  
261 - content: "\e62e";  
262 -}  
263 -  
264 -.icon-xuexi:before {  
265 - content: "\e61b";  
266 -}  
267 -  
268 -.icon-baogao:before {  
269 - content: "\e639";  
270 -}  
271 -  
272 -.icon-weixinzhifu:before {  
273 - content: "\e647";  
274 -}  
275 -  
276 -.icon-dianhua:before {  
277 - content: "\e67c";  
278 -}  
279 -  
280 -.icon-xiugai:before {  
281 - content: "\e607";  
282 -}  
283 -  
284 -.icon-xuanzhong1:before {  
285 - content: "\e61f";  
286 -}  
287 -  
288 -.icon-guanli:before {  
289 - content: "\e6e3";  
290 -}  
291 -  
292 -.icon-tixian:before {  
293 - content: "\e62d";  
294 -}  
295 -  
296 -.icon-shang:before {  
297 - content: "\e611";  
298 -}  
299 -  
300 -.icon-rizhi:before {  
301 - content: "\e614";  
302 -}  
303 -  
304 -.icon-baogao1:before {  
305 - content: "\e62f";  
306 -}  
307 -  
308 -.icon-jisuanqi:before {  
309 - content: "\e608";  
310 -}  
311 -  
312 -.icon-jiatingzhanghu:before {  
313 - content: "\e615";  
314 -}  
315 -  
316 -.icon-shuoming:before {  
317 - content: "\e633";  
318 -}  
319 -  
320 -.icon-nav:before {  
321 - content: "\e601";  
322 -}  
323 -  
324 -.icon-xuanzhongkuang:before {  
325 - content: "\e628";  
326 -}  
327 -  
328 -.icon-ling:before {  
329 - content: "\e8bf";  
330 -}  
331 -  
332 -.icon-dianhua2:before {  
333 - content: "\e649";  
334 -}  
335 -  
336 -.icon-fangan:before {  
337 - content: "\e60c";  
338 -}  
339 -  
340 -.icon-fenxiang1:before {  
341 - content: "\e634";  
342 -}  
343 -  
344 -.icon-gray-crown:before {  
345 - content: "\e60d";  
346 -}  
347 -  
348 -.icon-shanchu1:before {  
349 - content: "\e616";  
350 -}  
351 -  
352 -.icon-kakou:before {  
353 - content: "\e660";  
354 -}  
355 -  
356 -.icon-shezhi:before {  
357 - content: "\e610";  
358 -}  
359 -  
360 -.icon-jianyi:before {  
361 - content: "\e696";  
362 -}  
363 -  
364 -.icon-zhuanfa:before {  
365 - content: "\e783";  
366 -}  
367 -  
368 -.icon-shanchu:before {  
369 - content: "\e67b";  
370 -}  
371 -  
372 -.icon-danjiantou:before {  
373 - content: "\e612";  
374 -}  
1 -{  
2 - "description": "项目配置文件",  
3 - "packOptions": {  
4 - "ignore": []  
5 - },  
6 - "setting": {  
7 - "urlCheck": true,  
8 - "es6": true,  
9 - "postcss": true,  
10 - "minified": true,  
11 - "newFeature": true,  
12 - "autoAudits": false  
13 - },  
14 - "compileType": "miniprogram",  
15 - "libVersion": "2.4.0",  
16 - "appid": "wxac365079a43a66bb",  
17 - "projectname": "%E5%AE%B6%E5%BA%AD%E4%BF%9D%E9%99%A91",  
18 - "debugOptions": {  
19 - "hidedInDevtools": []  
20 - },  
21 - "isGameTourist": false,  
22 - "condition": {  
23 - "search": {  
24 - "current": -1,  
25 - "list": []  
26 - },  
27 - "conversation": {  
28 - "current": -1,  
29 - "list": []  
30 - },  
31 - "plugin": {  
32 - "current": -1,  
33 - "list": []  
34 - },  
35 - "game": {  
36 - "currentL": -1,  
37 - "list": []  
38 - },  
39 - "miniprogram": {  
40 - "current": -1,  
41 - "list": [  
42 - {  
43 - "id": 0,  
44 - "name": "保单添加",  
45 - "pathName": "pages/index/addListDetail/addListDetail",  
46 - "query": "",  
47 - "scene": null  
48 - },  
49 - {  
50 - "id": -1,  
51 - "name": "保单体检",  
52 - "pathName": "pages/index/periodicReviews/periodicReviews",  
53 - "query": ""  
54 - },  
55 - {  
56 - "id": 2,  
57 - "name": "保单体检",  
58 - "pathName": "pages/index/periodicReviews/periodicReviews",  
59 - "query": "allinfo={\"family_id\":128,\"warn_time\":0,\"warn_status\":0,\"infor\":2,\"users\":[{\"family_id\":128,\"id\":241,\"name\":\"测试\",\"family_role\":\"家住\",\"user_family\":1,\"cid\":413,\"key_status\":0},{\"family_id\":128,\"id\":242,\"name\":\"ceshi\",\"family_role\":\"haiz\",\"user_family\":0,\"cid\":413,\"key_status\":0}]}"  
60 - },  
61 - {  
62 - "id": -1,  
63 - "name": "个人信息录入",  
64 - "pathName": "pages/index/EntryInformation/EntryInformation",  
65 - "query": ""  
66 - },  
67 - {  
68 - "id": 4,  
69 - "name": "编辑保单",  
70 - "pathName": "pages/index/addListDetail/addListDetail",  
71 - "query": "def_id=105&inforid=68&FamilyId=53",  
72 - "scene": null  
73 - },  
74 - {  
75 - "id": -1,  
76 - "name": "方案预设",  
77 - "pathName": "pages/index/Program/Program",  
78 - "query": ""  
79 - },  
80 - {  
81 - "id": -1,  
82 - "name": "center",  
83 - "pathName": "pages/personalCenter/personalCenter",  
84 - "query": ""  
85 - },  
86 - {  
87 - "id": -1,  
88 - "name": "保单汇总表",  
89 - "pathName": "pages/index/summaryList/summaryList",  
90 - "query": "allinfo={\"family_id\":130,\"warn_time\":0,\"warn_status\":0,\"infor\":1,\"users\":[{\"family_id\":130,\"id\":245,\"name\":\"ceshi\",\"family_role\":\"dsfs\",\"user_family\":1,\"cid\":413,\"key_status\":0}]}"  
91 - },  
92 - {  
93 - "id": -1,  
94 - "name": "提醒和跟踪",  
95 - "pathName": "pages/index/remind/remind",  
96 - "query": "cid=5&mainid=127",  
97 - "scene": null  
98 - }  
99 - ]  
100 - }  
101 - }  
102 -}  
1 -function withData(param) {  
2 - return param < 10 ? '0' + param : '' + param;  
3 -}  
4 -function getLoopArray(start, end) {  
5 - var start = start || 0;  
6 - var end = end || 1;  
7 - var array = [];  
8 - for (var i = start; i <= end; i++) {  
9 - array.push(withData(i));  
10 - }  
11 - return array;  
12 -}  
13 -function getMonthDay(year, month) {  
14 - var flag = year % 400 == 0 || (year % 4 == 0 && year % 100 != 0), array = null;  
15 -  
16 - switch (month) {  
17 - case '01':  
18 - case '03':  
19 - case '05':  
20 - case '07':  
21 - case '08':  
22 - case '10':  
23 - case '12':  
24 - array = getLoopArray(1, 31)  
25 - break;  
26 - case '04':  
27 - case '06':  
28 - case '09':  
29 - case '11':  
30 - array = getLoopArray(1, 30)  
31 - break;  
32 - case '02':  
33 - array = flag ? getLoopArray(1, 29) : getLoopArray(1, 28)  
34 - break;  
35 - default:  
36 - array = '月份格式不正确,请重新输入!'  
37 - }  
38 - return array;  
39 -}  
40 -function getNewDateArry() {  
41 - // 当前时间的处理  
42 - var newDate = new Date();  
43 - var year = withData(newDate.getFullYear()),  
44 - mont = withData(newDate.getMonth() + 1),  
45 - date = withData(newDate.getDate()),  
46 - hour = withData(newDate.getHours()),  
47 - minu = withData(newDate.getMinutes()),  
48 - seco = withData(newDate.getSeconds());  
49 -  
50 - return [year, mont, date, hour, minu, seco];  
51 -}  
52 -function dateTimePicker(startYear, endYear, date) {  
53 - // 返回默认显示的数组和联动数组的声明  
54 - var dateTime = [], dateTimeArray = [[], [], [], [], [], []];  
55 - var start = startYear || 1978;  
56 - var end = endYear || 2100;  
57 - // 默认开始显示数据  
58 - var defaultDate = date ? [...date.split(' ')[0].split('-'), ...date.split(' ')[1].split(':')] : getNewDateArry();  
59 - // 处理联动列表数据  
60 - /*年月日 时分秒*/  
61 - dateTimeArray[0] = getLoopArray(start, end);  
62 - dateTimeArray[1] = getLoopArray(1, 12);  
63 - dateTimeArray[2] = getMonthDay(defaultDate[0], defaultDate[1]);  
64 - dateTimeArray[3] = getLoopArray(0, 23);  
65 - dateTimeArray[4] = getLoopArray(0, 59);  
66 - dateTimeArray[5] = getLoopArray(0, 59);  
67 -  
68 - dateTimeArray.forEach((current, index) => {  
69 - dateTime.push(current.indexOf(defaultDate[index]));  
70 - });  
71 -  
72 - return {  
73 - dateTimeArray: dateTimeArray,  
74 - dateTime: dateTime  
75 - }  
76 -}  
77 -module.exports = {  
78 - dateTimePicker: dateTimePicker,  
79 - getMonthDay: getMonthDay  
80 -}  
1 -/*  
2 - * 小程序MD5加密算法封装  
3 - * +-----------------------------------------------------  
4 - * Author: 武当山道士  
5 - * Created: 2018-01-06  
6 - * Md5 Lib Source: http://cdn.bootcss.com/blueimp-md5/1.1.0/js/md5.js  
7 - * Tips: js库文件改装,加密算法没动,我只是封装了一下,便于小程序调用  
8 - * Thanks: 感谢js库文件作者 Sebastian Tschan 的辛勤付出  
9 - * +-----------------------------------------------------  
10 - * Usage:  
11 - *  
12 - * 引入(比如index.js页面引入md5.js):  
13 - * //pages/index.js  
14 - * import md5 from 'utils/md5.js';  
15 - *  
16 - * 调用base64MD5加密:  
17 - * var encryptedStr = md5('需要加密的字符串');  
18 - */  
19 -  
20 -function safe_add(x, y) {  
21 - var lsw = (x & 0xFFFF) + (y & 0xFFFF),  
22 - msw = (x >> 16) + (y >> 16) + (lsw >> 16);  
23 - return (msw << 16) | (lsw & 0xFFFF);  
24 -}  
25 -  
26 -/*  
27 -* Bitwise rotate a 32-bit number to the left.  
28 -*/  
29 -function bit_rol(num, cnt) {  
30 - return (num << cnt) | (num >>> (32 - cnt));  
31 -}  
32 -  
33 -/*  
34 -* These functions implement the four basic operations the algorithm uses.  
35 -*/  
36 -function md5_cmn(q, a, b, x, s, t) {  
37 - return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b);  
38 -}  
39 -function md5_ff(a, b, c, d, x, s, t) {  
40 - return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);  
41 -}  
42 -function md5_gg(a, b, c, d, x, s, t) {  
43 - return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);  
44 -}  
45 -function md5_hh(a, b, c, d, x, s, t) {  
46 - return md5_cmn(b ^ c ^ d, a, b, x, s, t);  
47 -}  
48 -function md5_ii(a, b, c, d, x, s, t) {  
49 - return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);  
50 -}  
51 -  
52 -/*  
53 -* Calculate the MD5 of an array of little-endian words, and a bit length.  
54 -*/  
55 -function binl_md5(x, len) {  
56 - /* append padding */  
57 - x[len >> 5] |= 0x80 << (len % 32);  
58 - x[(((len + 64) >>> 9) << 4) + 14] = len;  
59 -  
60 - var i, olda, oldb, oldc, oldd,  
61 - a = 1732584193,  
62 - b = -271733879,  
63 - c = -1732584194,  
64 - d = 271733878;  
65 -  
66 - for (i = 0; i < x.length; i += 16) {  
67 - olda = a;  
68 - oldb = b;  
69 - oldc = c;  
70 - oldd = d;  
71 -  
72 - a = md5_ff(a, b, c, d, x[i], 7, -680876936);  
73 - d = md5_ff(d, a, b, c, x[i + 1], 12, -389564586);  
74 - c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819);  
75 - b = md5_ff(b, c, d, a, x[i + 3], 22, -1044525330);  
76 - a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897);  
77 - d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426);  
78 - c = md5_ff(c, d, a, b, x[i + 6], 17, -1473231341);  
79 - b = md5_ff(b, c, d, a, x[i + 7], 22, -45705983);  
80 - a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416);  
81 - d = md5_ff(d, a, b, c, x[i + 9], 12, -1958414417);  
82 - c = md5_ff(c, d, a, b, x[i + 10], 17, -42063);  
83 - b = md5_ff(b, c, d, a, x[i + 11], 22, -1990404162);  
84 - a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682);  
85 - d = md5_ff(d, a, b, c, x[i + 13], 12, -40341101);  
86 - c = md5_ff(c, d, a, b, x[i + 14], 17, -1502002290);  
87 - b = md5_ff(b, c, d, a, x[i + 15], 22, 1236535329);  
88 -  
89 - a = md5_gg(a, b, c, d, x[i + 1], 5, -165796510);  
90 - d = md5_gg(d, a, b, c, x[i + 6], 9, -1069501632);  
91 - c = md5_gg(c, d, a, b, x[i + 11], 14, 643717713);  
92 - b = md5_gg(b, c, d, a, x[i], 20, -373897302);  
93 - a = md5_gg(a, b, c, d, x[i + 5], 5, -701558691);  
94 - d = md5_gg(d, a, b, c, x[i + 10], 9, 38016083);  
95 - c = md5_gg(c, d, a, b, x[i + 15], 14, -660478335);  
96 - b = md5_gg(b, c, d, a, x[i + 4], 20, -405537848);  
97 - a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438);  
98 - d = md5_gg(d, a, b, c, x[i + 14], 9, -1019803690);  
99 - c = md5_gg(c, d, a, b, x[i + 3], 14, -187363961);  
100 - b = md5_gg(b, c, d, a, x[i + 8], 20, 1163531501);  
101 - a = md5_gg(a, b, c, d, x[i + 13], 5, -1444681467);  
102 - d = md5_gg(d, a, b, c, x[i + 2], 9, -51403784);  
103 - c = md5_gg(c, d, a, b, x[i + 7], 14, 1735328473);  
104 - b = md5_gg(b, c, d, a, x[i + 12], 20, -1926607734);  
105 -  
106 - a = md5_hh(a, b, c, d, x[i + 5], 4, -378558);  
107 - d = md5_hh(d, a, b, c, x[i + 8], 11, -2022574463);  
108 - c = md5_hh(c, d, a, b, x[i + 11], 16, 1839030562);  
109 - b = md5_hh(b, c, d, a, x[i + 14], 23, -35309556);  
110 - a = md5_hh(a, b, c, d, x[i + 1], 4, -1530992060);  
111 - d = md5_hh(d, a, b, c, x[i + 4], 11, 1272893353);  
112 - c = md5_hh(c, d, a, b, x[i + 7], 16, -155497632);  
113 - b = md5_hh(b, c, d, a, x[i + 10], 23, -1094730640);  
114 - a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174);  
115 - d = md5_hh(d, a, b, c, x[i], 11, -358537222);  
116 - c = md5_hh(c, d, a, b, x[i + 3], 16, -722521979);  
117 - b = md5_hh(b, c, d, a, x[i + 6], 23, 76029189);  
118 - a = md5_hh(a, b, c, d, x[i + 9], 4, -640364487);  
119 - d = md5_hh(d, a, b, c, x[i + 12], 11, -421815835);  
120 - c = md5_hh(c, d, a, b, x[i + 15], 16, 530742520);  
121 - b = md5_hh(b, c, d, a, x[i + 2], 23, -995338651);  
122 -  
123 - a = md5_ii(a, b, c, d, x[i], 6, -198630844);  
124 - d = md5_ii(d, a, b, c, x[i + 7], 10, 1126891415);  
125 - c = md5_ii(c, d, a, b, x[i + 14], 15, -1416354905);  
126 - b = md5_ii(b, c, d, a, x[i + 5], 21, -57434055);  
127 - a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571);  
128 - d = md5_ii(d, a, b, c, x[i + 3], 10, -1894986606);  
129 - c = md5_ii(c, d, a, b, x[i + 10], 15, -1051523);  
130 - b = md5_ii(b, c, d, a, x[i + 1], 21, -2054922799);  
131 - a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359);  
132 - d = md5_ii(d, a, b, c, x[i + 15], 10, -30611744);  
133 - c = md5_ii(c, d, a, b, x[i + 6], 15, -1560198380);  
134 - b = md5_ii(b, c, d, a, x[i + 13], 21, 1309151649);  
135 - a = md5_ii(a, b, c, d, x[i + 4], 6, -145523070);  
136 - d = md5_ii(d, a, b, c, x[i + 11], 10, -1120210379);  
137 - c = md5_ii(c, d, a, b, x[i + 2], 15, 718787259);  
138 - b = md5_ii(b, c, d, a, x[i + 9], 21, -343485551);  
139 -  
140 - a = safe_add(a, olda);  
141 - b = safe_add(b, oldb);  
142 - c = safe_add(c, oldc);  
143 - d = safe_add(d, oldd);  
144 - }  
145 - return [a, b, c, d];  
146 -}  
147 -  
148 -/*  
149 -* Convert an array of little-endian words to a string  
150 -*/  
151 -function binl2rstr(input) {  
152 - var i,  
153 - output = '';  
154 - for (i = 0; i < input.length * 32; i += 8) {  
155 - output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xFF);  
156 - }  
157 - return output;  
158 -}  
159 -  
160 -/*  
161 -* Convert a raw string to an array of little-endian words  
162 -* Characters >255 have their high-byte silently ignored.  
163 -*/  
164 -function rstr2binl(input) {  
165 - var i,  
166 - output = [];  
167 - output[(input.length >> 2) - 1] = undefined;  
168 - for (i = 0; i < output.length; i += 1) {  
169 - output[i] = 0;  
170 - }  
171 - for (i = 0; i < input.length * 8; i += 8) {  
172 - output[i >> 5] |= (input.charCodeAt(i / 8) & 0xFF) << (i % 32);  
173 - }  
174 - return output;  
175 -}  
176 -  
177 -/*  
178 -* Calculate the MD5 of a raw string  
179 -*/  
180 -function rstr_md5(s) {  
181 - return binl2rstr(binl_md5(rstr2binl(s), s.length * 8));  
182 -}  
183 -  
184 -/*  
185 -* Calculate the HMAC-MD5, of a key and some data (raw strings)  
186 -*/  
187 -function rstr_hmac_md5(key, data) {  
188 - var i,  
189 - bkey = rstr2binl(key),  
190 - ipad = [],  
191 - opad = [],  
192 - hash;  
193 - ipad[15] = opad[15] = undefined;  
194 - if (bkey.length > 16) {  
195 - bkey = binl_md5(bkey, key.length * 8);  
196 - }  
197 - for (i = 0; i < 16; i += 1) {  
198 - ipad[i] = bkey[i] ^ 0x36363636;  
199 - opad[i] = bkey[i] ^ 0x5C5C5C5C;  
200 - }  
201 - hash = binl_md5(ipad.concat(rstr2binl(data)), 512 + data.length * 8);  
202 - return binl2rstr(binl_md5(opad.concat(hash), 512 + 128));  
203 -}  
204 -  
205 -/*  
206 -* Convert a raw string to a hex string  
207 -*/  
208 -function rstr2hex(input) {  
209 - var hex_tab = '0123456789abcdef',  
210 - output = '',  
211 - x,  
212 - i;  
213 - for (i = 0; i < input.length; i += 1) {  
214 - x = input.charCodeAt(i);  
215 - output += hex_tab.charAt((x >>> 4) & 0x0F) +  
216 - hex_tab.charAt(x & 0x0F);  
217 - }  
218 - return output;  
219 -}  
220 -  
221 -/*  
222 -* Encode a string as utf-8  
223 -*/  
224 -function str2rstr_utf8(input) {  
225 - return unescape(encodeURIComponent(input));  
226 -}  
227 -  
228 -/*  
229 -* Take string arguments and return either raw or hex encoded strings  
230 -*/  
231 -function raw_md5(s) {  
232 - return rstr_md5(str2rstr_utf8(s));  
233 -}  
234 -function hex_md5(s) {  
235 - return rstr2hex(raw_md5(s));  
236 -}  
237 -function raw_hmac_md5(k, d) {  
238 - return rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d));  
239 -}  
240 -function hex_hmac_md5(k, d) {  
241 - return rstr2hex(raw_hmac_md5(k, d));  
242 -}  
243 -  
244 -/**  
245 - * 暴露接口给小程序 因为export default,所以引入的时候可以自定义方法名称  
246 - * +--------------------  
247 - * @param {String} string 需要加密的字符串  
248 - * @param {String} key 加密key  
249 - * @param {Boolean} raw 规则 false: 返回hex_md5, true: 返回raw_md5  
250 - */  
251 -export default function md5(string, key, raw) {  
252 - if (!key) {  
253 - if (!raw) {  
254 - return hex_md5(string);  
255 - }  
256 - return raw_md5(string);  
257 - }  
258 - if (!raw) {  
259 - return hex_hmac_md5(key, string);  
260 - }  
261 - return raw_hmac_md5(key, string);  
262 -}  
1 -function formatTime(date) {  
2 - var year = date.getFullYear()  
3 - var month = date.getMonth() + 1  
4 - var day = date.getDate()  
5 -  
6 - var hour = date.getHours()  
7 - var minute = date.getMinutes()  
8 - var second = date.getSeconds()  
9 -  
10 -  
11 - return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')  
12 -}  
13 -  
14 -function formatNumber(n) {  
15 - n = n.toString()  
16 - return n[1] ? n : '0' + n  
17 -}  
18 -  
19 -module.exports = {  
20 - formatTime: formatTime  
21 -}  
22 -  
23 -function chooseTimeFormat(callback) {  
24 - //格式化日期时间  
25 - Date.prototype.pattern = function (fmt) {  
26 - var o = {  
27 - "M+": this.getMonth() + 1, //月份  
28 - "d+": this.getDate(), //日  
29 - "h+": this.getHours() % 12 == 0 ? 12 : this.getHours() % 12, //小时  
30 - "H+": this.getHours(), //小时  
31 - "m+": this.getMinutes(), //分  
32 - "s+": this.getSeconds(), //秒  
33 - "q+": Math.floor((this.getMonth() + 3) / 3), //季度  
34 - "S": this.getMilliseconds() //毫秒  
35 - };  
36 - var week = {  
37 - "0": "/u65e5",  
38 - "1": "/u4e00",  
39 - "2": "/u4e8c",  
40 - "3": "/u4e09",  
41 - "4": "/u56db",  
42 - "5": "/u4e94",  
43 - "6": "/u516d"  
44 - };  
45 - if (/(y+)/.test(fmt)) {  
46 - fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));  
47 - }  
48 - if (/(E+)/.test(fmt)) {  
49 - fmt = fmt.replace(RegExp.$1, ((RegExp.$1.length > 1) ? (RegExp.$1.length > 2 ? "/u661f/u671f" : "/u5468") : "") + week[this.getDay() + ""]);  
50 - }  
51 - for (var k in o) {  
52 - if (new RegExp("(" + k + ")").test(fmt)) {  
53 - fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));  
54 - }  
55 - }  
56 - return fmt;  
57 - }  
58 -  
59 - var date = new Date();  
60 - console.log("格式化前:" + date);  
61 - var fmtDate = date.pattern("yyyy-MM-dd hh:mm:ss");  
62 - console.log("格式化后:" + fmtDate);  
63 - callback(fmtDate, date);  
64 -  
65 -}  
66 -module.exports.chooseTimeFormat = chooseTimeFormat;  
1 -const formatTime = date => {  
2 - const year = date.getFullYear()  
3 - const month = date.getMonth() + 1  
4 - const day = date.getDate()  
5 - const hour = date.getHours()  
6 - const minute = date.getMinutes()  
7 - const second = date.getSeconds()  
8 -  
9 - return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')  
10 -}  
11 -  
12 -const formatNumber = n => {  
13 - n = n.toString()  
14 - return n[1] ? n : '0' + n  
15 -}  
16 -  
17 -module.exports = {  
18 - formatTime: formatTime  
19 -}