|
@@ -12,6 +12,8 @@ const store = userInfoStore()
|
|
const CurrentRole = userCurrentRole()
|
|
const CurrentRole = userCurrentRole()
|
|
const name = ref('')
|
|
const name = ref('')
|
|
const isShow = ref(true)
|
|
const isShow = ref(true)
|
|
|
|
+const setTimeState = ref(null)
|
|
|
|
+
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
// 通过 grant_code 获取登录信息
|
|
// 通过 grant_code 获取登录信息
|
|
let isGrantCode = getUrlParam(window.parent.location.href, 'grant_code')
|
|
let isGrantCode = getUrlParam(window.parent.location.href, 'grant_code')
|
|
@@ -80,14 +82,14 @@ const userInfo = (data) => {
|
|
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) {
|
|
- console.log(top)
|
|
|
|
- store.user = top.US.userInfo
|
|
|
|
|
|
+ setStateUserinfo()
|
|
} 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 => {
|
|
- store.user = top.US.userInfo
|
|
|
|
|
|
+ // store.user = top.US.userInfo
|
|
|
|
+ setStateUserinfo()
|
|
})
|
|
})
|
|
}, [], { "type": "POST", "withCredentials": true });
|
|
}, [], { "type": "POST", "withCredentials": true });
|
|
} else {
|
|
} else {
|
|
@@ -101,7 +103,10 @@ const userInfo = (data) => {
|
|
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 => {
|
|
- store.user = top.US.userInfo
|
|
|
|
|
|
+ // store.user = top.US.userInfo
|
|
|
|
+ if (d.data && d.data[0][0].active == 1) {
|
|
|
|
+ setStateUserinfo()
|
|
|
|
+ }
|
|
})
|
|
})
|
|
}, [], { "type": "POST", "withCredentials": true });
|
|
}, [], { "type": "POST", "withCredentials": true });
|
|
} else {
|
|
} else {
|
|
@@ -122,6 +127,19 @@ const userInfo = (data) => {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+const setStateUserinfo = () => {
|
|
|
|
+ // setTimeState
|
|
|
|
+ setTimeState.value = setInterval(() => {
|
|
|
|
+ if (JSON.stringify(top.US.userInfo) != '{}') {
|
|
|
|
+ store.user = top.US.userInfo
|
|
|
|
+ }else{
|
|
|
|
+ clearInterval(setTimeState.value)
|
|
|
|
+ }
|
|
|
|
+ }, 1000)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
const getUrlParam = (urlStr, urlKey) => {
|
|
const getUrlParam = (urlStr, urlKey) => {
|
|
const url = new URL(urlStr) // 字符串转换成url格式
|
|
const url = new URL(urlStr) // 字符串转换成url格式
|
|
const paramsStr = url.search.slice(1) // 获取'?'后面的参数字符串
|
|
const paramsStr = url.search.slice(1) // 获取'?'后面的参数字符串
|