my_report.html
15.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
<script src="../../assets/js/fontsize.js"></script>
<link rel="stylesheet" href="../../assets/css/weui.min.css">
<link rel="stylesheet" href="../../assets/css/style.css">
<link rel="stylesheet" href="../../assets/css/api.css"/>
<link rel="stylesheet" href="../../assets/css/my_f.css"/>
<link rel="stylesheet" href="../../assets/icon/iconfont.css">
<title></title>
<style>
.report_item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.2rem;
font-size: 16px;
color: #424242;
border-bottom: 1px solid #f4f4f4;
margin: 0 0.35rem
}
.report_item_right {
color: #a09f9f;
font-size: 14px;
display: flex;
align-items: center;
}
.report_item_right .iconfont {
margin-left: 0.15rem;
}
.text {
justify-content: inherit;
height: 1.55rem;
align-items: inherit;
color: #424242;
border: 1px solid #f4f4f4;
border-radius: 0.1rem;
}
.text_box {
padding: 0.25rem 0;
border-bottom: 5px solid #f4f4f4
}
.text .iconfont {
margin-right: 0.2rem;
color: #d5d5d3;
}
.text textarea {
width: 100%;
height: 100%;
line-height: 0.4rem;
}
.text textarea::-webkit-input-placeholder {
color: #d5d5d3;
}
.photo_box {
display: flex;
align-items: center;
justify-content: space-around;
padding: 0.5rem 0.2rem;
}
.photo_item {
display: flex;
align-items: center;
justify-content: center;
border-radius: 0.16rem;
border: 1px solid #ebebeb;
width: 2rem;
height: 2rem;
overflow: hidden;
}
.photo_item .iconfont {
font-size: 25px;
color: #ccc;
}
.photo_item img {
width: 100%;
}
</style>
</head>
<body>
<!--<div id="loadStart"></div>-->
<div id="app" v-cloak>
<div class="report_item" @click="broSelect">
<span>{{date_type}}</span>
<div class="report_item_right"><span>{{broth_info?broth_info:default_bro}}</span><span
class="iconfont icon-xiangyou"></span></div>
</div>
<div class="report_item" @click="choose_item">
<span>{{type_name}}</span>
<div class="report_item_right"><span>{{choose_type_name}}</span><span class="iconfont icon-xiangyou"></span>
</div>
</div>
<div class="report_item" style="border-bottom: 5px solid #f4f4f4" @click="choose_home">
<span>{{type_home}}</span>
<div class="report_item_right"><span>{{choose_homes}}</span><span class="iconfont icon-xiangyou"></span>
</div>
</div>
<div class="report_item">
<span>具体描述</span>
</div>
<div class="text_box">
<div class="report_item text">
<span class="iconfont icon-tianxie"></span>
<textarea placeholder="请您详细描述客观情况,以便更好为您提供分析解读服务。(最多支持输入200字)" maxlength="200" v-model="content"></textarea>
</div>
</div>
<div class="report_item" @click="popupVisible=true">
<span>上传照片或扫描报告</span>
</div>
<div class="photo_box">
<div class="photo_item" @click="popupVisible=true">
<img v-if='img_report' :src="img_report" alt="">
<span v-else class="iconfont icon-jiajianzujianjiahao"></span>
</div>
<div class="photo_item" @click="openQrc">
<img v-if='img_sao_yi_sao' :src="img_sao_yi_sao" alt="">
<span v-else class="iconfont icon-saoyisao"></span>
</div>
</div>
<mt-popup v-model="popupVisible" position="bottom">
<ul class="moreoul">
<li @click="choose_pic('camera')">拍照</li>
<li @click="choose_pic('album')">从相册中选择</li>
<li @click="popupVisible=false" style="border-top: 2px solid #f0f0f0">取消</li>
</ul>
</mt-popup>
<div class="save_btn" @click="save_info">保存</div>
</div>
</body>
</html>
<script type="text/javascript" src="../../assets/js/api.js"></script>
<script type="text/javascript" src="../../assets/js/fastclick.js"></script>
<script>
new FastClick(document.body);
</script>
<script type="text/javascript" src="../../assets/js/vue.min.js"></script>
<script type="text/javascript" src="../../assets/js/index.js"></script>
<script type="text/javascript" src="../../assets/js/weui.min.js"></script>
<script type="text/javascript" src="../../assets/js/public.js"></script>
<script type="text/javascript" src="../../assets/js/axios.min.js"></script>
<script type="text/javascript" src="../../assets/icon/iconfont.js"></script>
<script>
var app = new Vue({
el: '#app',
data: {
bro_year: '',
bro_month: '',
bro_day: '',
broth_info: '',
default_bro: '日期',
date_type: '',
type_name: '',
type_home: '',
type_id: '',
choose_type_name: '名称',
choose_homes: '机构名称',
popupVisible: false,
img_report: '',
img_sao_yi_sao: '',
Illness_list: [],
org_list: [],
content: '',
rid: '',
code: ''
},
created: function () {
apiready = function () {
app.rid = api.pageParam.rid;
app.date_type = api.pageParam.date_type;
app.type_name = api.pageParam.type_name;
app.type_home = api.pageParam.type_home;
app.type_id = api.pageParam.type_id;
app.getOrg();
switch (app.type_id) {
case 1:
app.getIllness();
break;
case 2:
app.getPExam();
break;
case 3:
app.getCheckReport();
break;
default:
return false;
}
}
},
methods: {
// 选择日期
broSelect: function () {
api.openPicker({
type: 'date',
title: '选择日期'
}, function (ret, err) {
if (ret) {
app.bro_year = ret.year;
app.bro_month = ret.month;
app.bro_day = ret.day;
app.broth_info = app.bro_year + '-' + add0(app.bro_month) + '-' + add0(app.bro_day);
if (checkDate(app.broth_info, 2)) {
return app.broth_info
} else {
toastMsg('日期不能比今天晚');
return app.broth_info = app.default_bro
}
} else {
console.log(JSON.stringify(err));
}
});
},
// 上传照片
choose_pic: function (type) {
app.popupVisible = false;
api.getPicture({
sourceType: type,
encodingType: 'jpg',
mediaValue: 'pic',
destinationType: 'url',
allowEdit: true,
quality: 50,
targetWidth: 300,
targetHeight: 400,
saveToPhotoAlbum: true
}, function (ret, err) {
// alert(JSON.stringify(ret));
if (ret && ret.data && ret.data !== "") {
api.ajax({
url: baseurl + 'user/index/addReportPic',
method: 'post',
data: {
values: {
r_type: app.type_id
},
files: {
file: ret.data
}
},
headers: {
"XX-Device-Type": getDevice(),
'XX-Token': getToken()
}
}, function (res, erro) {
if (res.code == 1) {
app.img_report = res.data.url;
// alert(JSON.stringify(app.img_report));
} else {
toastMsg(res.msg);
}
});
}
});
},
// 获取疾病类型
getIllness: function () {
var heder = {
"XX-Device-Type": getDevice(),
'XX-Token': getToken()
};
getRequest('post', 'user/index/getIllness', null, heder).then(function (res) {
if (res.data.code == 1) {
for (var i in res.data.data) {
app.Illness_list.push({
value: res.data.data[i].id,
label: res.data.data[i].name
})
}
loadEnd()
}
})
},
// 获取体检名称
getPExam: function () {
var heder = {
"XX-Device-Type": getDevice(),
'XX-Token': getToken()
};
getRequest('post', 'user/index/getPExam', null, heder).then(function (res) {
if (res.data.code == 1) {
for (var i in res.data.data) {
app.Illness_list.push({
value: res.data.data[i].id,
label: res.data.data[i].name
})
}
loadEnd()
}
})
},
// 获取
getCheckReport: function () {
var header = {
"XX-Device-Type": getDevice(),
'XX-Token': getToken()
};
getRequest('post', 'user/index/getCheckReport', null, header).then(function (res) {
if (res.data.code == 1) {
for (var i in res.data.data) {
app.Illness_list.push({
value: res.data.data[i].id,
label: res.data.data[i].name
})
}
loadEnd()
}
})
},
// 获取机构名称
getOrg: function () {
var heder = {
"XX-Device-Type": getDevice(),
'XX-Token': getToken()
};
getRequest('post', 'user/index/getOrg', null, heder).then(function (res) {
if (res.data.code == 1) {
for (var i in res.data.data) {
app.org_list.push({
value: res.data.data[i].id,
label: res.data.data[i].name
})
}
loadEnd()
}
})
},
// 选择类别
choose_item: function () {
weui.picker(app.Illness_list, {
onChange: function (result) {
},
onConfirm: function (result) {
app.choose_type_name = result[0].label
}
})
},
// 选择机构名称
choose_home: function () {
weui.picker(app.org_list, {
onChange: function (result) {
},
onConfirm: function (result) {
app.choose_homes = result[0].label
}
})
},
// 打开二维码
openQrc: function () {
var FNScanner = api.require('FNScanner');
FNScanner.open({
autorotation: true
}, function (ret, err) {
if (ret) {
FNScanner.openScanner({
autorotation: true
}, function (ret, err) {
if (ret) {
// alert(JSON.stringify(ret))
app.code = ret.content;
// alert(JSON.stringify(app.img_report));
// toastMsg('扫码成功')
} else {
// alert(JSON.stringify(ret))
}
});
} else {
}
});
},
// 保存报告
save_info: function () {
var header = {
"XX-Device-Type": getDevice(),
'XX-Token': getToken()
};
var post = {
rid: app.rid,
checktime: Date.parse(app.broth_info),
name: app.choose_type_name,
org: app.choose_homes,
descript: app.content,
pic: app.img_report,
r_type: app.type_id,
code: app.code
};
if (app.broth_info == '') {
toastMsg('请选择日期')
} else if (app.choose_type_name == '名称') {
toastMsg('请选择类别')
} else if (app.choose_homes == '机构名称') {
toastMsg('请选择机构名称')
} else if (app.content == '') {
toastMsg('请输入描述')
} else if (app.img_report == '' && app.code == '') {
toastMsg('请上传报告照片')
}
else {
getRequest('post', 'user/index/addReport', post, header).then(function (res) {
// alert(JSON.stringify(res))
if (res.data.code == 1) {
toastMsg('添加成功');
api.sendEvent({
name:'add_success'
});
setTimeout(function() {
api.closeWin()
}, 1000)
} else {
toastMsg(res.msg)
}
})
}
}
}
})
</script>