验证码添加图形验证
BIN
components/tf-verify-img/img/tf-arrows.png
Normal file
|
After Width: | Height: | Size: 685 B |
BIN
components/tf-verify-img/img/tf-close.png
Normal file
|
After Width: | Height: | Size: 972 B |
259
components/tf-verify-img/tf-verify-img.vue
Normal 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>
|
||||
53
components/tfVerify/tfVerify.vue
Normal 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
@@ -7,9 +7,12 @@ Vue.config.productionTip = false
|
||||
// 挂载 全局变量
|
||||
Vue.prototype.devCode = "2aaecd0b124df819eda75e639a1f91fd";
|
||||
// Vue.prototype.serverUrl = "https://pqmcc.com: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://112.4.156.196: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.authTokenId = "";
|
||||
Vue.prototype.getCid=function(){
|
||||
var that = this
|
||||
// #ifdef APP-PLUS
|
||||
@@ -58,16 +61,36 @@ Vue.prototype.createMessage=function(title,payload,content){
|
||||
}
|
||||
Vue.prototype.cid = function(){
|
||||
var that= this;
|
||||
// return '088GgLnToXTWf6XUpi8N7Z47PcqaKmONlF0ChR7F4gjdSLRIyTnTruoYfLxGK3Oy'
|
||||
var cidAES = uni.getStorageSync('cidAES');
|
||||
// var cid = uni.getStorageSync('cid');
|
||||
|
||||
if(!(cidAES!=null&&cidAES!='null'&&cidAES!=''&&cidAES!=undefined)){
|
||||
setTimeout(function() {
|
||||
return that.cid();
|
||||
}, 500);
|
||||
}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(){
|
||||
var that= this;
|
||||
if((!uni.getStorageSync('userInfo').userId)||(!uni.getStorageSync('userInfo').phone)){
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name" : "灿能云",
|
||||
"appid" : "__UNI__903A5B1",
|
||||
"appid" : "__UNI__9894FCF",
|
||||
"description" : "",
|
||||
"versionName" : "1.2.1",
|
||||
"versionCode" : 121,
|
||||
@@ -68,9 +68,8 @@
|
||||
"push" : {
|
||||
"unipush" : {}
|
||||
},
|
||||
"speech" : {
|
||||
"ifly" : {}
|
||||
},
|
||||
"speech" : {},
|
||||
// "ifly" : {}
|
||||
"ad" : {}
|
||||
},
|
||||
"icons" : {
|
||||
|
||||
17
package.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"id": "tf-verify-img",
|
||||
"name": "高性能多端拼图滑动验证",
|
||||
"version": "1.0.3",
|
||||
"description": "一款高性能的多端拼图滑动验证组件(希望各位大佬们抽出宝贵的时间留下您的评论,感激不尽)",
|
||||
"keywords": [
|
||||
"拼图",
|
||||
"滑动验证"
|
||||
],
|
||||
"dcloudext": {
|
||||
"category": [
|
||||
"前端组件",
|
||||
"通用组件"
|
||||
]
|
||||
},
|
||||
"displayName": "高性能多端拼图滑动验证"
|
||||
}
|
||||
@@ -184,6 +184,13 @@
|
||||
,{
|
||||
"path" : "pages/terminalStatusAll/terminalStatusAll",
|
||||
"style" : {}
|
||||
},
|
||||
{
|
||||
"path" : "components/tfVerify/tfVerify",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : ""
|
||||
}
|
||||
}
|
||||
],
|
||||
"tabBar": {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<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>
|
||||
</template>
|
||||
|
||||
@@ -27,12 +27,18 @@
|
||||
<view class="textHigh">下一步</view>
|
||||
</button>
|
||||
</view>
|
||||
<!-- 图片滑块 -->
|
||||
<tfVerify ref="tfVerifyRef" @chenggong="chenggong"/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import back from '../../components/back.vue';
|
||||
import tfVerify from '@/components/tfVerify/tfVerify.vue';
|
||||
export default {
|
||||
components:{
|
||||
back,tfVerify
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
phoneNum:'',
|
||||
@@ -69,18 +75,24 @@
|
||||
}
|
||||
},
|
||||
sendVercodeAgain(){
|
||||
this.$refs.tfVerifyRef.open()
|
||||
},
|
||||
async chenggong(){
|
||||
var that = this;
|
||||
if(that.second!=60){
|
||||
return;
|
||||
}
|
||||
that.sendAgainFlag=1
|
||||
await that.authToken();
|
||||
setTimeout(() => {
|
||||
uni.request({
|
||||
url: that.serverUrl+'/user/authCode',
|
||||
method:'POST',
|
||||
data: {
|
||||
phone:that.phoneNumTrue,
|
||||
devCode:that.cid(),
|
||||
type:1
|
||||
type:1,
|
||||
authToken: that.authTokenId
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded'
|
||||
@@ -124,7 +136,9 @@
|
||||
});
|
||||
}
|
||||
});
|
||||
}, 500);
|
||||
},
|
||||
|
||||
reset(){
|
||||
this.vercode='';
|
||||
this.resetFlag=0;
|
||||
@@ -199,9 +213,7 @@
|
||||
this.phoneNum = e.phoneNum.substr(0,3)+'****'+e.phoneNum.substr(7,11);
|
||||
this.sendVercodeAgain();
|
||||
},
|
||||
components:{
|
||||
back
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -19,12 +19,16 @@
|
||||
<view class="textHigh">下一步</view>
|
||||
</button>
|
||||
</view>
|
||||
<!-- 图片滑块 -->
|
||||
<tfVerify ref="tfVerifyRef" @chenggong="chenggong"/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import back from '../../components/back.vue';
|
||||
import tfVerify from '@/components/tfVerify/tfVerify.vue';
|
||||
export default {
|
||||
components: {back, tfVerify },
|
||||
data() {
|
||||
return {
|
||||
pageNameFlag:1,
|
||||
@@ -34,7 +38,27 @@
|
||||
resetFlag:0,
|
||||
nextFlag:0,
|
||||
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: {
|
||||
@@ -76,12 +100,13 @@
|
||||
url:'../setNewPassword/setNewPassword?phoneNum='+this.phoneNum,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
},
|
||||
components:{
|
||||
back
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -67,16 +67,19 @@
|
||||
that.nextFlag=0
|
||||
}
|
||||
},
|
||||
sendVercodeAgain(){
|
||||
async sendVercodeAgain(){
|
||||
var that = this;
|
||||
that.sendAgainFlag=1
|
||||
await that.authToken();
|
||||
setTimeout(() => {
|
||||
uni.request({
|
||||
url: that.serverUrl+'/user/authCode',
|
||||
method:'POST',
|
||||
data: {
|
||||
phone:that.phoneNumTrue,
|
||||
devCode:that.cid(),
|
||||
type:3
|
||||
type:3,
|
||||
authToken: that.authTokenId
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded'
|
||||
@@ -122,6 +125,7 @@
|
||||
that.second=60;
|
||||
that.sendAgainFlag=0
|
||||
},61000)
|
||||
}, 500);
|
||||
},
|
||||
reset(){
|
||||
this.vercode='';
|
||||
|
||||
@@ -8,22 +8,41 @@
|
||||
<view class="login-user" @click="jumpToUserAgreement">用户协议、</view>
|
||||
<view class="login-user" @click="jumpToPrivacyAgreement">隐私协议</view>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="phone-block">
|
||||
<view class="num">+86</view>
|
||||
<image class="pull" src="/static/pic/pull.png"></image>
|
||||
<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 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>
|
||||
</view>
|
||||
</view>
|
||||
<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"/>
|
||||
<view class="see-block" v-if="seeFlag==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"
|
||||
/>
|
||||
<view class="see-block" v-if="seeFlag == 1">
|
||||
<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 class="line"></view>
|
||||
<view class="reset-block" @click="see(false)" v-if="passwordFlag">
|
||||
@@ -34,179 +53,184 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="rememberMe-block" @click="changeRememberFlag" v-if="loginType==1">
|
||||
<image src="/static/pic/choose.png" class="rememberMe-pic" v-if="rememberFlag==1"></image>
|
||||
<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/nochoose.png" class="rememberMe-pic" v-else></image>
|
||||
<view class="rememberMe-text">
|
||||
记住密码
|
||||
</view>
|
||||
<view class="rememberMe-text">记住密码</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>
|
||||
</button>
|
||||
<button class="login-vercode" :loading='loadingFlag' v-if="vercodeFlag==1&&loginType==0" @click="getVercode" :disabled="disabledFlag">
|
||||
<view class="textHigh" >获取验证码</view>
|
||||
<button class="login-vercode" :loading="loadingFlag" v-if="vercodeFlag == 1 && loginType == 0" @click="getVercode" :disabled="disabledFlag">
|
||||
<view class="textHigh">获取验证码</view>
|
||||
</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>
|
||||
</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>
|
||||
</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-fast" @click="jumpToFastlogin">快速注册</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-right">
|
||||
<view class="login-fast" @click="jumpToForgetPassword">忘记密码</view>
|
||||
<view class="login-line"></view>
|
||||
<view class="login-fast" @click="jumpToFastlogin">快速注册</view>
|
||||
<view class="login-fast" @click="jumpToFastlogin">快速注册</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="introduce-block">
|
||||
—— 寻电能质量之因,解电能质量之惑,治电能质量之本 ——
|
||||
</view>
|
||||
<view class="introduce-block">—— 寻电能质量之因,解电能质量之惑,治电能质量之本 ——</view>
|
||||
</view>
|
||||
|
||||
<!-- 图片滑块 -->
|
||||
<tfVerify ref="tfVerifyRef" @chenggong="chenggong" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import back from "../../components/back.vue";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
vercodeFlag:0,
|
||||
loadingFlag:false,
|
||||
phoneNum:'',
|
||||
errorMsg:'',
|
||||
showFlag:0,
|
||||
loginType:1 ,//0-验证码登录 1-账号密码
|
||||
password:'',
|
||||
passwordFlag:true,
|
||||
seeFlag:0,
|
||||
resetFlag:0,
|
||||
backShowFlag:0,
|
||||
rememberFlag:1,
|
||||
disabledFlag:false
|
||||
import back from '../../components/back.vue';
|
||||
import tfVerify from '@/components/tfVerify/tfVerify.vue';
|
||||
export default {
|
||||
components: { back, tfVerify },
|
||||
data() {
|
||||
return {
|
||||
vercodeFlag: 0,
|
||||
loadingFlag: false,
|
||||
phoneNum: '',
|
||||
errorMsg: '',
|
||||
showFlag: 0,
|
||||
loginType: 1, //0-验证码登录 1-账号密码
|
||||
password: '',
|
||||
passwordFlag: true,
|
||||
seeFlag: 0,
|
||||
resetFlag: 0,
|
||||
backShowFlag: 0,
|
||||
rememberFlag: 1,
|
||||
disabledFlag: false
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
changeRememberFlag() {
|
||||
var that = this;
|
||||
if (that.rememberFlag == 0) {
|
||||
that.rememberFlag = 1;
|
||||
} else {
|
||||
that.rememberFlag = 0;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
changeRememberFlag(){
|
||||
var that = this;
|
||||
if(that.rememberFlag==0){
|
||||
that.rememberFlag=1;
|
||||
}else{
|
||||
that.rememberFlag=0
|
||||
}
|
||||
},
|
||||
changeClass(e){
|
||||
var that = this;
|
||||
var length = e.detail.value.length;
|
||||
var loginType =that.loginType;
|
||||
if(length>0){
|
||||
that.resetFlag=1
|
||||
that.phoneNum=e.detail.value;
|
||||
}else{
|
||||
that.resetFlag=0;
|
||||
that.phoneNum='';
|
||||
}
|
||||
if(length>=10){
|
||||
if(loginType==0){
|
||||
that.vercodeFlag=1;
|
||||
}else{
|
||||
if(that.password!=null&&that.password!=''){
|
||||
that.vercodeFlag=1;
|
||||
}
|
||||
changeClass(e) {
|
||||
var that = this;
|
||||
var length = e.detail.value.length;
|
||||
var loginType = that.loginType;
|
||||
if (length > 0) {
|
||||
that.resetFlag = 1;
|
||||
that.phoneNum = e.detail.value;
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
},
|
||||
resetPhoneNum(){
|
||||
this.phoneNum="";
|
||||
this.resetFlag=0;
|
||||
this.vercodeFlag=0;
|
||||
},
|
||||
changePasswordClass(e){
|
||||
var that = this;
|
||||
var length = e.detail.value.length;
|
||||
var phoneNum =that.phoneNum;
|
||||
if(length>0){
|
||||
that.password=e.detail.value;
|
||||
that.seeFlag=1;
|
||||
if(phoneNum!=null&&phoneNum!=''){
|
||||
that.vercodeFlag=1;
|
||||
}
|
||||
}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(){
|
||||
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;
|
||||
}
|
||||
},
|
||||
resetPhoneNum() {
|
||||
this.phoneNum = '';
|
||||
this.resetFlag = 0;
|
||||
this.vercodeFlag = 0;
|
||||
},
|
||||
changePasswordClass(e) {
|
||||
var that = this;
|
||||
var length = e.detail.value.length;
|
||||
var phoneNum = that.phoneNum;
|
||||
if (length > 0) {
|
||||
that.password = e.detail.value;
|
||||
that.seeFlag = 1;
|
||||
if (phoneNum != null && phoneNum != '') {
|
||||
that.vercodeFlag = 1;
|
||||
}
|
||||
} 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({
|
||||
url: that.serverUrl+'/user/authCode',
|
||||
method:'POST',
|
||||
url: that.serverUrl + '/user/authCode',
|
||||
method: 'POST',
|
||||
data: {
|
||||
phone:that.phoneNum,
|
||||
devCode:that.cid(),
|
||||
type:0
|
||||
phone: that.phoneNum,
|
||||
devCode: that.cid(),
|
||||
type: 0,
|
||||
authToken: that.authTokenId
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
sslVerify:false,
|
||||
sslVerify: false,
|
||||
success: (res) => {
|
||||
that.loadingFlag=false;
|
||||
if(res.data.resultCode=='10000'){
|
||||
that.disabledFlag=false;
|
||||
console.log(123, res);
|
||||
that.loadingFlag = false;
|
||||
if (res.data.resultCode == '10000') {
|
||||
that.disabledFlag = false;
|
||||
uni.navigateTo({
|
||||
url:'../vercode/vercode?phoneNum='+that.phoneNum,
|
||||
})
|
||||
}else{
|
||||
that.errorMsg=that.showError(res.data.msgCode,res.data.msg);
|
||||
that.showFlag=1
|
||||
setTimeout(function() {
|
||||
that.errorMsg='';
|
||||
that.showFlag=0;
|
||||
that.disabledFlag=false;
|
||||
url: '../vercode/vercode?phoneNum=' + that.phoneNum
|
||||
});
|
||||
} 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)=>{
|
||||
that.loadingFlag=false;
|
||||
that.disabledFlag=false;
|
||||
fail: (re) => {
|
||||
that.loadingFlag = false;
|
||||
that.disabledFlag = false;
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '网络或服务器异常,请稍后再试',
|
||||
showCancel:false,
|
||||
showCancel: false,
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
console.log('用户点击确定');
|
||||
@@ -217,191 +241,196 @@
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
loginIn(account,password){
|
||||
var that = this;
|
||||
that.loadingFlag=true;
|
||||
that.disabledFlag=true;
|
||||
if(account.length!=11){
|
||||
that.loadingFlag=false;
|
||||
that.showFlag=1;
|
||||
that.errorMsg='请检查号码';
|
||||
setTimeout(function() {
|
||||
that.errorMsg='';
|
||||
that.showFlag=0;
|
||||
that.disabledFlag=false;
|
||||
}, 5000);
|
||||
return;
|
||||
}
|
||||
uni.request({
|
||||
url: that.serverUrl+'/user/login',
|
||||
method:'POST',
|
||||
data: {
|
||||
phone:account,
|
||||
devCode:that.cid(),
|
||||
key:password.trim(),
|
||||
type:1
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
sslVerify:false,
|
||||
success: (res) => {
|
||||
that.loadingFlag=false;
|
||||
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!=''){
|
||||
uni.setStorageSync("account",that.phoneNum);
|
||||
uni.setStorageSync("password",that.password);
|
||||
}
|
||||
uni.setStorageSync('loginType',1);
|
||||
uni.setStorageSync("loginTime",new Date())
|
||||
var userInfo = eval(res.data.data);
|
||||
userInfo.phoneNum=that.phoneNum;
|
||||
uni.setStorageSync('userInfo',userInfo);
|
||||
that.disabledFlag=false;
|
||||
// console.log(userInfo.userId)
|
||||
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);
|
||||
}, 500);
|
||||
},
|
||||
loginIn(account, password) {
|
||||
var that = this;
|
||||
that.loadingFlag = true;
|
||||
that.disabledFlag = true;
|
||||
if (account.length != 11) {
|
||||
that.loadingFlag = false;
|
||||
that.showFlag = 1;
|
||||
that.errorMsg = '请检查号码';
|
||||
setTimeout(function () {
|
||||
that.errorMsg = '';
|
||||
that.showFlag = 0;
|
||||
that.disabledFlag = false;
|
||||
}, 5000);
|
||||
return;
|
||||
}
|
||||
uni.request({
|
||||
url: that.serverUrl + '/user/login',
|
||||
method: 'POST',
|
||||
data: {
|
||||
phone: account,
|
||||
devCode: that.cid(),
|
||||
key: password.trim(),
|
||||
type: 1
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
sslVerify: false,
|
||||
success: (res) => {
|
||||
that.loadingFlag = false;
|
||||
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 != ''
|
||||
) {
|
||||
uni.setStorageSync('account', that.phoneNum);
|
||||
uni.setStorageSync('password', that.password);
|
||||
}
|
||||
},
|
||||
fail:(re)=>{
|
||||
that.disabledFlag=false;
|
||||
that.loadingFlag=false;
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '服务器或网络异常',
|
||||
showCancel:false,
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
console.log('用户点击确定');
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
uni.setStorageSync('loginType', 1);
|
||||
uni.setStorageSync('loginTime', new Date());
|
||||
var userInfo = eval(res.data.data);
|
||||
userInfo.phoneNum = that.phoneNum;
|
||||
uni.setStorageSync('userInfo', userInfo);
|
||||
that.disabledFlag = false;
|
||||
// console.log(userInfo.userId)
|
||||
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);
|
||||
}
|
||||
});
|
||||
},
|
||||
changeLoginType(type){
|
||||
var that = this;
|
||||
that.loginType=type;
|
||||
that.loadingFlag=false;
|
||||
that.errorMsg='';
|
||||
that.showFlag=0;
|
||||
that.password='';
|
||||
that.passwordFlag=false;
|
||||
that.seeFlag=0;
|
||||
that.vercodeFlag=0
|
||||
if(type==0&&that.phoneNum.length>=10){
|
||||
that.vercodeFlag=1
|
||||
},
|
||||
fail: (re) => {
|
||||
that.disabledFlag = false;
|
||||
that.loadingFlag = false;
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '服务器或网络异常',
|
||||
showCancel: false,
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
console.log('用户点击确定');
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
jumpToForgetPassword(){
|
||||
uni.navigateTo({
|
||||
url:'../forgetPassword/forgetPassword',
|
||||
})
|
||||
},
|
||||
jumpToFastlogin(){
|
||||
uni.navigateTo({
|
||||
url: '../fastLogin/fastLogin',
|
||||
});
|
||||
},
|
||||
jumpToUserAgreement(){
|
||||
uni.navigateTo({
|
||||
url: '../userAgreement/userAgreement',
|
||||
});
|
||||
},
|
||||
jumpToPrivacyAgreement(){
|
||||
uni.navigateTo({
|
||||
url: '../privacyAgreement/privacyAgreement',
|
||||
});
|
||||
});
|
||||
},
|
||||
changeLoginType(type) {
|
||||
var that = this;
|
||||
that.loginType = type;
|
||||
that.loadingFlag = false;
|
||||
that.errorMsg = '';
|
||||
that.showFlag = 0;
|
||||
that.password = '';
|
||||
that.passwordFlag = false;
|
||||
that.seeFlag = 0;
|
||||
that.vercodeFlag = 0;
|
||||
if (type == 0 && that.phoneNum.length >= 10) {
|
||||
that.vercodeFlag = 1;
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
var that=this;
|
||||
// var style = plus.navigator.getUiStyle();
|
||||
// console.log(style)
|
||||
// if('dark'==style){
|
||||
// console.log('当前为暗黑模式');
|
||||
// }else{
|
||||
// console.log('当前为普通模式');
|
||||
// }
|
||||
that.getCid();
|
||||
var cid = that.cid();
|
||||
if(cid){
|
||||
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'
|
||||
})
|
||||
}
|
||||
jumpToForgetPassword() {
|
||||
uni.navigateTo({
|
||||
url: '../forgetPassword/forgetPassword'
|
||||
});
|
||||
},
|
||||
jumpToFastlogin() {
|
||||
uni.navigateTo({
|
||||
url: '../fastLogin/fastLogin'
|
||||
});
|
||||
},
|
||||
jumpToUserAgreement() {
|
||||
uni.navigateTo({
|
||||
url: '../userAgreement/userAgreement'
|
||||
});
|
||||
},
|
||||
jumpToPrivacyAgreement() {
|
||||
uni.navigateTo({
|
||||
url: '../privacyAgreement/privacyAgreement'
|
||||
});
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
var that = this;
|
||||
// var style = plus.navigator.getUiStyle();
|
||||
// console.log(style)
|
||||
// if('dark'==style){
|
||||
// console.log('当前为暗黑模式');
|
||||
// }else{
|
||||
// console.log('当前为普通模式');
|
||||
// }
|
||||
that.getCid();
|
||||
var cid = that.cid();
|
||||
if (cid) {
|
||||
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(){
|
||||
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{
|
||||
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 {
|
||||
setTimeout(function () {
|
||||
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 {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
},2000)
|
||||
}
|
||||
},
|
||||
components: {
|
||||
back
|
||||
}, 2000);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
@import url("login.css");
|
||||
@import url('login.css');
|
||||
</style>
|
||||
|
||||
@@ -67,16 +67,19 @@
|
||||
that.nextFlag=0
|
||||
}
|
||||
},
|
||||
sendVercodeAgain(){
|
||||
async sendVercodeAgain(){
|
||||
var that = this;
|
||||
that.sendAgainFlag=1
|
||||
await that.authToken();
|
||||
setTimeout(() => {
|
||||
uni.request({
|
||||
url: that.serverUrl+'/user/authCode',
|
||||
method:'POST',
|
||||
data: {
|
||||
phone:that.phoneNumTrue,
|
||||
devCode:that.cid(),
|
||||
type:2
|
||||
type:2,
|
||||
authToken: that.authTokenId
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded'
|
||||
@@ -122,6 +125,7 @@
|
||||
that.second=60;
|
||||
that.sendAgainFlag=0
|
||||
},61000)
|
||||
}, 500);
|
||||
},
|
||||
reset(){
|
||||
this.vercode='';
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
disabledFlag:false,
|
||||
doneFlag:0,
|
||||
sendAgain:'发送验证码',
|
||||
sendAgainFlag:0,
|
||||
sendAgainFlag:1,
|
||||
resetFlag:0,
|
||||
vercode:'',
|
||||
second:60,
|
||||
@@ -115,6 +115,11 @@
|
||||
that.seeFlag=0;
|
||||
that.password='';
|
||||
}
|
||||
if( that.password.length>0 && that.again.length>0 ){
|
||||
that.sendAgainFlag=0
|
||||
}else{
|
||||
that.sendAgainFlag=1
|
||||
}
|
||||
},
|
||||
setAgain(e){
|
||||
var that = this;
|
||||
@@ -130,6 +135,11 @@
|
||||
that.seeAgainFlag=0;
|
||||
that.again='';
|
||||
}
|
||||
if( that.password.length>0 && that.again.length>0 ){
|
||||
that.sendAgainFlag=0
|
||||
}else{
|
||||
that.sendAgainFlag=1
|
||||
}
|
||||
},
|
||||
see(flag){
|
||||
this.passwordFlag=flag;
|
||||
@@ -137,19 +147,22 @@
|
||||
seeAgain(flag){
|
||||
this.againFlag=flag;
|
||||
},
|
||||
sendVercodeAgain(){
|
||||
async sendVercodeAgain(){
|
||||
var that = this;
|
||||
if(that.second!=60){
|
||||
return;
|
||||
}
|
||||
that.sendAgainFlag=1
|
||||
await that.authToken();
|
||||
setTimeout(() => {
|
||||
uni.request({
|
||||
url: that.serverUrl+'/user/authCode',
|
||||
method:'POST',
|
||||
data: {
|
||||
phone:that.phoneNum,
|
||||
devCode:that.cid(),
|
||||
type:2
|
||||
type:2,
|
||||
authToken: that.authTokenId
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded'
|
||||
@@ -193,6 +206,7 @@
|
||||
});
|
||||
}
|
||||
});
|
||||
}, 500);
|
||||
},
|
||||
complete(){
|
||||
var that = this;
|
||||
|
||||
@@ -68,20 +68,25 @@
|
||||
that.nextFlag=0
|
||||
}
|
||||
},
|
||||
sendVercodeAgain(){
|
||||
async sendVercodeAgain(){
|
||||
var that = this;
|
||||
if(that.second!=60){
|
||||
return;
|
||||
}
|
||||
that.sendAgainFlag=1
|
||||
if(that.judgeLogin()){
|
||||
await that.authToken();
|
||||
setTimeout(() => {
|
||||
|
||||
|
||||
uni.request({
|
||||
url: that.serverUrl+'/user/authCode',
|
||||
method:'POST',
|
||||
data: {
|
||||
phone:uni.getStorageSync('userInfo').phone,
|
||||
devCode:that.cid(),
|
||||
type:5
|
||||
type:5,
|
||||
authToken: that.authTokenId
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded'
|
||||
@@ -125,6 +130,7 @@
|
||||
});
|
||||
}
|
||||
});
|
||||
}, 500);
|
||||
}
|
||||
},
|
||||
reset(){
|
||||
|
||||
@@ -1,275 +1,296 @@
|
||||
<template>
|
||||
<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="text-top">请设置新的手机号码</view>
|
||||
<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 class="phone-block">
|
||||
<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 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>
|
||||
</view>
|
||||
<button class="vercode-button" v-if="sendAgainFlag==0" @click="sendVercodeAgain">
|
||||
{{sendAgain}}
|
||||
<button class="vercode-button" v-if="sendAgainFlag == 0" @click="sendVercodeAgain">
|
||||
{{ sendAgain }}
|
||||
</button>
|
||||
<view class="vercode-button-send" v-if="sendAgainFlag==1">
|
||||
{{sendAgain}}
|
||||
<view class="vercode-button-send" v-if="sendAgainFlag == 1">
|
||||
{{ sendAgain }}
|
||||
</view>
|
||||
</view>
|
||||
<button class="login-vercode" v-if="doneFlag==0">
|
||||
<button class="login-vercode" v-if="doneFlag == 0">
|
||||
<view class="text">更换</view>
|
||||
</button>
|
||||
<button class="login-vercode" :loading='loadingFlag' :disabled="disabledFlag" v-if="doneFlag==1" @click="complete">
|
||||
<view class="textHigh" >更换</view>
|
||||
<button class="login-vercode" :loading="loadingFlag" :disabled="disabledFlag" v-if="doneFlag == 1" @click="complete">
|
||||
<view class="textHigh">更换</view>
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import back from '../../components/back.vue';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
pageNameFlag:1,
|
||||
showFlag:0,
|
||||
pageName:'账号绑定手机号更换',
|
||||
phoneNum:'',
|
||||
passwordFlag:true,
|
||||
againFlag:true,
|
||||
password:'',
|
||||
again:'',
|
||||
seeFlag:0,
|
||||
seeAgainFlag:0,
|
||||
loadingFlag:false,
|
||||
doneFlag:0,
|
||||
vercode:'',
|
||||
resetFlag:0,
|
||||
nextFlag:0,
|
||||
sendAgain:'发送验证码',
|
||||
sendAgainFlag:0,
|
||||
second:60,
|
||||
errorMsg:'',
|
||||
disabledFlag:false
|
||||
import back from '../../components/back.vue';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
pageNameFlag: 1,
|
||||
showFlag: 0,
|
||||
pageName: '账号绑定手机号更换',
|
||||
phoneNum: '',
|
||||
passwordFlag: true,
|
||||
againFlag: true,
|
||||
password: '',
|
||||
again: '',
|
||||
seeFlag: 0,
|
||||
seeAgainFlag: 0,
|
||||
loadingFlag: false,
|
||||
doneFlag: 0,
|
||||
vercode: '',
|
||||
resetFlag: 0,
|
||||
nextFlag: 0,
|
||||
sendAgain: '发送验证码',
|
||||
sendAgainFlag: 0,
|
||||
second: 60,
|
||||
errorMsg: '',
|
||||
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: {
|
||||
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='';
|
||||
}
|
||||
},
|
||||
sendVercodeAgain(){
|
||||
var that = this;
|
||||
if(that.second!=60){
|
||||
return;
|
||||
}
|
||||
that.sendAgainFlag=1
|
||||
if(that.password.length==11){
|
||||
uni.request({
|
||||
url: that.serverUrl+'/user/authCode',
|
||||
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'){
|
||||
async sendVercodeAgain() {
|
||||
var that = this;
|
||||
if (that.second != 60) {
|
||||
return;
|
||||
}
|
||||
that.sendAgainFlag = 1;
|
||||
if (that.password.length == 11) {
|
||||
await that.authToken();
|
||||
setTimeout(() => {
|
||||
console.log(123, that.password, that.cid(), that.authTokenId);
|
||||
uni.request({
|
||||
url: that.serverUrl + '/user/authCode',
|
||||
method: 'POST',
|
||||
data: {
|
||||
phone: that.password,
|
||||
devCode: that.cid(),
|
||||
type: 4,
|
||||
authToken: that.authTokenId
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
sslVerify: false,
|
||||
success: (res) => {
|
||||
if (res.data.resultCode == '10000') {
|
||||
that.second--;
|
||||
var intervalID =setInterval(function(){
|
||||
that.sendAgain ='重新发送('+that.second-- +"S)";
|
||||
},1000);
|
||||
setTimeout(function(){
|
||||
var intervalID = setInterval(function () {
|
||||
that.sendAgain = '重新发送(' + that.second-- + 'S)';
|
||||
}, 1000);
|
||||
setTimeout(function () {
|
||||
clearInterval(intervalID);
|
||||
that.sendAgain ="发送验证码";
|
||||
that.second=60;
|
||||
that.sendAgainFlag=0
|
||||
},61000)
|
||||
}else{
|
||||
that.errorMsg=that.showError(res.data.msgCode,res.data.msg);
|
||||
that.showFlag=1
|
||||
setTimeout(function() {
|
||||
that.errorMsg='';
|
||||
that.showFlag=0;
|
||||
that.sendAgainFlag=0
|
||||
}, 5000);
|
||||
that.sendAgain = '发送验证码';
|
||||
that.second = 60;
|
||||
that.sendAgainFlag = 0;
|
||||
}, 61000);
|
||||
} else {
|
||||
that.errorMsg = that.showError(res.data.msgCode, res.data.msg);
|
||||
that.showFlag = 1;
|
||||
setTimeout(function () {
|
||||
that.errorMsg = '';
|
||||
that.showFlag = 0;
|
||||
that.sendAgainFlag = 0;
|
||||
}, 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() {
|
||||
that.sendAgainFlag=0
|
||||
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.sendAgainFlag=0
|
||||
});
|
||||
}, 500);
|
||||
} else {
|
||||
that.errorMsg = '请检查手机号';
|
||||
that.showFlag = 1;
|
||||
setTimeout(function () {
|
||||
that.errorMsg = '';
|
||||
that.showFlag = 0;
|
||||
that.sendAgainFlag = 0;
|
||||
}, 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);
|
||||
}
|
||||
},
|
||||
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>
|
||||
|
||||
<style>
|
||||
@import url("modifyUserPhoneNumSetPhoneNum.css");
|
||||
@import url('modifyUserPhoneNumSetPhoneNum.css');
|
||||
</style>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<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>
|
||||
</template>
|
||||
|
||||
@@ -50,12 +50,18 @@
|
||||
<view class="textHigh">完成</view>
|
||||
</button>
|
||||
</view>
|
||||
<!-- 图片滑块 -->
|
||||
<tfVerify ref="tfVerifyRef" @chenggong="chenggong"/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import back from '../../components/back.vue';
|
||||
import tfVerify from '@/components/tfVerify/tfVerify.vue';
|
||||
export default {
|
||||
components:{
|
||||
back,tfVerify
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
pageNameFlag:1,
|
||||
@@ -71,12 +77,13 @@
|
||||
loadingFlag:false,
|
||||
doneFlag:0,
|
||||
sendAgain:'发送验证码',
|
||||
sendAgainFlag:0,
|
||||
sendAgainFlag:1,
|
||||
resetFlag:0,
|
||||
vercode:'',
|
||||
second:60,
|
||||
errorMsg:'',
|
||||
disabledFlag:false
|
||||
disabledFlag:false,
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -114,6 +121,11 @@
|
||||
that.seeFlag=0;
|
||||
that.password='';
|
||||
}
|
||||
if( that.password.length>0 && that.again.length>0 ){
|
||||
that.sendAgainFlag=0
|
||||
}else{
|
||||
that.sendAgainFlag=1
|
||||
}
|
||||
},
|
||||
setAgain(e){
|
||||
var that = this;
|
||||
@@ -129,6 +141,11 @@
|
||||
that.seeAgainFlag=0;
|
||||
that.again='';
|
||||
}
|
||||
if( that.password.length>0 && that.again.length>0 ){
|
||||
that.sendAgainFlag=0
|
||||
}else{
|
||||
that.sendAgainFlag=1
|
||||
}
|
||||
},
|
||||
see(flag){
|
||||
this.passwordFlag=flag;
|
||||
@@ -137,18 +154,26 @@
|
||||
this.againFlag=flag;
|
||||
},
|
||||
sendVercodeAgain(){
|
||||
var that = this;
|
||||
this.$refs.tfVerifyRef.open()
|
||||
|
||||
},
|
||||
async chenggong() {
|
||||
|
||||
var that = this;
|
||||
if(that.second!=60){
|
||||
return;
|
||||
}
|
||||
that.sendAgainFlag=1
|
||||
await that.authToken();
|
||||
setTimeout(() => {
|
||||
uni.request({
|
||||
url: that.serverUrl+'/user/authCode',
|
||||
method:'POST',
|
||||
data: {
|
||||
phone:that.phoneNum,
|
||||
devCode:that.cid(),
|
||||
type:3
|
||||
type:3,
|
||||
authToken: that.authTokenId
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded'
|
||||
@@ -191,8 +216,10 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
}, 500);
|
||||
},
|
||||
complete(){
|
||||
var that = this;
|
||||
var password = that.password.trim();
|
||||
@@ -280,9 +307,7 @@
|
||||
onLoad(e) {
|
||||
this.phoneNum=e.phoneNum;
|
||||
},
|
||||
components:{
|
||||
back
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<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>
|
||||
</template>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<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>
|
||||
</template>
|
||||
|
||||
@@ -115,15 +115,18 @@
|
||||
});
|
||||
}
|
||||
},
|
||||
getVerCode(e){
|
||||
async getVerCode(e){
|
||||
var that = this;
|
||||
await that.authToken();
|
||||
setTimeout(() => {
|
||||
uni.request({
|
||||
url: that.serverUrl+'/user/authCode',
|
||||
method:'POST',
|
||||
data: {
|
||||
phone:that.phoneNum,
|
||||
devCode:that.cid(),
|
||||
type:0
|
||||
type:0,
|
||||
authToken: that.authTokenId
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded'
|
||||
@@ -157,6 +160,7 @@
|
||||
});
|
||||
}
|
||||
});
|
||||
}, 500);
|
||||
this.readSecond();
|
||||
},
|
||||
readSecond(){
|
||||
|
||||
BIN
static/pic/BG0.jpeg
Normal file
|
After Width: | Height: | Size: 195 KiB |
BIN
static/pic/BG1.jpeg
Normal file
|
After Width: | Height: | Size: 107 KiB |
BIN
static/pic/BG2.jpg
Normal file
|
After Width: | Height: | Size: 200 KiB |
BIN
static/pic/BG3.jpg
Normal file
|
After Width: | Height: | Size: 8.8 MiB |
BIN
static/pic/BG4.jpg
Normal file
|
After Width: | Height: | Size: 12 MiB |
|
Before Width: | Height: | Size: 37 KiB |
BIN
static/verify/0.jpeg
Normal file
|
After Width: | Height: | Size: 195 KiB |
BIN
static/verify/1.jpeg
Normal file
|
After Width: | Height: | Size: 107 KiB |