Commit cae67984 authored by 杨思琦's avatar 杨思琦

feat: 新增演示模式

parent 007d51ae
Pipeline #77202 passed with stages
...@@ -115,9 +115,9 @@ ...@@ -115,9 +115,9 @@
"@wisdom-map/arcgismap": "1.4.0-175", "@wisdom-map/arcgismap": "1.4.0-175",
"@wisdom-map/basemap": "1.1.0-27", "@wisdom-map/basemap": "1.1.0-27",
"@wisdom-map/util": "^1.0.28-0", "@wisdom-map/util": "^1.0.28-0",
"@wisdom-utils/components": "0.1.313", "@wisdom-utils/components": "0.1.314",
"@wisdom-utils/runtime": "0.0.46", "@wisdom-utils/runtime": "0.0.46",
"@wisdom-utils/utils": "0.1.353", "@wisdom-utils/utils": "0.1.354",
"animate.css": "^4.1.1", "animate.css": "^4.1.1",
"antd": "4.21.2", "antd": "4.21.2",
"compression": "1.7.4", "compression": "1.7.4",
......
import { jsonp, request } from '@wisdom-utils/utils'; import { jsonp, request } from '@wisdom-utils/utils';
import * as constants from '../../constants'; import * as constants from '../../constants';
/**
* 兼容老接口
*/
const transformGateWay = url => {
if (!/^(cityinterface|CityInterface|CityServer)/) {
return url.replace(/GeteWay/, '');
}
};
export const API = { export const API = {
AUTHORIZATION_TOKEN: '/PandaCore/Identity/AuthorizationToken', // 授权验证,不需要走网关加前缀 AUTHORIZATION_TOKEN: '/PandaCore/Identity/AuthorizationToken', // 授权验证,不需要走网关加前缀
...@@ -45,6 +37,8 @@ export const API = { ...@@ -45,6 +37,8 @@ export const API = {
GET_InOnLine: '/PandaEnergy/GZshuiwuju/GuangZhou/InOnLine', // 广州登陆接口 GET_InOnLine: '/PandaEnergy/GZshuiwuju/GuangZhou/InOnLine', // 广州登陆接口
GET_UserMobile: '/PandaEnergy/GZshuiwuju/SingleLogin/SingleLoginByAccess_token', // 获取登录手机号 GET_UserMobile: '/PandaEnergy/GZshuiwuju/SingleLogin/SingleLoginByAccess_token', // 获取登录手机号
GET_JIANGXI_MANAGE: '/PandaWorkFlow/WorkFlow/JiangXiManage/Login', // 江西登录接口 GET_JIANGXI_MANAGE: '/PandaWorkFlow/WorkFlow/JiangXiManage/Login', // 江西登录接口
GET_YANSHI_AUTHORITY: '/PandaCore/GCK/Demonstrate/GetYanshiAuthority', // 获取当前用户开始演示模式的所有菜单ID
IS_OPEN_YANSHI: '/PandaCore/GCK/Demonstrate/IsOpenYanshi', // 获取是否开启演示模式服务
}; };
const services = { const services = {
...@@ -88,19 +82,16 @@ const services = { ...@@ -88,19 +82,16 @@ const services = {
method: constants.REQUEST_METHOD_GET, method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP, type: constants.REQUEST_HTTP,
}, },
getWebSiteConfig: { getWebSiteConfig: {
url: API.GET_WEB_SITE_CONFIG, url: API.GET_WEB_SITE_CONFIG,
method: constants.REQUEST_METHOD_GET, method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP, type: constants.REQUEST_HTTP,
}, },
getUserInfo: { getUserInfo: {
url: API.GET_USER_INFO, url: API.GET_USER_INFO,
method: constants.REQUEST_METHOD_GET, method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP, type: constants.REQUEST_HTTP,
}, },
getOA: { getOA: {
url: API.GET_OA, url: API.GET_OA,
method: constants.REQUEST_METHOD_GET, method: constants.REQUEST_METHOD_GET,
...@@ -119,31 +110,26 @@ const services = { ...@@ -119,31 +110,26 @@ const services = {
method: constants.REQUEST_METHOD_POST, method: constants.REQUEST_METHOD_POST,
type: constants.REQUEST_HTTP, type: constants.REQUEST_HTTP,
}, },
getCity: { getCity: {
url: API.GET_CITY, url: API.GET_CITY,
method: constants.REQUEST_METHOD_GET, method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP, type: constants.REQUEST_HTTP,
}, },
generateTokenQuick: { generateTokenQuick: {
url: API.GENERATE_TOKEN_CHANGE, url: API.GENERATE_TOKEN_CHANGE,
method: constants.REQUEST_METHOD_GET, method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP, type: constants.REQUEST_HTTP,
}, },
getAllGroupsInfoForUser: { getAllGroupsInfoForUser: {
url: API.GET_ALL_GROUPS_INFO_FORUSER, url: API.GET_ALL_GROUPS_INFO_FORUSER,
method: constants.REQUEST_METHOD_GET, method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP, type: constants.REQUEST_HTTP,
}, },
getWeather: { getWeather: {
url: API.GET_WEATHER, url: API.GET_WEATHER,
method: constants.REQUEST_METHOD_GET, method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP, type: constants.REQUEST_HTTP,
}, },
sendMessVerificationCode: { sendMessVerificationCode: {
url: API.SEND_MESSAGE_CODE, url: API.SEND_MESSAGE_CODE,
method: constants.REQUEST_METHOD_GET, method: constants.REQUEST_METHOD_GET,
...@@ -205,6 +191,16 @@ const services = { ...@@ -205,6 +191,16 @@ const services = {
method: constants.REQUEST_METHOD_GET, method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP, type: constants.REQUEST_HTTP,
}, },
getYanshiAuthority: {
url: API.GET_YANSHI_AUTHORITY,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
isOpenYanshi: {
url: API.IS_OPEN_YANSHI,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
}; };
export const searchAutoCity = keywords => { export const searchAutoCity = keywords => {
......
...@@ -74,13 +74,8 @@ class Login { ...@@ -74,13 +74,8 @@ class Login {
gztransformLoginHander(response, isRememberPWD, pwd) { gztransformLoginHander(response, isRememberPWD, pwd) {
const self = this; const self = this;
const token = // eslint-disable-next-line prettier/prettier
response && const token = response && (response.token ? response.token : response.access_token !== null && response.user_token !== null ? response.user_token : '');
(response.token
? response.token
: response.access_token !== null && response.user_token !== null
? response.user_token
: '');
if (token) { if (token) {
const exp = 86400000; const exp = 86400000;
self.globalConfig.token = token; self.globalConfig.token = token;
...@@ -368,7 +363,9 @@ class Login { ...@@ -368,7 +363,9 @@ class Login {
const data = res.data[0]; const data = res.data[0];
mqttConfig.ipConfig = data; mqttConfig.ipConfig = data;
mqttConfig.mqtt_IsSSL = data.IsSSL ? data.IsSSL : false; mqttConfig.mqtt_IsSSL = data.IsSSL ? data.IsSSL : false;
mqttConfig.mqtt_mess.site_code = mqttConfig.mqtt_site_code = data.SiteCode || self.globalConfig.userInfo.site; // eslint-disable-next-line no-multi-assign
mqttConfig.mqtt_mess.site_code = mqttConfig.mqtt_site_code =
data.SiteCode || self.globalConfig.userInfo.site;
mqttConfig.mqtt_mess.TcpIP = data.TcpIP; mqttConfig.mqtt_mess.TcpIP = data.TcpIP;
// eslint-disable-next-line radix // eslint-disable-next-line radix
mqttConfig.mqtt_mess.TcpPort = data.TcpPort ? parseInt(data.TcpPort) : 8083; mqttConfig.mqtt_mess.TcpPort = data.TcpPort ? parseInt(data.TcpPort) : 8083;
...@@ -502,36 +499,12 @@ class Login { ...@@ -502,36 +499,12 @@ class Login {
} }
// if (mainConf.productType) // if (mainConf.productType)
// self.globalConfig.productType = mainConf.productType; // self.globalConfig.productType = mainConf.productType;
self.updateConfig && self.updateConfig(self.globalConfig);
} }
if (self.globalConfig.widgets.length === 0) { this.isOpenYanshi(self, getIndustry);
message.error({
duration: 3,
content: '当前账号未配置菜单',
});
self.events.emit('loginError', '当前账号未配置菜单');
self.handleLoginError();
return;
}
window.share.event = self.events;
self.callback && self.callback();
getIndustry ? self.events.emit('toggleIndustry') : self.events.emit('loginSuccess', self.history);
}); });
} else { } else {
// loginSuccess // loginSuccess
self.updateConfig && self.updateConfig(self.globalConfig); this.isOpenYanshi(self, getIndustry);
if (self.globalConfig.widgets.length === 0) {
message.error({
duration: 3,
content: '当前账号未配置菜单',
});
self.events.emit('loginError', '当前账号未配置菜单');
self.handleLoginError();
return;
}
getIndustry ? self.events.emit('toggleIndustry') : self.events.emit('loginSuccess', self.history);
window.share.event = self.events;
self.callback && self.callback();
} }
}); });
} else { } else {
...@@ -540,17 +513,57 @@ class Login { ...@@ -540,17 +513,57 @@ class Login {
} }
this.handleLoginError(); this.handleLoginError();
// Logger.log('获取网络配置失败'); // Logger.log('获取网络配置失败');
console.log('获取网络配置失败');
} }
}) })
.catch(error => { .catch(error => {
console.log(error);
// Logger.log(error); // Logger.log(error);
this.handleLoginError(); this.handleLoginError();
// Logger.log('获取网络配置失败'); // Logger.log('获取网络配置失败');
}); });
} }
isOpenYanshi(self, getIndustry) {
appService
.isOpenYanshi()
.then(res => {
if (res.data) {
appService
.getYanshiAuthority({ userId: self?.globalConfig?.userInfo?.OID })
.then(response => {
if (response.data && response.data.length > 0) {
const menu = response.data.map(item => `widget=${item}`);
self.globalConfig.mockMenu = menu;
}
self.getYanshiAuthority(self, getIndustry);
})
.catch(error => {
this.handleLoginError();
});
} else {
self.getYanshiAuthority(self, getIndustry);
}
})
.catch(error => {
self.getYanshiAuthority(self, getIndustry);
});
}
getYanshiAuthority(self, getIndustry) {
self.updateConfig && self.updateConfig(self.globalConfig);
if (self.globalConfig.widgets.length === 0) {
message.error({
duration: 3,
content: '当前账号未配置菜单',
});
self.events.emit('loginError', '当前账号未配置菜单');
self.handleLoginError();
return;
}
getIndustry ? self.events.emit('toggleIndustry') : self.events.emit('loginSuccess', self.history);
window.share.event = self.events;
self.callback && self.callback();
}
getProjectItems() { getProjectItems() {
let MAX_BOTTOM = 0; let MAX_BOTTOM = 0;
let isScale = false; let isScale = false;
...@@ -884,7 +897,6 @@ class Login { ...@@ -884,7 +897,6 @@ class Login {
} }
self.updateConfig && self.updateConfig(self.globalConfig); self.updateConfig && self.updateConfig(self.globalConfig);
} catch (error) { } catch (error) {
console.log(error);
message.error('登录失败'); message.error('登录失败');
if (self.goLogin()) { if (self.goLogin()) {
return false; return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment