正在显示
87 个修改的文件
包含
4086 行增加
和
0 行删除
app.js
0 → 100644
1 | +var ald = require('./utils/ald-stat.js'); | ||
2 | +//app.js | ||
3 | +App({ | ||
4 | + onLaunch: function () { | ||
5 | + // 展示本地存储能力 | ||
6 | + var logs = wx.getStorageSync('logs') || [] | ||
7 | + logs.unshift(Date.now()) | ||
8 | + wx.setStorageSync('logs', logs) | ||
9 | + | ||
10 | + }, | ||
11 | + post: function (url, data) { | ||
12 | + /** | ||
13 | + * 自定义post函数,返回Promise | ||
14 | + * +------------------- | ||
15 | + * @param {String} url 接口网址 | ||
16 | + * @param {arrayObject} data 要传的数组对象 like: {name: 'name', age: 32} | ||
17 | + * +------------------- | ||
18 | + * @return {Promise} promise 返回promise供后续操作 | ||
19 | + */ | ||
20 | + // wx.showLoading({ | ||
21 | + // title: '加载中', | ||
22 | + // }) | ||
23 | + wx.showNavigationBarLoading() | ||
24 | + var promise = new Promise((resolve, reject) => { | ||
25 | + //init | ||
26 | + let that = this; | ||
27 | + let postData = data; | ||
28 | + let baseUrl = 'http://zhouli.w.bronet.cn/api/zhouli'; | ||
29 | + // let baseUrl = ' https://tzzl.superkangaroo.net'; | ||
30 | + // postData.signature = that.makeSign(postData); | ||
31 | + //网络请求 | ||
32 | + wx.request({ | ||
33 | + url: baseUrl + url, | ||
34 | + data: postData, | ||
35 | + method: 'POST', | ||
36 | + header: { | ||
37 | + 'content-type': 'application/x-www-form-urlencoded', | ||
38 | + 'XX-Token': wx.getStorageSync('token') | ||
39 | + }, | ||
40 | + success: function (res) {//返回取得的数据 | ||
41 | + if (res.data.code == '20000') { | ||
42 | + resolve(res.data.data); | ||
43 | + } else if (res.data.code == '20001') {//返回错误提示信息 | ||
44 | + wx.showModal({ | ||
45 | + title: '提示', | ||
46 | + content: res.data.msg, | ||
47 | + success: function (res) { | ||
48 | + if (res.confirm) { | ||
49 | + wx.removeStorageSync('token'); | ||
50 | + wx.navigateTo({ | ||
51 | + url: '/pages/startRecord/startRecord', | ||
52 | + }) | ||
53 | + } | ||
54 | + } | ||
55 | + }) | ||
56 | + }else if(res.data.code == '40001'){//返回错误提示信息 | ||
57 | + wx.showModal({ | ||
58 | + title: '提示', | ||
59 | + content: '登录已过期请重新登录!', | ||
60 | + showCancel: false, | ||
61 | + success: function(res){ | ||
62 | + if(res.confirm){ | ||
63 | + wx.removeStorageSync('token'); | ||
64 | + wx.navigateTo({ | ||
65 | + url: '/pages/startRecord/startRecord', | ||
66 | + }) | ||
67 | + } | ||
68 | + } | ||
69 | + }) | ||
70 | + } else if (res.data.code == '40000'){ | ||
71 | + wx.showModal({ | ||
72 | + title: '提示', | ||
73 | + content: res.data.msg, | ||
74 | + showCancel: false, | ||
75 | + success: function (res) {} | ||
76 | + }) | ||
77 | + } else if (res.data.code == '44004') { | ||
78 | + wx.showModal({ | ||
79 | + title: '提示', | ||
80 | + content: res.data.msg, | ||
81 | + showCancel: false, | ||
82 | + success: function (res) { | ||
83 | + wx.navigateBack() | ||
84 | + } | ||
85 | + }) | ||
86 | + } else if (res.data.code == '44002'){ | ||
87 | + // 初始化用户信息判断 | ||
88 | + let usetrInfoType = { | ||
89 | + hasUserInfo: false | ||
90 | + } | ||
91 | + resolve(usetrInfoType); | ||
92 | + // wx.showModal({ | ||
93 | + // title: '提示', | ||
94 | + // content: res.data.msg, | ||
95 | + // showCancel: false | ||
96 | + // }) | ||
97 | + }else{ | ||
98 | + wx.showModal({ | ||
99 | + title: '提示', | ||
100 | + content: res.data.msg, | ||
101 | + showCancel: false | ||
102 | + }) | ||
103 | + reject(res.data) | ||
104 | + } | ||
105 | + setTimeout(function () { | ||
106 | + // wx.hideLoading() | ||
107 | + wx.hideNavigationBarLoading() | ||
108 | + }, 600) | ||
109 | + }, | ||
110 | + error: function (e) { | ||
111 | + reject('网络出错'); | ||
112 | + // wx.hideLoading() | ||
113 | + wx.hideNavigationBarLoading() | ||
114 | + } | ||
115 | + }) | ||
116 | + }); | ||
117 | + return promise; | ||
118 | + }, | ||
119 | + nowDate(){ | ||
120 | + let date = new Date(); | ||
121 | + let month = date.getMonth()+1; | ||
122 | + let day = date.getDate(); | ||
123 | + return date.getFullYear()+'-'+(month>9?month:('0'+month))+'-'+(day>9?day:('0'+day)); | ||
124 | + }, | ||
125 | + minDate(){ | ||
126 | + let date = new Date(); | ||
127 | + date.setDate(date.getDate() - 287); | ||
128 | + let m = date.getMonth() + 1; | ||
129 | + return date.getFullYear() + '-' + m + '-' + date.getDate(); | ||
130 | + }, | ||
131 | + globalData: { | ||
132 | + userInfo: null, | ||
133 | + appInfo:{ | ||
134 | + | ||
135 | + } | ||
136 | + } | ||
137 | +}) |
app.json
0 → 100644
1 | +{ | ||
2 | + "pages": [ | ||
3 | + "pages/startRecord/startRecord", | ||
4 | + "pages/baseInfo/baseInfo", | ||
5 | + "pages/weight/weight", | ||
6 | + "pages/bchao/bchao", | ||
7 | + "pages/userInfo/userInfo", | ||
8 | + "pages/personal/personal", | ||
9 | + "pages/xiyiDetail/xieyidetail", | ||
10 | + "pages/index/index", | ||
11 | + "pages/addbchao/addbchao", | ||
12 | + "pages/logs/logs", | ||
13 | + "pages/changeBaseInfo/changeBaseInfo", | ||
14 | + "pages/addWeight/addWeight", | ||
15 | + "pages/changebchao/changebchao" | ||
16 | + ], | ||
17 | + "window": { | ||
18 | + "backgroundTextStyle": "dark", | ||
19 | + "navigationBarBackgroundColor": "#51DBA2", | ||
20 | + "navigationBarTitleText": "孕期体重管理小助手", | ||
21 | + "navigationBarTextStyle": "#FFF" | ||
22 | + }, | ||
23 | + "tabBar": { | ||
24 | + "color": "#999", | ||
25 | + "selectedColor": "#7ED99D", | ||
26 | + "backgroundColor": "#000000", | ||
27 | + "list": [ | ||
28 | + { | ||
29 | + "text": "体重记录", | ||
30 | + "selectedIconPath": "images/1.0.png", | ||
31 | + "iconPath": "images/1.1.png", | ||
32 | + "pagePath": "pages/weight/weight" | ||
33 | + }, | ||
34 | + { | ||
35 | + "text": "孕期B超", | ||
36 | + "selectedIconPath": "images/2.0.png", | ||
37 | + "iconPath": "images/2.1.png", | ||
38 | + "pagePath": "pages/bchao/bchao" | ||
39 | + }, | ||
40 | + { | ||
41 | + "text": "个人中心", | ||
42 | + "selectedIconPath": "images/3.0.png", | ||
43 | + "iconPath": "images/3.1.png", | ||
44 | + "pagePath": "pages/personal/personal" | ||
45 | + } | ||
46 | + ] | ||
47 | + } | ||
48 | +} |
app.wxss
0 → 100644
images/+.png
0 → 100644
3.3 KB
images/+@2x.png
0 → 100644
8.4 KB
images/+@3x.png
0 → 100644
13.4 KB
images/1.0.png
0 → 100644
16.6 KB
images/1.1.png
0 → 100644
16.6 KB
images/2.0.png
0 → 100644
17.4 KB
images/2.1.png
0 → 100644
17.1 KB
images/3.0.png
0 → 100644
16.7 KB
images/3.1.png
0 → 100644
16.3 KB
images/Bitmap.png
0 → 100644
7.4 KB
images/Bitmap@2x.png
0 → 100644
7.4 KB
images/Group 5.png
0 → 100644
5.1 KB
images/Page 1.png
0 → 100644
1.2 KB
images/b@2x.png
0 → 100644
7.5 KB
images/circle.png
0 → 100644
12.0 KB
images/copy.png
0 → 100644
15.0 KB
images/cover.png
0 → 100644
23.2 KB
images/cover_bg.png
0 → 100644
9.4 KB
images/next.png
0 → 100644
4.5 KB
images/p@3x.png
0 → 100644
4.7 KB
images/personal.png
0 → 100644
2.9 KB
images/righticon.png
0 → 100644
1.6 KB
images/tanicon@2x.png
0 → 100644
2.0 KB
images/up.png
0 → 100644
14.9 KB
images/zhizhen.png
0 → 100644
18.0 KB
images/zhouli.png
0 → 100644
297.6 KB
pages/addWeight/addWeight.js
0 → 100644
1 | +// pages/addWeight/addWeight.js | ||
2 | +const app = getApp(); | ||
3 | +Page({ | ||
4 | + | ||
5 | + /** | ||
6 | + * 页面的初始数据 | ||
7 | + */ | ||
8 | + data: { | ||
9 | + multiIndex: [0, 0], | ||
10 | + weeksArry: [], | ||
11 | + weight: '' | ||
12 | + }, | ||
13 | + getWeeks() { | ||
14 | + let url = '/user/getWeekDay' | ||
15 | + app.post(url, {}).then((res) => { | ||
16 | + console.log(res) | ||
17 | + this.setData({ | ||
18 | + multiIndex: [res.default.week, res.default.day], | ||
19 | + week: res.default.week, | ||
20 | + day: res.default.day | ||
21 | + }) | ||
22 | + console.log(this.data.multiIndex) | ||
23 | + let tempData = [] | ||
24 | + let tempWeeks = [] | ||
25 | + let tempDays = [] | ||
26 | + for (let i = 0; i <= this.data.week; i++) { | ||
27 | + let tempText = '孕期' + i + '周' | ||
28 | + let tempw = { | ||
29 | + id: i, | ||
30 | + text: tempText | ||
31 | + } | ||
32 | + tempWeeks.push(tempw) | ||
33 | + } | ||
34 | + for (let i = 0; i <= this.data.day; i++) { | ||
35 | + let tempText = '加' + i + '天' | ||
36 | + let tempD = { | ||
37 | + id: i, | ||
38 | + text: tempText | ||
39 | + } | ||
40 | + tempDays.push(tempD) | ||
41 | + } | ||
42 | + tempData[0] = tempWeeks; | ||
43 | + tempData[1] = tempDays; | ||
44 | + this.setData({ | ||
45 | + weeksArry: tempData | ||
46 | + }) | ||
47 | + }).catch((errMsg) => { | ||
48 | + | ||
49 | + }) | ||
50 | + }, | ||
51 | + bindMultiPickerChange: function (e) { | ||
52 | + console.log(e) | ||
53 | + let chooseW = this.data.weeksArry[0][e.detail.value[0]] | ||
54 | + let chooseD = this.data.weeksArry[1][e.detail.value[1]] | ||
55 | + this.setData({ | ||
56 | + multiIndex: e.detail.value, | ||
57 | + week: chooseW.id, | ||
58 | + day: chooseD.id | ||
59 | + }) | ||
60 | + }, | ||
61 | + bindMultiPickerColumnChange: function (e) { | ||
62 | + console.log(e) | ||
63 | + let row = e.detail.column; | ||
64 | + let value = e.detail.value; | ||
65 | + let baseWeek = this.data.week; | ||
66 | + let weeksArry = this.data.weeksArry; | ||
67 | + let tempDays = []; | ||
68 | + let nowDays = [] | ||
69 | + if (row == 0) { | ||
70 | + if (value < baseWeek) { | ||
71 | + for (let i = 0; i < 7; i++) { | ||
72 | + let tempText = '加' + i + '天' | ||
73 | + let tempD = { | ||
74 | + id: i, | ||
75 | + text: tempText | ||
76 | + } | ||
77 | + tempDays.push(tempD) | ||
78 | + } | ||
79 | + weeksArry[1] = tempDays; | ||
80 | + this.setData({ | ||
81 | + weeksArry: weeksArry | ||
82 | + }) | ||
83 | + } else { | ||
84 | + for (let i = 0; i <= this.data.day; i++) { | ||
85 | + let tempText = '加' + i + '天' | ||
86 | + let tempD = { | ||
87 | + id: i, | ||
88 | + text: tempText | ||
89 | + } | ||
90 | + nowDays.push(tempD) | ||
91 | + } | ||
92 | + weeksArry[1] = nowDays; | ||
93 | + this.setData({ | ||
94 | + weeksArry: weeksArry | ||
95 | + }) | ||
96 | + } | ||
97 | + } | ||
98 | + }, | ||
99 | + getWeight(e) { | ||
100 | + console.log(e) | ||
101 | + this.setData({ | ||
102 | + weight: e.detail.value | ||
103 | + }) | ||
104 | + }, | ||
105 | + addWeight() { | ||
106 | + let url = '/user/addWeightLog' | ||
107 | + let params = { | ||
108 | + create_date: this.data.create_date, | ||
109 | + weight: this.data.weight | ||
110 | + } | ||
111 | + if (params.weight == '' || params.weight == null || params.weight == undefined) { | ||
112 | + wx.showToast({ | ||
113 | + title: '请输入体重', | ||
114 | + icon: 'none' | ||
115 | + }) | ||
116 | + } else { | ||
117 | + app.post(url, params).then((res) => { | ||
118 | + wx.showToast({ | ||
119 | + title: '添加成功', | ||
120 | + }) | ||
121 | + wx.setStorageSync('newWeight','true') | ||
122 | + setTimeout(function(){ | ||
123 | + wx.switchTab({ | ||
124 | + url: '/pages/weight/weight', | ||
125 | + }) | ||
126 | + },1000) | ||
127 | + }).catch((errMsg) => { | ||
128 | + | ||
129 | + }) | ||
130 | + } | ||
131 | + }, | ||
132 | + inputDate: function (e) { | ||
133 | + this.setData({ | ||
134 | + create_date: e.detail.value | ||
135 | + }) | ||
136 | + }, | ||
137 | + /** | ||
138 | + * 生命周期函数--监听页面加载 | ||
139 | + */ | ||
140 | + onLoad: function (options) { | ||
141 | + // let tempData = [] | ||
142 | + // let tempWeeks = [] | ||
143 | + // let tempDays = [] | ||
144 | + // for (let i = 0; i <= 42; i++) { | ||
145 | + // let tempText = '孕期' + i + '周' | ||
146 | + // let tempw = { | ||
147 | + // id: i, | ||
148 | + // text: tempText | ||
149 | + // } | ||
150 | + // tempWeeks.push(tempw) | ||
151 | + // } | ||
152 | + // for (let i = 0; i < 7; i++) { | ||
153 | + // let tempText = '加' + i + '天' | ||
154 | + // let tempD = { | ||
155 | + // id: i, | ||
156 | + // text: tempText | ||
157 | + // } | ||
158 | + // tempDays.push(tempD) | ||
159 | + // } | ||
160 | + // tempData[0] = tempWeeks; | ||
161 | + // tempData[1] = tempDays; | ||
162 | + // this.setData({ | ||
163 | + // weeksArry: tempData | ||
164 | + // }) | ||
165 | + // this.getWeeks(); | ||
166 | + this.setData({ | ||
167 | + create_date:app.nowDate(), | ||
168 | + endDate: app.nowDate(), | ||
169 | + startDate: app.minDate() | ||
170 | + }) | ||
171 | + }, | ||
172 | + /** | ||
173 | + * 生命周期函数--监听页面初次渲染完成 | ||
174 | + */ | ||
175 | + onReady: function () { | ||
176 | + | ||
177 | + }, | ||
178 | + | ||
179 | + /** | ||
180 | + * 生命周期函数--监听页面显示 | ||
181 | + */ | ||
182 | + onShow: function () { | ||
183 | + | ||
184 | + }, | ||
185 | + | ||
186 | + /** | ||
187 | + * 生命周期函数--监听页面隐藏 | ||
188 | + */ | ||
189 | + onHide: function () { | ||
190 | + | ||
191 | + }, | ||
192 | + | ||
193 | + /** | ||
194 | + * 生命周期函数--监听页面卸载 | ||
195 | + */ | ||
196 | + onUnload: function () { | ||
197 | + | ||
198 | + }, | ||
199 | + | ||
200 | + /** | ||
201 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
202 | + */ | ||
203 | + onPullDownRefresh: function () { | ||
204 | + | ||
205 | + }, | ||
206 | + | ||
207 | + /** | ||
208 | + * 页面上拉触底事件的处理函数 | ||
209 | + */ | ||
210 | + onReachBottom: function () { | ||
211 | + | ||
212 | + }, | ||
213 | + | ||
214 | + /** | ||
215 | + * 用户点击右上角分享 | ||
216 | + */ | ||
217 | + onShareAppMessage: function () { | ||
218 | + | ||
219 | + } | ||
220 | +}) |
pages/addWeight/addWeight.json
0 → 100644
pages/addWeight/addWeight.wxml
0 → 100644
1 | +<!--pages/addWeight/addWeight.wxml--> | ||
2 | +<view class='z_container'> | ||
3 | + <!--信息记录 --> | ||
4 | + <view class='info_box'> | ||
5 | + <view class='info_item'> | ||
6 | + <view>测量日期</view> | ||
7 | + <!-- <text class='info_item_input'>{{create_date}}</text> --> | ||
8 | + <picker mode="date" class='sub_item_input' value="{{date}}" start="{{startDate}}" end="{{endDate}}" bindchange="inputDate"> | ||
9 | + <view class="picker"> | ||
10 | + <text class='info_item_input'>{{create_date}}</text> | ||
11 | + </view> | ||
12 | + </picker> | ||
13 | + </view> | ||
14 | + <view class='info_item'> | ||
15 | + <view>测量体重</view> | ||
16 | + <input class='info_item_input' type='digit' bindinput='getWeight' value='' placeholder='请输入当天体重' /> | ||
17 | + <view class='danwei'>kg</view> | ||
18 | + </view> | ||
19 | + </view> | ||
20 | + <view class='save_btn' bindtap='addWeight'>保存</view> | ||
21 | +</view> |
pages/addWeight/addWeight.wxss
0 → 100644
pages/addbchao/addbchao.js
0 → 100644
1 | +// pages/addbchao/addbchao.js | ||
2 | +const app = getApp() | ||
3 | +Page({ | ||
4 | + | ||
5 | + /** | ||
6 | + * 页面的初始数据 | ||
7 | + */ | ||
8 | + data: { | ||
9 | + weeksArry:[], | ||
10 | + create_date:'', | ||
11 | + head_circumference:'', | ||
12 | + abdominal_circumference:'', | ||
13 | + femur_length:'', | ||
14 | + neck_length:'' | ||
15 | + }, | ||
16 | + getWeeks() { | ||
17 | + let url = '/user/getWeekDay' | ||
18 | + app.post(url, {}).then((res) => { | ||
19 | + console.log(res) | ||
20 | + this.setData({ | ||
21 | + multiIndex: [res.default.week, res.default.day], | ||
22 | + week: res.default.week, | ||
23 | + day: res.default.day | ||
24 | + }) | ||
25 | + console.log(this.data.multiIndex) | ||
26 | + let tempData = [] | ||
27 | + let tempWeeks = [] | ||
28 | + let tempDays = [] | ||
29 | + for (let i = 0; i <= this.data.week; i++) { | ||
30 | + let tempText = '孕期' + i + '周' | ||
31 | + let tempw = { | ||
32 | + id: i, | ||
33 | + text: tempText | ||
34 | + } | ||
35 | + tempWeeks.push(tempw) | ||
36 | + } | ||
37 | + for (let i = 0; i <= this.data.day; i++) { | ||
38 | + let tempText = '加' + i + '天' | ||
39 | + let tempD = { | ||
40 | + id: i, | ||
41 | + text: tempText | ||
42 | + } | ||
43 | + tempDays.push(tempD) | ||
44 | + } | ||
45 | + tempData[0] = tempWeeks; | ||
46 | + tempData[1] = tempDays; | ||
47 | + this.setData({ | ||
48 | + weeksArry: tempData | ||
49 | + }) | ||
50 | + }).catch((errMsg) => { | ||
51 | + | ||
52 | + }) | ||
53 | + }, | ||
54 | + bindMultiPickerChange: function (e) { | ||
55 | + console.log(e) | ||
56 | + let chooseW = this.data.weeksArry[0][e.detail.value[0]] | ||
57 | + let chooseD = this.data.weeksArry[1][e.detail.value[1]] | ||
58 | + this.setData({ | ||
59 | + multiIndex: e.detail.value, | ||
60 | + week: chooseW.id, | ||
61 | + day: chooseD.id | ||
62 | + }) | ||
63 | + }, | ||
64 | + bindMultiPickerColumnChange: function (e) { | ||
65 | + console.log(e) | ||
66 | + let row = e.detail.column; | ||
67 | + let value = e.detail.value; | ||
68 | + let baseWeek = this.data.week; | ||
69 | + let weeksArry = this.data.weeksArry; | ||
70 | + let tempDays = []; | ||
71 | + let nowDays = [] | ||
72 | + if(row==0){ | ||
73 | + if (value < baseWeek){ | ||
74 | + for (let i = 0; i < 7; i++) { | ||
75 | + let tempText = '加' + i + '天' | ||
76 | + let tempD = { | ||
77 | + id: i, | ||
78 | + text: tempText | ||
79 | + } | ||
80 | + tempDays.push(tempD) | ||
81 | + } | ||
82 | + weeksArry[1] = tempDays; | ||
83 | + this.setData({ | ||
84 | + weeksArry: weeksArry | ||
85 | + }) | ||
86 | + }else{ | ||
87 | + for (let i = 0; i <= this.data.day; i++) { | ||
88 | + let tempText = '加' + i + '天' | ||
89 | + let tempD = { | ||
90 | + id: i, | ||
91 | + text: tempText | ||
92 | + } | ||
93 | + nowDays.push(tempD) | ||
94 | + } | ||
95 | + weeksArry[1] = nowDays; | ||
96 | + this.setData({ | ||
97 | + weeksArry: weeksArry | ||
98 | + }) | ||
99 | + } | ||
100 | + } | ||
101 | + }, | ||
102 | + getHead(e){ | ||
103 | + this.setData({ | ||
104 | + head_circumference:e.detail.value | ||
105 | + }) | ||
106 | + }, | ||
107 | + getadominal(e){ | ||
108 | + this.setData({ | ||
109 | + abdominal_circumference: e.detail.value | ||
110 | + }) | ||
111 | + }, | ||
112 | + getfemur(e){ | ||
113 | + this.setData({ | ||
114 | + femur_length:e.detail.value | ||
115 | + }) | ||
116 | + }, | ||
117 | + getneck(e){ | ||
118 | + this.setData({ | ||
119 | + neck_length: e.detail.value | ||
120 | + }) | ||
121 | + }, | ||
122 | + savebinfo(){ | ||
123 | + let url = '/user/addBCLog' | ||
124 | + let params = { | ||
125 | + create_date: this.data.create_date, | ||
126 | + head_circumference: this.data.head_circumference, | ||
127 | + abdominal_circumference: this.data.abdominal_circumference, | ||
128 | + femur_length: this.data.femur_length, | ||
129 | + neck_length: this.data.neck_length | ||
130 | + } | ||
131 | + console.log(params) | ||
132 | + if(params.head_circumference==''){ | ||
133 | + wx.showToast({ | ||
134 | + title: '请输入头围', | ||
135 | + icon: 'none' | ||
136 | + }) | ||
137 | + return false | ||
138 | + }else if(params.abdominal_circumference == ''){ | ||
139 | + wx.showToast({ | ||
140 | + title: '请输入腹围', | ||
141 | + icon: 'none' | ||
142 | + }) | ||
143 | + return false | ||
144 | + }else if(params.femur_length == ''){ | ||
145 | + wx.showToast({ | ||
146 | + title: '请输入股骨长', | ||
147 | + icon: 'none' | ||
148 | + }) | ||
149 | + return false | ||
150 | + }else if(params.neck_length == ''){ | ||
151 | + wx.showToast({ | ||
152 | + title: '请输入胎儿头颈长度', | ||
153 | + icon: 'none' | ||
154 | + }) | ||
155 | + return false | ||
156 | + }else{ | ||
157 | + app.post(url,params).then((res)=>{ | ||
158 | + wx.showToast({ | ||
159 | + title:'保存成功' | ||
160 | + }) | ||
161 | + setTimeout(function(){ | ||
162 | + wx.switchTab({ | ||
163 | + url: '/pages/bchao/bchao', | ||
164 | + }) | ||
165 | + },1000) | ||
166 | + }) | ||
167 | + } | ||
168 | + }, | ||
169 | + inputDate: function (e) { | ||
170 | + this.setData({ | ||
171 | + create_date: e.detail.value | ||
172 | + }) | ||
173 | + }, | ||
174 | + /** | ||
175 | + * 生命周期函数--监听页面加载 | ||
176 | + */ | ||
177 | + onLoad: function (options) { | ||
178 | + this.setData({ | ||
179 | + create_date: app.nowDate(), | ||
180 | + endDate: app.nowDate(), | ||
181 | + startDate: app.minDate() | ||
182 | + }) | ||
183 | + }, | ||
184 | + | ||
185 | + /** | ||
186 | + * 生命周期函数--监听页面初次渲染完成 | ||
187 | + */ | ||
188 | + onReady: function () { | ||
189 | + | ||
190 | + }, | ||
191 | + | ||
192 | + /** | ||
193 | + * 生命周期函数--监听页面显示 | ||
194 | + */ | ||
195 | + onShow: function () { | ||
196 | + | ||
197 | + }, | ||
198 | + | ||
199 | + /** | ||
200 | + * 生命周期函数--监听页面隐藏 | ||
201 | + */ | ||
202 | + onHide: function () { | ||
203 | + | ||
204 | + }, | ||
205 | + | ||
206 | + /** | ||
207 | + * 生命周期函数--监听页面卸载 | ||
208 | + */ | ||
209 | + onUnload: function () { | ||
210 | + | ||
211 | + }, | ||
212 | + | ||
213 | + /** | ||
214 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
215 | + */ | ||
216 | + onPullDownRefresh: function () { | ||
217 | + | ||
218 | + }, | ||
219 | + | ||
220 | + /** | ||
221 | + * 页面上拉触底事件的处理函数 | ||
222 | + */ | ||
223 | + onReachBottom: function () { | ||
224 | + | ||
225 | + }, | ||
226 | + | ||
227 | + /** | ||
228 | + * 用户点击右上角分享 | ||
229 | + */ | ||
230 | + onShareAppMessage: function () { | ||
231 | + | ||
232 | + } | ||
233 | +}) |
pages/addbchao/addbchao.json
0 → 100644
pages/addbchao/addbchao.wxml
0 → 100644
1 | +<view class='z_container'> | ||
2 | + | ||
3 | + <!--信息记录 --> | ||
4 | + <view class='info_box'> | ||
5 | + <view class='info_item'> | ||
6 | + <view>B超检查日期</view> | ||
7 | + <!-- <text class='info_item_input'>{{create_date}}</text> --> | ||
8 | + <picker mode="date" class='sub_item_input' value="{{date}}" start="{{startDate}}" end="{{endDate}}" bindchange="inputDate"> | ||
9 | + <view class="picker"> | ||
10 | + <text class='info_item_input'>{{create_date}}</text> | ||
11 | + </view> | ||
12 | + </picker> | ||
13 | + </view> | ||
14 | + <view class='info_item'> | ||
15 | + <view>头围</view> | ||
16 | + <input class='info_item_input' type='digit' value='' bindinput='getHead' placeholder='' /> | ||
17 | + <view class='danwei'>mm</view> | ||
18 | + </view> | ||
19 | + <view class='info_item'> | ||
20 | + <view>腹围</view> | ||
21 | + <input class='info_item_input' type='digit' value='' bindinput='getadominal' placeholder='' /> | ||
22 | + <view class='danwei'>mm</view> | ||
23 | + </view> | ||
24 | + <view class='info_item'> | ||
25 | + <view>股骨长</view> | ||
26 | + <input class='info_item_input' type='digit' value='' bindinput='getfemur' placeholder='' /> | ||
27 | + <view class='danwei'>mm</view> | ||
28 | + </view> | ||
29 | + <view class='info_item'> | ||
30 | + <view>双顶径</view> | ||
31 | + <input class='info_item_input' type='digit' value='' bindinput='getneck' placeholder='' /> | ||
32 | + <view class='danwei'>mm</view> | ||
33 | + </view> | ||
34 | + </view> | ||
35 | + <view class='save_btn' bindtap='savebinfo'>保存</view> | ||
36 | +</view> |
pages/addbchao/addbchao.wxss
0 → 100644
pages/baseInfo/baseInfo.js
0 → 100644
1 | +// pages/baseInfo/baseInfo.js | ||
2 | +const app = getApp(); | ||
3 | +Page({ | ||
4 | + | ||
5 | + /** | ||
6 | + * 页面的初始数据 | ||
7 | + */ | ||
8 | + data: { | ||
9 | + choose: true, | ||
10 | + age:null, | ||
11 | + height: null, | ||
12 | + pre_weight: null, | ||
13 | + week: '', | ||
14 | + day: '', | ||
15 | + current_weight: null, | ||
16 | + multiIndex: [0, 0], | ||
17 | + weeksArry: [], | ||
18 | + taiArry: [{ | ||
19 | + value: '1', | ||
20 | + name: '单胞胎' | ||
21 | + }, { | ||
22 | + value: '2', | ||
23 | + name: '双胞胎' | ||
24 | + }], | ||
25 | + tai: ['单胞胎', '双包胎'], | ||
26 | + index: 0, | ||
27 | + is_single_birth: 1 | ||
28 | + }, | ||
29 | + bindtaichange(e) { | ||
30 | + console.log(e) | ||
31 | + this.setData({ | ||
32 | + index: e.detail.value, | ||
33 | + is_single_birth: this.data.taiArry[e.detail.value].value | ||
34 | + }) | ||
35 | + }, | ||
36 | + choose(){ | ||
37 | + this.setData({ | ||
38 | + choose: !this.data.choose | ||
39 | + }) | ||
40 | + }, | ||
41 | + inputAge(e){ | ||
42 | + console.log(e) | ||
43 | + this.setData({ | ||
44 | + age: e.detail.value | ||
45 | + }) | ||
46 | + }, | ||
47 | + inputHeight(e){ | ||
48 | + this.setData({ | ||
49 | + height: e.detail.value | ||
50 | + }) | ||
51 | + }, | ||
52 | + inputWeight(e){ | ||
53 | + this.setData({ | ||
54 | + pre_weight: e.detail.value | ||
55 | + }) | ||
56 | + }, | ||
57 | + inputDate: function (e) { | ||
58 | + this.setData({ | ||
59 | + last_menstruation: e.detail.value | ||
60 | + }) | ||
61 | + let params = { | ||
62 | + last_menstruation: e.detail.value | ||
63 | + } | ||
64 | + let url = '/profile/getGestationalWeek' | ||
65 | + let that = this; | ||
66 | + app.post(url,params).then((res)=>{ | ||
67 | + that.setData({ | ||
68 | + week: res.week, | ||
69 | + day: res.day | ||
70 | + }) | ||
71 | + }).catch((errMsg)=>{}) | ||
72 | + | ||
73 | + }, | ||
74 | + bindMultiPickerChange: function (e) { | ||
75 | + let chooseW = this.data.weeksArry[0][e.detail.value[0]] | ||
76 | + let chooseD = this.data.weeksArry[1][e.detail.value[1]] | ||
77 | + this.setData({ | ||
78 | + multiIndex: e.detail.value, | ||
79 | + week: chooseW.id, | ||
80 | + day: chooseD.id | ||
81 | + }) | ||
82 | + }, | ||
83 | + bindMultiPickerColumnChange: function (e) { | ||
84 | + }, | ||
85 | + inputCurrentWeight(e){ | ||
86 | + this.setData({ | ||
87 | + current_weight: e.detail.value | ||
88 | + }) | ||
89 | + }, | ||
90 | + saveBaseInfo(){ | ||
91 | + let userinfo = { | ||
92 | + age: this.data.age, | ||
93 | + height: this.data.height, | ||
94 | + pre_weight: this.data.pre_weight, | ||
95 | + last_menstruation: this.data.last_menstruation, | ||
96 | + week: this.data.week, | ||
97 | + day: this.data.day, | ||
98 | + current_weight: this.data.current_weight, | ||
99 | + is_single_birth: this.data.is_single_birth | ||
100 | + } | ||
101 | + if (userinfo.age == null){ | ||
102 | + wx.showToast({ | ||
103 | + icon:'none', | ||
104 | + title: '年龄不能为空', | ||
105 | + }) | ||
106 | + return false; | ||
107 | + } else if (userinfo.height == null){ | ||
108 | + wx.showToast({ | ||
109 | + icon: 'none', | ||
110 | + title: '身高不能为空', | ||
111 | + }) | ||
112 | + return false; | ||
113 | + } else if (userinfo.pre_weight == null){ | ||
114 | + wx.showToast({ | ||
115 | + icon: 'none', | ||
116 | + title: '孕前体重不能为空', | ||
117 | + }) | ||
118 | + return false; | ||
119 | + } else if (userinfo.last_menstruation == null){ | ||
120 | + wx.showToast({ | ||
121 | + icon: 'none', | ||
122 | + title: '末次月经时间不能为空', | ||
123 | + }) | ||
124 | + return false; | ||
125 | + } else if (userinfo.week == null){ | ||
126 | + wx.showToast({ | ||
127 | + icon: 'none', | ||
128 | + title: '孕周不能为空', | ||
129 | + }) | ||
130 | + return false; | ||
131 | + } else if (userinfo.current_weight == null) { | ||
132 | + wx.showToast({ | ||
133 | + icon: 'none', | ||
134 | + title: '孕妇当前体重不能为空', | ||
135 | + }) | ||
136 | + return false; | ||
137 | + }else if(!this.data.choose){ | ||
138 | + wx.showToast({ | ||
139 | + icon: 'none', | ||
140 | + title: '选择用户个人隐私保护协议', | ||
141 | + }) | ||
142 | + return false; | ||
143 | + } | ||
144 | + let url = '/profile/setGravidaBaseInfo' | ||
145 | + app.post(url,userinfo).then((res)=>{ | ||
146 | + wx.showToast({ | ||
147 | + title: '保存成功' | ||
148 | + }) | ||
149 | + wx.setStorageSync('first', true) | ||
150 | + setTimeout(function(){ | ||
151 | + wx.switchTab({ | ||
152 | + url: '/pages/weight/weight', | ||
153 | + }) | ||
154 | + }) | ||
155 | + }).catch((errMsg)=>{ | ||
156 | + | ||
157 | + }) | ||
158 | + | ||
159 | + }, | ||
160 | + viewxieyi() { | ||
161 | + wx.navigateTo({ | ||
162 | + url: '/pages/xiyiDetail/xieyidetail', | ||
163 | + }) | ||
164 | + }, | ||
165 | + /** | ||
166 | + * 生命周期函数--监听页面加载 | ||
167 | + */ | ||
168 | + onLoad: function (options) { | ||
169 | + let tempData = [] | ||
170 | + let tempWeeks = [] | ||
171 | + let tempDays = [] | ||
172 | + for(let i = 0; i<=42 ; i++){ | ||
173 | + let tempText = '孕'+i+'周' | ||
174 | + let tempw = { | ||
175 | + id: i, | ||
176 | + text: tempText | ||
177 | + } | ||
178 | + tempWeeks.push(tempw) | ||
179 | + } | ||
180 | + for (let i = 0; i < 7; i++) { | ||
181 | + let tempText = '加' + i + '天' | ||
182 | + let tempD = { | ||
183 | + id: i, | ||
184 | + text: tempText | ||
185 | + } | ||
186 | + tempDays.push(tempD) | ||
187 | + } | ||
188 | + tempData[0] = tempWeeks; | ||
189 | + tempData[1] = tempDays; | ||
190 | + this.setData({ | ||
191 | + weeksArry: tempData, | ||
192 | + endDate: app.nowDate(), | ||
193 | + startDate: app.minDate() | ||
194 | + }) | ||
195 | + }, | ||
196 | + | ||
197 | + /** | ||
198 | + * 生命周期函数--监听页面初次渲染完成 | ||
199 | + */ | ||
200 | + onReady: function () { | ||
201 | + | ||
202 | + }, | ||
203 | + | ||
204 | + /** | ||
205 | + * 生命周期函数--监听页面显示 | ||
206 | + */ | ||
207 | + onShow: function () { | ||
208 | + | ||
209 | + }, | ||
210 | + | ||
211 | + /** | ||
212 | + * 生命周期函数--监听页面隐藏 | ||
213 | + */ | ||
214 | + onHide: function () { | ||
215 | + | ||
216 | + }, | ||
217 | + | ||
218 | + /** | ||
219 | + * 生命周期函数--监听页面卸载 | ||
220 | + */ | ||
221 | + onUnload: function () { | ||
222 | + | ||
223 | + }, | ||
224 | + | ||
225 | + /** | ||
226 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
227 | + */ | ||
228 | + onPullDownRefresh: function () { | ||
229 | + | ||
230 | + }, | ||
231 | + | ||
232 | + /** | ||
233 | + * 页面上拉触底事件的处理函数 | ||
234 | + */ | ||
235 | + onReachBottom: function () { | ||
236 | + | ||
237 | + }, | ||
238 | + | ||
239 | + /** | ||
240 | + * 用户点击右上角分享 | ||
241 | + */ | ||
242 | + onShareAppMessage: function () { | ||
243 | + | ||
244 | + } | ||
245 | +}) |
pages/baseInfo/baseInfo.json
0 → 100644
pages/baseInfo/baseInfo.wxml
0 → 100644
1 | +<!--pages/baseInfo/baseInfo.wxml--> | ||
2 | +<view class='z_container'> | ||
3 | + <view class='top_tips'> | ||
4 | + 为了给您提供更准确的判断,请将以下信息补充完整。 | ||
5 | + </view> | ||
6 | + <!--基本信息表单 --> | ||
7 | + <view class='base_subform'> | ||
8 | + <view class='sub_item'> | ||
9 | + <view class='sub_item_label'>孕妇年龄</view> | ||
10 | + <input class='sub_item_input' type='number' placeholder-style="color:#999" bindinput | ||
11 | + ='inputAge' placeholder="请输入准确年龄" /> | ||
12 | + <view class='danwei'>岁</view> | ||
13 | + </view> | ||
14 | + <view class='sub_item'> | ||
15 | + <view class='sub_item_label'>孕妇身高</view> | ||
16 | + <input class='sub_item_input' type='digit' placeholder-style="color:#999" bindinput='inputHeight' placeholder="请输入准确身高" /><view class='danwei'>cm</view> | ||
17 | + </view> | ||
18 | + <view class='sub_item'> | ||
19 | + <view class='sub_item_label'>孕前体重</view> | ||
20 | + <input class='sub_item_input' type='digit' placeholder-style="color:#999" bindinput='inputWeight' placeholder="请输入准确孕前体重" /><view class='danwei'>kg</view> | ||
21 | + </view> | ||
22 | + <view class='sub_item'> | ||
23 | + <view class='sub_item_label'>末次月经第一天</view> | ||
24 | + | ||
25 | + <picker mode="date" class='sub_item_input' value="{{date}}" start="{{startDate}}" end="{{endDate}}" bindchange="inputDate"> | ||
26 | + <view class="picker"> | ||
27 | + <text wx:if="{{!last_menstruation}}">请输入准确末次月经</text> | ||
28 | + {{last_menstruation}} | ||
29 | + </view> | ||
30 | + </picker> | ||
31 | + </view> | ||
32 | + <view class='sub_item'> | ||
33 | + <view class='sub_item_label'>孕周</view> | ||
34 | + <text class='sub_item_input'>孕{{week}}<text wx:if="{{week===''}}">几</text>周+{{day}}天</text> | ||
35 | + <!-- <picker class='sub_item_input' mode="multiSelector" bindchange="bindMultiPickerChange" bindcolumnchange="bindMultiPickerColumnChange" value="{{multiIndex}}" range="{{weeksArry}}" range-key="text"> | ||
36 | + <view class="picker"> | ||
37 | + <text wx:if="{{!week && !day}}">孕几周+天</text> | ||
38 | + <text wx:else>孕{{week}}+{{day}}天</text> | ||
39 | + </view> | ||
40 | + </picker> --> | ||
41 | + | ||
42 | + </view> | ||
43 | + <view class='sub_item'> | ||
44 | + <view class='sub_item_label'>孕妇当前体重</view> | ||
45 | + <input class='sub_item_input' bindinput='inputCurrentWeight' placeholder-style="color:#999" type='digit' placeholder="请输入准确体重" /><view class='danwei'>kg</view> | ||
46 | + </view> | ||
47 | + | ||
48 | + <view class='sub_item'> | ||
49 | + <view class='sub_item_label'>单/双胞胎</view> | ||
50 | + <picker bindchange="bindtaichange" class='sub_item_input' value="{{index}}" range="{{tai}}"> | ||
51 | + <view class="picker"> | ||
52 | + <text class='danwei'>{{tai[index]}}</text> | ||
53 | + </view> | ||
54 | + </picker> | ||
55 | + </view> | ||
56 | + </view> | ||
57 | + <view class='shengming'> | ||
58 | + 注:由于每位女性月经周期长短不一,所以推测的孕周及预产期与实际有1-2周的出入属正常范围,不影响体重计算。 | ||
59 | + </view> | ||
60 | + <!--个人隐私 --> | ||
61 | + <view class='xieyi'> | ||
62 | + <view class='check_box' bindtap='choose'> | ||
63 | + <image src='/images/righticon.png' wx:if = "{{choose}}" ></image> | ||
64 | + </view> | ||
65 | + <view class='xieyi_title' bindtap='viewxieyi'>用户个人隐私保护协议</view> | ||
66 | + </view> | ||
67 | + <!--保存按钮 --> | ||
68 | + <view class='save_btn' bindtap='saveBaseInfo'>保存</view> | ||
69 | +</view> |
pages/baseInfo/baseInfo.wxss
0 → 100644
1 | +/* pages/baseInfo/baseInfo.wxss */ | ||
2 | +.z_container{ | ||
3 | + height: 100vh; | ||
4 | + overflow: hidden; | ||
5 | +} | ||
6 | +.top_tips{ | ||
7 | + height: 122rpx; | ||
8 | + background-color: #51DBA2; | ||
9 | + padding: 0 60rpx; | ||
10 | + font-size: 30rpx; | ||
11 | + line-height: 45rpx; | ||
12 | + color: #FFF; | ||
13 | +} | ||
14 | +.base_subform{ | ||
15 | + width: 640rpx; | ||
16 | + margin: 30rpx auto; | ||
17 | +} | ||
18 | +.sub_item{ | ||
19 | + border-bottom: 1px solid #D8D8D8; | ||
20 | + height: 88rpx; | ||
21 | + display: flex; | ||
22 | + align-items: center; | ||
23 | + font-size: 34rpx; | ||
24 | + color: #333; | ||
25 | + justify-content: space-between; | ||
26 | +} | ||
27 | +.sub_item_input{ | ||
28 | + text-align: right; | ||
29 | + font-size: 34rpx; | ||
30 | + color: #999; | ||
31 | + margin-left: auto; | ||
32 | + -webkit-margin-start: auto; | ||
33 | +} | ||
34 | +.save_btn{ | ||
35 | + width: 670rpx; | ||
36 | + margin: 0 auto; | ||
37 | + height: 94rpx; | ||
38 | + align-items: center; | ||
39 | + justify-content: center; | ||
40 | + background: #51DBA2; | ||
41 | + color: #FFF; | ||
42 | + font-size: 36rpx; | ||
43 | + display: flex; | ||
44 | + border-radius: 10rpx; | ||
45 | + position: fixed; | ||
46 | + bottom: 62rpx; | ||
47 | + left: 40rpx; | ||
48 | + | ||
49 | +} | ||
50 | +.xieyi{ | ||
51 | + height: 44rpx; | ||
52 | + width: 100%; | ||
53 | + display: flex; | ||
54 | + align-items: center; | ||
55 | + justify-content: center; | ||
56 | + position: fixed; | ||
57 | + bottom: 225rpx; | ||
58 | + font-size: 30rpx; | ||
59 | + color: #6DA9EB; | ||
60 | +} | ||
61 | +.check_box{ | ||
62 | + width: 44rpx; | ||
63 | + height: 44rpx; | ||
64 | + border-radius: 50%; | ||
65 | + border: 1px solid #ccc; | ||
66 | + margin-right: 17rpx; | ||
67 | +} | ||
68 | +.check_box image{ | ||
69 | + width: 100%; | ||
70 | + height: 100%; | ||
71 | +} | ||
72 | +.danwei{ | ||
73 | + color: #999; | ||
74 | +} | ||
75 | +.shengming{ | ||
76 | + font-size: 28rpx; | ||
77 | + color: #999; | ||
78 | + margin: 0 74rpx; | ||
79 | +} |
pages/bchao/bchao.js
0 → 100644
1 | +// pages/bchao/bchao.js | ||
2 | +const app = getApp(); | ||
3 | +Page({ | ||
4 | + | ||
5 | + /** | ||
6 | + * 页面的初始数据 | ||
7 | + */ | ||
8 | + data: { | ||
9 | + }, | ||
10 | + addbchao(){ | ||
11 | + wx.navigateTo({ | ||
12 | + url: '/pages/addbchao/addbchao', | ||
13 | + }) | ||
14 | + }, | ||
15 | + changeRecord(e){ | ||
16 | + let id = e.currentTarget.id; | ||
17 | + wx.navigateTo({ | ||
18 | + url: '/pages/changebchao/changebchao?id='+id, | ||
19 | + }) | ||
20 | + }, | ||
21 | + getRecords(){ | ||
22 | + let url = '/user/getBCLog' | ||
23 | + app.post(url,{}).then((res)=>{ | ||
24 | + wx.hideLoading() | ||
25 | + this.setData({ | ||
26 | + recordsList:res | ||
27 | + }) | ||
28 | + }).catch((errMsg)=>{ | ||
29 | + | ||
30 | + }) | ||
31 | + }, | ||
32 | + /** | ||
33 | + * 生命周期函数--监听页面加载 | ||
34 | + */ | ||
35 | + onLoad: function (options) { | ||
36 | + }, | ||
37 | + /** | ||
38 | + * 生命周期函数--监听页面初次渲染完成 | ||
39 | + */ | ||
40 | + onReady: function () { | ||
41 | + | ||
42 | + }, | ||
43 | + /** | ||
44 | + * 生命周期函数--监听页面显示 | ||
45 | + */ | ||
46 | + onShow: function () { | ||
47 | + this.getRecords() | ||
48 | + }, | ||
49 | + | ||
50 | + /** | ||
51 | + * 生命周期函数--监听页面隐藏 | ||
52 | + */ | ||
53 | + onHide: function () { | ||
54 | + | ||
55 | + }, | ||
56 | + | ||
57 | + /** | ||
58 | + * 生命周期函数--监听页面卸载 | ||
59 | + */ | ||
60 | + onUnload: function () { | ||
61 | + | ||
62 | + }, | ||
63 | + | ||
64 | + /** | ||
65 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
66 | + */ | ||
67 | + onPullDownRefresh: function () { | ||
68 | + | ||
69 | + }, | ||
70 | + | ||
71 | + /** | ||
72 | + * 页面上拉触底事件的处理函数 | ||
73 | + */ | ||
74 | + onReachBottom: function () { | ||
75 | + | ||
76 | + }, | ||
77 | + | ||
78 | + /** | ||
79 | + * 用户点击右上角分享 | ||
80 | + */ | ||
81 | + onShareAppMessage: function () { | ||
82 | + | ||
83 | + } | ||
84 | +}) |
pages/bchao/bchao.json
0 → 100644
pages/bchao/bchao.wxml
0 → 100644
1 | +<!--pages/bchao/bchao.wxml--> | ||
2 | +<view class='z_container'> | ||
3 | + <view class='top_note'> | ||
4 | + 详细记录孕期B超检查结果,密切关注宝宝的每一个动向。 | ||
5 | + </view> | ||
6 | + <view class='add_record' bindtap='addbchao'> | ||
7 | + 添加B超记录 | ||
8 | + </view> | ||
9 | + <view class='record_lists'> | ||
10 | + <view class='nodata' wx:if="{{recordsList.length==0}}"> | ||
11 | + 无记录 | ||
12 | + </view> | ||
13 | + | ||
14 | + <block wx:for="{{recordsList}}" wx:key=""> | ||
15 | + <view class='record_list'> | ||
16 | + <view class='record_container'> | ||
17 | + <view class='top_date'> | ||
18 | + <view>{{item.create_date}}</view> | ||
19 | + <view class='edit' bindtap='changeRecord' id='{{item.id}}'>修改</view> | ||
20 | + </view> | ||
21 | + <!--label --> | ||
22 | + <view class='record_label'> | ||
23 | + <view class='lable_item'> | ||
24 | + <view>头围</view> | ||
25 | + <view>mm</view> | ||
26 | + </view> | ||
27 | + <view class='lable_item'> | ||
28 | + <view>腹围</view> | ||
29 | + <view>mm</view> | ||
30 | + </view> | ||
31 | + <view class='lable_item'> | ||
32 | + <view>股骨长</view> | ||
33 | + <view>mm</view> | ||
34 | + </view> | ||
35 | + <view class='lable_item'> | ||
36 | + <view>双顶径</view> | ||
37 | + <view>mm</view> | ||
38 | + </view> | ||
39 | + </view> | ||
40 | + <view class='label_detail_value'> | ||
41 | + <view class='detail_value'> | ||
42 | + {{item.head_circumference}} | ||
43 | + </view> | ||
44 | + <view class='detail_value'> | ||
45 | + {{item.abdominal_circumference}} | ||
46 | + </view> | ||
47 | + <view class='detail_value'> | ||
48 | + {{item.femur_length}} | ||
49 | + </view> | ||
50 | + <view class='detail_value'> | ||
51 | + {{item.neck_length}} | ||
52 | + </view> | ||
53 | + </view> | ||
54 | + </view> | ||
55 | + </view> | ||
56 | + </block> | ||
57 | + | ||
58 | + </view> | ||
59 | +</view> |
pages/bchao/bchao.wxss
0 → 100644
1 | +/* pages/bchao/bchao.wxss */ | ||
2 | +.z_container{ | ||
3 | + background: #EFEFF4; | ||
4 | + width: 100%; | ||
5 | + height: 100vh; | ||
6 | + display: flex; | ||
7 | + display: -webkit-flex; | ||
8 | + display: -webkit-box; | ||
9 | + flex-flow: column; | ||
10 | + -webkit-flex-flow: column; | ||
11 | + -webkit-box-orient: vertical; | ||
12 | + overflow-x: hidden; | ||
13 | +} | ||
14 | +.top_note{ | ||
15 | + width: 660rpx; | ||
16 | + height: 100rpx; | ||
17 | + margin: 65rpx auto 30rpx; | ||
18 | + font-size: 30rpx; | ||
19 | + color: #999; | ||
20 | +} | ||
21 | +.add_record{ | ||
22 | + width: 670rpx; | ||
23 | + height: 94rpx; | ||
24 | + margin: 0 auto; | ||
25 | + display: flex; | ||
26 | + align-items: center; | ||
27 | + justify-content: center; | ||
28 | + font-size: 34rpx; | ||
29 | + color: #666666; | ||
30 | + border: 1rpx dashed #999; | ||
31 | + border-radius: 10rpx; | ||
32 | + | ||
33 | +} | ||
34 | +.record_lists{ | ||
35 | + margin: 90rpx 40rpx 0; | ||
36 | + -webkit-box-flex: 1; | ||
37 | + -webkit-flex: 1; | ||
38 | + flex: 1; | ||
39 | + overflow: auto; | ||
40 | +} | ||
41 | +.record_list{ | ||
42 | + background-color: #FFF; | ||
43 | + border-radius: 10rpx; | ||
44 | + padding: 0 15rpx; | ||
45 | + margin-bottom: 40rpx; | ||
46 | +} | ||
47 | +.top_date{ | ||
48 | + height: 74rpx; | ||
49 | + display: flex; | ||
50 | + align-items: center; | ||
51 | + justify-content: space-between; | ||
52 | + font-size: 30rpx; | ||
53 | + color: #999; | ||
54 | + border-bottom: 1px solid #D8D8D8; | ||
55 | +} | ||
56 | +.edit{ | ||
57 | + width: 84rpx; | ||
58 | + height: 44rpx; | ||
59 | + display: flex; | ||
60 | + align-items: center; | ||
61 | + justify-content: center; | ||
62 | + color: #FFF; | ||
63 | + background-color: #51DBA2; | ||
64 | + border-radius: 100rpx; | ||
65 | +} | ||
66 | +.record_label{ | ||
67 | + height: 122rpx; | ||
68 | + display: flex; | ||
69 | + justify-content: space-between; | ||
70 | + border-bottom: 1rpx solid #D8D8D8; | ||
71 | +} | ||
72 | +.lable_item{ | ||
73 | + display: flex; | ||
74 | + align-items: center; | ||
75 | + justify-content: center; | ||
76 | + flex-wrap: wrap; | ||
77 | + flex: 1; | ||
78 | + font-size: 34rpx; | ||
79 | + color: #000; | ||
80 | + flex-direction: column; | ||
81 | + font-weight: 500; | ||
82 | +} | ||
83 | +.label_detail_value{ | ||
84 | + display: flex; | ||
85 | + justify-content: space-between; | ||
86 | + align-items: center; | ||
87 | + height: 90rpx; | ||
88 | +} | ||
89 | +.detail_value{ | ||
90 | + display: flex; | ||
91 | + justify-content: center; | ||
92 | + align-items: center; | ||
93 | + flex: 1; | ||
94 | + font-size: 30rpx; | ||
95 | + color: #666; | ||
96 | +} | ||
97 | +.nodata{ | ||
98 | + height: 580rpx; | ||
99 | + display: flex; | ||
100 | + align-items: center; | ||
101 | + justify-content: center; | ||
102 | + font-size: 34rpx; | ||
103 | + color: #999; | ||
104 | +} |
pages/changeBaseInfo/changeBaseInfo.js
0 → 100644
1 | +// pages/changeBaseInfo/changeBaseInfo.js | ||
2 | +const app = getApp() | ||
3 | +Page({ | ||
4 | + | ||
5 | + /** | ||
6 | + * 页面的初始数据 | ||
7 | + */ | ||
8 | + data: { | ||
9 | + tempDate:'', | ||
10 | + taiArry:[{ | ||
11 | + value: '1', | ||
12 | + name:'单胞胎' | ||
13 | + },{ | ||
14 | + value: '2', | ||
15 | + name: '双胞胎' | ||
16 | + }], | ||
17 | + tai:['单胞胎','双包胎'], | ||
18 | + index: 0, | ||
19 | + is_single_birth: 1 | ||
20 | + }, | ||
21 | + getuserInfo() { | ||
22 | + let url = '/user/getGravidaInfo' | ||
23 | + app.post(url, {}).then((res) => { | ||
24 | + console.log(res) | ||
25 | + this.setData({ | ||
26 | + age: res.age, | ||
27 | + height: res.height, | ||
28 | + pre_weight: res.pre_weight, | ||
29 | + last_menstruation: res.last_menstruation, | ||
30 | + tempDate: res.last_menstruation, | ||
31 | + current_weight: res.current_weight, | ||
32 | + multiIndex:[res.week,res.day], | ||
33 | + index:res.is_single_birth -1 | ||
34 | + // week: res.week, | ||
35 | + // day: res.day, | ||
36 | + }) | ||
37 | + }) | ||
38 | + }, | ||
39 | + bindtaichange(e){ | ||
40 | + console.log(e) | ||
41 | + this.setData({ | ||
42 | + index: e.detail.value, | ||
43 | + is_single_birth: this.data.taiArry[e.detail.value].value | ||
44 | + }) | ||
45 | + }, | ||
46 | + inputDate: function (e) { | ||
47 | + this.setData({ | ||
48 | + last_menstruation: e.detail.value | ||
49 | + }) | ||
50 | + let params = { | ||
51 | + last_menstruation: e.detail.value | ||
52 | + } | ||
53 | + // let url = '/user/checkEditLastMenstruationData' | ||
54 | + // app.post(url, params).then(function(res){ | ||
55 | + // console.log(res) | ||
56 | + // }) | ||
57 | + let tempurl = '/profile/getGestationalWeek' | ||
58 | + let that = this; | ||
59 | + app.post(tempurl, params).then((res) => { | ||
60 | + that.setData({ | ||
61 | + week: res.week | ||
62 | + }) | ||
63 | + }).catch((errMsg) => { }) | ||
64 | + }, | ||
65 | + inputAge(e){ | ||
66 | + console.log(e) | ||
67 | + this.setData({ | ||
68 | + age: e.detail.value | ||
69 | + }) | ||
70 | + }, | ||
71 | + inputHeight(e){ | ||
72 | + this.setData({ | ||
73 | + height: e.detail.value | ||
74 | + }) | ||
75 | + }, | ||
76 | + inputWeight(e){ | ||
77 | + this.setData({ | ||
78 | + pre_weight: e.detail.value | ||
79 | + }) | ||
80 | + | ||
81 | + }, | ||
82 | + | ||
83 | + bindMultiPickerChange: function (e) { | ||
84 | + let chooseW = this.data.weeksArry[0][e.detail.value[0]] | ||
85 | + let chooseD = this.data.weeksArry[1][e.detail.value[1]] | ||
86 | + this.setData({ | ||
87 | + multiIndex: e.detail.value, | ||
88 | + week: chooseW.id, | ||
89 | + day: chooseD.id | ||
90 | + }) | ||
91 | + }, | ||
92 | + bindMultiPickerColumnChange: function (e) { | ||
93 | + }, | ||
94 | + inputCurrentWeight(e){ | ||
95 | + this.setData({ | ||
96 | + current_weight: e.detail.value | ||
97 | + }) | ||
98 | + }, | ||
99 | + saveBaseInfo(){ | ||
100 | + let userinfo = { | ||
101 | + age: this.data.age, | ||
102 | + height: this.data.height, | ||
103 | + pre_weight: this.data.pre_weight, | ||
104 | + last_menstruation: this.data.last_menstruation, | ||
105 | + is_single_birth: this.data.is_single_birth | ||
106 | + // week: this.data.week, | ||
107 | + // day: this.data.day, | ||
108 | + // current_weight: this.data.current_weight | ||
109 | + } | ||
110 | + if (userinfo.age == null){ | ||
111 | + wx.showToast({ | ||
112 | + icon:'none', | ||
113 | + title: '年龄不能为空', | ||
114 | + }) | ||
115 | + return false; | ||
116 | + } else if (userinfo.height == null){ | ||
117 | + wx.showToast({ | ||
118 | + icon: 'none', | ||
119 | + title: '身高不能为空', | ||
120 | + }) | ||
121 | + return false; | ||
122 | + } else if (userinfo.pre_weight == null){ | ||
123 | + wx.showToast({ | ||
124 | + icon: 'none', | ||
125 | + title: '孕前体重不能为空', | ||
126 | + }) | ||
127 | + return false; | ||
128 | + } else if (userinfo.last_menstruation == null){ | ||
129 | + wx.showToast({ | ||
130 | + icon: 'none', | ||
131 | + title: '末次月经时间不能为空', | ||
132 | + }) | ||
133 | + return false; | ||
134 | + } else if(this.data.week > 41) { | ||
135 | + console.log(this.data.week); | ||
136 | + wx.showToast({ | ||
137 | + icon: 'none', | ||
138 | + title: '经检测您初次录入末次月经日期与本次修改超出了正常孕期41周,请确认后重新输入', | ||
139 | + }) | ||
140 | + | ||
141 | + | ||
142 | + // wx.showModal({ | ||
143 | + // title: '提示', | ||
144 | + // //content: '经检测您初次录入末次月经日期与本次修改超出了正常孕期41周,系统将会删除超出的体重记录数据。', | ||
145 | + // content: '经检测您初次录入末次月经日期与本次修改超出了正常孕期41周,请确认后重新输入', | ||
146 | + // success: function(res){ | ||
147 | + // if(res.confirm){ | ||
148 | + // let url = '/user/editGravidaBaseInfo' | ||
149 | + // app.post(url, userinfo).then((res) => { | ||
150 | + // wx.showToast({ | ||
151 | + // title: '保存成功' | ||
152 | + // }) | ||
153 | + // setTimeout(function () { | ||
154 | + // wx.switchTab({ | ||
155 | + // url: '/pages/personal/personal', | ||
156 | + // }) | ||
157 | + // }, 600) | ||
158 | + // }).catch((errMsg) => { | ||
159 | + // console.log(errMsg) | ||
160 | + // }) | ||
161 | + // } | ||
162 | + // } | ||
163 | + // }) | ||
164 | + | ||
165 | + | ||
166 | + | ||
167 | + | ||
168 | + }else{ | ||
169 | + let url = '/user/editGravidaBaseInfo' | ||
170 | + app.post(url, userinfo).then((res) => { | ||
171 | + wx.showToast({ | ||
172 | + title: '保存成功' | ||
173 | + }) | ||
174 | + setTimeout(function () { | ||
175 | + wx.switchTab({ | ||
176 | + url: '/pages/personal/personal', | ||
177 | + }) | ||
178 | + }, 600) | ||
179 | + }).catch((errMsg) => { | ||
180 | + console.log(errMsg) | ||
181 | + }) | ||
182 | + } | ||
183 | + | ||
184 | + | ||
185 | + }, | ||
186 | + /** | ||
187 | + * 生命周期函数--监听页面加载 | ||
188 | + */ | ||
189 | + onLoad: function (options) { | ||
190 | + this.getuserInfo() | ||
191 | + let tempData = [] | ||
192 | + let tempWeeks = [] | ||
193 | + let tempDays = [] | ||
194 | + for(let i = 0; i<=42 ; i++){ | ||
195 | + let tempText = '孕'+i+'周' | ||
196 | + let tempw = { | ||
197 | + id: i, | ||
198 | + text: tempText | ||
199 | + } | ||
200 | + tempWeeks.push(tempw) | ||
201 | + } | ||
202 | + for (let i = 0; i < 7; i++) { | ||
203 | + let tempText = '加' + i + '天' | ||
204 | + let tempD = { | ||
205 | + id: i, | ||
206 | + text: tempText | ||
207 | + } | ||
208 | + tempDays.push(tempD) | ||
209 | + } | ||
210 | + tempData[0] = tempWeeks; | ||
211 | + tempData[1] = tempDays; | ||
212 | + this.setData({ | ||
213 | + weeksArry: tempData | ||
214 | + }) | ||
215 | + this.setData({ | ||
216 | + endDate: app.nowDate(), | ||
217 | + startDate: app.minDate() | ||
218 | + }) | ||
219 | + }, | ||
220 | + | ||
221 | + /** | ||
222 | + * 生命周期函数--监听页面初次渲染完成 | ||
223 | + */ | ||
224 | + onReady: function () { | ||
225 | + | ||
226 | + }, | ||
227 | + | ||
228 | + /** | ||
229 | + * 生命周期函数--监听页面显示 | ||
230 | + */ | ||
231 | + onShow: function () { | ||
232 | + | ||
233 | + }, | ||
234 | + | ||
235 | + /** | ||
236 | + * 生命周期函数--监听页面隐藏 | ||
237 | + */ | ||
238 | + onHide: function () { | ||
239 | + | ||
240 | + }, | ||
241 | + | ||
242 | + /** | ||
243 | + * 生命周期函数--监听页面卸载 | ||
244 | + */ | ||
245 | + onUnload: function () { | ||
246 | + | ||
247 | + }, | ||
248 | + | ||
249 | + /** | ||
250 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
251 | + */ | ||
252 | + onPullDownRefresh: function () { | ||
253 | + | ||
254 | + }, | ||
255 | + | ||
256 | + /** | ||
257 | + * 页面上拉触底事件的处理函数 | ||
258 | + */ | ||
259 | + onReachBottom: function () { | ||
260 | + | ||
261 | + }, | ||
262 | + | ||
263 | + /** | ||
264 | + * 用户点击右上角分享 | ||
265 | + */ | ||
266 | + onShareAppMessage: function () { | ||
267 | + | ||
268 | + } | ||
269 | +}) |
pages/changeBaseInfo/changeBaseInfo.json
0 → 100644
pages/changeBaseInfo/changeBaseInfo.wxml
0 → 100644
1 | +<!--pages/changeBaseInfo/changeBaseInfo.wxml--> | ||
2 | +<view class='z_container'> | ||
3 | + <!--信息记录 --> | ||
4 | + <view class='info_box'> | ||
5 | + <view class='info_item'> | ||
6 | + <view>孕妇年龄</view> | ||
7 | + <input class='info_item_input' type='number' value='{{age}}' bindinput='inputAge' /> | ||
8 | + <view class='danwei'>岁</view> | ||
9 | + </view> | ||
10 | + <view class='info_item'> | ||
11 | + <view>孕妇身高</view> | ||
12 | + <input class='info_item_input' type='digit' value='{{height}}' bindinput='inputHeight' /> | ||
13 | + <view class='danwei'>cm</view> | ||
14 | + </view> | ||
15 | + <view class='info_item'> | ||
16 | + <view>孕前体重</view> | ||
17 | + <input class='info_item_input' type='digit' value='{{pre_weight}}' bindinput='inputWeight' /> | ||
18 | + <view class='danwei'>kg</view> | ||
19 | + </view> | ||
20 | + <view class='info_item'> | ||
21 | + <view>末次月经第一天</view> | ||
22 | + <picker mode="date" class='sub_item_input' value="{{date}}" start="{{startDate}}" end="{{endDate}}" bindchange="inputDate"> | ||
23 | + <view class="picker"> | ||
24 | + <text class='danwei'>{{last_menstruation}}</text> | ||
25 | + </view> | ||
26 | + </picker> | ||
27 | + </view> | ||
28 | + <view class='info_item'> | ||
29 | + <view>单/双胞胎</view> | ||
30 | + <picker bindchange="bindtaichange" class='sub_item_input' value="{{index}}" range="{{tai}}"> | ||
31 | + <view class="picker"> | ||
32 | + <text class='danwei'>{{tai[index]}}</text> | ||
33 | + </view> | ||
34 | + </picker> | ||
35 | + </view> | ||
36 | + </view> | ||
37 | + <view class='save_btn' bindtap='saveBaseInfo'>保存</view> | ||
38 | +</view> |
pages/changeBaseInfo/changeBaseInfo.wxss
0 → 100644
pages/changebchao/changebchao.js
0 → 100644
1 | +// pages/addbchao/addbchao.js | ||
2 | +const app = getApp() | ||
3 | +Page({ | ||
4 | + | ||
5 | + /** | ||
6 | + * 页面的初始数据 | ||
7 | + */ | ||
8 | + data: { | ||
9 | + weeksArry: [], | ||
10 | + create_date:'', | ||
11 | + head_circumference: '', | ||
12 | + abdominal_circumference: '', | ||
13 | + femur_length: '', | ||
14 | + neck_length: '', | ||
15 | + tempId:'' | ||
16 | + }, | ||
17 | + getWeeks() { | ||
18 | + let url = '/user/getWeekDay' | ||
19 | + app.post(url, {}).then((res) => { | ||
20 | + console.log(res) | ||
21 | + this.setData({ | ||
22 | + multiIndex: [res.default.week, res.default.day], | ||
23 | + week: res.default.week, | ||
24 | + day: res.default.day | ||
25 | + }) | ||
26 | + console.log(this.data.multiIndex) | ||
27 | + let tempData = [] | ||
28 | + let tempWeeks = [] | ||
29 | + let tempDays = [] | ||
30 | + for (let i = 0; i <= this.data.week; i++) { | ||
31 | + let tempText = '孕期' + i + '周' | ||
32 | + let tempw = { | ||
33 | + id: i, | ||
34 | + text: tempText | ||
35 | + } | ||
36 | + tempWeeks.push(tempw) | ||
37 | + } | ||
38 | + for (let i = 0; i <= this.data.day; i++) { | ||
39 | + let tempText = '加' + i + '天' | ||
40 | + let tempD = { | ||
41 | + id: i, | ||
42 | + text: tempText | ||
43 | + } | ||
44 | + tempDays.push(tempD) | ||
45 | + } | ||
46 | + tempData[0] = tempWeeks; | ||
47 | + tempData[1] = tempDays; | ||
48 | + this.setData({ | ||
49 | + weeksArry: tempData | ||
50 | + }) | ||
51 | + }).catch((errMsg) => { | ||
52 | + | ||
53 | + }) | ||
54 | + }, | ||
55 | + bindMultiPickerChange: function (e) { | ||
56 | + console.log(e) | ||
57 | + let chooseW = this.data.weeksArry[0][e.detail.value[0]] | ||
58 | + let chooseD = this.data.weeksArry[1][e.detail.value[1]] | ||
59 | + this.setData({ | ||
60 | + multiIndex: e.detail.value, | ||
61 | + week: chooseW.id, | ||
62 | + day: chooseD.id | ||
63 | + }) | ||
64 | + }, | ||
65 | + bindMultiPickerColumnChange: function (e) { | ||
66 | + console.log(e) | ||
67 | + let row = e.detail.column; | ||
68 | + let value = e.detail.value; | ||
69 | + let baseWeek = this.data.week; | ||
70 | + let weeksArry = this.data.weeksArry; | ||
71 | + let tempDays = []; | ||
72 | + let nowDays = [] | ||
73 | + if (row == 0) { | ||
74 | + if (value < baseWeek) { | ||
75 | + for (let i = 0; i < 7; i++) { | ||
76 | + let tempText = '加' + i + '天' | ||
77 | + let tempD = { | ||
78 | + id: i, | ||
79 | + text: tempText | ||
80 | + } | ||
81 | + tempDays.push(tempD) | ||
82 | + } | ||
83 | + weeksArry[1] = tempDays; | ||
84 | + this.setData({ | ||
85 | + weeksArry: weeksArry | ||
86 | + }) | ||
87 | + } else { | ||
88 | + for (let i = 0; i <= this.data.day; i++) { | ||
89 | + let tempText = '加' + i + '天' | ||
90 | + let tempD = { | ||
91 | + id: i, | ||
92 | + text: tempText | ||
93 | + } | ||
94 | + nowDays.push(tempD) | ||
95 | + } | ||
96 | + weeksArry[1] = nowDays; | ||
97 | + this.setData({ | ||
98 | + weeksArry: weeksArry | ||
99 | + }) | ||
100 | + } | ||
101 | + } | ||
102 | + }, | ||
103 | + getHead(e) { | ||
104 | + this.setData({ | ||
105 | + head_circumference: e.detail.value | ||
106 | + }) | ||
107 | + }, | ||
108 | + getadominal(e) { | ||
109 | + this.setData({ | ||
110 | + abdominal_circumference: e.detail.value | ||
111 | + }) | ||
112 | + }, | ||
113 | + getfemur(e) { | ||
114 | + this.setData({ | ||
115 | + femur_length: e.detail.value | ||
116 | + }) | ||
117 | + }, | ||
118 | + getneck(e) { | ||
119 | + this.setData({ | ||
120 | + neck_length: e.detail.value | ||
121 | + }) | ||
122 | + }, | ||
123 | + savebinfo() { | ||
124 | + let url = '/user/editBCLog' | ||
125 | + let params = { | ||
126 | + create_date: this.data.create_date, | ||
127 | + head_circumference: this.data.head_circumference, | ||
128 | + abdominal_circumference: this.data.abdominal_circumference, | ||
129 | + femur_length: this.data.femur_length, | ||
130 | + neck_length: this.data.neck_length, | ||
131 | + id: this.data.tempId | ||
132 | + } | ||
133 | + console.log(params) | ||
134 | + if (params.head_circumference == '') { | ||
135 | + wx.showToast({ | ||
136 | + title: '请输入头围', | ||
137 | + icon: 'none' | ||
138 | + }) | ||
139 | + return false | ||
140 | + } else if (params.abdominal_circumference == '') { | ||
141 | + wx.showToast({ | ||
142 | + title: '请输入腹围', | ||
143 | + icon: 'none' | ||
144 | + }) | ||
145 | + return false | ||
146 | + } else if (params.femur_length == '') { | ||
147 | + wx.showToast({ | ||
148 | + title: '请输入股骨长', | ||
149 | + icon: 'none' | ||
150 | + }) | ||
151 | + return false | ||
152 | + } else if (params.neck_length == '') { | ||
153 | + wx.showToast({ | ||
154 | + title: '请输入胎儿头颈长度', | ||
155 | + icon: 'none' | ||
156 | + }) | ||
157 | + return false | ||
158 | + } else { | ||
159 | + app.post(url, params).then((res) => { | ||
160 | + wx.showToast({ | ||
161 | + title: '修改成功' | ||
162 | + }) | ||
163 | + setTimeout(function () { | ||
164 | + wx.switchTab({ | ||
165 | + url: '/pages/bchao/bchao', | ||
166 | + }) | ||
167 | + }, 1000) | ||
168 | + }) | ||
169 | + } | ||
170 | + }, | ||
171 | + getinfo(){ | ||
172 | + let url = '/user/getBCLogDetail' | ||
173 | + app.post(url,{id:this.data.tempId}).then((res)=>{ | ||
174 | + this.setData({ | ||
175 | + create_date: res.create_date, | ||
176 | + head_circumference: res.head_circumference, | ||
177 | + abdominal_circumference: res.abdominal_circumference, | ||
178 | + femur_length: res.femur_length, | ||
179 | + neck_length: res.neck_length, | ||
180 | + }) | ||
181 | + }).catch((errMsg)=>{ | ||
182 | + | ||
183 | + }) | ||
184 | + | ||
185 | + }, | ||
186 | + inputDate: function (e) { | ||
187 | + this.setData({ | ||
188 | + create_date: e.detail.value | ||
189 | + }) | ||
190 | + }, | ||
191 | + | ||
192 | + /** | ||
193 | + * 生命周期函数--监听页面加载 | ||
194 | + */ | ||
195 | + onLoad: function (options) { | ||
196 | + this.setData({ | ||
197 | + tempId: options.id, | ||
198 | + endDate: app.nowDate(), | ||
199 | + startDate: app.minDate() | ||
200 | + }) | ||
201 | + this.getinfo() | ||
202 | + // let tempData = [] | ||
203 | + // let tempWeeks = [] | ||
204 | + // let tempDays = [] | ||
205 | + // for (let i = 0; i <= 42; i++) { | ||
206 | + // let tempText = '孕期' + i + '周' | ||
207 | + // let tempw = { | ||
208 | + // id: i, | ||
209 | + // text: tempText | ||
210 | + // } | ||
211 | + // tempWeeks.push(tempw) | ||
212 | + // } | ||
213 | + // for (let i = 0; i < 7; i++) { | ||
214 | + // let tempText = '加' + i + '天' | ||
215 | + // let tempD = { | ||
216 | + // id: i, | ||
217 | + // text: tempText | ||
218 | + // } | ||
219 | + // tempDays.push(tempD) | ||
220 | + // } | ||
221 | + // tempData[0] = tempWeeks; | ||
222 | + // tempData[1] = tempDays; | ||
223 | + // this.setData({ | ||
224 | + // weeksArry: tempData | ||
225 | + // }) | ||
226 | + // this.getWeeks(); | ||
227 | + }, | ||
228 | + | ||
229 | + /** | ||
230 | + * 生命周期函数--监听页面初次渲染完成 | ||
231 | + */ | ||
232 | + onReady: function () { | ||
233 | + | ||
234 | + }, | ||
235 | + | ||
236 | + /** | ||
237 | + * 生命周期函数--监听页面显示 | ||
238 | + */ | ||
239 | + onShow: function () { | ||
240 | + | ||
241 | + }, | ||
242 | + | ||
243 | + /** | ||
244 | + * 生命周期函数--监听页面隐藏 | ||
245 | + */ | ||
246 | + onHide: function () { | ||
247 | + | ||
248 | + }, | ||
249 | + | ||
250 | + /** | ||
251 | + * 生命周期函数--监听页面卸载 | ||
252 | + */ | ||
253 | + onUnload: function () { | ||
254 | + | ||
255 | + }, | ||
256 | + | ||
257 | + /** | ||
258 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
259 | + */ | ||
260 | + onPullDownRefresh: function () { | ||
261 | + | ||
262 | + }, | ||
263 | + | ||
264 | + /** | ||
265 | + * 页面上拉触底事件的处理函数 | ||
266 | + */ | ||
267 | + onReachBottom: function () { | ||
268 | + | ||
269 | + }, | ||
270 | + | ||
271 | + /** | ||
272 | + * 用户点击右上角分享 | ||
273 | + */ | ||
274 | + onShareAppMessage: function () { | ||
275 | + | ||
276 | + } | ||
277 | +}) |
pages/changebchao/changebchao.json
0 → 100644
pages/changebchao/changebchao.wxml
0 → 100644
1 | +<view class='z_container'> | ||
2 | + | ||
3 | + <!--信息记录 --> | ||
4 | + <view class='info_box'> | ||
5 | + <view class='info_item'> | ||
6 | + <view>B超检查日期</view> | ||
7 | + <!-- <text class='info_item_input'>{{create_date}}</text> --> | ||
8 | + | ||
9 | + <picker mode="date" class='sub_item_input' value="{{date}}" start="{{startDate}}" end="{{endDate}}" bindchange="inputDate"> | ||
10 | + <view class="picker"> | ||
11 | + <text class='info_item_input'>{{create_date}}</text> | ||
12 | + </view> | ||
13 | + </picker> | ||
14 | + | ||
15 | + </view> | ||
16 | + <view class='info_item'> | ||
17 | + <view>头围</view> | ||
18 | + <input class='info_item_input' type='digit' value='{{head_circumference}}' bindinput='getHead' placeholder='' /> | ||
19 | + <view class='danwei'>mm</view> | ||
20 | + </view> | ||
21 | + <view class='info_item'> | ||
22 | + <view>腹围</view> | ||
23 | + <input class='info_item_input' type='digit' value='{{abdominal_circumference}}' bindinput='getadominal' placeholder='' /> | ||
24 | + <view class='danwei'>mm</view> | ||
25 | + </view> | ||
26 | + <view class='info_item'> | ||
27 | + <view>股骨长</view> | ||
28 | + <input class='info_item_input' type='digit' value='{{femur_length}}' bindinput='getfemur' placeholder='' /> | ||
29 | + <view class='danwei'>mm</view> | ||
30 | + </view> | ||
31 | + <view class='info_item'> | ||
32 | + <view>双顶径</view> | ||
33 | + <input class='info_item_input' type='digit' value='{{neck_length}}' bindinput='getneck' placeholder='' /> | ||
34 | + <view class='danwei'>mm</view> | ||
35 | + </view> | ||
36 | + </view> | ||
37 | + <view class='save_btn' bindtap='savebinfo'>保存</view> | ||
38 | +</view> |
pages/changebchao/changebchao.wxss
0 → 100644
pages/index/index.js
0 → 100644
1 | +//index.js | ||
2 | +//获取应用实例 | ||
3 | +const app = getApp() | ||
4 | + | ||
5 | +Page({ | ||
6 | + data: { | ||
7 | + motto: 'Hello World', | ||
8 | + userInfo: {}, | ||
9 | + hasUserInfo: false, | ||
10 | + canIUse: wx.canIUse('button.open-type.getUserInfo') | ||
11 | + }, | ||
12 | + //事件处理函数 | ||
13 | + bindViewTap: function() { | ||
14 | + wx.navigateTo({ | ||
15 | + url: '../logs/logs' | ||
16 | + }) | ||
17 | + }, | ||
18 | + onLoad: function () { | ||
19 | + if (app.globalData.userInfo) { | ||
20 | + this.setData({ | ||
21 | + userInfo: app.globalData.userInfo, | ||
22 | + hasUserInfo: true | ||
23 | + }) | ||
24 | + } else if (this.data.canIUse){ | ||
25 | + // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回 | ||
26 | + // 所以此处加入 callback 以防止这种情况 | ||
27 | + app.userInfoReadyCallback = res => { | ||
28 | + this.setData({ | ||
29 | + userInfo: res.userInfo, | ||
30 | + hasUserInfo: true | ||
31 | + }) | ||
32 | + } | ||
33 | + } else { | ||
34 | + // 在没有 open-type=getUserInfo 版本的兼容处理 | ||
35 | + wx.getUserInfo({ | ||
36 | + success: res => { | ||
37 | + app.globalData.userInfo = res.userInfo | ||
38 | + this.setData({ | ||
39 | + userInfo: res.userInfo, | ||
40 | + hasUserInfo: true | ||
41 | + }) | ||
42 | + } | ||
43 | + }) | ||
44 | + } | ||
45 | + }, | ||
46 | + getUserInfo: function(e) { | ||
47 | + console.log(e) | ||
48 | + app.globalData.userInfo = e.detail.userInfo | ||
49 | + this.setData({ | ||
50 | + userInfo: e.detail.userInfo, | ||
51 | + hasUserInfo: true | ||
52 | + }) | ||
53 | + } | ||
54 | +}) |
pages/index/index.json
0 → 100644
1 | +{} |
pages/index/index.wxml
0 → 100644
1 | +<!--index.wxml--> | ||
2 | +<view class="container"> | ||
3 | + <view class="userinfo"> | ||
4 | + <button wx:if="{{!hasUserInfo && canIUse}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo"> 获取头像昵称 </button> | ||
5 | + <block wx:else> | ||
6 | + <image bindtap="bindViewTap" class="userinfo-avatar" src="{{userInfo.avatarUrl}}" background-size="cover"></image> | ||
7 | + <text class="userinfo-nickname">{{userInfo.nickName}}</text> | ||
8 | + </block> | ||
9 | + </view> | ||
10 | + <view class="usermotto"> | ||
11 | + <text class="user-motto">{{motto}}</text> | ||
12 | + </view> | ||
13 | +</view> |
pages/index/index.wxss
0 → 100644
1 | +/**index.wxss**/ | ||
2 | +.userinfo { | ||
3 | + display: flex; | ||
4 | + flex-direction: column; | ||
5 | + align-items: center; | ||
6 | +} | ||
7 | + | ||
8 | +.userinfo-avatar { | ||
9 | + width: 128rpx; | ||
10 | + height: 128rpx; | ||
11 | + margin: 20rpx; | ||
12 | + border-radius: 50%; | ||
13 | +} | ||
14 | + | ||
15 | +.userinfo-nickname { | ||
16 | + color: #aaa; | ||
17 | +} | ||
18 | + | ||
19 | +.usermotto { | ||
20 | + margin-top: 200px; | ||
21 | +} |
pages/logs/logs.js
0 → 100644
pages/logs/logs.json
0 → 100644
pages/logs/logs.wxml
0 → 100644
pages/logs/logs.wxss
0 → 100644
pages/personal/personal.js
0 → 100644
1 | +// pages/personal/personal.js | ||
2 | +// c | ||
3 | +const app = getApp() | ||
4 | +Page({ | ||
5 | + | ||
6 | + /** | ||
7 | + * 页面的初始数据 | ||
8 | + */ | ||
9 | + data: { | ||
10 | + | ||
11 | + }, | ||
12 | + getuserBaseInfo() { | ||
13 | + let url = '/user/getGravidaInfo' | ||
14 | + app.post(url, {}).then((res) => { | ||
15 | + wx.hideLoading() | ||
16 | + this.setData({ | ||
17 | + age: res.age, | ||
18 | + height: res.height, | ||
19 | + pre_weight: res.pre_weight, | ||
20 | + last_menstruation: res.last_menstruation, | ||
21 | + week: res.week, | ||
22 | + day: res.day, | ||
23 | + name: res.name, | ||
24 | + current_weight: res.current_weight, | ||
25 | + is_single_birth: res.is_single_birth | ||
26 | + }) | ||
27 | + }) | ||
28 | +}, | ||
29 | + getUserInfo(){ | ||
30 | + wx.navigateTo({ | ||
31 | + url: '../userInfo/userInfo', | ||
32 | + }) | ||
33 | + }, | ||
34 | + changebaseInfo(){ | ||
35 | + wx.navigateTo({ | ||
36 | + url: '../changeBaseInfo/changeBaseInfo', | ||
37 | + }) | ||
38 | + }, | ||
39 | + /** | ||
40 | + * 生命周期函数--监听页面加载 | ||
41 | + */ | ||
42 | + onLoad: function (options) { | ||
43 | + | ||
44 | + }, | ||
45 | + | ||
46 | + /** | ||
47 | + * 生命周期函数--监听页面初次渲染完成 | ||
48 | + */ | ||
49 | + onReady: function () { | ||
50 | + | ||
51 | + }, | ||
52 | + | ||
53 | + /** | ||
54 | + * 生命周期函数--监听页面显示 | ||
55 | + */ | ||
56 | + onShow: function () { | ||
57 | + this.getuserBaseInfo() | ||
58 | + }, | ||
59 | + | ||
60 | + /** | ||
61 | + * 生命周期函数--监听页面隐藏 | ||
62 | + */ | ||
63 | + onHide: function () { | ||
64 | + | ||
65 | + }, | ||
66 | + | ||
67 | + /** | ||
68 | + * 生命周期函数--监听页面卸载 | ||
69 | + */ | ||
70 | + onUnload: function () { | ||
71 | + | ||
72 | + }, | ||
73 | + | ||
74 | + /** | ||
75 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
76 | + */ | ||
77 | + onPullDownRefresh: function () { | ||
78 | + | ||
79 | + }, | ||
80 | + | ||
81 | + /** | ||
82 | + * 页面上拉触底事件的处理函数 | ||
83 | + */ | ||
84 | + onReachBottom: function () { | ||
85 | + | ||
86 | + }, | ||
87 | + | ||
88 | + /** | ||
89 | + * 用户点击右上角分享 | ||
90 | + */ | ||
91 | + onShareAppMessage: function () { | ||
92 | + | ||
93 | + } | ||
94 | +}) |
pages/personal/personal.json
0 → 100644
pages/personal/personal.wxml
0 → 100644
1 | +<!--pages/personal/personal.wxml--> | ||
2 | +<view class='z_container'> | ||
3 | + <!--个人信息 --> | ||
4 | + <view class='person_info'> | ||
5 | + <open-data type="userAvatarUrl" class='image_box'></open-data> | ||
6 | + <view class='name'>{{name}}</view> | ||
7 | + </view> | ||
8 | + <!--周莉医生用户信息--> | ||
9 | + <view class='userInfo' bindtap='getUserInfo'> | ||
10 | + <view class='left'> | ||
11 | + <view class='userInfo_note'>周莉医生用户信息</view> | ||
12 | + <view class='userInfo_note_tips'>周莉医生用户请将该内容补充完整</view> | ||
13 | + </view> | ||
14 | + <view class='right'> | ||
15 | + <image src='/images/next.png'></image> | ||
16 | + </view> | ||
17 | + </view> | ||
18 | + | ||
19 | + <!--baseInfo--> | ||
20 | + <view class='baseInfo'> | ||
21 | + <view class='baseInfo_item baseInfo_item_top'> | ||
22 | + <view style='color:#000'>基本信息</view> | ||
23 | + <view class='action' bindtap='changebaseInfo'>修改</view> | ||
24 | + </view> | ||
25 | + <view class='baseInfo_item'> | ||
26 | + <view>孕妇年龄</view> | ||
27 | + <view class='detail'>{{age}}岁</view> | ||
28 | + </view> | ||
29 | + <view class='baseInfo_item'> | ||
30 | + <view>孕妇身高</view> | ||
31 | + <view class='detail'>{{height}}cm</view> | ||
32 | + </view> | ||
33 | + <view class='baseInfo_item'> | ||
34 | + <view>孕前体重</view> | ||
35 | + <view class='detail'>{{pre_weight}}kg</view> | ||
36 | + </view> | ||
37 | + <view class='baseInfo_item'> | ||
38 | + <view>末次月经第一天</view> | ||
39 | + <view class='detail'>{{last_menstruation}}</view> | ||
40 | + </view> | ||
41 | + <view class='baseInfo_item'> | ||
42 | + <view>单双胞胎</view> | ||
43 | + <view class='detail'>{{is_single_birth=='2'?'双胞胎':'单胞胎'}}</view> | ||
44 | + </view> | ||
45 | + <!-- <view class='baseInfo_item'> | ||
46 | + <view>孕周</view> | ||
47 | + <view class='detail'>孕期{{week}}周+{{day}}天</view> | ||
48 | + </view> | ||
49 | + <view class='baseInfo_item'> | ||
50 | + <view>孕妇当前体重</view> | ||
51 | + <view class='detail'>{{current_weight}}kg</view> | ||
52 | + </view> --> | ||
53 | + </view> | ||
54 | + | ||
55 | +</view> |
pages/personal/personal.wxss
0 → 100644
1 | +/* pages/personal/personal.wxss */ | ||
2 | +.z_container{ | ||
3 | + height: 100vh; | ||
4 | + background-color: #EFEFF4; | ||
5 | +} | ||
6 | +.person_info{ | ||
7 | + height: 170rpx; | ||
8 | + width: 100%; | ||
9 | + display: flex; | ||
10 | + align-items: center; | ||
11 | + padding-left: 30rpx; | ||
12 | + background: #FFF; | ||
13 | +} | ||
14 | +.image_box{ | ||
15 | + width: 106rpx; | ||
16 | + height: 106rpx; | ||
17 | + border-radius: 50%; | ||
18 | + overflow: hidden; | ||
19 | + margin-right: 34rpx; | ||
20 | +} | ||
21 | +.image_box image{ | ||
22 | + width: 100%; | ||
23 | + height: 100%; | ||
24 | +} | ||
25 | +.name{ | ||
26 | + font-size: 30rpx; | ||
27 | +} | ||
28 | +.userInfo{ | ||
29 | + height: 120rpx; | ||
30 | + background: #FFF; | ||
31 | + display: flex; | ||
32 | + padding-left: 30rpx; | ||
33 | + margin-top: 30rpx; | ||
34 | + margin-bottom: 30rpx; | ||
35 | + align-items: center; | ||
36 | + justify-content: center; | ||
37 | +} | ||
38 | +.left{ | ||
39 | + display: flex; | ||
40 | + flex-direction: column; | ||
41 | + justify-content: center; | ||
42 | + font-size: 34rpx; | ||
43 | +} | ||
44 | +.right{ | ||
45 | + flex: 1; | ||
46 | + height: 100%; | ||
47 | + display: flex; | ||
48 | + align-items: center; | ||
49 | + justify-content: flex-end; | ||
50 | +} | ||
51 | +.right image{ | ||
52 | + width: 30rpx; | ||
53 | + height: 30rpx; | ||
54 | + margin-right: 30rpx; | ||
55 | +} | ||
56 | +.userInfo_note_tips{ | ||
57 | + font-size: 26rpx; | ||
58 | + color: #999; | ||
59 | +} | ||
60 | +.baseInfo{ | ||
61 | + margin-top: 30rpx; | ||
62 | + background-color: #FFF; | ||
63 | +} | ||
64 | + | ||
65 | +.baseInfo_item{ | ||
66 | + padding: 0 30rpx; | ||
67 | + height: 88rpx; | ||
68 | + display: flex; | ||
69 | + align-items: center; | ||
70 | + justify-content: space-between; | ||
71 | + font-size: 34rpx; | ||
72 | + color: #666; | ||
73 | + border-bottom: 1rpx solid #D8D8D8; | ||
74 | +} | ||
75 | +.baseInfo_item:last-child{ | ||
76 | + border: none; | ||
77 | +} | ||
78 | +.baseInfo_item_top{ | ||
79 | + height: 98rpx; | ||
80 | +} | ||
81 | +.action{ | ||
82 | + color: #FFF; | ||
83 | + width: 84rpx; | ||
84 | + height: 50rpx; | ||
85 | + background: #51DBA2; | ||
86 | + border-radius: 100px; | ||
87 | + justify-content: center; | ||
88 | + align-items: center; | ||
89 | + font-size: 30rpx; | ||
90 | + display: flex; | ||
91 | +} | ||
92 | +.bottom_menu{ | ||
93 | + display: flex; | ||
94 | + align-items: center; | ||
95 | + justify-content: space-around; | ||
96 | + height: 98rpx; | ||
97 | + background: #F7F7FA; | ||
98 | + position: fixed; | ||
99 | + bottom: 0; | ||
100 | + left: 0; | ||
101 | + width: 100%; | ||
102 | + border-top: 1rpx solid rgba(247,247,250,.1); | ||
103 | +} |
pages/startRecord/startRecord.js
0 → 100644
1 | +// pages/startRecord/startRecord.js | ||
2 | +const app = getApp() | ||
3 | +Page({ | ||
4 | + | ||
5 | + /** | ||
6 | + * 页面的初始数据 | ||
7 | + */ | ||
8 | + data: { | ||
9 | + // hasToken: false | ||
10 | + }, | ||
11 | + startrecord(){ | ||
12 | + let url = '/user/getGravidaInfo'; | ||
13 | + app.post(url,{}).then((res)=>{ | ||
14 | + if(res.id){ | ||
15 | + wx.switchTab({ | ||
16 | + url: '/pages/weight/weight', | ||
17 | + }) | ||
18 | + }else{ | ||
19 | + wx.navigateTo({ | ||
20 | + url: '/pages/baseInfo/baseInfo', | ||
21 | + }) | ||
22 | + } | ||
23 | + }).catch((errMsg)=>{ | ||
24 | + | ||
25 | + }) | ||
26 | + }, | ||
27 | + getUserInfo(e) { | ||
28 | + let detail = e.detail ; | ||
29 | + let that = this ; | ||
30 | + wx.login({ | ||
31 | + success: (res) => { | ||
32 | + // 获取code | ||
33 | + let code = res.code; | ||
34 | + let codeurl = '/public/login'; | ||
35 | + let params = { | ||
36 | + code: code, | ||
37 | + encrypted_data: detail.encryptedData, | ||
38 | + doctor_id:'', | ||
39 | + iv: detail.iv, | ||
40 | + raw_data: detail.rawData, | ||
41 | + signature: detail.signature, | ||
42 | + doctor_id: wx.getStorageSync('doctor_id') | ||
43 | + } | ||
44 | + console.log(params) | ||
45 | + wx.showLoading({ | ||
46 | + title: '加载中', | ||
47 | + }) | ||
48 | + app.post(codeurl, params).then((res) => { | ||
49 | + //正确返回结果 | ||
50 | + console.log(res) | ||
51 | + wx.setStorageSync('token', res.token) | ||
52 | + this.setData({ | ||
53 | + hasToken: true | ||
54 | + }) | ||
55 | + wx.hideLoading() | ||
56 | + // 登陆后跳转 | ||
57 | + that.startrecord() | ||
58 | + }).catch((errMsg) => { | ||
59 | + console.log(errMsg);//错误提示信息 | ||
60 | + }); | ||
61 | + } | ||
62 | + }) | ||
63 | + }, | ||
64 | + /** | ||
65 | + * 生命周期函数--监听页面加载 | ||
66 | + */ | ||
67 | + onLoad: function (options) { | ||
68 | + let token = wx.getStorageSync('token') | ||
69 | + if (token != '' && token != null && typeof token != undefined) { | ||
70 | + this.setData({ | ||
71 | + hasToken: true | ||
72 | + }) | ||
73 | + } | ||
74 | + }, | ||
75 | + /** | ||
76 | + * 生命周期函数--监听页面初次渲染完成 | ||
77 | + */ | ||
78 | + onReady: function () { | ||
79 | + | ||
80 | + }, | ||
81 | + | ||
82 | + /** | ||
83 | + * 生命周期函数--监听页面显示 | ||
84 | + */ | ||
85 | + onShow: function () { | ||
86 | + | ||
87 | + }, | ||
88 | + | ||
89 | + /** | ||
90 | + * 生命周期函数--监听页面隐藏 | ||
91 | + */ | ||
92 | + onHide: function () { | ||
93 | + | ||
94 | + }, | ||
95 | + | ||
96 | + /** | ||
97 | + * 生命周期函数--监听页面卸载 | ||
98 | + */ | ||
99 | + onUnload: function () { | ||
100 | + | ||
101 | + }, | ||
102 | + | ||
103 | + /** | ||
104 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
105 | + */ | ||
106 | + onPullDownRefresh: function () { | ||
107 | + | ||
108 | + }, | ||
109 | + | ||
110 | + /** | ||
111 | + * 页面上拉触底事件的处理函数 | ||
112 | + */ | ||
113 | + onReachBottom: function () { | ||
114 | + | ||
115 | + }, | ||
116 | + | ||
117 | + /** | ||
118 | + * 用户点击右上角分享 | ||
119 | + */ | ||
120 | + onShareAppMessage: function () { | ||
121 | + | ||
122 | + } | ||
123 | +}) |
pages/startRecord/startRecord.json
0 → 100644
pages/startRecord/startRecord.wxml
0 → 100644
1 | +<!--pages/startRecord/startRecord.wxml--> | ||
2 | +<view class='z_container'> | ||
3 | + <view class='top_png'> | ||
4 | + <image src='/images/zhouli.png'></image> | ||
5 | + </view> | ||
6 | + <!--note --> | ||
7 | + <view class='note'>周密记录 顺莉生产</view> | ||
8 | + <view class='introduce'> | ||
9 | + <view class='introduce_note'>你好,我是北京妇产医院</view> | ||
10 | + <view class='introduce_note'>产科主任医师周莉</view> | ||
11 | + <!-- <view class='introduce_note'>我与您一起关注您的孕期体重</view> --> | ||
12 | + <!-- <view class='introduce_note'>孕期体重小帮手</view> --> | ||
13 | + <!-- <view class='introduce_note'>记录、见证你和宝宝的十月旅程</view> --> | ||
14 | + <!-- <view class='introduce_note'></view> --> | ||
15 | + </view> | ||
16 | + <view class='stratBtn' wx:if="{{hasToken}}" bindtap='startrecord'>开始记录</view> | ||
17 | + <button class='stratBtn' wx:else open-type="getUserInfo" bindgetuserinfo="getUserInfo">开始记录</button> | ||
18 | +</view> |
pages/startRecord/startRecord.wxss
0 → 100644
1 | +/* pages/startRecord/startRecord.wxss */ | ||
2 | + | ||
3 | +.top_png{ | ||
4 | + width: 750rpx; | ||
5 | + height: 640rpx; | ||
6 | + background: #51DBA2; | ||
7 | + display: flex; | ||
8 | + align-items: center; | ||
9 | + justify-content: center; | ||
10 | +} | ||
11 | + | ||
12 | +.top_png image{ | ||
13 | + width: 100%; | ||
14 | + height: 100%; | ||
15 | +} | ||
16 | +.note{ | ||
17 | + display: flex; | ||
18 | + align-items: center; | ||
19 | + justify-content: center; | ||
20 | + font-size: 74rpx; | ||
21 | + margin-top: 60rpx; | ||
22 | +} | ||
23 | +.introduce{ | ||
24 | + margin-top: 17rpx; | ||
25 | + | ||
26 | +} | ||
27 | +.introduce_note{ | ||
28 | + font-size: 36rpx; | ||
29 | + color: #999; | ||
30 | + display: flex; | ||
31 | + align-items: center; | ||
32 | + justify-content: center; | ||
33 | + line-height: 1.6; | ||
34 | +} | ||
35 | +.stratBtn{ | ||
36 | + width: 670rpx; | ||
37 | + height: 94rpx; | ||
38 | + background: #51DBA2; | ||
39 | + border-radius: 10rpx; | ||
40 | + margin-left: 40rpx; | ||
41 | + margin-top: 60rpx; | ||
42 | + display: flex; | ||
43 | + justify-content: center; | ||
44 | + align-items: center; | ||
45 | + font-size: 36rpx; | ||
46 | + color: #FFF; | ||
47 | + | ||
48 | +} |
pages/userInfo/userInfo.js
0 → 100644
1 | +// pages/userInfo/userInfo.js | ||
2 | +const app = getApp() | ||
3 | +Page({ | ||
4 | + | ||
5 | + /** | ||
6 | + * 页面的初始数据 | ||
7 | + */ | ||
8 | + data: { | ||
9 | + | ||
10 | + }, | ||
11 | + inputName(e){ | ||
12 | + this.setData({ | ||
13 | + name: e.detail.value | ||
14 | + }) | ||
15 | + }, | ||
16 | + inputNum(e){ | ||
17 | + this.setData({ | ||
18 | + archives_number: e.detail.value | ||
19 | + }) | ||
20 | + }, | ||
21 | + inputMobile(e){ | ||
22 | + this.setData({ | ||
23 | + mobile: e.detail.value | ||
24 | + }) | ||
25 | + }, | ||
26 | + getuserInfo(){ | ||
27 | + let url = '/user/getGravidaInfo' | ||
28 | + app.post(url,{}).then((res)=>{ | ||
29 | + console.log(res) | ||
30 | + this.setData({ | ||
31 | + name: res.name, | ||
32 | + archives_number: res.archives_number, | ||
33 | + mobile: res.mobile | ||
34 | + }) | ||
35 | + }) | ||
36 | + }, | ||
37 | + settingUserInfo(){ | ||
38 | + let params = { | ||
39 | + name: this.data.name, | ||
40 | + archives_number: this.data.archives_number, | ||
41 | + mobile: this.data.mobile | ||
42 | + } | ||
43 | + let reg = /^1[3|4|5|7|8][0-9]{9}$/; | ||
44 | + if(params.name == '' || typeof params.name == 'undefined' || params.name == null){ | ||
45 | + wx.showToast({ | ||
46 | + title: '请填写姓名', | ||
47 | + icon: 'none' | ||
48 | + }) | ||
49 | + return false | ||
50 | + } else if (params.archives_number == '' || typeof params.archives_number == 'undefined'){ | ||
51 | + wx.showToast({ | ||
52 | + title: '请填写建档编号', | ||
53 | + icon: 'none' | ||
54 | + }) | ||
55 | + return false | ||
56 | + } else if (!reg.test(params.mobile)){ | ||
57 | + wx.showToast({ | ||
58 | + title: '联系方式不正确', | ||
59 | + icon: 'none' | ||
60 | + }) | ||
61 | + return false | ||
62 | + } else{ | ||
63 | + let url = '/profile/setGravidaInfo' | ||
64 | + app.post(url, params).then((res) => { | ||
65 | + console.log(res) | ||
66 | + wx.showToast({ | ||
67 | + title: '提交成功', | ||
68 | + }) | ||
69 | + wx.switchTab({ | ||
70 | + url: '/pages/personal/personal', | ||
71 | + }) | ||
72 | + }).catch((errMsg) => { | ||
73 | + | ||
74 | + }) | ||
75 | + } | ||
76 | + | ||
77 | + }, | ||
78 | + /** | ||
79 | + * 生命周期函数--监听页面加载 | ||
80 | + */ | ||
81 | + onLoad: function (options) { | ||
82 | + this.getuserInfo() | ||
83 | + }, | ||
84 | + | ||
85 | + /** | ||
86 | + * 生命周期函数--监听页面初次渲染完成 | ||
87 | + */ | ||
88 | + onReady: function () { | ||
89 | + | ||
90 | + }, | ||
91 | + | ||
92 | + /** | ||
93 | + * 生命周期函数--监听页面显示 | ||
94 | + */ | ||
95 | + onShow: function () { | ||
96 | + | ||
97 | + }, | ||
98 | + | ||
99 | + /** | ||
100 | + * 生命周期函数--监听页面隐藏 | ||
101 | + */ | ||
102 | + onHide: function () { | ||
103 | + | ||
104 | + }, | ||
105 | + | ||
106 | + /** | ||
107 | + * 生命周期函数--监听页面卸载 | ||
108 | + */ | ||
109 | + onUnload: function () { | ||
110 | + | ||
111 | + }, | ||
112 | + | ||
113 | + /** | ||
114 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
115 | + */ | ||
116 | + onPullDownRefresh: function () { | ||
117 | + | ||
118 | + }, | ||
119 | + | ||
120 | + /** | ||
121 | + * 页面上拉触底事件的处理函数 | ||
122 | + */ | ||
123 | + onReachBottom: function () { | ||
124 | + | ||
125 | + }, | ||
126 | + | ||
127 | + /** | ||
128 | + * 用户点击右上角分享 | ||
129 | + */ | ||
130 | + onShareAppMessage: function () { | ||
131 | + | ||
132 | + } | ||
133 | +}) |
pages/userInfo/userInfo.json
0 → 100644
pages/userInfo/userInfo.wxml
0 → 100644
1 | +<!--pages/userInfo/userInfo.wxml--> | ||
2 | +<view class='z_container'> | ||
3 | + <view class='user_top'> | ||
4 | + 周莉医生用户请将以下的内容补充完整,这可以让医生更好的为您诊断。 | ||
5 | + </view> | ||
6 | + <!--信息记录 --> | ||
7 | + <view class='info_box'> | ||
8 | + <view class='info_item'> | ||
9 | + <view>姓名</view> | ||
10 | + <input class='info_item_input' value='{{name}}' bindinput='inputName' /> | ||
11 | + </view> | ||
12 | + <view class='info_item'> | ||
13 | + <view>建档登记号</view> | ||
14 | + <input class='info_item_input' value='{{archives_number}}' placeholder='请输入建档登记号' bindinput='inputNum' /> | ||
15 | + </view> | ||
16 | + <view class='info_item'> | ||
17 | + <view>联系电话</view> | ||
18 | + <input class='info_item_input' value='{{mobile}}' type='number' placeholder='请输入联系电话' bindinput='inputMobile' /> | ||
19 | + </view> | ||
20 | + | ||
21 | + </view> | ||
22 | + <view class='save_btn' bindtap='settingUserInfo'>保存</view> | ||
23 | +</view> |
pages/userInfo/userInfo.wxss
0 → 100644
1 | +/* pages/userInfo/userInfo.wxss */ | ||
2 | + | ||
3 | +.z_container{ | ||
4 | + background-color: #EFEFF4; | ||
5 | + height: 100vh; | ||
6 | +} | ||
7 | +.user_top{ | ||
8 | + font-size: 30rpx; | ||
9 | + padding: 30rpx 46rpx 18rpx; | ||
10 | + color: #999; | ||
11 | +} | ||
12 | +.info_box{ | ||
13 | + background: #FFF; | ||
14 | + padding: 0 36rpx 0 30rpx; | ||
15 | +} | ||
16 | + | ||
17 | +.info_item{ | ||
18 | + height: 88rpx; | ||
19 | + border-bottom: 1px solid #E5E5E5; | ||
20 | + display: flex; | ||
21 | + align-items: center; | ||
22 | + justify-content: space-between; | ||
23 | + font-size: 34rpx; | ||
24 | + color: #333333; | ||
25 | +} | ||
26 | +.info_item:last-child{ | ||
27 | + border: none; | ||
28 | +} | ||
29 | +.info_item_input{ | ||
30 | + color: #999; | ||
31 | + text-align: right; | ||
32 | + margin-left: auto; | ||
33 | +} | ||
34 | +.save_btn{ | ||
35 | + color: #FFF; | ||
36 | + display: flex; | ||
37 | + align-items: center; | ||
38 | + justify-content: center; | ||
39 | + background: #51DBA2; | ||
40 | + width: 670rpx; | ||
41 | + height: 94rpx; | ||
42 | + position: fixed; | ||
43 | + bottom: 50rpx; | ||
44 | + left: 40rpx; | ||
45 | + border-radius: 10rpx; | ||
46 | +} |
pages/weight/weight.js
0 → 100644
1 | +// pages/weight/weight.js | ||
2 | +const app = getApp(); | ||
3 | +Page({ | ||
4 | + /** | ||
5 | + * 页面的初始数据 | ||
6 | + */ | ||
7 | + data: { | ||
8 | + weightLists:[], | ||
9 | + show: false, | ||
10 | + showtype:0, | ||
11 | + mask: false, | ||
12 | + rote: -15 | ||
13 | + }, | ||
14 | + add_record(){ | ||
15 | + wx.navigateTo({ | ||
16 | + url: '/pages/addWeight/addWeight', | ||
17 | + }) | ||
18 | + }, | ||
19 | + get_records(){ | ||
20 | + let url = '/user/getWeightLog' | ||
21 | + app.post(url,{}).then((res)=>{ | ||
22 | + let rote = parseInt(res.new.scale) | ||
23 | + this.setData({ | ||
24 | + weightLists: res.list, | ||
25 | + latestRecord: res.new, | ||
26 | + bmi: res.bmi, | ||
27 | + rote: rote - 90, | ||
28 | + week: res.new.week, | ||
29 | + day: res.new.day, | ||
30 | + nowWeight: res.new.weight, | ||
31 | + residual_quota: res.new.residual_quota, | ||
32 | + increase: res.new.increase, | ||
33 | + residual_msg: res.new.residual_msg, | ||
34 | + | ||
35 | + baseData:{ | ||
36 | + week: res.new.week, | ||
37 | + day: res.new.day, | ||
38 | + nowWeight: res.new.weight, | ||
39 | + rote: rote - 90, | ||
40 | + residual_quota: res.new.residual_quota, | ||
41 | + residual_msg: res.new.residual_msg, | ||
42 | + increase: res.new.increase | ||
43 | + } | ||
44 | + }) | ||
45 | + let status = this.data.weightLists[0].sign_status | ||
46 | + let newWeight = wx.getStorageSync('newWeight') | ||
47 | + // let type = status == '1' && 'newWeight' ? '1' : status == '2' && 'newWeight' ? '2' : status == '3' && newWeight ? '3' : status == '4' && newWeight ? '4' : status == '5' && newWeight?'5':''; | ||
48 | + if (newWeight){ | ||
49 | + this.setData({ | ||
50 | + showtype: 8, | ||
51 | + mask: true, | ||
52 | + sign_mbi: this.data.weightLists[0].sign_mbi | ||
53 | + | ||
54 | + }) | ||
55 | + } | ||
56 | + | ||
57 | + }).catch((errMsg)=>{ | ||
58 | + | ||
59 | + }) | ||
60 | + }, | ||
61 | + showTips(){ | ||
62 | + let that = this; | ||
63 | + let show = this.data.show; | ||
64 | + if(!show){ | ||
65 | + that.setData({ | ||
66 | + show: !that.data.show | ||
67 | + }) | ||
68 | + setTimeout(function(){ | ||
69 | + that.setData({ | ||
70 | + show: !that.data.show | ||
71 | + }) | ||
72 | + },3000) | ||
73 | + } | ||
74 | + }, | ||
75 | + showtoast(e){ | ||
76 | + console.log(e) | ||
77 | + let rote = parseInt(e.currentTarget.dataset.roate) | ||
78 | + this.setData({ | ||
79 | + showtype: 8, | ||
80 | + mask: true, | ||
81 | + sign_mbi: e.currentTarget.dataset.current.sign_mbi, | ||
82 | + rote: rote - 90, | ||
83 | + week: e.currentTarget.dataset.current.week, | ||
84 | + day: e.currentTarget.dataset.current.day, | ||
85 | + nowWeight: e.currentTarget.dataset.current.current_weight, | ||
86 | + residual_quota: e.currentTarget.dataset.current.residual_quota, | ||
87 | + residual_msg: e.currentTarget.dataset.current.residual_msg, | ||
88 | + increase: e.currentTarget.dataset.current.increase | ||
89 | + }) | ||
90 | + }, | ||
91 | + closefirst(){ | ||
92 | + this.setData({ | ||
93 | + showtype: 0, | ||
94 | + mask: false | ||
95 | + // rote: this.data.baseData.rote, | ||
96 | + // week: this.data.baseData.week, | ||
97 | + // day: this.data.baseData.day, | ||
98 | + // nowWeight: this.data.baseData.nowWeight | ||
99 | + }) | ||
100 | + wx.removeStorageSync('first') | ||
101 | + wx.removeStorageSync('newWeight') | ||
102 | + }, | ||
103 | + /** | ||
104 | + * 生命周期函数--监听页面加载 | ||
105 | + */ | ||
106 | + onLoad: function (options) { | ||
107 | + let first = wx.getStorageSync('first') | ||
108 | + if (first) { | ||
109 | + this.setData({ | ||
110 | + showtype: 6, | ||
111 | + mask: true | ||
112 | + }) | ||
113 | + } | ||
114 | + }, | ||
115 | + /** | ||
116 | + * 生命周期函数--监听页面初次渲染完成 | ||
117 | + */ | ||
118 | + onReady: function () { | ||
119 | + | ||
120 | + }, | ||
121 | + /** | ||
122 | + * 生命周期函数--监听页面显示 | ||
123 | + */ | ||
124 | + onShow: function () { | ||
125 | + this.get_records(); | ||
126 | + }, | ||
127 | + | ||
128 | + /** | ||
129 | + * 生命周期函数--监听页面隐藏 | ||
130 | + */ | ||
131 | + onHide: function () { | ||
132 | + | ||
133 | + }, | ||
134 | + | ||
135 | + /** | ||
136 | + * 生命周期函数--监听页面卸载 | ||
137 | + */ | ||
138 | + onUnload: function () { | ||
139 | + | ||
140 | + }, | ||
141 | + | ||
142 | + /** | ||
143 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
144 | + */ | ||
145 | + onPullDownRefresh: function () { | ||
146 | + | ||
147 | + }, | ||
148 | + | ||
149 | + /** | ||
150 | + * 页面上拉触底事件的处理函数 | ||
151 | + */ | ||
152 | + onReachBottom: function () { | ||
153 | + | ||
154 | + }, | ||
155 | + | ||
156 | + /** | ||
157 | + * 用户点击右上角分享 | ||
158 | + */ | ||
159 | + onShareAppMessage: function () { | ||
160 | + | ||
161 | + } | ||
162 | +}) |
pages/weight/weight.json
0 → 100644
pages/weight/weight.wxml
0 → 100644
1 | +<!--pages/weight/weight.wxml--> | ||
2 | +<view class='z_container'> | ||
3 | + <view class='top_watch' > | ||
4 | + <view class='todayData'> | ||
5 | + <view class='now_data'>孕{{week}}周+{{day}}天</view> | ||
6 | + <view class='now_weight'>{{nowWeight}}</view> | ||
7 | + </view> | ||
8 | + <view class='images_box'> | ||
9 | + <image src='/images/circle.png'></image> | ||
10 | + </view> | ||
11 | + <!--顶部数据 --> | ||
12 | + <view class='data_1 data'>{{bmi[0]}}Kg</view> | ||
13 | + <view class='data_2 data'>{{bmi[1]}}Kg</view> | ||
14 | + <view class='data_3 data'>{{bmi[2]}}Kg</view> | ||
15 | + <view class='data_4 data'>{{bmi[3]}}Kg</view> | ||
16 | + <!--指针 --> | ||
17 | + <image src='/images/zhizhen.png' class='zhizhen' style='transform: rotate({{rote}}deg);'></image> | ||
18 | + </view> | ||
19 | + <!--topData --> | ||
20 | + <view class='top_data'> | ||
21 | + <view class='left_data'> | ||
22 | + <view class='top_direc'> | ||
23 | + {{increase}} | ||
24 | + <view class='danwei'>kg</view> | ||
25 | + </view> | ||
26 | + <view class='top_label'> | ||
27 | + 较孕前增长 | ||
28 | + </view> | ||
29 | + </view> | ||
30 | + <view class='right_data'> | ||
31 | + <view class='top_direc'> | ||
32 | + {{residual_quota}} | ||
33 | + <view class='danwei'>kg</view> | ||
34 | + </view> | ||
35 | + <view class='top_label' bindtap='showTips'> | ||
36 | + <text wx:if="{{residual_quota>0}}">剩余配额</text> | ||
37 | + <text wx:else>超过配额</text> | ||
38 | + <view class='tips'>!</view> | ||
39 | + </view> | ||
40 | + </view> | ||
41 | + <view class='latestips {{show?"show":""}}'> | ||
42 | + <view class='tips_box'> | ||
43 | + {{residual_msg}}</view> | ||
44 | + </view> | ||
45 | + | ||
46 | + </view> | ||
47 | + <!--container --> | ||
48 | + <view class='record_container'> | ||
49 | + <!--添加记录--> | ||
50 | + <view class='add_icon' bindtap='add_record'> | ||
51 | + <image src='/images/+@2x.png'></image> | ||
52 | + </view> | ||
53 | + <!--记录列表--> | ||
54 | + <view class='record_label'> | ||
55 | + <view class='label_item'> | ||
56 | + 孕期 | ||
57 | + </view> | ||
58 | + <view class='label_item'> | ||
59 | + 体重 kg | ||
60 | + </view> | ||
61 | + <view class='label_item'> | ||
62 | + 状态 | ||
63 | + </view> | ||
64 | + </view> | ||
65 | + <view class='record_lists'> | ||
66 | + <block wx:for="{{weightLists}}" wx:key="" > | ||
67 | + <view class='record_list' bindtap='showtoast' id='{{item.sign_status}}' data-mbi="{{item.sign_mbi}}" data-roate='{{item.scale}}' data-current="{{item}}"> | ||
68 | + <view class='record_list_item'>孕{{item.week}}周+{{item.day}}天</view> | ||
69 | + <view class='record_list_item'>{{item.current_weight}}</view> | ||
70 | + <view class='record_list_item'> | ||
71 | + <view class='chaoqing weight_type {{item.sign_status=="1"?"active":""}}'> | ||
72 | + <image class='type_icon' src='/images/copy.png'></image> | ||
73 | + <text class='cq'>超轻</text> | ||
74 | + </view> | ||
75 | + <view class='chaoqing weight_type {{item.sign_status=="2"?"active":""}}'> | ||
76 | + <image class='type_icon' src='/images/copy.png' ></image> | ||
77 | + <text class='cq'>消瘦</text> | ||
78 | + </view> | ||
79 | + <text class='zhengchang weight_type {{item.sign_status=="3"?"active":""}}' >正常</text> | ||
80 | + <view class='chaozhong weight_type {{item.sign_status=="4"?"active":""}}'> | ||
81 | + <image class='type_icon' src='/images/up.png'></image> | ||
82 | + <text class='cq'>偏重</text> | ||
83 | + </view> | ||
84 | + <view class='chaozhong weight_type {{item.sign_status=="5"?"active":""}}' > | ||
85 | + <image class='type_icon' src='/images/up.png'></image> | ||
86 | + <text class='cq'>超重</text> | ||
87 | + </view> | ||
88 | + </view> | ||
89 | + </view> | ||
90 | + </block> | ||
91 | + </view> | ||
92 | + </view> | ||
93 | + <view class='biaozhu'>注:算法数据来源于美国医学研究所(IOM)</view> | ||
94 | +</view> | ||
95 | +<view class='mask' wx:if="{{mask}}" bindtap='closefirst'> | ||
96 | + <!--初始测量提示框 --> | ||
97 | + <view class='tongyi_toast' wx:if="{{showtype==6}}"> | ||
98 | + <view class='toast_container'> | ||
99 | + <view class='shengming'>体重测量的正确姿势:</view> | ||
100 | + <view class='detail'>早上起床后;排空大小便;穿同样的衣服;尽量在吃早饭之前。因为这样称体重,受外界影响比较小,会比较准确。</view> | ||
101 | + </view> | ||
102 | + <view class='liaojie' bindtap='closefirst'>知道了</view> | ||
103 | + </view> | ||
104 | + | ||
105 | + <!--正常 --> | ||
106 | + <view class='tongyi_toast' wx:if="{{showtype=='3'}}"> | ||
107 | + <view class='toast_container'> | ||
108 | + <view class='detail'>{{sign_mbi}}</view> | ||
109 | + </view> | ||
110 | + <view class='liaojie' bindtap='closefirst'>知道了</view> | ||
111 | + </view> | ||
112 | + <!--超轻 --> | ||
113 | + <view class='tongyi_toast' wx:if="{{showtype=='1'}}"> | ||
114 | + <view class='toast_container'> | ||
115 | + <view class='detail'>您目前体重过轻,为不影响您和宝宝的健康,需为身体增加能量,加强营养,您可在公众号图文消息中查看孕妇体重过轻如何增重。</view> | ||
116 | + </view> | ||
117 | + <view class='liaojie' bindtap='closefirst'>知道了</view> | ||
118 | + </view> | ||
119 | + <!--偏轻 --> | ||
120 | + <view class='tongyi_toast' wx:if="{{showtype=='2'}}"> | ||
121 | + <view class='toast_container'> | ||
122 | + <view class='detail'>您目前体重偏低,为不影响您和宝宝的健康,需为身体增加能量,加强营养,您可在公众号图文消息中查看体重偏低如何增重。</view> | ||
123 | + </view> | ||
124 | + <view class='liaojie' bindtap='closefirst'>知道了</view> | ||
125 | + </view> | ||
126 | + <!--超重--> | ||
127 | + <view class='tongyi_toast' wx:if="{{showtype=='4'}}"> | ||
128 | + <view class='toast_container'> | ||
129 | + <view class='detail'>您目前体重偏重,为了不影响您和宝宝的健康,建议控制体重增长速度,少食多餐适当运动,您可在公众号图文消息中查看孕期如何合理饮食。</view> | ||
130 | + </view> | ||
131 | + <view class='liaojie' bindtap='closefirst'>知道了</view> | ||
132 | + </view> | ||
133 | + <view class='tongyi_toast' wx:if="{{showtype=='5'}}"> | ||
134 | + <view class='toast_container'> | ||
135 | + <view class='detail'>您目前体重超重,为了不影响您和宝宝的健康,建议减重,为避免发生妊娠期合并症,适当运动,您可在公众号图文消息中查看孕期如何科学减重。</view> | ||
136 | + </view> | ||
137 | + <view class='liaojie' bindtap='closefirst'>知道了</view> | ||
138 | + </view> | ||
139 | + <!--点击提示 --> | ||
140 | + <view class='tongyi_toast' wx:if="{{showtype=='8'}}"> | ||
141 | + <view class='toast_container'> | ||
142 | + <view class='detail'>{{sign_mbi}}</view> | ||
143 | + </view> | ||
144 | + <view class='liaojie' bindtap='closefirst'>知道了</view> | ||
145 | + </view> | ||
146 | +</view> |
pages/weight/weight.wxss
0 → 100644
1 | +/* pages/weight/weight.wxss */ | ||
2 | + | ||
3 | +.z_container{ | ||
4 | + height: 100vh; | ||
5 | + overflow: hidden; | ||
6 | + background: -webkit-linear-gradient(#52DCA3, #F6FFD5); | ||
7 | + background: -o-linear-gradient(#52DCA3, #F6FFD5); | ||
8 | + background: -moz-linear-gradient(#52DCA3, #F6FFD5); | ||
9 | + background: linear-gradient(#52DCA3, #F6FFD5); | ||
10 | +} | ||
11 | +.top_watch{ | ||
12 | + height: 240rpx; | ||
13 | + width: 370rpx; | ||
14 | + margin: 0 auto; | ||
15 | + position: relative; | ||
16 | +} | ||
17 | +.top_watch image{ | ||
18 | + width: 100%; | ||
19 | + height: 100%; | ||
20 | +} | ||
21 | +.top_watch .data{ | ||
22 | + position: absolute; | ||
23 | + color: #FFF; | ||
24 | + font-size: 25rpx; | ||
25 | + z-index: 15; | ||
26 | +} | ||
27 | +.data_1{ | ||
28 | + top: 90rpx; | ||
29 | + left: -10rpx; | ||
30 | + transform: rotate(-54deg); | ||
31 | +} | ||
32 | +.data_2{ | ||
33 | + top: 20rpx; | ||
34 | + transform: rotate(-18deg); | ||
35 | + left: 94rpx; | ||
36 | +} | ||
37 | +.data_3{ | ||
38 | + top: 20rpx; | ||
39 | + transform: rotate(18deg); | ||
40 | + right: 94rpx; | ||
41 | +} | ||
42 | +.data_4{ | ||
43 | + top: 90rpx; | ||
44 | + transform: rotate(54deg); | ||
45 | + right: -10rpx; | ||
46 | +} | ||
47 | +.images_box{ | ||
48 | + width: 100%; | ||
49 | + height: 185rpx; | ||
50 | + position: absolute; | ||
51 | + bottom: 0; | ||
52 | + left: 50%; | ||
53 | + transform: translateX(-50%); | ||
54 | +} | ||
55 | +.top_data{ | ||
56 | + margin: 13rpx 95rpx 0 118rpx; | ||
57 | + display: flex; | ||
58 | + justify-content: space-between; | ||
59 | + color: #FFF; | ||
60 | + position: relative; | ||
61 | +} | ||
62 | +.latestips{ | ||
63 | + width: 400rpx; | ||
64 | + height: 110rpx; | ||
65 | + background: #FFF; | ||
66 | + position: absolute; | ||
67 | + top: 25rpx; | ||
68 | + left: -80rpx; | ||
69 | + border-radius: 10rpx; | ||
70 | + opacity: 0; | ||
71 | + transition: 1s; | ||
72 | +} | ||
73 | +.latestips.show{ | ||
74 | + opacity: 1; | ||
75 | +} | ||
76 | +.tips_box{ | ||
77 | + width: 100%; | ||
78 | + height: 100%; | ||
79 | + position: relative; | ||
80 | + box-sizing: border-box; | ||
81 | + padding: 0rpx 10rpx 5rpx 13rpx; | ||
82 | + display: flex; | ||
83 | + align-items: center; | ||
84 | + font-size: 28rpx; | ||
85 | + color: #51DBA2; | ||
86 | +} | ||
87 | +.tips_box:after{ | ||
88 | + content: ''; | ||
89 | + display: block; | ||
90 | + bottom: 8rpx; | ||
91 | + right: -22rpx; | ||
92 | + position: absolute; | ||
93 | + width: 0; | ||
94 | + height: 0; | ||
95 | + border-left: 24rpx solid #FFF; | ||
96 | + border-top: 10rpx solid transparent; | ||
97 | + border-bottom: 10rpx solid transparent; | ||
98 | +} | ||
99 | +.top_direc{ | ||
100 | + display: flex; | ||
101 | + color: #FFF; | ||
102 | + font-size: 64rpx; | ||
103 | + height: 90rpx; | ||
104 | + font-weight: bold; | ||
105 | + align-items: center; | ||
106 | +} | ||
107 | +.danwei{ | ||
108 | + font-size: 34rpx; | ||
109 | + display: flex; | ||
110 | + align-items: flex-end; | ||
111 | + justify-content: center; | ||
112 | + height: 64rpx; | ||
113 | + font-weight: normal; | ||
114 | + margin-left: 20rpx; | ||
115 | +} | ||
116 | +.top_label{ | ||
117 | + font-size: 30rpx; | ||
118 | + display: flex; | ||
119 | + align-items: center; | ||
120 | + justify-content: center; | ||
121 | +} | ||
122 | +.tips{ | ||
123 | + width: 48rpx; | ||
124 | + height: 48rpx; | ||
125 | + border-radius: 50%; | ||
126 | + background-color: #FFF; | ||
127 | + color: #DDD; | ||
128 | + display: flex; | ||
129 | + align-items: center; | ||
130 | + margin-left: 15rpx; | ||
131 | + justify-content: center; | ||
132 | +} | ||
133 | +.record_container{ | ||
134 | + width: 670rpx; | ||
135 | + height:570rpx; | ||
136 | + background-color: #FFF; | ||
137 | + margin: 0 auto; | ||
138 | + margin-top: 60rpx; | ||
139 | + border-radius: 10rpx; | ||
140 | + position: relative; | ||
141 | + padding: 0 15rpx; | ||
142 | + padding-top: 60rpx; | ||
143 | + box-sizing: border-box; | ||
144 | + margin-bottom: 4rpx; | ||
145 | +} | ||
146 | +.add_icon{ | ||
147 | + width: 100rpx; | ||
148 | + height: 100rpx; | ||
149 | + display: flex; | ||
150 | + align-items: center; | ||
151 | + justify-content: center; | ||
152 | + position: absolute; | ||
153 | + left: 50%; | ||
154 | + top: -50rpx; | ||
155 | + transform: translateX(-50%); | ||
156 | +} | ||
157 | +.add_icon image{ | ||
158 | + width: 100%; | ||
159 | + height: 100%; | ||
160 | +} | ||
161 | +.record_label{ | ||
162 | + font-size: 34rpx; | ||
163 | + color: #333; | ||
164 | + font-weight: bold; | ||
165 | + display: flex; | ||
166 | + justify-content: space-between; | ||
167 | + border-bottom: 1rpx solid #D8D8D8; | ||
168 | +} | ||
169 | +.label_item,.record_list_item{ | ||
170 | + height: 88rpx; | ||
171 | + display: flex; | ||
172 | + flex: 1; | ||
173 | + align-items: center; | ||
174 | + justify-content: center; | ||
175 | +} | ||
176 | +.type_icon{ | ||
177 | + width: 28rpx; | ||
178 | + height: 28rpx; | ||
179 | + margin-right: 8rpx; | ||
180 | +} | ||
181 | +.record_lists{ | ||
182 | + height: 430rpx; | ||
183 | + overflow-y: auto; | ||
184 | +} | ||
185 | +.record_list{ | ||
186 | + font-size: 30rpx; | ||
187 | + color: #666; | ||
188 | + display: flex; | ||
189 | + border-bottom: 1rpx solid #D8D8D8; | ||
190 | +} | ||
191 | +.record_list:last-child{ | ||
192 | + border: none; | ||
193 | +} | ||
194 | +.zhengchang{ | ||
195 | + color: #56DCA5; | ||
196 | + display: none; | ||
197 | +} | ||
198 | + | ||
199 | +.chaoqing{ | ||
200 | + color: #78D2DF; | ||
201 | + display: none; | ||
202 | +} | ||
203 | +.chaozhong{ | ||
204 | + color: #AA6E6E; | ||
205 | +} | ||
206 | +.biaozhu{ | ||
207 | + font-size: 26rpx; | ||
208 | + color: #7DAA97; | ||
209 | + padding: 10rpx 73rpx; | ||
210 | +} | ||
211 | +image.zhizhen{ | ||
212 | + width: 14rpx; | ||
213 | + position: absolute; | ||
214 | + bottom: 0; | ||
215 | + z-index: 15; | ||
216 | + height: 193rpx; | ||
217 | + left: 50%; | ||
218 | + top: 50%; | ||
219 | + margin: -75rpx 0 0 -7rpx; | ||
220 | + transform-origin: bottom; | ||
221 | + -webkit-transform-origin: bottom; | ||
222 | + transform: rotate(0deg) ; | ||
223 | + transition: 1s; | ||
224 | +} | ||
225 | +.weight_type{ | ||
226 | + display: none; | ||
227 | +} | ||
228 | +.weight_type.active{ | ||
229 | + display: block; | ||
230 | +} | ||
231 | +.todayData{ | ||
232 | + text-align: center; | ||
233 | + color: #FFF; | ||
234 | + position: absolute; | ||
235 | + top: 140rpx; | ||
236 | + width: 100%; | ||
237 | + font-size: 30rpx; | ||
238 | +} | ||
239 | +.now_weight{ | ||
240 | + font-size: 64rpx; | ||
241 | + line-height: 64rpx; | ||
242 | + font-weight: bold; | ||
243 | +} | ||
244 | +.mask{ | ||
245 | + width: 100%; | ||
246 | + height: 100%; | ||
247 | + display: flex; | ||
248 | + position: fixed; | ||
249 | + top: 0; | ||
250 | + left: 0; | ||
251 | + background: rgba(0, 0, 0, .3); | ||
252 | + z-index: 20; | ||
253 | +} | ||
254 | +.tongyi_toast{ | ||
255 | + width: 560rpx; | ||
256 | + margin: 0 auto; | ||
257 | + margin-top: 423rpx; | ||
258 | + background: #FFF; | ||
259 | + border-radius: 10rpx; | ||
260 | + overflow: hidden; | ||
261 | + position: absolute; | ||
262 | + left: 50%; | ||
263 | + transform: translateX(-50%); | ||
264 | + padding-bottom: 100rpx; | ||
265 | + | ||
266 | +} | ||
267 | +.toast_container{ | ||
268 | + padding: 24rpx; | ||
269 | + font-size: 30rpx; | ||
270 | + text-align: center; | ||
271 | + color: #666; | ||
272 | + line-height: 52rpx; | ||
273 | +} | ||
274 | +.shengming{ | ||
275 | + text-align: center; | ||
276 | + margin-bottom: 10rpx; | ||
277 | +} | ||
278 | +.liaojie{ | ||
279 | + height: 100rpx; | ||
280 | + border-top: 1rpx #E5E5E5 solid; | ||
281 | + display: flex; | ||
282 | + align-items: center; | ||
283 | + justify-content: center; | ||
284 | + font-size: 36rpx; | ||
285 | + color: #02BB00; | ||
286 | + position: absolute; | ||
287 | + bottom: 0; | ||
288 | + left: 0; | ||
289 | + right: 0; | ||
290 | +} |
pages/xiyiDetail/xieyidetail.js
0 → 100644
1 | +// pages/xiyiDetail/xieyidetail.js | ||
2 | +let WxParse = require('../../wxParse/wxParse.js'); | ||
3 | +const app = getApp(); | ||
4 | +Page({ | ||
5 | + | ||
6 | + /** | ||
7 | + * 页面的初始数据 | ||
8 | + */ | ||
9 | + data: { | ||
10 | + contentHtml: '', | ||
11 | + xieyiTitle:'' | ||
12 | + }, | ||
13 | + accept(){ | ||
14 | + wx.navigateBack() | ||
15 | + }, | ||
16 | + //获取协议内容 | ||
17 | + getxieyi(){ | ||
18 | + let url = '/Article/getAgreement' | ||
19 | + let that = this; | ||
20 | + wx.showLoading({ | ||
21 | + title: '加载中', | ||
22 | + }) | ||
23 | + app.post(url,{}).then((res)=>{ | ||
24 | + wx.hideLoading() | ||
25 | + that.setData({ | ||
26 | + xieyiTitle: res.post_title | ||
27 | + }) | ||
28 | + WxParse.wxParse('contentHtml', 'html', res.post_content, that, 5); | ||
29 | + }) | ||
30 | + }, | ||
31 | + /** | ||
32 | + * 生命周期函数--监听页面加载 | ||
33 | + */ | ||
34 | + onLoad: function (options) { | ||
35 | + this.getxieyi() | ||
36 | + }, | ||
37 | + | ||
38 | + /** | ||
39 | + * 生命周期函数--监听页面初次渲染完成 | ||
40 | + */ | ||
41 | + onReady: function () { | ||
42 | + | ||
43 | + }, | ||
44 | + | ||
45 | + /** | ||
46 | + * 生命周期函数--监听页面显示 | ||
47 | + */ | ||
48 | + onShow: function () { | ||
49 | + | ||
50 | + }, | ||
51 | + | ||
52 | + /** | ||
53 | + * 生命周期函数--监听页面隐藏 | ||
54 | + */ | ||
55 | + onHide: function () { | ||
56 | + | ||
57 | + }, | ||
58 | + | ||
59 | + /** | ||
60 | + * 生命周期函数--监听页面卸载 | ||
61 | + */ | ||
62 | + onUnload: function () { | ||
63 | + | ||
64 | + }, | ||
65 | + | ||
66 | + /** | ||
67 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
68 | + */ | ||
69 | + onPullDownRefresh: function () { | ||
70 | + | ||
71 | + }, | ||
72 | + | ||
73 | + /** | ||
74 | + * 页面上拉触底事件的处理函数 | ||
75 | + */ | ||
76 | + onReachBottom: function () { | ||
77 | + | ||
78 | + }, | ||
79 | + | ||
80 | + /** | ||
81 | + * 用户点击右上角分享 | ||
82 | + */ | ||
83 | + onShareAppMessage: function () { | ||
84 | + | ||
85 | + } | ||
86 | +}) |
pages/xiyiDetail/xieyidetail.json
0 → 100644
pages/xiyiDetail/xieyidetail.wxml
0 → 100644
1 | +<!--pages/xiyiDetail/xieyidetail.wxml--> | ||
2 | +<view class='z_container'> | ||
3 | +<view class='xieyiTitle'>{{xieyiTitle}}</view> | ||
4 | + <view class='xieyi_detail'> | ||
5 | + <import src="/wxParse/wxParse.wxml"/> | ||
6 | + <template is="wxParse" data="{{wxParseData:contentHtml.nodes}}"/> | ||
7 | + </view> | ||
8 | + <view class='accept' bindtap='accept'>接受</view> | ||
9 | + | ||
10 | +</view> | ||
11 | + |
pages/xiyiDetail/xieyidetail.wxss
0 → 100644
1 | +/* pages/xiyiDetail/xieyidetail.wxss */ | ||
2 | + | ||
3 | +.xieyi_detail{ | ||
4 | + margin: 0 30rpx; | ||
5 | + min-height: 100rpx; | ||
6 | + font-size: 34rpx; | ||
7 | + color: #666; | ||
8 | + padding-top: 30rpx; | ||
9 | + padding: 0 30rpx; | ||
10 | +} | ||
11 | +.accept{ | ||
12 | + width: 670rpx; | ||
13 | + height: 94rpx; | ||
14 | + display: flex; | ||
15 | + align-items: center; | ||
16 | + justify-content: center; | ||
17 | + font-size: 36rpx; | ||
18 | + border-radius: 10rpx; | ||
19 | + background: #51DBA2; | ||
20 | + color: #FFF; | ||
21 | + margin: 0 auto; | ||
22 | + margin-bottom: 60rpx; | ||
23 | + margin-top: 67rpx; | ||
24 | +} | ||
25 | +.xieyiTitle{ | ||
26 | + display: flex; | ||
27 | + align-items: center; | ||
28 | + justify-content: center; | ||
29 | + height: 60rpx; | ||
30 | + margin-bottom: 50rpx; | ||
31 | + margin-top: 40rpx; | ||
32 | +} |
project.config.json
0 → 100644
1 | +{ | ||
2 | + "description": "项目配置文件。", | ||
3 | + "packOptions": { | ||
4 | + "ignore": [] | ||
5 | + }, | ||
6 | + "setting": { | ||
7 | + "urlCheck": false, | ||
8 | + "es6": true, | ||
9 | + "postcss": true, | ||
10 | + "minified": true, | ||
11 | + "newFeature": true | ||
12 | + }, | ||
13 | + "compileType": "miniprogram", | ||
14 | + "libVersion": "2.3.2", | ||
15 | + "appid": "wx75855734b0730d64", | ||
16 | + "projectname": "%E5%91%A8%E8%8E%89%E5%AD%95%E6%9C%9F%E4%BD%93%E9%87%8D%E7%AE%A1%E7%90%86", | ||
17 | + "isGameTourist": false, | ||
18 | + "condition": { | ||
19 | + "search": { | ||
20 | + "current": -1, | ||
21 | + "list": [] | ||
22 | + }, | ||
23 | + "conversation": { | ||
24 | + "current": -1, | ||
25 | + "list": [] | ||
26 | + }, | ||
27 | + "plugin": { | ||
28 | + "current": -1, | ||
29 | + "list": [] | ||
30 | + }, | ||
31 | + "game": { | ||
32 | + "currentL": -1, | ||
33 | + "list": [] | ||
34 | + }, | ||
35 | + "miniprogram": { | ||
36 | + "current": -1, | ||
37 | + "list": [] | ||
38 | + } | ||
39 | + } | ||
40 | +} |
utils/ald-stat-conf.js
0 → 100644
utils/ald-stat.js
0 → 100644
1 | +!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):n.Ald=t()}(this,function(){function n(n){this.app=n}function t(t){O=t,this.aldstat=new n(this),y("app","launch")}function o(n){if(O=n,C=n.query.ald_share_src,F=n.query.aldsrc||"",j=n.query.ald_share_src,U=Date.now(),A=Date.now(),!tn){I=""+Date.now()+Math.floor(1e7*Math.random()),E=!1;try{wx.setStorageSync("ald_ifo",!1)}catch(n){}}tn=!1,0!==b&&Date.now()-b>3e5&&(T=""+Date.now()+Math.floor(1e7*Math.random()),A=Date.now()),n.query.ald_share_src&&"1044"==n.scene&&n.shareTicket?wx.getShareInfo({shareTicket:n.shareTicket,success:function(n){G=n,_("event","ald_share_click",JSON.stringify(n))}}):n.query.ald_share_src&&_("event","ald_share_click",1),""===K&&wx.getSetting({withCredentials:!0,success:function(n){if(n.authSetting["scope.userInfo"]){wx.getUserInfo({withCredentials:!0,success:function(n){var t=p();K=n,t.ufo=w(n),q=g(n.userInfo.avatarUrl.split("/")),d(t)}})}}}),y("app","show")}function e(){b=Date.now(),""===K&&wx.getSetting({success:function(n){n.authSetting["scope.userInfo"]&&wx.getUserInfo({withCredentials:!0,success:function(n){K=n,q=g(n.userInfo.avatarUrl.split("/"));var t=p();t.ufo=w(n),d(t)}})}}),y("app","hide")}function a(n){J++,_("event","ald_error_message",n)}function r(n){X=n}function i(){z=this.route,Y=Date.now(),$=0,Z=0}function s(){S("page","hide"),Q=this.route}function c(){S("page","unload"),Q=this.route}function u(){$++}function l(){Z++}function f(n){var t=v(n.path),o={};for(var e in O.query)"ald_share_src"===e&&(o[e]=O.query[e]);var a="";if(a=n.path.indexOf("?")==-1?n.path+"?":n.path.substr(0,n.path.indexOf("?"))+"?",""!==t)for(var e in t)o[e]=t[e];o.ald_share_src?o.ald_share_src.indexOf(N)==-1&&o.ald_share_src.length<200&&(o.ald_share_src=o.ald_share_src+","+N):o.ald_share_src=N;for(var r in o)r.indexOf("ald")==-1&&(a+=r+"="+o[r]+"&");return n.path=a+"ald_share_src="+o.ald_share_src,_("event","ald_share_status",n),n}function h(){function n(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return n()+n()+n()+n()+n()+n()+n()+n()}function d(n){var t=n,o=0,e=0,a=function(r){e++,r?(n={},n.et=Date.now(),n.at=I,n.uu=N,n.v=P,n.ak=t.ak,n.life=t.life,n.ev=t.ev,n.err="err",n.status=o):(H++,n.at=I,n.et=Date.now(),n.uu=N,n.v=P,n.ak=M.app_key,n.wsr=O,n.oifo=E,n.rq_c=H),wx.request({url:"https://"+R+".aldwx.com/d.html",data:n,header:{AldStat:"MiniApp-Stat",waid:M.appid||"",wst:M.appsecret||"",se:L||"",op:k||"",img:q},method:"GET",success:function(n){o=n.statusCode,200!=n.statusCode&&e<=3&&a("errorsend")},fail:function(){e<=3&&a("errorsend")}})};a()}function p(){var n={};for(var t in V)n[t]=V[t];return n}function g(n){for(var t="",o=0;o<n.length;o++)n[o].length>t.length&&(t=n[o]);return t}function w(n){var t={};for(var o in n)"rawData"!=o&&"errMsg"!=o&&(t[o]=n[o]);return t}function v(n){if(n.indexOf("?")==-1)return"";var t={};return n.split("?")[1].split("&").forEach(function(n){var o=n.split("=")[1];t[n.split("=")[0]]=o}),t}function y(n,t){var o=p();o.ev=n,o.life=t,o.ec=J,o.st=B,F&&(o.qr=F,o.sr=F),C&&(o.usr=C),"launch"!==t&&(o.ahs=T),"hide"===t&&(o.hdr=Date.now()-A,o.dr=Date.now()-U,o.ifo=!!E),d(o)}function S(n,t){var o=p();o.ev=n,o.st=Date.now(),o.life=t,o.pp=z,o.pc=Q,o.dr=Date.now()-B,o.ndr=Date.now()-Y,o.rc=$,o.bc=Z,o.ahs=T,X&&"{}"!=JSON.stringify(X)&&(o.ag=X),F&&(o.qr=F,o.sr=F),C&&(o.usr=C),W||(nn=z,W=!0,o.ifp=W,o.fp=z),d(o)}function _(n,t,o){var e=p();e.ev=n,e.tp=t,e.st=B,o&&(e.ct=o),d(e)}function m(n,t,o){if(n[t]){var e=n[t];n[t]=function(n){o.call(this,n,t),e.call(this,n)}}else n[t]=function(n){o.call(this,n,t)}}function D(n){var r={};for(var i in n)"onLaunch"!==i&&"onShow"!==i&&"onHide"!==i&&"onError"!==i&&"onPageNotFound"!==i&&"onUnlaunch"!==i&&(r[i]=n[i]);r.onLaunch=function(o){t.call(this,o),"function"==typeof n.onLaunch&&n.onLaunch.call(this,o)},r.onShow=function(t){o.call(this,t),n.onShow&&"function"==typeof n.onShow&&n.onShow.call(this,t)},r.onHide=function(){e.call(this),n.onHide&&"function"==typeof n.onHide&&n.onHide.call(this)},r.onError=function(t){a.call(this,t),n.onError&&"function"==typeof n.onError&&n.onError.call(this,t)},r.onUnlaunch=function(){n.onUnlaunch&&"function"==typeof n.onUnlaunch&&n.onUnlaunch.call(this)},r.onPageNotFound=function(t){n.onPageNotFound&&"function"==typeof n.onPageNotFound&&n.onPageNotFound.call(this,t)},App(r)}function x(n){var t={};for(var o in n)"onLoad"!==o&&"onReady"!==o&&"onShow"!==o&&"onHide"!==o&&"onUnload"!==o&&"onPullDownRefresh"!==o&&"onReachBottom"!==o&&"onShareAppMessage"!==o&&"onPageScroll"!==o&&"onTabItemTap"!==o&&(t[o]=n[o]);t.onLoad=function(t){r.call(this,t),"function"==typeof n.onLoad&&n.onLoad.call(this,t)},t.onShow=function(t){i.call(this),"function"==typeof n.onShow&&n.onShow.call(this,t)},t.onHide=function(t){s.call(this),"function"==typeof n.onHide&&n.onHide.call(this,t)},t.onUnload=function(t){c.call(this),"function"==typeof n.onUnload&&n.onUnload.call(this,t)},t.onReady=function(t){n.onReady&&"function"==typeof n.onReady&&n.onReady.call(this,t)},t.onReachBottom=function(t){l(),n.onReachBottom&&"function"==typeof n.onReachBottom&&n.onReachBottom.call(this,t)},t.onPullDownRefresh=function(t){u(),n.onPullDownRefresh&&"function"==typeof n.onPullDownRefresh&&n.onPullDownRefresh.call(this,t)},t.onPageScroll=function(t){n.onPageScroll&&"function"==typeof n.onPageScroll&&n.onPageScroll.call(this,t)},t.onTabItemTap=function(t){n.onTabItemTap&&"function"==typeof n.onTabItemTap&&n.onTabItemTap.call(this,t)},n.onShareAppMessage&&"function"==typeof n.onShareAppMessage&&(t.onShareAppMessage=function(t){var o=n.onShareAppMessage.call(this,t);return void 0===o?(o={},o.path=this.route):void 0===o.path&&(o.path=this.route),f.call(this,o)}),Page(t)}var M=require("./ald-stat-conf"),P="7.0.0",R="log",I=""+Date.now()+Math.floor(1e7*Math.random()),T=""+Date.now()+Math.floor(1e7*Math.random()),A="",U=0,b=0,L="",k="",q="",H=0,O="",E="",N=function(){var n="";try{n=wx.getStorageSync("aldstat_uuid")}catch(t){n="uuid_getstoragesync"}if(n)E=!1;else{n=h(),E=!0;try{wx.setStorageSync("aldstat_uuid",n),wx.setStorageSync("ald_ifo",!0)}catch(n){wx.setStorageSync("aldstat_uuid","uuid_getstoragesync")}}return n}(),B=Date.now(),C="",F="",j="",J=0,G="",K="",V={},W=!1,z="",Q="",X="",Y="",Z=0,$=0,nn="",tn=!0;!function(){wx.request({url:"https://"+R+".aldwx.com/config/app.json",header:{AldStat:"MiniApp-Stat"},method:"GET",success:function(n){200===n.statusCode&&(n.data.version!=P&&console.warn("您的SDK不是最新版本,请尽快升级!"),n.data.warn&&console.warn(n.data.warn),n.data.error&&console.error(n.data.error))}})}();try{var on=wx.getSystemInfoSync();V.br=on.brand,V.pm=on.model,V.pr=on.pixelRatio,V.ww=on.windowWidth,V.wh=on.windowHeight,V.lang=on.language,V.wv=on.version,V.wvv=on.platform,V.wsdk=on.SDKVersion,V.sv=on.system}catch(n){}wx.getNetworkType({success:function(n){V.nt=n.networkType}}),wx.getSetting({success:function(n){n.authSetting["scope.userLocation"]?wx.getLocation({type:"wgs84",success:function(n){V.lat=n.latitude,V.lng=n.longitude,V.spd=n.speed}}):M.getLocation&&wx.getLocation({type:"wgs84",success:function(n){V.lat=n.latitude,V.lng=n.longitude,V.spd=n.speed}})}}),n.prototype.debug=function(n){_("debug","0",n)},n.prototype.warn=function(n){_("warn","1",n)},n.prototype.sendEvent=function(n,t){if(""!==n&&"string"==typeof n&&n.length<=255)if("string"==typeof t&&t.length<=255)_("event",n,t);else if("object"==typeof t){if(JSON.stringify(t).length>=255)return void console.error("自定义事件参数不能超过255个字符");_("event",n,JSON.stringify(t))}else void 0===t?_("event",n,!1):console.error("事件参数必须为String,Object类型,且参数长度不能超过255个字符");else console.error("事件名称必须为String类型且不能超过255个字符")},n.prototype.sendSession=function(n){if(""===n||!n)return void console.error("请传入从后台获取的session_key");if(""===M.appid||""===M.appsecret)return void console.error("请在配置文件中填写小程序的appid和appsecret!");L=n;var t=p();t.st=Date.now(),t.tp="session",t.ct="session",t.ev="event",""===K?wx.getSetting({success:function(n){n.authSetting["scope.userInfo"]?wx.getUserInfo({success:function(n){t.ufo=w(n),q=g(n.userInfo.avatarUrl.split("/")),""!==G&&(t.gid=G),d(t)}}):""!==G?(t.gid=G,d(t)):console.warn("用户未授权")}}):(t.ufo=K,""!==G&&(t.gid=G),d(t))},n.prototype.sendOpenid=function(n){if(""===n||!n)return void console.error("openID不能为空");k=n;var t=p();t.st=Date.now(),t.tp="openid",t.ev="event",t.ct="openid",d(t)};return M.plugin?{App:D,Page:x}:function(n){!function(){var n=App,h=Page;App=function(r){m(r,"onLaunch",t),m(r,"onShow",o),m(r,"onHide",e),m(r,"onError",a),n(r)},Page=function(n){var t=n.onShareAppMessage;m(n,"onLoad",r),m(n,"onUnload",c),m(n,"onShow",i),m(n,"onHide",s),m(n,"onReachBottom",l),m(n,"onPullDownRefresh",u),void 0!==t&&null!==t&&(n.onShareAppMessage=function(n){if(void 0!==t){var o=t.call(this,n);return void 0===o?(o={},o.path=this.route):void 0===o.path&&(o.path=this.route),f(o)}}),h(n)}}()}()}); |
utils/util.js
0 → 100644
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 | +} |
wxParse/html2json.js
0 → 100644
1 | +/** | ||
2 | + * html2Json 改造来自: https://github.com/Jxck/html2json | ||
3 | + * | ||
4 | + * | ||
5 | + * author: Di (微信小程序开发工程师) | ||
6 | + * organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com) | ||
7 | + * 垂直微信小程序开发交流社区 | ||
8 | + * | ||
9 | + * github地址: https://github.com/icindy/wxParse | ||
10 | + * | ||
11 | + * for: 微信小程序富文本解析 | ||
12 | + * detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184 | ||
13 | + */ | ||
14 | + | ||
15 | +var __placeImgeUrlHttps = "https"; | ||
16 | +var __emojisReg = ''; | ||
17 | +var __emojisBaseSrc = ''; | ||
18 | +var __emojis = {}; | ||
19 | +var wxDiscode = require('./wxDiscode.js'); | ||
20 | +var HTMLParser = require('./htmlparser.js'); | ||
21 | +// Empty Elements - HTML 5 | ||
22 | +var empty = makeMap("area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr"); | ||
23 | +// Block Elements - HTML 5 | ||
24 | +var block = makeMap("br,a,code,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video"); | ||
25 | + | ||
26 | +// Inline Elements - HTML 5 | ||
27 | +var inline = makeMap("abbr,acronym,applet,b,basefont,bdo,big,button,cite,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var"); | ||
28 | + | ||
29 | +// Elements that you can, intentionally, leave open | ||
30 | +// (and which close themselves) | ||
31 | +var closeSelf = makeMap("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr"); | ||
32 | + | ||
33 | +// Attributes that have their values filled in disabled="disabled" | ||
34 | +var fillAttrs = makeMap("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"); | ||
35 | + | ||
36 | +// Special Elements (can contain anything) | ||
37 | +var special = makeMap("wxxxcode-style,script,style,view,scroll-view,block"); | ||
38 | +function makeMap(str) { | ||
39 | + var obj = {}, items = str.split(","); | ||
40 | + for (var i = 0; i < items.length; i++) | ||
41 | + obj[items[i]] = true; | ||
42 | + return obj; | ||
43 | +} | ||
44 | + | ||
45 | +function q(v) { | ||
46 | + return '"' + v + '"'; | ||
47 | +} | ||
48 | + | ||
49 | +function removeDOCTYPE(html) { | ||
50 | + return html | ||
51 | + .replace(/<\?xml.*\?>\n/, '') | ||
52 | + .replace(/<.*!doctype.*\>\n/, '') | ||
53 | + .replace(/<.*!DOCTYPE.*\>\n/, ''); | ||
54 | +} | ||
55 | + | ||
56 | +function trimHtml(html) { | ||
57 | + return html | ||
58 | + .replace(/\r?\n+/g, '') | ||
59 | + .replace(/<!--.*?-->/ig, '') | ||
60 | + .replace(/\/\*.*?\*\//ig, '') | ||
61 | + .replace(/[ ]+</ig, '<') | ||
62 | +} | ||
63 | + | ||
64 | + | ||
65 | +function html2json(html, bindName) { | ||
66 | + //处理字符串 | ||
67 | + html = removeDOCTYPE(html); | ||
68 | + html = trimHtml(html); | ||
69 | + html = wxDiscode.strDiscode(html); | ||
70 | + //生成node节点 | ||
71 | + var bufArray = []; | ||
72 | + var results = { | ||
73 | + node: bindName, | ||
74 | + nodes: [], | ||
75 | + images:[], | ||
76 | + imageUrls:[] | ||
77 | + }; | ||
78 | + var index = 0; | ||
79 | + HTMLParser(html, { | ||
80 | + start: function (tag, attrs, unary) { | ||
81 | + //debug(tag, attrs, unary); | ||
82 | + // node for this element | ||
83 | + var node = { | ||
84 | + node: 'element', | ||
85 | + tag: tag, | ||
86 | + }; | ||
87 | + | ||
88 | + if (bufArray.length === 0) { | ||
89 | + node.index = index.toString() | ||
90 | + index += 1 | ||
91 | + } else { | ||
92 | + var parent = bufArray[0]; | ||
93 | + if (parent.nodes === undefined) { | ||
94 | + parent.nodes = []; | ||
95 | + } | ||
96 | + node.index = parent.index + '.' + parent.nodes.length | ||
97 | + } | ||
98 | + | ||
99 | + if (block[tag]) { | ||
100 | + node.tagType = "block"; | ||
101 | + } else if (inline[tag]) { | ||
102 | + node.tagType = "inline"; | ||
103 | + } else if (closeSelf[tag]) { | ||
104 | + node.tagType = "closeSelf"; | ||
105 | + } | ||
106 | + | ||
107 | + if (attrs.length !== 0) { | ||
108 | + node.attr = attrs.reduce(function (pre, attr) { | ||
109 | + var name = attr.name; | ||
110 | + var value = attr.value; | ||
111 | + if (name == 'class') { | ||
112 | + console.dir(value); | ||
113 | + // value = value.join("") | ||
114 | + node.classStr = value; | ||
115 | + } | ||
116 | + // has multi attibutes | ||
117 | + // make it array of attribute | ||
118 | + if (name == 'style') { | ||
119 | + console.dir(value); | ||
120 | + // value = value.join("") | ||
121 | + node.styleStr = value; | ||
122 | + } | ||
123 | + if (value.match(/ /)) { | ||
124 | + value = value.split(' '); | ||
125 | + } | ||
126 | + | ||
127 | + | ||
128 | + // if attr already exists | ||
129 | + // merge it | ||
130 | + if (pre[name]) { | ||
131 | + if (Array.isArray(pre[name])) { | ||
132 | + // already array, push to last | ||
133 | + pre[name].push(value); | ||
134 | + } else { | ||
135 | + // single value, make it array | ||
136 | + pre[name] = [pre[name], value]; | ||
137 | + } | ||
138 | + } else { | ||
139 | + // not exist, put it | ||
140 | + pre[name] = value; | ||
141 | + } | ||
142 | + | ||
143 | + return pre; | ||
144 | + }, {}); | ||
145 | + } | ||
146 | + | ||
147 | + //对img添加额外数据 | ||
148 | + if (node.tag === 'img') { | ||
149 | + node.imgIndex = results.images.length; | ||
150 | + var imgUrl = node.attr.src; | ||
151 | + if (imgUrl[0] == '') { | ||
152 | + imgUrl.splice(0, 1); | ||
153 | + } | ||
154 | + imgUrl = wxDiscode.urlToHttpUrl(imgUrl, __placeImgeUrlHttps); | ||
155 | + node.attr.src = imgUrl; | ||
156 | + node.from = bindName; | ||
157 | + results.images.push(node); | ||
158 | + results.imageUrls.push(imgUrl); | ||
159 | + } | ||
160 | + | ||
161 | + // 处理font标签样式属性 | ||
162 | + if (node.tag === 'font') { | ||
163 | + var fontSize = ['x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', '-webkit-xxx-large']; | ||
164 | + var styleAttrs = { | ||
165 | + 'color': 'color', | ||
166 | + 'face': 'font-family', | ||
167 | + 'size': 'font-size' | ||
168 | + }; | ||
169 | + if (!node.attr.style) node.attr.style = []; | ||
170 | + if (!node.styleStr) node.styleStr = ''; | ||
171 | + for (var key in styleAttrs) { | ||
172 | + if (node.attr[key]) { | ||
173 | + var value = key === 'size' ? fontSize[node.attr[key]-1] : node.attr[key]; | ||
174 | + node.attr.style.push(styleAttrs[key]); | ||
175 | + node.attr.style.push(value); | ||
176 | + node.styleStr += styleAttrs[key] + ': ' + value + ';'; | ||
177 | + } | ||
178 | + } | ||
179 | + } | ||
180 | + | ||
181 | + //临时记录source资源 | ||
182 | + if(node.tag === 'source'){ | ||
183 | + results.source = node.attr.src; | ||
184 | + } | ||
185 | + | ||
186 | + if (unary) { | ||
187 | + // if this tag doesn't have end tag | ||
188 | + // like <img src="hoge.png"/> | ||
189 | + // add to parents | ||
190 | + var parent = bufArray[0] || results; | ||
191 | + if (parent.nodes === undefined) { | ||
192 | + parent.nodes = []; | ||
193 | + } | ||
194 | + parent.nodes.push(node); | ||
195 | + } else { | ||
196 | + bufArray.unshift(node); | ||
197 | + } | ||
198 | + }, | ||
199 | + end: function (tag) { | ||
200 | + //debug(tag); | ||
201 | + // merge into parent tag | ||
202 | + var node = bufArray.shift(); | ||
203 | + if (node.tag !== tag) console.error('invalid state: mismatch end tag'); | ||
204 | + | ||
205 | + //当有缓存source资源时于于video补上src资源 | ||
206 | + if(node.tag === 'video' && results.source){ | ||
207 | + node.attr.src = results.source; | ||
208 | + delete results.source; | ||
209 | + } | ||
210 | + | ||
211 | + if (bufArray.length === 0) { | ||
212 | + results.nodes.push(node); | ||
213 | + } else { | ||
214 | + var parent = bufArray[0]; | ||
215 | + if (parent.nodes === undefined) { | ||
216 | + parent.nodes = []; | ||
217 | + } | ||
218 | + parent.nodes.push(node); | ||
219 | + } | ||
220 | + }, | ||
221 | + chars: function (text) { | ||
222 | + //debug(text); | ||
223 | + var node = { | ||
224 | + node: 'text', | ||
225 | + text: text, | ||
226 | + textArray:transEmojiStr(text) | ||
227 | + }; | ||
228 | + | ||
229 | + if (bufArray.length === 0) { | ||
230 | + node.index = index.toString() | ||
231 | + index += 1 | ||
232 | + results.nodes.push(node); | ||
233 | + } else { | ||
234 | + var parent = bufArray[0]; | ||
235 | + if (parent.nodes === undefined) { | ||
236 | + parent.nodes = []; | ||
237 | + } | ||
238 | + node.index = parent.index + '.' + parent.nodes.length | ||
239 | + parent.nodes.push(node); | ||
240 | + } | ||
241 | + }, | ||
242 | + comment: function (text) { | ||
243 | + //debug(text); | ||
244 | + // var node = { | ||
245 | + // node: 'comment', | ||
246 | + // text: text, | ||
247 | + // }; | ||
248 | + // var parent = bufArray[0]; | ||
249 | + // if (parent.nodes === undefined) { | ||
250 | + // parent.nodes = []; | ||
251 | + // } | ||
252 | + // parent.nodes.push(node); | ||
253 | + }, | ||
254 | + }); | ||
255 | + return results; | ||
256 | +}; | ||
257 | + | ||
258 | +function transEmojiStr(str){ | ||
259 | + // var eReg = new RegExp("["+__reg+' '+"]"); | ||
260 | +// str = str.replace(/\[([^\[\]]+)\]/g,':$1:') | ||
261 | + | ||
262 | + var emojiObjs = []; | ||
263 | + //如果正则表达式为空 | ||
264 | + if(__emojisReg.length == 0 || !__emojis){ | ||
265 | + var emojiObj = {} | ||
266 | + emojiObj.node = "text"; | ||
267 | + emojiObj.text = str; | ||
268 | + array = [emojiObj]; | ||
269 | + return array; | ||
270 | + } | ||
271 | + //这个地方需要调整 | ||
272 | + str = str.replace(/\[([^\[\]]+)\]/g,':$1:') | ||
273 | + var eReg = new RegExp("[:]"); | ||
274 | + var array = str.split(eReg); | ||
275 | + for(var i = 0; i < array.length; i++){ | ||
276 | + var ele = array[i]; | ||
277 | + var emojiObj = {}; | ||
278 | + if(__emojis[ele]){ | ||
279 | + emojiObj.node = "element"; | ||
280 | + emojiObj.tag = "emoji"; | ||
281 | + emojiObj.text = __emojis[ele]; | ||
282 | + emojiObj.baseSrc= __emojisBaseSrc; | ||
283 | + }else{ | ||
284 | + emojiObj.node = "text"; | ||
285 | + emojiObj.text = ele; | ||
286 | + } | ||
287 | + emojiObjs.push(emojiObj); | ||
288 | + } | ||
289 | + | ||
290 | + return emojiObjs; | ||
291 | +} | ||
292 | + | ||
293 | +function emojisInit(reg='',baseSrc="/wxParse/emojis/",emojis){ | ||
294 | + __emojisReg = reg; | ||
295 | + __emojisBaseSrc=baseSrc; | ||
296 | + __emojis=emojis; | ||
297 | +} | ||
298 | + | ||
299 | +module.exports = { | ||
300 | + html2json: html2json, | ||
301 | + emojisInit:emojisInit | ||
302 | +}; | ||
303 | + |
wxParse/htmlparser.js
0 → 100644
1 | +/** | ||
2 | + * | ||
3 | + * htmlParser改造自: https://github.com/blowsie/Pure-JavaScript-HTML5-Parser | ||
4 | + * | ||
5 | + * author: Di (微信小程序开发工程师) | ||
6 | + * organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com) | ||
7 | + * 垂直微信小程序开发交流社区 | ||
8 | + * | ||
9 | + * github地址: https://github.com/icindy/wxParse | ||
10 | + * | ||
11 | + * for: 微信小程序富文本解析 | ||
12 | + * detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184 | ||
13 | + */ | ||
14 | +// Regular Expressions for parsing tags and attributes | ||
15 | +var startTag = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/, | ||
16 | + endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/, | ||
17 | + attr = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g; | ||
18 | + | ||
19 | +// Empty Elements - HTML 5 | ||
20 | +var empty = makeMap("area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr"); | ||
21 | + | ||
22 | +// Block Elements - HTML 5 | ||
23 | +var block = makeMap("a,address,code,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video"); | ||
24 | + | ||
25 | +// Inline Elements - HTML 5 | ||
26 | +var inline = makeMap("abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var"); | ||
27 | + | ||
28 | +// Elements that you can, intentionally, leave open | ||
29 | +// (and which close themselves) | ||
30 | +var closeSelf = makeMap("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr"); | ||
31 | + | ||
32 | +// Attributes that have their values filled in disabled="disabled" | ||
33 | +var fillAttrs = makeMap("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"); | ||
34 | + | ||
35 | +// Special Elements (can contain anything) | ||
36 | +var special = makeMap("wxxxcode-style,script,style,view,scroll-view,block"); | ||
37 | + | ||
38 | +function HTMLParser(html, handler) { | ||
39 | + var index, chars, match, stack = [], last = html; | ||
40 | + stack.last = function () { | ||
41 | + return this[this.length - 1]; | ||
42 | + }; | ||
43 | + | ||
44 | + while (html) { | ||
45 | + chars = true; | ||
46 | + | ||
47 | + // Make sure we're not in a script or style element | ||
48 | + if (!stack.last() || !special[stack.last()]) { | ||
49 | + | ||
50 | + // Comment | ||
51 | + if (html.indexOf("<!--") == 0) { | ||
52 | + index = html.indexOf("-->"); | ||
53 | + | ||
54 | + if (index >= 0) { | ||
55 | + if (handler.comment) | ||
56 | + handler.comment(html.substring(4, index)); | ||
57 | + html = html.substring(index + 3); | ||
58 | + chars = false; | ||
59 | + } | ||
60 | + | ||
61 | + // end tag | ||
62 | + } else if (html.indexOf("</") == 0) { | ||
63 | + match = html.match(endTag); | ||
64 | + | ||
65 | + if (match) { | ||
66 | + html = html.substring(match[0].length); | ||
67 | + match[0].replace(endTag, parseEndTag); | ||
68 | + chars = false; | ||
69 | + } | ||
70 | + | ||
71 | + // start tag | ||
72 | + } else if (html.indexOf("<") == 0) { | ||
73 | + match = html.match(startTag); | ||
74 | + | ||
75 | + if (match) { | ||
76 | + html = html.substring(match[0].length); | ||
77 | + match[0].replace(startTag, parseStartTag); | ||
78 | + chars = false; | ||
79 | + } | ||
80 | + } | ||
81 | + | ||
82 | + if (chars) { | ||
83 | + index = html.indexOf("<"); | ||
84 | + var text = '' | ||
85 | + while (index === 0) { | ||
86 | + text += "<"; | ||
87 | + html = html.substring(1); | ||
88 | + index = html.indexOf("<"); | ||
89 | + } | ||
90 | + text += index < 0 ? html : html.substring(0, index); | ||
91 | + html = index < 0 ? "" : html.substring(index); | ||
92 | + | ||
93 | + if (handler.chars) | ||
94 | + handler.chars(text); | ||
95 | + } | ||
96 | + | ||
97 | + } else { | ||
98 | + | ||
99 | + html = html.replace(new RegExp("([\\s\\S]*?)<\/" + stack.last() + "[^>]*>"), function (all, text) { | ||
100 | + text = text.replace(/<!--([\s\S]*?)-->|<!\[CDATA\[([\s\S]*?)]]>/g, "$1$2"); | ||
101 | + if (handler.chars) | ||
102 | + handler.chars(text); | ||
103 | + | ||
104 | + return ""; | ||
105 | + }); | ||
106 | + | ||
107 | + | ||
108 | + parseEndTag("", stack.last()); | ||
109 | + } | ||
110 | + | ||
111 | + if (html == last) | ||
112 | + throw "Parse Error: " + html; | ||
113 | + last = html; | ||
114 | + } | ||
115 | + | ||
116 | + // Clean up any remaining tags | ||
117 | + parseEndTag(); | ||
118 | + | ||
119 | + function parseStartTag(tag, tagName, rest, unary) { | ||
120 | + tagName = tagName.toLowerCase(); | ||
121 | + | ||
122 | + if (block[tagName]) { | ||
123 | + while (stack.last() && inline[stack.last()]) { | ||
124 | + parseEndTag("", stack.last()); | ||
125 | + } | ||
126 | + } | ||
127 | + | ||
128 | + if (closeSelf[tagName] && stack.last() == tagName) { | ||
129 | + parseEndTag("", tagName); | ||
130 | + } | ||
131 | + | ||
132 | + unary = empty[tagName] || !!unary; | ||
133 | + | ||
134 | + if (!unary) | ||
135 | + stack.push(tagName); | ||
136 | + | ||
137 | + if (handler.start) { | ||
138 | + var attrs = []; | ||
139 | + | ||
140 | + rest.replace(attr, function (match, name) { | ||
141 | + var value = arguments[2] ? arguments[2] : | ||
142 | + arguments[3] ? arguments[3] : | ||
143 | + arguments[4] ? arguments[4] : | ||
144 | + fillAttrs[name] ? name : ""; | ||
145 | + | ||
146 | + attrs.push({ | ||
147 | + name: name, | ||
148 | + value: value, | ||
149 | + escaped: value.replace(/(^|[^\\])"/g, '$1\\\"') //" | ||
150 | + }); | ||
151 | + }); | ||
152 | + | ||
153 | + if (handler.start) { | ||
154 | + handler.start(tagName, attrs, unary); | ||
155 | + } | ||
156 | + | ||
157 | + } | ||
158 | + } | ||
159 | + | ||
160 | + function parseEndTag(tag, tagName) { | ||
161 | + // If no tag name is provided, clean shop | ||
162 | + if (!tagName) | ||
163 | + var pos = 0; | ||
164 | + | ||
165 | + // Find the closest opened tag of the same type | ||
166 | + else { | ||
167 | + tagName = tagName.toLowerCase(); | ||
168 | + for (var pos = stack.length - 1; pos >= 0; pos--) | ||
169 | + if (stack[pos] == tagName) | ||
170 | + break; | ||
171 | + } | ||
172 | + if (pos >= 0) { | ||
173 | + // Close all the open elements, up the stack | ||
174 | + for (var i = stack.length - 1; i >= pos; i--) | ||
175 | + if (handler.end) | ||
176 | + handler.end(stack[i]); | ||
177 | + | ||
178 | + // Remove the open elements from the stack | ||
179 | + stack.length = pos; | ||
180 | + } | ||
181 | + } | ||
182 | +}; | ||
183 | + | ||
184 | + | ||
185 | +function makeMap(str) { | ||
186 | + var obj = {}, items = str.split(","); | ||
187 | + for (var i = 0; i < items.length; i++) | ||
188 | + obj[items[i]] = true; | ||
189 | + return obj; | ||
190 | +} | ||
191 | + | ||
192 | +module.exports = HTMLParser; |
-
请 注册 或 登录 后发表评论