验证码添加图形验证

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>

29
main.js
View File

@@ -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,8 +61,9 @@ 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();
@@ -68,6 +72,25 @@ Vue.prototype.cid = function(){
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)){

View File

@@ -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
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",
"style" : {}
},
{
"path" : "components/tfVerify/tfVerify",
"style" :
{
"navigationBarTitleText" : ""
}
}
],
"tabBar": {

View File

@@ -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>

View File

@@ -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>

View File

@@ -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: {
@@ -77,11 +101,12 @@
})
}
}
},
components:{
back
}
},
}
</script>

View File

@@ -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='';

View File

@@ -13,14 +13,33 @@
<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">
<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"/>
<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>
@@ -37,20 +56,18 @@
<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 class="rememberMe-text">记住密码</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>
</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>
</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">
@@ -64,19 +81,19 @@
<view class="login-line"></view>
<view class="login-fast" @click="jumpToFastlogin">快速注册</view>
</view>
</view>
<view class="introduce-block">
寻电能质量之因解电能质量之惑治电能质量之本
<view class="introduce-block"> 寻电能质量之因解电能质量之惑治电能质量之本 </view>
</view>
</view>
<!-- 图片滑块 -->
<tfVerify ref="tfVerifyRef" @chenggong="chenggong" />
</view>
</template>
<script>
import back from "../../components/back.vue";
import back from '../../components/back.vue';
import tfVerify from '@/components/tfVerify/tfVerify.vue';
export default {
components: { back, tfVerify },
data() {
return {
vercodeFlag: 0,
@@ -92,7 +109,7 @@
backShowFlag: 0,
rememberFlag: 1,
disabledFlag: false
}
};
},
methods: {
changeRememberFlag() {
@@ -100,7 +117,7 @@
if (that.rememberFlag == 0) {
that.rememberFlag = 1;
} else {
that.rememberFlag=0
that.rememberFlag = 0;
}
},
changeClass(e) {
@@ -108,7 +125,7 @@
var length = e.detail.value.length;
var loginType = that.loginType;
if (length > 0) {
that.resetFlag=1
that.resetFlag = 1;
that.phoneNum = e.detail.value;
} else {
that.resetFlag = 0;
@@ -127,7 +144,7 @@
}
},
resetPhoneNum() {
this.phoneNum="";
this.phoneNum = '';
this.resetFlag = 0;
this.vercodeFlag = 0;
},
@@ -157,6 +174,9 @@
this.passwordFlag = flag;
},
getVercode() {
this.$refs.tfVerifyRef.open();
},
async chenggong() {
var that = this;
that.disabledFlag = true;
that.loadingFlag = true;
@@ -171,28 +191,32 @@
}, 5000);
return;
}
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'
},
sslVerify: false,
success: (res) => {
console.log(123, res);
that.loadingFlag = false;
if (res.data.resultCode == '10000') {
that.disabledFlag = false;
uni.navigateTo({
url:'../vercode/vercode?phoneNum='+that.phoneNum,
})
url: '../vercode/vercode?phoneNum=' + that.phoneNum
});
} else {
that.errorMsg = that.showError(res.data.msgCode, res.data.msg);
that.showFlag=1
that.showFlag = 1;
setTimeout(function () {
that.errorMsg = '';
that.showFlag = 0;
@@ -217,7 +241,7 @@
});
}
});
}, 500);
},
loginIn(account, password) {
var that = this;
@@ -250,29 +274,37 @@
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);
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())
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',
})
url: '../information/information'
});
} else {
var msg = '';
if (res.data.msg == undefined || res.data.msg == null || res.data.msg == '') {
msg = '服务器或网络异常'
msg = '服务器或网络异常';
} else {
msg = res.data.msg
msg = res.data.msg;
}
that.errorMsg = that.showError(res.data.msgCode, msg);
that.showFlag = 1
that.showFlag = 1;
setTimeout(function () {
that.errorMsg = '';
that.showFlag = 0;
@@ -307,29 +339,29 @@
that.password = '';
that.passwordFlag = false;
that.seeFlag = 0;
that.vercodeFlag=0
that.vercodeFlag = 0;
if (type == 0 && that.phoneNum.length >= 10) {
that.vercodeFlag=1
that.vercodeFlag = 1;
}
},
jumpToForgetPassword() {
uni.navigateTo({
url:'../forgetPassword/forgetPassword',
})
url: '../forgetPassword/forgetPassword'
});
},
jumpToFastlogin() {
uni.navigateTo({
url: '../fastLogin/fastLogin',
url: '../fastLogin/fastLogin'
});
},
jumpToUserAgreement() {
uni.navigateTo({
url: '../userAgreement/userAgreement',
url: '../userAgreement/userAgreement'
});
},
jumpToPrivacyAgreement() {
uni.navigateTo({
url: '../privacyAgreement/privacyAgreement',
url: '../privacyAgreement/privacyAgreement'
});
}
},
@@ -345,15 +377,15 @@
that.getCid();
var cid = that.cid();
if (cid) {
var loginTime = uni.getStorageSync("loginTime");
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");
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 (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;
@@ -361,27 +393,27 @@
that.resetFlag = 1;
that.seeFlag = 1;
that.passwordFlag = 1;
that.loginIn(account,password)
that.loginIn(account, password);
}
} else {
if(uni.getStorageSync("userInfo")){
if (uni.getStorageSync('userInfo')) {
uni.switchTab({
url: '../information/information'
})
});
}
}
}
}
} else {
setTimeout(function () {
var loginTime = uni.getStorageSync("loginTime");
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");
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");
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;
@@ -389,19 +421,16 @@
that.resetFlag = 1;
that.seeFlag = 1;
that.passwordFlag = 1;
that.loginIn(account,password)
that.loginIn(account, password);
}
}
}
},2000)
}
},
components: {
back
}, 2000);
}
}
};
</script>
<style>
@import url("login.css");
@import url('login.css');
</style>

