Commit 1d1f62dc authored by 周宏民's avatar 周宏民

fix: 修改新产品跳转可按site

parent 81b90a4e
Pipeline #86366 passed with stages
...@@ -9,7 +9,7 @@ import classNames from 'classnames'; ...@@ -9,7 +9,7 @@ import classNames from 'classnames';
import DataCarousel from '../DataCarousel'; import DataCarousel from '../DataCarousel';
import styles from './index.less'; import styles from './index.less';
const RightItem = props => { const RightItem = props => {
const { listData, handToPage, handToProduct } = props; const { listData, handToPage, handlePage, handToProduct } = props;
const toPage = row => { const toPage = row => {
if (row.site) { if (row.site) {
handToProduct(row); handToProduct(row);
......
...@@ -114,10 +114,9 @@ const Demonstration = props => { ...@@ -114,10 +114,9 @@ const Demonstration = props => {
loginAction && loginAction.getUserInfoAndConfig(failCallback, true, type); loginAction && loginAction.getUserInfoAndConfig(failCallback, true, type);
}; };
const updateConfig = (config, data) => { const updateConfig = (config, data) => {
// props.instance && props.instance.updateConfig(config);
props.updateConfig && props.updateConfig(config); props.updateConfig && props.updateConfig(config);
const newLoginAction = new LoginAction({ ...props, global: config }); const newLoginAction = new LoginAction({ ...props, global: config });
newLoginAction && newLoginAction.getUserInfoAndConfig(failCallback, true, data.industry); newLoginAction && newLoginAction.getUserInfoAndConfig(failCallback, true, data.industry, data.site);
}; };
// 新产品跳转 // 新产品跳转
...@@ -452,7 +451,12 @@ const Demonstration = props => { ...@@ -452,7 +451,12 @@ const Demonstration = props => {
<VideoItem ref={videoRef} selectKey={selectKey} setSelectKey={setSelectKey} /> <VideoItem ref={videoRef} selectKey={selectKey} setSelectKey={setSelectKey} />
</div> </div>
<div className={styles.row_r}> <div className={styles.row_r}>
<RightItem listData={productData} handToPage={handToPage} handToProduct={handToProduct} /> <RightItem
listData={productData}
handlePage={handlePage}
handToPage={handToPage}
handToProduct={handToProduct}
/>
</div> </div>
</div> </div>
<div className={classNames(styles.center_wrap, 'animate__fadeIn', 'animate__animated', 'duration-500ms')}> <div className={classNames(styles.center_wrap, 'animate__fadeIn', 'animate__animated', 'duration-500ms')}>
......
/* eslint-disable no-underscore-dangle */ /* eslint-disable no-underscore-dangle */
import 'kit_logger'; import 'kit_logger';
import { log, params } from '@wisdom-utils/utils/lib/helpers'; import { log, params, encipher } from '@wisdom-utils/utils/lib/helpers';
import { message } from 'antd'; import { message } from 'antd';
import { decode, encode } from 'js-base64'; import { decode, encode } from 'js-base64';
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
import { encipher } from '@wisdom-utils/utils/lib/helpers';
import { SlideVerify } from '@wisdom-utils/components'; import { SlideVerify } from '@wisdom-utils/components';
import { appService, noticeService } from '@/api'; import { appService, noticeService } from '@/api';
import { getUserInfo, getWebSiteConfig } from '@/api/service/base'; import { getUserInfo, getWebSiteConfig } from '@/api/service/base';
...@@ -31,10 +30,14 @@ class Login { ...@@ -31,10 +30,14 @@ class Login {
this.globalConfig = getGlobalConfig(); this.globalConfig = getGlobalConfig();
}; };
//单点登录_xule_20231214 // 单点登录_xule_20231214
let queryString = window.location.search.substring(1); const queryString = window.location.search.substring(1);
let params = queryString.split("&"); const params = queryString.split('&');
let paramsFind = params && params.find(function (a) { return a.split('=')[0] == 'uniwater_utoken' }); const paramsFind =
params &&
params.find(function(a) {
return a.split('=')[0] == 'uniwater_utoken';
});
this.uniwater_utoken = paramsFind?.split('=')[1] ?? ''; this.uniwater_utoken = paramsFind?.split('=')[1] ?? '';
if (this.uniwater_utoken) { if (this.uniwater_utoken) {
...@@ -52,9 +55,9 @@ class Login { ...@@ -52,9 +55,9 @@ class Login {
} }
} }
//单点登录接口_xule_20231214 // 单点登录接口_xule_20231214
getTokenForThird() { getTokenForThird() {
let self = this; const self = this;
appService appService
.HDAuthLogin({ .HDAuthLogin({
token: self.uniwater_utoken, token: self.uniwater_utoken,
...@@ -64,7 +67,7 @@ class Login { ...@@ -64,7 +67,7 @@ class Login {
if (res.success === 'OK') { if (res.success === 'OK') {
const tk = res.token; const tk = res.token;
self.globalConfig.token = tk; self.globalConfig.token = tk;
let param = { const param = {
subOID: 'subOID', subOID: 'subOID',
site: this.getLocalSiteBytoken(tk), site: this.getLocalSiteBytoken(tk),
ignoreSite: true, ignoreSite: true,
...@@ -119,7 +122,7 @@ class Login { ...@@ -119,7 +122,7 @@ class Login {
Logger.log('获取用户配置失败'); Logger.log('获取用户配置失败');
}); });
} }
}) });
} }
gzlogin(userPhone) { gzlogin(userPhone) {
...@@ -254,7 +257,7 @@ class Login { ...@@ -254,7 +257,7 @@ class Login {
this.globalConfig.token = token; this.globalConfig.token = token;
const self = this; const self = this;
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
let param = { const param = {
subOID: 'subOID', subOID: 'subOID',
site: noTokenSite ?? this.getLocalSiteBytoken(token), site: noTokenSite ?? this.getLocalSiteBytoken(token),
'request.preventCache': Date.now(), 'request.preventCache': Date.now(),
...@@ -309,7 +312,7 @@ class Login { ...@@ -309,7 +312,7 @@ class Login {
? this.globalConfig.userInfo.fullName ? this.globalConfig.userInfo.fullName
: '', : '',
}) })
.catch(error => { }); .catch(error => {});
} }
if (window.location.host === 'panda-water.com') { if (window.location.host === 'panda-water.com') {
...@@ -323,7 +326,7 @@ class Login { ...@@ -323,7 +326,7 @@ class Login {
? this.globalConfig.userInfo.fullName ? this.globalConfig.userInfo.fullName
: '', : '',
}) })
.catch(error => { }); .catch(error => {});
} }
} }
...@@ -431,7 +434,7 @@ class Login { ...@@ -431,7 +434,7 @@ class Login {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
// 获取网站配置的同时,预先获取到mqtt配置,注册进子应用 // 获取网站配置的同时,预先获取到mqtt配置,注册进子应用
// 兼容云平台子站不更新的情况 // 兼容云平台子站不更新的情况
let param = { const param = {
client: self.globalConfig.client, client: self.globalConfig.client,
'request.preventCache': Date.now(), 'request.preventCache': Date.now(),
}; };
...@@ -440,10 +443,7 @@ class Login { ...@@ -440,10 +443,7 @@ class Login {
} else { } else {
param.identity = token; param.identity = token;
} }
Promise.allSettled([ Promise.allSettled([noticeService.getMqttSiteCode({ 'request.preventCache': Date.now() }), getWebSiteConfig(param)])
noticeService.getMqttSiteCode({ 'request.preventCache': Date.now() }),
getWebSiteConfig(param),
])
.then(results => { .then(results => {
const promise = results[0]; const promise = results[0];
const site = results[1]; const site = results[1];
...@@ -495,7 +495,8 @@ class Login { ...@@ -495,7 +495,8 @@ class Login {
mqttConfig.mqtt_mess.TcpPort = DEFAULT_TCP_PORT; mqttConfig.mqtt_mess.TcpPort = DEFAULT_TCP_PORT;
mqttConfig.mqtt_IsSSL = `${mqttConfig.mqtt_mess.TcpIP}:${mqttConfig.mqtt_mess.TcpPort}`; mqttConfig.mqtt_IsSSL = `${mqttConfig.mqtt_mess.TcpIP}:${mqttConfig.mqtt_mess.TcpPort}`;
} }
mqttConfig.mqtt_iotIP = `${mqttConfig.mqtt_mess.TcpIP}:${mqttConfig.mqtt_mess.TcpPort ? mqttConfig.mqtt_mess.TcpPort : '443' mqttConfig.mqtt_iotIP = `${mqttConfig.mqtt_mess.TcpIP}:${
mqttConfig.mqtt_mess.TcpPort ? mqttConfig.mqtt_mess.TcpPort : '443'
}`; }`;
self.globalConfig = Object.assign(self.globalConfig, { self.globalConfig = Object.assign(self.globalConfig, {
...mqttConfig, ...mqttConfig,
...@@ -566,7 +567,7 @@ class Login { ...@@ -566,7 +567,7 @@ class Login {
self.updateConfig && self.updateConfig(self.globalConfig); self.updateConfig && self.updateConfig(self.globalConfig);
} }
self.getProjectItems().then((res) => { self.getProjectItems().then(res => {
window.subSysCfg = {}; window.subSysCfg = {};
self.globalConfig = Object.assign(self.globalConfig, { self.globalConfig = Object.assign(self.globalConfig, {
mapsettings: res, mapsettings: res,
...@@ -755,7 +756,7 @@ class Login { ...@@ -755,7 +756,7 @@ class Login {
}); });
} }
} }
this.globalConfig.mapsettings.initareasettings = {... this.globalConfig.mapsettings.areasettings} this.globalConfig.mapsettings.initareasettings = { ...this.globalConfig.mapsettings.areasettings };
if (layer.areaName) { if (layer.areaName) {
this.globalConfig.mapsettings.areasettings.areaName = layer.areaName; this.globalConfig.mapsettings.areasettings.areaName = layer.areaName;
} }
...@@ -887,7 +888,7 @@ class Login { ...@@ -887,7 +888,7 @@ class Login {
height: '400', height: '400',
}); });
const handleMessage = function (event) { const handleMessage = function(event) {
const { origin } = event; const { origin } = event;
// Logger.log('origin', event.origin); // Logger.log('origin', event.origin);
if (origin === 'https://login.dingtalk.com') { if (origin === 'https://login.dingtalk.com') {
...@@ -1005,7 +1006,7 @@ class Login { ...@@ -1005,7 +1006,7 @@ class Login {
const tk = response.token; const tk = response.token;
self.globalConfig.token = tk; self.globalConfig.token = tk;
// eslint-disable-next-line no-undef,no-debugger // eslint-disable-next-line no-undef,no-debugger
let param = { const param = {
subOID: 'subOID', subOID: 'subOID',
site: this.getLocalSiteBytoken(tk), site: this.getLocalSiteBytoken(tk),
ignoreSite: true, ignoreSite: true,
...@@ -1080,20 +1081,25 @@ class Login { ...@@ -1080,20 +1081,25 @@ class Login {
}); });
} }
getUserInfoAndConfig(failCallback, flag, industry) { getUserInfoAndConfig(failCallback, flag, industry, toSite) {
const { token: tk } = this.globalConfig; const { token: tk } = this.globalConfig;
const token = tk || Cookies.get('token'); const token = tk || Cookies.get('token');
const site = Cookies.get('site'); const site = Cookies.get('site');
const self = this; const self = this;
/* eslint-disable */ /* eslint-disable */
let _industrySite = null; let _industrySite = null;
if (industry) { if (industry) {
const userInfo = let userInfo =
self.globalConfig.userInfo && self.globalConfig.userInfo &&
self.globalConfig.userInfo.Groups && self.globalConfig.userInfo.Groups &&
self.globalConfig.userInfo.Groups instanceof Array self.globalConfig.userInfo.Groups instanceof Array
? self.globalConfig.userInfo.Groups.find(enter => enter.industry === industry) ? self.globalConfig.userInfo.Groups.find(enter => {
if(toSite){
return enter.site === toSite
}else{
return enter.industry === industry
}
})
: null; : null;
if (industry === '熊猫新产品' && site) { if (industry === '熊猫新产品' && site) {
......
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