소스 검색

首页添加修改密码功能sdy

zhongtianhaoyuan 3 년 전
부모
커밋
132c1e5c34
2개의 변경된 파일38개의 추가작업 그리고 8개의 파일을 삭제
  1. 26 6
      pages/public/reset.vue
  2. 12 2
      pages/user/setUp.vue

+ 26 - 6
pages/public/reset.vue

@@ -60,7 +60,8 @@
 				system:'',
 				system:'',
 				platform:'',
 				platform:'',
 				userData:undefined,
 				userData:undefined,
-				canIUseProfile:false
+				canIUseProfile:false,
+				isPhone:""
 			}
 			}
 		},
 		},
 		onShow() {
 		onShow() {
@@ -68,7 +69,8 @@
 			this.$api.logout()
 			this.$api.logout()
 		},
 		},
 		onLoad(options) {
 		onLoad(options) {
-			
+			this.phone = options.phone //个人首页修改密码
+			this.isPhone = options.phone //个人首页修改密码成功后自动退出重新登录
 			if( wx.getUserProfile ){  
 			if( wx.getUserProfile ){  
 			    console.log('--check getUserProfile--OK');  
 			    console.log('--check getUserProfile--OK');  
 			    this.canIUseProfile = true;  
 			    this.canIUseProfile = true;  
@@ -150,9 +152,27 @@
 				    console.log("重置密码",res)
 				    console.log("重置密码",res)
 					// 获得数据
 					// 获得数据
 					if(res.data.code==200){
 					if(res.data.code==200){
-						setTimeout(() => {
-							uni.navigateBack()
-						}, 1000)
+						if(this.isPhone){//判断是否是在个人首页进来的(若是退出重进)
+							uni.clearStorageSync();
+							that.$api.doRequest('post', '/auth/api/logout').then(res => {})
+							this.$store.commit('logout')
+							this.$api.logout()
+								setTimeout(() => {
+							uni.showToast({
+								title: '修改成功',
+								icon: 'none',
+								duration: 2000
+							})
+							},2000)
+							uni.navigateTo({
+								url: `/pages/public/login_account_number`
+							})
+							
+						}else{
+							setTimeout(() => {
+								uni.navigateBack()
+						    }, 1000)
+						}
 						uni.showToast({
 						uni.showToast({
 							title: '重置成功',
 							title: '重置成功',
 							icon: 'none',
 							icon: 'none',
@@ -160,7 +180,7 @@
 						})
 						})
 					}else{
 					}else{
 						uni.showToast({
 						uni.showToast({
-							title: "系统异常,请联系管理员",
+							title: "系统异常或验证码已过期,请退出重试",
 							icon:'none',
 							icon:'none',
 							duration: 2000
 							duration: 2000
 						})
 						})

+ 12 - 2
pages/user/setUp.vue

@@ -29,12 +29,18 @@
 				</view>
 				</view>
 				<image src="../../static/img/myimg/gengduo1@3x.png" class="arrow"></image>
 				<image src="../../static/img/myimg/gengduo1@3x.png" class="arrow"></image>
 			</view>
 			</view>
-			<view class='cu-item' @click='clearStorage'>
+			<view class='cu-item' style='margin-bottom:10px;' @click='clearStorage'>
 				<view>
 				<view>
 					<text>清除缓存</text>
 					<text>清除缓存</text>
 				</view>
 				</view>
 				<image src="../../static/img/myimg/gengduo1@3x.png" class="arrow"></image>
 				<image src="../../static/img/myimg/gengduo1@3x.png" class="arrow"></image>
 			</view>
 			</view>
+			<view class='cu-item' style='margin-bottom:10px;' @click='UpdataPassword'>
+				<view>
+					<text>修改密码</text>
+				</view>
+				<image src="../../static/img/myimg/gengduo1@3x.png" class="arrow"></image>
+			</view>
 		</view>
 		</view>
 		<view class='exitloginwrap'>
 		<view class='exitloginwrap'>
 			<button @click='logout()' class='exitlogin'>退出登录</button>
 			<button @click='logout()' class='exitlogin'>退出登录</button>
@@ -75,6 +81,11 @@
 		},
 		},
 		onLoad() {},
 		onLoad() {},
 		methods: {
 		methods: {
+			UpdataPassword(){
+				uni.navigateTo({
+					url: `/pages/public/reset?phone=${this.userInfo.phone}`
+				})
+			},
 			clearStorage(){
 			clearStorage(){
 			let that = this
 			let that = this
 				uni.clearStorage({
 				uni.clearStorage({
@@ -103,7 +114,6 @@
 						uni.navigateTo({
 						uni.navigateTo({
 							url: `/pages/public/login`
 							url: `/pages/public/login`
 						})
 						})
-				
 			},
 			},
 			getList() {
 			getList() {
 				this.userInfo = uni.getStorageSync('userInfo')
 				this.userInfo = uni.getStorageSync('userInfo')