|
|
@ -17,22 +17,14 @@ |
|
|
|
</button> |
|
|
|
</view> |
|
|
|
<view class="item"> |
|
|
|
<view class="label">昵称</view> |
|
|
|
<view class="label">{{ userShop ? '店铺名称' : '昵称' }}</view> |
|
|
|
<view class="value"> |
|
|
|
<input type="nickname" placeholder="请输入昵称" style="text-align: right;" id="nickName" |
|
|
|
<input type="nickname" :placeholder="'请输入' + (userShop ? '店铺名称' : '昵称') " style="text-align: right;" id="nickName" |
|
|
|
v-model="form.nickName" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<!-- <view class="item" @click="sexChange"> |
|
|
|
<view class="label">性别</view> |
|
|
|
<view>{{form.sex}}</view> |
|
|
|
</view> --> |
|
|
|
<!-- <view class="item"> |
|
|
|
<view class="label">联系方式</view> |
|
|
|
<view class="value"> |
|
|
|
<uv-input v-model="form.phone" placeholder="联系方式" border="bottom" clearable></uv-input> |
|
|
|
</view> |
|
|
|
</view> --> |
|
|
|
|
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- ActionSheet 操作菜单 --> |
|
|
@ -49,39 +41,29 @@ |
|
|
|
<script> |
|
|
|
import { |
|
|
|
mapState, |
|
|
|
mapGetters, |
|
|
|
} from 'vuex' |
|
|
|
export default { |
|
|
|
computed: { |
|
|
|
...mapState(['userInfo']), |
|
|
|
...mapGetters(['userShop']), |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
form: { |
|
|
|
sex: '', |
|
|
|
nickName: '1', |
|
|
|
phone: '', |
|
|
|
headImage: '', |
|
|
|
}, |
|
|
|
// itemUserImage: userInfo.headImage, |
|
|
|
fileList: [], |
|
|
|
sexList: [{ |
|
|
|
name: '男', |
|
|
|
value: 1 |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: '女', |
|
|
|
value: 0 |
|
|
|
}, |
|
|
|
], |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad() { |
|
|
|
this.form.phone = this.userInfo.phone |
|
|
|
this.form.headImage = this.userInfo.headImage |
|
|
|
this.form.nickName = this.userInfo.nickName |
|
|
|
this.form.sex = this.userInfo.sex |
|
|
|
if (this.userInfo.sex == '' || this.userInfo.sex == null) { |
|
|
|
this.form.sex = '未知' |
|
|
|
if(this.userShop){ |
|
|
|
this.form.headImage = this.userInfo.shop.pic |
|
|
|
this.form.nickName = this.userInfo.shop.name |
|
|
|
}else{ |
|
|
|
this.form.headImage = this.userInfo.headImage |
|
|
|
this.form.nickName = this.userInfo.nickName |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
@ -110,21 +92,36 @@ |
|
|
|
|
|
|
|
if (self.$utils.verificationAll(self.form, { |
|
|
|
headImage: '请选择头像', |
|
|
|
nickName: '请填写昵称' |
|
|
|
nickName: '请填写' + (this.userShop ? '店铺名称' : '昵称') |
|
|
|
})) { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
self.$api('updateInfo', { |
|
|
|
headImg : self.form.headImage, |
|
|
|
nickname : self.form.nickName, |
|
|
|
}, res => { |
|
|
|
if (res.code == 200) { |
|
|
|
uni.redirectTo({ |
|
|
|
url: '/pages/index/center' |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
if(this.userShop){ |
|
|
|
self.$api('shopEditInfo', { |
|
|
|
pic : self.form.headImage, |
|
|
|
name : self.form.nickName, |
|
|
|
}, res => { |
|
|
|
if (res.code == 200) { |
|
|
|
uni.reLaunch({ |
|
|
|
url: '/pages/index/center' |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
}else{ |
|
|
|
self.$api('updateInfo', { |
|
|
|
headImg : self.form.headImage, |
|
|
|
nickname : self.form.nickName, |
|
|
|
}, res => { |
|
|
|
if (res.code == 200) { |
|
|
|
uni.reLaunch({ |
|
|
|
url: '/pages/index/center' |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|