|
@@ -37,7 +37,7 @@
|
|
|
</div> -->
|
|
|
</div>
|
|
|
<!-- <div id="login_container" style="transform: scale(.8);">123456</div> -->
|
|
|
- <bind :callbackStatus=callbackStatus v-if="callbackStatus.state ===200" ref="comRef"></bind>
|
|
|
+ <bind :callbackStatus=callbackStatus v-if="callbackStatus.state ===201" ref="comRef"></bind>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
@@ -84,6 +84,7 @@ export default {
|
|
|
}
|
|
|
var types = navigator.language
|
|
|
localStorage.setItem('language', JSON.stringify(types))
|
|
|
+ localStorage.setItem('Host', JSON.stringify(window.location.host))
|
|
|
})
|
|
|
//处理登录icon变化
|
|
|
watch(loginModel, () => {
|
|
@@ -105,61 +106,80 @@ export default {
|
|
|
callbackStatus.value.state = res.state
|
|
|
callbackStatus.value.partitionKey = res.ddUserId.partitionKey
|
|
|
callbackStatus.value.rowKey = res.ddUserId.rowKey
|
|
|
- res.state === 200 ? (store.commit('BindStatus', true), loading.close(), (callbackStatus.value.phoneNum = res.ddUserId.mobile)) : res.state === 0 ? ElMessage.error(res.message) : ''
|
|
|
+ res.state === 201
|
|
|
+ ? (store.commit('BindStatus', true), loading.close(), (callbackStatus.value.phoneNum = res.ddUserId.mobile))
|
|
|
+ : res.state === 200
|
|
|
+ ? (loading.close(), getOrganization(), Allpermission(), ElMessage.success('登录成功'), router.push({ path: '/dashboard' }))
|
|
|
+ : (loading.close(), ElMessage.error(res.message))
|
|
|
})
|
|
|
}
|
|
|
return {
|
|
|
editState,
|
|
|
}
|
|
|
}
|
|
|
- //钉钉账号或扫码登录
|
|
|
- function userlogin(proxy) {
|
|
|
- loading = ElLoading.service({
|
|
|
- lock: true,
|
|
|
- text: 'Loading',
|
|
|
- background: 'rgba(0, 0, 0, 0.7)',
|
|
|
+ //获取组织架构
|
|
|
+ function getOrganization() {
|
|
|
+ console.log(proxy, '检查proxy')
|
|
|
+ proxy.$api.getorganization().then((res) => {
|
|
|
+ console.log(res, '组织架构返回的内容')
|
|
|
+ res.state === 200 ? (store.commit('ChangOrganization', res.deptlist), localStorage.setItem('organization', JSON.stringify(res.deptlist))) : ''
|
|
|
})
|
|
|
- let nonceNum = Math.floor(Math.random() * 10000)
|
|
|
- console.log(nonceNum, '随机数')
|
|
|
- let params = {
|
|
|
- grant_type: 'account',
|
|
|
- client_id: 'c7317f88-7cea-4e48-ac57-a16071f7b884',
|
|
|
- nonce: 'habook',
|
|
|
- account: user.value,
|
|
|
- password: pwd.value,
|
|
|
- }
|
|
|
- // proxy.$api.loginUser(params).then(async (res) => {
|
|
|
- // console.log(res, '登录接口返回成功!')
|
|
|
- // res.error
|
|
|
- // ? (ElMessage.error('密码错误'), loading.close())
|
|
|
- // : res.id_token
|
|
|
- // ? (getTeachinfo(proxy, res.id_token), Allpermission(proxy), getOrganization(proxy))
|
|
|
- // : (loading.close(), ElMessage.error('登录失败'))
|
|
|
- // // router.push("/home");
|
|
|
- // })
|
|
|
}
|
|
|
- //获取教师个人信息
|
|
|
- function getTeachinfo(proxy, param) {
|
|
|
- let parameter = { id_token: param }
|
|
|
- proxy.$api.teacherinfo(parameter).then((res) => {
|
|
|
- if (res.state === 1) {
|
|
|
- ElMessage.warning('该账户未绑定钉钉信息!请扫码绑定信息!')
|
|
|
- loginModel.value = false
|
|
|
- } else {
|
|
|
- localStorage.setItem('userData', JSON.stringify(res))
|
|
|
- console.log(res, '教室个人信息')
|
|
|
- let jwt_authtoken = {
|
|
|
- jwt_user: jwt_decode(res.auth_token),
|
|
|
- }
|
|
|
- res = Object.assign(res, jwt_authtoken)
|
|
|
- res.state === 200 ? store.commit('getTeachdata', res) : []
|
|
|
- loading.close()
|
|
|
- ElMessage.success('登录成功')
|
|
|
- store.commit('getBlobsas', { host: res.osblob_uri, sas: res.osblob_sas })
|
|
|
- // router.push('/home')
|
|
|
- }
|
|
|
+ //获取所有权限表
|
|
|
+ function Allpermission() {
|
|
|
+ proxy.$api.getAllpermission().then((res) => {
|
|
|
+ console.log(res, '权限列表')
|
|
|
+ res.authorityBIList ? (store.commit('getPermission', res.authorityBIList), localStorage.setItem('management', JSON.stringify(res.authorityBIList))) : []
|
|
|
})
|
|
|
}
|
|
|
+ // //钉钉账号或扫码登录
|
|
|
+ // function userlogin(proxy) {
|
|
|
+ // loading = ElLoading.service({
|
|
|
+ // lock: true,
|
|
|
+ // text: 'Loading',
|
|
|
+ // background: 'rgba(0, 0, 0, 0.7)',
|
|
|
+ // })
|
|
|
+ // let nonceNum = Math.floor(Math.random() * 10000)
|
|
|
+ // console.log(nonceNum, '随机数')
|
|
|
+ // let params = {
|
|
|
+ // grant_type: 'account',
|
|
|
+ // client_id: 'c7317f88-7cea-4e48-ac57-a16071f7b884',
|
|
|
+ // nonce: 'habook',
|
|
|
+ // account: user.value,
|
|
|
+ // password: pwd.value,
|
|
|
+ // }
|
|
|
+ // // proxy.$api.loginUser(params).then(async (res) => {
|
|
|
+ // // console.log(res, '登录接口返回成功!')
|
|
|
+ // // res.error
|
|
|
+ // // ? (ElMessage.error('密码错误'), loading.close())
|
|
|
+ // // : res.id_token
|
|
|
+ // // ? (getTeachinfo(proxy, res.id_token), Allpermission(proxy), getOrganization(proxy))
|
|
|
+ // // : (loading.close(), ElMessage.error('登录失败'))
|
|
|
+ // // // router.push("/home");
|
|
|
+ // // })
|
|
|
+ // }
|
|
|
+ // //获取教师个人信息
|
|
|
+ // function getTeachinfo(proxy, param) {
|
|
|
+ // let parameter = { id_token: param }
|
|
|
+ // proxy.$api.teacherinfo(parameter).then((res) => {
|
|
|
+ // if (res.state === 1) {
|
|
|
+ // ElMessage.warning('该账户未绑定钉钉信息!请扫码绑定信息!')
|
|
|
+ // loginModel.value = false
|
|
|
+ // } else {
|
|
|
+ // localStorage.setItem('userData', JSON.stringify(res))
|
|
|
+ // console.log(res, '教室个人信息')
|
|
|
+ // let jwt_authtoken = {
|
|
|
+ // jwt_user: jwt_decode(res.auth_token),
|
|
|
+ // }
|
|
|
+ // res = Object.assign(res, jwt_authtoken)
|
|
|
+ // res.state === 200 ? store.commit('getTeachdata', res) : []
|
|
|
+ // loading.close()
|
|
|
+ // ElMessage.success('登录成功')
|
|
|
+ // store.commit('getBlobsas', { host: res.osblob_uri, sas: res.osblob_sas })
|
|
|
+ // // router.push('/home')
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // }
|
|
|
return {
|
|
|
comRef,
|
|
|
store,
|
|
@@ -171,11 +191,11 @@ export default {
|
|
|
userCode,
|
|
|
editState,
|
|
|
callbackStatus,
|
|
|
- userlogin,
|
|
|
router,
|
|
|
- getTeachinfo,
|
|
|
loading,
|
|
|
msgText,
|
|
|
+ getOrganization,
|
|
|
+ Allpermission,
|
|
|
}
|
|
|
},
|
|
|
}
|