Browse Source

login/account/order

master
lizhixin 4 years ago
parent
commit
1258df77a3
  1. 39
      src/layout/dashboard/TopNavbar.vue
  2. 1
      src/pages/Account/index.vue
  3. 3
      src/pages/Prev/index.vue
  4. 37
      src/pages/ReCheck/OrderTable.vue
  5. 92
      src/pages/login/index.vue
  6. 13
      src/router/index.js
  7. 15
      src/router/routes.js

39
src/layout/dashboard/TopNavbar.vue

@ -45,17 +45,17 @@
> >
<!-- <input type="text" class="form-control" placeholder="Search..."> <!-- <input type="text" class="form-control" placeholder="Search...">
<div class="input-group-addon"><i class="tim-icons icon-zoom-split"></i></div> --> <div class="input-group-addon"><i class="tim-icons icon-zoom-split"></i></div> -->
<button <!-- <button
class="btn btn-link" class="btn btn-link"
id="search-button" id="search-button"
data-toggle="modal" data-toggle="modal"
data-target="#searchModal" data-target="#searchModal"
> >
<i class="tim-icons icon-zoom-split"></i> <i class="tim-icons icon-zoom-split"></i>
</button> </button> -->
<!-- You can choose types of search input --> <!-- You can choose types of search input -->
</div> </div>
<modal <!-- <modal
:show.sync="searchModalVisible" :show.sync="searchModalVisible"
class="modal-search" class="modal-search"
id="searchModal" id="searchModal"
@ -70,7 +70,7 @@
id="inlineFormInputGroup" id="inlineFormInputGroup"
placeholder="SEARCH" placeholder="SEARCH"
/> />
</modal> </modal> -->
<!-- <base-dropdown tag="li" <!-- <base-dropdown tag="li"
:menu-on-right="!$rtl.isRTL" :menu-on-right="!$rtl.isRTL"
title-tag="a" class="nav-item"> title-tag="a" class="nav-item">
@ -97,7 +97,9 @@
<a href="#" class="nav-item dropdown-item">Another one</a> <a href="#" class="nav-item dropdown-item">Another one</a>
</li> </li>
</base-dropdown> --> </base-dropdown> -->
<login v-if="!isLogin" @login="login"> </login>
<base-dropdown <base-dropdown
v-else
tag="li" tag="li"
:menu-on-right="!$rtl.isRTL" :menu-on-right="!$rtl.isRTL"
title-tag="a" title-tag="a"
@ -127,7 +129,9 @@
</li> </li>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<li class="nav-link"> <li class="nav-link">
<a href="#" class="nav-item dropdown-item">Log out</a> <a href="#" class="nav-item dropdown-item" @click="logout"
>登出</a
>
</li> </li>
</base-dropdown> </base-dropdown>
</ul> </ul>
@ -139,11 +143,12 @@
<script> <script>
import { CollapseTransition } from "vue2-transitions"; import { CollapseTransition } from "vue2-transitions";
import Modal from "@/components/Modal"; import Modal from "@/components/Modal";
import Login from "../../pages/login";
export default { export default {
components: { components: {
CollapseTransition, CollapseTransition,
Modal Modal,
Login
}, },
computed: { computed: {
routeName() { routeName() {
@ -159,9 +164,17 @@ export default {
activeNotifications: false, activeNotifications: false,
showMenu: false, showMenu: false,
searchModalVisible: false, searchModalVisible: false,
searchQuery: "" searchQuery: "",
isLogin: localStorage.getItem("robotToken")
}; };
}, },
created() {
if (localStorage.getItem("robotToken")) {
if (this.$route.path == "/prev") this.$router.push("/robot/0");
}
},
methods: { methods: {
capitalizeFirstLetter(string) { capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1); return string.charAt(0).toUpperCase() + string.slice(1);
@ -180,6 +193,16 @@ export default {
}, },
toggleMenu() { toggleMenu() {
this.showMenu = !this.showMenu; this.showMenu = !this.showMenu;
},
login(isLogin) {
this.isLogin = isLogin;
console.log(isLogin, "why");
this.$router.push("/robot/0");
},
logout() {
localStorage.clear();
this.isLogin = false;
this.$router.push({ path: "/" });
} }
} }
}; };

1
src/pages/Account/index.vue

@ -94,7 +94,6 @@ import { Modal } from "@/components";
import { accountTypes } from "../prePages/js/selectoptions"; import { accountTypes } from "../prePages/js/selectoptions";
const tableColumns = [ const tableColumns = [
{ name: "账号名称", prop: "Name" },
{ name: "账号AccessKey", prop: "AccessKey" }, { name: "账号AccessKey", prop: "AccessKey" },
{ name: "账号SecretKey", prop: "SecretKey" }, { name: "账号SecretKey", prop: "SecretKey" },
{ name: "帐号类型", prop: "AccountType", customSlot: "type" }, { name: "帐号类型", prop: "AccountType", customSlot: "type" },

3
src/pages/Prev/index.vue

@ -0,0 +1,3 @@
<template>
<h3 style="textAlign:center">请先登陆</h3>
</template>

37
src/pages/ReCheck/OrderTable.vue

@ -1,4 +1,21 @@
<template> <template>
<div>
<el-select
class="select-danger"
style="width:200px"
placeholder="不限"
v-model="sortType"
@change="sortChange"
>
<el-option
v-for="item in orderTypes"
class="select-danger"
:value="item.value"
:label="item.title"
:key="item.value"
>
</el-option>
</el-select>
<div class="table-full-width table-responsive" style="height:500px"> <div class="table-full-width table-responsive" style="height:500px">
<custom-base-table <custom-base-table
:data="data" :data="data"
@ -74,6 +91,7 @@
</template> </template>
</custom-base-table> </custom-base-table>
</div> </div>
</div>
</template> </template>
<script> <script>
@ -88,7 +106,24 @@ export default {
}, },
components: { CustomBaseTable }, components: { CustomBaseTable },
data() { data() {
return { moment, columns: tradeColumns }; return {
moment,
columns: tradeColumns,
sortType: 0,
orderTypes: [
{ value: 0, title: "买入排序" },
{ value: 1, title: "卖出排序" }
]
};
},
methods: {
sortChange(value) {
if (value == 0) {
this.data.sort((a, b) => b.PurchaseKLineId - a.PurchaseKLineId);
} else {
this.data.sort((a, b) => b.SaleKLineId - a.SaleKLineId);
}
}
} }
}; };
</script> </script>

