zhongtianhaoyuan преди 3 години
родител
ревизия
780d8262bb
променени са 3 файла, в които са добавени 44 реда и са изтрити 29 реда
  1. 3 4
      pages/user/setUp.vue
  2. 23 14
      pages/user/set_nickname.vue
  3. 18 11
      pages/user/set_picture.vue

+ 3 - 4
pages/user/setUp.vue

@@ -13,7 +13,7 @@
 			<view class="title">昵称</view>
 			<view class="nextStep flex">
 				<view class="username">
-					{{userInfo.userName}}
+					{{username}}
 					</view>
 				<image src="../../static/img/myimg/gengduo1@3x.png" class="arrow" @click="nickname"></image>
 			</view>
@@ -29,8 +29,7 @@
 		data() {
 			return {
 				headUrl:"../../static/img/myimg/YongHu@3x.png",
-				username:"",	
-				
+				username:"",
 			}
 		},
 		computed: {
@@ -43,7 +42,7 @@
 		},
 		methods:{
 			getList(){
-				this.userInfo= wx.getStorageSync('userInfo')
+				this.userInfo= uni.getStorageSync('userInfo')
 					this.headUrl = this.userInfo.avatarUrl
 				if(this.headUrl == null || this.headUrl == ""){
 					this.headUrl="../../static/img/myimg/YongHu@3x.png"

+ 23 - 14
pages/user/set_nickname.vue

@@ -28,7 +28,7 @@
 			...mapState(['hasLogin', 'userInfo'])
 		},
 		methods: {
-			
+
 			commit() {
 				if (this.nickname == null || this.nickname == "") {
 					this.$api.msg('请输入昵称!')
@@ -47,15 +47,24 @@
 						if (res.confirm) {
 							that.deptListurl.userName = that.nickname
 							that.deptListurl.id = that.userInfo.id
-							that.$api.doRequest('post', '/commonUser/editUserInfo', that.deptListurl).then(res => {
-								if (res.data.code == 200) {
-									// this.$api.msg('修改成功!')
-									var _student = uni.getStorageSync('userInfo');
-									_student.userName = that.nickname;
-									uni.setStorageSync('userInfo', _student);
-									uni.navigateBack()
-								}
-								})
+							that.$api.doRequest('post', '/commonUser/editUserInfo', that.deptListurl).then(
+									res => {
+										if (res.data.code == 200) {
+											uni.showToast({
+												title: '修改成功!',
+												icon: 'success',
+												duration: 2000,
+												success() {
+													setTimeout(()=>{
+														var _student = uni.getStorageSync('userInfo');
+														_student.userName = that.nickname;
+														uni.setStorageSync('userInfo', _student);
+														uni.navigateBack()
+													},2000)
+												}
+											})
+										}
+									})
 								.catch(res => {
 									uni.showToast({
 										title: res.errmsg,
@@ -63,15 +72,15 @@
 										duration: 2000
 									})
 								});
-							
+
 						} else if (res.cancel) {
 							// console.log('用户点击取消');
 						}
 					},
 				})
-				
-				
-				
+
+
+
 			},
 		}
 	}

+ 18 - 11
pages/user/set_picture.vue

@@ -124,17 +124,24 @@
 							that.$api.doRequest('post', '/commonUser/editUserInfo', that.deptListurl).then(
 									res => {
 										if (res.data.code == 200) {
-												// uni.showToast({
-												// 	title: '修改成功!',
-												// 	icon: 'success',
-												// 	duration: 2000
-												// })
-											that.userInfo.avatarUrl = that.identityUrl
-											var _student = uni.getStorageSync('userInfo');
-											_student.avatarUrl = that.identityUrl;
-											uni.setStorageSync('userInfo', _student);
-										    // this.$api.msg('修改成功!')
-											uni.navigateBack()
+												uni.showToast({
+													title: '修改成功!',
+													icon: 'success',
+													duration: 2000,
+													success() {
+														setTimeout(()=>{
+															that.userInfo.avatarUrl = that.identityUrl
+															var _student = uni.getStorageSync('userInfo');
+															_student.avatarUrl = that.identityUrl;
+															uni.setStorageSync('userInfo', _student);
+															// this.$api.msg('修改成功2!')
+															uni.navigateBack({
+																delta:1
+															})
+														},2000)
+													}
+												})
+											
 										}
 									})
 								.catch(res => {