fix:修复okr路由解析错误

This commit is contained in:
weifashi 2023-09-04 18:37:14 +08:00
parent 7b2b026bad
commit a38fa4625f
9 changed files with 21 additions and 25 deletions

View File

@ -176,7 +176,7 @@ services:
okr:
container_name: "dootask-okr-${APP_ID}"
image: "kuaifan/doookr:0.0.6"
image: "kuaifan/doookr:0.0.7"
environment:
TZ: "${TIMEZONE:-PRC}"
DOO_TASK_URL: "http://${APP_IPPR}.3"

View File

@ -2,8 +2,6 @@ const isElectron = !!(window && window.process && window.process.type);
const isEEUiApp = window && window.navigator && /eeui/i.test(window.navigator.userAgent);
import microappInit from "./microapp"
microappInit()
import {switchLanguage as $L} from "./language";
import './functions/common'
@ -210,6 +208,9 @@ Vue.mixin(mixin)
let app;
store.dispatch("init").then(action => {
microappInit();
app = new Vue({
router,
store,

View File

@ -96,7 +96,7 @@ export default {
handler(to) {
if(to.name == 'manage-apps'){
this.appData = {
path: to.hash
path: to.hash || to.fullPath
}
}
},
@ -120,6 +120,7 @@ export default {
getAppData(){
return {
type: 'init',
url: this.url,
vues: {
Vue,
store,

View File

@ -1,11 +1,7 @@
import microApp from '@micro-zoe/micro-app'
const getUrl = (s) => {
let url = $A.apiUrl('../' + s)
if (url.indexOf('http') == -1) {
url = window.location.origin + url
}
return import.meta.env.VITE_OKR_WEB_URL || url;
const getUrl = (url) => {
return import.meta.env.VITE_OKR_WEB_URL || $A.apiUrl(url);
}
export default function() {
@ -21,7 +17,7 @@ export default function() {
route = urls.replace(match[0].replace("@vite/client",""),"");
}
// 这里 /basename/ 需要和子应用vite.config.js中base的配置保持一致
code = code.replace( eval(`/(from|import)(\\s*['"])(${route.replace(/\//g,"\\/")})/g`) , all => {
code = code.replace(new RegExp(`(from|import)(\\s*['"])(${route.replace(/\//g,"\\/")})`,'g') , all => {
return all.replace(route, urls)
})
}
@ -44,7 +40,7 @@ export default function() {
microApp.preFetch([
{
name: 'micro-app',
url: getUrl("/apps/okr"),
url: getUrl("../apps/okr"),
disableSandbox: true
}
])

View File

@ -474,11 +474,7 @@ export default {
// okr
okrUrl() {
let url = $A.apiUrl("../apps/okr")
if (url.indexOf('http') == -1) {
url = window.location.origin + url
}
return import.meta.env.VITE_OKR_WEB_URL || url
return import.meta.env.VITE_OKR_WEB_URL || $A.apiUrl("../apps/okr")
},
/**

View File

@ -356,7 +356,7 @@ export default {
case 'okr':
case 'okrAnalyze':
this.goForward({
path: '/manage/apps/' + (item.value == 'okr' ? '/#/list' : '/#/analysis'),
path: '/manage/apps/okr/' + (item.value == 'okr' ? 'list' : 'analysis'),
});
break;
case 'report':

View File

@ -26,11 +26,7 @@ export default {
if (to.name == 'manage-apps') {
this.$nextTick(() => {
this.loading = false;
let url = $A.apiUrl("../apps/okr")
if (url.indexOf('http') == -1) {
url = window.location.origin + url
}
this.appUrl = import.meta.env.VITE_OKR_WEB_URL || url
this.appUrl = import.meta.env.VITE_OKR_WEB_URL || $A.apiUrl("../apps/okr")
this.path = this.$route.query.path || '';
})
}

View File

@ -3639,7 +3639,7 @@ export default {
if (link_id > 0) {
if (window.innerWidth < 910) {
$A.goForward({
path:'/manage/apps/#/okrDetails?data='+link_id,
path:'/manage/apps/okr/okrDetails?data=' + link_id,
});
}else{
state.okrWindow = {

8
vite.config.js vendored
View File

@ -68,7 +68,13 @@ export default defineConfig(({command, mode}) => {
chunkSizeWarningLimit: 3000,
},
plugins: [
createVuePlugin(),
createVuePlugin({
template: {
compilerOptions: {
isCustomElement: (tag) => tag.includes('micro-app') ,
}
}
}),
vitePluginRequire(),
vitePluginFileCopy([{
src: resolve(__dirname, 'resources/assets/statics/public'),