diff --git a/src/main.js b/src/main.js index 97b064b..4a92626 100644 --- a/src/main.js +++ b/src/main.js @@ -1,5 +1,6 @@ import Vue from 'vue' import { setToken } from '@/utils/auth' +import { getQueryParam } from '@/utils' import 'normalize.css/normalize.css' // A modern alternative to CSS resets import ElementUI from 'element-ui' @@ -73,24 +74,37 @@ if (window.__POWERED_BY_WUJIE__) { window.__WUJIE_UNMOUNT = () => { instance.$destroy(); }; -} else if(window.top !== window.self) { +} +else if(window.top !== window.self) { if (window.top !== window.self) { + // 当前页面在iframe中 // 当前页面在iframe中 window._IN_IFRAME = true; - window.addEventListener("message",function (e) { - const { module_name, auth_token } = e.data; - window.MODULE_NAME = module_name; - console.log('token',auth_token) - setToken(auth_token) - new Vue({ - router, - store, - render: h => h(App) - }).$mount("#app") - router.push('/') - }) + + setToken(getQueryParam('auth_token')) + window.MODULE_NAME = getQueryParam('module_name') + new Vue({ + router, + store, + render: h => h(App) + }).$mount("#app") + router.push('/') + // window._IN_IFRAME = true; + // window.addEventListener("message",function (e) { + // const { module_name, auth_token } = e.data; + // window.MODULE_NAME = module_name; + // console.log('token',auth_token) + // setToken(auth_token) + // new Vue({ + // router, + // store, + // render: h => h(App) + // }).$mount("#app") + // router.push('/') + // }) } -} else { +} +else { new Vue({ router, store, diff --git a/src/utils/index.js b/src/utils/index.js index 31e5f43..f70672a 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -217,3 +217,8 @@ export function resetSelect(select) { } }) } + +export function getQueryParam(param) { + const params = new URLSearchParams(window.location.search.substring(1)); + return params.get(param); +} diff --git a/src/views/contract/contractEdit.vue b/src/views/contract/contractEdit.vue index bb1a0f6..3fc166f 100644 --- a/src/views/contract/contractEdit.vue +++ b/src/views/contract/contractEdit.vue @@ -1689,17 +1689,17 @@ export default { computed: { flowIdsFormat () { let temp = this.form.is_trade; - console.log(temp ? this.flowIds.filter(i => /工会/g.test(i.name)) : this.flowIds) - return temp ? this.flowIds.filter(i => /工会/g.test(i.name)) : this.flowIds + console.log(temp ? this.flowIds?.filter(i => /工会/g.test(i.name)) : this.flowIds) + return temp ? this.flowIds?.filter(i => /工会/g.test(i.name)) : this.flowIds }, isOtherFlow () { - return this.flowIds.find(i => i.id === this.form.flow_mod_id)?.type == 1; + return this.flowIds?.find(i => i.id === this.form.flow_mod_id)?.type == 1; }, isNeedMore () { //是否需要组织形式等 - return this.flowIds.find(i => i.id === this.form.flow_mod_id)?.name === "政府采购流转" || this.flowIds.find(i => i.id === this.form.flow_mod_id)?.name === "政府小额采购" + return this.flowIds?.find(i => i.id === this.form.flow_mod_id)?.name === "政府采购流转" || this.flowIds?.find(i => i.id === this.form.flow_mod_id)?.name === "政府小额采购" }, purchaseWayFormat() {