feat:v1.4前端更新

This commit is contained in:
超凡
2025-06-24 14:43:09 +08:00
parent 0268aa5033
commit 35fec82e4a
1026 changed files with 118424 additions and 56490 deletions

View File

@@ -0,0 +1,467 @@
<template>
<view :data-theme="theme">
<form @submit="formSubmit" report-submit='true'>
<view class='personal-data pad30'>
<view class='list borRadius14'>
<view class="item acea-row row-between-wrapper">
<view>头像</view>
<!-- #ifndef MP -->
<view class="pictrue" @click.stop='uploadpic'>
<image :src='newAvatar'></image>
<image :src='editPng' class="alter"></image>
</view>
<!-- #endif -->
<!-- #ifdef MP -->
<view class="pictrue">
<button class="avatar-wrapper" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
<image class="avatar" :src="newAvatar"></image>
</button>
<image :src='editPng' class="alter"></image>
</view>
<!-- #endif -->
</view>
<view class='item acea-row row-between-wrapper'>
<view>昵称</view>
<view class='input'>
<!-- #ifndef MP -->
<input type='text' name='nickname' :value='userInfo.nickname' maxlength="20"></input>
<!-- #endif -->
<!-- #ifdef MP -->
<input type="nickname" name='nickname' :value='nickname' class="weui-input"
placeholder="请输入昵称" />
<!-- #endif -->
</view>
</view>
<view class='item acea-row row-between-wrapper'>
<view>手机号码</view>
<navigator url="/pages/users/app_login/index" hover-class="none" class="input"
v-if="!userInfo.phone">
点击绑定手机号<text class="iconfont icon-xiangyou"></text>
</navigator>
<navigator url="/pages/infos/user_phone/index" hover-class="none" class="input" v-else>
<view class='input acea-row row-between-wrapper'>
<input disabled='true' name='phone' :value='userInfo.phone'
class='id'></input>
<text class='iconfont icon-xiangyou'></text>
</view>
</navigator>
</view>
<view class='item acea-row row-between-wrapper'>
<view>ID号</view>
<view class='input acea-row row-between-wrapper'>
<input type='text' :value='uid' disabled='true' class='id'></input>
<text class='iconfont icon-suozi'></text>
</view>
</view>
<!-- #ifdef MP -->
<view class='item acea-row row-between-wrapper'>
<view>权限设置</view>
<view class="input" @click="Setting">
点击管理<text class="iconfont icon-xiangyou"></text>
</view>
</view>
<!-- #endif -->
<!-- #ifdef H5 -->
<view class="item acea-row row-between-wrapper" v-if="userInfo.phone && wechat">
<view>密码</view>
<navigator url="/pages/infos/user_pwd_edit/index" hover-class="none" class="input">
点击修改密码<text class="iconfont icon-xiangyou"></text>
</navigator>
</view>
<!-- #endif -->
<!-- #ifdef APP-PLUS -->
<view class="item acea-row row-between-wrapper" v-if="userInfo.phone">
<view>密码</view>
<navigator url="/pages/infos/user_pwd_edit/index" hover-class="none" class="input">
点击修改密码<text class="iconfont icon-xiangyou"></text>
</navigator>
</view>
<!-- #endif -->
<view class='item acea-row row-between-wrapper'>
<view>地址管理</view>
<view class="input" @click="toAddress">
立即设置<text class="iconfont icon-xiangyou"></text>
</view>
</view>
</view>
<button class='modifyBnt bg_color' formType="submit">保存修改</button>
<!-- #ifdef H5 -->
<view class="logOut cart-color acea-row row-center-wrapper" @click="outLogin"
v-if="!this.$wechat.isWeixin() || (this.$wechat.isWeixin() && publicLoginType ==2)">退出登录</view>
<!-- #endif -->
<!-- #ifdef APP-PLUS -->
<view class="logOut cart-color acea-row row-center-wrapper" @click="outLogin">退出登录</view>
<!-- #endif -->
</view>
</form>
</view>
</template>
<script>
import {
userEdit,
getLogout
} from '@/api/user.js';
import {
switchH5Login
} from '@/api/api.js';
import {
toLogin
} from '@/libs/login.js';
import {
mapGetters
} from "vuex";
import {
Debounce
} from '@/utils/validate.js'
import dayjs from "@/plugin/dayjs/dayjs.min.js";
let app = getApp();
export default {
data() {
return {
urlDomain: this.$Cache.get("imgHost"),
memberInfo: {},
loginType: 'h5', //app.globalData.loginType
userIndex: 0,
newAvatar: '',
nickname: '',
wechat: false,
theme: app.globalData.theme,
editPng: `${this.$Cache.get("imgHost")}crmebimage/perset/staticImg/alert1.png`,
publicLoginType: app.globalData.publicLoginType //公众号登录方式(单选),1微信授权2手机号登录
};
},
computed: mapGetters(['isLogin', 'uid', 'userInfo']),
onLoad() {
if (!this.isLogin) {
toLogin();
}
this.newAvatar = this.userInfo.avatar ? this.userInfo.avatar : `${this.$Cache.get("imgHost")}crmebimage/perset/staticImg/f.png`;
this.nickname = this.userInfo.nickname ? this.userInfo.nickname : '-';
// #ifdef H5
let ua = navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == "micromessenger") {
this.$set(this, 'wechat', false);
} else {
this.$set(this, 'wechat', true);
}
// #endif
switch (this.theme) {
case 'theme2':
this.editPng = `${this.$Cache.get("imgHost")}crmebimage/perset/staticImg/alert2.png`
break;
case 'theme3':
this.editPng = `${this.$Cache.get("imgHost")}crmebimage/perset/staticImg/alert3.png`
break;
case 'theme4':
this.editPng = `${this.$Cache.get("imgHost")}crmebimage/perset/staticImg/alert4.png`
break;
case 'theme5':
this.editPng = `${this.$Cache.get("imgHost")}crmebimage/perset/staticImg/alert5.png`
break;
default:
this.editPng = `${this.$Cache.get("imgHost")}crmebimage/perset/staticImg/alert1.png`
break;
}
},
methods: {
//to地址
toAddress(){
uni.navigateTo({
url:'/pages/users/user_address_list/index'
})
},
/**
* 小程序端上传头像
*
*/
onChooseAvatar(e) {
const {
avatarUrl
} = e.detail
uni.showLoading({
title: '加载中...'
});
this.$util.uploadImgs(avatarUrl, {
url: 'upload/image',
name: 'multipart',
model: "user",
pid: 7
}, (res) => {
this.newAvatar = res.data.url;
uni.hideLoading();
}, (err) => {
uni.hideLoading();
})
},
/**
* 小程序设置
*/
Setting: function() {
uni.openSetting({
success: function(res) {
console.log(res.authSetting)
}
});
},
/**
* 退出登录
*
*/
outLogin: function() {
let that = this;
if (that.loginType == 'h5') {
uni.showModal({
title: '提示',
content: '确认退出登录?',
success: function(res) {
if (res.confirm) {
uni.showLoading({
title: '加载中...'
})
getLogout()
.then(res => {
that.$store.commit("LOGOUT");
uni.hideLoading();
uni.reLaunch({
url: '/pages/index/index'
});
})
.catch(err => {
uni.hideLoading();
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
}
},
/**
* 上传文件
*
*/
uploadpic: function() {
let that = this;
that.$util.uploadImageOne({
url: 'upload/image',
name: 'multipart',
model: "user",
pid: 7
}, function(res) {
that.newAvatar = res.data.url;
});
},
/**
* 提交修改
*/
formSubmit: Debounce(function(e) {
let that = this,
value = e.detail.value
if (!value.nickname) return that.$util.Tips({
title: '用户姓名不能为空'
});
value.avatar = that.newAvatar ? that.newAvatar : that.userInfo.avatar;
userEdit(value).then(res => {
that.$store.commit("changInfo", {
amount1: 'avatar',
amount2: that.newAvatar
});
return that.$util.Tips({
title: '保存成功',
icon: 'success'
}, {
tab: 3,
url: 1
});
}).catch(msg => {
return that.$util.Tips({
title: msg || '保存失败,您并没有修改'
}, {
tab: 3,
url: 1
});
});
})
}
}
</script>
<style scoped lang="scss">
.personal-data .wrapper {
margin: 10rpx 0;
background-color: #fff;
padding: 36rpx 30rpx 13rpx 30rpx;
}
.personal-data .wrapper .title {
margin-bottom: 30rpx;
font-size: 32rpx;
color: #282828;
}
.personal-data .wrapper .wrapList .item {
width: 690rpx;
height: 160rpx;
background-color: #f8f8f8;
border-radius: 20rpx;
margin-bottom: 22rpx;
padding: 0 30rpx;
position: relative;
border: 2rpx solid #f8f8f8;
box-sizing: border-box;
}
.personal-data .wrapper .wrapList .item.on {
border-color: $theme-color;
border-radius: 20rpx;
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAArIAAACgCAYAAADw+I85AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L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GQBAMbh8oyfew7Y2+0bhSwAgJA9ZQ+7Ivbcyx4AQMietvt9EStkAQDGIc/HntO/pKcSsCtlDwAwbufUbHkV9i4MdifwogAAjNfUdyvIJzhYhcHJDtQ9AMA0TGmsIJVYzZfH0B7M9fiRX/R/AQYA1i4UF+HkevkAAAAASUVORK5CYII=");
background-size: 100% 100%;
background-color: #fff9f9;
background-repeat: no-repeat;
}
.personal-data .wrapper .wrapList .item .picTxt {
width: 445rpx;
}
.personal-data .wrapper .wrapList .item .picTxt .pictrue {
width: 96rpx;
height: 96rpx;
position: relative;
}
.personal-data .wrapper .wrapList .item .picTxt .pictrue image,
.pictrue button {
width: 100%;
height: 100%;
border-radius: 50%;
}
.personal-data .wrapper .wrapList .item .picTxt .pictrue .alter {
width: 30rpx;
height: 30rpx;
border-radius: 50%;
position: absolute;
bottom: 0;
right: 0;
}
.personal-data .wrapper .wrapList .item .picTxt .text {
width: 325rpx;
}
.personal-data .wrapper .wrapList .item .picTxt .text .name {
width: 100%;
font-size: 30rpx;
color: #282828;
}
.personal-data .wrapper .wrapList .item .picTxt .text .phone {
font-size: 24rpx;
color: #999;
margin-top: 10rpx;
}
.personal-data .wrapper .wrapList .item .bnt {
font-size: 24rpx;
background-color: #fff;
border-radius: 27rpx;
width: 140rpx;
height: 54rpx;
border: 2rpx solid $theme-color;
}
.personal-data .wrapper .wrapList .item .currentBnt {
position: absolute;
right: 0;
top: 0;
font-size: 26rpx;
background-color: rgba(233, 51, 35, 0.1);
width: 140rpx;
height: 48rpx;
border-radius: 0 20rpx 0 20rpx;
}
.personal-data .list {
margin-top: 30rpx;
background-color: #fff;
}
.personal-data .list .item {
border-bottom: 1rpx solid #f2f2f2;
padding: 24rpx;
font-size: 32rpx;
color: #282828;
}
.personal-data .list .item .phone {
width: 160rpx;
height: 56rpx;
font-size: 24rpx;
color: #fff;
line-height: 56rpx;
border-radius: 32rpx
}
.personal-data .list .item .pictrue {
width: 88rpx;
height: 88rpx;
position: relative;
}
.personal-data .list .item .pictrue image {
width: 100%;
height: 100%;
border-radius: 50%;
}
.personal-data .list .item .pictrue .alter {
width: 30rpx;
height: 30rpx;
border-radius: 50%;
position: absolute;
bottom: 0;
right: 0;
}
.personal-data .list .item .input {
width: 415rpx;
text-align: right;
color: #868686;
}
.personal-data .list .item .input .id {
width: 365rpx;
}
.personal-data .list .item .input .iconfont {
font-size: 35rpx;
}
.personal-data .modifyBnt {
font-size: 32rpx;
color: #fff;
width: 690rpx;
height: 90rpx;
border-radius: 50rpx;
text-align: center;
line-height: 90rpx;
margin: 76rpx auto 0 auto;
}
.bg_color {
@include main_bg_color(theme);
}
.personal-data .logOut {
font-size: 32rpx;
text-align: center;
width: 690rpx;
height: 90rpx;
border-radius: 45rpx;
margin: 30rpx auto 0 auto;
}
</style>

View File

@@ -0,0 +1,283 @@
<template>
<view :data-theme="theme">
<view class="ChangePassword">
<view class="list">
<view class="item" v-if="isNew">
<input disabled='true' placeholder='填写手机号码' placeholder-class='placeholder' v-model="userInfo.phone"></input>
</view>
<view class="item" v-else>
<input type='number' placeholder='填写手机号码' placeholder-class='placeholder' v-model="phone" maxlength="11"></input>
</view>
<view class="item acea-row row-between-wrapper">
<input type='number' placeholder='填写验证码' placeholder-class='placeholder' class="codeIput" v-model="captcha" maxlength="6"></input>
<button class="code" :class="disabled === true ? 'on' : ''" :disabled='disabled' @click="code">
{{ text }}
</button>
</view>
</view>
<button form-type="submit" v-if="isNew" class="confirmBnt bg_color" @click="next">下一步</button>
<button form-type="submit" v-else class="confirmBnt bg_color" @click="editPwd">保存</button>
</view>
</view>
</template>
<script>
import sendVerifyCode from "@/mixins/SendVerifyCode";
import {
registerVerify,
bindingPhone,
verifyCode,
bindingVerify
} from '@/api/api.js';
import {toLogin} from '@/libs/login.js';
import {mapGetters} from "vuex";
import {setThemeColor} from '@/utils/setTheme.js'
const app = getApp();
export default {
mixins: [sendVerifyCode],
data() {
return {
phone:'',
captcha:'',
isAuto: false, //没有授权的不会自动授权
isShowAuth: false, //是否隐藏授权
key: '',
isNew: true,
timer: '',
text: '获取验证码',
nums: 60,
theme:app.globalData.theme,
bgColor:''
};
},
mounted() {
// this.timer = setInterval(this.getTimes, 1000);
},
computed: mapGetters(['isLogin','userInfo']),
onLoad() {
let that = this;
that.bgColor = setThemeColor();
uni.setNavigationBarColor({
frontColor: '#ffffff',
backgroundColor:that.bgColor,
});
if (this.isLogin) {
// verifyCode().then(res=>{
// this.$set(this, 'key', res.data.key)
// });
} else {
toLogin();
}
},
methods: {
getTimes(){
this.nums = this.nums - 1;
this.text = "剩余 " + this.nums + "s";
if (this.nums < 0) {
clearInterval(this.timer);
}
this.text = "剩余 " + this.nums + "s";
if (this.text < "剩余 " + 0 + "s") {
this.disabled = false;
this.text = "重新获取";
}
},
onLoadFun:function(){},
// 授权关闭
authColse: function(e) {
this.isShowAuth = e
},
next() {
// uni.hideLoading();
// this.isNew = false;
// this.captcha = '';
// clearInterval(this.timer);
// this.disabled = false;
// this.text = "获取验证码";
// uni.showLoading({
// title: '加载中',
// mask: true
// });
if (!this.captcha) return this.$util.Tips({
title: '请填写验证码'
});
bindingVerify({
phone: this.userInfo.phone,
captcha: this.captcha
}).then(res => {
// uni.hideLoading();
this.isNew = false;
this.captcha = '';
clearInterval(this.timer);
this.disabled = false;
this.text = "获取验证码";
}).catch(err => {
return this.$util.Tips({
title: err
});
uni.hideLoading();
})
},
editPwd: function() {
let that = this;
if (!that.phone) return that.$util.Tips({
title: '请填写手机号码!'
});
if (!(/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.phone))) return that.$util.Tips({
title: '请输入正确的手机号码!'
});
if (!that.captcha) return that.$util.Tips({
title: '请填写验证码'
});
uni.showModal({
title: '是否更换绑定账号',
confirmText: '绑定',
success(res) {
if (res.confirm) {
bindingPhone({
phone: that.phone,
captcha: that.captcha
}).then(res => {
return that.$util.Tips({
title: res.message,
icon: 'success'
}, {
tab: 5,
url: '/pages/users/user_info/index'
});
}).catch(err => {
return that.$util.Tips({
title: err
});
})
} else if (res.cancel) {
return that.$util.Tips({
title: '您已取消更换绑定!'
}, {
tab: 5,
url: '/pages/users/user_info/index'
});
}
}
});
},
/**
* 发送验证码
*
*/
async code() {
this.nums = 60;
uni.showLoading({
title: '加载中',
mask: true
});
let that = this;
if(!that.isNew){
if (!that.phone) return that.$util.Tips({
title: '请填写手机号码!'
});
if (!(/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.phone))) return that.$util.Tips({
title: '请输入正确的手机号码!'
});
}
await registerVerify(that.isNew?that.userInfo.phone:that.phone).then(res => {
that.$util.Tips({
title: res.message
});
that.timer = setInterval(that.getTimes, 1000);
that.disabled = true;
uni.hideLoading();
}).catch(err => {
return that.$util.Tips({
title: err
});
uni.hideLoading();
});
}
}
}
</script>
<style lang="scss" scoped>
.shading {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
/* #ifdef APP-VUE */
margin-top: 50rpx;
/* #endif */
/* #ifndef APP-VUE */
margin-top: 200rpx;
/* #endif */
image {
width: 180rpx;
height: 180rpx;
}
}
page {
background-color: #fff !important;
}
.ChangePassword{padding-top:100rpx;}
.ChangePassword .phone {
font-size: 32rpx;
font-weight: bold;
text-align: center;
margin-top: 55rpx;
}
.ChangePassword .list {
width: 580rpx;
margin: 0 auto;
}
.ChangePassword .list .item {
width: 100%;
height: 110rpx;
border-bottom: 2rpx solid #f0f0f0;
}
.ChangePassword .list .item input {
width: 100%;
height: 100%;
font-size: 32rpx;
}
.ChangePassword .list .item .placeholder {
color: #b9b9bc;
}
.ChangePassword .list .item input.codeIput {
width: 340rpx;
}
.ChangePassword .list .item .code {
font-size: 32rpx;
@include main_color(theme);
background-color: #f5f5f5;
}
.ChangePassword .list .item .code.on {
color: #b9b9bc !important;
}
.ChangePassword .confirmBnt {
font-size: 32rpx;
width: 580rpx;
height: 90rpx;
border-radius: 45rpx;
color: #fff;
margin: 92rpx auto 0 auto;
text-align: center;
line-height: 90rpx;
}
.bg_color{
@include main_bg_color(theme);
}
</style>

View File

@@ -0,0 +1,263 @@
<template>
<view :data-theme="theme" class="upda_pasd">
<view class="ChangePassword">
<form @submit="editPwd" report-submit='true'>
<view class="phone">当前手机号{{phone}}</view>
<view class="list">
<view class="item">
<input type='password' placeholder='6-8位字母加数字' placeholder-class='placeholder' name="password" v-model="password" maxlength="18"></input>
</view>
<view class="item">
<input type='password' placeholder='确认新密码' placeholder-class='placeholder' name="qr_password" v-model="qr_password" maxlength="18"></input>
</view>
<view class="item acea-row row-between-wrapper">
<input type='number' placeholder='填写验证码' placeholder-class='placeholder' class="codeIput" name="captcha" :value="captcha" maxlength="6"></input>
<button class="code" :class="disabled === true ? 'on' : ''" :disabled='disabled' @click="clickCode">
{{ text }}
</button>
</view>
</view>
<button form-type="submit" class="confirmBnt">确认修改</button>
</form>
</view>
<Verify @success="handlerOnVerSuccess" :captchaType="'clickWord'" :imgSize="{ width: '330px', height: '155px' }"
ref="verify"></Verify>
</view>
</template>
<script>
import sendVerifyCode from "@/mixins/SendVerifyCode";
import Verify from '@/pages/users/components/verifition/verify.vue';
import {
phoneRegisterReset,
registerVerify
} from '@/api/api.js';
import {
getUserInfo
} from '@/api/user.js';
import {
toLogin
} from '@/libs/login.js';
import {mapGetters} from "vuex";
import {setThemeColor} from '@/utils/setTheme.js'
const app = getApp();
export default {
mixins: [sendVerifyCode],
components: {
Verify,
},
data() {
return {
userInfo: {},
phone: '',
password: '',
captcha: '',
qr_password: '',
isAuto: false, //没有授权的不会自动授权
isShowAuth: false, //是否隐藏授权
theme:app.globalData.theme,
bgColor:''
};
},
computed: mapGetters(['isLogin']),
watch:{
isLogin:{
handler:function(newV,oldV){
if(newV){
this.getUserInfo();
}
},
deep:true
}
},
onLoad() {
if (this.isLogin) {
this.getUserInfo();
} else {
toLogin();
}
let that = this;
that.bgColor = setThemeColor();
uni.setNavigationBarColor({
frontColor: '#ffffff',
backgroundColor:that.bgColor,
});
},
methods: {
clickCode(){
let that = this;
if (that.qr_password != that.password) return that.$util.Tips({
title: '两次输入的密码不一致!'
});
if (!/^[a-zA-Z]\w{5,17}$/i.test(that.password)) return that.$util.Tips({
title: '密码格式错误密码必须以字母开头长度在618之间只能包含字符、数字和下划线'
});
this.$refs.verify.show();
},
//滑块验证成功后
handlerOnVerSuccess(data) {
this.$refs.verify.hide();
this.code();
},
/**
* 授权回调
*/
onLoadFun: function(e) {
this.getUserInfo();
},
// 授权关闭
authColse: function(e) {
this.isShowAuth = e
},
/**
* 获取个人用户信息
*/
getUserInfo: function() {
let that = this;
getUserInfo().then(res => {
let tel = res.data.phone;
let phone = tel.substr(0, 3) + "****" + tel.substr(7);
that.$set(that, 'userInfo', res.data);
that.phone = phone;
});
},
/**
* 发送验证码
*
*/
async code() {
let that = this;
if (!that.userInfo.phone) return that.$util.Tips({
title: '手机号码不存在,无法发送验证码!'
});
await registerVerify(that.userInfo.phone).then(res => {
that.$util.Tips({
title: res.message
});
that.sendCode();
}).catch(err => {
return that.$util.Tips({
title: err
});
});
},
/**
* H5登录 修改密码
*
*/
checkPasd(e){
let that = this,password = e.detail.value;
that.password = password;
// if (!/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,8}$/i.test(password)) return that.$util.Tips({
if (!/^[a-zA-Z]\w{5,17}$/i.test(password)) return that.$util.Tips({
title: '密码格式错误密码必须以字母开头长度在618之间只能包含字符、数字和下划线'
});
},
//校验2次密码是否一样
checkPassword(e){
let that = this,qr_password = e.detail.value;
if (qr_password != that.password) return that.$util.Tips({
title: '两次输入的密码不一致!'
});
},
editPwd: function(e) {
let that = this,
password = e.detail.value.password,
qr_password = e.detail.value.qr_password,
captcha = e.detail.value.captcha;
if (!password) return that.$util.Tips({
title: '请输入新密码'
});
if (!qr_password) return that.$util.Tips({
title: '请确认新密码'
});
if (!captcha) return that.$util.Tips({
title: '请输入验证码'
});
if (qr_password != that.password) return that.$util.Tips({
title: '两次输入的密码不一致!'
});
phoneRegisterReset({
account: that.userInfo.phone,
captcha: captcha,
password: password
}).then(res => {
return that.$util.Tips({
title: res.message
}, {
tab: 3,
url: 1
});
}).catch(err => {
return that.$util.Tips({
title: err
});
});
}
}
}
</script>
<style lang="scss">
page {
background-color: #fff !important;
}
.upda_pasd{
background: #FFFFFF;
height: 100vh;
}
.ChangePassword .phone {
font-size: 32rpx;
font-weight: bold;
text-align: center;
padding-top: 100rpx;
}
.ChangePassword .list {
width: 580rpx;
margin: 53rpx auto 0 auto;
}
.ChangePassword .list .item {
width: 100%;
height: 110rpx;
border-bottom: 2rpx solid #f0f0f0;
}
.ChangePassword .list .item input {
width: 100%;
height: 100%;
font-size: 32rpx;
}
.ChangePassword .list .item .placeholder {
color: #b9b9bc;
}
.ChangePassword .list .item input.codeIput {
width: 340rpx;
}
.ChangePassword .list .item .code {
font-size: 32rpx;
// background-color: #fff;
@include main_color(theme);
}
.ChangePassword .list .item .code.on {
color: #b9b9bc !important;
}
.ChangePassword .confirmBnt {
font-size: 32rpx;
width: 580rpx;
height: 90rpx;
border-radius: 45rpx;
color: #fff;
margin: 92rpx auto 0 auto;
text-align: center;
line-height: 90rpx;
@include main_bg_color(theme);
}
</style>

View File

File diff suppressed because one or more lines are too long