From 1def88b5625d3c4f571742283e9a75b1e929199e Mon Sep 17 00:00:00 2001 From: yangyin <18723093654@163.com> Date: 星期五, 06 十二月 2024 14:02:30 +0800 Subject: [PATCH] Merge branch 'test' of http://47.103.154.90:83/r/WI/Web.V1.0 into test --- customer_list/ch/static/config/globalConfig.pro.js | 5 ++ customer_list/ch/static/config/globalConfig.test.js | 4 + customer_list/ch/share/index.html | 91 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 98 insertions(+), 2 deletions(-) diff --git a/customer_list/ch/share/index.html b/customer_list/ch/share/index.html new file mode 100644 index 0000000..ba7f18c --- /dev/null +++ b/customer_list/ch/share/index.html @@ -0,0 +1,91 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="UTF-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <title>share</title> + </head> + <style> + body, + html { + margin: 0; + height: 100%; + } + html { + overflow-y: hidden; + } + </style> + <script src="../static/config/globalConfig.js"></script> + <script> + function isMobile() { + const userAgentInfo = navigator.userAgent; + const mobileAgents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod']; + const mobileFlag = mobileAgents.some((mobileAgent) => { + return userAgentInfo.indexOf(mobileAgent) > 0; + }); + + return mobileFlag; + } + + const isTest = window.globalConfig.Mode === 'test'; + + const getSearchParams = (url) => { + // 鑾峰彇鏌ヨ鍙傛暟鍓嶇殑 ? 瀵瑰簲鐨勭储寮曚綅缃� + const searchIndex = url.indexOf('?'); + // 鎴彇鍑烘煡璇㈠弬鏁板瓧绗︿覆锛屽苟鏍规嵁 & 灏嗗叾鍒嗗壊鎴愪竴涓釜 name=bruce 褰㈠紡瀛楃涓茬粍鎴愮殑鏁扮粍 + const searchParamsArray = url.slice(searchIndex + 1).split('&'); + // 閬嶅巻鏁扮粍锛岀粍鎴愭煡璇㈠弬鏁板璞� + return searchParamsArray.reduce((pre, cur) => { + const [key, value] = cur.split('='); + return { + ...pre, + // 闇�瑕佷娇鐢� decodeURIComponent 瀵瑰弬鏁拌繘琛岃В鐮� + [key]: decodeURIComponent(value), + }; + }, {}); + }; + + /** + * + * @param {*} func 闃叉姈鍑芥暟 + * @param {*} wait 绛夊緟鏃堕暱锛堟绉掞級 + * @param {*} immediate 鏄惁鍏堢珛鍗宠Е鍙戜竴娆� + * @description 浣跨敤鏂规硶瑙亄@link https://mp.weixin.qq.com/s/vfnqmE1EG8UCedduDJE7Eg} + * 瑙﹀彂浜嗕簨浠朵細鍦╪姣鍚庢墽琛岋紝浣嗘槸濡傛灉鍦ㄨ繖n姣鍐呭張鍘昏Е鍙戯紝璁℃椂鍣ㄥ張浼氶噸鏂拌绠梟姣锛岀瓑n姣鍚庤Е鍙� + * + * 浜嬩欢浼氱疆鍚庤Е鍙戯紝鏂版潵鐨勪簨浠朵細瑕嗙洊涔嬪墠鐨勪簨浠� + * @returns + */ + const debounce = (func, wait = 300, immediate = false) => { + if (!func) return undefined; + let timer = null; + return function (...arg) { + if (timer !== null) { + clearTimeout(timer); + } else if (immediate) { + func.apply(this, arg); + } + timer = setTimeout(() => { + func.apply(this, arg); + timer = null; + }, wait); + }; + }; + + const urlParams = getSearchParams(window.location.search); + const id = urlParams.id; + + let pcShareUrl; + let mobileShareUrl; + + if (isTest) { + pcShareUrl = `https://wi.beng35.com/web/test/#/share?id=${id}`; + mobileShareUrl = `https://wi.beng35.com/mobile/test/#/share?id=${id}`; + } else { + pcShareUrl = `https://wi.beng35.com/#/share?id=${id}`; + mobileShareUrl = `https://wi.beng35.com/mobile/prod/#/share?id=${id}`; + } + window.location.href = isMobile() ? mobileShareUrl : pcShareUrl; + </script> + <body></body> +</html> diff --git a/customer_list/ch/static/config/globalConfig.pro.js b/customer_list/ch/static/config/globalConfig.pro.js index f5fecfd..598d79a 100644 --- a/customer_list/ch/static/config/globalConfig.pro.js +++ b/customer_list/ch/static/config/globalConfig.pro.js @@ -1,3 +1,5 @@ +const origin = window.location.origin; +const pathname = window.location.pathname; window.globalConfig = { // 椤圭洰鍚嶇О Name: 'WI姘村姟鏅鸿兘', @@ -9,7 +11,8 @@ WebApiUrl: { MainUrl: 'https://wi.cpolar.top', AuthUrl: 'http://47.100.245.85:8190/', - ShareUrl:'http://101.133.133.173:8084/share', + // 鍒嗕韩閾炬帴 + ShareUrl: `${origin}${pathname}share/`, }, SoftWareInfo: { // 缃戠珯涓绘爣棰橈紙鑿滃崟瀵艰埅銆佹祻瑙堝櫒褰撳墠缃戦〉鏍囬锛� diff --git a/customer_list/ch/static/config/globalConfig.test.js b/customer_list/ch/static/config/globalConfig.test.js index 50f638e..124ab09 100644 --- a/customer_list/ch/static/config/globalConfig.test.js +++ b/customer_list/ch/static/config/globalConfig.test.js @@ -1,3 +1,5 @@ +const origin = window.location.origin; +const pathname = window.location.pathname; window.globalConfig = { // 椤圭洰鍚嶇О Name: 'WI姘村姟鏅鸿兘', @@ -10,7 +12,7 @@ MainUrl: 'https://widev.cpolar.top/ai_dev/', AuthUrl: 'http://47.100.245.85:8190/', // 鍒嗕韩閾炬帴 - ShareUrl:'http://101.133.133.173:8084/sharedev', + ShareUrl: `${origin}${pathname}share/`, PhoneUrl:'https://wi.beng35.com/mobile/prod' }, SoftWareInfo: { -- Gitblit v1.9.3