View File

@@ -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='';

View File

@@ -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;

View File

@@ -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(){

View File

@@ -1,14 +1,31 @@
<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">
<image class="vercode-pic" src="/static/pic/close.png"></image>
@@ -23,7 +40,7 @@
<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">
<button class="login-vercode" :loading="loadingFlag" :disabled="disabledFlag" v-if="doneFlag == 1" @click="complete">
<view class="textHigh">更换</view>
</button>
</view>
@@ -55,7 +72,7 @@
second: 60,
errorMsg: '',
disabledFlag: false
}
};
},
methods: {
setPassword(e) {
@@ -73,20 +90,24 @@
that.password = '';
}
},
sendVercodeAgain(){
async sendVercodeAgain() {
var that = this;
if (that.second != 60) {
return;
}
that.sendAgainFlag=1
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
type: 4,
authToken: that.authTokenId
},
header: {
'content-type': 'application/x-www-form-urlencoded'
@@ -96,26 +117,26 @@
if (res.data.resultCode == '10000') {
that.second--;
var intervalID = setInterval(function () {
that.sendAgain ='重新发送('+that.second-- +"S)";
that.sendAgain = '重新发送(' + that.second-- + 'S)';
}, 1000);
setTimeout(function () {
clearInterval(intervalID);
that.sendAgain ="发送验证码";
that.sendAgain = '发送验证码';
that.second = 60;
that.sendAgainFlag=0
},61000)
that.sendAgainFlag = 0;
}, 61000);
} else {
that.errorMsg = that.showError(res.data.msgCode, res.data.msg);
that.showFlag=1
that.showFlag = 1;
setTimeout(function () {
that.errorMsg = '';
that.showFlag = 0;
that.sendAgainFlag=0
that.sendAgainFlag = 0;
}, 5000);
}
},
fail() {
that.sendAgainFlag=0
that.sendAgainFlag = 0;
uni.showModal({
title: '提示',
content: '网络或服务器异常,请稍后再试',
@@ -130,20 +151,21 @@
});
}
});
}, 500);
} else {
that.errorMsg = '请检查手机号';
that.showFlag=1
that.showFlag = 1;
setTimeout(function () {
that.errorMsg = '';
that.showFlag = 0;
that.sendAgainFlag=0
that.sendAgainFlag = 0;
}, 5000);
}
},
reset() {
this.vercode = '';
this.resetFlag = 0;
this.nextFlag=0
this.nextFlag = 0;
},
changeVercode(e) {
var that = this;
@@ -155,9 +177,9 @@
that.resetFlag = 0;
}
if (e.detail.value.length == 6) {
that.nextFlag=1
that.nextFlag = 1;
} else {
that.nextFlag=0
that.nextFlag = 0;
}
},
setAgain(e) {
@@ -219,11 +241,11 @@
that.disabledFlag = false;
uni.redirectTo({
url: '../login/login'
})
},2000)
});
}, 2000);
} else {
that.errorMsg = that.showError(res.data.msgCode, res.data.msg);
that.showFlag=1
that.showFlag = 1;
setTimeout(function () {
that.errorMsg = '';
that.showFlag = 0;
@@ -244,15 +266,15 @@
} else if (res.cancel) {
console.log('用户点击取消');
}
},
});
}
});
}
})
});
}
});
} else {
that.errorMsg = '请检查输入';
that.showFlag=1
that.showFlag = 1;
setTimeout(function () {
that.errorMsg = '';
that.showFlag = 0;
@@ -262,14 +284,13 @@
}
}
},
onLoad(e) {
},
onLoad(e) {},
components: {
back
}
}
};
</script>
<style>
@import url("modifyUserPhoneNumSetPhoneNum.css");
@import url('modifyUserPhoneNumSetPhoneNum.css');
</style>

View File

@@ -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>

View File

@@ -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(){
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,7 +216,9 @@
}
});
}
});
}, 500);
},
complete(){
var that = this;
@@ -280,9 +307,7 @@
onLoad(e) {
this.phoneNum=e.phoneNum;
},
components:{
back
}
}
</script>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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

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