martial-arts/pagesA/my-data/my-data.vue

112 lines
3.4 KiB
Vue
Raw Normal View History

2022-08-03 13:28:45 +00:00
<template>
<view>
<status-container titlet="基本资料" returnc="#FFFFFF">
<view slot="content" style="margin-top: -20rpx;">
2022-08-04 08:01:19 +00:00
<view class="bacf pad-x50 pad-zy20">
<view class="pad-sx30 pad-zy10 disjbac bbot">
<view class="fon24 col26">头像</view>
<view class="disac">
<image class="radius_100" :src="userInfo.headimgurl" mode="aspectFill" style="width: 92rpx;height: 92rpx;"></image>
2022-08-04 08:01:19 +00:00
<view class="icon icon-next fon24 mar-z10" style="color: #7f7f7f;"></view>
</view>
</view>
<view class="pad-sx30 fon24 pad-zy10 disjbac bbot">
<view class="col26">昵称</view>
<view class="disac">
<view class="">{{userInfo.nickname}}</view>
2022-08-04 08:01:19 +00:00
<view class="icon icon-next fon24 mar-z10" style="color: #FFFFFF;"></view>
</view>
</view>
<view class="pad-sx30 fon24 pad-zy10 disjbac bbot" @tap="chooseEv(5)">
<view class="col26">真实姓名</view>
<view class="disac">
<view class="">{{realName || '未填写'}}</view>
<view class="icon icon-next fon24 mar-z10" style="color: #7f7f7f;"></view>
</view>
</view>
<view class="pad-sx30 fon24 pad-zy10 disjbac bbot mar-x30" @tap="chooseEv(6)">
2022-08-11 10:27:47 +00:00
<!-- <view class="pad-sx30 fon24 pad-zy10 disjbac bbot mar-x30"> -->
2022-08-04 08:01:19 +00:00
<view class="col26">联系电话</view>
<view class="disac">
<view class="">{{phone || '未填写'}}</view>
<view class="icon icon-next fon24 mar-z10" style="color: #7f7f7f;"></view>
</view>
</view>
2022-08-03 13:28:45 +00:00
</view>
</view>
</status-container>
2022-08-04 08:01:19 +00:00
<dynamic-frame ref="refFrame" :showType="showType" :tipsTitle="tipsTitle" @returnEv="returnEv"></dynamic-frame>
2022-08-03 13:28:45 +00:00
</view>
</template>
<script>
2022-08-04 08:01:19 +00:00
import dynamicFrame from '@/components/dynamic-frame.vue';
2022-08-03 13:28:45 +00:00
export default {
2022-08-04 08:01:19 +00:00
components:{
dynamicFrame
},
2022-08-03 13:28:45 +00:00
data() {
return {
2022-08-04 08:01:19 +00:00
showType:5,
tipsTitle:'真实姓名',
realName:'',//真实姓名字段
phone:'',//联系电话
userInfo:''
2022-08-03 13:28:45 +00:00
}
},
onLoad() {
this.userInfo = uni.getStorageSync('userInfo');
this.realName = this.userInfo.real_name;
this.phone = this.userInfo.mobile;
},
2022-08-03 13:28:45 +00:00
methods: {
2022-08-05 03:08:36 +00:00
// 发起修改
2022-08-04 08:01:19 +00:00
chooseEv(index){
this.showType = index;
this.tipsTitle = index==5?'真实姓名':'电话号码';
this.$refs.refFrame.ifLogistics = true;
this.$refs.refFrame.ifAnimated = true;
if(this.showType==5){
this.$refs.refFrame.dynamicObj.content = this.realName || '';
this.$refs.refFrame.tempText = JSON.parse(JSON.stringify(this.realName || ''));
}
if(this.showType==6){
this.$refs.refFrame.dynamicObj.content = this.phone || '';
this.$refs.refFrame.tempText = JSON.parse(JSON.stringify(this.phone || ''));
}
},
2022-08-05 03:08:36 +00:00
//确认修改
2022-08-04 08:01:19 +00:00
returnEv(obj){
if(this.showType==5){
2022-08-11 10:27:47 +00:00
if(this.realName!=obj.content){
// 如果修改后的跟修改前的不一样
this.setData('real_name',obj.content);
}
2022-08-04 08:01:19 +00:00
this.realName = obj.content;
}
if(this.showType==6){
2022-08-11 10:27:47 +00:00
if(this.phone!=obj.content){
// 如果修改后的跟修改前的不一样
this.setData('mobile',obj.content);
}
2022-08-04 08:01:19 +00:00
this.phone = obj.content;
}
2022-08-11 10:27:47 +00:00
},
// 执行修改事件
setData(field,value){
let params = {
field,
value
}
this.$requst.post('/api/user/update-info',params).then(res=>{
if(res.code==0){
this.$toolAll.tools.showToast('修改成功');
}
})
2022-08-04 08:01:19 +00:00
}
2022-08-03 13:28:45 +00:00
}
}
</script>
<style></style>