验证码添加图形验证

This commit is contained in:
GGJ
2025-03-21 08:39:44 +08:00
parent 6023eac4fe
commit a388dec384
31 changed files with 1089 additions and 587 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 685 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 972 B

View File

@@ -0,0 +1,259 @@
<template>
<view class="tf-Box-Bg">
<view class="tf-Box">
<view class="tf-Box-title">
<text class="text">请完成安全验证</text>
<!-- <image class="tf-close" src="img/tf-close.png" mode="aspectFit" @click.stop="close_"></image> -->
<view class="tf-close" @click.stop="close_">×</view>
</view>
<canvas :style="{ width: canvasW + 'px', height: canvasH + 'px' }"
class="tf-Box-center" canvas-id="tf-verify-canvas" id="tf-verify-canvas"></canvas>
<movable-area class="tf-Box-BtnBox">
<view class="tf-Box-BtnBox-text">滑动滑块完成拼图</view>
<movable-view class="tf-Box-BtnNei" direction="all" :x="canvasX2" @change="changePath" @touchend="endTouch" @mouseup="endTouch">
<view class="tf-Box-BtnNei-leftBox" :style="{backgroundColor:verifyImgs[verifyIndex].color}"></view>
</movable-view>
</movable-area>
</view>
</view>
</template>
<script>
export default {
name:"tf-verify-img",
props:{
verifyImgs:{
type:Array,
default: function(){
return []
}
}
},
data() {
return {
verifyIndex:0,
canvasW:"",
canvasH:"",
canvasX2:0,//归为用的
canvasX:0,//实时移动X
ctx:false,
jgX:0,//结果X
dqImgPath:'',//本地临时图片路径
};
},
created() {
this.canvasW = uni.upx2px(580);
this.canvasH = uni.upx2px(290);
console.log("created");
},
mounted() {
this.$nextTick(()=>{
this.init()
})
},
methods:{
// 生成从minNum到maxNum的随机数
randomNum(minNum,maxNum){
switch(arguments.length){
case 1:
return parseInt(Math.random()*minNum+1,10);
break;
case 2:
return parseInt(Math.random()*(maxNum-minNum+1)+minNum,10);
break;
default:
return 0;
break;
}
},
close_(){
this.$emit('close');
},
init(){
if(this.verifyImgs.length==0){
uni.showToast({
title: 'verifyImgs不能为空',
icon:"none"
});
return;
}
console.log("init");
this.canvasX2--;
this.canvasX = 0;
this.verifyIndex = this.randomNum(0,this.verifyImgs.length-1);
this.ctx = uni.createCanvasContext('tf-verify-canvas',this);
console.log(this.ctx);
this.jgX = this.randomNum(uni.upx2px(150),uni.upx2px(450));
this.dqImgPath = this.verifyImgs[this.verifyIndex].src;
this.huatu();
},
endTouch(){
if(Math.abs(this.canvasX-this.jgX)<=5){
this.$emit('succeed')
}else{
uni.showToast({
title: '验证失败',
icon:"error"
});
this.init();
}
},
huatu(){
let this_ = this;
let r = uni.upx2px(10);
let XX = this.canvasX;
let YY = uni.upx2px(100);
let cs = uni.upx2px(20);
this_.ctx.drawImage(this_.dqImgPath,0,0,this_.canvasW,this_.canvasH);
//画不可移动的拼图块
this_.ctx.beginPath();
this_.ctx.moveTo(-2*r+this_.jgX+cs+2*r, YY-2*r+2*r);
this_.ctx.lineTo(-2*r+this_.jgX+cs+5.5*r, YY-2*r+2*r);
this_.ctx.arcTo(-2*r+this_.jgX+cs+5.5*r, YY-2*r+3*r, XX-2+this_.jgX*r+cs+6.5*r, YY-2*r+3*r, r);
this_.ctx.lineTo(-2*r+this_.jgX+cs+7.5*r, YY-2*r+3*r);
this_.ctx.arcTo(-2*r+this_.jgX+cs+8.5*r, YY-2*r+3*r, -2*r+this_.jgX+cs+8.5*r, YY-2*r+2*r, r);
this_.ctx.lineTo(-2*r+this_.jgX+cs+12*r, YY-2*r+2*r);
this_.ctx.lineTo(-2*r+this_.jgX+cs+12*r, YY-2*r+11*r);
this_.ctx.lineTo(-2*r+this_.jgX+cs+8.5*r, YY-2*r+11*r);
this_.ctx.arcTo(-2*r+this_.jgX+cs+8.5*r, YY-2*r+12*r, -2*r+this_.jgX+cs+7.5*r, YY-2*r+12*r, r);
this_.ctx.lineTo(-2*r+this_.jgX+cs+6.5*r, YY-2*r+12*r);
this_.ctx.arcTo(-2*r+this_.jgX+cs+5.5*r, YY-2*r+12*r, -2*r+this_.jgX+cs+5.5*r, YY-2*r+11*r, r);
this_.ctx.lineTo(-2*r+this_.jgX+cs+2*r, YY-2*r+11*r);
this_.ctx.lineTo(-2*r+this_.jgX+cs+2*r, YY-2*r+8*r);
this_.ctx.arcTo(-2*r+this_.jgX+cs+3*r, YY-2*r+8*r, -2*r+this_.jgX+cs+3*r, YY-2*r+7*r, r);
this_.ctx.lineTo(-2*r+this_.jgX+cs+3*r, YY-2*r+6*r);
this_.ctx.arcTo(-2*r+this_.jgX+cs+3*r, YY-2*r+5*r, -2*r+this_.jgX+cs+2*r, YY-2*r+5*r, r);
this_.ctx.lineTo(-2*r+this_.jgX+cs+2*r, YY-2*r+2*r);
this_.ctx.shadowBlur=10;
this_.ctx.shadowColor="#ffffff";
this_.ctx.fillStyle = "rgba(0,0,0,0.5)";
this_.ctx.fill();
this_.ctx.restore();
//画可移动的拼图块
this_.ctx.beginPath();
this_.ctx.save();
this_.ctx.moveTo(XX-2*r+cs+2*r, YY-2*r+2*r);
this_.ctx.lineTo(XX-2*r+cs+5.5*r, YY-2*r+2*r);
this_.ctx.arcTo(XX-2*r+cs+5.5*r, YY-2*r+3*r, XX-2*r+cs+6.5*r, YY-2*r+3*r, r);
this_.ctx.lineTo(XX-2*r+cs+7.5*r, YY-2*r+3*r);
this_.ctx.arcTo(XX-2*r+cs+8.5*r, YY-2*r+3*r, XX-2*r+cs+8.5*r, YY-2*r+2*r, r);
this_.ctx.lineTo(XX-2*r+cs+12*r, YY-2*r+2*r);
this_.ctx.lineTo(XX-2*r+cs+12*r, YY-2*r+11*r);
this_.ctx.lineTo(XX-2*r+cs+8.5*r, YY-2*r+11*r);
this_.ctx.arcTo(XX-2*r+cs+8.5*r, YY-2*r+12*r, XX-2*r+cs+7.5*r, YY-2*r+12*r, r);
this_.ctx.lineTo(XX-2*r+cs+6.5*r, YY-2*r+12*r);
this_.ctx.arcTo(XX-2*r+cs+5.5*r, YY-2*r+12*r, XX-2*r+cs+5.5*r, YY-2*r+11*r, r);
this_.ctx.lineTo(XX-2*r+cs+2*r, YY-2*r+11*r);
this_.ctx.lineTo(XX-2*r+cs+2*r, YY-2*r+8*r);
this_.ctx.arcTo(XX-2*r+cs+3*r, YY-2*r+8*r, XX-2*r+cs+3*r, YY-2*r+7*r, r);
this_.ctx.lineTo(XX-2*r+cs+3*r, YY-2*r+6*r);
this_.ctx.arcTo(XX-2*r+cs+3*r, YY-2*r+5*r, XX-2*r+cs+2*r, YY-2*r+5*r, r);
this_.ctx.lineTo(XX-2*r+cs+2*r, YY-2*r+2*r);
this_.ctx.shadowBlur=10;
this_.ctx.shadowColor="#ffffff";
this_.ctx.fill();
this_.ctx.clip();
this_.ctx.drawImage(this_.dqImgPath,this_.canvasX-this_.jgX,0,this_.canvasW,this_.canvasH);
this_.ctx.restore();
//绘图
this_.ctx.draw();
},
changePath(e){
// #ifdef APP-NVUE
this.canvasX = e.detail.x;
// #endif
// #ifndef APP-NVUE
this.canvasX = e.target.x;
// #endif
this.huatu();
}
}
}
</script>
<style lang="less">
.tf-Box-Bg{
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
z-index: 100;
background-color: rgba(0,0,0,.3);
display: flex;
align-items: center;
justify-content: center;
.tf-Box{
width: 640upx;
height: 584upx;
background-color: #fff;
border-radius: 6upx;
box-shadow: 0 0 50upx 0upx rgba(0,0,0,.2);
.tf-Box-title{
height: 100upx;
line-height: 100upx;
padding: 0 32upx;
border-bottom: 1px solid #E1E3E9;
flex-direction: row;
display: flex;
align-items: center;
justify-content: space-between;
.text{
font-size: 32upx;
flex: 1;
}
.tf-close{
font-size: 40upx;
color:#ccc;
}
}
.tf-Box-center{
margin-top: 30upx;
margin-bottom: 30upx;
align-self: center;
}
.tf-Box-BtnBox{
margin-top: 30upx;
margin-bottom: 30upx;
align-self: center;
width: 580upx;
height: 75upx;
line-height: 75upx;
text-align: center;
font-size: 28upx;
border-radius: 6upx;
border: 1px solid #E1E3E9;
background-color: #F7F8F9;
overflow: hidden;
position: relative;
.tf-Box-BtnBox-text{
width: 100%;
height: 75upx;
position: absolute;
top: 0;
left: 0;
color: #424649;
text-align: center;
}
.tf-Box-BtnNei{
height: 75upx;
width: 75upx;
background-color: #fff;
box-shadow: 0 0 10upx 0upx rgba(0,0,0,.2);
background-image: url(img/tf-arrows.png);
background-size: 34upx;
background-position: center;
background-repeat: no-repeat;
.tf-Box-BtnNei-leftBox{
position: absolute;
top: 0;
left: -580upx;
width: 580upx;
height: 100%;
}
}
}
}
}
</style>

