|
|
@ -11,14 +11,17 @@ |
|
|
<van-form @submit="onSubmit"> |
|
|
<van-form @submit="onSubmit"> |
|
|
<van-field v-model="loginParam.secretName" name="secretName" label="用户名" placeholder="用户名" |
|
|
<van-field v-model="loginParam.secretName" name="secretName" label="用户名" placeholder="用户名" |
|
|
:rules="[{ required: true, message: '请填写用户名' }]"/> |
|
|
: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: '请填写密码' }]"/> |
|
|
:rules="[{ required: true, message: '请填写密码' }]"/> |
|
|
<div style="margin: 0.42rem"> |
|
|
<div style="margin: 0.42rem"> |
|
|
<van-button block type="primary" native-type="submit">登录</van-button> |
|
|
<van-button block type="primary" native-type="submit">登录</van-button> |
|
|
</div> |
|
|
</div> |
|
|
</van-form> |
|
|
</van-form> |
|
|
<div style="margin: 0.42rem 0.42rem 0; text-align: center;"> |
|
|
<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> |
|
|
</div> |
|
|
<van-action-sheet v-model:show="showTestPicker" title="选择测试用户"> |
|
|
<van-action-sheet v-model:show="showTestPicker" title="选择测试用户"> |
|
|
<div class="test-enterprise-list"> |
|
|
<div class="test-enterprise-list"> |
|
|
@ -68,61 +71,23 @@ |
|
|
// 直接触发登录 |
|
|
// 直接触发登录 |
|
|
doLogin(item.account, item.password); |
|
|
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 doLogin = (secretName, secretKey) => { |
|
|
// const encryptedKey = Encrypt(secretKey); |
|
|
// const encryptedKey = Encrypt(secretKey); |
|
|
// enforcementLogin({"secretName": secretName, "secretKey": encryptedKey}, response => { |
|
|
// enforcementLogin({code: '12346678985288799'}, response => { |
|
|
// if (response.code === 200) { |
|
|
// if (response.code === 200) { |
|
|
// // 验证关键组织信息 |
|
|
// // // 验证关键组织信息 |
|
|
// if (!response.data.deptId) { |
|
|
// // if (!response.data.deptId) { |
|
|
// showFailToast("该用户未关联部门,无法登录"); |
|
|
// // showFailToast("该用户未关联部门,无法登录"); |
|
|
// return; |
|
|
// // return; |
|
|
// } |
|
|
// // } |
|
|
// if (!response.data.organId) { |
|
|
// // if (!response.data.organId) { |
|
|
// showFailToast("该用户未关联认证机构,无法登录"); |
|
|
// // showFailToast("该用户未关联认证机构,无法登录"); |
|
|
// return; |
|
|
// // return; |
|
|
// } |
|
|
// // } |
|
|
// if (!response.data.bureauUnitId) { |
|
|
// // if (!response.data.bureauUnitId) { |
|
|
// showFailToast("该用户未关联执法单位,无法登录"); |
|
|
// // showFailToast("该用户未关联执法单位,无法登录"); |
|
|
// return; |
|
|
// // return; |
|
|
// } |
|
|
// // } |
|
|
// // 执法端登录成功 → 赋值用户基本信息 |
|
|
// // 执法端登录成功 → 赋值用户基本信息 |
|
|
// useCommon.SET_USER_PHONENUMBER(response.data.phonenumber || ""); |
|
|
// useCommon.SET_USER_PHONENUMBER(response.data.phonenumber || ""); |
|
|
// useCommon.SET_USER_ID(response.data.userId); |
|
|
// useCommon.SET_USER_ID(response.data.userId); |
|
|
@ -144,6 +109,44 @@ |
|
|
// showFailToast(error?.msg || "登录失败,请检查网络"); |
|
|
// 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 || "登录失败,请检查网络"); |
|
|
|
|
|
}) |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
const onSubmit = async () => { |
|
|
const onSubmit = async () => { |
|
|
doLogin(loginParam.secretName, loginParam.secretKey); |
|
|
doLogin(loginParam.secretName, loginParam.secretKey); |
|
|
|