ReedawFoodApp/body/setting/password.vue

238 lines
5.0 KiB
Vue
Raw Normal View History

2026-03-23 16:23:40 +08:00
<template>
<view class="content">
<view class="login">
<view class="editem">
<view class="item">
2026-03-31 16:04:41 +08:00
<view class="text">{{$t("infoEmail")}}</view>
2026-03-23 16:23:40 +08:00
<view class="input">
2026-03-31 16:04:41 +08:00
<input v-model="phone" :placeholder="$t('verifyEmail')" />
</view>
</view>
<view class="item ">
<view class="text">{{$t("titleCode")}}</view>
<view class="input yanzhengma">
<input class="uni-input" v-model="code" />
<button class="code" type="none" @click="handleCode" v-model="code"
:disabled="disabled">{{second<60 ? second+$t("titleSendCodeRetry"):$t("titleSendCode")}}
</button>
2026-03-23 16:23:40 +08:00
</view>
</view>
<view class="item">
2026-03-31 16:04:41 +08:00
<view class="text">{{$t('titlePassword')}}</view>
2026-03-23 16:23:40 +08:00
<view class="input">
2026-03-31 16:04:41 +08:00
<input class="uni-input" v-model="password" :placeholder="$t('verifyPassword')" />
</view>
</view>
<view class="item">
<view class="text">{{$t('titleConfirmPassword')}}</view>
<view class="input">
<input class="uni-input" v-model="password2" :placeholder="$t('verifyPasswordTwo')" />
2026-03-23 16:23:40 +08:00
</view>
</view>
</view>
2026-03-31 16:04:41 +08:00
<view class="btnlogin" @click="handleTelLogin">{{$t('btnSubmit')}}</view>
2026-03-23 16:23:40 +08:00
</view>
</view>
</template>
<script>
export default {
data() {
return {
password: "",
password2: "",
2026-03-31 16:04:41 +08:00
phone: "",
code: "",
disabled: false,
second: 60,
2026-03-23 16:23:40 +08:00
}
},
2026-03-31 16:04:41 +08:00
onLoad() {
let that = this
uni.setNavigationBarTitle({
title: that.$t('titlePasswordEdit')
})
},
2026-03-23 16:23:40 +08:00
methods: {
// 登录、
handleTelLogin() {
let that = this
2026-03-31 16:04:41 +08:00
if (!(/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(that.phone))) {
that.$tools.msg(that.$t("verifyEmailCorrect"))
return
}
if (!that.code) {
that.$tools.msg(that.$t("verifyCode"))
return
}
2026-03-23 16:23:40 +08:00
if (!that.password) {
2026-03-31 16:04:41 +08:00
that.$tools.msg(that.$t('verifyPassword'))
2026-03-23 16:23:40 +08:00
return
}
if (!that.password2) {
2026-03-31 16:04:41 +08:00
that.$tools.msg(that.$t('verifyPasswordTwo'))
2026-03-23 16:23:40 +08:00
return
}
if (that.password2 != that.password) {
2026-03-31 16:04:41 +08:00
that.$tools.msg(that.$t('verifyPasswordCorrect'))
2026-03-23 16:23:40 +08:00
return
}
that.$model.getAccountPassword({
2026-03-31 16:04:41 +08:00
data: that.phone,
code: that.code,
2026-03-23 16:23:40 +08:00
password: that.password,
c_password: that.password2,
}).then(res => {
console.log("注册", res)
if (res.code != 0) {
that.$tools.msg(res.msg)
} else {
2026-03-31 16:04:41 +08:00
that.$tools.msg(that.$t('msgSetSuccess'))
2026-03-27 10:56:18 +08:00
that.$model.getloginOut({}).then((res) => {
if (res.code != 0) return
uni.setStorageSync('token', null)
uni.setStorageSync('aan_id', null)
uni.clearStorageSync()
setTimeout(function() {
uni.reLaunch({
url: "/body/login/login"
})
}, 1000)
})
2026-03-23 16:23:40 +08:00
}
}).catch(err => {})
},
2026-03-31 16:04:41 +08:00
// 获取验证码
handleCode() {
let that = this
if (!that.phone) {
that.$tools.msg(that.$t("verifyEmail"))
return
}
if (!(/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(that.phone))) {
that.$tools.msg(that.$t("verifyEmailCorrect"))
return
}
//
that.$model.getSendCode({
data: that.phone,
}).then(res => {
console.log(res)
if (res.code != 0) {
that.$tools.msg(res.msg)
return
}
that.disabled = true
let interval = setInterval(() => {
--that.second
}, 1000)
setTimeout(() => {
clearInterval(interval)
that.disabled = false
that.second = 60
}, 60000)
}).catch(err => {})
},
2026-03-23 16:23:40 +08:00
}
}
</script>
<style scoped lang="scss">
.content {
width: 100%;
height: 100vh;
2026-03-31 16:04:41 +08:00
background-color: #fff;
2026-03-23 16:23:40 +08:00
}
2026-03-31 16:04:41 +08:00
2026-03-23 16:23:40 +08:00
.login {
2026-03-31 16:04:41 +08:00
width: calc(100% - 60rpx);
2026-03-23 16:23:40 +08:00
height: auto;
background: #fff;
2026-03-31 16:04:41 +08:00
border-radius: 20rpx;
padding: 30rpx;
2026-03-23 16:23:40 +08:00
z-index: 99;
2026-03-31 16:04:41 +08:00
2026-03-23 16:23:40 +08:00
.editem {
position: relative;
display: flex;
align-items: center;
2026-03-27 10:56:18 +08:00
font-size: 28rpx;
2026-03-23 16:23:40 +08:00
justify-content: space-between;
flex-wrap: wrap;
2026-03-31 16:04:41 +08:00
2026-03-23 16:23:40 +08:00
.item {
width: 100%;
display: flex;
2026-03-31 16:04:41 +08:00
flex-wrap: wrap;
2026-03-23 16:23:40 +08:00
align-items: center;
justify-content: space-between;
2026-03-31 16:04:41 +08:00
margin-bottom: 20rpx;
2026-03-23 16:23:40 +08:00
.text {
2026-03-31 16:04:41 +08:00
width: 100%;
height: 80rpx;
line-height: 80rpx;
2026-03-23 16:23:40 +08:00
font-size: 32rpx;
2026-03-31 16:04:41 +08:00
font-weight: bold;
2026-03-23 16:23:40 +08:00
}
2026-03-31 16:04:41 +08:00
2026-03-23 16:23:40 +08:00
.input {
2026-03-31 16:04:41 +08:00
width: 100%;
2026-03-23 16:23:40 +08:00
height: 35px;
line-height: 35px;
display: flex;
position: relative;
border: #dfdfdf 1px solid;
border-radius: 5px;
2026-03-31 16:04:41 +08:00
padding: 0 20rpx;
2026-03-23 16:23:40 +08:00
background-color: #f7f7f7;
}
2026-03-31 16:04:41 +08:00
2026-03-23 16:23:40 +08:00
input {
2026-03-31 16:04:41 +08:00
height: 80rpx;
line-height: 80rpx;
2026-03-23 16:23:40 +08:00
position: absolute;
2026-03-31 16:04:41 +08:00
left: 20rpx;
2026-03-23 16:23:40 +08:00
right: 0px;
z-index: 88;
2026-03-27 10:56:18 +08:00
font-size: 28rpx;
2026-03-23 16:23:40 +08:00
}
2026-03-31 16:04:41 +08:00
.yanzhengma {
input {
right: 180px;
font-size: 32rpx;
}
}
2026-03-23 16:23:40 +08:00
}
}
2026-03-31 16:04:41 +08:00
.code {
color: #333;
position: absolute;
right: 0;
top: 0;
height: 35px;
font-size: 14px;
box-sizing: border-box;
width: 180px;
z-index: 999;
}
2026-03-23 16:23:40 +08:00
.btnlogin {
width: 100%;
2026-03-31 16:04:41 +08:00
margin: 30rpx 0;
2026-03-23 16:23:40 +08:00
height: 42px;
line-height: 42px;
background: $btncolor;
font-weight: 700;
2026-03-31 16:04:41 +08:00
border-radius: 30rpx;
2026-03-23 16:23:40 +08:00
text-align: center;
color: #fff !important;
}
}
</style>