Files
h5-uniapp/pages/my/safety/password.vue
T
li 5f40e4e1b5 feat: 前端全量更新 - 含所有本次需求
- 移除秒合约页面及UI
- 合约页Tab改为Position Held/Transaction Record
- 存款/提款/转账页增加BTC/ETH
- 资产页重构(用户信息+盈亏+多语言)
- 注册页改版(匹配新设计稿)
- 日文全面翻译+首页菜单多语言
- 代理专属注册链接支持(?code=)
- 10个locale文件同步更新
2026-03-30 20:14:20 +08:00

320 lines
7.9 KiB
Vue

<template>
<view :style="'background-color: '+theme.bg+';color: '+theme.text" style="height: 100vh;">
<myNav :title="i18n.mine.safety.logpwd"></myNav>
<!-- tab选择 -->
<view class="padding-w-40">
<view class="height-52 flex align-center justify-between">
<view @click="tabsChange(index)" class="flex-1 height-52 flex align-center justify-center"
v-for="(item,index) in tablist" :key="index">
<text :class="current==index?'':'color-C3C3C3'"
class="bold-font font-30">{{item}}</text>
</view>
</view>
<view class="height-20 relative">
<view :style="current==0?'left: 142rpx;':'left: 482rpx;'" class="heng"></view>
</view>
</view>
<view v-if="current==0" class="listBox">
<view class="width-100b height-96 line-height-96">
<text class="font-30 bold-font">{{i18n.mine.safety.email}}</text>
</view>
<view class="width-100b height-96 line-height-96">
<text class="font-30 numbold-font color-999999">{{email||i18n.mine.safety.nobangding}}</text>
</view>
</view>
<view v-if="current==1" class="listBox">
<view class="width-100b height-96 line-height-96">
<text class="font-30 bold-font">{{i18n.mine.safety.mobile}}</text>
</view>
<view class="width-100b height-96 flex align-center">
<view class="width-80 height-46 flex align-center justify-center" style="border: 1rpx solid #3ECEB2;border-radius: 6rpx;">
<text class="font-30 numbold-font">+{{seleCountry.value}}</text>
</view>
<text class="font-30 numbold-font color-999999">{{phone||i18n.mine.safety.nobangding}}</text>
</view>
</view>
<view class="listBox">
<view class="width-100b height-96 line-height-96">
<text class="font-30 bold-font">{{i18n.mine.safety.code}}</text>
</view>
<view class="width-100b height-96 flex align-center justify-between">
<input class="flex-1 height-96 font-30 numbold-font" type="text" v-model="captcha"
:placeholder="i18n.mine.safety.codeTag" />
<text @click="cutTime()" class="font-30 bold-font color-0165EE">{{codeText}}</text>
</view>
</view>
<view class="listBox">
<view class="width-100b height-96 line-height-96">
<text class="font-30 bold-font">{{i18n.mine.safety.logpwd1}}</text>
</view>
<view class="width-100b height-96">
<input class="width-100b height-96 font-30" type="text" v-model="pwd1" password
:placeholder="i18n.mine.safety.lp1" />
</view>
</view>
<view class="listBox">
<view class="width-100b height-96 line-height-96">
<text class="font-30 bold-font">{{i18n.mine.safety.logpwd2}}</text>
</view>
<view class="width-100b height-96">
<input class="width-100b height-96 font-30" type="text" v-model="pwd2" password
:placeholder="i18n.mine.safety.lp2" />
</view>
</view>
<button @click="forgot" class="cu-btn loginBtn">{{i18n.mine.safety.queren}}</button>
<u-picker @columnchange="change" @confirm="selectCountry" v-model="countryType" mode="selector" range-key="name"
:range="rangelist" :confirm-text="i18n.cycle.confirm" :cancel-text="i18n.cycle.cancel"
:kaiqiChina="kaiqiChina"></u-picker>
</view>
</template>
<script>
import {
country
} from '../../../components/country.js'
export default {
data() {
return {
current: 0,
tablist: ['邮箱', '电话'],
countryType: false,
rangelist: country,
seleCountry: {
value:''
},
phone: '',
email: '',
pwd1: '',
pwd2: '',
captcha: '',
kaiqiChina: true,
flag: true,
time: '获取验证码',
timeFlag: true,
theme:''
}
},
computed: {
i18n() {
return this.$t('message');
},
codeText() {
if (this.time > 0) {
return this.time + " s"
} else {
return this.i18n.mine.safety.get
}
}
},
onLoad() {
// this.seleCountry = this.rangelist[0]
this.tablist = this.i18n.mine.safety.tablist
this.getUserinfo()
},
onShow() {
if (uni.getStorageSync("theme") == "dark") {
this.theme = this.$store.state.darkTheme
} else {
this.theme = this.$store.state.lightTheme
}
},
methods: {
change(index) {
// console.log(index)
if (index == 1) {
this.kaiqiChina = false
} else {
this.kaiqiChina = true
}
},
getUserinfo() {
this.post('/my/get_userinfo').then((res) => {
console.log('用户信息', res)
if (res.code == 1) {
this.phone = res.data.mobile
this.email = res.data.email
this.seleCountry.value = res.data.m_prefix
}
})
},
selectCountry(index) {
console.log(index)
this.seleCountry = this.rangelist[index]
},
// tabs通知swiper切换
tabsChange(index) {
this.current = index;
},
forgot() {
if (!this.flag) return
if (this.captcha == '') {
this.tos(this.i18n.mine.safety.codeTag)
return
}
if (this.pwd1 == '') {
this.tos(this.i18n.mine.safety.lp1)
return
}
if (this.pwd2 == '') {
this.tos(this.i18n.mine.safety.lp2)
return
}
if (this.pwd2 !== this.pwd1) {
this.tos(this.i18n.mine.safety.lp3)
return
}
uni.showLoading({
title: this.i18n.mine.safety.loading,
mask: true
})
var obj = {}
if (this.current == 0) {
obj = {
newpassword: this.pwd2,
captcha: this.captcha,
types: 'pwd',
type: 'email'
}
}
if (this.current == 1) {
obj = {
newpassword: this.pwd2,
captcha: this.captcha,
types: 'pwd',
type: 'mobile'
}
}
this.flag = false
this.post('/user/xiugaipwd', obj).then(res => {
console.log(res)
uni.hideLoading()
this.flag = true
if (res.code == 1) {
this.tos(res.msg)
setTimeout(() => {
uni.reLaunch({
url: '/pages/login/index'
})
}, 500)
}
})
},
cutTime() {
if (!this.timeFlag) return
if (this.current == 0) {
if (this.email == "") {
this.tos(this.i18n.mine.safety.nobangding)
return
}
uni.showLoading({
title: this.i18n.regist.loading,
mask: true
})
this.timeFlag = false
this.post('/ems/send', {
email: this.email,
event: "resetpwd",
}).then(res => {
uni.hideLoading()
if (res.code == 1) {
this.tos(res.msg)
this.time = 120
var that = this
let timeName = setInterval(() => {
if (that.time > 0) {
that.time--
} else {
that.time = 0
that.timeFlag = true
clearInterval(timeName)
}
}, 1000)
} else {
this.timeFlag = true
}
})
}
if (this.current == 1) {
if (this.phone == "") {
this.tos(this.i18n.mine.safety.nobangding)
return
}
uni.showLoading({
title: this.i18n.regist.loading,
mask: true
})
this.timeFlag = false
this.post('/sms/send', {
mobile: this.phone,
m_prefix:this.seleCountry.value,
event: "resetpwd",
}).then(res => {
uni.hideLoading()
if (res.code == 1) {
this.tos(res.msg)
this.time = 60
var that = this
let timeName = setInterval(() => {
if (that.time > 0) {
that.time--
} else {
that.time = 0
that.timeFlag = true
clearInterval(timeName)
}
}, 1000)
} else {
this.timeFlag = true
}
})
}
}
}
}
</script>
<style>
.listBox {
width: 100%;
/* height: 96rpx; */
padding: 0 45rpx;
margin-bottom: 1rpx;
/* background-color: #FFFFFF; */
}
.loginBtn {
width: 600rpx;
height: 96rpx;
background: linear-gradient(180deg, #52F3C9 0%, #3ECEB2 100%) !important;
border-radius: 12rpx;
line-height: 96rpx;
color: #FFFFFF;
font-size: 32rpx;
text-align: center;
position: absolute;
bottom: 5%;
left: 50%;
margin-left: -300rpx;
}
.heng {
width: 48rpx;
height: 4rpx;
background: linear-gradient(180deg, #52F3C9 0%, #3ECEB2 100%) !important;
position: absolute;
top: 10rpx;
transition: all 0.5s;
}
</style>