Commit b15bd44f by shibukun

设置

parent af5481aa
......@@ -62,6 +62,27 @@
"enablePullDownRefresh": false
}
}, {
"path": "setting/setting",
"style": {
"navigationBarTitleText": "设置",
"enablePullDownRefresh": false
}
}, {
"path": "VertifyPhone/VertifyPhone",
"style": {
"navigationBarTitleText": "验证手机号",
"enablePullDownRefresh": false
}
}, {
"path": "SetPwd/SetPwd",
"style": {
"navigationBarTitleText": "设置支付密码",
"enablePullDownRefresh": false
}
}
]
}],
......
......@@ -59,6 +59,7 @@ export default {
this.name = res.data.staffName;
this.integralCount = res.data.allIntegral;
this.isLogin = true
this.$store.commit('refreshUserInfo', res.data)
} else {
this.isLogin = false
}
......
......@@ -55,7 +55,7 @@
</view>
<image class="right-arrow" src="../../static/arrow-right.png" mode=""></image>
</view>
<view class="item last-item">
<view class="item last-item" @click="setting">
<view class="left">
<image class="left-img" src="../../static/setting.png" mode=""></image>
<view class="title">设置</view>
......@@ -102,6 +102,9 @@
}
});
},
setting() {
this.$router.push('Setting')
}
}
}
</script>
......
<template>
<view class="layout">
<view class="title">支付密码</view>
<input class="input" placeholder="请输入6位数字支付密码" type="number" v-model="pwd" maxlength="6"/>
<view class="title">再次输入</view>
<input class="input" placeholder="再次输入上方相同的支付密码" type="number" v-model="pwdSecond" maxlength="6" />
<view :class="pwd.length == 6 && pwdSecond.length == 6 ? 'submit1' : 'submit'" @click="submit">提交</view>
</view>
</template>
<script>
export default {
data() {
return {
pwd: '',
pwdSecond: '',
randomCode: ''
}
},
onLoad(option) {
this.randomCode = option.randomCode ? option.randomCode : ''
},
methods: {
submit() {
if (this.pwd !== this.pwdSecond) {
this.toast('请输入相同密码')
return
}
this.$net.post('/staff/password/setting', {from: 'my', pwd: this.pwd, randomCode: this.randomCode})
.then(res => {
if (res.code == 200) {
this.$router.pop()
} else {
this.toast(res.message)
}
})
.catch(err => {
this.toast(err)
})
}
}
}
</script>
<style lang="scss" scoped>
.layout {
width: 100%;
height: 100%;
position: absolute;
background: #ffffff;
.title {
font-size: 32rpx;
font-weight: bolder;
color: #333333;
line-height: 48rpx;
margin-top: 80rpx;
padding-left: 49rpx;
padding-right: 49rpx;
}
.input {
outline: none;
border-bottom: solid 2rpx #FF0520;
font-size: 32rpx;
margin-top: 49rpx;
margin-left: 49rpx;
margin-right: 49rpx;
padding-bottom: 29rpx;
}
.submit {
width: 590rpx;
height: 96rpx;
background: #FF0520;
opacity: 0.5;
border-radius: 48rpx;
font-size: 32rpx;
color: #FFFFFF;
line-height: 96rpx;
text-align: center;
margin: 120rpx auto;
}
.submit1 {
width: 590rpx;
height: 96rpx;
background: #FF0520;
border-radius: 48rpx;
font-size: 32rpx;
color: #FFFFFF;
line-height: 96rpx;
text-align: center;
margin: 120rpx auto;
}
}
</style>
<template>
<view class="layout">
<view class="first-line">请完成以下认证</view>
<view class="sencond-line">请输入{{ phone }}收到的短信验证码</view>
<view class="code-layout">
<input class="input" placeholder="请输入短信验证码" v-model="code" type="number" maxlength="8" />
<text class="vertify-code" @click="getCode()">{{ verifyCode }}</text>
</view>
<view :class="code.length > 0 ? 'submit1' : 'submit'" @click="submit">下一步</view>
</view>
</template>
<script>
export default {
data() {
return {
phone: this.$store.state.userInfo.mobile.substring(0, 3) + '****' + this.$store.state.userInfo.mobile.substring(7, 11),
verifyCode: '获取验证码',
verifyTime: 300,
code: ''
};
},
onLoad() {
console.log(this.$store.state.userInfo.mobile);
},
methods: {
getCode() {
if (this.verifyTime !== 300) {
return;
}
this.$net
.post('/meta/sms', { codeType: 20, mobile: this.$store.state.userInfo.mobile })
.then(res => {
if (res.code == 200) {
this.toast('验证码发送成功');
this.startTime();
} else {
this.toast(res.messaage);
}
})
.catch(err => {
this.toast(err);
console.log(err);
});
},
// 开始倒计时
startTime() {
if (this.verifyTime !== 300) {
return;
}
this.verifyCode = this.verifyTime + 's';
const timer = setInterval(() => {
this.verifyTime--;
if (this.verifyTime > 0) {
this.verifyCode = this.verifyTime + 's';
} else {
this.verifyCode = '重新发送';
this.verifyTime = 300;
clearInterval(timer);
}
}, 1000);
},
submit() {
this.$net.post('/staff/password/change', {code: this.code})
.then(res => {
console.log(res)
if (res.code == 200) {
this.$router.replaceTo('SetPwd', {randomCode: res.data.randomCode})
}
})
.catch(err => {
})
}
}
};
</script>
<style lang="scss" scoped>
.layout {
width: 100%;
height: 100%;
background: #ffffff;
.first-line {
font-size: 36rpx;
font-weight: bolder;
color: #333333;
line-height: 48rpx;
margin: 80rpx 49rpx 0 49rpx;
}
.sencond-line {
font-size: 26rpx;
color: #333333;
line-height: 48rpx;
margin: 29rpx 49rpx 0 49rpx;
}
.code-layout {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
margin: 29rpx 49rpx 0 49rpx;
border-bottom: solid 2rpx #ff0520;
padding-bottom: 30rpx;
.input {
outline: none;
font-size: 32rpx;
font-weight: bolder;
flex: 1;
}
.vertify-code {
font-size: 32rpx;
color: #ff0520;
line-height: 48rpx;
}
}
.submit {
width: 590rpx;
height: 96rpx;
background: #ff0520;
opacity: 0.5;
border-radius: 48rpx;
font-size: 32rpx;
color: #ffffff;
line-height: 96rpx;
text-align: center;
margin: 120rpx auto;
}
.submit1 {
width: 590rpx;
height: 96rpx;
background: #ff0520;
border-radius: 48rpx;
font-size: 32rpx;
color: #ffffff;
line-height: 96rpx;
text-align: center;
margin: 120rpx auto;
}
}
</style>
<template>
<view class="layout">
<view class="item" @click="changePwd">
<text class="item-title">设置支付密码</text>
<view>
<text v-if="hasPwd" class="already-set">已设置</text>
<image class="item-right-row" src="../../static/arrow-right.png"></image>
</view>
</view>
<view class="item">
<text class="item-title" @click="changeAccount">切换账号</text>
<image class="item-right-row" src="../../static/arrow-right.png"></image>
</view>
<view class="item1">
<text class="item-quit" @click="quit">退出账号</text>
</view>
</view>
</template>
<script>
export default {
data() {
return {
hasPwd: this.$store.state.userInfo.settingCheckCode === 1
}
},
methods: {
changePwd() {
if (this.hasPwd) {
this.$router.push('VertifyPhone')
return
}
this.$router.push('SetPwd')
},
changeAccount() {
},
quit() {
}
}
}
</script>
<style lang="scss" scoped>
.layout {
width: 100%;
height: 100%;
background: #f5f5f5;
padding-top: 20rpx;
position: absolute;
.item {
background: #ffffff;
height: 107rpx;
margin-top: 2rpx;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 0 30rpx;
.item-title {
font-size: 30rpx;
color: #333333;
line-height: 85rpx;
}
.already-set {
font-size: 30rpx;
color: #333333;
line-height: 85px;
margin-right: 30rpx;
}
.item-right-row {
width: 12rpx;
height: 20rpx;
}
}
.item1 {
background: #ffffff;
height: 107rpx;
margin-top: 99rpx;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
width: 100%;
.item-quit {
font-size: 30rpx;
color: #333333;
line-height: 107rpx;
text-align: center;
width: 100%;
}
}
}
</style>
......@@ -7,7 +7,10 @@ const routers = {
'Mine': '/pages/mine/mine',
'SelectAccount': '/pagesA/selectAccount/selectAccount',
'GoodSkuList': '/pagesA/GoodSkuList/GoodSkuList',
'IntegralDetail': '/pagesA/integralDetail/integralDetail'
'IntegralDetail': '/pagesA/integralDetail/integralDetail',
'Setting': '/pagesA/setting/setting',
'VertifyPhone': '/pagesA/VertifyPhone/VertifyPhone',
'SetPwd': '/pagesA/SetPwd/SetPwd'
}
export function push(routerName, params, events) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment