mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-mobile.git
synced 2025-12-11 11:56:47 +08:00
2022年5月29日 从svn移到git
This commit is contained in:
80
pages/login/nickName.vue
Normal file
80
pages/login/nickName.vue
Normal file
@@ -0,0 +1,80 @@
|
||||
<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
|
||||
});
|
||||
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>
|
||||
Reference in New Issue
Block a user