作者 李洪娟

修改个人中心内容

... ... @@ -15,8 +15,17 @@ function openWin(winName, url) {
}
function openView(fmName, fmUrl, winTitle, winName, winUrl, fmParams, winParams) {
if(fmParams){
for (var item in fmParams) {
console.log(item)
console.log(fmParams[item])
localStorage.setItem(item,fmParams[item])
}
}
if(winParams){
for (var item in winParams) {
console.log(item)
console.log(winParams[item])
localStorage.setItem(item,winParams[item])
}
}
... ...
... ... @@ -123,15 +123,19 @@
status3: ''
},
created: function () {
apiready = function () {
app.type_id = api.pageParam.id;
app.rid = api.pageParam.rid;
app.typeInfo();
}
// var app=this;
// apiready = function () {
// app.type_id = api.pageParam.id;
// app.rid = api.pageParam.rid;
this.type_id=localStorage.getItem("id");
this.rid=localStorage.getItem("rid")
this.typeInfo();
// }
},
methods: {
// 获取选择数据
typeInfo: function () {
var app=this;
var post = {
type_id: app.type_id
};
... ... @@ -171,6 +175,7 @@
},
// 多选
choose_more: function (select, index) {
var app=this;
Array.prototype.indexOf = function (val) {
for (var i = 0; i < this.length; i++) {
if (this[i] == val) return i;
... ... @@ -195,7 +200,8 @@
,
// 第一道单选
chooseAnswer: function (index) {
for (let m in app.answer_one) {
var app=this;
for (var m in app.answer_one) {
app.answer_one[m].select = 0
}
var ind = app.answer_one[index].select;
... ... @@ -210,6 +216,7 @@
,
// 第二道单选
chooseAnswer2: function (index) {
var app=this;
for (var n in app.answer_thr) {
app.answer_thr[n].select = 0
}
... ... @@ -224,6 +231,7 @@
,
// 保存选择结果
save_info: function () {
var app=this;
toastMsg('正在保存')
// api.showProgress({
... ...
... ... @@ -113,7 +113,7 @@
<img :src="head_img?head_img:'../../assets/image/default_img.png'" alt="">
</span>
<span class="iconfont icon-xiangyou"></span>
<input type="file" @change="takePhotos" accept="image/jpeg,image/x-png,image/gif" id="" value="" class="img_input">
<input type="file" @change="takePhotos($event)" accept="image/jpeg,image/x-png,image/gif" id="" value="" class="img_input">
</div>
<mt-popup v-model="popupVisible_head_img" position="bottom">
<ul class="moreoul">
... ... @@ -238,6 +238,7 @@
<script>
new FastClick(document.body);
</script>
<script type="text/javascript" src="../../assets/js/jquery-1.10.1.min.js"></script>
<script type="text/javascript" src="../../assets/js/axios.min.js"></script>
<script type="text/javascript" src="../../assets/icon/iconfont.js"></script>
<script type="text/javascript" src="../../assets/js/datePicker.js"></script>
... ... @@ -353,9 +354,9 @@
})
},
// 选择头像
takePhotos: function () {
takePhotos: function (e) {
var app = this;
var file = e.target.files[0];e
var file = e.target.files[0];
var imgSize=file.size/1024;
if(imgSize>200){
alert('请上传大小不要超过200KB的图片')
... ...
... ... @@ -488,19 +488,19 @@
openData: function () {
var app = this;
app.img_active = false;
api.sendEvent({
name: 'hidelist',
extra: {
img_active:app.img_active
}
});
openView('my_healthData', 'my/my_healthData', '健康数据', 'my_healthData', false, {rid: app.rid})
// api.sendEvent({
// name: 'hidelist',
// extra: {
// img_active:app.img_active
// }
// });
openView('my_healthData', '../my/my_healthData', '健康数据', 'my_healthData', false, {rid: app.rid})
},
// 健康史
openHistory: function () {
var app = this;
app.img_active = false;
openView('my_history', 'my/my_history', '健康史', 'my_history', false, {rid: app.rid});
openView('my_history', '../my/my_history', '健康史', 'my_history', false, {rid: app.rid});
},
// 亲友档案
openFriend: function () {
... ...
... ... @@ -95,34 +95,41 @@
rid: ''
},
created: function () {
apiready = function () {
app.rid = api.pageParam.rid;
// apiready = function () {
// var app = this;
// app.rid = api.pageParam.rid;
this.rid = localStorage.getItem('rid');
// alert(app.rid);
app.healthData();
api.addEventListener({
name: 'sugar'
}, function (ret, err) {
app.healthData();
});
api.addEventListener({
name: 'pressure'
}, function (ret, err) {
app.healthData();
});
}
this.healthData();
// api.addEventListener({
// name: 'sugar'
// }, function (ret, err) {
// app.healthData();
// });
// api.addEventListener({
// name: 'pressure'
// }, function (ret, err) {
// app.healthData();
// });
// }
},
methods: {
// 记录血压
openPress: function () {
openView('my_pressure', 'my/my_pressure', '手动血压记录', 'my_pressure', false, {rid: app.rid})
var app = this;
openView('my_pressure', '../my/my_pressure', '手动血压记录', 'my_pressure', false, {rid: app.rid})
},
// 记录血糖
openSugar: function () {
openView('my_sugar', 'my/my_sugar', '记血糖', 'my_sugar', false, {rid: app.rid})
var app = this;
openView('my_sugar', '../my/my_sugar', '记血糖', 'my_sugar', false, {rid: app.rid})
},
// 增加报告
open_des: function (name, date_type, type_name, type_home, type_id) {
openView('my_report', 'my/my_report', name, 'my_report', false, {
var app = this;
openView('my_report', '../my/my_report', name, 'my_report', false, {
date_type: date_type,
type_name: type_name,
type_home: type_home,
... ... @@ -132,6 +139,7 @@
},
// 获取血糖,血压
healthData: function () {
var app = this;
var post = {
rid: app.rid
};
... ... @@ -141,6 +149,7 @@
};
getRequest('post', 'user/index/healthData', post, header).then(function (res) {
loadEnd();
console.log(res)
if (res.data.code == 1) {
app.sugar_data = res.data.data.suger.data ? res.data.data.suger.data : 0;
app.puser_data = res.data.data.puser.data ? res.data.data.puser.data : 0/0;
... ...
... ... @@ -134,8 +134,9 @@
methods: {
// 打开详情
openHome: function (name, index) {
var app = this;
openView('history_detail', 'my/history_detail', name, 'history_detail', false, {
openView('history_detail', '../my/history_detail', name, 'history_detail', false, {
rid: app.rid,
id: index
})
... ...
... ... @@ -159,12 +159,13 @@
<script type="text/javascript" src="../../assets/js/weui.min.js"></script>
<script type="text/javascript">
$(function () {
apiready = function () {
// apiready = function () {
$(document).ready(function () {
var type=1
$(".knob").knob();
loadEnd();
var rid=localStorage.getItem("rid")
function getSugar() {
var header = {
... ... @@ -172,7 +173,7 @@
'XX-Token': getToken()
};
var post = {
rid: api.pageParam.rid,
rid: rid,
type: 1
};
getRequest('post', 'user/index/getLastBoolData', post, header).then(function (res) {
... ... @@ -263,6 +264,7 @@
$('.save_btn').click(function () {
var rid=localStorage.getItem("rid")
var value = $('.knob').val();
var date = $('#test04').val();
... ... @@ -271,7 +273,7 @@
type = $('.spanactive').attr('data-id')
// console.log(type)
var post = {
rid: api.pageParam.rid,
rid: rid,
time_type: type,
time: date,
data: value,
... ... @@ -308,6 +310,6 @@
})
}
// }
});
</script>
... ...