From 2ad976ee2570b905d7512ebcd9a8b2713fad5cdb Mon Sep 17 00:00:00 2001 From: lizhixin <382352532@qq.com> Date: Sun, 30 May 2021 02:44:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Collapse/index.js | 74 +++++ src/layout/dashboard/DashboardLayout.vue | 77 ++++- src/main.js | 10 +- src/pages/Account/index.vue | 43 +-- src/pages/ReCheck/MoveTrend.vue | 5 +- src/pages/ReCheck/index.vue | 150 ++++++---- src/pages/Robot/index.vue | 39 ++- src/pages/prePages/ReCheck.vue | 352 ++++++++++++----------- src/router/routes.js | 6 +- 9 files changed, 488 insertions(+), 268 deletions(-) create mode 100644 src/components/Collapse/index.js diff --git a/src/components/Collapse/index.js b/src/components/Collapse/index.js new file mode 100644 index 0000000..8b3a321 --- /dev/null +++ b/src/components/Collapse/index.js @@ -0,0 +1,74 @@ +const elTransition = '0.3s height ease-in-out, 0.3s padding-top ease-in-out, 0.3s padding-bottom ease-in-out' +const Transition = { + 'before-enter'(el) { + el.style.transition = elTransition + if (!el.dataset) el.dataset = {} + + el.dataset.oldPaddingTop = el.style.paddingTop + el.dataset.oldPaddingBottom = el.style.paddingBottom + + el.style.height = 0 + el.style.paddingTop = 0 + el.style.paddingBottom = 0 + }, + + enter(el) { + el.dataset.oldOverflow = el.style.overflow + if (el.scrollHeight !== 0) { + el.style.height = el.scrollHeight + 'px' + el.style.paddingTop = el.dataset.oldPaddingTop + el.style.paddingBottom = el.dataset.oldPaddingBottom + } else { + el.style.height = '' + el.style.paddingTop = el.dataset.oldPaddingTop + el.style.paddingBottom = el.dataset.oldPaddingBottom + } + + el.style.overflow = 'hidden' + }, + + 'after-enter'(el) { + el.style.transition = '' + el.style.height = '' + el.style.overflow = el.dataset.oldOverflow + }, + + 'before-leave'(el) { + if (!el.dataset) el.dataset = {} + el.dataset.oldPaddingTop = el.style.paddingTop + el.dataset.oldPaddingBottom = el.style.paddingBottom + el.dataset.oldOverflow = el.style.overflow + + el.style.height = el.scrollHeight + 'px' + el.style.overflow = 'hidden' + }, + + leave(el) { + if (el.scrollHeight !== 0) { + el.style.transition = elTransition + el.style.height = 0 + el.style.paddingTop = 0 + el.style.paddingBottom = 0 + } + }, + + 'after-leave'(el) { + el.style.transition = '' + el.style.height = '' + el.style.overflow = el.dataset.oldOverflow + el.style.paddingTop = el.dataset.oldPaddingTop + el.style.paddingBottom = el.dataset.oldPaddingBottom + } +} + +export default { + name: 'collapseTransition', + functional: true, + render(h, { children }) { + const data = { + on: Transition + } + return h('transition', data, children) + } +} + diff --git a/src/layout/dashboard/DashboardLayout.vue b/src/layout/dashboard/DashboardLayout.vue index 000a06d..363ead5 100644 --- a/src/layout/dashboard/DashboardLayout.vue +++ b/src/layout/dashboard/DashboardLayout.vue @@ -1,7 +1,55 @@ -->
@@ -52,18 +92,26 @@ import TopNavbar from "./TopNavbar.vue"; import ContentFooter from "./ContentFooter.vue"; import DashboardContent from "./Content.vue"; import MobileMenu from "./MobileMenu"; +import Collapse from "../../components/Collapse"; export default { components: { TopNavbar, ContentFooter, DashboardContent, - MobileMenu + MobileMenu, + Collapse + }, + data() { + return { test: false }; }, methods: { toggleSidebar() { if (this.$sidebar.showSidebar) { this.$sidebar.displaySidebar(false); } + }, + to(path) { + if (this.$route.path != path.toLowerCase()) this.$router.push({ path }); } } }; @@ -73,4 +121,11 @@ export default { .off-canvas-sidebar { background: linear-gradient(0deg, #333 0%, #333 100%) !important; } +.title { + cursor: pointer; + margin-left: 20px; +} +.el-menu { + border-right: none !important; +} diff --git a/src/main.js b/src/main.js index 85d158a..1e72cb2 100644 --- a/src/main.js +++ b/src/main.js @@ -30,7 +30,11 @@ import { Tabs, TabPane, Pagination, - DatePicker + DatePicker, + Menu, + MenuItem, + MenuItemGroup, + Submenu } from "element-ui"; import "element-ui/lib/theme-chalk/index.css"; import i18n from "./i18n"; @@ -49,6 +53,10 @@ Vue.use(Tabs); Vue.use(TabPane); Vue.use(Pagination); Vue.use(DatePicker); +Vue.use(Menu); +Vue.use(MenuItem); +Vue.use(MenuItemGroup); +Vue.use(Submenu); /* eslint-disable no-new */ new Vue({ router, diff --git a/src/pages/Account/index.vue b/src/pages/Account/index.vue index 3a0a998..0e4ebfb 100644 --- a/src/pages/Account/index.vue +++ b/src/pages/Account/index.vue @@ -64,9 +64,7 @@ - 添加账号 + 添加账号 { - if (res.Code == 200) { - this.tableData = res.Data; - } - }); + this.$http + .get(`/Api/StockExchangeAccount/GetList?policyType=${this.type}`) + .then(res => { + if (res.Code == 200) { + this.tableData = res.Data; + } + }); }, getMatchTitle(value, sourceArray) { @@ -137,16 +139,21 @@ export default { //请求创建新的账号 createRobot() { this.createLoading = true; - this.$http.post("/Api/StockExchangeAccount/Add", this.form).then(res => { - this.createLoading = false; - if (res.Code == 200) { - this.modal.visible = false; - this.sMessage("success", "创建成功"); - this.getAccountList(); - } else { - this.sMessage("danger", res.Message); - } - }); + this.$http + .post("/Api/StockExchangeAccount/Add", { + ...this.form, + PolicyType: this.type + }) + .then(res => { + this.createLoading = false; + if (res.Code == 200) { + this.modal.visible = false; + this.sMessage("success", "创建成功"); + this.getAccountList(); + } else { + this.sMessage("danger", res.Message); + } + }); }, // 封装showNotification diff --git a/src/pages/ReCheck/MoveTrend.vue b/src/pages/ReCheck/MoveTrend.vue index c00ce66..dee7f61 100644 --- a/src/pages/ReCheck/MoveTrend.vue +++ b/src/pages/ReCheck/MoveTrend.vue @@ -26,7 +26,10 @@ export default { model: { prop: "form", event: "formChange" }, props: { - form: { type: Object, default: () => {} } + form: { + type: Object, + default: () => {} + } }, watch: { form() { diff --git a/src/pages/ReCheck/index.vue b/src/pages/ReCheck/index.vue index 18668ee..82ca1bc 100644 --- a/src/pages/ReCheck/index.vue +++ b/src/pages/ReCheck/index.vue @@ -161,10 +161,13 @@ -