소스 검색

添加修改密码

gcz 1 년 전
부모
커밋
8353a6a73a
4개의 변경된 파일189개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      center/center.vue
  2. 176 0
      center/resetpass.vue
  3. 5 0
      common/apiurl.js
  4. 7 0
      pages.json

+ 1 - 1
center/center.vue

@@ -76,7 +76,7 @@
 				memberInfo:{},
 				customerMobile:'',
 				tools:[
-					// {name:'观看记录',url:'/center/viewrecord',ico:this.$commonConfig.staticUrl+'/img/center-record.png',checkauth:true},
+					{name:'修改密码',url:'/center/resetpass',ico:this.$commonConfig.staticUrl+'/img/center-coupon.png',checkauth:true},
 					// {name:'领券中心',url:'/center/mycoupon',ico:this.$commonConfig.staticUrl+'/img/center-coupon.png',checkauth:true},
 					// {name:'开具发票',url:'center/invoice',ico:this.$commonConfig.staticUrl+'/img/center-ticket.png',checkauth:true},
 					{name:'报名记录',url:'center/applylist',ico:this.$commonConfig.staticUrl+'/img/center-order.png',checkauth:true},

+ 176 - 0
center/resetpass.vue

@@ -0,0 +1,176 @@
+<template>
+	<view class="pages">
+	<!-- 	<u-navbar
+			title="修改密码"
+			:placeholder="true"
+			:autoBack="true"
+			 :safeAreaInsetTop="true"
+			 bgColor="#ED0000"
+			 :titleStyle="{color:'#fff'}"
+			 leftIconColor="#fff"
+		>
+		</u-navbar> -->
+		<view class="form-wrap">
+			<u--form labelPosition="left" labelWidth="70px" :model="form"  :rules="rules" ref="uForm" >
+				<u-form-item label="旧密码" prop="oldPassword" borderBottom ref="oldPassword" >
+					<u--input
+						v-model="form.oldPassword"
+						border="none"
+						placeholder="请输入旧密码"
+						:customStyle="inputCustomStyle"
+					></u--input>
+				</u-form-item>
+				<u-form-item label="新密码" prop="password" borderBottom ref="password" >
+					<u--input
+						v-model="form.password"
+						border="none"
+						:password="true"
+						placeholder="请输入新密码"
+						:customStyle="inputCustomStyle"
+					></u--input>
+				</u-form-item>
+				<u-form-item label="确认密码" prop="comfpassword" :borderBottom="false" ref="comfpassword" >
+					<u--input
+						v-model="form.comfpassword"
+						border="none"
+						:password="true"
+						placeholder="请确认新密码"
+						:customStyle="inputCustomStyle"
+					></u--input>
+				</u-form-item>
+			</u--form>
+		</view>
+		<u-button
+			@click="submit"
+			text="确定" 
+			type="primary" 
+			shape="circle" 
+			:customStyle="{'margin':'60rpx 32rpx',height:'98rpx','box-sizing':'border-box',width:'auto'}"
+			color="linear-gradient(90deg, #FF7979 0%, #ED0000 100%)">
+		</u-button>
+	</view>
+</template>
+
+<script>
+	export default {
+		
+		data() {
+			return {
+				form:{
+					oldPassword:'',
+					password:'',
+					comfpassword:'',
+				},
+				
+				rules: {
+					oldPassword: {
+						type: 'string',
+						required: true,
+						message: '请输入旧密码',
+						trigger: ['blur', 'change']
+					},
+					password: [
+						{
+							type: 'string',
+							required: true,
+							message: '请输入新密码',
+							trigger: ['blur', 'change']
+						},
+						{
+							min: 6,
+							max: 10,
+							message: '长度在6-10个字符之间',
+							trigger: 'blur',
+						},
+					],
+					comfpassword: [
+						{
+							type: 'string',
+							required: true,
+							message: '请确认密码',
+							trigger: ['blur', 'change']
+						},
+						{
+							validator: (rule, value, callback) => {
+								if (value === '') {
+									callback(new Error('请再次输入密码'));
+								} else if (value !== this.form.password) {
+									callback(new Error('两次输入密码不一致!'));
+								} else {
+									callback();
+								}
+							},
+							trigger: 'blur',
+						}
+					],
+				},
+				inputCustomStyle:{
+					height:'98rpx',
+					'border-color':'#eee',
+					'padding-left':'30rpx',
+					'box-sizing':'border-box',
+				}
+			}
+		},
+		onShow() {
+		},
+		onReady() {
+			this.$refs.uForm.setRules(this.rules)
+		},
+		onLoad() {
+
+		},
+		methods: {
+			chekPass(){
+				console.log('chekPass---',this.form);
+				return new Promise((resolve, reject)=>{
+					if(!password){
+						 reject('needAuth');
+					}
+				})
+			},
+			async submit(){
+				// console.log('form',this.form);
+				this.$refs.uForm.validate().then(res => {
+					// let chekPassResult = await this.chekPass();
+					// return
+					// uni.$u.toast('校验通过')
+					const param = {
+						oldPassword:this.form.oldPassword,
+						newPassword:this.form.password
+					}
+					this.$u.api.updatePassword(param).then(res=>{
+						// console.log('res',res.data);
+						this.$u.vuex('vuex_user_info', res.data);
+						uni.showToast({
+							title:res.msg,
+							icon:'success'
+						})
+						setTimeout(()=>{
+							uni.$u.route('/pages/login/login');
+						},2000)
+						// uni.reLaunch({url: this.backUrl});
+					}).catch(err=>{
+						console.log('login',err);
+					})
+				}).catch(errors => {
+					uni.$u.toast('请正确填写表单')
+				})
+			}
+		}
+	}
+</script>
+<style>
+page{
+	background-color: #F4F5F7;
+}
+</style>
+<style lang="scss" scoped>
+.form-wrap{
+	margin: 40rpx 32rpx;
+	padding: 20rpx 40rpx;
+	background-color: #fff;
+	box-shadow: 0rpx 4rpx 8rpx 0rpx rgba(226,226,226,0.5);
+	border-radius: 24rpx;
+}
+</style>

+ 5 - 0
common/apiurl.js

@@ -218,6 +218,11 @@ const apiurl = {
 		url: '/member/auth/teamLoginCheck',
 		type: 'get'
 	},
+	// 密码修改
+	updatePassword: {
+		url: '/member/marketTeam/updatePwd',
+		type: 'post'
+	},
 	
 	
 	/**

+ 7 - 0
pages.json

@@ -82,6 +82,13 @@
 						"navigationStyle": "custom"
 					}
 				},
+				{
+					"path": "resetpass",
+					"style": {
+						"navigationBarTitleText": "修改密码",
+						"navigationStyle": "custom"
+					}
+				},
 				{
 					"path": "factorauth",
 					"style": {