Commit e856428eeb2ae7fc5eb1dd41cc47710084b8743d

Authored by ly525
1 parent b7211865

update previewUrl & relaseUrl & build publicPath

front-end/h5/src/components/core/editor/modals/preview.vue
@@ -23,7 +23,7 @@ export default { @@ -23,7 +23,7 @@ export default {
23 // work: state => state.work 23 // work: state => state.work
24 // }), 24 // }),
25 releaseUrl () { 25 releaseUrl () {
26 - return `${API_ORIGIN}/works/preview/${this.work.id}` 26 + return `/works/preview/${this.work.id}`
27 } 27 }
28 }, 28 },
29 data () { 29 data () {
front-end/h5/src/views/work-manager/list.vue
@@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
2 import { mapState, mapActions } from 'vuex' 2 import { mapState, mapActions } from 'vuex'
3 import QRCode from 'qrcode' 3 import QRCode from 'qrcode'
4 4
5 -import { API_ORIGIN } from '@/constants/api.js'  
6 import PreviewDialog from '@/components/core/editor/modals/preview.vue' 5 import PreviewDialog from '@/components/core/editor/modals/preview.vue'
7 import CardCover from '@/components/common/work/card-cover.js' 6 import CardCover from '@/components/common/work/card-cover.js'
8 7
@@ -32,7 +31,7 @@ const ListItemCard = { @@ -32,7 +31,7 @@ const ListItemCard = {
32 return displayTime 31 return displayTime
33 }, 32 },
34 genQRCodeUrl (work) { 33 genQRCodeUrl (work) {
35 - const url = `${API_ORIGIN}/works/preview/${work.id}` 34 + const url = `/works/preview/${work.id}`
36 QRCode.toDataURL(url, (err, url) => { 35 QRCode.toDataURL(url, (err, url) => {
37 if (err) console.log(err) 36 if (err) console.log(err)
38 this.qrcodeUrl = url 37 this.qrcodeUrl = url
front-end/h5/src/views/work-manager/templates.vue
@@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
2 import { mapState, mapActions } from 'vuex' 2 import { mapState, mapActions } from 'vuex'
3 import QRCode from 'qrcode' 3 import QRCode from 'qrcode'
4 4
5 -import { API_ORIGIN } from '@/constants/api.js'  
6 import PreviewDialog from '@/components/core/editor/modals/preview.vue' 5 import PreviewDialog from '@/components/core/editor/modals/preview.vue'
7 import CardCover from '@/components/common/work/card-cover.js' 6 import CardCover from '@/components/common/work/card-cover.js'
8 7
@@ -36,7 +35,7 @@ const ListItemCard = { @@ -36,7 +35,7 @@ const ListItemCard = {
36 return displayTime 35 return displayTime
37 }, 36 },
38 genQRCodeUrl (work) { 37 genQRCodeUrl (work) {
39 - const url = `${API_ORIGIN}/works/preview/${work.id}` 38 + const url = `/works/preview/${work.id}`
40 QRCode.toDataURL(url, (err, url) => { 39 QRCode.toDataURL(url, (err, url) => {
41 if (err) console.log(err) 40 if (err) console.log(err)
42 this.qrcodeUrl = url 41 this.qrcodeUrl = url
front-end/h5/vue.config.js
1 -const isProd = process.env.NODE_ENV === 'production'  
2 const target = 'http://localhost:1337' 1 const target = 'http://localhost:1337'
3 module.exports = { 2 module.exports = {
4 runtimeCompiler: true, 3 runtimeCompiler: true,
5 - // 因为需要部署到 github pages,所以需要将 publicPath 设为 "/< GitHub Repo Name>/"  
6 - publicPath: isProd ? '/luban-h5/' : '/',  
7 productionSourceMap: false, 4 productionSourceMap: false,
8 devServer: { 5 devServer: {
9 - // proxy: API_ORIGIN  
10 proxy: { 6 proxy: {
11 '/works': { 7 '/works': {
12 target, 8 target,