Browse Source

添加项目根路径

old
jianjun 4 years ago
parent
commit
db05fc0b2c
  1. 3
      .env.development
  2. 2
      .env.production
  3. 4
      src/components/tinymce/index.vue
  4. 2
      src/router/index.js
  5. 2
      src/views/form/preview/index.vue
  6. 3
      src/views/form/publish/index.vue
  7. 2
      vue.config.js

3
.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

2
.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

4
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,

2
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 了相同地址报错的问题

2
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)
}
}

3
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: {

2
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: {

Loading…
Cancel
Save