Browse Source

1. map.wanda.cn地址更改为 mapapp.wanda.cn
2. 打包时自动判断环境,无需手动更改vuex store
3. 更新README.md 打包说明书
4. package.json修改,
1)新增自动化依赖node-ssh
2)新增自动发布命令 publish(仅支持阿里云环境发布)

yunxing 4 years ago
parent
commit
db08ef6b77
7 changed files with 87 additions and 11 deletions
  1. 42 4
      README.md
  2. 11 2
      package.json
  3. 28 0
      publish.js
  4. 2 2
      src/App.vue
  5. 1 1
      src/components/floorMap/index.vue
  6. 2 1
      src/store/index.js
  7. 1 1
      vue.config.js

+ 42 - 4
README.md

@@ -2,25 +2,25 @@
 
 ## Project setup
 
-```
+``` 
 npm install
 ```
 
 ### Compiles and hot-reloads for development
 
-```
+``` 
 npm run serve
 ```
 
 ### Compiles and minifies for production
 
-```
+``` 
 npm run build
 ```
 
 ### Lints and fixes files
 
-```
+``` 
 npm run lint
 ```
 
@@ -39,3 +39,41 @@ See [Configuration Reference](https://cli.vuejs.org/config/).
 ### 机房区域-图片预览
 
 #### <pic-large :imgUrl='imgUrl'></pic-large> imgUrl 图片数组
+
+### 打包发版
+
+1. 阿里云
+
+阿里与打包
+
+``` shell
+ npm run build:aly
+```
+
+阿里云发版
+
+``` shell
+npm run publish 
+```
+
+2. 测试环境
+
+打包
+
+``` shell
+npm run build:wanda_dev
+```
+
+发版
+远程跳板机进行发版
+
+3. 生产环境
+
+打包
+
+``` shell
+npm run build:wanda_build
+```
+
+发版
+远程跳板机进行发版

+ 11 - 2
package.json

@@ -2,12 +2,20 @@
     "name": "wandaspecificationofsanming",
     "version": "0.1.0",
     "private": true,
+    "remote": {
+        "host": "60.205.177.43",
+        "path": "/root/apps/web/wandaBmGuide",
+        "user": "root",
+        "password": "WWW.sagacloud.mail@2020",
+        "local": "wandaBmGuide"
+    },
     "scripts": {
         "serve": "cross-env NODE_ENV=serve vue-cli-service serve --open",
         "build:aly": "cross-env NODE_ENV=aly_dev vue-cli-service build",
         "build:wanda_dev": "cross-env NODE_ENV=wanda_dev vue-cli-service build",
         "build:wanda_build": "cross-env NODE_ENV=wanda_build vue-cli-service build",
-        "lint": "vue-cli-service lint"
+        "lint": "vue-cli-service lint",
+        "publish": "node publish.js"
     },
     "dependencies": {
         "@mapbox/geojson-merge": "^1.1.1",
@@ -60,6 +68,7 @@
         "typescript": "~3.8.3",
         "vue-property-decorator": "^8.4.2",
         "vue-svg-loader": "^0.15.0",
-        "vue-template-compiler": "^2.6.10"
+        "vue-template-compiler": "^2.6.10",
+        "node-ssh": "^6.0.0"
     }
 }

+ 28 - 0
publish.js

@@ -0,0 +1,28 @@
+const Client = require('node-ssh')
+const ssh = new Client()
+
+ssh.connect({
+    host: process.env.npm_package_remote_host,
+    port: '22',
+    username: process.env.npm_package_remote_user,
+    password: process.env.npm_package_remote_password,
+}).then(() => {
+    const failedList = []
+    ssh.putDirectory(process.env.npm_package_remote_local, process.env.npm_package_remote_path, {
+        recursive: true,
+        concurrency: 1,
+        tick: function(localPath, remotePath, error) {
+            if (error) {
+                failedList.push(localPath)
+            }
+        },
+    }).then((status) => {
+        if (failedList.length > 0) {
+            console.log('发布失败')
+            console.log('failed transfers', failedList.join(', '))
+        } else {
+            console.log(status ? '发布成功' : '发布失败')
+        }
+        ssh.dispose()
+    })
+})

+ 2 - 2
src/App.vue

@@ -18,8 +18,8 @@ export default {
             canvasID: '',
             key: '23f30a832a862c58637a4aadbf50a566',
             appName: '万达可视化系统',
-            mapServerURL: `http://map.wanda.cn/editor`,
-            mapthemeUrl: `http://map.wanda.cn/editor/webtheme`,
+            mapServerURL: `http://mapapp.wanda.cn/editor`,
+            mapthemeUrl: `http://mapapp.wanda.cn/editor/webtheme`,
             isMounted: false,
             plazaIds: '',
         }

+ 1 - 1
src/components/floorMap/index.vue

@@ -126,7 +126,7 @@ export default {
         return {
             appName: '万达可视化系统',
             key: '23f30a832a862c58637a4aadbf50a566',
-            mapServerURL: `http://map.wanda.cn/editor`,
+            mapServerURL: `http://mapapp.wanda.cn/editor`,
             canvasWidth: 600,
             canvasHeight: 800,
             loading: false, // 限制重复查询

+ 2 - 1
src/store/index.js

@@ -8,7 +8,8 @@ import router from '../router'
 Vue.use(Vuex)
 export default new Vuex.Store({
     state: {
-        ssoToken: 'admin:liujiandong',
+        // 阿里云环境,开发环境使用 admin:liujiandong ,测试环境,生产环境使用null
+        ssoToken: ['aly_dev', 'serve'].includes(process.env.NODE_ENV) ? 'admin:liujiandong' : null,
         // ssoToken: '',
         // ssoToken: null,
         plazaName: '',

+ 1 - 1
vue.config.js

@@ -25,7 +25,7 @@ module.exports = {
             // },
             // 万达蜂鸟服务
             "/wdfn": {
-                target: "http://map.wanda.cn",
+                target: "http://mapapp.wanda.cn",
                 changeOrigin: true,
                 pathRewrite: {
                     "^/wdfn": "/editor",