|
|
|
@ -11,14 +11,17 @@ |
|
|
|
<van-form @submit="onSubmit"> |
|
|
|
<van-field v-model="loginParam.secretName" name="secretName" label="用户名" placeholder="用户名" |
|
|
|
:rules="[{ required: true, message: '请填写用户名' }]"/> |
|
|
|
<van-field v-model="loginParam.secretKey" type="password" name="secretKey" label="密码" placeholder="密码" |
|
|
|
<van-field v-model="loginParam.secretKey" type="password" name="secretKey" label="密码" |
|
|
|
placeholder="密码" |
|
|
|
:rules="[{ required: true, message: '请填写密码' }]"/> |
|
|
|
<div style="margin: 0.42rem"> |
|
|
|
<van-button block type="primary" native-type="submit">登录</van-button> |
|
|
|
</div> |
|
|
|
</van-form> |
|
|
|
<div style="margin: 0.42rem 0.42rem 0; text-align: center;"> |
|
|
|
<van-button plain type="default" size="small" @click="showTestPicker = true" style="background-color: darkred;color: white">选择测试用户</van-button> |
|
|
|
<van-button plain type="default" size="small" @click="showTestPicker = true" |
|
|
|
style="background-color: darkred;color: white">选择测试用户 |
|
|
|
</van-button> |
|
|
|
</div> |
|
|
|
<van-action-sheet v-model:show="showTestPicker" title="选择测试用户"> |
|
|
|
<div class="test-enterprise-list"> |
|
|
|
@ -36,163 +39,163 @@ |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
<script setup> |
|
|
|
import {reactive, ref} from 'vue'; |
|
|
|
import {enforcementLogin} from '../../api/enforcement'; |
|
|
|
import CryptoJS from "crypto-js"; |
|
|
|
import {showFailToast} from 'vant'; |
|
|
|
import 'vant/es/toast/style'; |
|
|
|
import {reactive, ref} from 'vue'; |
|
|
|
import {enforcementLogin} from '../../api/enforcement'; |
|
|
|
import CryptoJS from "crypto-js"; |
|
|
|
import {showFailToast} from 'vant'; |
|
|
|
import 'vant/es/toast/style'; |
|
|
|
|
|
|
|
const {useCommon} = $globalStore; |
|
|
|
const router = useRouter(); |
|
|
|
const loginParam = reactive({ |
|
|
|
secretName: "", |
|
|
|
secretKey: "" |
|
|
|
}) |
|
|
|
const {useCommon} = $globalStore; |
|
|
|
const router = useRouter(); |
|
|
|
const loginParam = reactive({ |
|
|
|
secretName: "", |
|
|
|
secretKey: "" |
|
|
|
}) |
|
|
|
|
|
|
|
const showTestPicker = ref(false); |
|
|
|
const testUsers = [ |
|
|
|
{ account: 'liuqianlin', name: '刘倩琳', password: 'szsf@zfjd' }, |
|
|
|
{ account: 'baining', name: '白宁', password: 'szsf@zfjd' }, |
|
|
|
{ account: 'caizifan', name: '蔡梓帆', password: 'szsf@zfjd' }, |
|
|
|
{ account: 'chenchong4', name: '陈冲', password: 'szsf@zfjd' }, |
|
|
|
{ account: 'chenggaozhan', name: '程高展', password: 'szsf@zfjd' }, |
|
|
|
{ account: 'chenhaitao2', name: '陈海涛', password: 'szsf@zfjd' }, |
|
|
|
{ account: 'chenhanyu', name: '陈汉羽', password: 'szsf@zfjd' } |
|
|
|
const showTestPicker = ref(false); |
|
|
|
const testUsers = [ |
|
|
|
{account: 'liuqianlin', name: '刘倩琳', password: 'szsf@zfjd'}, |
|
|
|
{account: 'baining', name: '白宁', password: 'szsf@zfjd'}, |
|
|
|
{account: 'caizifan', name: '蔡梓帆', password: 'szsf@zfjd'}, |
|
|
|
{account: 'chenchong4', name: '陈冲', password: 'szsf@zfjd'}, |
|
|
|
{account: 'chenggaozhan', name: '程高展', password: 'szsf@zfjd'}, |
|
|
|
{account: 'chenhaitao2', name: '陈海涛', password: 'szsf@zfjd'}, |
|
|
|
{account: 'chenhanyu', name: '陈汉羽', password: 'szsf@zfjd'} |
|
|
|
|
|
|
|
]; |
|
|
|
]; |
|
|
|
|
|
|
|
const selectTestUser = (item) => { |
|
|
|
loginParam.secretName = item.account; |
|
|
|
loginParam.secretKey = item.password; |
|
|
|
showTestPicker.value = false; |
|
|
|
// 直接触发登录 |
|
|
|
doLogin(item.account, item.password); |
|
|
|
} |
|
|
|
const doLogin = (secretName, secretKey) => { |
|
|
|
const encryptedKey = Encrypt(secretKey); |
|
|
|
enforcementLogin({code: '12346678985288799'}, response => { |
|
|
|
if (response.code === 200) { |
|
|
|
// // 验证关键组织信息 |
|
|
|
// if (!response.data.deptId) { |
|
|
|
// showFailToast("该用户未关联部门,无法登录"); |
|
|
|
// return; |
|
|
|
// } |
|
|
|
// if (!response.data.organId) { |
|
|
|
// showFailToast("该用户未关联认证机构,无法登录"); |
|
|
|
// return; |
|
|
|
// } |
|
|
|
// if (!response.data.bureauUnitId) { |
|
|
|
// showFailToast("该用户未关联执法单位,无法登录"); |
|
|
|
// return; |
|
|
|
// } |
|
|
|
// 执法端登录成功 → 赋值用户基本信息 |
|
|
|
useCommon.SET_USER_PHONENUMBER(response.data.phonenumber || ""); |
|
|
|
useCommon.SET_USER_ID(response.data.userId); |
|
|
|
useCommon.SET_USER_NAME(response.data.userName || ""); |
|
|
|
useCommon.SET_NICK_NAME(response.data.nickName || ""); |
|
|
|
useCommon.SET_TOKEN(response.data.token); |
|
|
|
useCommon.SET_DEPT_ID(response.data.deptId); |
|
|
|
useCommon.SET_DEPT_NAME(response.data.deptName || ""); |
|
|
|
useCommon.SET_ORGAN_ID(response.data.organId); |
|
|
|
useCommon.SET_ORGAN_NAME(response.data.organName || ""); |
|
|
|
useCommon.SET_BUREAU_UNIT_ID(response.data.bureauUnitId); |
|
|
|
useCommon.SET_BUREAU_UNIT_NAME(response.data.bureauUnitName || ""); |
|
|
|
console.log("enforcement login success", useCommon.userId); |
|
|
|
router.push({name: "enforcementHome"}); |
|
|
|
} else { |
|
|
|
showFailToast(response.msg || "登录失败"); |
|
|
|
const selectTestUser = (item) => { |
|
|
|
loginParam.secretName = item.account; |
|
|
|
loginParam.secretKey = item.password; |
|
|
|
showTestPicker.value = false; |
|
|
|
// 直接触发登录 |
|
|
|
doLogin(item.account, item.password); |
|
|
|
} |
|
|
|
// const doLogin = (secretName, secretKey) => { |
|
|
|
// const encryptedKey = Encrypt(secretKey); |
|
|
|
// enforcementLogin({code: '12346678985288799'}, response => { |
|
|
|
// if (response.code === 200) { |
|
|
|
// // // 验证关键组织信息 |
|
|
|
// // if (!response.data.deptId) { |
|
|
|
// // showFailToast("该用户未关联部门,无法登录"); |
|
|
|
// // return; |
|
|
|
// // } |
|
|
|
// // if (!response.data.organId) { |
|
|
|
// // showFailToast("该用户未关联认证机构,无法登录"); |
|
|
|
// // return; |
|
|
|
// // } |
|
|
|
// // if (!response.data.bureauUnitId) { |
|
|
|
// // showFailToast("该用户未关联执法单位,无法登录"); |
|
|
|
// // return; |
|
|
|
// // } |
|
|
|
// // 执法端登录成功 → 赋值用户基本信息 |
|
|
|
// useCommon.SET_USER_PHONENUMBER(response.data.phonenumber || ""); |
|
|
|
// useCommon.SET_USER_ID(response.data.userId); |
|
|
|
// useCommon.SET_USER_NAME(response.data.userName || ""); |
|
|
|
// useCommon.SET_NICK_NAME(response.data.nickName || ""); |
|
|
|
// useCommon.SET_TOKEN(response.data.token); |
|
|
|
// useCommon.SET_DEPT_ID(response.data.deptId); |
|
|
|
// useCommon.SET_DEPT_NAME(response.data.deptName || ""); |
|
|
|
// useCommon.SET_ORGAN_ID(response.data.organId); |
|
|
|
// useCommon.SET_ORGAN_NAME(response.data.organName || ""); |
|
|
|
// useCommon.SET_BUREAU_UNIT_ID(response.data.bureauUnitId); |
|
|
|
// useCommon.SET_BUREAU_UNIT_NAME(response.data.bureauUnitName || ""); |
|
|
|
// console.log("enforcement login success", useCommon.userId); |
|
|
|
// router.push({name: "enforcementHome"}); |
|
|
|
// } else { |
|
|
|
// showFailToast(response.msg || "登录失败"); |
|
|
|
// } |
|
|
|
// }, error => { |
|
|
|
// showFailToast(error?.msg || "登录失败,请检查网络"); |
|
|
|
// }) |
|
|
|
// }; |
|
|
|
const doLogin = (secretName, secretKey) => { |
|
|
|
const encryptedKey = Encrypt(secretKey); |
|
|
|
enforcementLogin({"secretName": secretName, "secretKey": encryptedKey}, response => { |
|
|
|
if (response.code === 200) { |
|
|
|
// 验证关键组织信息 |
|
|
|
if (!response.data.deptId) { |
|
|
|
showFailToast("该用户未关联部门,无法登录"); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (!response.data.organId) { |
|
|
|
showFailToast("该用户未关联认证机构,无法登录"); |
|
|
|
return; |
|
|
|
} |
|
|
|
}, error => { |
|
|
|
showFailToast(error?.msg || "登录失败,请检查网络"); |
|
|
|
}) |
|
|
|
}; |
|
|
|
// const doLogin = (secretName, secretKey) => { |
|
|
|
// const encryptedKey = Encrypt(secretKey); |
|
|
|
// enforcementLogin({"secretName": secretName, "secretKey": encryptedKey}, response => { |
|
|
|
// if (response.code === 200) { |
|
|
|
// // 验证关键组织信息 |
|
|
|
// if (!response.data.deptId) { |
|
|
|
// showFailToast("该用户未关联部门,无法登录"); |
|
|
|
// return; |
|
|
|
// } |
|
|
|
// if (!response.data.organId) { |
|
|
|
// showFailToast("该用户未关联认证机构,无法登录"); |
|
|
|
// return; |
|
|
|
// } |
|
|
|
// if (!response.data.bureauUnitId) { |
|
|
|
// showFailToast("该用户未关联执法单位,无法登录"); |
|
|
|
// return; |
|
|
|
// } |
|
|
|
// // 执法端登录成功 → 赋值用户基本信息 |
|
|
|
// useCommon.SET_USER_PHONENUMBER(response.data.phonenumber || ""); |
|
|
|
// useCommon.SET_USER_ID(response.data.userId); |
|
|
|
// useCommon.SET_USER_NAME(response.data.userName || ""); |
|
|
|
// useCommon.SET_NICK_NAME(response.data.nickName || ""); |
|
|
|
// useCommon.SET_TOKEN(response.data.token); |
|
|
|
// useCommon.SET_DEPT_ID(response.data.deptId); |
|
|
|
// useCommon.SET_DEPT_NAME(response.data.deptName || ""); |
|
|
|
// useCommon.SET_ORGAN_ID(response.data.organId); |
|
|
|
// useCommon.SET_ORGAN_NAME(response.data.organName || ""); |
|
|
|
// useCommon.SET_BUREAU_UNIT_ID(response.data.bureauUnitId); |
|
|
|
// useCommon.SET_BUREAU_UNIT_NAME(response.data.bureauUnitName || ""); |
|
|
|
// console.log("enforcement login success", useCommon.userId); |
|
|
|
// router.push({name: "enforcementHome"}); |
|
|
|
// } else { |
|
|
|
// showFailToast(response.msg || "登录失败"); |
|
|
|
// } |
|
|
|
// }, error => { |
|
|
|
// showFailToast(error?.msg || "登录失败,请检查网络"); |
|
|
|
// }) |
|
|
|
// }; |
|
|
|
if (!response.data.bureauUnitId) { |
|
|
|
showFailToast("该用户未关联执法单位,无法登录"); |
|
|
|
return; |
|
|
|
} |
|
|
|
// 执法端登录成功 → 赋值用户基本信息 |
|
|
|
useCommon.SET_USER_PHONENUMBER(response.data.phonenumber || ""); |
|
|
|
useCommon.SET_USER_ID(response.data.userId); |
|
|
|
useCommon.SET_USER_NAME(response.data.userName || ""); |
|
|
|
useCommon.SET_NICK_NAME(response.data.nickName || ""); |
|
|
|
useCommon.SET_TOKEN(response.data.token); |
|
|
|
useCommon.SET_DEPT_ID(response.data.deptId); |
|
|
|
useCommon.SET_DEPT_NAME(response.data.deptName || ""); |
|
|
|
useCommon.SET_ORGAN_ID(response.data.organId); |
|
|
|
useCommon.SET_ORGAN_NAME(response.data.organName || ""); |
|
|
|
useCommon.SET_BUREAU_UNIT_ID(response.data.bureauUnitId); |
|
|
|
useCommon.SET_BUREAU_UNIT_NAME(response.data.bureauUnitName || ""); |
|
|
|
console.log("enforcement login success", useCommon.userId); |
|
|
|
router.push({name: "enforcementHome"}); |
|
|
|
} else { |
|
|
|
showFailToast(response.msg || "登录失败"); |
|
|
|
} |
|
|
|
}, error => { |
|
|
|
showFailToast(error?.msg || "登录失败,请检查网络"); |
|
|
|
}) |
|
|
|
}; |
|
|
|
|
|
|
|
const onSubmit = async () => { |
|
|
|
doLogin(loginParam.secretName, loginParam.secretKey); |
|
|
|
}; |
|
|
|
const onSubmit = async () => { |
|
|
|
doLogin(loginParam.secretName, loginParam.secretKey); |
|
|
|
}; |
|
|
|
|
|
|
|
const Encrypt = (passWord) => { |
|
|
|
var keyStr = '1234567898745621'; |
|
|
|
var ivStr = keyStr; |
|
|
|
var key = CryptoJS.enc.Utf8.parse(keyStr); |
|
|
|
var iv = CryptoJS.enc.Utf8.parse(ivStr); |
|
|
|
var srcs = CryptoJS.enc.Utf8.parse(passWord); |
|
|
|
var encrypted = CryptoJS.AES.encrypt(srcs, key, { |
|
|
|
iv: iv, |
|
|
|
mode: CryptoJS.mode.CBC, |
|
|
|
padding: CryptoJS.pad.ZeroPadding |
|
|
|
}); |
|
|
|
return CryptoJS.enc.Base64.stringify(encrypted.ciphertext); |
|
|
|
} |
|
|
|
const Encrypt = (passWord) => { |
|
|
|
var keyStr = '1234567898745621'; |
|
|
|
var ivStr = keyStr; |
|
|
|
var key = CryptoJS.enc.Utf8.parse(keyStr); |
|
|
|
var iv = CryptoJS.enc.Utf8.parse(ivStr); |
|
|
|
var srcs = CryptoJS.enc.Utf8.parse(passWord); |
|
|
|
var encrypted = CryptoJS.AES.encrypt(srcs, key, { |
|
|
|
iv: iv, |
|
|
|
mode: CryptoJS.mode.CBC, |
|
|
|
padding: CryptoJS.pad.ZeroPadding |
|
|
|
}); |
|
|
|
return CryptoJS.enc.Base64.stringify(encrypted.ciphertext); |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
<style lang="less" scoped> |
|
|
|
.login-page { |
|
|
|
width: 100%; |
|
|
|
height: 100%; |
|
|
|
display: flex; |
|
|
|
overflow: hidden; |
|
|
|
background-image: url("~@/assets/images/login.jpg"); |
|
|
|
background-repeat: no-repeat; |
|
|
|
background-size: cover; |
|
|
|
opacity: 0.9; |
|
|
|
.login-page { |
|
|
|
width: 100%; |
|
|
|
height: 100%; |
|
|
|
display: flex; |
|
|
|
overflow: hidden; |
|
|
|
background-image: url("~@/assets/images/login.jpg"); |
|
|
|
background-repeat: no-repeat; |
|
|
|
background-size: cover; |
|
|
|
opacity: 0.9; |
|
|
|
|
|
|
|
.login-content { |
|
|
|
margin: auto; |
|
|
|
padding: 0.27rem 0.27rem 0.52rem 0.27rem; |
|
|
|
background-color: #fff; |
|
|
|
border-radius: 0.27rem; |
|
|
|
box-shadow: 0 0 0.27rem rgba(0, 0, 0, 0.2); |
|
|
|
opacity: 0.9; |
|
|
|
.login-content { |
|
|
|
margin: auto; |
|
|
|
padding: 0.27rem 0.27rem 0.52rem 0.27rem; |
|
|
|
background-color: #fff; |
|
|
|
border-radius: 0.27rem; |
|
|
|
box-shadow: 0 0 0.27rem rgba(0, 0, 0, 0.2); |
|
|
|
opacity: 0.9; |
|
|
|
|
|
|
|
.title { |
|
|
|
font-size: 0.52rem; |
|
|
|
font-weight: 600; |
|
|
|
} |
|
|
|
.title { |
|
|
|
font-size: 0.52rem; |
|
|
|
font-weight: 600; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.test-enterprise-list { |
|
|
|
max-height: 60vh; |
|
|
|
overflow-y: auto; |
|
|
|
padding: 0.2rem; |
|
|
|
} |
|
|
|
.test-enterprise-list { |
|
|
|
max-height: 60vh; |
|
|
|
overflow-y: auto; |
|
|
|
padding: 0.2rem; |
|
|
|
} |
|
|
|
</style> |
|
|
|
|