4 changed files with 233 additions and 137 deletions
@ -1,136 +1,151 @@ |
|||
<template> |
|||
<view> |
|||
<view class="formBox"> |
|||
<uni-forms :modelValue="addForm" ref="addForm" validateTrigger="bind" :rules="rules" label-width="160rpx" label-align="right"> |
|||
<uni-forms-item label="手机号" required name="mobile"> |
|||
<uni-easyinput type="text" v-model="addForm.mobile" placeholder="请输入登录手机号" /> |
|||
</uni-forms-item> |
|||
<uni-forms-item label="原密码" required name="password"> |
|||
<uni-easyinput type="password" v-model="addForm.password" placeholder="请输入原登录密码" /> |
|||
</uni-forms-item> |
|||
<uni-forms-item label="新密码" required name="password"> |
|||
<uni-easyinput type="password" v-model="addForm.newPass" placeholder="请输入新登录密码" /> |
|||
</uni-forms-item> |
|||
<uni-forms-item label="密码确认" required name="confirm"> |
|||
<uni-easyinput type="password" v-model="addForm.confirm" placeholder="请输入新登录密码" /> |
|||
</uni-forms-item> |
|||
</uni-forms> |
|||
<view class="tui-tabbar"> |
|||
<u-button type="primary" shape="circle" @tap.stop="onFormSubmit">确定</u-button> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view> |
|||
<view class="formBox"> |
|||
<uni-forms :modelValue="addForm" ref="addForm" validateTrigger="bind" :rules="rules" label-width="160rpx" |
|||
label-align="right"> |
|||
<uni-forms-item label="手机号" required name="mobile"> |
|||
<uni-easyinput type="text" v-model="addForm.mobile" placeholder="请输入登录手机号" /> |
|||
</uni-forms-item> |
|||
<uni-forms-item label="原密码" required name="password"> |
|||
<uni-easyinput type="password" v-model="addForm.password" placeholder="请输入原登录密码" /> |
|||
</uni-forms-item> |
|||
<uni-forms-item label="新密码" required name="password"> |
|||
<uni-easyinput type="password" v-model="addForm.newPass" placeholder="请输入新登录密码" /> |
|||
</uni-forms-item> |
|||
<uni-forms-item label="密码确认" required name="confirm"> |
|||
<uni-easyinput type="password" v-model="addForm.confirm" placeholder="请输入新登录密码" /> |
|||
</uni-forms-item> |
|||
</uni-forms> |
|||
<view class="tui-tabbar"> |
|||
<u-button type="primary" shape="circle" @tap.stop="onFormSubmit">确定</u-button> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import { |
|||
mapState |
|||
} from 'vuex'; |
|||
export default { |
|||
name:"shopInfo", |
|||
computed: mapState([ 'userId','mobile' ]), |
|||
data() { |
|||
return { |
|||
addForm: { |
|||
mobile: '', |
|||
password: '', |
|||
confirm:'', |
|||
newPass:'' |
|||
}, |
|||
userId:'', |
|||
shopList:[], |
|||
rules:{ |
|||
mobile:{ |
|||
rules:[{required:true,errorMessage:'手机号不能为空'}] |
|||
}, |
|||
password:{ |
|||
rules:[{required:true,errorMessage:'密码不能为空'}] |
|||
}, |
|||
confirm:{ |
|||
rules:[{required:true,errorMessage:'确认密码不能为空'}] |
|||
}, |
|||
} |
|||
} |
|||
}, |
|||
onLoad(options) { |
|||
this.userId = uni.getStorageSync('id') |
|||
this.addForm.mobile = this.mobile |
|||
}, |
|||
methods:{ |
|||
onFormSubmit() { |
|||
if (this.addForm.confirm !== this.addForm.newPass)return this.tui.toast('两次密码不一致', 2000,) |
|||
this.$refs.addForm.validate().then(async () => { |
|||
this.tui.request("/user/modifyPassAndMobile", "post", { |
|||
mobile: this.addForm.mobile, |
|||
password:this.addForm.password, |
|||
newPass:this.addForm.newPass, |
|||
userId:this.userId |
|||
}, false, true).then((res) => { |
|||
if (res.code == 200) { |
|||
this.tui.toast("修改手机号密码成功!") |
|||
setTimeout(() => { |
|||
uni.reLaunch({ |
|||
url: '/pages/index/index' |
|||
}) |
|||
}, 200) |
|||
}else { |
|||
this.tui.toast(res.message) |
|||
} |
|||
}) |
|||
}) |
|||
} |
|||
} |
|||
} |
|||
import { |
|||
mapState |
|||
} from 'vuex'; |
|||
export default { |
|||
name: "shopInfo", |
|||
computed: mapState(['userId', 'mobile']), |
|||
data() { |
|||
return { |
|||
addForm: { |
|||
mobile: '', |
|||
password: '', |
|||
confirm: '', |
|||
newPass: '' |
|||
}, |
|||
userId: '', |
|||
shopList: [], |
|||
rules: { |
|||
mobile: { |
|||
rules: [{ |
|||
required: true, |
|||
errorMessage: '手机号不能为空' |
|||
}] |
|||
}, |
|||
password: { |
|||
rules: [{ |
|||
required: true, |
|||
errorMessage: '密码不能为空' |
|||
}] |
|||
}, |
|||
confirm: { |
|||
rules: [{ |
|||
required: true, |
|||
errorMessage: '确认密码不能为空' |
|||
}] |
|||
}, |
|||
} |
|||
} |
|||
}, |
|||
onLoad(options) { |
|||
this.userId = uni.getStorageSync('id') |
|||
this.addForm.mobile = this.mobile |
|||
}, |
|||
methods: { |
|||
onFormSubmit() { |
|||
if(this.addForm.mobile == '' &&this.addForm.newPass == ''){ |
|||
this.tui.toast("不能为空") |
|||
return; |
|||
} |
|||
if (this.addForm.confirm !== this.addForm.newPass) return this.tui.toast('两次密码不一致', 2000, ) |
|||
// this.$refs.addForm.validate().then(async () => { |
|||
this.tui.request("/user/modifyPassAndMobile", "post", { |
|||
mobile: this.addForm.mobile, |
|||
password: this.addForm.password, |
|||
newPass: this.addForm.newPass, |
|||
userId: this.userId |
|||
}, false, true).then((res) => { |
|||
if (res.code == 200) { |
|||
this.tui.toast("修改成功!") |
|||
setTimeout(() => { |
|||
uni.reLaunch({ |
|||
url: '/pages/login/login' |
|||
}) |
|||
}, 200) |
|||
} else { |
|||
this.tui.toast(res.message) |
|||
} |
|||
}) |
|||
// }) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.popup-height { |
|||
padding: 0 25upx; |
|||
background-color: #fff; |
|||
} |
|||
.formBox { |
|||
margin: 20rpx; |
|||
padding: 20rpx 26rpx; |
|||
border-radius: 14rpx; |
|||
box-shadow: 0px 1px 10px 2px #e2e2e2; |
|||
background-color: #fff; |
|||
.popup-height { |
|||
padding: 0 25upx; |
|||
background-color: #fff; |
|||
} |
|||
|
|||
.uni-data-select { |
|||
width: 100%; |
|||
} |
|||
.formBox { |
|||
margin: 20rpx; |
|||
padding: 20rpx 26rpx; |
|||
border-radius: 14rpx; |
|||
box-shadow: 0px 1px 10px 2px #e2e2e2; |
|||
background-color: #fff; |
|||
|
|||
.tui-order-title { |
|||
position: relative; |
|||
font-size: 28upx; |
|||
line-height: 28upx; |
|||
padding-left: 16upx; |
|||
box-sizing: border-box; |
|||
} |
|||
.uni-data-select { |
|||
width: 100%; |
|||
} |
|||
|
|||
.tui-order-title::before { |
|||
content: ''; |
|||
position: absolute; |
|||
left: 0; |
|||
top: 0; |
|||
border-left: 8upx solid $u-primary; |
|||
height: 120%; |
|||
border-radius: 4upx; |
|||
} |
|||
} |
|||
.tui-order-title { |
|||
position: relative; |
|||
font-size: 28upx; |
|||
line-height: 28upx; |
|||
padding-left: 16upx; |
|||
box-sizing: border-box; |
|||
} |
|||
|
|||
.tui-tabbar { |
|||
width: 100%; |
|||
height: 98rpx; |
|||
background: #fff; |
|||
position: fixed; |
|||
left: 0; |
|||
bottom: 0; |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: flex-end; |
|||
font-size: 26rpx; |
|||
box-shadow: 0 0 1px rgba(0, 0, 0, .3); |
|||
padding-bottom: env(safe-area-inset-bottom); |
|||
z-index: 996; |
|||
} |
|||
</style> |
|||
.tui-order-title::before { |
|||
content: ''; |
|||
position: absolute; |
|||
left: 0; |
|||
top: 0; |
|||
border-left: 8upx solid $u-primary; |
|||
height: 120%; |
|||
border-radius: 4upx; |
|||
} |
|||
} |
|||
|
|||
.tui-tabbar { |
|||
width: 100%; |
|||
height: 98rpx; |
|||
background: #fff; |
|||
position: fixed; |
|||
left: 0; |
|||
bottom: 0; |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: flex-end; |
|||
font-size: 26rpx; |
|||
box-shadow: 0 0 1px rgba(0, 0, 0, .3); |
|||
padding-bottom: env(safe-area-inset-bottom); |
|||
z-index: 996; |
|||
} |
|||
</style> |
|||
Loading…
Reference in new issue