Quellcode durchsuchen

增加 发布阿里云, 可以在PC端查看的H5项目

yunxing vor 4 Jahren
Ursprung
Commit
e8da45e77d
5 geänderte Dateien mit 55 neuen und 15 gelöschten Zeilen
  1. 2 3
      .gitignore
  2. 31 0
      README.md
  3. 2 2
      src/main.ts
  4. 17 8
      src/views/equipmentFacilities/MoreEquipmentList.vue
  5. 3 2
      vue.config.js

+ 2 - 3
.gitignore

@@ -1,9 +1,8 @@
 .DS_Store
 node_modules
-/wandaBmGuideH5
+/wandaBmGuideH5*
 /dist
-wandaBmGuideH5.zip
-
+wandaBmGuideH5*.zip
 # local env files
 .env.local
 .env.*.local

+ 31 - 0
README.md

@@ -34,6 +34,37 @@ yarn build --report 或 npm run build --report
 npm run publish # 只能发布到阿里云环境(需要外网支持)
 ```
 
+- - -
+
+### 发布阿里云, 可以在PC端查看的H5项目
+
+修改packaje.json
+
+``` json
+ "remote": {
+    "host": "60.205.177.43",
+    "path": "/root/apps/web/wandaBmGuideH5Test", // wandaBmGuideH5 -> wandaBmGuideH5Test
+    "user": "root",
+    "password": "WWW.sagacloud.mail@2020",
+    "local": "wandaBmGuideH5Test"  //wandaBmGuideH5 -> wandaBmGuideH5Test
+  },
+  ```
+
+  执行打包命令
+  
+
+``` shell
+  npm run build_test
+```
+
+发布
+
+``` shell
+npm run publish 
+```
+
+- - -
+
 ### 目录结构
 
 ``` shell

+ 2 - 2
src/main.ts

@@ -28,7 +28,7 @@ console.log('height:', window.screen.height)
 console.log('clientWidth:', document.body.clientWidth)
 console.log('clientHeight:', document.body.clientHeight)
 // 打包后,监听deviceready事件,处理 部分设备 不能使用cordova插件方法的问题
-if (process.env.NODE_ENV === 'production') {
+if (process.env.NODE_ENV === 'production' && process.env.VUE_APP_RealEnv !== 'test') {
     window.addEventListener('deviceready', function() {
         new Vue({
             router,
@@ -38,7 +38,7 @@ if (process.env.NODE_ENV === 'production') {
     })
 } else {
     // 开发环境
-    new Vue({ 
+    new Vue({
         router,
         store,
         render: (h) => h(App),

+ 17 - 8
src/views/equipmentFacilities/MoreEquipmentList.vue

@@ -258,6 +258,7 @@ export default {
         },
         async onLoad() {
             console.log('onload')
+            // console.trace('11111')
             if (this.page > 1) {
                 await sleep(1000)
             }
@@ -372,7 +373,6 @@ export default {
          */
         initData() {
             this.noDataFlag = false
-            this.finished = false
             this.page = 1
             this.count = 0
             this.list = []
@@ -442,7 +442,7 @@ export default {
         /**
          * 重置
          */
-        reset: debounce(function () {
+        reset() {
             this.modalDataBak = {
                 system: '',
                 sbss: '全部',
@@ -456,20 +456,29 @@ export default {
             this.showPopup = false
             // 初始化数据,查询列表
             this.initData()
-            this.onLoad()
-        }, 300),
+            if (this.finished) {
+                this.finished = false
+            } else {
+                this.onLoad()
+            }
+        },
         /**
          * 弹窗确认
          */
-        confirm: debounce(function () {
-            this.modalData = cloneDeep(this.modalDataBak)
+        confirm() {
+            console.log('confirm')
             this.showPopup = false
+            this.modalData = cloneDeep(this.modalDataBak)
             this.system_code = this.modalData.system
             this.sbss_code = this.modalData.sbss
             // 初始化数据,查询列表
             this.initData()
-            this.onLoad()
-        }, 300),
+            if (this.finished) {
+                this.finished = false
+            } else {
+                this.onLoad()
+            }
+        },
     },
 }
 </script>

+ 3 - 2
vue.config.js

@@ -40,9 +40,10 @@ module.exports = {
         config.output.chunkFilename('static/js/[name].[hash].js').end()
     },
     lintOnSave: false,
-    publicPath: '/wandaBmGuideH5',
+    // 测试包路径修改
+    publicPath: process.env.VUE_APP_RealEnv === 'test' ? '/wandaBmGuideH5Test' : '/wandaBmGuideH5',
     // 打包名称
-    outputDir: 'wandaBmGuideH5',
+    outputDir: process.env.VUE_APP_RealEnv === 'test' ? 'wandaBmGuideH5Test' : 'wandaBmGuideH5',
     // 放置生成的静态资源 (js、css、img、fonts) 的 (相对于 outputDir 的) 目录
     assetsDir: 'static',
     transpileDependencies: [