fix: 去除多余代码
This commit is contained in:
parent
0e22a725fc
commit
10748f97f1
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,5 +1,4 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
.upchina
|
|
||||||
node_modules
|
node_modules
|
||||||
/dist
|
/dist
|
||||||
/build
|
/build
|
||||||
|
|||||||
@ -10,7 +10,6 @@
|
|||||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico" />
|
<link rel="icon" href="<%= BASE_URL %>favicon.ico" />
|
||||||
<script src="<%= BASE_URL %>static/js/config.js"></script>
|
<script src="<%= BASE_URL %>static/js/config.js"></script>
|
||||||
<script src="<%= BASE_URL %>static/js/jquery.min.js"></script>
|
<script src="<%= BASE_URL %>static/js/jquery.min.js"></script>
|
||||||
<script src="<%= BASE_URL %>static/js/up_share.min.js"></script>
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
@media screen and (min-width: 480px) {
|
@media screen and (min-width: 480px) {
|
||||||
html {
|
html {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
window.config = {
|
window.config = {
|
||||||
wxAuthUrl: "https://clogin.test.upchina.com/wx_auth?callback=",
|
wxAuthUrl: "",
|
||||||
webAuthUrl: "https://clogin.test.upchina.com/new",
|
webAuthUrl: "",
|
||||||
VConsole: true,
|
VConsole: true,
|
||||||
userIdList: [],
|
userIdList: [],
|
||||||
shareEnv: "production",
|
shareEnv: "production",
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
!function(n){function e(n,e){var a="UPEvent."+n;t.exec(a,e)}var t={},a={},o=(new Date).getTime();t.exec=function(n,e){e=e||{};var t=++o;e.callbackId=t,a[t]=e.callback||function(n,e){},delete e.callback;var i='up://["'+n+'",'+JSON.stringify(e)+"]";prompt("TITLE",i)},n.nativeCallback=function(n,e,t){a[n]&&(a[n](e,t,JSON.parse(t)),delete a[n])},n.gCreateEvent=function(n,e){var t=document.createEvent("Events");if(t.initEvent(n,!1,!1),e)for(var a in e)e.hasOwnProperty(a)&&(t[a]=e[a]);return t};var i=function(n){this.type=n,this.handleMap={},this.count=0,this.onHandleCountChange=null};n.gEventHandleMap={create:function(n){return gEventHandleMap[n]=new i(n)},count:0},i.prototype.addEvent=function(n){var e=n.upEventFlag;e||(e=gEventHandleMap.count++,n.upEventFlag=e),this.handleMap[e]||(this.handleMap[e]=n,1==++this.count&&this.onHandleCountChange&&this.onHandleCountChange())},i.prototype.removeEvent=function(n){var e=n.upEventFlag;this.handleMap[e]&&(delete this.handleMap[e],0==--this.count&&this.onHandleCountChange&&this.onHandleCountChange())},i.prototype.fire=function(n){if(this.count){var e=[],t=0,a=Object.keys(this.handleMap);for(t=0;t<a.length;t++)e.push(this.handleMap[a[t]]);for(t=0;t<e.length;t++)e[t](n)}},t.addEventListener=function(n,t){var a=gEventHandleMap[n];a||(a=gEventHandleMap.create(n),a.onHandleCountChange=function(){e(n,{count:this.count})}),a.addEvent(t)},t.removeEventListener=function(n,e){var t=gEventHandleMap[n];t&&t.removeEvent(e)},n.nativeFireEvent=function(e,t){var a=gEventHandleMap[e];if(a){var o=n.gCreateEvent(e,JSON.parse(t));a.fire(o)}},n.upNativeComm=t}(window);
|
|
||||||
32
public/static/js/up_share.min.js
vendored
32
public/static/js/up_share.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,151 +0,0 @@
|
|||||||
const upNativeComm = {};
|
|
||||||
const cmdQueue = {};
|
|
||||||
const SCHEME = "up";
|
|
||||||
|
|
||||||
let count = new Date().getTime();
|
|
||||||
|
|
||||||
upNativeComm.exec = function exec(cmd, option) {
|
|
||||||
option = option || {};
|
|
||||||
count += 1;
|
|
||||||
const callbackId = count;
|
|
||||||
option.callbackId = callbackId;
|
|
||||||
cmdQueue[callbackId] = option.callback || function callback() {};
|
|
||||||
delete option.callback;
|
|
||||||
const url = `${SCHEME}://["${cmd}",${callbackId},${JSON.stringify(option)}]`;
|
|
||||||
prompt("TITLE", url);
|
|
||||||
};
|
|
||||||
|
|
||||||
window.nativeCallback = function nativeCallback(callbackId, code, option) {
|
|
||||||
if (cmdQueue[callbackId]) {
|
|
||||||
cmdQueue[callbackId](code, option);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// /////////////////////////////////// 浜嬩欢鏈哄埗 ///////////////////////////////////
|
|
||||||
|
|
||||||
// 閫氱煡瀹㈡埛绔簨浠朵俊鎭<E4BF8A>
|
|
||||||
function notifyEvent(option) {
|
|
||||||
const cmd = "up.event";
|
|
||||||
upNativeComm.exec(cmd, option);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 鍒涘缓鍘熺敓鐨別vent瀵硅薄(鍏ㄥ眬鍑芥暟)
|
|
||||||
* @param type 绫诲瀷
|
|
||||||
* @param data 鏁版嵁
|
|
||||||
* @returns {Event}
|
|
||||||
*/
|
|
||||||
window.gCreateEvent = function gCreateEvent(type, data) {
|
|
||||||
const event = document.createEvent("Events");
|
|
||||||
event.initEvent(type, false, false);
|
|
||||||
if (data) {
|
|
||||||
for (const i in data) {
|
|
||||||
if (Object.prototype.hasOwnProperty.call(data, i)) {
|
|
||||||
event[i] = data[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return event;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 涓€涓被鍨嬩簨浠跺搴斾竴涓狤ventMeta瀹炰緥
|
|
||||||
const EventMeta = function EventMeta(type) {
|
|
||||||
this.type = type;
|
|
||||||
this.handleMap = {}; // 澶勭悊鍑芥暟Map
|
|
||||||
this.count = 0;
|
|
||||||
this.onHandleCountChange = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 鍏ㄥ眬鍑芥暟
|
|
||||||
window.gEventHandleMap = {
|
|
||||||
create(type) {
|
|
||||||
window.gEventHandleMap[type] = new EventMeta(type);
|
|
||||||
return window.gEventHandleMap[type];
|
|
||||||
},
|
|
||||||
count: 0, // 鍙ユ焺鏍囪瘑
|
|
||||||
};
|
|
||||||
|
|
||||||
EventMeta.prototype.addEvent = function addEvent(handle) {
|
|
||||||
let flag = handle.upEventFlag;
|
|
||||||
if (!flag) {
|
|
||||||
window.gEventHandleMap.count += 1;
|
|
||||||
flag = window.gEventHandleMap.count;
|
|
||||||
handle.upEventFlag = flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 鍚屼竴涓被鍨嬩簨浠剁粦瀹氬涓浉鍚岀殑澶勭悊鍑芥暟锛屽彧鎵ц涓€娆★紝鑻ユ兂鎵ц澶氭锛屽繀椤婚噰鐢ㄥ尶鍚嶇殑鏂瑰紡
|
|
||||||
if (!this.handleMap[flag]) {
|
|
||||||
this.handleMap[flag] = handle;
|
|
||||||
this.count += 1;
|
|
||||||
if (this.count === 1) {
|
|
||||||
if (this.onHandleCountChange) {
|
|
||||||
this.onHandleCountChange();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
EventMeta.prototype.removeEvent = function removeEvent(handle) {
|
|
||||||
const flag = handle.upEventFlag;
|
|
||||||
if (this.handleMap[flag]) {
|
|
||||||
delete this.handleMap[flag];
|
|
||||||
this.count -= 1;
|
|
||||||
if (this.count === 0) {
|
|
||||||
if (this.onHandleCountChange) {
|
|
||||||
this.onHandleCountChange();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
EventMeta.prototype.fire = function fire(e) {
|
|
||||||
if (this.count) {
|
|
||||||
// copy澶勭悊鍑芥暟锛岄槻姝㈠湪璋冪敤澶勭悊鍑芥暟鐨勮繃绋嬩腑handleMap鍙戠敓鏀瑰彉
|
|
||||||
const handles = [];
|
|
||||||
let i = 0;
|
|
||||||
const keys = Object.keys(this.handleMap);
|
|
||||||
for (i = 0; i < keys.length; i += 1) {
|
|
||||||
handles.push(this.handleMap[keys[i]]);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < handles.length; i += 1) {
|
|
||||||
handles[i](e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 娉ㄥ唽浜嬩欢(瀵瑰API)
|
|
||||||
upNativeComm.addEventListener = function addEventListener(type, handle) {
|
|
||||||
let eventInstance = window.gEventHandleMap[type];
|
|
||||||
if (!eventInstance) {
|
|
||||||
eventInstance = window.gEventHandleMap.create(type);
|
|
||||||
eventInstance.onHandleCountChange = function onHandleCountChange() {
|
|
||||||
// 閫氱煡瀹㈡埛绔<E59F9B>
|
|
||||||
notifyEvent({
|
|
||||||
count: this.count,
|
|
||||||
type,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
eventInstance.addEvent(handle);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 绉婚櫎浜嬩欢(瀵瑰API)
|
|
||||||
upNativeComm.removeEventListener = function removeEventListener(type, handle) {
|
|
||||||
const eventInstance = window.gEventHandleMap[type];
|
|
||||||
if (eventInstance) {
|
|
||||||
eventInstance.removeEvent(handle);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 鍏ㄥ眬鍑芥暟浜嬩欢瑙﹀彂鍚庯紝瀹㈡埛绔皟鐢ㄧ殑鍑芥暟
|
|
||||||
window.nativeFireEvent = function nativeFireEvent(type, param) {
|
|
||||||
const instance = window.gEventHandleMap[type];
|
|
||||||
if (instance) {
|
|
||||||
const evt = window.gCreateEvent(type, param);
|
|
||||||
instance.fire(evt);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
window.upPCNativeComm = upNativeComm;
|
|
||||||
15
src/main.js
15
src/main.js
@ -14,8 +14,8 @@ import { liveStatusObj } from "@/config/constant";
|
|||||||
import shieldConfig from "@/config/index";
|
import shieldConfig from "@/config/index";
|
||||||
import { getProductType, dateFormat, getPrice } from "@/utils/filters";
|
import { getProductType, dateFormat, getPrice } from "@/utils/filters";
|
||||||
import SvgIcon from "@/components/SvgIcon";
|
import SvgIcon from "@/components/SvgIcon";
|
||||||
import { terminalType } from "@/utils/index";
|
// import { terminalType } from "@/utils/index";
|
||||||
import loadScript from "@/utils/loadScript";
|
// import loadScript from "@/utils/loadScript";
|
||||||
|
|
||||||
if (window.config.VConsole) {
|
if (window.config.VConsole) {
|
||||||
new VConsole();
|
new VConsole();
|
||||||
@ -44,13 +44,4 @@ const init = () => {
|
|||||||
app.component("svg-icon", SvgIcon);
|
app.component("svg-icon", SvgIcon);
|
||||||
app.mount("#app");
|
app.mount("#app");
|
||||||
};
|
};
|
||||||
|
init();
|
||||||
if (["App", "PcClient"].includes(terminalType)) {
|
|
||||||
let url =
|
|
||||||
terminalType === "App"
|
|
||||||
? "/h5/static/js/jssdk-app-1.0.1.js"
|
|
||||||
: "/h5/static/js/webNativeCommunicatePC.js";
|
|
||||||
loadScript(url, init);
|
|
||||||
} else {
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|||||||
@ -40,6 +40,7 @@ const disabled = ref(true);
|
|||||||
const fromData = reactive({
|
const fromData = reactive({
|
||||||
userName: "",
|
userName: "",
|
||||||
password: "",
|
password: "",
|
||||||
|
loginType: 1,
|
||||||
clientType: 1,
|
clientType: 1,
|
||||||
});
|
});
|
||||||
watch(fromData, (val) => {
|
watch(fromData, (val) => {
|
||||||
|
|||||||
@ -36,18 +36,6 @@ module.exports = defineConfig({
|
|||||||
target: "http://8.138.144.54:8080",
|
target: "http://8.138.144.54:8080",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
"/admin": {
|
|
||||||
target: "http://lczqvideodev.test.upchina.com",
|
|
||||||
changeOrigin: true,
|
|
||||||
},
|
|
||||||
"/frontend": {
|
|
||||||
target: "http://lczqvideodev.test.upchina.com",
|
|
||||||
changeOrigin: true,
|
|
||||||
},
|
|
||||||
"/backend": {
|
|
||||||
target: "http://lczqvideodev.test.upchina.com",
|
|
||||||
changeOrigin: true,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
chainWebpack: (config) => {
|
chainWebpack: (config) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user