版本1.2.3
This commit is contained in:
115
pages/setup/changePhone/auth.vue
Normal file
115
pages/setup/changePhone/auth.vue
Normal file
@@ -0,0 +1,115 @@
|
||||
<template>
|
||||
<view class="page-content my-bg">
|
||||
<cu-custom :isBack="true" class="main-topbar bg-main-oil" bgColor="bg-main-oil">
|
||||
<block slot="content">手机短信验证</block>
|
||||
<block slot="backText">返回</block>
|
||||
</cu-custom>
|
||||
<view class="bg-white cu-card margin-bottom-lg">
|
||||
<view class="text-gray text-lg padding-top-lg padding-bottom-lg margin-bottom margin-top-lg text-center">
|
||||
请输入 <text class="text-black">
|
||||
{{oldPhone}}
|
||||
</text> 收到的短信验证码
|
||||
</view>
|
||||
</view>
|
||||
<view class="cu-form-group padding-top-sm padding-bottom-sm">
|
||||
<view class="title text-black ">验证码</view>
|
||||
<input type="number" :maxlength="6" v-model="authCode" placeholder="填写验证码" name="input" />
|
||||
<text class="mini-left-border" :class="frozen?'text-gray':'oil-main-color'" @tap="sendMsg">{{tips}}</text>
|
||||
</view>
|
||||
<view class="padding margin-top-lg padding-top-lg">
|
||||
<button class="bg-main-oil" @tap="nextStep">下一步</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import cloudSiteApi from '@/api/cloud-site.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
oldPhone: uni.getStorageSync('oldPhone'),
|
||||
loginUser: uni.getStorageSync('loginUser'),
|
||||
auth: {},
|
||||
type: 'oldPhone',
|
||||
authCode: "",
|
||||
tips: '获取验证码',
|
||||
frozen: false // 冷却时间
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
nextStep() {
|
||||
if (this.authCode) {
|
||||
const data3 = {
|
||||
phone: this.loginUser.userPhone,
|
||||
authCode: this.authCode,
|
||||
type: this.type
|
||||
}
|
||||
cloudSiteApi.updatePhone(data3).then(res => {
|
||||
if (res.code == 20000) {
|
||||
uni.showToast({
|
||||
title: res.msg
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/setup/changePhone/changePhone',
|
||||
fail: (err) => {
|
||||
console.log(err)
|
||||
}
|
||||
})
|
||||
}, 800);
|
||||
|
||||
}
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '请输入验证码',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
},
|
||||
sendMsg() {
|
||||
if (!this.frozen) {
|
||||
const data2 = {
|
||||
phone: this.loginUser.userPhone
|
||||
}
|
||||
cloudSiteApi.updatePhoneSms(data2).then(res => {
|
||||
console.log('res', res)
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
if (res.code == 20000) {
|
||||
this.frozen = true
|
||||
let second = 60
|
||||
this.tips = `${second}秒后重发`
|
||||
setTimeout(() => {
|
||||
this.frozen = false
|
||||
clearInterval(timer)
|
||||
this.tips = `发送验证码`
|
||||
}, 1000 * 60);
|
||||
|
||||
const timer = setInterval(() => {
|
||||
second--
|
||||
if (second) {
|
||||
this.tips = `${second}秒后重发`
|
||||
} else {
|
||||
this.tips = `发送验证码`
|
||||
}
|
||||
}, 1000)
|
||||
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.mini-left-border {
|
||||
border-left: 1px solid #999;
|
||||
padding-left: 1rem;
|
||||
}
|
||||
</style>
|
||||
134
pages/setup/changePhone/changePhone.vue
Normal file
134
pages/setup/changePhone/changePhone.vue
Normal file
@@ -0,0 +1,134 @@
|
||||
<template>
|
||||
<view class="page-content ">
|
||||
<cu-custom :isBack="true" class="main-topbar bg-main-oil" bgColor="bg-main-oil">
|
||||
<block slot="content">更换手机号</block>
|
||||
<block slot="backText">返回</block>
|
||||
</cu-custom>
|
||||
<view class="boforeChange">
|
||||
<view class="solid-bottom margin-bottom-lg">
|
||||
<view class="cu-form-group padding-top-sm padding-bottom-sm">
|
||||
<view class="title text-black ">新手机号</view>
|
||||
<input type="number" :maxlength="11" v-model="newPhone" placeholder="请输入手机号" name="input" />
|
||||
</view>
|
||||
<view class="cu-form-group padding-top-sm solid-bottom padding-bottom-sm">
|
||||
<view class="title text-black ">验证码</view>
|
||||
<input type="number" :maxlength="6" v-model="authCode" placeholder="请输入验证码" name="input" />
|
||||
<text :class="frozen?'text-gray':'oil-main-color'" @tap="sendMsg">{{tips}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="margin-left padding-bottom-lg">
|
||||
<text class="cuIcon-infofill padding-right-xs text-sm oil-main-color"></text>
|
||||
<text class="text-sm text-grey">更换成功将会重新登录</text>
|
||||
</view>
|
||||
<view class="padding-xl margin-top-lg ">
|
||||
<button class="bg-main-oil margin-top-lg" @tap="nextStep">提交</button>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="afterChange">
|
||||
<view class="">
|
||||
<view class="cu-avatar xl round margin-left bg-red">
|
||||
<text class="cuIcon-roundcheck"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import cloudSiteApi from '@/api/cloud-site.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
oldPhone: uni.getStorageSync('oldPhone'),
|
||||
newPhone: '',
|
||||
loginUser: uni.getStorageSync('loginUser'),
|
||||
auth: {},
|
||||
type: 'newPhone',
|
||||
authCode: "",
|
||||
tips: '获取验证码',
|
||||
frozen: false // 冷却时间
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
nextStep() {
|
||||
if (this.authCode) {
|
||||
const data3 = {
|
||||
phone: this.newPhone,
|
||||
authCode: this.authCode,
|
||||
type: this.type
|
||||
}
|
||||
cloudSiteApi.updatePhone(data3).then(res => {
|
||||
if (res.code == 20000) {
|
||||
uni.showToast({
|
||||
title: res.msg + '请重新登录'
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.clearStorage()
|
||||
uni.reLaunch({
|
||||
url: '/pages/login/boforeLogin/boforeLogin',
|
||||
fail: (err) => {
|
||||
console.log(err)
|
||||
}
|
||||
})
|
||||
}, 1000);
|
||||
|
||||
}
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '请输入验证码',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
sendMsg() {
|
||||
if (!this.frozen) {
|
||||
if (this.newPhone) {
|
||||
|
||||
const data2 = {
|
||||
phone: this.newPhone
|
||||
}
|
||||
cloudSiteApi.updatePhoneSms(data2).then(res => {
|
||||
console.log('res', res)
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
if (res.code == 20000) {
|
||||
this.frozen = true
|
||||
let second = 60
|
||||
this.tips = `${second}秒后重发`
|
||||
setTimeout(() => {
|
||||
this.frozen = false
|
||||
clearInterval(timer)
|
||||
this.tips = `发送验证码`
|
||||
}, 1000 * 60);
|
||||
|
||||
const timer = setInterval(() => {
|
||||
second--
|
||||
if (second) {
|
||||
this.tips = `${second}秒后重发`
|
||||
} else {
|
||||
this.tips = `发送验证码`
|
||||
}
|
||||
}, 1000)
|
||||
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '请输入新手机号'
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
157
pages/setup/setPassword/setPassword.vue
Normal file
157
pages/setup/setPassword/setPassword.vue
Normal file
@@ -0,0 +1,157 @@
|
||||
<template>
|
||||
<view class="page-content">
|
||||
<cu-custom :isBack="true" class="main-topbar bg-main-oil" bgColor="bg-main-oil">
|
||||
<block slot="content">绑定星油云站</block>
|
||||
<block slot="backText">返回</block>
|
||||
</cu-custom>
|
||||
<view class=" margin radius cu-card shadow no-card padding-top padding-bottom ">
|
||||
<view class="radius ">
|
||||
<!-- <view class="cu-form-group">
|
||||
<view class="title text-black">工号</view>
|
||||
<input v-model="oilSiteNo" placeholder="请输入云站编号" name="input"></input>
|
||||
</view> -->
|
||||
<view class="cu-form-group">
|
||||
<view class="title text-black mini-label">手机号</view>
|
||||
<view class="text-right">
|
||||
{{loginUser.userPhone}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="cu-form-group">
|
||||
<input type="number" class="padding-left-xs" :maxlength="6" v-model="auth.authCode" placeholder="请输入六位数字验证码" name="input"></input>
|
||||
<text :class="frozen?'text-gray':'oil-main-color'" @tap="sendMsg">{{tips}}</text>
|
||||
</view>
|
||||
<view class="cu-form-group">
|
||||
<view class="title text-black mini-label">新密码</view>
|
||||
<input type="password" v-model="pwd" class="text-right" placeholder="请输入新密码" name="input"></input>
|
||||
</view>
|
||||
<view class="cu-form-group solid-bottom">
|
||||
<view class="title text-black mini-label">确认密码</view>
|
||||
<input type="password" v-model="authpwd" class="text-right" placeholder="请确认密码" name="input"></input>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="margin-left">
|
||||
<text class="cuIcon-infofill padding-right-xs text-sm oil-main-color"></text>
|
||||
<text class="text-sm">密码必须至少8个字符,而且同时包含字母和数字</text>
|
||||
</view>
|
||||
<view class="margin padding-top-lg margin-top-xl">
|
||||
<button class="bg-main-oil" @tap="comfirmPwd">
|
||||
确定
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import cloudSiteApi from '@/api/cloud-site.js'
|
||||
import md5 from 'js-md5'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
tips: '发送验证码',
|
||||
frozen: false, // 验证码冷却时间
|
||||
auth: {
|
||||
|
||||
},
|
||||
loginUser: uni.getStorageSync('loginUser')
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 确认修改
|
||||
comfirmPwd() {
|
||||
if (!this.auth.authCode) {
|
||||
uni.showToast({
|
||||
title: '请输入验证码',
|
||||
icon: "none"
|
||||
});
|
||||
return false
|
||||
}
|
||||
if (!this.pwd) {
|
||||
uni.showToast({
|
||||
title: '请输入新密码',
|
||||
icon: "none"
|
||||
});
|
||||
return false
|
||||
}
|
||||
|
||||
if (!this.authpwd) {
|
||||
uni.showToast({
|
||||
title: '请确认新密码',
|
||||
icon: "none"
|
||||
});
|
||||
return false
|
||||
}
|
||||
if (this.authpwd.length < 8) {
|
||||
uni.showToast({
|
||||
title: '密码至少8个字符',
|
||||
icon: "none"
|
||||
});
|
||||
return false
|
||||
}
|
||||
if (this.pwd === this.authpwd) {
|
||||
const data3 = {
|
||||
phone: this.loginUser.userPhone,
|
||||
authCode: this.auth.authCode,
|
||||
oldPassword: md5(this.pwd),
|
||||
newPassword: md5(this.authpwd)
|
||||
}
|
||||
cloudSiteApi.setPassword(data3).then(res => {
|
||||
if (res.code == 20000) {
|
||||
uni.showToast({
|
||||
title: res.msg
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1500);
|
||||
}
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '两次输入密码不一致'
|
||||
})
|
||||
}
|
||||
},
|
||||
sendMsg() {
|
||||
if (!this.frozen) {
|
||||
const data2 = {
|
||||
phone: this.loginUser.userPhone
|
||||
}
|
||||
cloudSiteApi.sendPwdSms(data2).then(res => {
|
||||
console.log('res', res)
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
if (res.code == 20000) {
|
||||
this.frozen = true
|
||||
let second = 60
|
||||
this.tips = `${second}秒后重发`
|
||||
setTimeout(() => {
|
||||
this.frozen = false
|
||||
clearInterval(timer)
|
||||
this.tips = `发送验证码`
|
||||
}, 1000 * 60);
|
||||
|
||||
const timer = setInterval(() => {
|
||||
second--
|
||||
if (second) {
|
||||
this.tips = `${second}秒后重发`
|
||||
} else {
|
||||
this.tips = `发送验证码`
|
||||
}
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.shadow {
|
||||
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
</style>
|
||||
160
pages/setup/setup.vue
Normal file
160
pages/setup/setup.vue
Normal file
@@ -0,0 +1,160 @@
|
||||
<template>
|
||||
<view class="page-content bg-white">
|
||||
<cu-custom class="main-totextbar bg-main-oil" bgColor="bg-main-oil">
|
||||
<block slot="content">个人中心</block>
|
||||
</cu-custom>
|
||||
<view class="bg-img flex align-center" :style="'background-image: url('+mainURL+'user-info-bg.png);height:250upx;width:750upx'">
|
||||
<view class="position-re card-view">
|
||||
<view class="position-ab">
|
||||
<view class="cu-list text-white menu-avatar padding bg-transparent no-border">
|
||||
<view class="cu-item bg-transparent no-border">
|
||||
<view class="cu-avatar round xl " :style="'background-image: url('+mainURL+'default-avator.png)'">
|
||||
|
||||
</view>
|
||||
<view class="content padding-left">
|
||||
<view class="">{{userInfo.cUserName}}</view>
|
||||
<view class=" text-sm flex">
|
||||
<view class="text-cut">
|
||||
<!-- <text class="cuIcon-infofill text-red margin-right-xs"></text> -->
|
||||
{{userInfo.cUserId}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="cu-tag round bg-dark-main-color sm "> <text class="text-sm"> {{userInfo.phone}}</text></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cu-list menu padding padding-top-lg bg-white">
|
||||
<view class="cu-item arrow">
|
||||
<view class="content">
|
||||
<text class="color-000">所属油站</text>
|
||||
</view>
|
||||
<view class="action" @tap="routerTo('/pages/station-info/station-info')">
|
||||
<text class="text-grey text-sm">{{userInfo.cSiteName}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="cu-item arrow" @tap="changePhone">
|
||||
<view class="content">
|
||||
<text class="color-000">手机号码</text>
|
||||
</view>
|
||||
<view class="action">
|
||||
<text class="text-grey text-sm">更换手机号</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
<view class="cu-item arrow" @tap="setpwd">
|
||||
<view class="content">
|
||||
<text class="color-000">登录密码</text>
|
||||
</view>
|
||||
<view class="action">
|
||||
<text class="text-grey text-sm">修改密码</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="cu-item arrow">
|
||||
<view class="content">
|
||||
<text class="color-000">版本号</text>
|
||||
</view>
|
||||
<view class="action">
|
||||
<text class="text-grey text-sm">1.2.3</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="cu-item arrow" @tap="loginOut">
|
||||
<view class="content">
|
||||
<text class="color-000">退出登录</text>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import cloudSiteApi from '@/api/cloud-site.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
mainURL: this.global.mainURL,
|
||||
userInfo: {}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getInfo()
|
||||
},
|
||||
methods: {
|
||||
changePhone() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/setup/changePhone/auth',
|
||||
fail: (err) => {
|
||||
console.log(err)
|
||||
}
|
||||
})
|
||||
},
|
||||
loginOut() {
|
||||
uni.clearStorage()
|
||||
uni.reLaunch({
|
||||
url: '/pages/login/boforeLogin/boforeLogin'
|
||||
})
|
||||
},
|
||||
getInfo() {
|
||||
cloudSiteApi.personCenter().then(res => {
|
||||
if (res.code == 20000) {
|
||||
this.userInfo = res.data
|
||||
uni.setStorageSync('oldPhone', res.data.phone)
|
||||
}
|
||||
})
|
||||
},
|
||||
setpwd() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/setup/setPassword/setPassword',
|
||||
fail: (err) => {
|
||||
console.log(err)
|
||||
}
|
||||
})
|
||||
},
|
||||
routerTo(url) {
|
||||
uni.navigateTo({
|
||||
url: url
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.cu-list+.cu-list {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.page-content {
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
.card-view {
|
||||
height: 250upx;
|
||||
width: 750upx;
|
||||
}
|
||||
|
||||
.position-ab {
|
||||
width: 750upx;
|
||||
top: 20upx;
|
||||
}
|
||||
|
||||
.bg-dark-main-color {
|
||||
background-color: #D30000;
|
||||
}
|
||||
|
||||
/* 去边框 */
|
||||
.bg-img .cu-list.menu-avatar>.cu-item::after,
|
||||
.bg-img .cu-list.menu>.cu-item::after {
|
||||
border-bottom: 0;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user