增加南网手机号码登录逻辑

This commit is contained in:
BianLzhaoMin 2024-08-23 16:20:04 +08:00
parent 07361ae8b6
commit ed74f05cef
12 changed files with 4935 additions and 3374 deletions

View File

@ -10,6 +10,14 @@ const login = {
header
)
},
async getMessageCode(data = {}, header = {}) {
return await Http.post(
HttpConfig.authPath,
HttpConfig.serviceUrl.login.code,
data,
header
)
},
async checkCode(data = {}, header = {}) {
return await Http.post(
HttpConfig.authPath,
@ -25,7 +33,7 @@ const login = {
data,
header
)
}
},
}
const user = {

View File

@ -19,7 +19,7 @@ class HttpConfig {
// baseUrl = "https://z.csgmall.com.cn/gl"
// baseUrl = "http://192.168.2.160:39080" // 梁超
// baseUrl = "http://192.168.2.218:39080" // 福
target = "http://192.168.0.56:21626" // 开发阶段后台ip
target = "http://192.168.2.135:49080" // 开发阶段后台ip
// #endif
// 基地址 (部署时使用 需要加 dev-api
// authPath = `${this.baseUrl}/dev-api/auth`

View File

@ -1,13 +1,13 @@
class Http{
get(baseUrl='',url,data={},header={}){
return new Promise((resolve,reject)=>{
class Http {
get(baseUrl = '', url, data = {}, header = {}) {
return new Promise((resolve, reject) => {
uni.request({
url:baseUrl + url,
data:data,
method:"GET",
dataType:'json',
header:{
'content-type':'application/json',
url: baseUrl + url,
data: data,
method: "GET",
dataType: 'json',
header: {
'content-type': 'application/json',
'Authorization': uni.getStorageSync('token'),
...header
},
@ -33,16 +33,16 @@ class Http{
})
})
}
post(baseUrl='',url,data={},header={}){
return new Promise((resolve,reject)=>{
post(baseUrl = '', url, data = {}, header = {}) {
return new Promise((resolve, reject) => {
uni.request({
url:baseUrl + url,
data:data,
method:"POST",
dataType:'json',
header:{
'content-type':'application/json',
url: baseUrl + url,
data: data,
method: "POST",
dataType: 'json',
header: {
'content-type': 'application/json',
'Authorization': uni.getStorageSync('token'),
...header
},
@ -70,16 +70,16 @@ class Http{
})
})
}
put(baseUrl='',url,data={},header={}){
return new Promise((resolve,reject) => {
put(baseUrl = '', url, data = {}, header = {}) {
return new Promise((resolve, reject) => {
uni.request({
url:baseUrl + url,
data:data,
method:"PUT",
dataType:'json',
header:{
'content-type':'application/json',
url: baseUrl + url,
data: data,
method: "PUT",
dataType: 'json',
header: {
'content-type': 'application/json',
'Authorization': uni.getStorageSync('token'),
...header
},
@ -105,16 +105,16 @@ class Http{
})
})
}
delete(baseUrl='',url,data={},header={}){
return new Promise((resolve,reject) => {
delete(baseUrl = '', url, data = {}, header = {}) {
return new Promise((resolve, reject) => {
uni.request({
url:baseUrl + url,
data:data,
method:"DELETE",
dataType:'json',
header:{
'content-type':'application/json',
url: baseUrl + url,
data: data,
method: "DELETE",
dataType: 'json',
header: {
'content-type': 'application/json',
'Authorization': uni.getStorageSync('token'),
...header
},
@ -140,13 +140,13 @@ class Http{
})
})
}
upload(baseUrl='',url,data={},header={}){
return new Promise((resolve,reject) => {
upload(baseUrl = '', url, data = {}, header = {}) {
return new Promise((resolve, reject) => {
uni.uploadFile({
url:baseUrl + url,
url: baseUrl + url,
filePath: data,
header:{
header: {
'Authorization': uni.getStorageSync('token'),
...header
},
@ -175,4 +175,4 @@ class Http{
}
}
export default new Http()
export default new Http()

View File

@ -1,496 +1,469 @@
{
"pages": [ //pageshttps://uniapp.dcloud.io/collocation/pages
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "首页",
"app-plus": {
"titleNView": {
"buttons": [
/* {
"pages": [
//pageshttps://uniapp.dcloud.io/collocation/pages
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "首页",
"app-plus": {
"titleNView": {
"buttons": [
/* {
"text": "权限",
"fontSize": "14px",
"color": "#4e6ef2",
"width": "auto" ,
"float": "left"
}, */
{
"text": "扫一扫",
"fontSize": "14px",
"color": "#4e6ef2",
"width": "auto" ,
"float": "right"
}
]
}
}
}
}, {
"path": "pages/user/user",
"style": {
"navigationBarTitleText": "个人中心"
}
{
"text": "扫一扫",
"fontSize": "14px",
"color": "#4e6ef2",
"width": "auto",
"float": "right"
}
]
}
}
}
},
{
"path": "pages/user/user",
"style": {
"navigationBarTitleText": "个人中心"
}
},
{
"path": "pages/workSpace/workSpace",
"style": {
"navigationBarTitleText": "工作台"
}
},
{
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "登录"
}
},
{
"path": "pages/nwLogin/index",
"style": {
"navigationBarTitleText": "南网登录"
}
},
{
"path": "pages/fetchMaterial/fetchMaterial",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/exitMaterial/exitMaterial",
"style": {
"navigationBarTitleText": "退料申请",
"app-plus": {
"titleNView": {
"buttons": [
{
"float": "right",
"text": "新增",
"fontSize": "16px",
"onclick": "Function"
}
]
}
}
}
},
{
"path": "pages/workFetchMaterial/workFetchMaterial",
"style": {
"navigationBarTitleText": "工器具领料申请"
}
},
{
"path": "pages/workExitMaterial/workExitMaterial",
"style": {
"navigationBarTitleText": "工器具退料申请"
}
},
{
"path": "pages/deviceDetail/deviceDetail",
"style": {
"navigationBarTitleText": "机具详情"
}
},
{
"path": "pages/orderCart/orderCart",
"style": {
"navigationBarTitleText": "预约车",
"app-plus": {
"titleNView": {
"buttons": [
{
"float": "right",
"text": "删除",
"fontSize": "16px",
"onclick": "Function"
}
]
}
}
}
},
{
"path": "pages/fetchExam/fetchExam",
"style": {
"navigationBarTitleText": "领料审批"
}
},
{
"path": "pages/exitMaterialDetail/exitMaterialDetail",
"style": {
"navigationBarTitleText": "退料申请明细"
}
},
{
"path": "pages/fetchMaterialDetail/fetchMaterialDetail",
"style": {
"navigationBarTitleText": "领料明细"
}
},
{
"path": "pages/exitExam/exitExam",
"style": {
"navigationBarTitleText": "退料审批"
}
},
{
"path": "pages/newInStore/newInStore",
"style": {
"navigationBarTitleText": "新购入库"
}
},
{
"path": "pages/newBuyDetail/newBuyDetail",
"style": {
"navigationBarTitleText": "新购明细"
}
},
{
"path": "pages/newInAfterScan/newInAfterScan",
"style": {
"navigationBarTitleText": "新购机具详情"
}
},
{
"path": "pages/fix/fix",
"style": {
"navigationBarTitleText": "维修"
}
},
{
"path": "pages/fixDetail/fixDetail",
"style": {
"navigationBarTitleText": "维修明细"
}
},
{
"path": "pages/innerFix/innerFix",
"style": {
"navigationBarTitleText": "内部维修"
}
},
{
"path": "pages/returnFix/returnFix",
"style": {
"navigationBarTitleText": "返厂维修"
}
},
{
"path": "pages/waitCrash/waitCrash",
"style": {
"navigationBarTitleText": "待报废"
}
},
{
"path": "pages/backMaterialInStore/backMaterialInStore",
"style": {
"navigationBarTitleText": "退料入库"
}
},
{
"path": "pages/backMaterialInStoreDetail/backMaterialInStoreDetail",
"style": {
"navigationBarTitleText": "退料入库明细"
}
},
{
"path": "pages/repairTestInStore/repairTestInStore",
"style": {
"navigationBarTitleText": "修试入库"
}
},
{
"path": "pages/fetchMaterialOutStore/fetchMaterialOutStore",
"style": {
"navigationBarTitleText": "领料出库"
}
},
{
"path": "pages/backMaterialReceive/backMaterialReceive",
"style": {
"navigationBarTitleText": "退料接收"
}
},
{
"path": "pages/repairTestInStoreDetail/repairTestInStoreDetail",
"style": {
"navigationBarTitleText": "修试入库明细"
}
},
}, {
"path": "pages/workSpace/workSpace",
"style": {
"navigationBarTitleText": "工作台"
}
}, {
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "登录"
}
}, {
"path": "pages/fetchMaterial/fetchMaterial",
"style": {
"navigationStyle": "custom"
}
}, {
"path": "pages/exitMaterial/exitMaterial",
"style": {
"navigationBarTitleText": "退料申请",
"app-plus": {
"titleNView": {
"buttons": [{
"float": "right",
"text": "新增",
"fontSize": "16px",
"onclick": "Function"
}]
}
}
}
}, {
"path": "pages/workFetchMaterial/workFetchMaterial",
"style": {
"navigationBarTitleText": "工器具领料申请"
}
}, {
"path": "pages/workExitMaterial/workExitMaterial",
"style": {
"navigationBarTitleText": "工器具退料申请"
}
}, {
"path": "pages/deviceDetail/deviceDetail",
"style": {
"navigationBarTitleText": "机具详情"
}
}, {
"path": "pages/orderCart/orderCart",
"style": {
"navigationBarTitleText": "预约车",
"app-plus": {
"titleNView": {
"buttons": [{
"float": "right",
"text": "删除",
"fontSize": "16px",
"onclick": "Function"
}]
}
}
}
}, {
"path": "pages/fetchExam/fetchExam",
"style": {
"navigationBarTitleText": "领料审批"
}
}, {
"path": "pages/exitMaterialDetail/exitMaterialDetail",
"style": {
"navigationBarTitleText": "退料申请明细"
}
}, {
"path": "pages/fetchMaterialDetail/fetchMaterialDetail",
"style": {
"navigationBarTitleText": "领料明细"
}
}, {
"path": "pages/exitExam/exitExam",
"style": {
"navigationBarTitleText": "退料审批"
}
}, {
"path": "pages/newInStore/newInStore",
"style": {
"navigationBarTitleText": "新购入库"
}
}, {
"path": "pages/newBuyDetail/newBuyDetail",
"style": {
"navigationBarTitleText": "新购明细"
}
}, {
"path": "pages/newInAfterScan/newInAfterScan",
"style": {
"navigationBarTitleText": "新购机具详情"
}
}, {
"path": "pages/fix/fix",
"style": {
"navigationBarTitleText": "维修"
}
}, {
"path": "pages/fixDetail/fixDetail",
"style": {
"navigationBarTitleText": "维修明细"
}
}, {
"path": "pages/innerFix/innerFix",
"style": {
"navigationBarTitleText": "内部维修"
}
}, {
"path": "pages/returnFix/returnFix",
"style": {
"navigationBarTitleText": "返厂维修"
}
}, {
"path": "pages/waitCrash/waitCrash",
"style": {
"navigationBarTitleText": "待报废"
}
}, {
"path": "pages/backMaterialInStore/backMaterialInStore",
"style": {
"navigationBarTitleText": "退料入库"
}
}, {
"path": "pages/backMaterialInStoreDetail/backMaterialInStoreDetail",
"style": {
"navigationBarTitleText": "退料入库明细"
}
}, {
"path": "pages/repairTestInStore/repairTestInStore",
"style": {
"navigationBarTitleText": "修试入库"
}
}, {
"path": "pages/fetchMaterialOutStore/fetchMaterialOutStore",
"style": {
"navigationBarTitleText": "领料出库"
}
}, {
"path": "pages/backMaterialReceive/backMaterialReceive",
"style": {
"navigationBarTitleText": "退料接收"
}
}, {
"path": "pages/repairTestInStoreDetail/repairTestInStoreDetail",
"style": {
"navigationBarTitleText": "修试入库明细"
}
}
, {
"path": "pages/exitMaterialSelect/exitMaterialSelect",
"style": {
"navigationBarTitleText": "退料物料选择"
}
}, {
"path": "pages/exitExamDetail/exitExamDetail",
"style": {
"navigationBarTitleText": "退料明细"
}
}, {
"path": "pages/crashExam/crashExam",
"style": {
"navigationBarTitleText": "报废审核"
}
},
{
"path" : "pages/crashExam/crashExamDetails",
"style" :
{
"navigationBarTitleText": "报废明细"
}
},{
"path" : "pages/crashExam/crashExamList",
"style" :
{
"navigationBarTitleText": "报废详情"
}
},
{
"path": "pages/testExam/testExam",
"style": {
"navigationBarTitleText": "维修审核"
}
},
{
"path" : "pages/testExam/testExamDetails",
"style" :
{
"navigationBarTitleText": "维修审核明细"
}
},{
"path" : "pages/testExam/testExamList",
"style" :
{
"navigationBarTitleText": "维修审核详情"
}
},
{
"path": "pages/fetchMaterialOutStoreDetail/fetchMaterialOutStoreDetail",
"style": {
"navigationBarTitleText": "领料出库明细"
}
}, {
"path": "pages/codeOutStore/codeOutStore",
"style": {
"navigationBarTitleText": "编码出库"
}
}, {
"path": "pages/scanOutStore/scanOutStore",
"style": {
"navigationBarTitleText": "二维码出库"
}
}, {
"path": "pages/backMaterialReceiveDetail/backMaterialReceiveDetail",
"style": {
"navigationBarTitleText": "退料接收明细",
"app-plus": {
"titleNView": {
"buttons": [
{
"text": "结束任务",
"fontSize": "12px",
"color": "#4e6ef2",
"width": "auto"
}
]
}
}
}
}, {
"path": "pages/scanReceive/scanReceive",
"style": {
"navigationBarTitleText": "二维码接收"
}
}, {
"path": "pages/codeReceive/codeReceive",
"style": {
"navigationBarTitleText": "编码接收"
}
}, {
"path": "pages/numReceive/numReceive",
"style": {
"navigationBarTitleText": "数量接收"
}
}
,{
"path" : "pages/seeBackMaterialDetail/seeBackMaterialDetail",
"style" :
{
{
"path": "pages/exitMaterialSelect/exitMaterialSelect",
"style": {
"navigationBarTitleText": "退料物料选择"
}
},
{
"path": "pages/exitExamDetail/exitExamDetail",
"style": {
"navigationBarTitleText": "退料明细"
}
},
{
"path": "pages/crashExam/crashExam",
"style": {
"navigationBarTitleText": "报废审核"
}
},
{
"path": "pages/crashExam/crashExamDetails",
"style": {
"navigationBarTitleText": "报废明细"
}
},
{
"path": "pages/crashExam/crashExamList",
"style": {
"navigationBarTitleText": "报废详情"
}
},
{
"path": "pages/testExam/testExam",
"style": {
"navigationBarTitleText": "维修审核"
}
},
{
"path": "pages/testExam/testExamDetails",
"style": {
"navigationBarTitleText": "维修审核明细"
}
},
{
"path": "pages/testExam/testExamList",
"style": {
"navigationBarTitleText": "维修审核详情"
}
},
{
"path": "pages/fetchMaterialOutStoreDetail/fetchMaterialOutStoreDetail",
"style": {
"navigationBarTitleText": "领料出库明细"
}
},
{
"path": "pages/codeOutStore/codeOutStore",
"style": {
"navigationBarTitleText": "编码出库"
}
},
{
"path": "pages/scanOutStore/scanOutStore",
"style": {
"navigationBarTitleText": "二维码出库"
}
},
{
"path": "pages/backMaterialReceiveDetail/backMaterialReceiveDetail",
"style": {
"navigationBarTitleText": "退料接收明细",
"app-plus": {
"titleNView": {
"buttons": [
{
"text": "结束任务",
"fontSize": "12px",
"color": "#4e6ef2",
"width": "auto"
}
]
}
}
}
},
{
"path": "pages/scanReceive/scanReceive",
"style": {
"navigationBarTitleText": "二维码接收"
}
},
{
"path": "pages/codeReceive/codeReceive",
"style": {
"navigationBarTitleText": "编码接收"
}
},
{
"path": "pages/numReceive/numReceive",
"style": {
"navigationBarTitleText": "数量接收"
}
},
{
"path": "pages/seeBackMaterialDetail/seeBackMaterialDetail",
"style": {
"navigationBarTitleText": "退料明细查看"
}
}
,{
"path" : "pages/authManage/authManage",
"style" :
{
},
{
"path": "pages/authManage/authManage",
"style": {
"navigationBarTitleText": "权限管理"
}
}
,{
"path" : "pages/moreNotice/moreNotice",
"style" :
{
},
{
"path": "pages/moreNotice/moreNotice",
"style": {
"navigationBarTitleText": "通知公告"
}
}
,{
"path" : "pages/rfidOutStore/rfidOutStore",
"style" :
{
},
{
"path": "pages/rfidOutStore/rfidOutStore",
"style": {
"navigationBarTitleText": "rfid出库"
}
}
,{
"path" : "pages/rfidReceive/rfidReceive",
"style" :
{
},
{
"path": "pages/rfidReceive/rfidReceive",
"style": {
"navigationBarTitleText": "rfid接收"
}
}
,{
"path" : "pages/noticeDetail/noticeDetail",
"style" :
{
},
{
"path": "pages/noticeDetail/noticeDetail",
"style": {
"navigationBarTitleText": "通知公告"
}
}
,{
"path" : "pages/QROut/QROut",
"style" :
{
},
{
"path": "pages/QROut/QROut",
"style": {
"app-plus": {
"titleNView": false
"titleNView": false
}
}
}
,{
"path" : "pages/searchProjUsing/searchProjUsing",
"style" :
{
},
{
"path": "pages/searchProjUsing/searchProjUsing",
"style": {
"navigationBarTitleText": "工程在用"
}
}
,{
"path" : "pages/searchFetchRecord/searchFetchRecord",
"style" :
{
},
{
"path": "pages/searchFetchRecord/searchFetchRecord",
"style": {
"navigationBarTitleText": "领用记录"
}
}
,{
"path" : "pages/QRIn/QRIn",
"style" :
{
},
{
"path": "pages/QRIn/QRIn",
"style": {
"app-plus": {
"titleNView": false
"titleNView": false
}
}
}
,{
"path" : "pages/newCheck/newCheck",
"style" :
{
},
{
"path": "pages/newCheck/newCheck",
"style": {
"navigationBarTitleText": "新购验收"
}
}
,{
"path" : "pages/newCheck/newCheckDetail",
"style" :
{
},
{
"path": "pages/newCheck/newCheckDetail",
"style": {
"navigationBarTitleText": "新购验收明细"
}
}
,{
"path" : "pages/rfidBinding/rfidBinding",
"style" :
{
},
{
"path": "pages/rfidBinding/rfidBinding",
"style": {
"navigationBarTitleText": "RFID绑定"
}
}
,{
"path" : "pages/qrcodeBinding/qrcodeBinding",
"style" :
{
},
{
"path": "pages/qrcodeBinding/qrcodeBinding",
"style": {
"app-plus": {
"titleNView": false
"titleNView": false
}
}
}
,{
"path" : "pages/qrcodeBindPage/qrcodeBindPage",
"style" :
{
},
{
"path": "pages/qrcodeBindPage/qrcodeBindPage",
"style": {
"navigationBarTitleText": "二维码绑定"
}
}
,{
"path" : "pages/indexScan/indexScan",
"style" :
{
},
{
"path": "pages/indexScan/indexScan",
"style": {
"navigationBarTitleText": "扫描结果"
}
}
,{
"path" : "pages/numLoanReceive/numLoanReceive",
},
{
"path": "pages/numLoanReceive/numLoanReceive",
"style": {
"navigationBarTitleText": "数量接收"
"navigationBarTitleText": "数量接收"
}
}
],
"tabBar": {
"color": "#2c2c2c",
"selectedColor": "#1296db",
"borderStyle": "black",
"backgroundColor": "#FFFFFF",
"iconWidth": "24px",
"list": [{
"pagePath": "pages/index/index",
"iconPath": "static/home.png",
"selectedIconPath": "static/homeSelected.png",
"text": "首页"
},
{
"pagePath": "pages/workSpace/workSpace",
"iconPath": "static/workSpace.png",
"selectedIconPath": "static/workSpaceSelected.png",
"text": "工作台"
},
{
"pagePath": "pages/user/user",
"iconPath": "static/my.png",
"selectedIconPath": "static/mySelected.png",
"text": "个人中心"
}
]
},
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8",
"maxWidth": 750
},
"uniIdRouter": {}
}
"tabBar": {
"color": "#2c2c2c",
"selectedColor": "#1296db",
"borderStyle": "black",
"backgroundColor": "#FFFFFF",
"iconWidth": "24px",
"list": [
{
"pagePath": "pages/index/index",
"iconPath": "static/home.png",
"selectedIconPath": "static/homeSelected.png",
"text": "首页"
},
{
"pagePath": "pages/workSpace/workSpace",
"iconPath": "static/workSpace.png",
"selectedIconPath": "static/workSpaceSelected.png",
"text": "工作台"
},
{
"pagePath": "pages/user/user",
"iconPath": "static/my.png",
"selectedIconPath": "static/mySelected.png",
"text": "个人中心"
}
]
},
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8",
"maxWidth": 750
},
"uniIdRouter": {}
}

View File

@ -273,8 +273,11 @@
success: () => {
uni.removeStorageSync("token");
uni.removeStorageSync("userInfo");
// uni.reLaunch({
// url: "/pages/login/login",
// });
uni.reLaunch({
url: "/pages/login/login",
url: "/pages/nwLogin/index",
});
},
});

562
pages/nwLogin/index.vue Normal file
View File

@ -0,0 +1,562 @@
<template>
<view>
<view class="upper-bgd">
<view class="logo">
<image src="../../static/logo.png" mode=""></image>
</view>
<view class="tit"> 智慧仓储管理平台 </view>
</view>
<view class="switch-log">
<view
:class="[{ active: switchStatus == 1 }]"
@click="switchUpper(1)">
账号登录
</view>
<view
:class="[{ active: switchStatus == 2 }]"
@click="switchUpper(2)">
手机登录
</view>
</view>
<view class="login-area">
<uni-forms
v-show="switchStatus == 1"
ref="accountForm"
:modelValue="accountFormData"
:rules="accountRules"
class="form-area"
label-position="top">
<uni-forms-item
name="username"
required
label="用户名"
label-width="100">
<uni-easyinput
placeholder="请输入用户名称"
maxlength="60"
v-model="accountFormData.username"></uni-easyinput>
</uni-forms-item>
<uni-forms-item
name="password"
required
label="密码"
label-width="100">
<uni-easyinput
type="password"
placeholder="请输入密码"
maxlength="60"
v-model="accountFormData.password"></uni-easyinput>
</uni-forms-item>
<text
style="
width: 100%;
display: flex;
justify-content: flex-end;
color: #3689ff;
font-size: 14px;
">
忘记密码
</text>
<button class="submit-btn" @click="accountSubmit">登录</button>
</uni-forms>
<uni-forms
v-show="switchStatus == 2"
ref="veriForm"
:modelValue="veriFormData"
:rules="veriRules"
class="form-area"
label-position="top">
<uni-forms-item
name="phone"
required
label="手机号码"
label-width="100">
<uni-easyinput
placeholder="请输入手机号码"
v-model="veriFormData.phone"
maxlength="11"></uni-easyinput>
</uni-forms-item>
<uni-forms-item
required
label="图形验证码"
label-width="100"
name="imgCode">
<view class="code-img-wrapper">
<uni-easyinput
placeholder="请输入图形验证码"
v-model="veriFormData.imgCode"></uni-easyinput>
<img
:src="phoneCodeUrlNew"
@tap="
() => {
getImgCode();
}
" />
</view>
</uni-forms-item>
<uni-forms-item
name="code"
required
label="验证码"
label-width="100">
<uni-easyinput
maxlength="6"
placeholder="请输入短信验证码"
v-model="veriFormData.code"></uni-easyinput>
<button
class="count-down"
:disabled="sendDisabled"
@click="sendVeriCode"
style="font-size: 14px">
<span v-if="countDownStatus == 0">发送验证码</span>
<span v-if="countDownStatus == 1">
{{ countDown }}s
</span>
</button>
</uni-forms-item>
<button class="submit-btn" @click="veriSubmit">登录</button>
</uni-forms>
</view>
<u-loading-page
:loading="showLoading"
color="#000"
loading-text="登录中,请稍后..."></u-loading-page>
</view>
</template>
<script>
import { authPath, publicPath, systemPath } from "../../public";
import store from "../../store/user";
import { Mcaptcha } from "../../utils/mcaptcha";
export default {
data() {
return {
showLoading: false,
accountFormData: {
username: "",
password: "",
},
veriFormData: {
phone: "",
code: "",
imgCode: "",
uuid: "",
},
switchStatus: 1,
phoneCodeUrlNew: "",
countDown: 60,
countDownStatus: 0,
sendDisabled: false,
givenCode: "",
accountRules: {
username: {
rules: [
{
required: true,
errorMessage: "请输入用户名称!",
},
],
},
password: {
rules: [
{
required: true,
errorMessage: "请输入密码!",
},
],
},
},
veriRules: {
phone: {
rules: [
{
required: true,
errorMessage: "请输入手机号码!",
},
{
pattern: /^(?:(?:\+|00)86)?1[3-9]\d{9}$/,
errorMessage: "请输入正确的手机号码!",
},
],
},
code: {
rules: [
{
required: true,
errorMessage: "请输入短信验证码",
},
],
},
imgCode: {
rules: [
{
required: true,
errorMessage: "请输入图形验证码!",
},
],
},
},
mcaptcha: null,
};
},
methods: {
switchUpper(count) {
this.getImgCode();
this.switchStatus = count;
},
/** 发送短信验证码按钮 */
sendVeriCode() {
// 1.
this.$refs.veriForm
.validateField(["phone", "imgCode"])
.then(async () => {
// 2.
const params = {
phone: this.veriFormData.phone,
code: this.veriFormData.imgCode,
uuid: this.veriFormData.uuid,
};
const { data: messageRes } =
await this.$api.login.getMessageCode(params);
if (messageRes.code === 200) {
uni.showToast({
icon: "none",
title: "验证码已发送",
});
this.countDownStatus = 1;
this.sendDisabled = true;
let timeInterval = setInterval(() => {
this.countDown -= 1;
}, 1000);
let timeOut = setTimeout(() => {
this.countDownStatus = 0;
this.countDown = 60;
this.sendDisabled = false;
clearInterval(timeInterval);
clearTimeout(timeOut);
}, 1000 * 60);
} else {
uni.showToast({
icon: "none",
title: `${messageRes.msg}`,
});
//
this.getImgCode();
}
})
.catch((err) => {});
if (true) return;
let that = this;
let phoneReg = /^(?:(?:\+|00)86)?1[3-9]\d{9}$/;
if (!phoneReg.test(that.veriFormData.phone)) {
uni.showToast({
icon: "none",
title: "请输入正确格式的手机号!",
});
} else {
that.$api.login
.codeLogin({
phone: String(that.veriFormData.phone),
})
.then((res) => {
console.log(res);
if (res.data.code !== 200) {
// uni.showToast({
// icon:'none',
// title:res.data.msg
// })
uni.showModal({
title: "提示", //
content: res.data.msg, //
showCancel: false, //
});
} else {
that.countDownStatus = 1;
that.sendDisabled = true;
let timeInterval = setInterval(() => {
that.countDown -= 1;
}, 1000);
let timeOut = setTimeout(() => {
that.countDownStatus = 0;
that.countDown = 60;
that.sendDisabled = false;
clearInterval(timeInterval);
clearTimeout(timeOut);
}, 1000 * 60);
}
})
.catch((err) => {
console.log(err);
uni.showToast({
icon: "error",
title: "验证码获取失败",
});
});
}
},
veriSubmit() {
// 1.
this.$refs.veriForm
.validateField(["phone", "code"])
.then(async () => {
// 2.
const { code, phone } = this.veriFormData;
const { data: res } = await this.$api.login.checkCode({
code,
phone,
});
if (res.code === 200) {
uni.setStorageSync("userInfo", res.data.login_user);
uni.setStorageSync("token", res.data.access_token);
uni.setStorageSync(
"roles",
res.data.login_user.roles
);
uni.setStorageSync(
"deptId",
res.data.login_user.sysUser.dept.deptId
);
const { data: resS } =
await this.$api.index.getUserInfo();
store.commit("SET_PERMISSIONS", resS.permissions);
uni.showToast({ icon: "none", title: "登录成功" });
setTimeout(() => {
uni.switchTab({
url: "/pages/index/index",
});
}, 500);
}
});
if (true) return;
let that = this;
that.$refs.veriForm.validate().then((formRes) => {
that.showLoading = true;
console.log(formRes);
that.$api.login
.checkCode(formRes)
.then((res) => {
console.log(res);
if (res.data.code == 200) {
uni.setStorageSync(
"userInfo",
res.data.data.login_user
);
uni.setStorageSync(
"token",
res.data.data.access_token
);
uni.setStorageSync(
"roles",
res.data.data.login_user.roles
);
uni.setStorageSync(
"deptId",
res.data.data.login_user.sysUser.dept.deptId
);
uni.showToast({
icon: "none",
title: "登录成功!",
success: async () => {
that.showLoading = false;
const res =
await this.$api.index.getUserInfo();
console.log(res, "用户权限----");
// uni.switchTab({
// url: '/pages/index/index'
// })
},
});
} else {
uni.showToast({
icon: "none",
title: res.data.msg,
success: () => {
that.showLoading = false;
},
});
}
})
.catch((err) => {
console.log(err);
});
});
},
accountSubmit() {
let that = this;
that.$refs.accountForm.validate().then((formData) => {
that.showLoading = true;
console.log(formData);
that.$api.login
.log(formData)
.then(async (res) => {
console.log(res);
if (res.data.code == 200) {
uni.setStorageSync(
"userInfo",
res.data.data.login_user
);
uni.setStorageSync(
"token",
res.data.data.access_token
);
uni.setStorageSync(
"roles",
res.data.data.login_user.roles
);
uni.setStorageSync(
"deptId",
res.data.data.login_user.sysUser.dept.deptId
);
uni.setStorageSync("pwd", formData.password);
uni.showToast({
icon: "none",
title: "登录成功!",
success: async () => {
that.showLoading = false;
const { data: res } =
await this.$api.index.getUserInfo();
store.commit(
"SET_PERMISSIONS",
res.permissions
);
uni.switchTab({
url: "/pages/index/index",
});
},
});
} else {
uni.showToast({
icon: "none",
title: res.data.msg,
success: () => {
that.showLoading = false;
},
});
}
})
.catch((err) => {
console.log(err);
});
});
},
/** 获取图形验证码 */
getImgCode() {
const url =
process.env.NODE_ENV === "production"
? "测试环境或者线上ip"
: "本地调试ip";
uni.request({
url: "http://192.168.2.135:49080/code",
method: "GET",
}).then((res) => {
this.phoneCodeUrlNew =
"data:image/gif;base64," + res.data.img;
this.veriFormData.uuid = res.data.uuid;
});
},
},
onShow() {
if (uni.getStorageSync("pwd")) {
this.accountFormData.password = uni.getStorageSync("pwd");
}
},
};
</script>
<style lang="scss">
body {
background: url("/static/log-bgd.png");
background-repeat: no-repeat;
background-size: 100% 100%;
}
.upper-bgd {
width: 100%;
height: 25vh;
box-sizing: border-box;
padding-top: 10vh;
.logo {
width: 20%;
height: 10vh;
margin: 0 auto;
margin-bottom: 2vh;
image {
width: 100%;
height: 100%;
}
}
.tit {
width: 100%;
font-size: 20px;
font-weight: bold;
display: flex;
justify-content: center;
color: #3c87f3;
}
}
.switch-log {
width: 80%;
height: 100rpx;
margin: 6vh auto;
margin-bottom: 1vh;
display: flex;
justify-content: space-around;
align-items: center;
font-size: 26rpx;
.active {
font-size: 14px;
font-weight: bold;
border-bottom: 4px solid #b4d0ff;
border-bottom-left-radius: 15rpx;
border-bottom-right-radius: 15rpx;
}
}
.login-area {
width: 80%;
box-sizing: border-box;
padding: 3vh;
margin: 0 auto;
background-color: #fff;
border-radius: 20rpx;
box-shadow: 0 3px 5px #e6eefe;
.uni-forms-item__content[data-v-61dfc0d0] {
display: flex;
}
.submit-btn {
background-color: #3888ff;
margin: 2vh auto;
margin-bottom: 0;
border-radius: 50rpx;
color: #fff;
font-size: 26rpx;
}
}
.code-img-wrapper {
display: flex;
align-items: center;
img {
margin-left: 5rpx;
height: 80rpx;
}
}
</style>

View File

@ -72,7 +72,8 @@
uni.removeStorageSync("token");
uni.removeStorageSync("userInfo");
uni.reLaunch({
url: "/pages/login/login",
// url: "/pages/login/login",
url: "/pages/nwLogin/index",
});
}
},

591
router.js
View File

@ -11,11 +11,11 @@ const router = createRouter({
}
},
{
"path" : "/pages/workSpace/workSpace",
"name": 'workSpace',
"meta": {
"needAuth": "true"
}
"path": "/pages/workSpace/workSpace",
"name": 'workSpace',
"meta": {
"needAuth": "true"
}
},
{
"path": "/pages/user/user",
@ -24,401 +24,408 @@ const router = createRouter({
"needAuth": "true"
}
},
// 重庆登录页
// {
// "path" : "/pages/login/login",
// "name": 'login'
// },
// 南网登陆页
{
"path" : "/pages/login/login",
"name": 'login'
"path": "/pages/nwLogin/index",
"name": 'login'
},
{
"path" : "/pages/fetchMaterial/fetchMaterial",
"name": 'fetchMaterial',
"meta": {
"needAuth": "true"
}
"path": "/pages/fetchMaterial/fetchMaterial",
"name": 'fetchMaterial',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/exitMaterial/exitMaterial",
"name": 'exitMaterial',
"meta": {
"needAuth": "true"
}
"path": "/pages/exitMaterial/exitMaterial",
"name": 'exitMaterial',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/workFetchMaterial/workFetchMaterial",
"name": 'workFetchMaterial',
"meta": {
"needAuth": "true"
}
"path": "/pages/workFetchMaterial/workFetchMaterial",
"name": 'workFetchMaterial',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/workExitMaterial/workExitMaterial",
"name": 'workExitMaterial',
"meta": {
"needAuth": "true"
}
"path": "/pages/workExitMaterial/workExitMaterial",
"name": 'workExitMaterial',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/deviceDetail/deviceDetail",
"name": 'deviceDetail',
"meta": {
"needAuth": "true"
}
"path": "/pages/deviceDetail/deviceDetail",
"name": 'deviceDetail',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/orderCart/orderCart",
"name": 'orderCart',
"meta": {
"needAuth": "true"
}
"path": "/pages/orderCart/orderCart",
"name": 'orderCart',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/fetchExam/fetchExam",
"name": 'fetchExam',
"meta": {
"needAuth": "true"
}
"path": "/pages/fetchExam/fetchExam",
"name": 'fetchExam',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/exitMaterialDetail/exitMaterialDetail",
"name": 'exitMaterialDetail',
"meta": {
"needAuth": "true"
}
"path": "/pages/exitMaterialDetail/exitMaterialDetail",
"name": 'exitMaterialDetail',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/fetchMaterialDetail/fetchMaterialDetail",
"name": 'fetchMaterialDetail',
"meta": {
"needAuth": "true"
}
"path": "/pages/fetchMaterialDetail/fetchMaterialDetail",
"name": 'fetchMaterialDetail',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/exitExam/exitExam",
"name": 'exitExam',
"meta": {
"needAuth": "true"
}
"path": "/pages/exitExam/exitExam",
"name": 'exitExam',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/newInStore/newInStore",
"name": 'newInStore',
"meta": {
"needAuth": "true"
}
"path": "/pages/newInStore/newInStore",
"name": 'newInStore',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/newBuyDetail/newBuyDetail",
"name": 'newBuyDetail',
"meta": {
"needAuth": "true"
}
"path": "/pages/newBuyDetail/newBuyDetail",
"name": 'newBuyDetail',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/newInAfterScan/newInAfterScan",
"name": 'newInAfterScan',
"meta": {
"needAuth": "true"
}
"path": "/pages/newInAfterScan/newInAfterScan",
"name": 'newInAfterScan',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/fix/fix",
"name": 'fix',
"meta": {
"needAuth": "true"
}
"path": "/pages/fix/fix",
"name": 'fix',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/fixDetail/fixDetail",
"name": 'fixDetail',
"meta": {
"needAuth": "true"
}
"path": "/pages/fixDetail/fixDetail",
"name": 'fixDetail',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/innerFix/innerFix",
"name": 'innerFix',
"meta": {
"needAuth": "true"
}
"path": "/pages/innerFix/innerFix",
"name": 'innerFix',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/returnFix/returnFix",
"name": 'returnFix',
"meta": {
"needAuth": "true"
}
"path": "/pages/returnFix/returnFix",
"name": 'returnFix',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/waitCrash/waitCrash",
"name": 'waitCrash',
"meta": {
"needAuth": "true"
}
"path": "/pages/waitCrash/waitCrash",
"name": 'waitCrash',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/backMaterialInStore/backMaterialInStore",
"name": 'backMaterialInStore',
"meta": {
"needAuth": "true"
}
"path": "/pages/backMaterialInStore/backMaterialInStore",
"name": 'backMaterialInStore',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/backMaterialInStoreDetail/backMaterialInStoreDetail",
"name": 'backMaterialInStoreDetail',
"meta": {
"needAuth": "true"
}
"path": "/pages/backMaterialInStoreDetail/backMaterialInStoreDetail",
"name": 'backMaterialInStoreDetail',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/repairTestInStore/repairTestInStore",
"name": 'repairTestInStore',
"meta": {
"needAuth": "true"
}
"path": "/pages/repairTestInStore/repairTestInStore",
"name": 'repairTestInStore',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/fetchMaterialOutStore/fetchMaterialOutStore",
"name": 'fetchMaterialOutStore',
"meta": {
"needAuth": "true"
}
"path": "/pages/fetchMaterialOutStore/fetchMaterialOutStore",
"name": 'fetchMaterialOutStore',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/backMaterialReceive/backMaterialReceive",
"name": 'backMaterialReceive',
"meta": {
"needAuth": "true"
}
"path": "/pages/backMaterialReceive/backMaterialReceive",
"name": 'backMaterialReceive',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/repairTestInStoreDetail/repairTestInStoreDetail",
"name": 'repairTestInStoreDetail',
"meta": {
"needAuth": "true"
}
"path": "/pages/repairTestInStoreDetail/repairTestInStoreDetail",
"name": 'repairTestInStoreDetail',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/exitMaterialSelect/exitMaterialSelect",
"name": 'exitMaterialSelect',
"meta": {
"needAuth": "true"
}
"path": "/pages/exitMaterialSelect/exitMaterialSelect",
"name": 'exitMaterialSelect',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/exitExamDetail/exitExamDetail",
"name": 'exitExamDetail',
"meta": {
"needAuth": "true"
}
"path": "/pages/exitExamDetail/exitExamDetail",
"name": 'exitExamDetail',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/crashExam/crashExam",
"name": 'crashExam',
"meta": {
"needAuth": "true"
}
"path": "/pages/crashExam/crashExam",
"name": 'crashExam',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/crashExam/crashExamDetails",
"name": 'crashExamDetails',
"meta": {
"needAuth": "true"
}
"path": "/pages/crashExam/crashExamDetails",
"name": 'crashExamDetails',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/crashExam/crashExamList",
"name": 'crashExamList',
"meta": {
"needAuth": "true"
}
"path": "/pages/crashExam/crashExamList",
"name": 'crashExamList',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/testExam/testExam",
"name": 'testExam',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/testExam/testExamDetails",
"name": 'testExamDetails',
"meta": {
"needAuth": "true"
}
"path": "/pages/testExam/testExam",
"name": 'testExam',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/testExam/testExamList",
"name": 'testExamList',
"meta": {
"needAuth": "true"
}
"path": "/pages/testExam/testExamDetails",
"name": 'testExamDetails',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/fetchMaterialOutStoreDetail/fetchMaterialOutStoreDetail",
"name": 'fetchMaterialOutStoreDetail',
"meta": {
"needAuth": "true"
}
"path": "/pages/testExam/testExamList",
"name": 'testExamList',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/codeOutStore/codeOutStore",
"name": 'codeOutStore',
"meta": {
"needAuth": "true"
}
"path": "/pages/fetchMaterialOutStoreDetail/fetchMaterialOutStoreDetail",
"name": 'fetchMaterialOutStoreDetail',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/scanOutStore/scanOutStore",
"name": 'scanOutStore',
"meta": {
"needAuth": "true"
}
"path": "/pages/codeOutStore/codeOutStore",
"name": 'codeOutStore',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/backMaterialReceiveDetail/backMaterialReceiveDetail",
"name": 'backMaterialReceiveDetail',
"meta": {
"needAuth": "true"
}
"path": "/pages/scanOutStore/scanOutStore",
"name": 'scanOutStore',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/scanReceive/scanReceive",
"name": 'scanReceive',
"meta": {
"needAuth": "true"
}
"path": "/pages/backMaterialReceiveDetail/backMaterialReceiveDetail",
"name": 'backMaterialReceiveDetail',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/codeReceive/codeReceive",
"name": 'codeReceive',
"meta": {
"needAuth": "true"
}
"path": "/pages/scanReceive/scanReceive",
"name": 'scanReceive',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/numReceive/numReceive",
"name": 'numReceive',
"meta": {
"needAuth": "true"
}
"path": "/pages/codeReceive/codeReceive",
"name": 'codeReceive',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/seeBackMaterialDetail/seeBackMaterialDetail",
"name": 'seeBackMaterialDetail',
"meta": {
"needAuth": "true"
}
"path": "/pages/numReceive/numReceive",
"name": 'numReceive',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/authManage/authManage",
"name": 'authManage',
"meta": {
"needAuth": "true"
}
"path": "/pages/seeBackMaterialDetail/seeBackMaterialDetail",
"name": 'seeBackMaterialDetail',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/moreNotice/moreNotice",
"name": 'moreNotice',
"meta": {
"needAuth": "true"
}
"path": "/pages/authManage/authManage",
"name": 'authManage',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/rfidOutStore/rfidOutStore",
"name": 'rfidOutStore',
"meta": {
"needAuth": "true"
}
"path": "/pages/moreNotice/moreNotice",
"name": 'moreNotice',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/rfidReceive/rfidReceive",
"name": 'rfidReceive',
"meta": {
"needAuth": "true"
}
"path": "/pages/rfidOutStore/rfidOutStore",
"name": 'rfidOutStore',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/noticeDetail/noticeDetail",
"name": 'noticeDetail',
"meta": {
"needAuth": "true"
}
"path": "/pages/rfidReceive/rfidReceive",
"name": 'rfidReceive',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/QROut/QROut",
"name": 'QROut',
"meta": {
"needAuth": "true"
}
"path": "/pages/noticeDetail/noticeDetail",
"name": 'noticeDetail',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/searchProjUsing/searchProjUsing",
"name": 'searchProjUsing',
"meta": {
"needAuth": "true"
}
"path": "/pages/QROut/QROut",
"name": 'QROut',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/searchFetchRecord/searchFetchRecord",
"name": 'searchFetchRecord',
"meta": {
"needAuth": "true"
}
"path": "/pages/searchProjUsing/searchProjUsing",
"name": 'searchProjUsing',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/QRIn/QRIn",
"name": 'QRIn',
"meta": {
"needAuth": "true"
}
"path": "/pages/searchFetchRecord/searchFetchRecord",
"name": 'searchFetchRecord',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/newCheck/newCheck",
"name": 'newCheck',
"meta": {
"needAuth": "true"
}
"path": "/pages/QRIn/QRIn",
"name": 'QRIn',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/newCheck/newCheckDetail",
"name": 'newCheckDetail',
"meta": {
"needAuth": "true"
}
"path": "/pages/newCheck/newCheck",
"name": 'newCheck',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/rfidBinding/rfidBinding",
"name": 'rfidBinding',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/qrcodeBinding/qrcodeBinding",
"name": 'qrcodeBinding',
"meta": {
"needAuth": "true"
}
"path": "/pages/newCheck/newCheckDetail",
"name": 'newCheckDetail',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/qrcodeBindPage/qrcodeBindPage",
"name": 'qrcodeBindPage',
"meta": {
"needAuth": "true"
}
"path": "/pages/rfidBinding/rfidBinding",
"name": 'rfidBinding',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/indexScan/indexScan",
"name": 'indexScan',
"meta": {
"needAuth": "true"
}
"path": "/pages/qrcodeBinding/qrcodeBinding",
"name": 'qrcodeBinding',
"meta": {
"needAuth": "true"
}
},
{
"path" : "/pages/numLoanReceive/numLoanReceive",
"name": 'numLoanReceive',
"meta": {
"needAuth": "true"
}
"path": "/pages/qrcodeBindPage/qrcodeBindPage",
"name": 'qrcodeBindPage',
"meta": {
"needAuth": "true"
}
},
{
"path": "/pages/indexScan/indexScan",
"name": 'indexScan',
"meta": {
"needAuth": "true"
}
},
{
"path": "/pages/numLoanReceive/numLoanReceive",
"name": 'numLoanReceive',
"meta": {
"needAuth": "true"
}
}
]
})
@ -453,7 +460,7 @@ router.beforeEach((to, from, next) => {
});
// 全局路由后置守卫
router.afterEach((to, from) => {
})
export {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

75
utils/mcaptcha.js Normal file
View File

@ -0,0 +1,75 @@
// mcaptcha.js
export class Mcaptcha {
constructor(options) {
this.options = options;
this.fontSize = options.height * 3 / 6;
this.init();
this.refresh();
}
init() {
this.ctx = uni.createCanvasContext(this.options.el);
this.ctx.setTextBaseline("middle");
this.ctx.setFillStyle(this.randomColor(180, 240));
}
refresh() {
var code = '';
var txtArr = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
for (var i = 0; i < 4; i++) {
code += txtArr[this.randomNum(0, txtArr.length)];
}
this.options.createCodeImg = code;
let arr = (code + '').split('');
if (arr.length === 0) {
arr = ['e', 'r', 'r', 'o', 'r'];
};
let offsetLeft = this.options.width * 0.6 / (arr.length - 1);
let marginLeft = this.options.width * 0.2;
arr.forEach((item, index) => {
this.ctx.setFillStyle(this.randomColor(0, 180));
let size = this.randomNum(24, this.fontSize);
this.ctx.setFontSize(size);
let dis = offsetLeft * index + marginLeft - size * 0.3;
let deg = this.randomNum(-30, 30);
this.ctx.translate(dis, this.options.height * 0.5);
this.ctx.rotate(deg * Math.PI / 180);
this.ctx.fillText(item, 0, 0);
this.ctx.rotate(-deg * Math.PI / 180);
this.ctx.translate(-dis, -this.options.height * 0.5);
})
for (var i = 0; i < 4; i++) {
this.ctx.strokeStyle = this.randomColor(40, 180);
this.ctx.beginPath();
this.ctx.moveTo(this.randomNum(0, this.options.width), this.randomNum(0, this.options.height));
this.ctx.lineTo(this.randomNum(0, this.options.width), this.randomNum(0, this.options.height));
this.ctx.stroke();
}
for (var i = 0; i < this.options.width / 4; i++) {
this.ctx.fillStyle = this.randomColor(0, 255);
this.ctx.beginPath();
this.ctx.arc(this.randomNum(0, this.options.width), this.randomNum(0, this.options.height), 1, 0, 2 * Math.PI);
this.ctx.fill();
}
this.ctx.draw();
}
validate(code) {
var code = code.toLowerCase();
var v_code = this.options.createCodeImg.toLowerCase();
console.log(code)
console.log(v_code.substring(v_code.length - 4))
if (code == v_code.substring(v_code.length - 4)) {
return true;
} else {
return false;
}
}
randomNum(min, max) {
return Math.floor(Math.random() * (max - min) + min);
}
randomColor(min, max) {
let r = this.randomNum(min, max);
let g = this.randomNum(min, max);
let b = this.randomNum(min, max);
return "rgb(" + r + "," + g + "," + b + ")";
}
}