Pārlūkot izejas kodu

Merge branch 'develop' of http://39.106.8.246:3003/web/wanda-bm-guide into smswb_dev

yunxing 4 gadi atpakaļ
vecāks
revīzija
15440e9793
8 mainītis faili ar 154 papildinājumiem un 11 dzēšanām
  1. 54 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. 55 0
      version.js
  8. 1 1
      vue.config.js

+ 54 - 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,53 @@ See [Configuration Reference](https://cli.vuejs.org/config/).
 ### 机房区域-图片预览
 
 #### <pic-large :imgUrl='imgUrl'></pic-large> imgUrl 图片数组
+
+### 打包发版
+
+1. 阿里云
+
+阿里与打包
+
+``` shell
+ npm run build:aly
+```
+
+``` shell 
+node version # 在打包后的wandaBmGuide文件夹中生成version.txt git版本信息文件
+
+``` 
+阿里云发版
+
+``` shell
+npm run publish 
+```
+
+2. 测试环境
+
+打包
+
+``` shell
+npm run build:wanda_dev
+```
+
+``` shell 
+node version # 在打包后的wandaBmGuide文件夹中生成version.txt git版本信息文件
+
+``` 
+发版
+远程跳板机进行发版
+
+3. 生产环境
+
+打包
+
+``` shell
+npm run build:wanda_build
+```
+
+``` shell 
+node version # 在打包后的wandaBmGuide文件夹中生成version.txt git版本信息文件
+
+```
+发版
+远程跳板机进行发版

+ 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: '',

+ 55 - 0
version.js

@@ -0,0 +1,55 @@
+/** 自动记录版本信息**/
+const fs = require('fs')
+const buildPath = 'wandaBmGuide' //放置 version.txt的路径
+const execSync = require('child_process').execSync //同步子进程
+const date = new Date() // Date对象
+
+// 获取时间函数
+const getDate = (df, tf) => {
+    const dArr = [
+        date.getFullYear(),
+        date.getMonth() > 9 ? String(date.getMonth() + 1) : String('0' + (date.getMonth() + 1)),
+        date.getDate() > 9 ? String(date.getDate()) : String('0' + date.getDate()),
+    ]
+    const tArr = [date.getHours(), date.getMinutes() > 9 ? String(date.getMinutes() + 1) : String('0' + date.getMinutes())]
+    return `${dArr.join(df)}${tf ? ' ' : ''}${tArr.join(tf)}`
+}
+//写入最新的版本信息
+const branch = execSync('git symbolic-ref --short -q HEAD')
+    .toString()
+    .trim() // 分支
+const commit = execSync('git show -s --format=%h')
+    .toString()
+    .trim() //版本号
+const message = execSync('git show -s --format=%s')
+    .toString()
+    .trim() //说明
+const name = execSync('git show -s --format=%cn')
+    .toString()
+    .trim() //姓名
+const email = execSync('git show -s --format=%ce')
+    .toString()
+    .trim() //邮箱
+//const date = execSync('git show -s --format=%cd').toString().trim(); //日期
+const versionStr = `git:${commit}<${branch}>\n作者:${name}<${email}>\n日期:${getDate('-', ':')}\n说明:${message}\n`
+fs.writeFile(`${buildPath}/version.txt`, versionStr, (err) => {
+    if (err) console.err('写入失败', err)
+})
+
+// 打包文件命名
+const distName = `打包命名:${buildPath}_${getDate('', '')}_git_${commit}`
+
+// 程序运行结束
+console.info(
+    '\x1B[32m%s\x1b[0m',
+    [
+        distName,
+        versionStr,
+        '██████╗ ███████╗██████╗ ███████╗ █████╗  ██████╗██╗   ██╗',
+        '██╔══██╗██╔════╝██╔══██╗██╔════╝██╔══██╗██╔════╝╚██╗ ██╔╝',
+        '██████╔╝█████╗  ██████╔╝███████╗███████║██║  ███╗╚████╔╝ ',
+        '██╔═══╝ ██╔══╝  ██╔══██╗╚════██║██╔══██║██║   ██║ ╚██╔╝  ',
+        '██║     ███████╗██║  ██║███████║██║  ██║╚██████╔╝  ██║   ',
+        '╚═╝     ╚══════╝╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝ ╚═════╝   ╚═╝   ',
+    ].join('\n')
+)

+ 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",