View File

@@ -0,0 +1,53 @@
<template>
<view>
<!-- 图片滑块 -->
<tf-verify-img @succeed="chenggong" @close="showVerify = false" v-if="showVerify" :verifyImgs="imgs"></tf-verify-img>
</view>
</template>
<script>
import tfVerifyImg from '@/components/tf-verify-img/tf-verify-img.vue';
export default {
components: { tfVerifyImg },
data() {
return {
showVerify: false,
imgs: [
{
src: '/static/pic/BG0.jpeg',
color: '#67c23a'
},
{
src: '/static/pic/BG1.jpeg',
color: '#67c23a'
},{
src: '/static/pic/BG2.jpg',
color: '#67c23a'
},{
src: '/static/pic/BG3.jpg',
color: '#67c23a'
},{
src: '/static/pic/BG4.jpg',
color: '#67c23a'
},
]
}
},
methods: {
open(){
this.showVerify=true
},
chenggong() {
uni.showToast({
title: '验证成功'
});
this.showVerify = false;
this.$emit('chenggong');
}
}
}
</script>
<style>
</style>

31
main.js
View File

@@ -7,9 +7,12 @@ Vue.config.productionTip = false
// 挂载 全局变量 // 挂载 全局变量
Vue.prototype.devCode = "2aaecd0b124df819eda75e639a1f91fd"; Vue.prototype.devCode = "2aaecd0b124df819eda75e639a1f91fd";
// Vue.prototype.serverUrl = "https://pqmcc.com:8040/shiningCloud"; // Vue.prototype.serverUrl = "https://pqmcc.com:8040/shiningCloud";
Vue.prototype.serverUrl = "http://112.4.156.196:8040/shiningCloud"; // Vue.prototype.serverUrl = "http://112.4.156.196:8040/shiningCloud";
// Vue.prototype.serverUrl = "http://www.pqmcc.com:8040/shiningCloud"; Vue.prototype.serverUrl = "http://www.pqmcc.com:8040/shiningCloud";
// Vue.prototype.serverUrl = "http://192.168.1.125:8889/shiningCloud";
Vue.prototype.key = "f81804778c89c779"; Vue.prototype.key = "f81804778c89c779";
Vue.prototype.authTokenId = "";
Vue.prototype.getCid=function(){ Vue.prototype.getCid=function(){
var that = this var that = this
// #ifdef APP-PLUS // #ifdef APP-PLUS
@@ -58,16 +61,36 @@ Vue.prototype.createMessage=function(title,payload,content){
} }
Vue.prototype.cid = function(){ Vue.prototype.cid = function(){
var that= this; var that= this;
// return '088GgLnToXTWf6XUpi8N7Z47PcqaKmONlF0ChR7F4gjdSLRIyTnTruoYfLxGK3Oy'
var cidAES = uni.getStorageSync('cidAES'); var cidAES = uni.getStorageSync('cidAES');
// var cid = uni.getStorageSync('cid');
if(!(cidAES!=null&&cidAES!='null'&&cidAES!=''&&cidAES!=undefined)){ if(!(cidAES!=null&&cidAES!='null'&&cidAES!=''&&cidAES!=undefined)){
setTimeout(function() { setTimeout(function() {
return that.cid(); return that.cid();
}, 500); }, 500);
}else{ }else{
return cidAES; return cidAES;
} }
} }
Vue.prototype.authToken = function(){
var that= this;
console.log(123,that.cid())
uni.request({
url: that.serverUrl + '/user/authToken',
method: 'POST',
data: {
devCode:that.cid(),
},
header: {
'content-type': 'application/x-www-form-urlencoded'
},
sslVerify: false,
success: (res) => {
that.authTokenId=res.data.data
},
});
}
Vue.prototype.judgeLogin = function(){ Vue.prototype.judgeLogin = function(){
var that= this; var that= this;
if((!uni.getStorageSync('userInfo').userId)||(!uni.getStorageSync('userInfo').phone)){ if((!uni.getStorageSync('userInfo').userId)||(!uni.getStorageSync('userInfo').phone)){

View File

@@ -1,6 +1,6 @@
{ {
"name" : "灿能云", "name" : "灿能云",
"appid" : "__UNI__903A5B1", "appid" : "__UNI__9894FCF",
"description" : "", "description" : "",
"versionName" : "1.2.1", "versionName" : "1.2.1",
"versionCode" : 121, "versionCode" : 121,
@@ -68,9 +68,8 @@
"push" : { "push" : {
"unipush" : {} "unipush" : {}
}, },
"speech" : { "speech" : {},
"ifly" : {} // "ifly" : {}
},
"ad" : {} "ad" : {}
}, },
"icons" : { "icons" : {

17
package.json Normal file
View File

@@ -0,0 +1,17 @@
{
"id": "tf-verify-img",
"name": "高性能多端拼图滑动验证",
"version": "1.0.3",
"description": "一款高性能的多端拼图滑动验证组件(希望各位大佬们抽出宝贵的时间留下您的评论,感激不尽)",
"keywords": [
"拼图",
"滑动验证"
],
"dcloudext": {
"category": [
"前端组件",
"通用组件"
]
},
"displayName": "高性能多端拼图滑动验证"
}

View File

@@ -184,6 +184,13 @@
,{ ,{
"path" : "pages/terminalStatusAll/terminalStatusAll", "path" : "pages/terminalStatusAll/terminalStatusAll",
"style" : {} "style" : {}
},
{
"path" : "components/tfVerify/tfVerify",
"style" :
{
"navigationBarTitleText" : ""
}
} }
], ],
"tabBar": { "tabBar": {

View File

@@ -1,7 +1,7 @@
<template> <template>
<view> <view>
<view> <view>
<web-view src="http://112.4.156.196:8040/shiningCloud/business/companyInfo"></web-view> <web-view src="http://www.pqmcc.com:8040/shiningCloud/business/companyInfo"></web-view>
</view> </view>
</view> </view>
</template> </template>

View File

@@ -27,12 +27,18 @@
<view class="textHigh">下一步</view> <view class="textHigh">下一步</view>
</button> </button>
</view> </view>
<!-- 图片滑块 -->
<tfVerify ref="tfVerifyRef" @chenggong="chenggong"/>
</view> </view>
</template> </template>
<script> <script>
import back from '../../components/back.vue'; import back from '../../components/back.vue';
import tfVerify from '@/components/tfVerify/tfVerify.vue';
export default { export default {
components:{
back,tfVerify
},
data() { data() {
return { return {
phoneNum:'', phoneNum:'',
@@ -69,18 +75,24 @@
} }
}, },
sendVercodeAgain(){ sendVercodeAgain(){
this.$refs.tfVerifyRef.open()
},
async chenggong(){
var that = this; var that = this;
if(that.second!=60){ if(that.second!=60){
return; return;
} }
that.sendAgainFlag=1 that.sendAgainFlag=1
await that.authToken();
setTimeout(() => {
uni.request({ uni.request({
url: that.serverUrl+'/user/authCode', url: that.serverUrl+'/user/authCode',
method:'POST', method:'POST',
data: { data: {
phone:that.phoneNumTrue, phone:that.phoneNumTrue,
devCode:that.cid(), devCode:that.cid(),
type:1 type:1,
authToken: that.authTokenId
}, },
header: { header: {
'content-type': 'application/x-www-form-urlencoded' 'content-type': 'application/x-www-form-urlencoded'
@@ -124,7 +136,9 @@
}); });
} }
}); });
}, 500);
}, },
reset(){ reset(){
this.vercode=''; this.vercode='';
this.resetFlag=0; this.resetFlag=0;
@@ -199,9 +213,7 @@
this.phoneNum = e.phoneNum.substr(0,3)+'****'+e.phoneNum.substr(7,11); this.phoneNum = e.phoneNum.substr(0,3)+'****'+e.phoneNum.substr(7,11);
this.sendVercodeAgain(); this.sendVercodeAgain();
}, },
components:{
back
}
} }
</script> </script>

View File

@@ -19,12 +19,16 @@
<view class="textHigh">下一步</view> <view class="textHigh">下一步</view>
</button> </button>
</view> </view>
<!-- 图片滑块 -->
<tfVerify ref="tfVerifyRef" @chenggong="chenggong"/>
</view> </view>
</template> </template>
<script> <script>
import back from '../../components/back.vue'; import back from '../../components/back.vue';
import tfVerify from '@/components/tfVerify/tfVerify.vue';
export default { export default {
components: {back, tfVerify },
data() { data() {
return { return {
pageNameFlag:1, pageNameFlag:1,
@@ -34,7 +38,27 @@
resetFlag:0, resetFlag:0,
nextFlag:0, nextFlag:0,
errorMsg:'', errorMsg:'',
disabledFlag:false disabledFlag:false,
showVerify: false,
imgs: [
{
src: '/static/pic/BG0.jpeg',
color: '#67c23a'
},
{
src: '/static/pic/BG1.jpeg',
color: '#67c23a'
},{
src: '/static/pic/BG2.jpg',
color: '#67c23a'
},{
src: '/static/pic/BG3.jpg',
color: '#67c23a'
},{
src: '/static/pic/BG4.jpg',
color: '#67c23a'
},
]
} }
}, },
methods: { methods: {
@@ -76,12 +100,13 @@
url:'../setNewPassword/setNewPassword?phoneNum='+this.phoneNum, url:'../setNewPassword/setNewPassword?phoneNum='+this.phoneNum,
}) })
} }
}
},
}, },
components:{
back
}
} }
</script> </script>

