首次提交

This commit is contained in:
duan
2024-06-06 11:50:53 +08:00
parent cab4751927
commit 544c3b65b2
344 changed files with 72919 additions and 1 deletions

163
pages/public/bind.vue Normal file
View File

@@ -0,0 +1,163 @@
<template>
<view class="container">
<view class="cu-form-group" style="margin: 30upx;border: 2upx solid whitesmoke;margin-bottom: 20px;border-radius: 30px">
<view class="title">手机号</view>
<input type="number" :value="mobile" placeholder="请输入手机号" maxlength="11" data-key="mobile" @input="inputChange" />
</view>
<view class="cu-form-group" style="margin: 30upx;border: 2upx solid whitesmoke;margin-bottom: 20px;border-radius: 30px">
<text class="title">验证码</text>
<input type="number" :value="code" placeholder="请输入验证码" maxlength="6" data-key="code" @input="inputChange"
@confirm="toLogin" />
<button class="send-msg" @click="sendMsg" :disabled="sending">{{ sendTime }}</button>
</view>
<button class="confirm-btn" @click="toLogin" :disabled="logining">立即换绑</button>
</view>
</view>
</template>
<script>
import listCell from '@/components/com-input';
export default {
components: {
listCell
},
data() {
return {
mobile: '',
code: '',
logining: false,
sending: false,
sendTime: '获取验证码',
count: 60,
}
},
methods: {
inputChange(e) {
const key = e.currentTarget.dataset.key;
this[key] = e.detail.value;
},
navBack() {
uni.navigateBack();
},
countDown() {
const {
count
} = this;
if (count === 1) {
this.count = 60;
this.sending = false;
this.sendTime = '获取验证码'
} else {
this.count = count - 1;
this.sending = true;
this.sendTime = count - 1 + '秒后重新获取';
setTimeout(this.countDown.bind(this), 1000);
}
},
sendMsg() {
const {
mobile
} = this;
if (!mobile) {
this.$queue.showToast("请输入手机号");
} else if (mobile.length !== 11) {
this.$queue.showToast("请输入正确的手机号");
} else {
this.$queue.showLoading("正在发送验证码...");
this.$Request.getT('/appLogin/sendMsg/' + mobile + '/bind').then(res => {
if (res.code === 0) {
this.sending = true;
this.$queue.showToast('验证码发送成功请注意查收');
this.countDown();
uni.hideLoading();
} else {
uni.hideLoading();
uni.showModal({
showCancel: false,
title: '短信发送失败',
content: res.msg ? res.msg : '请一分钟后再获取验证码'
});
}
});
}
},
toLogin() {
const {
mobile,
code
} = this;
let userId = this.$queue.getData("userId");
if (!mobile) {
this.$queue.showToast("请输入手机号");
} else if (mobile.length !== 11) {
this.$queue.showToast("请输入正确的手机号");
} else if (!code) {
this.$queue.showToast("请输入验证码");
} else {
this.$queue.showLoading("正在绑定中...");
this.$Request.postT("/app/updatePhone?msg=" + code + "&phone=" + mobile + "&userId=" + userId).then(res => {
if (res.code === 0) {
this.$queue.setData("mobile", mobile);
this.$queue.showToast('修改成功');
uni.switchTab({
url: '/pages/my/index'
});
} else {
uni.showModal({
showCancel: false,
title: '绑定失败',
content: res.msg,
});
}
uni.hideLoading();
});
}
},
},
}
</script>
<style lang='scss'>
.send-msg {
border-radius: 30px;
color: white;
height: 30px;
font-size: 14px;
line-height: 30px;
background: #e10a07;
}
.container {
top: 0;
padding-top: 32upx;
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
background: #111224;
}
.confirm-btn {
width: 600upx;
height: 80upx;
line-height: 80upx;
border-radius: 60upx;
margin-top: 32upx;
background: #5E81F9;
color: #fff;
font-size: 32upx;
&:after {
border-radius: 60px;
}
}
</style>

93
pages/public/css/main.css Normal file
View File

