Browse Source

个人信息页面的交互

littlegreen 2 years ago
parent
commit
af379a3752

+ 42 - 9
pages/menus/mine/mine.vue

@@ -46,14 +46,14 @@
 					prop="pwd"
 					borderBottom>
 					<view class="demo-layout" style="width: 300rpx;">
-						<u-button color="#000" size="small" @click="popupShow = true">修改密码</u-button>
+						<u-button color="#000" size="small" @click="toPopupShow">修改密码</u-button>
 					</view>
 				</u-form-item>
 			</u--form>
 		</view>
 		<u-popup :show="popupShow" @close="popupShow = false" >
 			<view class="popup-area">
-				<view class="form-area">
+				<view class="form-area" style="padding:0 20rpx;">
 					<u--form
 						labelPosition="left"
 						:model="pwdForm"
@@ -67,7 +67,10 @@
 							borderBottom>
 							<u--input
 							v-model="pwdForm.oldpwd"
-							border="none">
+							border="none"
+							type="password"
+							clearable
+							password>
 							</u--input>
 						</u-form-item>
 						<u-form-item
@@ -76,7 +79,10 @@
 							borderBottom>	
 							<u--input
 							v-model="pwdForm.newpwd"
-							border="none">
+							border="none"
+							type="password"
+							clearable
+							password>
 							</u--input>
 						</u-form-item>
 						<u-form-item
@@ -85,7 +91,10 @@
 							borderBottom>	
 							<u--input
 								v-model="pwdForm.surepwd"
-								border="none">
+								border="none"
+								type="password"
+								clearable
+								password>
 							</u--input>
 						</u-form-item>
 					</u--form>
@@ -247,8 +256,20 @@
 			};
 		},
 		methods:{
+			toPopupShow(){
+				this.popupShow = true
+				this.pwdForm = {
+					oldpwd:"",
+					newpwd:"",
+					surepwd:""
+				}
+			},
 			save(){
 				const that = this
+				uni.showLoading({
+					title:'保存中',
+					icon:'none'
+				})
 				this.$refs.Form1.validate().then(() => {
 					let data = {
 						email:this.form.email,
@@ -257,27 +278,39 @@
 						userId:this.userId
 					}
 					saveUserInfo(data).then(res=>{
+						uni.hideLoading()
 						console.log(res)
+						uni.$u.toast("修改成功!")
 						if(res.data.code===200 && res.data.msg === "操作成功"){
 							that.initInfo()
 						}
 					})
 				}).catch(errors => {
+					uni.hideLoading()
 					uni.$u.toast(errors[0].message)
 				})
 			},
 			changePwd(){
+				uni.showLoading({
+					title:'修改中',
+					icon:'none'
+				})
 				this.$refs.Form2.validate().then(() => {
 					savePassword(this.pwdForm.oldpwd,this.pwdForm.newpwd).then(res=>{
-						console.log(res)
+						// console.log(res)
+						uni.hideLoading()
+						uni.$u.toast("修改成功!")
+						that.pwdForm = {
+							oldpwd:"",
+							newpwd:"",
+							surepwd:""
+						}
 					})
 				}).catch(errors => {
+					uni.hideLoading()
 					uni.$u.toast(errors[0].message)
 				})
 			},
-			toLogout(){
-				console.log("退出登录")
-			},
 			initInfo(){
 				const that = this
 				getInfo().then(res=>{

File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/dev/.sourcemap/mp-weixin/pages/menus/mine/mine.js.map


File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/dev/mp-weixin/pages/menus/mine/mine.js


File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/dev/mp-weixin/pages/menus/mine/mine.wxml


Some files were not shown because too many files changed in this diff