mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-mobile.git
synced 2025-12-09 02:46:46 +08:00
82 lines
1.5 KiB
Vue
82 lines
1.5 KiB
Vue
<template>
|
|
<view>
|
|
<page-title :showBack='true'>修改昵称</page-title>
|
|
<view class="text">
|
|
<view>昵称:</view>
|
|
<u--textarea v-model="form.account.nickName" placeholder="请修改昵称" border="bottom"></u--textarea>
|
|
</view>
|
|
<u-button type="primary" text="确认" @click="submit" ></u-button>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import userApi from "@/api/system/user";
|
|
export default {
|
|
data() {
|
|
return {
|
|
form: {
|
|
account:{
|
|
nickName:''
|
|
},
|
|
},
|
|
preValue:''
|
|
}
|
|
},
|
|
methods:{
|
|
submit(){
|
|
if(this.preValue===this.form.account.nickName){
|
|
return uni.showToast({
|
|
title: '数据未修改',
|
|
icon: 'none'
|
|
});
|
|
}
|
|
userApi.updateUserInfo(this.form).then(res=>{
|
|
if(res.status==200){
|
|
uni.showToast({
|
|
title:"修改成功" ,
|
|
duration: 1000,
|
|
image:'../../static/images/icon/ok-icon.png'
|
|
});
|
|
setTimeout(()=>{
|
|
uni.navigateTo({
|
|
url: '/pages/my/setting'
|
|
})
|
|
},2000)
|
|
}else{
|
|
uni.showToast({
|
|
title: res.message,
|
|
icon:'none'
|
|
});
|
|
}
|
|
})
|
|
}
|
|
},
|
|
onLoad(){
|
|
if(this.$route.query.value){
|
|
this.form=JSON.parse(decodeURIComponent(this.$route.query.value));
|
|
this.preValue=this.form.account.nickName
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.text {
|
|
display: flex;
|
|
align-items: center;
|
|
margin-top: 50upx;
|
|
margin-right: 30upx;
|
|
margin-left: 40upx;
|
|
.u-textarea {
|
|
height: 50upx;
|
|
}
|
|
}
|
|
|
|
.u-button {
|
|
width: 660upx;
|
|
margin-top: 40upx;
|
|
text-align: center;
|
|
|
|
}
|
|
</style>
|