@@ -0,0 +1,93 @@
.content {
display: flex;
flex-direction: column;
justify-content:center;
/* margin-top: 128upx; */
}
/* 头部 logo */
.header {
text-align: center;
width:161upx;
height:161upx;
box-shadow:0upx 0upx 60upx 0upx rgba(0,0,0,0.1);
border-radius:50%;
background: -moz-linear-gradient(left, #F15B6C, #e10a07 100%);
background: -webkit-gradient(linear, left top, left right, color-stop(0, #F15B6C), color-stop(100%, #e10a07));
background: -webkit-linear-gradient(left, #F15B6C 0, #e10a07 100%);
background: -o-linear-gradient(left, #F15B6C 0, #e10a07 100%);
background: -ms-linear-gradient(left, #F15B6C 0, #e10a07 100%);
background: linear-gradient(to left, #F15B6C 0, #e10a07 100%);
margin-top: 180upx;
margin-bottom: 72upx;
font-size: 60upx;
color: white;
font-weight: bold;
padding-top: 32upx;
margin-left: auto;
margin-right: auto;
}
.header image{
width:161upx;
height:161upx;
border-radius:50%;
}
/* 主体 */
.main {
display: flex;
flex-direction: column;
padding-left: 70upx;
padding-right: 70upx;
}
.tips {
color: #999999;
font-size: 28upx;
margin-top: 64upx;
margin-left: 48upx;
}
/* 其他登录方式 */
.other_login{
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
margin-top: 256upx;
text-align: center;
}
.login_icon{
border: none;
font-size: 64upx;
margin: 0 64upx 0 64upx;
color: rgba(0,0,0,0.7)
}
.wechat_color{
color: #83DC42;
}
.weibo_color{
color: #F9221D;
}
.github_color{
color: #24292E;
}
/* 底部 */
.footer{
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
font-size: 28upx;
margin-top: 64upx;
color: rgba(0,0,0,0.7);
text-align: center;
height: 40upx;
line-height: 40upx;
}
.footer text{
font-size: 24upx;
margin-left: 15upx;
margin-right: 15upx;
}

189
pages/public/forgetPwd.vue Normal file
View File

@@ -0,0 +1,189 @@
<template>
<view class="container">
<view class="wrapper">
<view class="input-content">
<view class="cu-form-group" style="border: 2upx solid whitesmoke;margin-bottom: 20px;border-radius: 30px">
<view class="title text-black">手机号</view>
<input type="number" :value="phone" placeholder="请输入手机号" maxlength="11" data-key="phone" @input="inputChange" />
</view>
<view class="cu-form-group" style="border: 2upx solid whitesmoke;margin-bottom: 20px;border-radius: 30px">
<text class="title text-black">验证码</text>
<input type="number" :value="code" placeholder="请输入验证码" maxlength="6" data-key="code" @input="inputChange"
@confirm="toLogin" />
<button class="send-msg" @click="sendMsg" :disabled="sending">{{sendTime}}</button>
</view>
<view class="cu-form-group" style="border: 2upx solid whitesmoke;margin-bottom: 20px;border-radius: 30px">
<text class="title text-black">设置密码</text>
<input type="password" :value="password" placeholder="请设置新密码" placeholder-class="input-empty" maxlength="20"
minlength="6" data-key="password" @input="inputChange" @confirm="toLogin" />
</view>
</view>
<button class="confirm-btn" @click="toLogin">立即找回</button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
code: '',
phone: '',
password: '',
sending: false,
sendTime: '获取验证码',
count: 60,
logining: false
}
},
methods: {
sendMsg() {
const {
phone
} = this;
if (!phone) {
this.$queue.showToast("请输入手机号");
} else if (phone.length !== 11) {
this.$queue.showToast("请输入正确的手机号");
} else {
this.$queue.showLoading("正在发送验证码...");
this.$Request.getT("/app/Login/sendMsg/" + phone + "/forget").then(res => {
if (res.code === 0) {
this.sending = true;
this.$queue.showToast('验证码发送成功请注意查收');
this.countDown();
uni.hideLoading();
} else {
uni.hideLoading();
uni.showModal({
showCancel: false,
title: '短信发送失败',
content: res.msg ? res.msg : '请一分钟后再获取验证码'
});
}
});
}
},
countDown() {
const {
count
} = this;
if (count === 1) {
this.count = 60;
this.sending = false;
this.sendTime = '获取验证码'
} else {
this.count = count - 1;
this.sending = true;
this.sendTime = count - 1 + '秒后重新获取';
setTimeout(this.countDown.bind(this), 1000);
}
},
inputChange(e) {
const key = e.currentTarget.dataset.key;
this[key] = e.detail.value;
},
navBack() {
uni.navigateBack();
},
navTo(url) {
uni.navigateTo({
url
})
},
toLogin() {
const {
phone,
password,
code
} = this;
if (!phone) {
this.$queue.showToast("请输入手机号");
} else if (!password) {
this.$queue.showToast("请设置密码");
} else if (password.length < 6) {
this.$queue.showToast("密码位数必须大于六位");
} else {
this.logining = true;
this.$queue.showLoading("正在修改密码中...");
this.$Request.post("/app/Login/forgetPwd", {
pwd: password,
phone: phone,
msg: code
}).then(res => {
uni.hideLoading();
if (res.code === 0) {
uni.navigateTo({
url: '/pages/public/loginphone'
});
} else {
uni.showModal({
showCancel: false,
title: '密码找回失败',
content: res.msg,
});
}
});
}
},
},
}
</script>
<style lang='scss'>
page {
background: #1E1F31 !important;
}
.send-msg {
border-radius: 30px;
color: white;
height: 30px;
font-size: 14px;
line-height: 30px;
background: #5E81F9;
}
.container {
padding-top: 32upx;
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
background: #1E1F31;
}
.wrapper {
position: relative;
z-index: 90;
background: #1E1F31;
padding-bottom: 20px;
}
.input-content {
padding: 32upx 80upx;
}
.confirm-btn {
width: 600upx;
height: 80upx;
line-height: 80upx;
border-radius: 60upx;
margin-top: 32upx;
background: #5E81F9;
color: #fff;
font-size: 32upx;
&:after {
border-radius: 60px;
}
}
</style>

650
pages/public/login.vue Normal file
View File

@@ -0,0 +1,650 @@
<template>
<view class="container">
<!-- <image @click="navBack" src="../../static/images/index/close.png" style="width: 32upx;height: 32upx;margin-left: 46upx;"></image> -->
<!-- 小程序状态下登录 -->
<!-- #ifdef MP-WEIXIN -->
<view class="mp_wxBox">
<view>
<view class="headers">
<image src="../../static/logo.png" style="border-radius: 50%;"></image>
</view>
<view class="content">
<view>申请获取以下权限</view>
<text>获得你的公开信息(昵称头像地区等)</text>
</view>
<button v-show="weixinPhone" style="background: #FCD202;color: #333333;" class="bottom"
open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
授权手机号
</button>
<button v-show="!weixinPhone" style="background: #FCD202;color: #333333;" class='bottom'
bindtap="getUserProfile" @tap="wxGetUserInfo">
授权登录
</button>
</view>
</view>
<view style="text-align: center;">
<view class="footers">
<image v-if="showAgree" @tap="isShowAgree" src="../../static/images/selected.png"
style="width: 36upx;height: 36upx;"></image>
<image v-else @tap="isShowAgree" src="../../static/images/select.png"
style="width: 36upx;height: 36upx;"></image>
<text style="margin-left: 10upx;margin-right: 0;">同意</text>
<navigator url="/my/setting/mimi" open-type="navigate">隐私政策</navigator>
<navigator url="/my/setting/xieyi" open-type="navigate">用户服务协议</navigator>
</view>
</view>
<!-- #endif -->
<!-- #ifndef MP-WEIXIN -->
<view class="register">
<view class="back-btn yticon icon-zuojiantou-up" @click="navBack"></view>
<view style="padding-top: 172upx;margin-left: 36upx;">
<view style="color: #333333;font-size: 44upx;">手机快捷登录</view>
<view style="color: #999999;font-size: 24upx;margin-top: 20upx;">未注册的手机号将自动创建账号</view>
</view>
<view style="margin-left: 40upx;margin-top: 104upx;margin-right: 40upx;">
<wInput v-model="phoneData" type="number" maxlength="11" placeholder="请输入手机号"></wInput>
<!-- <wInput v-model="passData" type="number" maxlength="6" placeholder="请输入密码"></wInput> -->
<wInput v-model="verCode" type="number" maxlength="6" placeholder="请输入验证码" isShowCode ref="runCode"
@setCode="sendMsg()"></wInput>
<wInput v-show="show" v-model="invitation" isShowGet ref="setNumberCode" @setNumberCode="isShowGet()"
placeholder="请填写邀请码"></wInput>
</view>
<view class="footer">
<image v-if="showAgree" @tap="isShowAgree" src="../../static/images/selected.png"
style="width: 36upx;height: 36upx;"></image>
<image v-else @tap="isShowAgree" src="../../static/images/select.png"
style="width: 36upx;height: 36upx;"></image>
<text style="margin-left: 10upx;margin-right: 0;">同意</text>
<navigator url="/my/setting/mimi" open-type="navigate">隐私政策</navigator>
<navigator url="/my/setting/xieyi" open-type="navigate">用户服务协议</navigator>
</view>
<wButton text="登 录" :rotate="isRotate" @click.native="startReg()"></wButton>
</view>
<!-- #endif -->
</view>
</template>
<script>
import wInput from '@/components/watch-login/watch-input.vue' //input
import wButton from '@/components/watch-login/watch-button.vue' //button
export default {
components: {
wInput,
wButton,
},
data() {
return {
mobile: '',
code: '',
weixinLogin: false,
sending: false,
sendTime: '获取验证码',
count: 60,
weixinPhone: false,
sendDataList: {},
sessionkey: '',
phoneNum: false,
sysphone: 1,
phoneData: '',
verCode: '',
invitation: '',
show: '',
showAgree: false, //协议是否选择
isRotate: false, //是否加载旋转
platform: "h5",
};
},
onLoad(e) {
if (e.inviterCode) {
this.$queue.setData('inviterCode', e.inviterCode);
}
//微信登录开启
this.$Request.getT('/app/common/type/53').then(res => {
if (res.code == 0) {
if (res.data && res.data.value && res.data.value == '是') {
// this.weixinLogin = true;
}
}
});
this.$Request.getT('/app/common/type/188').then(res => {
if (res.code == 0) {
if (res.data && res.data.value && res.data.value == '是') {
this.phoneNum = true;
}
}
});
},
methods: {
isShowAgree() {
this.showAgree = !this.showAgree
},
startReg() {
var that = this
uni.getSystemInfo({
success: function(res) {
console.log(res.model);
if (res.model == 'iPhone') {
that.sysphone = 2
} else if (res.model != 'iPhone') {
that.sysphone = 1
}
}
});
//注册
if (that.isRotate) {
//判断是否加载中,避免重复点击请求
return false;
}
if (!that.phoneData) {
uni.showToast({
icon: 'none',
position: 'bottom',
title: '请输入手机号'
});
return false;
}
if (that.phoneData.length != 11) {
uni.showToast({
icon: 'none',
position: 'bottom',
title: '手机号不正确'
});
return false;
}
if (that.verCode.length != 6) {
uni.showToast({
icon: 'none',
position: 'bottom',
title: '验证码不正确'
});
return false;
}
if (that.showAgree == false) {
uni.showToast({
icon: 'none',
position: 'bottom',
title: '请阅读并同意《隐私政策》和《用户服务协议》'
});
return false;
}
that.isRotate = true;
var openid = this.$queue.getData("openid") ? this.$queue.getData("openid") : '';
let data = {
phone: that.phoneData,
msg: that.verCode,
platform: that.platform,
sysPhone: that.sysphone,
openId: openid,
userType: 1
}
that.$Request.post("/app/Login/registerCode", data).then(res => {
console.log(res)
if (res.code == 0) {
console.log(res.token)
this.$queue.setData("token", res.token);
this.$queue.setData("userId", res.user.userId);
this.$queue.setData("phone", res.user.phone);
uni.setStorageSync('userName', res.user.userName)
uni.setStorageSync('avatar', res.user.avatar)
uni.setStorageSync('phone', res.user.phone)
uni.setStorageSync('sex', res.user.sex)
uni.setStorageSync('userId', res.user.userId)
uni.setStorageSync('wxCode', res.user.wxCode)
uni.setStorageSync('wxQrCode', res.user.wxQrCode)
uni.setStorageSync('zhiFuBao', res.user.zhiFuBao)
uni.setStorageSync('zhiFuBaoName', res.user.zhiFuBaoName)
uni.switchTab({
url: '/pages/index/index'
})
return false;
} else {
that.isRotate = false;
uni.hideLoading();
uni.showModal({
showCancel: false,
title: '登录失败',
content: res.msg,
});
}
});
},
sendMsg() {
const {
phoneData
} = this;
if (!phoneData) {
this.$queue.showToast("请输入手机号");
} else if (phoneData.length !== 11) {
this.$queue.showToast("请输入正确的手机号");
} else {
this.$queue.showLoading("正在发送验证码...");
this.$Request.getT("/app/Login/sendMsg/" + phoneData + "/login").then(res => {
console.log(res)
if (res.code == 0) {
if (res.data === 'register') {
this.show = true;
}
this.sending = true;
this.$queue.showToast('验证码发送成功请注意查收');
this.$refs.runCode.$emit('runCode');
uni.hideLoading();
} else {
uni.hideLoading();
uni.showModal({
showCancel: false,
title: '短信发送失败',
content: res.msg ? res.msg : '请一分钟后再获取验证码',
});
}
});
}
},
wxGetUserInfo(e) {
if (this.showAgree == false) {
uni.showToast({
icon: 'none',
position: 'bottom',
title: '请阅读并同意《隐私政策》和《用户服务协议》'
});
return false;
}
wx.getUserProfile({
desc: '业务需要',
success: infoRes => {
console.log("infoRes.encryptedData__________:" + JSON.stringify(infoRes.userInfo))
let nickName = infoRes.userInfo.nickName; //昵称
let avatarUrl = infoRes.userInfo.avatarUrl; //头像
let sex = infoRes.userInfo.gender; //性别
try {
this.$queue.showLoading('正在登录中...');
this.login(nickName, avatarUrl, sex);
} catch (e) {}
}
})
},
//登录
login(nickName, avatarUrl, sex) {
let that = this;
// 1.wx获取登录用户code
uni.login({
provider: 'weixin',
success: function(loginRes) {
console.log(loginRes, '************')
let data = {
code: loginRes.code,
}
that.$Request.get('/app/Login/wxLogin', data).then(res => {
if (res.code == 0) {
uni.hideLoading()
uni.setStorageSync('openId', res.data.open_id)
uni.setStorageSync('unionId', res.data.unionId)
that.sessionkey = res.data.session_key;
let inviterCode = '';
if (uni.getStorageSync('inviterCode')) {
inviterCode = uni.getStorageSync('inviterCode')
}
let sendData = {
openId: uni.getStorageSync('openId'),
unionId: uni.getStorageSync('unionId'),
userName: nickName,
avatar: avatarUrl,
sex: sex, //性别
inviterCode: inviterCode //别人登录进来携带你的邀请码
};
that.sendDataList = sendData;
// 第一次登录获取手机号
console.log(that.phoneNum)
if (res.data.isPhone == '2' && that.phoneNum) {
that.weixinPhone = true;
} else {
that.getWeixinInfo(sendData);
}
} else {
uni.showToast({
icon: 'none',
title: res.msg,
duration: 2000
});
console.log(res, '失败')
}
})
}
});
},
//小程序微信登录后获取手机号
getPhoneNumber: function(e) {
if (e.detail.errMsg == 'getPhoneNumber:fail user deny') {
console.log('用户拒绝提供手机号');
} else {
console.log('用户同意提供手机号');
console.log(e)
this.setPhoneByInsert(e.detail.encryptedData, e.detail.iv);
}
},
//小程序微信登录后获取手机号
setPhoneByInsert(decryptData, iv) {
let data = {
decryptData: decryptData,
key: this.sessionkey,
iv: iv
};
this.$Request.postJson('/app/Login/selectPhone', data).then(res => {
if (res.code == 0) {
this.phone = res.data.phoneNumber;
this.getWeixinInfo(this.sendDataList);
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
});
}
})
},
//获取个人信息
getWeixinInfo(sendData) {
let that = this;
uni.showLoading({
title: '登录中...'
});
let postData = {
openId: sendData.openId, //小程序openId
unionId: sendData.unionId, //unionId
userName: sendData.userName, //微信名称
avatar: sendData.avatar, //头像
sex: sendData.sex, //性别
phone: that.phone,
inviterCode: sendData.inviterCode
};
that.$Request.postJson('/app/Login/insertWxUser', postData).then(res => {
uni.hideLoading();
if (res.code == 0) {
uni.setStorageSync('token', res.token)
uni.setStorageSync('adminUserId', res.user.adminUserId)
uni.setStorageSync('userName', res.user.userName)
uni.setStorageSync('avatar', res.user.avatar)
uni.setStorageSync('phone', res.user.phone)
uni.setStorageSync('invitationCode', res.user.invitationCode)
uni.setStorageSync('sex', res.user.sex)
uni.setStorageSync('userId', res.user.userId)
uni.setStorageSync('openId', res.user.openId)
uni.setStorageSync('zhiFuBao', res.user.zhiFuBao)
uni.setStorageSync('zhiFuBaoName', res.user.zhiFuBaoName)
// var pages = getCurrentPages();
// var currPage = pages[pages.length - 1] //当前页面
// var prePage = pages[pages.length - 2] //上一个页面
//调用上一页拉取数据的方法
// console.log(prePage.route)
// if (prePage.route == "pages/my/index") {
// prePage.$vm.getUserInfo()
// }
uni.navigateBack();
} else {
uni.showModal({
showCancel: false,
title: '登录失败',
content: res.msg,
});
}
})
},
weixinLo() {
let that = this;
uni.login({
provider: 'weixin',
success: function(loginRes) {
that.$queue.showLoading('正在登录中...');
console.error(loginRes.authResult);
that.$queue.setData('weixinToken', loginRes.authResult.access_token);
that.$queue.setData('unionid', loginRes.authResult.unionid);
that.$queue.setData('weixinOpenid', loginRes.authResult.openid);
that.$Request.postJson('/app/login/loginApp', {
token: loginRes.authResult.access_token,
unionid: loginRes.authResult.unionid,
openid: loginRes.authResult.openid
}).then(res => {
console.log(JSON.stringify(res))
if (res.code === 0) {
if (uni.getSystemInfoSync().platform == "android") {
let clientid = plus.push.getClientInfo().clientid;
that.$Request.postT('/app/login/updateClientId?clientId=' +
clientid + '&userId=' + res.userId).then(res => {
});
}
that.$queue.setData("token", res.uuid);
that.$queue.setData("userId", res.userId);
that.getUserInfo(res.userId, res.token);
} else {
uni.hideLoading();
uni.navigateTo({
url: '/pages/public/wxmobile'
});
}
});
}
});
},
forget() {
uni.navigateTo({
url: '/pages/public/pwd'
});
},
register() {
uni.navigateTo({
url: '/pages/public/loginphone'
});
},
inputChange(e) {
const key = e.currentTarget.dataset.key;
this[key] = e.detail.value;
},
navBack() {
uni.navigateBack();
},
getUserInfo(userId, token) {
this.$Request.postJson('/app/selectUserById?userId=' + userId).then(res => {
if (res.code === 0) {
this.$queue.setData('token', res.data.uuid);
this.$queue.setData('image_url', res.data.imageUrl ? res.data.imageUrl :
'/static/img/common/logo.jpg');
this.$queue.setData('inviterCode', res.data.inviterCode);
this.$queue.setData('invitationCode', res.data.invitationCode);
this.$queue.setData('grade', res.data.grade);
this.$queue.setData('mobile', res.data.mobile);
this.$queue.setData('isInvitation', res.data.isInvitation);
this.$queue.setData('nickName', res.data.nickName ? res.data.nickName : res.data.phone);
this.$queue.setData('gender', parseInt(res.data.gender));
uni.switchTab({
url: '/pages/index/index'
});
} else {
uni.showModal({
showCancel: false,
title: '登录失败',
content: res.msg
});
this.$queue.logout();
}
uni.hideLoading();
});
}
}
};
</script>
<style lang="scss">
page {
height: 100%;
background: #FFF;
}
.footers {
padding-left: 140upx;
margin-top: 32upx;
font-size: 24upx;
color: #666666;
text-align: center;
display: flex;
}
.confirm-btn-weixin {
width: 200px;
height: 42px;
line-height: 42px;
border-radius: 30px;
margin-top: 40upx;
background: -moz-linear-gradient(left, #f15b6c, #e10a07 100%);
background: -webkit-gradient(linear, left top, left right, color-stop(0, #f15b6c), color-stop(100%, #e10a07));
background: -webkit-linear-gradient(left, #f15b6c 0, #e10a07 100%);
background: -o-linear-gradient(left, #f15b6c 0, #e10a07 100%);
background: -ms-linear-gradient(left, #f15b6c 0, #e10a07 100%);
background: linear-gradient(to left, #f15b6c 0, #e10a07 100%);
color: #fff;
font-size: 32upx;
&:after {
border-radius: 60px;
}
}
.confirm-btn {
width: 200px;
height: 42px;
line-height: 42px;
border-radius: 30px;
margin-top: 300upx;
background: -moz-linear-gradient(left, #f15b6c, #e10a07 100%);
background: -webkit-gradient(linear, left top, left right, color-stop(0, #f15b6c), color-stop(100%, #e10a07));
background: -webkit-linear-gradient(left, #f15b6c 0, #e10a07 100%);
background: -o-linear-gradient(left, #f15b6c 0, #e10a07 100%);
background: -ms-linear-gradient(left, #f15b6c 0, #e10a07 100%);
background: linear-gradient(to left, #f15b6c 0, #e10a07 100%);
color: #fff;
font-size: 32upx;
&:after {
border-radius: 60px;
}
}
.headers {
text-align: center;
}
.headers>image {
width: 400upx;
height: 400upx;
}
.footer {
padding-left: 60upx;
margin-top: 48upx;
font-size: 24upx;
color: #666666;
text-align: center;
display: flex;
}
page {
background: #fff;
}
.send-msg {
border-radius: 30px;
color: black;
background: white;
height: 30px;
font-size: 14px;
line-height: 30px;
}
.container {
top: 0;
padding-top: 32upx;
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
// background: #111224;
// color: #FFF;
.mp_wxBox {
.headers {
margin: 35% auto 50rpx;
text-align: center;
border-radius: 60rpx;
width: 650rpx;
height: 300rpx;
line-height: 450rpx;
image {
width: 300rpx;
height: 300rpx;
}
}
.content {
text-align: center;
}
text {
display: block;
color: #9d9d9d;
margin-top: 40rpx;
}
.bottom {
line-height: 80upx;
border-radius: 80upx;
margin: 70rpx 50rpx;
height: 80upx;
font-size: 35rpx;
}
}
}
.wrapper {
position: relative;
z-index: 90;
background: #fff;
padding-bottom: 20px;
}
.input-content {
padding: 0 20px;
}
.confirm-btn {
width: 300px;
height: 42px;
line-height: 42px;
border-radius: 30px;
margin-top: 40px;
background: linear-gradient(to left, #3f5ecb 0, #5074FF 100%);
color: #fff;
// font-size: $font-lg;
&:after {
border-radius: 60px;
}
}
</style>

174
pages/public/pwd.vue Normal file
View File

@@ -0,0 +1,174 @@
<template>
<view class="container">
<view class="wrapper">
<view class="input-content">
<view class="cu-form-group" style="border: 2upx solid whitesmoke;margin-bottom: 20px;border-radius: 30px">
<text class="title">旧密码</text>
<input type="password" :value="oldPwd" placeholder="请输入旧密码" placeholder-class="input-empty" maxlength="20"
minlength="6" data-key="oldpassword" @input="inputChange" @confirm="toLogin" />
</view>
<view class="cu-form-group" style="border: 2upx solid whitesmoke;margin-bottom: 20px;border-radius: 30px">
<text class="title">新密码</text>
<input type="password" :value="pwd" placeholder="请设置新密码" placeholder-class="input-empty" maxlength="20"
minlength="6" data-key="password" @input="inputChange" @confirm="toLogin" />
</view>
</view>
<button class="confirm-btn" @click="toLogin">修改密码</button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
code: '',
phone: '',
password: '',
oldpassword: '',
sending: false,
sendTime: '获取验证码',
count: 60,
logining: false,
oldPwd: '',
pwd: ''
}
},
methods: {
sendMsg() {
const {
phone
} = this;
if (!phone) {
this.$queue.showToast("请输入手机号");
} else if (phone.length !== 11) {
this.$queue.showToast("请输入正确的手机号");
} else {
this.$queue.showLoading("正在发送验证码...");
this.$Request.getT('/appLogin/sendMsg/' + mobile + '/forget').then(res => {
if (res.code === 0) {
this.sending = true;
this.$queue.showToast('验证码发送成功请注意查收');
this.countDown();
uni.hideLoading();
} else {
uni.hideLoading();
uni.showModal({
showCancel: false,
title: '短信发送失败',
content: res.msg ? res.msg : '请一分钟后再获取验证码'
});
}
});
}
},
countDown() {
const {
count
} = this;
if (count === 1) {
this.count = 60;
this.sending = false;
this.sendTime = '获取验证码'
} else {
this.count = count - 1;
this.sending = true;
this.sendTime = count - 1 + '秒后重新获取';
setTimeout(this.countDown.bind(this), 1000);
}
},
inputChange(e) {
const key = e.currentTarget.dataset.key;
this[key] = e.detail.value;
},
navBack() {
uni.navigateBack();
},
toLogin() {
const {
password,
oldpassword
} = this;
if (!oldpassword) {
this.$queue.showToast("请输入旧密码");
} else if (oldpassword.length < 6) {
this.$queue.showToast("旧密码位数必须大于六位");
} else if (!password) {
this.$queue.showToast("请设置新密码");
} else if (password.length < 6) {
this.$queue.showToast("新密码位数必须大于六位");
} else {
this.logining = true;
this.$queue.showLoading("正在修改密码中...");
this.$Request.post("/app/user/updatePwd", {
pwd : password,
oldPwd : oldpassword,
}).then(res => {
uni.hideLoading();
if (res.code === 0) {
this.$queue.showToast('密码修改成功!下次请使用新密码登录!')
setTimeout(function(){
uni.navigateBack()
},1000)
} else {
uni.showModal({
showCancel: false,
title: '密码修改失败',
content: res.msg,
});
}
});
}
},
},
}
</script>
<style lang='scss'>
page {
height: 100%;
background: #1E1F31 !important;
}
.container {
padding-top: 32upx;
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
background: #1E1F31 !important;
}
.wrapper {
position: relative;
z-index: 90;
background: #111224;
padding-bottom: 20px;
}
.input-content {
padding: 32upx 80upx;
}
.confirm-btn {
width: 600upx;
height: 80upx;
line-height: 80upx;
border-radius: 60upx;
margin-top: 32upx;
background: #5E81F9;
color: #fff;
font-size: 32upx;
&:after {
border-radius: 60px;
}
}
</style>