92
src/pages/login/index.vue

@ -0,0 +1,92 @@
<template>
<div>
<a @click="show" style="cursor: pointer;"> 登陆</a>
<modal
:show.sync="visible"
body-classes="p-0"
modal-classes="modal-dialog-centered modal-xl"
>
<card
type="secondary"
header-classes="bg-white pb-5"
body-classes="px-lg-5 py-lg-5"
class="border-0 mb-0"
style="padding:0 60px"
>
<!-- <template>
<div class="text-muted text-center mb-3">
<small>Sign in with</small>
</div>
<div class="btn-wrapper text-center">
<base-button type="default">
<img
slot="icon"
src="https://demos.creative-tim.com/argon-design-system/assets/img/icons/common/github.svg"
/>
微信
</base-button>
<base-button type="danger">
<img
slot="icon"
src="https://demos.creative-tim.com/argon-design-system/assets/img/icons/common/google.svg"
/>
QQ
</base-button>
</div>
</template> -->
<template>
<div class="text-center text-muted mb-4">
<small>请使用账号密码登陆</small>
</div>
<form role="form">
<base-input class="mb-3" placeholder="账号" v-model="form.account">
</base-input>
<base-input
type="password"
placeholder="密码"
v-model="form.password"
>
</base-input>
<base-checkbox v-model="rememberMe">
记住我
</base-checkbox>
<div class="text-center">
<base-button type="primary" class="my-4" @click="login"
>登陆</base-button
>
</div>
</form>
</template>
</card>
</modal>
</div>
</template>
<script>
import Modal from "../../components/Modal";
export default {
components: { Modal },
data() {
return {
visible: false,
form: {},
rememberMe: false
};
},
methods: {
show() {
console.log(this.visible);
this.visible = true;
},
login() {
if (this.rememberMe) {
localStorage.setItem("robotAccount", this.form.account);
localStorage.setItem("robotPassword", this.form.password);
}
localStorage.setItem("robotToken", "123");
this.$emit("login", true);
},
request() {}
}
};
</script>

13
src/router/index.js

@ -5,13 +5,20 @@ import routes from "./routes";
const router = new VueRouter({ const router = new VueRouter({
routes, // short for routes: routes routes, // short for routes: routes
linkExactActiveClass: "active", linkExactActiveClass: "active",
scrollBehavior: (to) => { scrollBehavior: to => {
if (to.hash) { if (to.hash) {
return {selector: to.hash} return { selector: to.hash };
} else { } else {
return { x: 0, y: 0 } return { x: 0, y: 0 };
} }
} }
}); });
router.beforeEach((to, from, next) => {
if (to.meta.auth && !localStorage.getItem("robotToken")) {
} else {
next();
}
});
export default router; export default router;

15
src/router/routes.js

@ -16,40 +16,53 @@ const Edit = () => import("@/pages/Robot/edit.vue");
const WinRate = () => import("@/pages/WinRate"); const WinRate = () => import("@/pages/WinRate");
const ReCheck = () => import("@/pages/ReCheck"); const ReCheck = () => import("@/pages/ReCheck");
const Capital = () => import("@/pages/Profit"); const Capital = () => import("@/pages/Profit");
const Prev = () => import("@/pages/Prev");
const routes = [ const routes = [
{ {
path: "/", path: "/",
component: DashboardLayout, component: DashboardLayout,
redirect: "/robot/0", redirect: "/prev",
children: [ children: [
{
path: "prev",
name: "prev",
meta: { auth: false },
component: Prev
},
{ {
path: "robot/:type", path: "robot/:type",
name: "robot", name: "robot",
meta: { auth: true },
component: Robot component: Robot
}, },
{ {
path: "edit/:id", path: "edit/:id",
name: "edit", name: "edit",
meta: { auth: true },
component: Edit component: Edit
}, },
{ {
path: "winRate", path: "winRate",
name: "winRate", name: "winRate",
meta: { auth: true },
component: WinRate component: WinRate
}, },
{ {
path: "account/:type", path: "account/:type",
name: "account", name: "account",
meta: { auth: true },
component: Account component: Account
}, },
{ {
path: "reCheck", path: "reCheck",
name: "reCheck", name: "reCheck",
meta: { auth: true },
component: ReCheck component: ReCheck
}, },
{ {
path: "capital", path: "capital",
name: "capital", name: "capital",
meta: { auth: true },
component: Capital component: Capital
} }
// { // {

Loading…
Cancel
Save