作者 李洪娟

修改个人中心内容

@@ -15,8 +15,17 @@ function openWin(winName, url) { @@ -15,8 +15,17 @@ function openWin(winName, url) {
15 } 15 }
16 16
17 function openView(fmName, fmUrl, winTitle, winName, winUrl, fmParams, winParams) { 17 function openView(fmName, fmUrl, winTitle, winName, winUrl, fmParams, winParams) {
  18 + if(fmParams){
  19 + for (var item in fmParams) {
  20 + console.log(item)
  21 + console.log(fmParams[item])
  22 + localStorage.setItem(item,fmParams[item])
  23 + }
  24 + }
18 if(winParams){ 25 if(winParams){
19 for (var item in winParams) { 26 for (var item in winParams) {
  27 + console.log(item)
  28 + console.log(winParams[item])
20 localStorage.setItem(item,winParams[item]) 29 localStorage.setItem(item,winParams[item])
21 } 30 }
22 } 31 }
@@ -359,7 +368,7 @@ function getRequest(type, url, params, header) { @@ -359,7 +368,7 @@ function getRequest(type, url, params, header) {
359 }, 2000); 368 }, 2000);
360 // openView('login_index', 'login/login_index', '登录', 'login_index', false, false, false) 369 // openView('login_index', 'login/login_index', '登录', 'login_index', false, false, false)
361 } else { 370 } else {
362 - resolve(res) 371 + resolve(res)
363 } 372 }
364 loadEnd(); 373 loadEnd();
365 // resolve(res) 374 // resolve(res)
@@ -123,15 +123,19 @@ @@ -123,15 +123,19 @@
123 status3: '' 123 status3: ''
124 }, 124 },
125 created: function () { 125 created: function () {
126 - apiready = function () {  
127 - app.type_id = api.pageParam.id;  
128 - app.rid = api.pageParam.rid;  
129 - app.typeInfo();  
130 - } 126 + // var app=this;
  127 + // apiready = function () {
  128 + // app.type_id = api.pageParam.id;
  129 + // app.rid = api.pageParam.rid;
  130 + this.type_id=localStorage.getItem("id");
  131 + this.rid=localStorage.getItem("rid")
  132 + this.typeInfo();
  133 + // }
131 }, 134 },
132 methods: { 135 methods: {
133 // 获取选择数据 136 // 获取选择数据
134 typeInfo: function () { 137 typeInfo: function () {
  138 + var app=this;
135 var post = { 139 var post = {
136 type_id: app.type_id 140 type_id: app.type_id
137 }; 141 };
@@ -171,6 +175,7 @@ @@ -171,6 +175,7 @@
171 }, 175 },
172 // 多选 176 // 多选
173 choose_more: function (select, index) { 177 choose_more: function (select, index) {
  178 + var app=this;
174 Array.prototype.indexOf = function (val) { 179 Array.prototype.indexOf = function (val) {
175 for (var i = 0; i < this.length; i++) { 180 for (var i = 0; i < this.length; i++) {
176 if (this[i] == val) return i; 181 if (this[i] == val) return i;
@@ -195,7 +200,8 @@ @@ -195,7 +200,8 @@
195 , 200 ,
196 // 第一道单选 201 // 第一道单选
197 chooseAnswer: function (index) { 202 chooseAnswer: function (index) {
198 - for (let m in app.answer_one) { 203 + var app=this;
  204 + for (var m in app.answer_one) {
199 app.answer_one[m].select = 0 205 app.answer_one[m].select = 0
200 } 206 }
201 var ind = app.answer_one[index].select; 207 var ind = app.answer_one[index].select;
@@ -210,6 +216,7 @@ @@ -210,6 +216,7 @@
210 , 216 ,
211 // 第二道单选 217 // 第二道单选
212 chooseAnswer2: function (index) { 218 chooseAnswer2: function (index) {
  219 + var app=this;
213 for (var n in app.answer_thr) { 220 for (var n in app.answer_thr) {
214 app.answer_thr[n].select = 0 221 app.answer_thr[n].select = 0
215 } 222 }
@@ -224,6 +231,7 @@ @@ -224,6 +231,7 @@
224 , 231 ,
225 // 保存选择结果 232 // 保存选择结果
226 save_info: function () { 233 save_info: function () {
  234 + var app=this;
227 235
228 toastMsg('正在保存') 236 toastMsg('正在保存')
229 // api.showProgress({ 237 // api.showProgress({
@@ -113,7 +113,7 @@ @@ -113,7 +113,7 @@
113 <img :src="head_img?head_img:'../../assets/image/default_img.png'" alt=""> 113 <img :src="head_img?head_img:'../../assets/image/default_img.png'" alt="">
114 </span> 114 </span>
115 <span class="iconfont icon-xiangyou"></span> 115 <span class="iconfont icon-xiangyou"></span>
116 - <input type="file" @change="takePhotos" accept="image/jpeg,image/x-png,image/gif" id="" value="" class="img_input"> 116 + <input type="file" @change="takePhotos($event)" accept="image/jpeg,image/x-png,image/gif" id="" value="" class="img_input">
117 </div> 117 </div>
118 <mt-popup v-model="popupVisible_head_img" position="bottom"> 118 <mt-popup v-model="popupVisible_head_img" position="bottom">
119 <ul class="moreoul"> 119 <ul class="moreoul">
@@ -238,6 +238,7 @@ @@ -238,6 +238,7 @@
238 <script> 238 <script>
239 new FastClick(document.body); 239 new FastClick(document.body);
240 </script> 240 </script>
  241 +<script type="text/javascript" src="../../assets/js/jquery-1.10.1.min.js"></script>
241 <script type="text/javascript" src="../../assets/js/axios.min.js"></script> 242 <script type="text/javascript" src="../../assets/js/axios.min.js"></script>
242 <script type="text/javascript" src="../../assets/icon/iconfont.js"></script> 243 <script type="text/javascript" src="../../assets/icon/iconfont.js"></script>
243 <script type="text/javascript" src="../../assets/js/datePicker.js"></script> 244 <script type="text/javascript" src="../../assets/js/datePicker.js"></script>
@@ -353,9 +354,9 @@ @@ -353,9 +354,9 @@
353 }) 354 })
354 }, 355 },
355 // 选择头像 356 // 选择头像
356 - takePhotos: function () { 357 + takePhotos: function (e) {
357 var app = this; 358 var app = this;
358 - var file = e.target.files[0];e 359 + var file = e.target.files[0];
359 var imgSize=file.size/1024; 360 var imgSize=file.size/1024;
360 if(imgSize>200){ 361 if(imgSize>200){
361 alert('请上传大小不要超过200KB的图片') 362 alert('请上传大小不要超过200KB的图片')
@@ -779,4 +780,4 @@ @@ -779,4 +780,4 @@
779 }, 780 },
780 } 781 }
781 }) 782 })
782 -</script>  
  783 +</script>
@@ -488,19 +488,19 @@ @@ -488,19 +488,19 @@
488 openData: function () { 488 openData: function () {
489 var app = this; 489 var app = this;
490 app.img_active = false; 490 app.img_active = false;
491 - api.sendEvent({  
492 - name: 'hidelist',  
493 - extra: {  
494 - img_active:app.img_active  
495 - }  
496 - });  
497 - openView('my_healthData', 'my/my_healthData', '健康数据', 'my_healthData', false, {rid: app.rid}) 491 + // api.sendEvent({
  492 + // name: 'hidelist',
  493 + // extra: {
  494 + // img_active:app.img_active
  495 + // }
  496 + // });
  497 + openView('my_healthData', '../my/my_healthData', '健康数据', 'my_healthData', false, {rid: app.rid})
498 }, 498 },
499 // 健康史 499 // 健康史
500 openHistory: function () { 500 openHistory: function () {
501 var app = this; 501 var app = this;
502 app.img_active = false; 502 app.img_active = false;
503 - openView('my_history', 'my/my_history', '健康史', 'my_history', false, {rid: app.rid}); 503 + openView('my_history', '../my/my_history', '健康史', 'my_history', false, {rid: app.rid});
504 }, 504 },
505 // 亲友档案 505 // 亲友档案
506 openFriend: function () { 506 openFriend: function () {
@@ -95,34 +95,41 @@ @@ -95,34 +95,41 @@
95 rid: '' 95 rid: ''
96 }, 96 },
97 created: function () { 97 created: function () {
98 - apiready = function () {  
99 - app.rid = api.pageParam.rid; 98 +
  99 + // apiready = function () {
  100 + // var app = this;
  101 + // app.rid = api.pageParam.rid;
  102 + this.rid = localStorage.getItem('rid');
  103 +
100 // alert(app.rid); 104 // alert(app.rid);
101 - app.healthData();  
102 - api.addEventListener({  
103 - name: 'sugar'  
104 - }, function (ret, err) {  
105 - app.healthData();  
106 - });  
107 - api.addEventListener({  
108 - name: 'pressure'  
109 - }, function (ret, err) {  
110 - app.healthData();  
111 - });  
112 - } 105 + this.healthData();
  106 + // api.addEventListener({
  107 + // name: 'sugar'
  108 + // }, function (ret, err) {
  109 + // app.healthData();
  110 + // });
  111 + // api.addEventListener({
  112 + // name: 'pressure'
  113 + // }, function (ret, err) {
  114 + // app.healthData();
  115 + // });
  116 + // }
113 }, 117 },
114 methods: { 118 methods: {
115 // 记录血压 119 // 记录血压
116 openPress: function () { 120 openPress: function () {
117 - openView('my_pressure', 'my/my_pressure', '手动血压记录', 'my_pressure', false, {rid: app.rid}) 121 + var app = this;
  122 + openView('my_pressure', '../my/my_pressure', '手动血压记录', 'my_pressure', false, {rid: app.rid})
118 }, 123 },
119 // 记录血糖 124 // 记录血糖
120 openSugar: function () { 125 openSugar: function () {
121 - openView('my_sugar', 'my/my_sugar', '记血糖', 'my_sugar', false, {rid: app.rid}) 126 + var app = this;
  127 + openView('my_sugar', '../my/my_sugar', '记血糖', 'my_sugar', false, {rid: app.rid})
122 }, 128 },
123 // 增加报告 129 // 增加报告
124 open_des: function (name, date_type, type_name, type_home, type_id) { 130 open_des: function (name, date_type, type_name, type_home, type_id) {
125 - openView('my_report', 'my/my_report', name, 'my_report', false, { 131 + var app = this;
  132 + openView('my_report', '../my/my_report', name, 'my_report', false, {
126 date_type: date_type, 133 date_type: date_type,
127 type_name: type_name, 134 type_name: type_name,
128 type_home: type_home, 135 type_home: type_home,
@@ -132,6 +139,7 @@ @@ -132,6 +139,7 @@
132 }, 139 },
133 // 获取血糖,血压 140 // 获取血糖,血压
134 healthData: function () { 141 healthData: function () {
  142 + var app = this;
135 var post = { 143 var post = {
136 rid: app.rid 144 rid: app.rid
137 }; 145 };
@@ -141,6 +149,7 @@ @@ -141,6 +149,7 @@
141 }; 149 };
142 getRequest('post', 'user/index/healthData', post, header).then(function (res) { 150 getRequest('post', 'user/index/healthData', post, header).then(function (res) {
143 loadEnd(); 151 loadEnd();
  152 + console.log(res)
144 if (res.data.code == 1) { 153 if (res.data.code == 1) {
145 app.sugar_data = res.data.data.suger.data ? res.data.data.suger.data : 0; 154 app.sugar_data = res.data.data.suger.data ? res.data.data.suger.data : 0;
146 app.puser_data = res.data.data.puser.data ? res.data.data.puser.data : 0/0; 155 app.puser_data = res.data.data.puser.data ? res.data.data.puser.data : 0/0;
@@ -134,8 +134,9 @@ @@ -134,8 +134,9 @@
134 methods: { 134 methods: {
135 // 打开详情 135 // 打开详情
136 openHome: function (name, index) { 136 openHome: function (name, index) {
  137 +
137 var app = this; 138 var app = this;
138 - openView('history_detail', 'my/history_detail', name, 'history_detail', false, { 139 + openView('history_detail', '../my/history_detail', name, 'history_detail', false, {
139 rid: app.rid, 140 rid: app.rid,
140 id: index 141 id: index
141 }) 142 })
@@ -163,4 +164,4 @@ @@ -163,4 +164,4 @@
163 } 164 }
164 } 165 }
165 }) 166 })
166 -</script>  
  167 +</script>
@@ -159,12 +159,13 @@ @@ -159,12 +159,13 @@
159 <script type="text/javascript" src="../../assets/js/weui.min.js"></script> 159 <script type="text/javascript" src="../../assets/js/weui.min.js"></script>
160 <script type="text/javascript"> 160 <script type="text/javascript">
161 $(function () { 161 $(function () {
162 - apiready = function () { 162 + // apiready = function () {
163 $(document).ready(function () { 163 $(document).ready(function () {
164 164
165 var type=1 165 var type=1
166 $(".knob").knob(); 166 $(".knob").knob();
167 loadEnd(); 167 loadEnd();
  168 + var rid=localStorage.getItem("rid")
168 169
169 function getSugar() { 170 function getSugar() {
170 var header = { 171 var header = {
@@ -172,7 +173,7 @@ @@ -172,7 +173,7 @@
172 'XX-Token': getToken() 173 'XX-Token': getToken()
173 }; 174 };
174 var post = { 175 var post = {
175 - rid: api.pageParam.rid, 176 + rid: rid,
176 type: 1 177 type: 1
177 }; 178 };
178 getRequest('post', 'user/index/getLastBoolData', post, header).then(function (res) { 179 getRequest('post', 'user/index/getLastBoolData', post, header).then(function (res) {
@@ -263,6 +264,7 @@ @@ -263,6 +264,7 @@
263 264
264 265
265 $('.save_btn').click(function () { 266 $('.save_btn').click(function () {
  267 + var rid=localStorage.getItem("rid")
266 var value = $('.knob').val(); 268 var value = $('.knob').val();
267 269
268 var date = $('#test04').val(); 270 var date = $('#test04').val();
@@ -271,7 +273,7 @@ @@ -271,7 +273,7 @@
271 type = $('.spanactive').attr('data-id') 273 type = $('.spanactive').attr('data-id')
272 // console.log(type) 274 // console.log(type)
273 var post = { 275 var post = {
274 - rid: api.pageParam.rid, 276 + rid: rid,
275 time_type: type, 277 time_type: type,
276 time: date, 278 time: date,
277 data: value, 279 data: value,
@@ -308,6 +310,6 @@ @@ -308,6 +310,6 @@
308 310
309 311
310 }) 312 })
311 - } 313 + // }
312 }); 314 });
313 </script> 315 </script>