正在显示
3 个修改的文件
包含
118 行增加
和
20 行删除
@@ -23,9 +23,10 @@ var app = new Vue({ | @@ -23,9 +23,10 @@ var app = new Vue({ | ||
23 | }, | 23 | }, |
24 | created: function () { | 24 | created: function () { |
25 | // apiready = function () { | 25 | // apiready = function () { |
26 | - // app.broth_info=$("#date2").val(); | ||
27 | - console.log(this.broth_info) | ||
28 | - this.broth_info=localStorage.getItem("birth") | 26 | + // app.broth_info=$ ("#date2").val(); |
27 | + | ||
28 | + this.broth_info=localStorage.getItem("birth"); | ||
29 | + console.log(this.broth_info); | ||
29 | // this.rid = api.pageParam.rid; | 30 | // this.rid = api.pageParam.rid; |
30 | // this.date_type = api.pageParam.date_type; | 31 | // this.date_type = api.pageParam.date_type; |
31 | // this.type_name = api.pageParam.type_name; | 32 | // this.type_name = api.pageParam.type_name; |
@@ -122,7 +123,6 @@ var app = new Vue({ | @@ -122,7 +123,6 @@ var app = new Vue({ | ||
122 | }, | 123 | }, |
123 | // 获取疾病类型 | 124 | // 获取疾病类型 |
124 | getIllness: function () { | 125 | getIllness: function () { |
125 | - | ||
126 | var app=this; | 126 | var app=this; |
127 | var heder = { | 127 | var heder = { |
128 | "XX-Device-Type": getDevice(), | 128 | "XX-Device-Type": getDevice(), |
@@ -137,7 +137,7 @@ var app = new Vue({ | @@ -137,7 +137,7 @@ var app = new Vue({ | ||
137 | label: res.data.data[i].name | 137 | label: res.data.data[i].name |
138 | }) | 138 | }) |
139 | } | 139 | } |
140 | - loadEnd() | 140 | + //loadEnd() |
141 | } | 141 | } |
142 | }) | 142 | }) |
143 | }, | 143 | }, |
@@ -206,10 +206,12 @@ var app = new Vue({ | @@ -206,10 +206,12 @@ var app = new Vue({ | ||
206 | var app=this; | 206 | var app=this; |
207 | weui.picker(app.Illness_list, { | 207 | weui.picker(app.Illness_list, { |
208 | onChange: function (result) { | 208 | onChange: function (result) { |
209 | + app.broth_info=$("#date2").val() | ||
209 | }, | 210 | }, |
210 | onConfirm: function (result) { | 211 | onConfirm: function (result) { |
211 | 212 | ||
212 | - app.choose_type_name = result[0].label | 213 | + app.choose_type_name = result[0].label; |
214 | + | ||
213 | } | 215 | } |
214 | }) | 216 | }) |
215 | }, | 217 | }, |
@@ -218,9 +220,11 @@ var app = new Vue({ | @@ -218,9 +220,11 @@ var app = new Vue({ | ||
218 | var app=this; | 220 | var app=this; |
219 | weui.picker(app.org_list, { | 221 | weui.picker(app.org_list, { |
220 | onChange: function (result) { | 222 | onChange: function (result) { |
223 | + app.broth_info=$("#date2").val() | ||
221 | }, | 224 | }, |
222 | onConfirm: function (result) { | 225 | onConfirm: function (result) { |
223 | - app.choose_homes = result[0].label | 226 | + app.choose_homes = result[0].label; |
227 | + | ||
224 | } | 228 | } |
225 | }) | 229 | }) |
226 | }, | 230 | }, |
@@ -253,7 +257,6 @@ var app = new Vue({ | @@ -253,7 +257,6 @@ var app = new Vue({ | ||
253 | var app=this; | 257 | var app=this; |
254 | app.broth_info=$("#date2").val(); | 258 | app.broth_info=$("#date2").val(); |
255 | localStorage.setItem("birth",app.broth_info); | 259 | localStorage.setItem("birth",app.broth_info); |
256 | - console.log(localStorage) | ||
257 | console.log( app.broth_info) | 260 | console.log( app.broth_info) |
258 | var header = { | 261 | var header = { |
259 | "XX-Device-Type": getDevice(), | 262 | "XX-Device-Type": getDevice(), |
@@ -276,21 +279,23 @@ var app = new Vue({ | @@ -276,21 +279,23 @@ var app = new Vue({ | ||
276 | } else if (app.choose_homes == '机构名称') { | 279 | } else if (app.choose_homes == '机构名称') { |
277 | toastMsg('请选择机构名称') | 280 | toastMsg('请选择机构名称') |
278 | } else if (app.content == '') { | 281 | } else if (app.content == '') { |
279 | - toastMsg('请输入描述') | ||
280 | - } else if (app.img_report == '' && app.code == '') { | ||
281 | - toastMsg('请上传报告照片') | 282 | + toastMsg('请输入描述'); |
282 | } | 283 | } |
284 | + // } else if (app.img_report == '' && app.code == '') { | ||
285 | + // toastMsg('请上传报告照片') | ||
286 | + // } | ||
283 | else { | 287 | else { |
284 | getRequest('post', 'user/index/addReport', post, header).then(function (res) { | 288 | getRequest('post', 'user/index/addReport', post, header).then(function (res) { |
285 | // alert(JSON.stringify(res)) | 289 | // alert(JSON.stringify(res)) |
286 | if (res.data.code == 1) { | 290 | if (res.data.code == 1) { |
287 | toastMsg('添加成功'); | 291 | toastMsg('添加成功'); |
288 | - api.sendEvent({ | ||
289 | - name:'add_success' | ||
290 | - }); | ||
291 | - setTimeout(function() { | ||
292 | - api.closeWin() | ||
293 | - }, 1000) | 292 | + // api.sendEvent({ |
293 | + // name:'add_success' | ||
294 | + // }); | ||
295 | + // setTimeout(function() { | ||
296 | + // api.closeWin() | ||
297 | + // }, 1000) | ||
298 | + window.history.back(); | ||
294 | } else { | 299 | } else { |
295 | toastMsg(res.msg) | 300 | toastMsg(res.msg) |
296 | } | 301 | } |
@@ -93,6 +93,17 @@ | @@ -93,6 +93,17 @@ | ||
93 | .photo_item img { | 93 | .photo_item img { |
94 | width: 100%; | 94 | width: 100%; |
95 | } | 95 | } |
96 | + | ||
97 | + #preview{ | ||
98 | + width: 2rem; | ||
99 | + height: 2rem; | ||
100 | + | ||
101 | + } | ||
102 | + #imghead{ | ||
103 | + width:2rem; | ||
104 | + height:2rem; | ||
105 | + border-radius:0.16rem; | ||
106 | + } | ||
96 | </style> | 107 | </style> |
97 | </head> | 108 | </head> |
98 | <body> | 109 | <body> |
@@ -134,10 +145,10 @@ | @@ -134,10 +145,10 @@ | ||
134 | <!--<span v-else class="iconfont icon-jiajianzujianjiahao"></span>--> | 145 | <!--<span v-else class="iconfont icon-jiajianzujianjiahao"></span>--> |
135 | <!--</div>--> | 146 | <!--</div>--> |
136 | 147 | ||
137 | - <div class="photo_item"> | 148 | + <div class="addphoto"> |
138 | <!--../img/addimg.png--> | 149 | <!--../img/addimg.png--> |
139 | <div id="preview"> | 150 | <div id="preview"> |
140 | - <img id="imghead" border="0" src="" style="width:100%;height:100%" onclick="$('#previewImg').click();"> | 151 | + <img id="imghead" border="0" src="../../assets/image/tri.png" style="width:100%;height:100%" onclick="$('#previewImg').click();"> |
141 | </div> | 152 | </div> |
142 | <!--<img src="../img/delet.png" alt="" style="position:absolute;bottom:92px;left:46px" class="deleteimg"/>--> | 153 | <!--<img src="../img/delet.png" alt="" style="position:absolute;bottom:92px;left:46px" class="deleteimg"/>--> |
143 | <input type="file" onchange="previewImage(this)" style="display: none;" id="previewImg"> | 154 | <input type="file" onchange="previewImage(this)" style="display: none;" id="previewImg"> |
@@ -145,7 +156,6 @@ | @@ -145,7 +156,6 @@ | ||
145 | 156 | ||
146 | 157 | ||
147 | 158 | ||
148 | - | ||
149 | <div class="photo_item" @click="openQrc"> | 159 | <div class="photo_item" @click="openQrc"> |
150 | <img v-if='img_sao_yi_sao' :src="img_sao_yi_sao" alt=""> | 160 | <img v-if='img_sao_yi_sao' :src="img_sao_yi_sao" alt=""> |
151 | <span v-else class="iconfont icon-saoyisao"></span> | 161 | <span v-else class="iconfont icon-saoyisao"></span> |
@@ -185,4 +195,86 @@ | @@ -185,4 +195,86 @@ | ||
185 | beginYear:2000, | 195 | beginYear:2000, |
186 | endYear:2100 | 196 | endYear:2100 |
187 | }) | 197 | }) |
198 | + | ||
199 | + function clacImgZoomParam(maxWidth, maxHeight, width, height) { | ||
200 | + var param = { | ||
201 | + top: 0, | ||
202 | + left: 0, | ||
203 | + width: width, | ||
204 | + height: height | ||
205 | + }; | ||
206 | + if(width > maxWidth || height > maxHeight) { | ||
207 | + rateWidth = width / maxWidth; | ||
208 | + rateHeight = height / maxHeight; | ||
209 | + | ||
210 | + if(rateWidth > rateHeight) { | ||
211 | + param.width = maxWidth; | ||
212 | + param.height = Math.round(height / rateWidth); | ||
213 | + } else { | ||
214 | + param.width = Math.round(width / rateHeight); | ||
215 | + param.height = maxHeight; | ||
216 | + } | ||
217 | + } | ||
218 | + param.left = Math.round((maxWidth - param.width) / 2); | ||
219 | + param.top = Math.round((maxHeight - param.height) / 2); | ||
220 | + return param; | ||
221 | + } | ||
222 | + | ||
223 | + function previewImage(file) { | ||
224 | + var url=baseurl + 'user/index/addReportPic'; | ||
225 | + console.log(url) | ||
226 | + | ||
227 | + var MAXWIDTH =60; | ||
228 | + var MAXHEIGHT =77; | ||
229 | + var div = document.getElementById('preview'); | ||
230 | + if(file.files && file.files[0]) { | ||
231 | + div.innerHTML = '<img id=imghead onclick=$("#previewImg").click()>'; | ||
232 | + var img = document.getElementById('imghead'); | ||
233 | + img.onload = function() { | ||
234 | + var rect = clacImgZoomParam(MAXWIDTH, MAXHEIGHT, img.offsetWidth, img.offsetHeight); | ||
235 | + img.width = rect.width; | ||
236 | + img.height = rect.height; | ||
237 | + // img.style.marginLeft = rect.left+'px'; | ||
238 | + // img.style.marginTop = rect.top + 'px'; | ||
239 | + } | ||
240 | + var reader = new FileReader(); | ||
241 | + reader.onload = function(evt) { | ||
242 | + img.src = evt.target.result; | ||
243 | + } | ||
244 | + reader.readAsDataURL(file.files[0]); | ||
245 | + } else //兼容IE | ||
246 | + { | ||
247 | + var sFilter = 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="'; | ||
248 | + file.select(); | ||
249 | + var src = document.selection.createRange().text; | ||
250 | + div.innerHTML = '<img id=imghead>'; | ||
251 | + var img = document.getElementById('imghead'); | ||
252 | + img.filters.item('DXImageTransform.Microsoft.AlphaImageLoader').src = src; | ||
253 | + var rect = clacImgZoomParam(MAXWIDTH, MAXHEIGHT, img.offsetWidth, img.offsetHeight); | ||
254 | + status = ('rect:' + rect.top + ',' + rect.left + ',' + rect.width + ',' + rect.height); | ||
255 | + div.innerHTML = "<div id=divhead style='width:" + rect.width + "px;height:" + rect.height + "px;margin-top:" + rect.top + "px;" + sFilter + src + "\"'></div>"; | ||
256 | + } | ||
257 | + var formData = new FormData(); | ||
258 | + var fileM = document.querySelector("#previewImg"); | ||
259 | + var fileObj = fileM.files[0]; | ||
260 | + formData.append("files", fileObj); | ||
261 | + formData.append("r_type",2) | ||
262 | + $.ajax({ | ||
263 | + url: baseurl + 'user/index/addReportPic', | ||
264 | + type: 'POST', | ||
265 | + data: formData, | ||
266 | + async: false, | ||
267 | + cache: false, | ||
268 | + contentType: false, | ||
269 | + processData: false, | ||
270 | + success: function(res) { | ||
271 | + console.log(res); | ||
272 | + alert(res) | ||
273 | + | ||
274 | + }, | ||
275 | + error: function() { | ||
276 | + | ||
277 | + } | ||
278 | + }); | ||
279 | + } | ||
188 | </script> | 280 | </script> |
-
请 注册 或 登录 后发表评论