发布配置
This commit is contained in:
parent
c0ed291e17
commit
1051c682d3
|
|
@ -1,8 +1,8 @@
|
|||
# 页面标题
|
||||
VUE_APP_TITLE = 博诺思管理系统
|
||||
VUE_APP_TITLE = 绿智食堂
|
||||
|
||||
# 生产环境配置
|
||||
ENV = 'production'
|
||||
|
||||
# 博诺思管理系统/生产环境
|
||||
VUE_APP_BASE_API = '/prod-api'
|
||||
# 绿智食堂/生产环境
|
||||
VUE_APP_BASE_API = '/canteen/dev-api'
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "bonus",
|
||||
"version": "3.6.4",
|
||||
"description": "博诺思管理系统",
|
||||
"description": "绿智食堂",
|
||||
"author": "博诺思",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ export default {
|
|||
}
|
||||
},
|
||||
computed: {
|
||||
routes() {
|
||||
routes() {
|
||||
return this.$store.getters.permission_routes
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ export default {
|
|||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$store.dispatch('LogOut').then(() => {
|
||||
location.href = '/index';
|
||||
location.href = '/canteen/glweb/';
|
||||
})
|
||||
}).catch(() => {});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@
|
|||
|
||||
<script>
|
||||
import { isExternal } from '@/utils/validate'
|
||||
|
||||
import { getToken } from '@/utils/auth'
|
||||
import { encryptCBC, decryptCBC } from '@/utils/aescbc';
|
||||
import { decryptWithSM4,encryptWithSM4,hashWithSM3AndSalt } from '@/utils/sm'
|
||||
export default {
|
||||
props: {
|
||||
to: {
|
||||
|
|
@ -28,8 +30,13 @@ export default {
|
|||
methods: {
|
||||
linkProps(to) {
|
||||
if (this.isExternal) {
|
||||
// console.log(to)
|
||||
console.log(this.$store.getters.phonenumber)
|
||||
console.log(hashWithSM3AndSalt(this.$store.getters.phonenumber));
|
||||
console.log(encryptWithSM4(this.$store.getters.phonenumber+"|"+hashWithSM3AndSalt(this.$store.getters.phonenumber)))
|
||||
return {
|
||||
href: to,
|
||||
href: to + ( getToken() ? '?token='+ getToken():'')+('&phonenumber='+encryptWithSM4(this.$store.getters.phonenumber+"|"+hashWithSM3AndSalt(this.$store.getters.phonenumber))),
|
||||
// href: to,
|
||||
target: '_blank',
|
||||
rel: 'noopener'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ export default {
|
|||
}
|
||||
},
|
||||
created() {
|
||||
this.checkPasswordStatus()
|
||||
// this.checkPasswordStatus()
|
||||
},
|
||||
methods: {
|
||||
checkPasswordStatus() {
|
||||
|
|
@ -138,7 +138,7 @@ export default {
|
|||
},
|
||||
close() {
|
||||
this.$store.dispatch('LogOut').then(() => {
|
||||
location.href = '/index';
|
||||
location.href = '/canteen/glweb/';
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -177,7 +177,8 @@ Router.prototype.replace = function push(location) {
|
|||
}
|
||||
|
||||
export default new Router({
|
||||
mode: 'history', // 去掉url中的#
|
||||
mode: 'hash', // 去掉url中的#
|
||||
scrollBehavior: () => ({ y: 0 }),
|
||||
base:"/canteen/",
|
||||
routes: constantRoutes
|
||||
})
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ const getters = {
|
|||
visitedViews: state => state.tagsView.visitedViews,
|
||||
cachedViews: state => state.tagsView.cachedViews,
|
||||
token: state => state.user.token,
|
||||
phonenumber: state => state.user.phonenumber,
|
||||
avatar: state => state.user.avatar,
|
||||
name: state => state.user.name,
|
||||
introduction: state => state.user.introduction,
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ const buildPayload = ({ loginMethod, username, password, uuid, code, mobile, ver
|
|||
const user = {
|
||||
state: {
|
||||
token: getToken(),
|
||||
phonenumber: '',
|
||||
id: '',
|
||||
name: '',
|
||||
avatar: '',
|
||||
|
|
@ -46,6 +47,9 @@ const user = {
|
|||
SET_TOKEN(state, token) {
|
||||
state.token = token
|
||||
},
|
||||
SET_PHONE(state, phonenumber) {
|
||||
state.phonenumber = phonenumber
|
||||
},
|
||||
SET_EXPIRES_IN(state, time) {
|
||||
state.expires_in = time
|
||||
},
|
||||
|
|
@ -118,6 +122,7 @@ const user = {
|
|||
commit('SET_PERMISSIONS', res.permissions)
|
||||
commit('SET_ID', user.userId)
|
||||
commit('SET_NAME', user.userName)
|
||||
commit('SET_PHONE', user.phonenumber)
|
||||
commit('SET_AVATAR', avatar)
|
||||
return res
|
||||
})
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@ const DATA_SETTINGS = {
|
|||
// SM 配置
|
||||
const SM_CONFIG = {
|
||||
SALT: '2cc0c5f9f1749f1632efa9f63e902323', // SM3 盐值(16 字节)
|
||||
SM4_KEY: 'your-sm4-key', // SM4 对称加密密钥
|
||||
SM4_KEY:"78d1295afa99449b99d6f83820e6965c", // SM4 对称加密密钥
|
||||
SM4_SALT:"f555adf6c01d0ab0761e626a2dae34a2",
|
||||
SM2_PUBLIC_KEY: 'your-public-key', // SM2 公钥
|
||||
SM2_PRIVATE_KEY: 'your-private-key' // SM2 私钥
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ service.interceptors.response.use(res => {
|
|||
}).then(() => {
|
||||
isRelogin.show = false
|
||||
store.dispatch('LogOut').then(() => {
|
||||
location.href = '/index'
|
||||
location.href = '/canteen/glweb/'
|
||||
})
|
||||
}).catch(() => {
|
||||
isRelogin.show = false
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
import { sm2, sm3, sm4 } from 'sm-crypto'
|
||||
// 配置项,例如盐值、SM2 公私钥、SM4 密钥
|
||||
import { SM_CONFIG } from './configure'
|
||||
|
||||
import SM4 from 'sm-crypto/src/sm4'
|
||||
import { hexToArray } from 'sm-crypto/src/sm2/utils'
|
||||
|
||||
// SM3 哈希
|
||||
export function hashSM3(text) {
|
||||
|
|
@ -29,15 +30,21 @@ export function decryptWithSM2(encryptedText) {
|
|||
// SM2 私钥解密
|
||||
return sm2.doDecrypt(encryptedText, SM_CONFIG.SM2_PRIVATE_KEY)
|
||||
}
|
||||
|
||||
// SM4 加密
|
||||
export function encryptWithSM4(text) {
|
||||
// SM4 对称加密,ECB 模式
|
||||
return sm4.encrypt(text, SM_CONFIG.SM4_KEY)
|
||||
/**
|
||||
* 加密函数
|
||||
* @param {string} plainText
|
||||
* @returns {string} 加密后的密文(Hex 编码格式)
|
||||
*/
|
||||
export function encryptWithSM4(plainText) {
|
||||
return sm4.encrypt(plainText, SM_CONFIG.SM4_KEY,{ mode: 'cbc', padding: 'pkcs#5',iv:SM_CONFIG.SM4_SALT});
|
||||
}
|
||||
|
||||
// SM4 解密
|
||||
export function decryptWithSM4(encryptedText) {
|
||||
// SM4 对称解密,ECB 模式
|
||||
return sm4.decrypt(encryptedText, SM_CONFIG.SM4_KEY)
|
||||
/**
|
||||
* 解密函数
|
||||
* @param {string} cipherText
|
||||
* @returns {string} 解密后的明文
|
||||
*/
|
||||
export function decryptWithSM4(cipherText){
|
||||
return SM4.decrypt(cipherText, SM_CONFIG.SM4_KEY,{ mode: 'cbc', padding: 'pkcs#5' ,iv:SM_CONFIG.SM4_SALT});
|
||||
}
|
||||
|
||||
|
|
@ -7,7 +7,7 @@ function resolve(dir) {
|
|||
|
||||
const CompressionPlugin = require('compression-webpack-plugin')
|
||||
|
||||
const name = process.env.VUE_APP_TITLE || '博诺思管理系统' // 网页标题
|
||||
const name = process.env.VUE_APP_TITLE || '绿智食堂' // 网页标题
|
||||
|
||||
const port = process.env.port || process.env.npm_config_port || 80 // 端口
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ module.exports = {
|
|||
// 部署生产环境和开发环境下的URL。
|
||||
// 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上
|
||||
// 例如 https://www.bonus.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.bonus.vip/admin/,则设置 baseUrl 为 /admin/。
|
||||
publicPath: process.env.NODE_ENV === "production" ? "/" : "/",
|
||||
publicPath: process.env.NODE_ENV === "production" ? "/canteen/glweb/" : "/",
|
||||
// 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist)
|
||||
outputDir: 'dist',
|
||||
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)
|
||||
|
|
@ -35,7 +35,8 @@ module.exports = {
|
|||
proxy: {
|
||||
// detail: https://cli.vuejs.org/config/#devserver-proxy
|
||||
[process.env.VUE_APP_BASE_API]: {
|
||||
target: `http://localhost:18080`,
|
||||
// target: `http://localhost:18080`,
|
||||
target: `http://192.168.0.244:58580`,
|
||||
changeOrigin: true,
|
||||
pathRewrite: {
|
||||
['^' + process.env.VUE_APP_BASE_API]: ''
|
||||
|
|
|
|||
Loading…
Reference in New Issue