|
@@ -317,7 +317,7 @@ let LoginState = false
|
|
|
U.MD.D.getuser = function () {
|
|
|
// $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/gif/longhuaBg.gif")'
|
|
|
var userInfo = US.userInfo;
|
|
|
- if (Object.keys(userInfo).length === 0 && !U.UF.C.queryString('code')) {
|
|
|
+ if (Object.keys(userInfo).length === 0 && !U.UF.C.queryString('code') && !U.UF.C.queryString('tycode')) {
|
|
|
var _cookie = U.UF.Cookie.get("cocorobo");
|
|
|
if (Object.keys(userInfo).length === 0 && _cookie) {
|
|
|
U.A.Request(US.Config.server + "getcookieuserid", [], function (res) {
|
|
@@ -473,6 +473,69 @@ U.MD.D.getuser = function () {
|
|
|
LoginState = false
|
|
|
console.log('error', error)
|
|
|
});
|
|
|
+ }else if(!LoginState &&Object.keys(userInfo).length === 0 && U.UF.C.queryString('tycode')){
|
|
|
+ if($("#U_MD_HomeC_Pop")[0]){
|
|
|
+ $("#U_MD_HomeC_Pop")[0].close()
|
|
|
+ }
|
|
|
+ LoginState = true
|
|
|
+ let url = "https://cloud.cocorobo.cn/api/getUserInfoByCode";
|
|
|
+ var myHeaders = new Headers();
|
|
|
+ myHeaders.append("Content-Type", "application/json");
|
|
|
+
|
|
|
+ var requestOptions = {
|
|
|
+ method: 'POST',
|
|
|
+ headers: myHeaders,
|
|
|
+ body: JSON.stringify({ code: U.UF.C.queryString('code') }),
|
|
|
+ redirect: 'follow'
|
|
|
+ };
|
|
|
+
|
|
|
+ fetch(url, requestOptions)
|
|
|
+ .then(response => response.text())
|
|
|
+ .then(result => {
|
|
|
+ // console.log(result)
|
|
|
+ let data = JSON.parse(result).data
|
|
|
+ // return
|
|
|
+ if(JSON.parse(result).code == 0){
|
|
|
+ U.A.Request(US.Config.pbl + "batchRegistrationSzdjg3", [data.nickName, data.userId+"@tianyuan.com", '', "e5cdf6b8-abdc-11ef-b887-005056b86db5", '', "", 1, data.userId,'',''], function (res) {
|
|
|
+ // console.log(res);
|
|
|
+ let loginData = JSON.stringify({
|
|
|
+ openid: data.userId,
|
|
|
+ edu: true
|
|
|
+ })
|
|
|
+ var requestOptionsLogin = {
|
|
|
+ method: 'POST',
|
|
|
+ headers: myHeaders,
|
|
|
+ body: loginData,
|
|
|
+ redirect: 'follow'
|
|
|
+ };
|
|
|
+
|
|
|
+ fetch("https://beta.api.cocorobo.cn/api/user", requestOptionsLogin)
|
|
|
+ .then(response => response.text())
|
|
|
+ .then(result => {
|
|
|
+ let a = JSON.parse(result)
|
|
|
+ if(a.length>0){
|
|
|
+ let userId = a[0][0].userid
|
|
|
+ US.userInfo.userid = userId
|
|
|
+ U.A.Request(US.Config.pbl + "selectUser?userid=" + userId, [], function (res) { //US.userInfo.userid
|
|
|
+ loginSet(res.value[0][0], res)
|
|
|
+ }, [], { "type": "GET", "withCredentials": true });
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ LoginState = false
|
|
|
+ console.log('error', error)
|
|
|
+ });
|
|
|
+
|
|
|
+ }, [], { "type": "POST", "withCredentials": true })
|
|
|
+ }else{
|
|
|
+ U.Alert("用户登录已失效,请重新获取登录信息!");
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ LoginState = false
|
|
|
+ console.log('error', error)
|
|
|
+ });
|
|
|
} else if(Object.keys(userInfo).length !== 0){
|
|
|
if(US.Config.type == '2'){
|
|
|
$("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/easyBg.png")'
|