From 868853bd1b26e09473140ff2e1abb3308b1557bd Mon Sep 17 00:00:00 2001 From: YM <479443481@qq.com> Date: 星期四, 13 六月 2024 14:19:08 +0800 Subject: [PATCH] 1 --- .env.product | 6 ++- vue.config.js | 26 ++++++++++++- .env | 3 + src/App.vue | 31 ++++----------- 4 files changed, 39 insertions(+), 27 deletions(-) diff --git a/.env b/.env index ba16ee5..faab82f 100644 --- a/.env +++ b/.env @@ -1,3 +1,4 @@ VUE_APP_ENV = 'dev' VUE_APP_API_URL = "https://jsek.bnuic.com" -PUBLIC_PATH = '/books/book' \ No newline at end of file +VUE_APP_RESOURCE_CTX = 'https://jsek.bnuic.com/books/resource/' +VUE_APP_PUBLIC_PATH = '/books/book' diff --git a/.env.product b/.env.product index 4df5688..7a2aabf 100644 --- a/.env.product +++ b/.env.product @@ -1,4 +1,6 @@ VUE_APP_ENV = 'product' VUE_APP_API_URL = "https://jsek.bnuic.com" -PUBLIC_PATH = 'http://182.92.203.7:3007/books/book' -# PUBLIC_PATH = 'https://jsek.bnuic.com/books/book' \ No newline at end of file +VUE_APP_RESOURCE_CTX = 'https://jsek.bnuic.com/books/resource/' +VUE_APP_PUBLIC_PATH = 'https://jsek.bnuic.com/books/book/childHealth' +VUE_APP_BOOK_LIST = "artAndDance/childHealth/embedded/English/lifeCare/sportsAndHealth" +VUE_APP_BOOK_ID = 'childHealth' \ No newline at end of file diff --git a/src/App.vue b/src/App.vue index 81ff827..6949a2d 100644 --- a/src/App.vue +++ b/src/App.vue @@ -17,7 +17,7 @@ import embedded from "./books/embedded/view/index.vue"; import english from "./books/English/view/index.vue"; import sportsAndHealth from "./books/sportsAndHealth/view/index"; -import artAndDance from './books/artAndDance/view/index.vue' +import artAndDance from "./books/artAndDance/view/index.vue"; export default { name: "App", @@ -38,20 +38,11 @@ if (this.setGlobalState) { this.setGlobalState({ initTestBook: async (bookId, tryPageCount) => { - // this.activeBook = await this.config.getBookConfig(this.config.resourceCtx + bookId); - if ( - // "http://182.92.203.7:3007/books/resource/" - // "https://jsek.bnuic.com/books/resource/" - this.config.resourceCtx == - "http://182.92.203.7:3007/books/resource/" - ) { - this.config.resourceCtx = this.config.resourceCtx + bookId; - } + this.activeBook = await this.config.getBookConfig( + process.env.VUE_APP_RESOURCE_CTX + process.env.VUE_APP_BOOK_ID + ); this.config.activeBook = this.activeBook; this.config.goodsStore = this.activeBook.storeRefcode; - this.activeBook = await this.config.getBookConfig( - this.config.resourceCtx - ); if (tryPageCount) { this.activeBook.tryPageCount = tryPageCount; } @@ -66,13 +57,10 @@ }); } else { this.activeBook = await this.config.getBookConfig( - // childHealth - // lifeCare - // sportsAndHealth - // embedded - // english - // artAndDance - this.config.resourceCtx + "sportsAndHealth" + process.env.VUE_APP_RESOURCE_CTX + + (process.env.VUE_APP_ENV == "product" + ? process.env.VUE_APP_BOOK_ID + : "english") ); // 娴嬭瘯璇曡30椤� // this.activeBook.tryPageCount = 10; @@ -174,8 +162,7 @@ margin: auto; } - -.openImgBox img{ +.openImgBox img { cursor: zoom-in; } </style> diff --git a/vue.config.js b/vue.config.js index b375ec8..8269352 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,6 +1,9 @@ const { defineConfig } = require("@vue/cli-service"); +const webpack = require("webpack"); +// 鑾峰彇鎵�鏈変功绫嶅垪琛� +const bookList = process.env.VUE_APP_BOOK_LIST ? process.env.VUE_APP_BOOK_LIST.split("/") : []; module.exports = defineConfig({ - publicPath: process.env.PUBLIC_PATH, + publicPath: process.env.VUE_APP_PUBLIC_PATH, transpileDependencies: true, lintOnSave: false, // devServer: { @@ -19,7 +22,26 @@ library: `app-content`, libraryTarget: "umd", chunkLoadingGlobal: `webpackJsonp_app-content` - } + }, + plugins: [ + new webpack.IgnorePlugin({ + checkResource(resource) { + if (process.env.VUE_APP_ENV == "product") { + // 缂栬瘧鍜屾墦鍖呰繃婊� + for (let i = 0; i < bookList.length; i++) { + const bookName = bookList[i]; + if (bookName != process.env.VUE_APP_BOOK_ID) { + // 杩囨护涓嶉渶瑕佺殑妯″潡 + if (resource.indexOf(bookName) > -1) { + return true; + } + } + } + } + return false; + } + }) + ] }, chainWebpack: (config) => { config.module -- Gitblit v1.9.1