View File

@@ -67,16 +67,19 @@
that.nextFlag=0 that.nextFlag=0
} }
}, },
sendVercodeAgain(){ async sendVercodeAgain(){
var that = this; var that = this;
that.sendAgainFlag=1 that.sendAgainFlag=1
await that.authToken();
setTimeout(() => {
uni.request({ uni.request({
url: that.serverUrl+'/user/authCode', url: that.serverUrl+'/user/authCode',
method:'POST', method:'POST',
data: { data: {
phone:that.phoneNumTrue, phone:that.phoneNumTrue,
devCode:that.cid(), devCode:that.cid(),
type:3 type:3,
authToken: that.authTokenId
}, },
header: { header: {
'content-type': 'application/x-www-form-urlencoded' 'content-type': 'application/x-www-form-urlencoded'
@@ -122,6 +125,7 @@
that.second=60; that.second=60;
that.sendAgainFlag=0 that.sendAgainFlag=0
},61000) },61000)
}, 500);
}, },
reset(){ reset(){
this.vercode=''; this.vercode='';

View File

@@ -8,22 +8,41 @@
<view class="login-user" @click="jumpToUserAgreement">用户协议</view> <view class="login-user" @click="jumpToUserAgreement">用户协议</view>
<view class="login-user" @click="jumpToPrivacyAgreement">隐私协议</view> <view class="login-user" @click="jumpToPrivacyAgreement">隐私协议</view>
</view> </view>
<view class="phone-block"> <view class="phone-block">
<view class="num">+86</view> <view class="num">+86</view>
<image class="pull" src="/static/pic/pull.png"></image> <image class="pull" src="/static/pic/pull.png"></image>
<view class="phone"> <view class="phone">
<input class="phone-input" placeholder="输入手机号" placeholder-class="phone-placeholder" type="number" @input="changeClass" maxlength="11" confirm-type="done" :value='phoneNum'/> <input
class="phone-input"
placeholder="输入手机号"
placeholder-class="phone-placeholder"
type="number"
@input="changeClass"
maxlength="11"
confirm-type="done"
:value="phoneNum"
/>
</view> </view>
<view class="reset-block" @click="resetPhoneNum" v-if="resetFlag==1"> <view class="reset-block" @click="resetPhoneNum" v-if="resetFlag == 1">
<image class="phone-pic" src="/static/pic/close.png"></image> <image class="phone-pic" src="/static/pic/close.png"></image>
</view> </view>
</view> </view>
<view class="password-block" v-if="loginType==1"> <view class="password-block" v-if="loginType == 1">
<input type="text" :password="passwordFlag" placeholder="请输入密码" confirm-type="done" placeholder-class="password-placeholder" class="phone-input" @input="changePasswordClass" :value="password" maxlength="18"/> <input
<view class="see-block" v-if="seeFlag==1"> type="text"
:password="passwordFlag"
placeholder="请输入密码"
confirm-type="done"
placeholder-class="password-placeholder"
class="phone-input"
@input="changePasswordClass"
:value="password"
maxlength="18"
/>
<view class="see-block" v-if="seeFlag == 1">
<view class="reset-block" @click="reset"> <view class="reset-block" @click="reset">
<image src="/static/pic/close.png" class="close" ></image> <image src="/static/pic/close.png" class="close"></image>
</view> </view>
<view class="line"></view> <view class="line"></view>
<view class="reset-block" @click="see(false)" v-if="passwordFlag"> <view class="reset-block" @click="see(false)" v-if="passwordFlag">
@@ -34,179 +53,184 @@
</view> </view>
</view> </view>
</view> </view>
<view class="rememberMe-block" @click="changeRememberFlag" v-if="loginType==1"> <view class="rememberMe-block" @click="changeRememberFlag" v-if="loginType == 1">
<image src="/static/pic/choose.png" class="rememberMe-pic" v-if="rememberFlag==1"></image> <image src="/static/pic/choose.png" class="rememberMe-pic" v-if="rememberFlag == 1"></image>
<image src="/static/pic/nochoose.png" class="rememberMe-pic" v-else></image> <image src="/static/pic/nochoose.png" class="rememberMe-pic" v-else></image>
<view class="rememberMe-text"> <view class="rememberMe-text">记住密码</view>
记住密码
</view>
</view> </view>
<button class="login-vercode" :loading='loadingFlag' v-if="vercodeFlag==0&&loginType==0"> <button class="login-vercode" :loading="loadingFlag" v-if="vercodeFlag == 0 && loginType == 0">
<view class="text">获取验证码</view> <view class="text">获取验证码</view>
</button> </button>
<button class="login-vercode" :loading='loadingFlag' v-if="vercodeFlag==1&&loginType==0" @click="getVercode" :disabled="disabledFlag"> <button class="login-vercode" :loading="loadingFlag" v-if="vercodeFlag == 1 && loginType == 0" @click="getVercode" :disabled="disabledFlag">
<view class="textHigh" >获取验证码</view> <view class="textHigh">获取验证码</view>
</button> </button>
<button class="login-vercode" :loading='loadingFlag' v-if="vercodeFlag==0&&loginType==1"> <button class="login-vercode" :loading="loadingFlag" v-if="vercodeFlag == 0 && loginType == 1">
<view class="text">登录</view> <view class="text">登录</view>
</button> </button>
<button class="login-vercode" :loading='loadingFlag' v-if="vercodeFlag==1&&loginType==1" @click="loginIn(phoneNum,password)" :disabled="disabledFlag"> <button class="login-vercode" :loading="loadingFlag" v-if="vercodeFlag == 1 && loginType == 1" @click="loginIn(phoneNum, password)" :disabled="disabledFlag">
<view class="textHigh">登录</view> <view class="textHigh">登录</view>
</button> </button>
<view class="login-other" v-if="loginType==0"> <view class="login-other" v-if="loginType == 0">
<view class="login-account" @click="changeLoginType(1)">用账号密码登录</view> <view class="login-account" @click="changeLoginType(1)">用账号密码登录</view>
<view class="login-fast" @click="jumpToFastlogin">快速注册</view> <view class="login-fast" @click="jumpToFastlogin">快速注册</view>
</view> </view>
<view class="login-other" v-if="loginType==1"> <view class="login-other" v-if="loginType == 1">
<view class="login-account" @click="changeLoginType(0)">短信验证码登录</view> <view class="login-account" @click="changeLoginType(0)">短信验证码登录</view>
<view class="login-right"> <view class="login-right">
<view class="login-fast" @click="jumpToForgetPassword">忘记密码</view> <view class="login-fast" @click="jumpToForgetPassword">忘记密码</view>
<view class="login-line"></view> <view class="login-line"></view>
<view class="login-fast" @click="jumpToFastlogin">快速注册</view> <view class="login-fast" @click="jumpToFastlogin">快速注册</view>
</view> </view>
</view>
<view class="introduce-block">
寻电能质量之因解电能质量之惑治电能质量之本
</view> </view>
<view class="introduce-block"> 寻电能质量之因解电能质量之惑治电能质量之本 </view>
</view> </view>
<!-- 图片滑块 -->
<tfVerify ref="tfVerifyRef" @chenggong="chenggong" />
</view> </view>
</template> </template>
<script> <script>
import back from "../../components/back.vue"; import back from '../../components/back.vue';
export default { import tfVerify from '@/components/tfVerify/tfVerify.vue';
data() { export default {
return { components: { back, tfVerify },
vercodeFlag:0, data() {
loadingFlag:false, return {
phoneNum:'', vercodeFlag: 0,
errorMsg:'', loadingFlag: false,
showFlag:0, phoneNum: '',
loginType:1 ,//0-验证码登录 1-账号密码 errorMsg: '',
password:'', showFlag: 0,
passwordFlag:true, loginType: 1, //0-验证码登录 1-账号密码
seeFlag:0, password: '',
resetFlag:0, passwordFlag: true,
backShowFlag:0, seeFlag: 0,
rememberFlag:1, resetFlag: 0,
disabledFlag:false backShowFlag: 0,
rememberFlag: 1,
disabledFlag: false
};
},
methods: {
changeRememberFlag() {
var that = this;
if (that.rememberFlag == 0) {
that.rememberFlag = 1;
} else {
that.rememberFlag = 0;
} }
}, },
methods: { changeClass(e) {
changeRememberFlag(){ var that = this;
var that = this; var length = e.detail.value.length;
if(that.rememberFlag==0){ var loginType = that.loginType;
that.rememberFlag=1; if (length > 0) {
}else{ that.resetFlag = 1;
that.rememberFlag=0 that.phoneNum = e.detail.value;
} } else {
}, that.resetFlag = 0;
changeClass(e){ that.phoneNum = '';
var that = this; }
var length = e.detail.value.length; if (length >= 10) {
var loginType =that.loginType; if (loginType == 0) {
if(length>0){ that.vercodeFlag = 1;
that.resetFlag=1 } else {
that.phoneNum=e.detail.value; if (that.password != null && that.password != '') {
}else{ that.vercodeFlag = 1;
that.resetFlag=0;
that.phoneNum='';
}
if(length>=10){
if(loginType==0){
that.vercodeFlag=1;
}else{
if(that.password!=null&&that.password!=''){
that.vercodeFlag=1;
}
} }
}else{
that.vercodeFlag=0;
} }
}, } else {
resetPhoneNum(){ that.vercodeFlag = 0;
this.phoneNum=""; }
this.resetFlag=0; },
this.vercodeFlag=0; resetPhoneNum() {
}, this.phoneNum = '';
changePasswordClass(e){ this.resetFlag = 0;
var that = this; this.vercodeFlag = 0;
var length = e.detail.value.length; },
var phoneNum =that.phoneNum; changePasswordClass(e) {
if(length>0){ var that = this;
that.password=e.detail.value; var length = e.detail.value.length;
that.seeFlag=1; var phoneNum = that.phoneNum;
if(phoneNum!=null&&phoneNum!=''){ if (length > 0) {
that.vercodeFlag=1; that.password = e.detail.value;
} that.seeFlag = 1;
}else{ if (phoneNum != null && phoneNum != '') {
that.vercodeFlag=0; that.vercodeFlag = 1;
that.password='';
that.seeFlag=0;
}
},
reset(){
this.password='';
this.passwordFlag=true;
this.seeFlag=0;
this.vercodeFlag=0;
},
see(flag){
this.passwordFlag=flag;
},
getVercode(){
var that = this;
that.disabledFlag=true;
that.loadingFlag=true;
if(that.phoneNum.length!=11){
that.showFlag=1;
that.errorMsg='请检查号码';
that.loadingFlag=false;
setTimeout(function() {
that.errorMsg='';
that.showFlag=0;
that.disabledFlag=false;
}, 5000);
return;
} }
} else {
that.vercodeFlag = 0;
that.password = '';
that.seeFlag = 0;
}
},
reset() {
this.password = '';
this.passwordFlag = true;
this.seeFlag = 0;
this.vercodeFlag = 0;
},
see(flag) {
this.passwordFlag = flag;
},
getVercode() {
this.$refs.tfVerifyRef.open();
},
async chenggong() {
var that = this;
that.disabledFlag = true;
that.loadingFlag = true;
if (that.phoneNum.length != 11) {
that.showFlag = 1;
that.errorMsg = '请检查号码';
that.loadingFlag = false;
setTimeout(function () {
that.errorMsg = '';
that.showFlag = 0;
that.disabledFlag = false;
}, 5000);
return;
}
await that.authToken();
setTimeout(() => {
uni.request({ uni.request({
url: that.serverUrl+'/user/authCode', url: that.serverUrl + '/user/authCode',
method:'POST', method: 'POST',
data: { data: {
phone:that.phoneNum, phone: that.phoneNum,
devCode:that.cid(), devCode: that.cid(),
type:0 type: 0,
authToken: that.authTokenId
}, },
header: { header: {
'content-type': 'application/x-www-form-urlencoded' 'content-type': 'application/x-www-form-urlencoded'
}, },
sslVerify:false, sslVerify: false,
success: (res) => { success: (res) => {
that.loadingFlag=false; console.log(123, res);
if(res.data.resultCode=='10000'){ that.loadingFlag = false;
that.disabledFlag=false; if (res.data.resultCode == '10000') {
that.disabledFlag = false;
uni.navigateTo({ uni.navigateTo({
url:'../vercode/vercode?phoneNum='+that.phoneNum, url: '../vercode/vercode?phoneNum=' + that.phoneNum
}) });
}else{ } else {
that.errorMsg=that.showError(res.data.msgCode,res.data.msg); that.errorMsg = that.showError(res.data.msgCode, res.data.msg);
that.showFlag=1 that.showFlag = 1;
setTimeout(function() { setTimeout(function () {
that.errorMsg=''; that.errorMsg = '';
that.showFlag=0; that.showFlag = 0;
that.disabledFlag=false; that.disabledFlag = false;
}, 5000); }, 5000);
} }
}, },
fail:(re)=>{ fail: (re) => {
that.loadingFlag=false; that.loadingFlag = false;
that.disabledFlag=false; that.disabledFlag = false;
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '网络或服务器异常,请稍后再试', content: '网络或服务器异常,请稍后再试',
showCancel:false, showCancel: false,
success: function (res) { success: function (res) {
if (res.confirm) { if (res.confirm) {
console.log('用户点击确定'); console.log('用户点击确定');
@@ -217,191 +241,196 @@
}); });
} }
}); });
}, 500);
}, },
loginIn(account,password){ loginIn(account, password) {
var that = this; var that = this;
that.loadingFlag=true; that.loadingFlag = true;
that.disabledFlag=true; that.disabledFlag = true;
if(account.length!=11){ if (account.length != 11) {
that.loadingFlag=false; that.loadingFlag = false;
that.showFlag=1; that.showFlag = 1;
that.errorMsg='请检查号码'; that.errorMsg = '请检查号码';
setTimeout(function() { setTimeout(function () {
that.errorMsg=''; that.errorMsg = '';
that.showFlag=0; that.showFlag = 0;
that.disabledFlag=false; that.disabledFlag = false;
}, 5000); }, 5000);
return; return;
} }
uni.request({ uni.request({
url: that.serverUrl+'/user/login', url: that.serverUrl + '/user/login',
method:'POST', method: 'POST',
data: { data: {
phone:account, phone: account,
devCode:that.cid(), devCode: that.cid(),
key:password.trim(), key: password.trim(),
type:1 type: 1
}, },
header: { header: {
'content-type': 'application/x-www-form-urlencoded' 'content-type': 'application/x-www-form-urlencoded'
}, },
sslVerify:false, sslVerify: false,
success: (res) => { success: (res) => {
that.loadingFlag=false; that.loadingFlag = false;
if(res.data.resultCode=='10000'){ if (res.data.resultCode == '10000') {
if(that.rememberFlag==1&&that.phoneNum!=null&&that.phoneNum!=undefined&&that.phoneNum!=''&&that.password!=null&&that.password!=undefined&&that.password!=''){ if (
uni.setStorageSync("account",that.phoneNum); that.rememberFlag == 1 &&
uni.setStorageSync("password",that.password); that.phoneNum != null &&
} that.phoneNum != undefined &&
uni.setStorageSync('loginType',1); that.phoneNum != '' &&
uni.setStorageSync("loginTime",new Date()) that.password != null &&
var userInfo = eval(res.data.data); that.password != undefined &&
userInfo.phoneNum=that.phoneNum; that.password != ''
uni.setStorageSync('userInfo',userInfo); ) {
that.disabledFlag=false; uni.setStorageSync('account', that.phoneNum);
// console.log(userInfo.userId) uni.setStorageSync('password', that.password);
uni.switchTab({
url:'../information/information',
})
}else{
var msg = '';
if(res.data.msg==undefined||res.data.msg==null||res.data.msg==''){
msg = '服务器或网络异常'
}else{
msg = res.data.msg
}
that.errorMsg=that.showError(res.data.msgCode,msg);
that.showFlag = 1
setTimeout(function() {
that.errorMsg='';
that.showFlag=0;
that.disabledFlag=false;
}, 5000);
} }
}, uni.setStorageSync('loginType', 1);
fail:(re)=>{ uni.setStorageSync('loginTime', new Date());
that.disabledFlag=false; var userInfo = eval(res.data.data);
that.loadingFlag=false; userInfo.phoneNum = that.phoneNum;
uni.showModal({ uni.setStorageSync('userInfo', userInfo);
title: '提示', that.disabledFlag = false;
content: '服务器或网络异常', // console.log(userInfo.userId)
showCancel:false, uni.switchTab({
success: function (res) { url: '../information/information'
if (res.confirm) {
console.log('用户点击确定');
} else if (res.cancel) {
console.log('用户点击取消');
}
}
}); });
} else {
var msg = '';
if (res.data.msg == undefined || res.data.msg == null || res.data.msg == '') {
msg = '服务器或网络异常';
} else {
msg = res.data.msg;
}
that.errorMsg = that.showError(res.data.msgCode, msg);
that.showFlag = 1;
setTimeout(function () {
that.errorMsg = '';
that.showFlag = 0;
that.disabledFlag = false;
}, 5000);
} }
}); },
}, fail: (re) => {
changeLoginType(type){ that.disabledFlag = false;
var that = this; that.loadingFlag = false;
that.loginType=type; uni.showModal({
that.loadingFlag=false; title: '提示',
that.errorMsg=''; content: '服务器或网络异常',
that.showFlag=0; showCancel: false,
that.password=''; success: function (res) {
that.passwordFlag=false; if (res.confirm) {
that.seeFlag=0; console.log('用户点击确定');
that.vercodeFlag=0 } else if (res.cancel) {
if(type==0&&that.phoneNum.length>=10){ console.log('用户点击取消');
that.vercodeFlag=1 }
}
});
} }
}, });
jumpToForgetPassword(){ },
uni.navigateTo({ changeLoginType(type) {
url:'../forgetPassword/forgetPassword', var that = this;
}) that.loginType = type;
}, that.loadingFlag = false;
jumpToFastlogin(){ that.errorMsg = '';
uni.navigateTo({ that.showFlag = 0;
url: '../fastLogin/fastLogin', that.password = '';
}); that.passwordFlag = false;
}, that.seeFlag = 0;
jumpToUserAgreement(){ that.vercodeFlag = 0;
uni.navigateTo({ if (type == 0 && that.phoneNum.length >= 10) {
url: '../userAgreement/userAgreement', that.vercodeFlag = 1;
});
},
jumpToPrivacyAgreement(){
uni.navigateTo({
url: '../privacyAgreement/privacyAgreement',
});
} }
}, },
onLoad() { jumpToForgetPassword() {
var that=this; uni.navigateTo({
// var style = plus.navigator.getUiStyle(); url: '../forgetPassword/forgetPassword'
// console.log(style) });
// if('dark'==style){ },
// console.log('当前为暗黑模式'); jumpToFastlogin() {
// }else{ uni.navigateTo({
// console.log('当前为普通模式'); url: '../fastLogin/fastLogin'
// } });
that.getCid(); },
var cid = that.cid(); jumpToUserAgreement() {
if(cid){ uni.navigateTo({
var loginTime = uni.getStorageSync("loginTime"); url: '../userAgreement/userAgreement'
if(loginTime){ });
if((new Date()-loginTime)/(1000*24*60*60)>30||(new Date()-loginTime)<0){ },
uni.removeStorageSync("account"); jumpToPrivacyAgreement() {
uni.removeStorageSync("password"); uni.navigateTo({
}else{ url: '../privacyAgreement/privacyAgreement'
if(uni.getStorageSync("loginType")==1){ });
var account = uni.getStorageSync("account"); }
var password = uni.getStorageSync("password"); },
if(account!=null&&account!=undefined&&account!=''&&password!=null&&password!=undefined&&password!=''){ onLoad() {
that.phoneNum=account; var that = this;
that.password=password; // var style = plus.navigator.getUiStyle();
that.vercodeFlag=1; // console.log(style)
that.resetFlag=1; // if('dark'==style){
that.seeFlag=1; // console.log('当前为暗黑模式');
that.passwordFlag=1; // }else{
that.loginIn(account,password) // console.log('当前为普通模式');
} // }
}else{ that.getCid();
if(uni.getStorageSync("userInfo")){ var cid = that.cid();
uni.switchTab({ if (cid) {
url:'../information/information' var loginTime = uni.getStorageSync('loginTime');
}) if (loginTime) {
} if ((new Date() - loginTime) / (1000 * 24 * 60 * 60) > 30 || new Date() - loginTime < 0) {
uni.removeStorageSync('account');
uni.removeStorageSync('password');
} else {
if (uni.getStorageSync('loginType') == 1) {
var account = uni.getStorageSync('account');
var password = uni.getStorageSync('password');
if (account != null && account != undefined && account != '' && password != null && password != undefined && password != '') {
that.phoneNum = account;
that.password = password;
that.vercodeFlag = 1;
that.resetFlag = 1;
that.seeFlag = 1;
that.passwordFlag = 1;
that.loginIn(account, password);
}
} else {
if (uni.getStorageSync('userInfo')) {
uni.switchTab({
url: '../information/information'
});
} }
} }
} }
}else{ }
setTimeout(function(){ } else {
var loginTime = uni.getStorageSync("loginTime"); setTimeout(function () {
if(loginTime){ var loginTime = uni.getStorageSync('loginTime');
if((new Date()-loginTime)/(1000*24*60*60)>30||(new Date()-loginTime)<0){ if (loginTime) {
uni.removeStorageSync("account"); if ((new Date() - loginTime) / (1000 * 24 * 60 * 60) > 30 || new Date() - loginTime < 0) {
uni.removeStorageSync("password"); uni.removeStorageSync('account');
}else{ uni.removeStorageSync('password');
var account = uni.getStorageSync("account"); } else {
var password = uni.getStorageSync("password"); var account = uni.getStorageSync('account');
if(account!=null&&account!=undefined&&account!=''&&password!=null&&password!=undefined&&password!=''){ var password = uni.getStorageSync('password');
that.phoneNum=account; if (account != null && account != undefined && account != '' && password != null && password != undefined && password != '') {
that.password=password; that.phoneNum = account;
that.vercodeFlag=1; that.password = password;
that.resetFlag=1; that.vercodeFlag = 1;
that.seeFlag=1; that.resetFlag = 1;
that.passwordFlag=1; that.seeFlag = 1;
that.loginIn(account,password) that.passwordFlag = 1;
that.loginIn(account, password);
} }
} }
} }
},2000) }, 2000);
}
},
components: {
back
} }
} }
};
</script> </script>
<style> <style>
@import url("login.css"); @import url('login.css');
</style> </style>

View File

@@ -67,16 +67,19 @@
that.nextFlag=0 that.nextFlag=0
} }
}, },
sendVercodeAgain(){ async sendVercodeAgain(){
var that = this; var that = this;
that.sendAgainFlag=1 that.sendAgainFlag=1
await that.authToken();
setTimeout(() => {
uni.request({ uni.request({
url: that.serverUrl+'/user/authCode', url: that.serverUrl+'/user/authCode',
method:'POST', method:'POST',
data: { data: {
phone:that.phoneNumTrue, phone:that.phoneNumTrue,
devCode:that.cid(), devCode:that.cid(),
type:2 type:2,
authToken: that.authTokenId
}, },
header: { header: {
'content-type': 'application/x-www-form-urlencoded' 'content-type': 'application/x-www-form-urlencoded'
@@ -122,6 +125,7 @@
that.second=60; that.second=60;
that.sendAgainFlag=0 that.sendAgainFlag=0
},61000) },61000)
}, 500);
}, },
reset(){ reset(){
this.vercode=''; this.vercode='';

View File

@@ -73,7 +73,7 @@
disabledFlag:false, disabledFlag:false,
doneFlag:0, doneFlag:0,
sendAgain:'发送验证码', sendAgain:'发送验证码',
sendAgainFlag:0, sendAgainFlag:1,
resetFlag:0, resetFlag:0,
vercode:'', vercode:'',
second:60, second:60,
@@ -115,6 +115,11 @@
that.seeFlag=0; that.seeFlag=0;
that.password=''; that.password='';
} }
if( that.password.length>0 && that.again.length>0 ){
that.sendAgainFlag=0
}else{
that.sendAgainFlag=1
}
}, },
setAgain(e){ setAgain(e){
var that = this; var that = this;
@@ -130,6 +135,11 @@
that.seeAgainFlag=0; that.seeAgainFlag=0;
that.again=''; that.again='';
} }
if( that.password.length>0 && that.again.length>0 ){
that.sendAgainFlag=0
}else{
that.sendAgainFlag=1
}
}, },
see(flag){ see(flag){
this.passwordFlag=flag; this.passwordFlag=flag;
@@ -137,19 +147,22 @@
seeAgain(flag){ seeAgain(flag){
this.againFlag=flag; this.againFlag=flag;
}, },
sendVercodeAgain(){ async sendVercodeAgain(){
var that = this; var that = this;
if(that.second!=60){ if(that.second!=60){
return; return;
} }
that.sendAgainFlag=1 that.sendAgainFlag=1
await that.authToken();
setTimeout(() => {
uni.request({ uni.request({
url: that.serverUrl+'/user/authCode', url: that.serverUrl+'/user/authCode',
method:'POST', method:'POST',
data: { data: {
phone:that.phoneNum, phone:that.phoneNum,
devCode:that.cid(), devCode:that.cid(),
type:2 type:2,
authToken: that.authTokenId
}, },
header: { header: {
'content-type': 'application/x-www-form-urlencoded' 'content-type': 'application/x-www-form-urlencoded'
@@ -193,6 +206,7 @@
}); });
} }
}); });
}, 500);
}, },
complete(){ complete(){
var that = this; var that = this;

View File

@@ -68,20 +68,25 @@
that.nextFlag=0 that.nextFlag=0
} }
}, },
sendVercodeAgain(){ async sendVercodeAgain(){
var that = this; var that = this;
if(that.second!=60){ if(that.second!=60){
return; return;
} }
that.sendAgainFlag=1 that.sendAgainFlag=1
if(that.judgeLogin()){ if(that.judgeLogin()){
await that.authToken();
setTimeout(() => {
uni.request({ uni.request({
url: that.serverUrl+'/user/authCode', url: that.serverUrl+'/user/authCode',
method:'POST', method:'POST',
data: { data: {
phone:uni.getStorageSync('userInfo').phone, phone:uni.getStorageSync('userInfo').phone,
devCode:that.cid(), devCode:that.cid(),
type:5 type:5,
authToken: that.authTokenId
}, },
header: { header: {
'content-type': 'application/x-www-form-urlencoded' 'content-type': 'application/x-www-form-urlencoded'
@@ -125,6 +130,7 @@
}); });
} }
}); });
}, 500);
} }
}, },
reset(){ reset(){

View File

@@ -1,275 +1,296 @@
<template> <template>
<view> <view>
<back :pageNameFlag="pageNameFlag" :showFlag="showFlag" :pageName='pageName' :errorMsg='errorMsg'></back> <back :pageNameFlag="pageNameFlag" :showFlag="showFlag" :pageName="pageName" :errorMsg="errorMsg"></back>
<view class="setNew-block"> <view class="setNew-block">
<view class="text-top">请设置新的手机号码</view> <view class="text-top">请设置新的手机号码</view>
<view class="password-block"> <view class="password-block">
<input class="password-input" placeholder="请输入手机号" placeholder-class="password-placeholder-input" :value='password' @input="setPassword" type="number" maxlength="11"/> <input
class="password-input"
placeholder="请输入手机号"
placeholder-class="password-placeholder-input"
:value="password"
@input="setPassword"
type="number"
maxlength="11"
/>
</view> </view>
<view class="phone-block"> <view class="phone-block">
<view class="vercode"> <view class="vercode">
<input class="vercode-input" placeholder="请输入验证码" :value="vercode" placeholder-class="vercode-placeholder" type="number" @input="changeVercode" maxlength="6" confirm-type="done"/> <input
class="vercode-input"
placeholder="请输入验证码"
:value="vercode"
placeholder-class="vercode-placeholder"
type="number"
@input="changeVercode"
maxlength="6"
confirm-type="done"
/>
</view> </view>
<view class="reset-block" @click="reset" v-if="resetFlag==1"> <view class="reset-block" @click="reset" v-if="resetFlag == 1">
<image class="vercode-pic" src="/static/pic/close.png"></image> <image class="vercode-pic" src="/static/pic/close.png"></image>
</view> </view>
<button class="vercode-button" v-if="sendAgainFlag==0" @click="sendVercodeAgain"> <button class="vercode-button" v-if="sendAgainFlag == 0" @click="sendVercodeAgain">
{{sendAgain}} {{ sendAgain }}
</button> </button>
<view class="vercode-button-send" v-if="sendAgainFlag==1"> <view class="vercode-button-send" v-if="sendAgainFlag == 1">
{{sendAgain}} {{ sendAgain }}
</view> </view>
</view> </view>
<button class="login-vercode" v-if="doneFlag==0"> <button class="login-vercode" v-if="doneFlag == 0">
<view class="text">更换</view> <view class="text">更换</view>
</button> </button>
<button class="login-vercode" :loading='loadingFlag' :disabled="disabledFlag" v-if="doneFlag==1" @click="complete"> <button class="login-vercode" :loading="loadingFlag" :disabled="disabledFlag" v-if="doneFlag == 1" @click="complete">
<view class="textHigh" >更换</view> <view class="textHigh">更换</view>
</button> </button>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import back from '../../components/back.vue'; import back from '../../components/back.vue';
export default { export default {
data() { data() {
return { return {
pageNameFlag:1, pageNameFlag: 1,
showFlag:0, showFlag: 0,
pageName:'账号绑定手机号更换', pageName: '账号绑定手机号更换',
phoneNum:'', phoneNum: '',
passwordFlag:true, passwordFlag: true,
againFlag:true, againFlag: true,
password:'', password: '',
again:'', again: '',
seeFlag:0, seeFlag: 0,
seeAgainFlag:0, seeAgainFlag: 0,
loadingFlag:false, loadingFlag: false,
doneFlag:0, doneFlag: 0,
vercode:'', vercode: '',
resetFlag:0, resetFlag: 0,
nextFlag:0, nextFlag: 0,
sendAgain:'发送验证码', sendAgain: '发送验证码',
sendAgainFlag:0, sendAgainFlag: 0,
second:60, second: 60,
errorMsg:'', errorMsg: '',
disabledFlag:false disabledFlag: false
};
},
methods: {
setPassword(e) {
var that = this;
if (e.detail.value.length > 0) {
that.seeFlag = 1;
that.password = e.detail.value;
if (e.detail.value.length > 10) {
that.doneFlag = 1;
} else {
that.doneFlag = 0;
}
} else {
that.seeFlag = 0;
that.password = '';
} }
}, },
methods: { async sendVercodeAgain() {
setPassword(e){ var that = this;
var that = this; if (that.second != 60) {
if(e.detail.value.length>0){ return;
that.seeFlag=1; }
that.password=e.detail.value; that.sendAgainFlag = 1;
if(e.detail.value.length>10){ if (that.password.length == 11) {
that.doneFlag=1; await that.authToken();
}else{ setTimeout(() => {
that.doneFlag=0; console.log(123, that.password, that.cid(), that.authTokenId);
} uni.request({
}else{ url: that.serverUrl + '/user/authCode',
that.seeFlag=0; method: 'POST',
that.password=''; data: {
} phone: that.password,
}, devCode: that.cid(),
sendVercodeAgain(){ type: 4,
var that = this; authToken: that.authTokenId
if(that.second!=60){ },
return; header: {
} 'content-type': 'application/x-www-form-urlencoded'
that.sendAgainFlag=1 },
if(that.password.length==11){ sslVerify: false,
uni.request({ success: (res) => {
url: that.serverUrl+'/user/authCode', if (res.data.resultCode == '10000') {
method:'POST',
data: {
phone:that.password,
devCode:that.cid(),
type:4
},
header: {
'content-type': 'application/x-www-form-urlencoded'
},
sslVerify:false,
success: (res) => {
if(res.data.resultCode=='10000'){
that.second--; that.second--;
var intervalID =setInterval(function(){ var intervalID = setInterval(function () {
that.sendAgain ='重新发送('+that.second-- +"S)"; that.sendAgain = '重新发送(' + that.second-- + 'S)';
},1000); }, 1000);
setTimeout(function(){ setTimeout(function () {
clearInterval(intervalID); clearInterval(intervalID);
that.sendAgain ="发送验证码"; that.sendAgain = '发送验证码';
that.second=60; that.second = 60;
that.sendAgainFlag=0 that.sendAgainFlag = 0;
},61000) }, 61000);
}else{ } else {
that.errorMsg=that.showError(res.data.msgCode,res.data.msg); that.errorMsg = that.showError(res.data.msgCode, res.data.msg);
that.showFlag=1 that.showFlag = 1;
setTimeout(function() { setTimeout(function () {
that.errorMsg=''; that.errorMsg = '';
that.showFlag=0; that.showFlag = 0;
that.sendAgainFlag=0 that.sendAgainFlag = 0;
}, 5000); }, 5000);
}
},
fail() {
that.sendAgainFlag = 0;
uni.showModal({
title: '提示',
content: '网络或服务器异常,请稍后再试',
showCancel: false,
success: function (res) {
if (res.confirm) {
console.log('用户点击确定');
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
} }
}, });
fail() { }, 500);
that.sendAgainFlag=0 } else {
uni.showModal({ that.errorMsg = '请检查手机号';
title: '提示', that.showFlag = 1;
content: '网络或服务器异常,请稍后再试', setTimeout(function () {
showCancel:false, that.errorMsg = '';
success: function (res) { that.showFlag = 0;
if (res.confirm) { that.sendAgainFlag = 0;
console.log('用户点击确定'); }, 5000);
} else if (res.cancel) { }
console.log('用户点击取消'); },
} reset() {
} this.vercode = '';
}); this.resetFlag = 0;
} this.nextFlag = 0;
}); },
}else{ changeVercode(e) {
that.errorMsg='请检查手机号'; var that = this;
that.showFlag=1 if (e.detail.value.length > 0) {
setTimeout(function() { that.vercode = e.detail.value;
that.errorMsg=''; that.resetFlag = 1;
that.showFlag=0; } else {
that.sendAgainFlag=0 that.vercode = '';
that.resetFlag = 0;
}
if (e.detail.value.length == 6) {
that.nextFlag = 1;
} else {
that.nextFlag = 0;
}
},
setAgain(e) {
var that = this;
if (e.detail.value.length > 0) {
that.seeAgainFlag = 1;
that.again = e.detail.value;
if (e.detail.value.length > 10 && that.password.length > 10) {
that.doneFlag = 1;
} else {
that.doneFlag = 0;
}
} else {
that.seeAgainFlag = 0;
that.again = '';
}
},
see(flag) {
this.passwordFlag = flag;
},
seeAgain(flag) {
this.againFlag = flag;
},
complete() {
var that = this;
that.disabledFlag = true;
if (that.judgeLogin()) {
var password = that.password;
var again = that.again;
if (password.length >= 10 && that.vercode != '') {
uni.showLoading({
title: '加载中',
mask: true,
success() {
uni.request({
url: that.serverUrl + '/user/rebindPhone',
method: 'POST',
data: {
userId: uni.getStorageSync('userInfo').userId,
phoneNew: that.password,
devCode: that.cid(),
code: that.vercode
},
header: {
'content-type': 'application/x-www-form-urlencoded'
},
sslVerify: false,
success: (res) => {
uni.hideLoading();
if (res.data.resultCode == '10000') {
uni.showToast({
title: '更换完成',
icon: 'success',
duration: 2000,
mask: true
});
setTimeout(function () {
uni.clearStorageSync();
that.disabledFlag = false;
uni.redirectTo({
url: '../login/login'
});
}, 2000);
} else {
that.errorMsg = that.showError(res.data.msgCode, res.data.msg);
that.showFlag = 1;
setTimeout(function () {
that.errorMsg = '';
that.showFlag = 0;
that.disabledFlag = false;
}, 5000);
}
},
fail: (re) => {
uni.hideLoading();
that.disabledFlag = false;
uni.showModal({
title: '提示',
content: '网络或服务器异常,请稍后再试',
showCancel: false,
success: function (res) {
if (res.confirm) {
console.log('用户点击确定');
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
}
});
}
});
} else {
that.errorMsg = '请检查输入';
that.showFlag = 1;
setTimeout(function () {
that.errorMsg = '';
that.showFlag = 0;
that.disabledFlag = false;
}, 5000); }, 5000);
} }
},
reset(){
this.vercode='';
this.resetFlag=0;
this.nextFlag=0
},
changeVercode(e){
var that = this;
if(e.detail.value.length>0){
that.vercode=e.detail.value;
that.resetFlag=1;
}else{
that.vercode='';
that.resetFlag=0;
}
if(e.detail.value.length==6){
that.nextFlag=1
}else{
that.nextFlag=0
}
},
setAgain(e){
var that = this;
if(e.detail.value.length>0){
that.seeAgainFlag=1;
that.again=e.detail.value;
if(e.detail.value.length>10&&that.password.length>10){
that.doneFlag=1;
}else{
that.doneFlag=0;
}
}else{
that.seeAgainFlag=0;
that.again='';
}
},
see(flag){
this.passwordFlag=flag;
},
seeAgain(flag){
this.againFlag=flag;
},
complete(){
var that = this;
that.disabledFlag=true;
if(that.judgeLogin()){
var password = that.password;
var again = that.again;
if(password.length>=10&&that.vercode!=''){
uni.showLoading({
title:'加载中',
mask:true,
success() {
uni.request({
url: that.serverUrl+'/user/rebindPhone',
method:'POST',
data: {
userId:uni.getStorageSync('userInfo').userId,
phoneNew:that.password,
devCode:that.cid(),
code:that.vercode
},
header: {
'content-type': 'application/x-www-form-urlencoded'
},
sslVerify:false,
success: (res) => {
uni.hideLoading();
if(res.data.resultCode=='10000'){
uni.showToast({
title: '更换完成',
icon:'success',
duration: 2000,
mask:true
});
setTimeout(function () {
uni.clearStorageSync();
that.disabledFlag=false;
uni.redirectTo({
url:'../login/login'
})
},2000)
}else{
that.errorMsg=that.showError(res.data.msgCode,res.data.msg);
that.showFlag=1
setTimeout(function() {
that.errorMsg='';
that.showFlag=0;
that.disabledFlag=false;
}, 5000);
}
},
fail:(re)=>{
uni.hideLoading();
that.disabledFlag=false;
uni.showModal({
title: '提示',
content: '网络或服务器异常,请稍后再试',
showCancel:false,
success: function (res) {
if (res.confirm) {
console.log('用户点击确定');
} else if (res.cancel) {
console.log('用户点击取消');
}
},
});
}
});
}
})
}else{
that.errorMsg='请检查输入';
that.showFlag=1
setTimeout(function() {
that.errorMsg='';
that.showFlag=0;
that.disabledFlag=false;
}, 5000);
}
}
} }
},
onLoad(e) {
},
components:{
back
} }
},
onLoad(e) {},
components: {
back
} }
};
</script> </script>
<style> <style>
@import url("modifyUserPhoneNumSetPhoneNum.css"); @import url('modifyUserPhoneNumSetPhoneNum.css');
</style> </style>

View File

@@ -1,7 +1,7 @@
<template> <template>
<view> <view>
<view> <view>
<web-view src="http://112.4.156.196:8040/shiningCloud/business/privacyAgreement"></web-view> <web-view src="http://www.pqmcc.com:8040/shiningCloud/business/privacyAgreement"></web-view>
</view> </view>
</view> </view>
</template> </template>

View File

@@ -50,12 +50,18 @@
<view class="textHigh">完成</view> <view class="textHigh">完成</view>
</button> </button>
</view> </view>
<!-- 图片滑块 -->
<tfVerify ref="tfVerifyRef" @chenggong="chenggong"/>
</view> </view>
</template> </template>
<script> <script>
import back from '../../components/back.vue'; import back from '../../components/back.vue';
import tfVerify from '@/components/tfVerify/tfVerify.vue';
export default { export default {
components:{
back,tfVerify
},
data() { data() {
return { return {
pageNameFlag:1, pageNameFlag:1,
@@ -71,12 +77,13 @@
loadingFlag:false, loadingFlag:false,
doneFlag:0, doneFlag:0,
sendAgain:'发送验证码', sendAgain:'发送验证码',
sendAgainFlag:0, sendAgainFlag:1,
resetFlag:0, resetFlag:0,
vercode:'', vercode:'',
second:60, second:60,
errorMsg:'', errorMsg:'',
disabledFlag:false disabledFlag:false,
} }
}, },
methods: { methods: {
@@ -114,6 +121,11 @@
that.seeFlag=0; that.seeFlag=0;
that.password=''; that.password='';
} }
if( that.password.length>0 && that.again.length>0 ){
that.sendAgainFlag=0
}else{
that.sendAgainFlag=1
}
}, },
setAgain(e){ setAgain(e){
var that = this; var that = this;
@@ -129,6 +141,11 @@
that.seeAgainFlag=0; that.seeAgainFlag=0;
that.again=''; that.again='';
} }
if( that.password.length>0 && that.again.length>0 ){
that.sendAgainFlag=0
}else{
that.sendAgainFlag=1
}
}, },
see(flag){ see(flag){
this.passwordFlag=flag; this.passwordFlag=flag;
@@ -137,18 +154,26 @@
this.againFlag=flag; this.againFlag=flag;
}, },
sendVercodeAgain(){ sendVercodeAgain(){
var that = this; this.$refs.tfVerifyRef.open()
},
async chenggong() {
var that = this;
if(that.second!=60){ if(that.second!=60){
return; return;
} }
that.sendAgainFlag=1 that.sendAgainFlag=1
await that.authToken();
setTimeout(() => {
uni.request({ uni.request({
url: that.serverUrl+'/user/authCode', url: that.serverUrl+'/user/authCode',
method:'POST', method:'POST',
data: { data: {
phone:that.phoneNum, phone:that.phoneNum,
devCode:that.cid(), devCode:that.cid(),
type:3 type:3,
authToken: that.authTokenId
}, },
header: { header: {
'content-type': 'application/x-www-form-urlencoded' 'content-type': 'application/x-www-form-urlencoded'
@@ -191,8 +216,10 @@
} }
}); });
} }
}); });
}, }, 500);
},
complete(){ complete(){
var that = this; var that = this;
var password = that.password.trim(); var password = that.password.trim();
@@ -280,9 +307,7 @@
onLoad(e) { onLoad(e) {
this.phoneNum=e.phoneNum; this.phoneNum=e.phoneNum;
}, },
components:{
back
}
} }
</script> </script>

View File

@@ -1,7 +1,7 @@
<template> <template>
<view> <view>
<view> <view>
<web-view src="http://112.4.156.196:8040/shiningCloud/business/appInfo"></web-view> <web-view src="http://www.pqmcc.com:8040/shiningCloud/business/appInfo"></web-view>
</view> </view>
</view> </view>
</template> </template>

View File

@@ -1,7 +1,7 @@
<template> <template>
<view> <view>
<view> <view>
<web-view src="http://112.4.156.196:8040/shiningCloud/business/userAgreement"></web-view> <web-view src="http://www.pqmcc.com:8040/shiningCloud/business/userAgreement"></web-view>
</view> </view>
</view> </view>
</template> </template>

View File

@@ -115,15 +115,18 @@
}); });
} }
}, },
getVerCode(e){ async getVerCode(e){
var that = this; var that = this;
await that.authToken();
setTimeout(() => {
uni.request({ uni.request({
url: that.serverUrl+'/user/authCode', url: that.serverUrl+'/user/authCode',
method:'POST', method:'POST',
data: { data: {
phone:that.phoneNum, phone:that.phoneNum,
devCode:that.cid(), devCode:that.cid(),
type:0 type:0,
authToken: that.authTokenId
}, },
header: { header: {
'content-type': 'application/x-www-form-urlencoded' 'content-type': 'application/x-www-form-urlencoded'
@@ -157,6 +160,7 @@
}); });
} }
}); });
}, 500);
this.readSecond(); this.readSecond();
}, },
readSecond(){ readSecond(){

BIN
static/pic/BG0.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 KiB

BIN
static/pic/BG1.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

BIN
static/pic/BG2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB

BIN
static/pic/BG3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 MiB

BIN
static/pic/BG4.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 MiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

BIN
static/verify/0.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 KiB

BIN
static/verify/1.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB