2 Commits 3b09c050e3 ... 393cf7a716

Author SHA1 Message Date
  aleyds 393cf7a716 Merge branch 'master' of http://dzgogs.hw.hongweisoft.com/tourism_project/tourism_admin_ui 11 months ago
  aleyds 538446f081 自动打包 11 months ago
4 changed files with 47 additions and 9 deletions
  1. 35 0
      deploy/index.js
  2. 5 2
      package.json
  3. 4 4
      src/api/monitor/logininfor.js
  4. 3 3
      src/api/monitor/operlog.js

+ 35 - 0
deploy/index.js

@@ -0,0 +1,35 @@
+const chalk = require('chalk')
+const scpClient = require('scp2')
+let server = {}
+
+//需要根据不同项目进行配置
+console.log(chalk.white('部署环境:'+ process.env.NODE_ENV))
+if (process.env.NODE_ENV === 'prod'){
+  server = {
+    host:'172.16.90.65',//服务器IP
+    port:22,//服务器端口
+    username:'root',//服务器ssh登录用户名
+    password:'hongwei$123',//服务器ssh登录密码
+    path:'/www/wwwroot/tourismadmin.dev.gztjy.top'//服务器web目录
+  }
+}else{
+  server = {
+    host:'172.16.90.64',//服务器IP
+    port:22,//服务器端口
+    username:'root',//服务器ssh登录用户名
+    password:'hongwei$123',//服务器ssh登录密码
+    path:'/www/wwwroot/tourismadmin.dev.gztjy.top'//服务器web目录
+  }
+}
+
+console.log(chalk.blue('项目部署到服务器:'+ server.host))
+console.log(chalk.blue('部署目录:'+ server.path))
+scpClient.scp('dist/', server ,(err)=>{
+  console.log(chalk.green('部署完成'))
+  if(err){
+    console.log(chalk.red('部署失败'))
+    throw err
+  }else{
+    console.log(chalk.green('部署成功'))
+  }
+})

+ 5 - 2
package.json

@@ -9,7 +9,9 @@
     "build:prod": "vue-cli-service build",
     "build:stage": "vue-cli-service build --mode staging",
     "preview": "node build/index.js --preview",
-    "lint": "eslint --ext .js,.vue src"
+    "lint": "eslint --ext .js,.vue src",
+    "deploy:dev": "npm run build:prod && cross-env NODE_ENV=dev node deploy/index.js --preview",
+    "deploy:prod": "npm run build:prod && cross-env NODE_ENV=prod node deploy/index.js --preview"
   },
   "husky": {
     "hooks": {
@@ -50,6 +52,7 @@
     "jsencrypt": "3.0.0-rc.1",
     "nprogress": "0.2.0",
     "quill": "1.3.7",
+    "scp2": "^0.5.0",
     "screenfull": "5.0.2",
     "sortablejs": "1.10.2",
     "vue": "2.6.12",
@@ -66,7 +69,7 @@
     "@vue/cli-service": "4.4.6",
     "babel-eslint": "10.1.0",
     "babel-plugin-dynamic-import-node": "2.3.3",
-    "chalk": "4.1.0",
+    "chalk": "^4.1.0",
     "compression-webpack-plugin": "5.0.2",
     "connect": "3.6.6",
     "eslint": "7.15.0",

+ 4 - 4
src/api/monitor/logininfor.js

@@ -3,7 +3,7 @@ import request from '@/utils/request'
 // 查询登录日志列表
 export function list(query) {
   return request({
-    url: '/monitor/logininfor/list',
+    url: '/system/logininfor/list',
     method: 'get',
     params: query
   })
@@ -12,7 +12,7 @@ export function list(query) {
 // 删除登录日志
 export function delLogininfor(infoId) {
   return request({
-    url: '/monitor/logininfor/' + infoId,
+    url: '/system/logininfor/' + infoId,
     method: 'delete'
   })
 }
@@ -20,7 +20,7 @@ export function delLogininfor(infoId) {
 // 解锁用户登录状态
 export function unlockLogininfor(userName) {
   return request({
-    url: '/monitor/logininfor/unlock/' + userName,
+    url: '/system/logininfor/unlock/' + userName,
     method: 'get'
   })
 }
@@ -28,7 +28,7 @@ export function unlockLogininfor(userName) {
 // 清空登录日志
 export function cleanLogininfor() {
   return request({
-    url: '/monitor/logininfor/clean',
+    url: '/system/logininfor/clean',
     method: 'delete'
   })
 }

+ 3 - 3
src/api/monitor/operlog.js

@@ -3,7 +3,7 @@ import request from '@/utils/request'
 // 查询操作日志列表
 export function list(query) {
   return request({
-    url: '/monitor/operlog/list',
+    url: '/system/operlog/list',
     method: 'get',
     params: query
   })
@@ -12,7 +12,7 @@ export function list(query) {
 // 删除操作日志
 export function delOperlog(operId) {
   return request({
-    url: '/monitor/operlog/' + operId,
+    url: '/system/operlog/' + operId,
     method: 'delete'
   })
 }
@@ -20,7 +20,7 @@ export function delOperlog(operId) {
 // 清空操作日志
 export function cleanOperlog() {
   return request({
-    url: '/monitor/operlog/clean',
+    url: '/system/operlog/clean',
     method: 'delete'
   })
 }