zhanghui 2 lat temu
rodzic
commit
6e166ef997

+ 8 - 0
common/js/login.js

@@ -17,5 +17,13 @@ export default {
 			url: '/auth/logout',
 			method: 'DELETE'
 		})
+	},
+	//账号密码登录
+	updatePassword(param) {
+		return request({
+			url: '/auth/tech/updatePassword',
+			method: 'POST',
+			data: param
+		})
 	}
 }

+ 5 - 0
pages/updatePassword/index.rpx.css

@@ -12,3 +12,8 @@
     color: #FFFFFF;
     margin-top: 100rpx;
 }
+.custom-style{
+    background: #fff05c;
+    border: #fff05c;
+    border-radius: 10rpx;
+}

+ 25 - 9
pages/updatePassword/updatePassword.vue

@@ -4,8 +4,8 @@
 		<view :style="{'marginTop':'10rpx'}">
 			<u--form labelPosition="left" :model="form" :rules="rules" ref="uForm">
 
-				<u-form-item :labelWidth="80" label="手机号:" prop="phone" ref="item1">
-					<u--input v-model="form.phone"  placeholder="请输入手机号"></u--input>
+				<u-form-item :labelWidth="80" label="手机号:" prop="username" ref="item1">
+					<u--input v-model="form.username"  placeholder="请输入手机号"></u--input>
 				</u-form-item>
 
 				<u-form-item :labelWidth="80" label="原密码:" prop="oldPassword" ref="item1">
@@ -19,7 +19,7 @@
 			</u--form>
 
 			<view :style="{'marginTop':'100rpx'}">
-				<u-button type="primary" text="提交" @click="updatePassword"></u-button>
+				<u-button class="custom-style"  text="提交" @click="updatePassword"></u-button>
 			</view>
 		</view>
 	</view>
@@ -30,12 +30,12 @@
 		data() {
 			return {
 				form:{
-					phone:'',
+					username:'',
 					oldPassword:'',
 					newPassword:''
 				},
 				rules: {
-					'phone': {
+					'username': {
 						type: 'string',
 						required: true,
 						min:11,
@@ -45,7 +45,7 @@
 					},
 					'oldPassword': {
 						type: 'string',
-						min:11,
+						min:6,
 						max: 16,
 						required: true,
 						message: '请输入6-18位老密码',
@@ -66,11 +66,27 @@
 			updatePassword(){
 				console.log("+++++++++++++++++++")
 				this.$refs.uForm.validate().then(res => {
-					uni.$u.toast('校验通过')
-				}).catch(errors => {
-					uni.$u.toast('校验失败')
+					this.$api.login.updatePassword(this.form).then(res=>{
+						uni.showToast({
+							icon: 'success',
+							duration: 2000,
+							title: '修改成功,即将跳转登录页'
+						});
+						setTimeout(()=>{
+							this.logout()
+						},2000)
+
+					})
 				})
 			},
+			logout(){
+				this.$api.login.logout().then(res=>{
+					uni.clearStorageSync();
+					uni.navigateTo({
+						url:'/pages/login/login'
+					})
+				})
+			}
 
 		}
 	}

+ 9 - 9
pages/userInfo/userInfo.vue

@@ -45,15 +45,15 @@
 <!--						<u-icon name="arrow-right" color="#666" size="18"></u-icon>-->
 					</view>
 				</view>
-<!--				<view class="flex-row justify-between bordBot" >-->
-<!--					<view class="key flex-col justify-center ">-->
-<!--						<text>修改密码</text>-->
-<!--					</view>-->
-<!--					<view class="flex-row justify-end groupItemContent " @click="updatePassword">-->
-<!--						<text>点击修改</text>-->
-<!--						<u-icon name="arrow-right" color="#666" size="18"></u-icon>-->
-<!--					</view>-->
-<!--				</view>-->
+				<view class="flex-row justify-between bordBot" >
+					<view class="key flex-col justify-center ">
+						<text>修改密码</text>
+					</view>
+					<view class="flex-row justify-end groupItemContent " @click="updatePassword">
+						<text>点击修改</text>
+						<u-icon name="arrow-right" color="#666" size="18"></u-icon>
+					</view>
+				</view>
 			</form>
 		</view>