From 5fc6bc12240277744d7e8d4d5140102fc00eb857 Mon Sep 17 00:00:00 2001 From: icssoa <2570063477@qq.com> Date: Wed, 10 Mar 2021 13:06:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- public/theme/black.css | 8 + src/assets/css/common.scss | 12 +- src/assets/css/element-variables.scss | 2 +- src/config/env.js | 5 +- src/cool/modules/base/common/index.js | 11 +- .../base/components/menu/slider/index.js | 4 +- src/cool/modules/base/store/app.js | 34 +- src/cool/modules/base/store/menu.js | 4 +- src/cool/modules/task/components/cron/base.js | 459 +++++++++++ src/cool/modules/task/components/cron/cn.js | 54 ++ .../modules/task/components/cron/cron.vue | 774 ++++++++++++++++++ .../modules/task/components/cron/index.js | 80 ++ src/cool/modules/task/views/task.vue | 8 +- src/cool/modules/theme/components/index.js | 5 + src/cool/modules/theme/components/theme.vue | 285 +++++++ src/cool/modules/theme/index.js | 3 + src/cool/modules/upload/components/index.vue | 13 +- src/pages/layout/index.vue | 4 +- src/pages/layout/slider.vue | 4 +- src/pages/layout/topbar.vue | 6 +- vue.config.js | 2 +- 22 files changed, 1726 insertions(+), 53 deletions(-) create mode 100644 src/cool/modules/task/components/cron/base.js create mode 100644 src/cool/modules/task/components/cron/cn.js create mode 100644 src/cool/modules/task/components/cron/cron.vue create mode 100644 src/cool/modules/task/components/cron/index.js create mode 100644 src/cool/modules/theme/components/index.js create mode 100644 src/cool/modules/theme/components/theme.vue create mode 100644 src/cool/modules/theme/index.js diff --git a/package.json b/package.json index b91f8d8..73a6dec 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "cl-admin": "^1.3.1", "cl-admin-crud": "^1.4.0", "cl-admin-export": "^1.0.5", - "cl-admin-theme": "^0.0.2", + "cl-admin-theme": "^0.0.3", "clipboard": "^2.0.7", "codemirror": "^5.59.4", "core-js": "^3.6.5", diff --git a/public/theme/black.css b/public/theme/black.css index 65566b0..180f968 100644 --- a/public/theme/black.css +++ b/public/theme/black.css @@ -13124,6 +13124,13 @@ margin: 0; } +.app-slider .cl-slider-menu .el-menu .el-submenu__title:hover, +.app-slider .cl-slider-menu .el-menu .el-submenu__title.is-active, +.app-slider .cl-slider-menu .el-menu .el-menu-item:hover, +.app-slider .cl-slider-menu .el-menu .el-menu-item.is-active { + background-color: #1d1a1a !important; +} + .page-layout__right { background-color: rgba(47, 52, 71, 0.9); } @@ -13159,3 +13166,4 @@ .page-layout__topbar .cl-menu-topbar .el-menu .el-menu-item.is-active { background-color: rgba(47, 52, 71, 0.8) !important; } +/*# sourceMappingURL=index.css.map */ diff --git a/src/assets/css/common.scss b/src/assets/css/common.scss index 1aac0a0..4e1098c 100644 --- a/src/assets/css/common.scss +++ b/src/assets/css/common.scss @@ -1,5 +1,15 @@ -$color-primary: #4165d7; +$primary: #4165d7; + +$color-primary: var(--color-primary, $primary); $color-success: #67c23a; $color-danger: #f56c6c; $color-info: #909399; $color-warning: #e6a23c; + +:export { + colorPrimary: $primary; + colorSuccess: $color-success; + colorDanger: $color-danger; + colorInfo: $color-info; + colorWarning: $color-warning; +} diff --git a/src/assets/css/element-variables.scss b/src/assets/css/element-variables.scss index 28b86c4..6b287e4 100644 --- a/src/assets/css/element-variables.scss +++ b/src/assets/css/element-variables.scss @@ -1,4 +1,4 @@ -$--color-primary: $color-primary; +$--color-primary: $primary; $--color-success: $color-success; $--color-danger: $color-danger; $--color-warning: $color-warning; diff --git a/src/config/env.js b/src/config/env.js index 5130a1e..0e82181 100644 --- a/src/config/env.js +++ b/src/config/env.js @@ -30,7 +30,7 @@ export const baseUrl = (function() { export const iconfontUrl = ``; // 程序配置参数 -export const app = { +export const app = store.get("__app__") || { name: "COOL-ADMIN", conf: { @@ -41,7 +41,8 @@ export const app = { }, theme: { - url: "" // 主题样式地址 + color: "", // 主题色 + url: "http://192.168.199.148:5000/black/index.css" // 主题样式地址 } }; diff --git a/src/cool/modules/base/common/index.js b/src/cool/modules/base/common/index.js index eb446d1..484427d 100644 --- a/src/cool/modules/base/common/index.js +++ b/src/cool/modules/base/common/index.js @@ -1,10 +1,17 @@ import { iconfontUrl, app } from "@/config/env"; import { createLink } from "../utils"; +import { colorPrimary } from "@/assets/css/common.scss"; if (app.theme) { - if (app.theme.url) { - createLink(app.theme.url); + const { url, color } = app.theme; + + if (url) { + createLink(url, "theme-style"); } + + document + .getElementsByTagName("body")[0] + .style.setProperty("--color-primary", color || colorPrimary); } if (iconfontUrl) { diff --git a/src/cool/modules/base/components/menu/slider/index.js b/src/cool/modules/base/components/menu/slider/index.js index 6aa2afb..a99a51a 100644 --- a/src/cool/modules/base/components/menu/slider/index.js +++ b/src/cool/modules/base/components/menu/slider/index.js @@ -11,14 +11,14 @@ export default { }, computed: { - ...mapGetters(["menuList", "menuCollapse", "browser", "conf"]) + ...mapGetters(["menuList", "menuCollapse", "browser", "app"]) }, watch: { menuList() { this.refresh(); }, - "conf.showAMenu"() { + "app.conf.showAMenu"() { this.$store.commit("SET_MENU_LIST"); } }, diff --git a/src/cool/modules/base/store/app.js b/src/cool/modules/base/store/app.js index a8c7a5b..38961ca 100644 --- a/src/cool/modules/base/store/app.js +++ b/src/cool/modules/base/store/app.js @@ -1,33 +1,27 @@ import { app } from "@/config/env"; import { deepMerge, getBrowser } from "cl-admin/utils"; +import store from "store"; +import common from "@/assets/css/common.scss"; + +console.log(common); export default { state: { info: { - name: app.name - }, - conf: { - ...app.conf + ...app }, browser: { isMobile: false }, - collapse: false, - upload: { - mode: "local" - } + collapse: false }, getters: { - // 应用信息 - appInfo: state => state.info, // 应用配置 - conf: state => state.conf, + app: state => state.info, // 浏览器信息 browser: state => state.browser, // 左侧菜单是否收起 - menuCollapse: state => state.collapse, - // 上传配置 - upload: state => state.upload + menuCollapse: state => state.collapse }, actions: { appLoad({ getters, dispatch }) { @@ -36,14 +30,7 @@ export default { dispatch("permMenu"); // 获取用户信息 dispatch("userInfo"); - // 设置上传配置 - dispatch("setUpload"); } - }, - setUpload({ state }) { - this.$service.common.uploadMode().then(res => { - state.upload = res; - }); } }, mutations: { @@ -58,8 +45,9 @@ export default { }, // 更新应用配置 - UPDATE_CONF(state, val) { - deepMerge(state.conf, val); + UPDATE_APP(state, val) { + deepMerge(state.info, val); + store.set("__app__", state.info); } } }; diff --git a/src/cool/modules/base/store/menu.js b/src/cool/modules/base/store/menu.js index 7574e7c..fe959d0 100644 --- a/src/cool/modules/base/store/menu.js +++ b/src/cool/modules/base/store/menu.js @@ -82,7 +82,7 @@ export default { }; // 监测自定义菜单 - if (!getters.conf.customMenu) { + if (!getters.app.conf.customMenu) { this.$service.common .permMenu() .then(res => { @@ -118,7 +118,7 @@ export default { // 设置左侧菜单 SET_MENU_LIST(state, index) { - const { showAMenu } = this.getters.conf; + const { showAMenu } = this.getters.app.conf; if (isEmpty(index)) { index = state.index; diff --git a/src/cool/modules/task/components/cron/base.js b/src/cool/modules/task/components/cron/base.js new file mode 100644 index 0000000..6f406d5 --- /dev/null +++ b/src/cool/modules/task/components/cron/base.js @@ -0,0 +1,459 @@ +/** + * 表单项基础类, 所有输入组件都继承Base + * @module $ui/components/my-form/src/Base + */ + +import { FormItem } from "element-ui"; +import { setStyle } from "element-ui/lib/utils/dom"; +import { addResizeListener, removeResizeListener } from "element-ui/lib/utils/resize-event"; + +const _get = require("lodash/get"); +const _set = require("lodash/set"); +const _isEqual = require("lodash/isEqual"); +const _cloneDeep = require("lodash/cloneDeep"); + +/** + * 深拷贝 + * @param {*} value 要深拷贝的值 + * @return {*} 返回拷贝后的值 + */ +export function cloneDeep(value) { + return _cloneDeep(value); +} + +/** + * 判断两个对象是否相等 + * @param {*} object 对象1 + * @param {*} other 对象2 + * @return {boolean} + */ +export function isEqual(object, other) { + return _isEqual(object, other); +} +/** + * 插槽 + * @member slots + * @property {string} before 输入组件前面的内容,仅当父组件是MyForm有效 + * @property {string} after 输入组件后面的内容,仅当父组件是MyForm有效 + * @property {string} label 定义字段的label内容,仅当父组件是MyForm有效 + * @property {string} error 作用域插槽,定义验证错误提示内容,仅当父组件是MyForm有效 + */ + +export default { + inject: { + myForm: { + default: null + } + }, + components: { + FormItem + }, + /** + * 属性参数 + * @member props + * @property {string} [name] 表单域 model 字段名称, 等价于 el-form-item 的 prop 参数 + * @property {string} [width] 宽度,css属性,支持像素,百分比和表达式,也可以在MyForm中统一设置itemWidth + * @property {object} [props] 输入组件参数对象,即 element 组件的参数 + * @property {Array} [options] 选项数据,数据优先顺序,options > loader > form.dictMap > form.loader + * @property {Object} [keyMap] 选项数据对象属性名称映射, 默认:{id, parentId, label, value} + * @property {boolean} [collapsible] 可收起 + * @property {boolean} [stopEnterEvent] 阻止回车事件冒泡 + * @property {string} [depend] 依赖字段名称 + * @property {*} [dependValue] 依赖字段的值,即依赖字段的值等于该值才会显示 + * @property {string} [cascade] 级联的上级字段名称,需要与loader配合加载数据 + * @property {Function} [loader] 加载数据函数,必须返回Promise + * @property {string} [dict] 字典名称,只是标识,需要与loader配合 或 表单的dictMap加载数据 + * @property {boolean} [disabled] 禁用 + * @property {boolean} [readonly] 只读 + * @property {string} [placeholder] 占位文本 + * + */ + props: { + // 表单域 model 字段名称 + name: String, + // 宽度,支持像素,百分比和表达式 + width: String, + // 输入组件参数对象 + props: Object, + // 选项数据,数据优先顺序,options > loader > form.dictMap > form.loader + options: Array, + // 选项数据对象属性名称映射 + keyMap: { + type: Object, + default() { + return { + id: "id", + label: "label", + value: "value", + disabled: "disabled", + parentId: "parentId" + }; + } + }, + // 可折叠 + collapsible: Boolean, + + // 阻止回车事件冒泡 + stopEnterEvent: Boolean, + + // 依赖字段名称 + depend: String, + + // 依赖字段的值,即依赖字段的值等于该值才会显示 + dependValue: [String, Number, Boolean, Object, Array, Function], + + // 级联的上级字段名称,需要与loader配合加载数据 + cascade: String, + + // 加载数据函数,必须返回Promise + loader: Function, + + // 字典名称,只是标识,需要与loader配合 或 表单的dictMap加载数据 + dict: String, + + // 禁用 + disabled: Boolean, + // 只读 + readonly: Boolean, + + // 占位文本 + placeholder: String, + + // 尺寸 + size: String + }, + data() { + return { + // 级联的值缓存 + cascadeValue: null, + // 当前选项数据 + currentOptions: [], + + // 正在调用loader + loading: false + }; + }, + computed: { + // 如果有name参数,并且是MyForm的子组件,即与MyForm的currentModel作双向绑定 + // 否则与组件自身的value作双向绑定 + fieldValue: { + get() { + if (this.name && this.myForm) { + const { currentModel } = this.myForm; + return _get(currentModel, this.name, this.getDefaultValue()); + } else { + return this.value || this.getDefaultValue(); + } + }, + set(val) { + if (this.name && this.myForm) { + const { currentModel } = this.myForm; + const model = cloneDeep(currentModel); + _set(model, this.name, val); + if (!isEqual(currentModel, model)) { + this.myForm.currentModel[this.name] = model[this.name]; + this.myForm.currentModel = model; + } + } else { + this.$emit("input", val); + } + } + }, + // 字段域的宽度 + itemWidth() { + // 优先取自身设置的宽度,没有就取父组件设置的公共设置宽度 + return ( + this.width || (this.myForm && this.myForm.itemWidth ? this.myForm.itemWidth : null) + ); + }, + // 字段域样式 + itemStyle() { + return { + width: this.itemWidth + }; + }, + // 输入框组件参数 + innerProps() { + return { + disabled: this.disabled, + readonly: this.readonly, + placeholder: this.placeholder, + size: this.size, + ...this.props + }; + } + }, + watch: { + itemWidth: { + immediate: true, + handler() { + this.$nextTick(() => { + this.setContentWidth(); + }); + } + }, + "myForm.currentCollapsed"(val) { + const { resetCollapsed, model } = this.myForm; + // 收起时重置表单项值 + if (val && resetCollapsed && model && this.collapsible) { + this.$nextTick(() => { + // this.fieldValue = this.myForm.model[this.name] + this.fieldValue = _get(this.myForm.model, this.name, this.getDefaultValue()); + }); + } + // 开启了折叠功能 + if (this.collapsible) { + // 折叠时先要清除事件句柄,因为原先的dom即将发生改变 + if (val) { + removeResizeListener(this.$el, this.setContentWidth); + } else { + // 如果没有加载过选项数据,触发加载函数 + if (!this.currentOptions || this.currentOptions.length === 0) { + this.loadOptions(this.myForm.currentModel, this); + } + // 展开时,待DOM生成后,重新注册事件句柄 + this.$nextTick(() => { + addResizeListener(this.$el, this.setContentWidth); + this.setContentWidth(); + }); + } + } + }, + // options 为了提高性能,不设置deep + options: { + immediate: true, + handler(val) { + this.currentOptions = cloneDeep(val) || []; + // options改变后,会触发表单验证,这里需要清楚验证错误信息 + this.$nextTick(() => { + this.clearValidate(); + }); + } + } + }, + methods: { + // 获取表单项的默认值,不同组件有不同的默认值,可在具体的组件重写这个函数 + getDefaultValue() { + return ""; + }, + // 重置字段 + resetField() { + this.$refs.elItem && this.$refs.elItem.resetField(); + }, + // 清除验证错误信息 + clearValidate() { + this.$refs.elItem && this.$refs.elItem.clearValidate(); + }, + isCollapsed() { + if (!this.myForm) return false; + + const { collapsible, currentCollapsed } = this.myForm; + // 是否已收起 + return collapsible && currentCollapsed && this.collapsible; + }, + isMatchDepend() { + // 没有设置依赖,即忽略,当已匹配处理 + if (!this.depend || !this.myForm) return true; + const model = this.myForm.currentModel; + // 依赖不支持 按路径查找 + const value = model[this.depend]; + let isMatch = true; + // 如果 dependValue 是函数,执行回调函数返回布尔值 + if (typeof this.dependValue === "function") { + isMatch = this.dependValue(value, model, this); + } else { + // 以上都不符合,即检验 dependValue 与 currentModel中的依赖属性是否一致 + isMatch = isEqual(this.dependValue, value); + } + + // 清除依赖不符合字段的值 + if (!isMatch && this.name && model[this.name]) { + this.fieldValue = this.getDefaultValue(); + delete model[this.name]; + } + return isMatch; + }, + // 传递给输入组件的插槽 + createSlots(slots = []) { + return slots.map(name => { + return ; + }); + }, + // 渲染输入组件 + renderComponent(vnode) { + // 如果组件不是MyForm的子组件,不需要包裹Item组件 + if (!this.myForm) { + return vnode; + } + // el-form-item 作用域插槽 + const scopedSlots = this.$scopedSlots.error + ? { + error: props => ( +
+ {this.$scopedSlots.error(props)} +
+ ) + } + : null; + + // 是否已收起 + const collapsed = this.isCollapsed(); + // 是否符合依赖项 + const isMatched = this.isMatchDepend(); + + return ( + + {!collapsed && isMatched ? ( + + {// label 插槽 + this.$slots.label ? ( + + ) : null} + {this.$slots.before} + {vnode} + {this.$slots.after} + + ) : ( + // Vue组件必须要有一个根DOM,创建一个隐藏占位元素 +
{this.name}
+ )} +
+ ); + }, + // 继承输入组件暴露的方法 + extendMethods(ref, names = []) { + if (!ref) return; + + names.forEach(name => { + // 子组件的方法加到实例 + this[name] = (...args) => { + ref[name].apply(ref, args); + }; + }); + }, + // 设置el-form-item内部的内容区宽度 + setContentWidth() { + // 字段域没有设置宽度,默认自适应,不需要处理 + if (!this.itemWidth || !this.$el) return; + const content = this.$el.querySelector(".el-form-item__content"); + const label = this.$el.querySelector(".el-form-item__label"); + if (content) { + const rect = label ? label.getBoundingClientRect() : { width: 0 }; + const itemWidth = this.$el.getBoundingClientRect().width; + const contentWidth = itemWidth - rect.width; + setStyle(content, { width: `${contentWidth}px` }); + } + }, + // 阻止回车事件冒泡 + stopEvent(e) { + if (this.stopEnterEvent) { + e.stopPropagation(); + } + }, + // 加载选项数据 + loadOptions(model) { + // 已收起的,不需要处理 + if (this.isCollapsed()) return; + + // 如果不符合依赖,不处理 + if (!this.isMatchDepend()) return; + + // 数据优先顺序,options > loader > form.dictMap > form.loader + if (this.options) { + this.currentOptions = cloneDeep(this.options); + return; + } + + if (this.loader) { + this.loading = true; + this.loader(model, this) + .then(res => { + this.currentOptions = cloneDeep(res); + }) + .finally(() => { + this.loading = false; + }); + return; + } + + // 无form容器,终止 + if (!this.myForm) return; + + if (this.dict) { + const { dictMap } = this.myForm; + const options = (dictMap || {})[this.dict]; + // 建立与表单的字典数据引用 + if (options) { + this.currentOptions = options; + return; + } + } + + if (this.myForm.loader) { + this.loading = true; + this.myForm + .loader(model, this) + .then(res => { + this.currentOptions = cloneDeep(res); + }) + .finally(() => { + this.loading = false; + }); + } + }, + // 响应currentModel改变处理级联加载数据 + handleWatch(model) { + // 级联上级的值 + const val = model[this.cascade]; + // 与上次的值不一致即重新获取数据 + if (!isEqual(this.cascadeValue, val)) { + this.fieldValue = this.getDefaultValue(); + this.cascadeValue = val; + this.loadOptions(model); + } + }, + // 绑定级联 + bindCascade() { + if (this.cascade && this.myForm) { + const model = this.myForm.currentModel; + this.cascadeValue = model[this.cascade]; + this.unwatch = this.$watch("myForm.currentModel", this.handleWatch, { deep: true }); + } + }, + // 销毁级联事件句柄 + unbindCascade() { + this.unwatch && this.unwatch(); + } + }, + mounted() { + addResizeListener(this.$el, this.setContentWidth); + }, + created() { + let model = null; + if (this.myForm) { + this.myForm.addItem(this); + model = this.myForm.currentModel; + } + + this.loadOptions(model, this); + this.bindCascade(); + }, + beforeDestroy() { + removeResizeListener(this.$el, this.setContentWidth); + this.unbindCascade(); + if (this.myForm) { + this.myForm.removeItem(this); + } + } +}; diff --git a/src/cool/modules/task/components/cron/cn.js b/src/cool/modules/task/components/cron/cn.js new file mode 100644 index 0000000..c03dc7f --- /dev/null +++ b/src/cool/modules/task/components/cron/cn.js @@ -0,0 +1,54 @@ +export default { + Seconds: { + name: "秒", + every: "每一秒钟", + interval: ["每隔", "秒执行 从", "秒开始"], + specific: "具体秒数(可多选)", + cycle: ["周期从", "到", "秒"] + }, + Minutes: { + name: "分", + every: "每一分钟", + interval: ["每隔", "分执行 从", "分开始"], + specific: "具体分钟数(可多选)", + cycle: ["周期从", "到", "分"] + }, + Hours: { + name: "时", + every: "每一小时", + interval: ["每隔", "小时执行 从", "小时开始"], + specific: "具体小时数(可多选)", + cycle: ["周期从", "到", "小时"] + }, + Day: { + name: "天", + every: "每一天", + intervalWeek: ["每隔", "周执行 从", "开始"], + intervalDay: ["每隔", "天执行 从", "天开始"], + specificWeek: "具体星期几(可多选)", + specificDay: "具体天数(可多选)", + lastDay: "在这个月的最后一天", + lastWeekday: "在这个月的最后一个工作日", + lastWeek: ["在这个月的最后一个"], + beforeEndMonth: ["在本月底前", "天"], + nearestWeekday: ["最近的工作日(周一至周五)至本月", "日"], + someWeekday: ["在这个月的第", "个"] + }, + Week: ["天", "一", "二", "三", "四", "五", "六"].map(val => "星期" + val), + Month: { + name: "月", + every: "每一月", + interval: ["每隔", "月执行 从", "月开始"], + specific: "具体月数(可多选)", + cycle: ["从", "到", "月之间的每个月"] + }, + Year: { + name: "年", + every: "每一年", + interval: ["每隔", "年执行 从", "年开始"], + specific: "具体年份(可多选)", + cycle: ["从", "到", "年之间的每一年"] + }, + Save: "保存", + Close: "关闭" +}; diff --git a/src/cool/modules/task/components/cron/cron.vue b/src/cool/modules/task/components/cron/cron.vue new file mode 100644 index 0000000..84d39db --- /dev/null +++ b/src/cool/modules/task/components/cron/cron.vue @@ -0,0 +1,774 @@ + + + + diff --git a/src/cool/modules/task/components/cron/index.js b/src/cool/modules/task/components/cron/index.js new file mode 100644 index 0000000..4f085fb --- /dev/null +++ b/src/cool/modules/task/components/cron/index.js @@ -0,0 +1,80 @@ +import Cron from "./cron"; +import Base from "./base"; + +export default { + name: "cl-cron", + + mixins: [Base], + + components: { + Cron + }, + + props: { + value: String, + placeholder: { + type: String, + default: "请输入定时策略" + } + }, + + data() { + return { + cronPopover: false, + cron: "" + }; + }, + + watch: { + cron: { + handler(val) { + this.fieldValue = val; + this.$emit("change", val); + } + }, + value: { + immediate: true, + handler(val) { + this.cron = val; + } + }, + fieldValue: { + immediate: true, + handler(val) { + this.cron = val; + } + } + }, + + methods: { + changeCron(val) { + this.cron = val; + }, + hidePopover() { + this.cronPopover = false; + } + }, + + render() { + const vnode = ( + + + + + ); + return this.renderComponent(vnode); + } +}; diff --git a/src/cool/modules/task/views/task.vue b/src/cool/modules/task/views/task.vue index 1bebf50..96cee4f 100644 --- a/src/cool/modules/task/views/task.vue +++ b/src/cool/modules/task/views/task.vue @@ -200,6 +200,7 @@ import draggable from "vuedraggable"; import { checkPerm } from "@/cool/modules/base"; import { Form, ContextMenu } from "cl-admin-crud"; +import Cron from "../components/cron"; export default { name: "system-task", @@ -467,12 +468,7 @@ export default { return scope.taskType == 1; }, value: info.cron, - component: { - name: "el-input", - attrs: { - placeholder: "* * * * * *" - } - }, + component: Cron, rules: { required: true, message: "cron不能为空" diff --git a/src/cool/modules/theme/components/index.js b/src/cool/modules/theme/components/index.js new file mode 100644 index 0000000..06ef912 --- /dev/null +++ b/src/cool/modules/theme/components/index.js @@ -0,0 +1,5 @@ +import Theme from "./theme"; + +export default { + Theme +}; diff --git a/src/cool/modules/theme/components/theme.vue b/src/cool/modules/theme/components/theme.vue new file mode 100644 index 0000000..45d7131 --- /dev/null +++ b/src/cool/modules/theme/components/theme.vue @@ -0,0 +1,285 @@ + + + + + diff --git a/src/cool/modules/theme/index.js b/src/cool/modules/theme/index.js new file mode 100644 index 0000000..277a61b --- /dev/null +++ b/src/cool/modules/theme/index.js @@ -0,0 +1,3 @@ +import components from "./components"; + +export default { components }; diff --git a/src/cool/modules/upload/components/index.vue b/src/cool/modules/upload/components/index.vue index 5a7d2f6..2f96ea1 100644 --- a/src/cool/modules/upload/components/index.vue +++ b/src/cool/modules/upload/components/index.vue @@ -32,8 +32,6 @@ :http-request="action ? undefined : httpRequest" :on-remove="_onRemove" :on-preview="_onPreview" - :on-success="_onSuccess" - :on-error="onError" :on-progress="onProgress" :on-change="onChange" :on-exceed="onExceed" @@ -188,7 +186,7 @@ export default { }, computed: { - ...mapGetters(["token", "modules", "upload"]), + ...mapGetters(["token", "modules"]), conf() { return this.modules.upload.options; @@ -418,9 +416,9 @@ export default { }, // 重设上传请求 - httpRequest(req) { + async httpRequest(req) { const isRename = isEmpty(this.rename) ? this.conf.rename : this.rename; - const { mode } = this.upload; + const mode = await this.uploadMode(); // 多种上传请求 const upload = file => { @@ -509,6 +507,11 @@ export default { .done(() => { this.loading = false; }); + }, + + // 上传模式 + uploadMode() { + return this.$service.common.uploadMode().then(res => res.mode); } } }; diff --git a/src/pages/layout/index.vue b/src/pages/layout/index.vue index 7334826..4ecfe0f 100644 --- a/src/pages/layout/index.vue +++ b/src/pages/layout/index.vue @@ -11,7 +11,7 @@ -
+
@@ -41,7 +41,7 @@ export default { }, computed: { - ...mapGetters(["menuCollapse", "conf", "browser"]), + ...mapGetters(["menuCollapse", "app", "browser"]), isKeepAlive() { return isEmpty(this.$route.meta.keepAlive) ? true : this.$route.meta.keepAlive; diff --git a/src/pages/layout/slider.vue b/src/pages/layout/slider.vue index 07f296d..39796bb 100644 --- a/src/pages/layout/slider.vue +++ b/src/pages/layout/slider.vue @@ -2,7 +2,7 @@
@@ -16,7 +16,7 @@ import { mapGetters } from "vuex"; export default { computed: { - ...mapGetters(["menuCollapse", "browser", "appInfo"]) + ...mapGetters(["menuCollapse", "browser", "app"]) }, methods: { diff --git a/src/pages/layout/topbar.vue b/src/pages/layout/topbar.vue index 3911f61..340d4b9 100644 --- a/src/pages/layout/topbar.vue +++ b/src/pages/layout/topbar.vue @@ -5,12 +5,12 @@
-
+
-
+
@@ -52,7 +52,7 @@ import { href } from "cl-admin/utils"; export default { computed: { - ...mapGetters(["userInfo", "menuCollapse", "conf", "modules"]) + ...mapGetters(["userInfo", "menuCollapse", "app", "modules"]) }, methods: { diff --git a/vue.config.js b/vue.config.js index b03dd57..db48cb0 100644 --- a/vue.config.js +++ b/vue.config.js @@ -13,7 +13,7 @@ const PROXY_LIST = { }, "/ap": { - target: "https://admin.cn.utools.club", + target: "https://admin.cool-js.cool", changeOrigin: true, pathRewrite: { "^/ap": ""