From 9c0a63b9fd68c5e8dab509f07be2dc0277d736b4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=B0=8F=E8=AF=BA?= <1253070437@qq.com>
Date: Fri, 7 Oct 2022 00:34:26 +0800
Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=9B=B4=E6=96=B0=E3=80=91=E4=BC=98?=
=?UTF-8?q?=E5=8C=96=E5=89=8D=E7=AB=AF=E4=BB=A3=E7=A0=81=EF=BC=8C=E6=9B=B4?=
=?UTF-8?q?=E6=94=B9=E6=A8=A1=E5=9D=97=E5=9D=9E=E5=90=8D=E7=A7=B0=E3=80=81?=
=?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8=E7=9A=84=E5=B7=A5=E5=85=B7?=
=?UTF-8?q?=E7=B1=BB=E3=80=81=E6=93=8D=E4=BD=9C=E6=97=A5=E5=BF=97=E5=A2=9E?=
=?UTF-8?q?=E5=8A=A0IP=E8=B7=9FIP=E5=9C=B0=E5=9D=80=E6=98=BE=E7=A4=BA?=
=?UTF-8?q?=E3=80=81=E4=BF=AE=E5=A4=8D=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0?=
=?UTF-8?q?=E7=BB=84=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/components/XnUpload/index.vue | 33 ++--
snowy-admin-web/src/config/index.js | 2 +-
.../src/layout/components/setting.vue | 2 +-
snowy-admin-web/src/layout/index.vue | 8 +-
snowy-admin-web/src/locales/index.js | 2 +-
snowy-admin-web/src/store/modules/global.js | 2 +-
snowy-admin-web/src/utils/print.js | 156 ------------------
snowy-admin-web/src/utils/smCrypto.js | 2 +-
snowy-admin-web/src/utils/tool.js | 52 +-----
.../src/views/dev/log/oplog/detail.vue | 2 +
.../src/views/dev/log/oplog/index.vue | 8 +
11 files changed, 38 insertions(+), 231 deletions(-)
delete mode 100644 snowy-admin-web/src/utils/print.js
diff --git a/snowy-admin-web/src/components/XnUpload/index.vue b/snowy-admin-web/src/components/XnUpload/index.vue
index 9fcfbef6..0cc7e505 100644
--- a/snowy-admin-web/src/components/XnUpload/index.vue
+++ b/snowy-admin-web/src/components/XnUpload/index.vue
@@ -36,6 +36,7 @@
import tool from '@/utils/tool'
import sysConfig from '@/config/index'
const fileList = ref([])
+ const emit = defineEmits({ uploadDone: null })
const headers = ref({
token: tool.data.get('TOKEN')
})
@@ -45,12 +46,6 @@
default: '/dev/file/uploadDynamicReturnUrl',
required: false
},
- // 允许多个
- allowMultiple: {
- type: Boolean,
- default: false,
- required: false
- },
// 上传方式 defaults || drag
uploadMode: {
type: String,
@@ -66,22 +61,16 @@
})
const action = sysConfig.API_URL + props.action
- const handleChange = () => {}
-
- // 获取上传的内容
- const getUploadData = () => {
- return fileList.value.map((item) => {
- return {
- uid: item.uid,
- name: item.name,
- status: item.status,
- url: item.response.data
+ const handleChange = () => {
+ let result = []
+ for (let a = 0; a < props.uploadMumber; a++) {
+ const file = fileList.value[a]
+ if (file.status === 'done' && file.response && file.response.code === 200) {
+ result.push(file.response.data)
}
- })
+ }
+ if (result.length > 0) {
+ emit('uploadDone', result)
+ }
}
- defineExpose({
- getUploadData
- })
-
-
diff --git a/snowy-admin-web/src/config/index.js b/snowy-admin-web/src/config/index.js
index cefe5647..94638817 100644
--- a/snowy-admin-web/src/config/index.js
+++ b/snowy-admin-web/src/config/index.js
@@ -36,7 +36,7 @@ const DEFAULT_CONFIG = {
// 菜单是否折叠
SNOWY_MENU_COLLAPSE: false,
- // 目录坞
+ // 模块坞
SNOWY_MODULE_UNFOLD_OPEN: true,
// 是否开启多标签
diff --git a/snowy-admin-web/src/layout/components/setting.vue b/snowy-admin-web/src/layout/components/setting.vue
index b39efbc0..66b60eb7 100644
--- a/snowy-admin-web/src/layout/components/setting.vue
+++ b/snowy-admin-web/src/layout/components/setting.vue
@@ -55,7 +55,7 @@
-
+
diff --git a/snowy-admin-web/src/layout/index.vue b/snowy-admin-web/src/layout/index.vue
index 1546f5bf..a9a8de15 100644
--- a/snowy-admin-web/src/layout/index.vue
+++ b/snowy-admin-web/src/layout/index.vue
@@ -484,9 +484,11 @@
: header.classList.remove('snowy-header-primary-color')
// 判断是否开启了通栏
const headerLogin = document.getElementById('snowyHeaderLogo')
- this.topHanderThemeColorSpread
- ? headerLogin.classList.add('snowy-header-logo-primary-color')
- : headerLogin.classList.remove('snowy-header-logo-primary-color')
+ try{
+ this.topHanderThemeColorSpread
+ ? headerLogin.classList.add('snowy-header-logo-primary-color')
+ : headerLogin.classList.remove('snowy-header-logo-primary-color')
+ }catch (e) { }
// 如果是双排菜单,吧第二排的也给渲染了
if (this.layout === 'doublerow') {
const snowyDoublerowSideTop = document.getElementById('snowyDoublerowSideTop')
diff --git a/snowy-admin-web/src/locales/index.js b/snowy-admin-web/src/locales/index.js
index 5b327239..ab3f23cc 100644
--- a/snowy-admin-web/src/locales/index.js
+++ b/snowy-admin-web/src/locales/index.js
@@ -14,7 +14,7 @@ import enGB from 'ant-design-vue/es/locale/en_GB'
import zh_cn from './lang/zh-cn.js'
import en from './lang/en.js'
import tool from '@/utils/tool'
-import sysConfig from '@/config/index.js'
+import sysConfig from '@/config/index'
export const messages = {
'zh-cn': {
diff --git a/snowy-admin-web/src/store/modules/global.js b/snowy-admin-web/src/store/modules/global.js
index 0f364237..f011020a 100644
--- a/snowy-admin-web/src/store/modules/global.js
+++ b/snowy-admin-web/src/store/modules/global.js
@@ -44,7 +44,7 @@ export default {
// 顶栏主题色通栏
topHanderThemeColorSpread:
getCacheConfig('SNOWY_TOP_HANDER_THEME_COLOR_SPREAD'),
- // 目录坞
+ // 模块坞
moduleUnfoldOpen: getCacheConfig('SNOWY_MODULE_UNFOLD_OPEN'),
// 主题
theme: getCacheConfig('SNOWY_THEME'),
diff --git a/snowy-admin-web/src/utils/print.js b/snowy-admin-web/src/utils/print.js
deleted file mode 100644
index 984e804c..00000000
--- a/snowy-admin-web/src/utils/print.js
+++ /dev/null
@@ -1,156 +0,0 @@
-/**
- * Copyright [2022] [https://www.xiaonuo.vip]
- * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
- * 1.请不要删除和修改根目录下的LICENSE文件。
- * 2.请不要删除和修改Snowy源码头部的版权声明。
- * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
- * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
- * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
- * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
- */
-/* eslint-disable */
-// 打印类属性、方法定义
-const Print = function(dom, options) {
- if (!(this instanceof Print)) return new Print(dom, options)
-
- this.options = this.extend({
- noPrint: '.no-print',
- }, options)
-
- if ((typeof dom) === 'string') {
- try {
- this.dom = document.querySelector(dom)
- }
- catch {
- const createDom = document.createElement('div')
- createDom.innerHTML = dom
- this.dom = createDom
- }
- }
- else {
- this.isDOM(dom)
- this.dom = this.isDOM(dom) ? dom : dom.$el
- }
-
- this.init()
-}
-Print.prototype = {
- init() {
- const content = this.getStyle() + this.getHtml()
- this.writeIframe(content)
- },
- extend(obj, obj2) {
- for (const k in obj2) {
- obj[k] = obj2[k]
- }
- return obj
- },
-
- getStyle() {
- let str = ''
- const styles = document.querySelectorAll('style,link')
- for (let i = 0; i < styles.length; i++) {
- str += styles[i].outerHTML
- }
- str += ``
- str += ''
- return str
- },
-
- getHtml() {
- const inputs = document.querySelectorAll('input')
- const textareas = document.querySelectorAll('textarea')
- const selects = document.querySelectorAll('select')
-
- for (let k = 0; k < inputs.length; k++) {
- if (inputs[k].type == 'checkbox' || inputs[k].type == 'radio') {
- if (inputs[k].checked == true) {
- inputs[k].setAttribute('checked', 'checked')
- }
- else {
- inputs[k].removeAttribute('checked')
- }
- }
- else if (inputs[k].type == 'text') {
- inputs[k].setAttribute('value', inputs[k].value)
- }
- else {
- inputs[k].setAttribute('value', inputs[k].value)
- }
- }
-
- for (let k2 = 0; k2 < textareas.length; k2++) {
- if (textareas[k2].type == 'textarea') {
- textareas[k2].innerHTML = textareas[k2].value
- }
- }
-
- for (let k3 = 0; k3 < selects.length; k3++) {
- if (selects[k3].type == 'select-one') {
- const child = selects[k3].children
- for (const i in child) {
- if (child[i].tagName == 'OPTION') {
- if (child[i].selected == true) {
- child[i].setAttribute('selected', 'selected')
- }
- else {
- child[i].removeAttribute('selected')
- }
- }
- }
- }
- }
-
- return this.dom.outerHTML
- },
-
- writeIframe(content) {
- let w; let doc; const iframe = document.createElement('iframe')
- const f = document.body.appendChild(iframe)
- iframe.id = 'myIframe'
- // iframe.style = "position:absolute;width:0;height:0;top:-10px;left:-10px;";
- iframe.setAttribute('style', 'position:absolute;width:0;height:0;top:-10px;left:-10px;')
- w = f.contentWindow || f.contentDocument
- doc = f.contentDocument || f.contentWindow.document
- doc.open()
- doc.write(content)
- doc.close()
- const _this = this
- iframe.onload = function() {
- _this.toPrint(w)
- setTimeout(() => {
- document.body.removeChild(iframe)
- }, 100)
- }
- },
-
- toPrint(frameWindow) {
- try {
- setTimeout(() => {
- frameWindow.focus()
- try {
- if (!frameWindow.document.execCommand('print', false, null)) {
- frameWindow.print()
- }
- }
- catch (e) {
- frameWindow.print()
- }
- frameWindow.close()
- }, 10)
- }
- catch (err) {
- console.log('err', err)
- }
- },
- isDOM: (typeof HTMLElement === 'object')
- ? function(obj) {
- return obj instanceof HTMLElement
- }
- : function(obj) {
- return obj && typeof obj === 'object' && obj.nodeType === 1 && typeof obj.nodeName === 'string'
- },
-}
-
-export default Print
diff --git a/snowy-admin-web/src/utils/smCrypto.js b/snowy-admin-web/src/utils/smCrypto.js
index c01b3caf..882f8d09 100644
--- a/snowy-admin-web/src/utils/smCrypto.js
+++ b/snowy-admin-web/src/utils/smCrypto.js
@@ -49,7 +49,7 @@ export default {
doSm3Hash(msgString) {
return sm3(msgString)
},
- // SM4 CBC加密
+ // SM4 加密
doSm4Encrypt(msgString) {
return sm4.encrypt(msgString, key)
},
diff --git a/snowy-admin-web/src/utils/tool.js b/snowy-admin-web/src/utils/tool.js
index c1beec0f..4105e7d8 100644
--- a/snowy-admin-web/src/utils/tool.js
+++ b/snowy-admin-web/src/utils/tool.js
@@ -14,15 +14,9 @@
* @LastEditors: yubaoshan
* @LastEditTime: 2022年4月19日10:58:41
*/
-
const tool = {}
-/**
- * localStorage
- *
- * @author yubaoshan
- * @date 2022-05-18 22:59
- */
+// localStorage
tool.data = {
set(table, settings) {
const _set = JSON.stringify(settings)
@@ -46,12 +40,7 @@ tool.data = {
}
}
-/**
- * sessionStorage
- *
- * @author yubaoshan
- * @date 2022-05-18 22:59
- */
+// sessionStorage
tool.session = {
set(table, settings) {
const _set = JSON.stringify(settings)
@@ -74,12 +63,7 @@ tool.session = {
}
}
-/**
- * 千分符
- *
- * @author yubaoshan
- * @date 2022-05-18 22:59
- */
+// 千分符
tool.groupSeparator = (num) => {
num = `${num}`
if (!num.includes('.')) num += '.'
@@ -91,24 +75,12 @@ tool.groupSeparator = (num) => {
.replace(/\.$/, '')
}
-/**
- * 获取所有字典数组
- *
- * @author yubaoshan
- * @date 2022-04-08 01:11
- */
+// 获取所有字典数组
tool.dictDataAll = () => {
return tool.data.get('DICT_TYPE_TREE_DATA')
}
-/**
- * 字典翻译方法
- * 界面插槽使用方法 {{ $TOOL.dictType('sex', record.sex) }}
- *
- * @author yubaoshan
- * @date 2022-04-08 01:11
- */
-// todo 每次都从localStorage获取并重新解析,会有性能问题,应该在内存中做一层缓存,后面需要优化掉
+// 字典翻译方法,界面插槽使用方法 {{ $TOOL.dictType('sex', record.sex) }}
tool.dictTypeData = (dictValue, value) => {
const dictTypeTree = tool.dictDataAll()
if (!dictTypeTree) {
@@ -123,12 +95,7 @@ tool.dictTypeData = (dictValue, value) => {
return dict?.name || '无此字典'
}
-/**
- * 获取某个code下字典的列表,多用于字典下拉框
- *
- * @author yubaoshan
- * @date 2022-04-08 01:11
- */
+// 获取某个code下字典的列表,多用于字典下拉框
tool.dictTypeList = (dictValue) => {
const dictTypeTree = tool.dictDataAll()
if (!dictTypeTree) {
@@ -141,12 +108,7 @@ tool.dictTypeList = (dictValue) => {
return []
}
-/**
- * 生成UUID
- *
- * @author yubaoshan
- * @date 2022-05-18 22:59
- */
+// 生成UUID
tool.snowyUuid = () => {
let uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
let r = (Math.random() * 16) | 0,
diff --git a/snowy-admin-web/src/views/dev/log/oplog/detail.vue b/snowy-admin-web/src/views/dev/log/oplog/detail.vue
index 9bc4c8f4..deb694e0 100644
--- a/snowy-admin-web/src/views/dev/log/oplog/detail.vue
+++ b/snowy-admin-web/src/views/dev/log/oplog/detail.vue
@@ -9,6 +9,8 @@
>
{{ formData.name }}
+ {{ formData.opIp }}
+ {{ formData.opAddress }}
{{ formData.reqUrl }}
{{ formData.className }}
{{ formData.methodName }}
diff --git a/snowy-admin-web/src/views/dev/log/oplog/index.vue b/snowy-admin-web/src/views/dev/log/oplog/index.vue
index f60c86ee..7dfb5256 100644
--- a/snowy-admin-web/src/views/dev/log/oplog/index.vue
+++ b/snowy-admin-web/src/views/dev/log/oplog/index.vue
@@ -87,6 +87,14 @@
title: '名称',
dataIndex: 'name'
},
+ {
+ title: 'IP地址',
+ dataIndex: 'opIp'
+ },
+ {
+ title: '地址',
+ dataIndex: 'opAddress'
+ },
{
title: '类名称',
dataIndex: 'className'