修改授权方式为手机号码和验证码方式

测试出的问题修复
This commit is contained in:
范露尧
2023-07-12 16:11:42 +08:00
parent fbbabeb690
commit 589b8a0132
86 changed files with 365 additions and 120 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1011 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 831 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 820 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 215 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 375 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 215 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 831 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 215 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 820 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 831 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 215 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 340 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 215 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 340 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 340 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 340 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 375 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 215 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 417 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 340 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 831 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 215 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 215 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 215 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

View File

@@ -21,7 +21,7 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="提交码:" prop="name">
<el-form-item label="手机号码:" prop="name">
<el-input v-model="form.submitCode" style="width:300px"></el-input>
</el-form-item>
<el-form-item>
@@ -34,7 +34,7 @@
<el-table-column type="expand">
<template slot-scope="props">
<el-form label-position="left" class="demo-table-expand" :model="props.row" style="width: 90%;margin:0 auto;">
<el-form-item label="提交码:">
<el-form-item label="手机号码:">
<span style="font-weight:bold;">{{ props.row.submitCode }}</span>
</el-form-item>
<el-form-item label="社区/小区名称:">
@@ -111,7 +111,7 @@
</el-form>
</template>
</el-table-column>
<el-table-column label="提交码" width="120"><template slot-scope="props">{{ props.row.submitCode}}</template></el-table-column>
<el-table-column label="手机号码" width="120"><template slot-scope="props">{{ props.row.submitCode}}</template></el-table-column>
<el-table-column label="社区/小区名称" width="200"><template slot-scope="props">{{ props.row.communityName}}</template></el-table-column>
<el-table-column label="提交日期" width="120"><template slot-scope="props">{{ dateFormat("mm-dd", props.row.createtime )}}</template></el-table-column>
<el-table-column label="幢名称"><template slot-scope="props">{{ props.row.buildingName}}</template></el-table-column>
@@ -160,7 +160,6 @@
},
methods: {
handlePreview(src, srcs) {
debugger
this.loading = true;
console.log(src);
this.dialogImageUrl = src.preview;
@@ -197,7 +196,7 @@
axios({
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
method: 'post',
url: '/gb/yjb/api/outsidewall/querybuilding',
url: `/gb/yjb/api/outsidewall/querybuilding`,
data: { wallId: row.id },
responseType: "json",
headers: {
@@ -236,7 +235,7 @@
axios({
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
method: 'get',
url: '/gb/yjb/api/outsidewall/Communitys?searchkey=' + queryString,
url: `/gb/yjb/api/outsidewall/Communitys?access_token=${window.sessionStorage.getItem('__TOKEN')}&searchkey=` + queryString,
responseType: "json",
}).then(async response => {
_this.communitys = response.data.data

View File

@@ -18,6 +18,26 @@
<body>
<div id="app">
<el-dialog v-model="pageData.dialogLoginVisible" title="请先登录" :close-on-click-modal="false" :close-on-press-escape="false" :show-close="false" append-to-body width="60%">
<el-form :model="pageData.loginForm" ref="loginFormRef" label-position="top">
<el-form-item label="手机号码" label-width="80px" prop="phone" :rules="[{ required: true, trigger: 'blur', min: 11, max: 11, message: '请输入正确的手机号码' }]">
<el-input v-model="pageData.loginForm.phone" autocomplete="off" />
</el-form-item>
<el-form-item label="验证码" label-width="80px">
<el-input type="text" maxlength="4" placeholder="验证码" v-model="pageData.loginForm.code">
<template slot="append" #append>
<el-button :disabled="pageData.loginForm.disabled" @click="(v,v2)=>funHandles.getCode(v,pageData,loginFormRef)">{{ pageData.loginForm.valiBtn }}</el-button>
</template>
</el-input>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<!--<el-button @click="dialogFormVisible = false">Cancel</el-button>-->
<el-button type="primary" @click="(v,v2)=>funHandles.verifyKey(pageData,loginFormRef)">登录</el-button>
</span>
</template>
</el-dialog>
<h3 style="text-align:center;">宁波既有建筑外墙脱落问卷调查</h3>
<el-form ref="formRef" :model="pageData.form" label-position="left" require-asterisk-position="right" label-width="160px" style="margin-top:15px;">
<el-form-item label="1.社区/小区名:" prop="communityId" :rules="[{ required: true, trigger: 'blur', message: '请选择社区/小区' }]">
@@ -43,7 +63,7 @@
</el-form-item>*@-->
<el-form-item label="3.外墙结构:" prop="outsidewallstructurefiles">
<el-upload class="upload-demo" drag multiple
action="/gb/yjb/api/outsidewall/sysFileInfo/upload"
:action="pageData.uploadaction"
auto-upload
list-type="picture-card"
v-model:file-list="pageData.fileList"
@@ -141,11 +161,11 @@
</el-form-item>
<el-form-item label="8.7 问题照片:">
<el-upload class="upload-demo" drag multiple
action="/gb/yjb/api/outsidewall/sysFileInfo/upload"
:action="pageData.uploadaction"
auto-upload
list-type="picture-card"
v-model:file-list="pageData.childFileList1"
:on-preview="(file)=>funHandles.filePreview(file,pageData.childFileList1)"
v-model:file-list="buildingItem.childFileList1"
:on-preview="(file)=>funHandles.filePreview(file,buildingItem.childFileList1)"
:on-remove="(file, fileList)=>funHandles.fileChildRemove(file, fileList,buildingItem)"
:on-success="(response, file, fileList)=>funHandles.fileChildChange(response, file, fileList, buildingItem,'东')"
style="width:100%">
@@ -155,11 +175,11 @@
</el-upload>
<el-upload class="upload-demo" drag multiple
action="/gb/yjb/api/outsidewall/sysFileInfo/upload"
:action="pageData.uploadaction"
auto-upload
list-type="picture-card"
v-model:file-list="pageData.childFileList2"
:on-preview="(file)=> funHandles.filePreview(file,pageData.childFileList2)"
v-model:file-list="buildingItem.childFileList2"
:on-preview="(file)=> funHandles.filePreview(file,buildingItem.childFileList2)"
:on-remove="(file, fileList)=>funHandles.fileChildRemove(file, fileList,buildingItem)"
:on-success="(response, file, fileList)=>funHandles.fileChildChange(response, file, fileList, buildingItem,'西')"
style="width:100%">
@@ -168,11 +188,11 @@
<div class="el-upload__tip" slot="tip">只能上传jpg/png文件且不超过500kb</div>
</el-upload>
<el-upload class="upload-demo" drag multiple
action="/gb/yjb/api/outsidewall/sysFileInfo/upload"
:action="pageData.uploadaction"
auto-upload
list-type="picture-card"
v-model:file-list="pageData.childFileList3"
:on-preview="(file)=> funHandles.filePreview(file,pageData.childFileList3)"
v-model:file-list="buildingItem.childFileList3"
:on-preview="(file)=> funHandles.filePreview(file,buildingItem.childFileList3)"
:on-remove="(file, fileList)=>funHandles.fileChildRemove(file, fileList,buildingItem)"
:on-success="(response, file, fileList)=>funHandles.fileChildChange(response, file, fileList, buildingItem,'南')"
style="width:100%">
@@ -181,11 +201,11 @@
<div class="el-upload__tip" slot="tip">只能上传jpg/png文件且不超过500kb</div>
</el-upload>
<el-upload class="upload-demo" drag multiple
action="/gb/yjb/api/outsidewall/sysFileInfo/upload"
:action="pageData.uploadaction"
auto-upload
list-type="picture-card"
v-model:file-list="pageData.childFileList4"
:on-preview="(file)=>funHandles.filePreview(file,pageData.childFileList4)"
v-model:file-list="buildingItem.childFileList4"
:on-preview="(file)=>funHandles.filePreview(file,buildingItem.childFileList4)"
:on-remove="(file, fileList)=>funHandles.fileChildRemove(file, fileList,buildingItem)"
:on-success="(response, file, fileList)=>funHandles.fileChildChange(response, file, fileList, buildingItem,'北')"
style="width:100%">
@@ -244,12 +264,17 @@
<el-button type="primary" @click.prevent="funHandles.onSubmit(formRef,childFormRef,pageData)"> 提 交 </el-button>
<!--<el-button @click.prevent="showinfo()">我的报名</el-button>-->
</el-form-item>
<el-form-item>
</el-form-item>
</el-form>
<el-image-viewer v-if="pageData.dialogImageUrl"
:zIndex="8000"
@close="() => { pageData.dialogImageUrl='' }"
:url-list="pageData.dialogImageUrls"
:initial-index="XEUtils.indexOf(pageData.dialogImageUrls, pageData.dialogImageUrl)"></el-image-viewer>
</div>
<script type="text/javascript">
@@ -260,14 +285,27 @@
setup() {
const formRef = ref();
const childFormRef = ref();
const loginFormRef = ref();
const pageData = ref({
form: {},
loginForm: {
valiBtn: '获取验证码',
disabled: false
},
//communitys: [],
//buildings: [],
//buildingItemId: ''
//buildingItemId: '',
dialogLoginVisible: false,
uploadaction: "/gb/yjb/api/outsidewall/sysFileInfo/upload"
});
const checkPhone = (rule, value, callback) => {
const regMobile = /^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/;
if (regMobile.test(value)) {
callback()
}
callback(new Error("请输入正确的手机号码"))
};
const rulesCheckData = {
checkPhone: (rule, value, callback) => {
const regMobile = /^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/;
@@ -305,42 +343,104 @@
const staticData = { wallproblems: ['漏水', '开裂', '脱落', '空鼓', '其他问题'] };
const funHandles = {
init: async (data) => {
do {
data.key = await funHandles.verifyKey();
} while (!data.key);
try {
const response = await axios({
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
method: 'get',
url: `/gb/yjb/api/outsidewall/VerifyIsLogin?access_token=${window.sessionStorage.getItem('__VerifyLogin')}`,
responseType: "json",
});
window.loadingInstance?.close();
if (response.data.data != true) {
//if (!window.sessionStorage.getItem('__VerifyLogin'))
data.dialogLoginVisible = true
} else {
data.uploadaction = `/gb/yjb/api/outsidewall/sysFileInfo/upload?access_token=${window.sessionStorage.getItem('__VerifyLogin')}`
}
//do {
// data.key = await funHandles.verifyKey(data);
//} while (data.key == false);
await funHandles.getCommunitys("", data);
//await funHandles.getCommunitys("", data);
} catch (error) {
window.loadingInstance?.close();
console.log(error)
//await ElMessageBox.alert(error.message, '异常', { type: 'error' });
//window.location.reload();//刷新当前页面
data.dialogLoginVisible = true
}
},
verifyKey: async () => {
const key = await ElMessageBox.prompt('请输入授权码', {
title: '授权',
inputPlaceholder: '授权码',
draggable: true,
showClose: false,
showCancelButton: false,
closeOnClickModal: false,
closeOnPressEscape: false,
inputErrorMessage: '请输入授权码',
})
getCode(v, pageData, loginFormRef) {
loginFormRef.validate(async (valid) => {
if (valid) {
console.log('已通过')
console.log(pageData.loginForm.phone)
axios({
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
method: 'post',
url: '/gb/yjb/api/ningbozhichun/sendcode',
data: pageData.loginForm,
responseType: "json",
}).then(async response => {
if (response.data.data != true) {
await ElMessageBox.alert("发送失败:" + response.data.message, '错误', { type: 'error' });
} else {
funHandles.tackBtn(pageData); //验证码倒数60秒
}
//_this.loading = false;
}).catch(async error => {
console.log(error)
await ElMessageBox.alert(error.message, '错误', { type: 'error' });
})
} else {
console.log('未通过')
return;
}
});
},
tackBtn(pageData) { //验证码倒数60秒
let time = 60;
let timer = setInterval(() => {
if (time == 0) {
clearInterval(timer);
pageData.loginForm.valiBtn = '获取验证码';
pageData.loginForm.disabled = false;
} else {
pageData.loginForm.disabled = true;
pageData.loginForm.valiBtn = time + '秒后重试';
time--;
}
}, 1000);
},
verifyKey: async (pageData) => {
if (pageData.loginForm?.phone?.length != 11 || pageData.loginForm?.code?.length != 4) {
return;
}
try {
window.loadingInstance = ElLoading.service({ lock: true, text: '处理中' });
const response = await axios({
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
method: 'post',
url: `/gb/yjb/api/outsidewall/VerifyKey?key=${key?.value ?? ''}`,
url: `/gb/yjb/api/outsidewall/VerifyLogin`,
data: pageData.loginForm,
responseType: "json",
});
window.loadingInstance?.close();
if (response.data.data)
return key?.value;
if (response.data.data.passed == true) {
window.sessionStorage.setItem('__VerifyLogin', response.data.data.token);
await funHandles.getCommunitys("", pageData);
pageData.dialogLoginVisible = false
pageData.uploadaction = `/gb/yjb/api/outsidewall/sysFileInfo/upload?access_token=${window.sessionStorage.getItem('__VerifyLogin')}`
//return response.data.data;
}
else {
await ElMessageBox.alert("授权码错误,授权失败", '授权', { type: 'error' });
await ElMessageBox.alert("验证码错误或已失效,登录失败", '登录', { type: 'error' });
}
} catch (error) {
window.loadingInstance?.close();
console.log(error)
await ElMessageBox.alert(error.message, '异常', { type: 'error' });
window.location.reload();//刷新当前页面
//window.location.reload();//刷新当前页面
}
},
getCommunitys: async (queryString, data) => {
@@ -352,7 +452,7 @@
const response = await axios({
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
method: 'get',
url: `/gb/yjb/api/outsidewall/Communitys?searchkey=${queryString ?? ''}`,
url: `/gb/yjb/api/outsidewall/Communitys?access_token=${window.sessionStorage.getItem('__VerifyLogin')}&searchkey=${queryString ?? ''}`,
responseType: "json",
});
window.loadingInstance?.close();
@@ -361,7 +461,10 @@
} catch (error) {
window.loadingInstance?.close();
console.log(error)
ElMessageBox.alert(error.message, '异常', { type: 'error' });
if (error.response.status == 401)
ElMessageBox.alert("请先登录", '异常', { type: 'error' });
else
ElMessageBox.alert(error.message, '异常', { type: 'error' });
}
},
onChangeSelectCommunity: async (v, data) => {
@@ -446,7 +549,7 @@
if (data?.form?.isExistProblem == '0') { isAllChildValid = true; }
else {
//验证
var waitValid = data.form?.buildingsForm
var waitValid = data.form?.buildingsForm?.filter(a => a.building.curwallproblems.length > 0)
if (waitValid?.length > 0) {
for (let ii = 0; ii < waitValid.length; ii++) {
let _fe = waitValid[ii]?.formEl;
@@ -578,13 +681,13 @@
debugger
window.loadingInstance = ElLoading.service({ lock: true, text: '提交中...请稍候' });
try {
data.form.buildings = data.form.buildings.filter(a => a.curwallproblems?.length > 0)
data.form.buildings = data.form.buildings?.filter(a => a.curwallproblems?.length > 0)
const response = await axios({
headers: { 'Content-Type': 'multipart/form-data' },
method: 'post',
url: `/gb/yjb/api/outsidewall/submit?key=${data.key ?? ''}`,
url: `/gb/yjb/api/outsidewall/submit?access_token=${window.sessionStorage.getItem('__VerifyLogin')}`,
data: data.form,
responseType: "json",
responseType: "json"
});
window.loadingInstance?.close();
@@ -691,7 +794,9 @@
XEUtils,
formRef,
childFormRef,
loginFormRef,
rulesCheckData,
checkPhone,
pageData,
staticData,
funHandles

View File

@@ -30,7 +30,7 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="提交码:" prop="name">
<el-form-item label="手机号码:" prop="name">
<el-input v-model="form.submitCode" style="width:300px"></el-input>
</el-form-item>
<el-form-item>
@@ -139,7 +139,7 @@
</el-table>
</template>
</el-table-column>
<el-table-column label="提交码">
<el-table-column label="手机号码">
<template slot-scope="props">
{{ props.row.submitCode}}
</template>
@@ -259,12 +259,10 @@
},
methods: {
lookphoto(outside_wall_photos) {
debugger;
this.outside_wall_photos = outside_wall_photos
this.dialogTableVisible = true
},
handlePreview(src, srcs) {
debugger
this.loading = true;
console.log(src);
this.dialogImageUrl = src.preview;
@@ -340,7 +338,7 @@
axios({
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
method: 'get',
url: '/gb/yjb/api/outsidewall/Communitys?searchkey=' + queryString,
url: `/gb/yjb/api/outsidewall/Communitys?access_token=${window.sessionStorage.getItem('__TOKEN')}&searchkey=` + queryString,
responseType: "json",
}).then(async response => {
_this.communitys = response.data.data