修复接口,模块引用等一些问题

This commit is contained in:
aixianling
2024-10-10 17:35:04 +08:00
parent b3f11698f2
commit 104f5d1049
11 changed files with 28 additions and 87 deletions

View File

@@ -9,13 +9,13 @@
</template>
</header-nav>
<ai-dv-wrapper class="fill" v-if="dvDev">
<router-view/>
<router-view v-bind="commonAttrs"/>
</ai-dv-wrapper>
<el-row v-else-if="showTools" class="fill mar-t48" type="flex">
<slider-nav/>
<main-content class="fill"/>
<main-content class="fill" :commonAttrs="commonAttrs"/>
</el-row>
<router-view class="fill" v-else/>
<router-view class="fill" v-else v-bind="commonAttrs"/>
<div v-if="dialog" class="sign-box">
<ai-sign style="margin: auto" :instance="$request" :action="{login}"
visible @login="getToken" :showScanLogin="false"/>
@@ -30,7 +30,7 @@ import MainContent from "./components/mainContent";
import HeaderNav from "./components/headerNav";
import {mapActions, mapMutations, mapState} from "vuex";
import Mock from "./components/mock";
import AiDvWrapper from "@dui/dv/layout/AiDvWrapper/AiDvWrapper.vue";
import AiDvWrapper from "dui/dv/layout/AiDvWrapper/AiDvWrapper.vue";
export default {
name: 'app',
@@ -42,6 +42,13 @@ export default {
/project\/sass/g.test(location.pathname) && (url += "?corpId=ww596787bb70f08288")
return url
},
commonAttrs() {
return {
instance: this.$request,
dict: this.$dict,
permissions: this.$permissions
}
}
},
data() {
return {
@@ -76,7 +83,8 @@ export default {
}
},
created() {
wx = jWeixin
const {jWeixin} = window
window.wx = jWeixin
if (this.user.token) this.getUserInfo().finally(() => {
if (/^\/project\/xiushan/.test(location.pathname)) {
this.getFinanceUser()

View File

@@ -2,7 +2,7 @@
<section class="mainContent">
<ai-nav-tab :routes="apps"/>
<div class="fill">
<router-view/>
<router-view v-bind="$attrs.commonAttrs"/>
<ai-empty v-if="isHome">欢迎使用村微产品库</ai-empty>
</div>
</section>

View File

@@ -4,10 +4,10 @@ import ui from 'element-ui';
import router from './router';
import axios from './router/axios';
import utils from './utils';
import dui from 'dui';
import dui from 'dui/packages';
import store from './store';
import dataV from '@jiaminghi/data-view';
import dvui from '@dui/dv'
import dvui from 'dui/dv'
Vue.use(dataV)
Vue.use(ui);

View File

@@ -1,5 +1,5 @@
import {Message} from 'element-ui'
import instance from '../../ui/lib/js/request'
import instance from 'dui/lib/js/request'
let baseURLs = {
production: "/",
@@ -8,31 +8,7 @@ let baseURLs = {
instance.defaults.baseURL = baseURLs[process.env.NODE_ENV]
instance.interceptors.request.use(config => {
if (config.url.startsWith("/node")) {
config.baseURL = "/ns"
} else if (config.url.startsWith("/sse")) {
config.baseURL = "/"
} else if (/\/project\/activeAnalysis/.test(location.pathname)) {
config.baseURL = "/analysis"
} else if (/\/project\/beta/.test(location.pathname)) {
config.baseURL = "/wg"
} else if (/\/project\/sass/.test(location.pathname)) {
config.baseURL = "/saas"
} else if (/\/tianfuxing/.test(location.pathname)) {
config.baseURL = "/tfx"
} else if (/\/qianxinan/.test(location.pathname)) {
// config.baseURL = "/qxn"
} else if (/\/xiushan/.test(location.pathname)) {
config.baseURL = "/xsjr"
} else if (/project\/oms/.test(location.pathname)) {
config.baseURL = "/omsapi"
} else if (/#url-/.test(location.hash)) {
config.baseURL = location.hash.replace(/#url-/, '/')
}
if (["/xsjr", "/tfx", "/omsapi"].includes(config.baseURL)) {
config.url = config.url.replace(/(app|auth|admin|api)\//, "api/")
}
if (['/qxn', '/analysis'].includes(config.baseURL)) {
config.url = config.url.replace(/(app|auth|admin)\//, "api/")
config.url = "/ns" + config.url
}
if (process.env.VUE_APP_IS_SIMPLE_SERVER == 1) {
config.url = config.url.replace(/(app|auth|admin)\//, "api/")

View File

@@ -1,46 +0,0 @@
<template>
<section class="appEntry">
<component v-if="app" :is="app" ref="currentPage" :instance="$request" :dict="$dict" :permissions="$permissions"/>
<ai-empty v-else>无法找到应用文件</ai-empty>
</section>
</template>
<script>
import {mapState} from "vuex";
import Vue from "vue";
export default {
name: "appEntry",
label: "应用库-应用",
computed: {
...mapState(['apps']),
app() {
const app = this.apps.find(e => e.name == this.$route.name)
return app.esm ?? ""
}
},
mounted() {
this.$vm.$on("mock", v => {
if (!!this.$refs.currentPage.$children?.[0]?.form) {
this.$refs.currentPage.$children[0].form = v
this.$refs.currentPage.$children[0].$forceUpdate()
}
})
}
}
</script>
<style lang="scss" scoped>
.appEntry {
width: 100%;
flex: 1;
min-width: 0;
min-height: 0;
height: 100%;
& > * {
height: 100%;
}
}
</style>