diff --git a/.env.development b/.env.development index b45dc6e..9113d2c 100644 --- a/.env.development +++ b/.env.development @@ -2,6 +2,7 @@ VUE_APP_TITLE = 问卷调查测试环境 # 接口请求地址,会设置到 axios 的 baseURL 参数上 VUE_APP_API_ROOT_TDUCK = /tduck-api +#VUE_APP_API_ROOT = http://localhost:8080/api VUE_APP_API_ROOT = http://192.168.1.140/api # 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空 VUE_APP_DEBUG_TOOL = @@ -9,3 +10,5 @@ VUE_APP_DEBUG_TOOL = VUE_APP_MAP_KEY = f2200337d0d08538e78729572749882d # 微信功能开关 开启设置 ON,关闭设置 OFF VUE_APP_WX = OFF +#项目根路径 +VUE_APP_PUBLIC_PATH=questionnaire diff --git a/.env.production b/.env.production index a54e590..5db4a72 100644 --- a/.env.production +++ b/.env.production @@ -8,3 +8,5 @@ VUE_APP_DEBUG_TOOL = VUE_APP_MAP_KEY = f2200337d0d08538e78729572749882d # 微信功能开关 开启设置 ON,关闭设置 OFF VUE_APP_WX = ON +#项目根路径 +VUE_APP_PUBLIC_PATH=questionnaire diff --git a/src/components/tinymce/index.vue b/src/components/tinymce/index.vue index 6b1a871..f5f5728 100644 --- a/src/components/tinymce/index.vue +++ b/src/components/tinymce/index.vue @@ -41,8 +41,8 @@ export default { selector: `#${this.tinymceId}`, language: 'zh_CN', menubar: 'false', - skin_url: '/questionnaire/tinymce/skins/ui/tduck', - content_css: '/questionnaire/tinymce/skins/content/tduck', + skin_url: '/'+process.env.VUE_APP_PUBLIC_PATH+'/tinymce/skins/ui/tduck', + content_css: '/'+process.env.VUE_APP_PUBLIC_PATH +'/tinymce/skins/content/tduck', cache_suffix: '?v=0.0.1', plugins, toolbar, diff --git a/src/router/index.js b/src/router/index.js index 078da10..edd2fad 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -32,7 +32,7 @@ routes.push({ const router = new Router({ mode: 'history', routes: routes.flat(), - base: '/questionnaire' + base: process.env.VUE_APP_PUBLIC_PATH }) // 解决路由在 push/replace 了相同地址报错的问题 diff --git a/src/views/form/preview/index.vue b/src/views/form/preview/index.vue index a102a5c..efbb346 100644 --- a/src/views/form/preview/index.vue +++ b/src/views/form/preview/index.vue @@ -64,7 +64,7 @@ export default { mounted() { this.projectKey = this.$route.query.key let url = window.location.protocol + '//' + window.location.host - this.mobilePreviewUrl = `${url}/project/view?key=${this.projectKey}` + this.mobilePreviewUrl = `${url}/${process.env.VUE_APP_PUBLIC_PATH}/project/view?key=${this.projectKey}` this.$set(this.projectConfig, 'projectKey', this.projectKey) } } diff --git a/src/views/form/publish/index.vue b/src/views/form/publish/index.vue index bbb1511..65f7430 100644 --- a/src/views/form/publish/index.vue +++ b/src/views/form/publish/index.vue @@ -134,8 +134,7 @@ export default { mounted () { this.projectKey = this.$route.query.key let url = window.location.protocol + '//' + window.location.host - this.writeLink = `${url}/questionnaire/s/${this.projectKey}` - + this.writeLink = `${url}/${process.env.VUE_APP_PUBLIC_PATH}/s/${this.projectKey}` this.getProjectStatus() }, methods: { diff --git a/vue.config.js b/vue.config.js index 623be23..427e332 100644 --- a/vue.config.js +++ b/vue.config.js @@ -7,7 +7,7 @@ function resolve(dir) { } module.exports = { - publicPath: '/questionnaire', + publicPath: '/'+process.env.VUE_APP_PUBLIC_PATH, lintOnSave: process.env.NODE_ENV === 'development', productionSourceMap: false, devServer: {