xiongzhu 4 years ago
parent
commit
e99c2bdad4

+ 1 - 1
src/main/nine-space/.env.app

@@ -1,6 +1,6 @@
 VUE_APP_BASE_URL=https://nft.9space.vip
 NODE_ENV=production
-PUBLIC_PATH=./
+VUE_APP_PUBLIC_PATH=./
 ASSETS_PATH=9th
 TITLE=第九空间
 VUE_APP_CORDOVA=true

+ 1 - 1
src/main/nine-space/.env.development

@@ -1,6 +1,6 @@
 VUE_APP_BASE_URL=https://nfttest.9space.vip/
 NODE_ENV=development
-PUBLIC_PATH=/
+VUE_APP_PUBLIC_PATH=/
 ASSETS_PATH=9th
 TITLE=第九空间
 VUE_APP_PAGE_TYPE=9th

+ 1 - 1
src/main/nine-space/.env.production

@@ -1,6 +1,6 @@
 VUE_APP_BASE_URL=/
 NODE_ENV=production
-PUBLIC_PATH=/9th/
+VUE_APP_PUBLIC_PATH=/9th/
 ASSETS_PATH=9th
 TITLE=第九空间
 VUE_APP_PAGE_TYPE=9th

+ 2 - 0
src/main/nine-space/package.json

@@ -12,6 +12,7 @@
         "@better-scroll/core": "^2.4.2",
         "@chenfengyuan/vue-qrcode": "^2.0.0-rc.1",
         "@vant/area-data": "^1.1.3",
+        "ali-oss": "^6.17.1",
         "axios": "^0.21.4",
         "better-scroll": "^2.4.2",
         "clipboard": "^2.0.8",
@@ -25,6 +26,7 @@
         "mathjs": "^9.5.1",
         "qrcode": "^1.4.4",
         "query-string": "^7.0.1",
+        "queue": "^6.0.2",
         "register-service-worker": "^1.7.1",
         "swiper": "^6.8.1",
         "three": "^0.135.0",

+ 4 - 1
src/main/nine-space/src/router/index.js

@@ -463,7 +463,10 @@ const routes = [
 ];
 
 const router = createRouter({
-    history: process.env.VUE_APP_CORDOVA === 'true' ? createWebHashHistory() : createWebHistory(process.env.BASE_URL),
+    history:
+        process.env.VUE_APP_CORDOVA === 'true'
+            ? createWebHashHistory()
+            : createWebHistory(process.env.VUE_APP_PUBLIC_PATH),
     routes,
     scrollBehavior(to, from, savedPosition) {
         return { x: 0, y: 0 };

+ 3 - 3
src/main/nine-space/upload.js

@@ -5,9 +5,9 @@ const path = require('path');
 
 let client = new OSS({
     region: 'oss-cn-shenzhen',
-    accessKeyId: 'LTAI5tPoBCiEMSDaS1Q4HKr9',
-    accessKeySecret: 'F8ZNiqdH35T7gikBkn6Fq8tgbvdY88',
-    bucket: 'raex-meta'
+    accessKeyId: 'LTAI5tCtRs8DXBLBsn49qRZX',
+    accessKeySecret: '86uC18LZsfB9JU04BK7ImVXfOytEkG',
+    bucket: '9space-2021'
 });
 
 class UploadCDNPlugin {

+ 18 - 1
src/main/nine-space/vue.config.js

@@ -1,6 +1,20 @@
 const path = require('path');
+const fs = require('fs');
+const UploadPlugin = require('./upload');
+let publicPath;
+switch (process.env.NODE_ENV) {
+    case 'development':
+        publicPath = '/';
+        break;
+    case 'production':
+        publicPath = `https://cosmoscdn.9space.vip/www/` + new Date().getTime();
+        break;
+    case 'test':
+        publicPath = `https://cosmoscdn.9space.vip/www_test/` + new Date().getTime();
+        break;
+}
 module.exports = {
-    publicPath: process.env.PUBLIC_PATH || '/',
+    publicPath: publicPath,
     devServer: {
         port: 8081,
         disableHostCheck: true
@@ -12,6 +26,9 @@ module.exports = {
         }
     },
     chainWebpack: config => {
+        if (process.env.NODE_ENV === 'production') {
+            config.plugin('upload').use(new UploadPlugin(publicPath.replace('https://cosmoscdn.9space.vip/', '')));
+        }
         config.output.filename('[name].[hash].js').end();
         config.resolve.alias.set('@assets', path.resolve(__dirname, 'src', 'assets', process.env.ASSETS_PATH || '9th'));
         config.plugin('html').tap(args => {

File diff suppressed because it is too large
+ 487 - 19
src/main/nine-space/yarn.lock


Some files were not shown because too many files changed in this diff