|
@@ -11,7 +11,7 @@ const route = useRoute()
|
|
const store = userInfoStore()
|
|
const store = userInfoStore()
|
|
const CurrentRole = userCurrentRole()
|
|
const CurrentRole = userCurrentRole()
|
|
const name = ref('')
|
|
const name = ref('')
|
|
-const isShow = ref(false)
|
|
|
|
|
|
+const isShow = ref(true)
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
// 通过 grant_code 获取登录信息
|
|
// 通过 grant_code 获取登录信息
|
|
let isGrantCode = getUrlParam(window.parent.location.href, 'grant_code')
|
|
let isGrantCode = getUrlParam(window.parent.location.href, 'grant_code')
|
|
@@ -23,18 +23,21 @@ onMounted(() => {
|
|
}
|
|
}
|
|
axios.post('//cloud.cocorobo.cn/api/getAccessToken', JSON.stringify(params)).then(res => {
|
|
axios.post('//cloud.cocorobo.cn/api/getAccessToken', JSON.stringify(params)).then(res => {
|
|
// console.log(res)
|
|
// console.log(res)
|
|
- let accessTokenParams = {
|
|
|
|
- accessToken: res.data.data.accessToken
|
|
|
|
- }
|
|
|
|
- axios.post('//cloud.cocorobo.cn/api/getUserInfo', JSON.stringify(accessTokenParams)).then(r => {
|
|
|
|
- // console.log(r, r.data.code, r.data.data)
|
|
|
|
- if (r.data.code == 0) {
|
|
|
|
- // store.user = r.data.data
|
|
|
|
- name.value = r.data.data.userName
|
|
|
|
- userInfo(r.data.data)
|
|
|
|
- } else {
|
|
|
|
|
|
+ if (res.data.code == 0) {
|
|
|
|
+ let accessTokenParams = {
|
|
|
|
+ accessToken: res.data.data.accessToken
|
|
}
|
|
}
|
|
- })
|
|
|
|
|
|
+ axios.post('//cloud.cocorobo.cn/api/getUserInfo', JSON.stringify(accessTokenParams)).then(r => {
|
|
|
|
+ // console.log(r, r.data.code, r.data.data)
|
|
|
|
+ if (r.data.code == 0) {
|
|
|
|
+ // store.user = r.data.data
|
|
|
|
+ name.value = r.data.data.userName
|
|
|
|
+ userInfo(r.data.data)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ linkLogin()
|
|
|
|
+ }
|
|
})
|
|
})
|
|
} else {
|
|
} else {
|
|
linkLogin()
|
|
linkLogin()
|
|
@@ -60,10 +63,10 @@ const userInfo = (data) => {
|
|
// parentagency - 家长代办
|
|
// parentagency - 家长代办
|
|
|
|
|
|
let userIdentity = 1
|
|
let userIdentity = 1
|
|
- if (data.currentRole == "edupersonnel" ||data.currentRole == "areaAdministrator" || data.currentRole == "userAdministrator" || data.currentRole == "securityAuditor" || data.currentRole == "schoolAdministrator" || data.currentRole == "schoolSecurityAuditor" || data.currentRole == "teacher") {
|
|
|
|
|
|
+ if (data.currentRole == "edupersonnel" || data.currentRole == "areaAdministrator" || data.currentRole == "userAdministrator" || data.currentRole == "securityAuditor" || data.currentRole == "schoolAdministrator" || data.currentRole == "schoolSecurityAuditor" || data.currentRole == "teacher") {
|
|
isShow.value = true
|
|
isShow.value = true
|
|
CurrentRole.currentRole == data.currentRole
|
|
CurrentRole.currentRole == data.currentRole
|
|
- userIdentity = 0
|
|
|
|
|
|
+ userIdentity = 1
|
|
let userGrand = ""
|
|
let userGrand = ""
|
|
if (data.childList && data.childList.length > 0) {
|
|
if (data.childList && data.childList.length > 0) {
|
|
userGrand = data.childList[0].gradeName + data.childList[0].className
|
|
userGrand = data.childList[0].gradeName + data.childList[0].className
|
|
@@ -76,20 +79,14 @@ const userInfo = (data) => {
|
|
axios.defaults.withCredentials = true;
|
|
axios.defaults.withCredentials = true;
|
|
axios.post(`https://beta.api.cocorobo.cn/api/user`, qs.stringify(params)).then(res => {
|
|
axios.post(`https://beta.api.cocorobo.cn/api/user`, qs.stringify(params)).then(res => {
|
|
// console.log(res, '222222222222')
|
|
// console.log(res, '222222222222')
|
|
-
|
|
|
|
if (res.data && res.data[0][0].active == 1) {
|
|
if (res.data && res.data[0][0].active == 1) {
|
|
- let obj = res.data[0][0]
|
|
|
|
- obj.userName = name
|
|
|
|
- store.user = obj
|
|
|
|
|
|
+ store.user = US.userInfo
|
|
} else {
|
|
} else {
|
|
if (data.telephoneNumber) {
|
|
if (data.telephoneNumber) {
|
|
top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/batchRegistrationSzdjg", [data.userName, data.telephoneNumber + '@szdjg.com', '16ace517-b5c7-4168-a9bb-a9e0035df840', data.schoolName, data.telephoneNumber, userGrand, userIdentity, data.userId], function (r) {
|
|
top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/batchRegistrationSzdjg", [data.userName, data.telephoneNumber + '@szdjg.com', '16ace517-b5c7-4168-a9bb-a9e0035df840', data.schoolName, data.telephoneNumber, userGrand, userIdentity, data.userId], function (r) {
|
|
// console.log('rrrrr', r)
|
|
// console.log('rrrrr', r)
|
|
axios.post(`https://beta.api.cocorobo.cn/api/user`, qs.stringify(params)).then(d => {
|
|
axios.post(`https://beta.api.cocorobo.cn/api/user`, qs.stringify(params)).then(d => {
|
|
- let obj = d.data[0][0]
|
|
|
|
- obj.userName = name
|
|
|
|
- store.user = obj
|
|
|
|
-
|
|
|
|
|
|
+ store.user = US.userInfo
|
|
})
|
|
})
|
|
}, [], { "type": "POST", "withCredentials": true });
|
|
}, [], { "type": "POST", "withCredentials": true });
|
|
} else {
|
|
} else {
|
|
@@ -144,7 +141,7 @@ const getUrlParam = (urlStr, urlKey) => {
|
|
|
|
|
|
<template>
|
|
<template>
|
|
<!-- <keep-alive> -->
|
|
<!-- <keep-alive> -->
|
|
- <div v-if="isShow">
|
|
|
|
|
|
+ <div v-if="isShow" style="height: 100%;">
|
|
<router-view></router-view>
|
|
<router-view></router-view>
|
|
</div>
|
|
</div>
|
|
<!-- </keep-alive> -->
|
|
<!-- </keep-alive> -->
|