分离main.ts 出permission.ts, 把学习改为onenote
This commit is contained in:
+1
-1
@@ -212,7 +212,7 @@ export default [
|
|||||||
strategy_name: 'string',
|
strategy_name: 'string',
|
||||||
class_name: 'string',
|
class_name: 'string',
|
||||||
vt_symbol: 'string',
|
vt_symbol: 'string',
|
||||||
setting: Object,
|
setting: {},
|
||||||
status: 1,
|
status: 1,
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -17,10 +17,6 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="12" :lg="9" :md="9" :sm="14" :xl="9">
|
<el-col :xs="12" :lg="9" :md="9" :sm="14" :xl="9">
|
||||||
<div class="right-box">
|
<div class="right-box">
|
||||||
<el-icon class="dashboard-icon" @click="open">
|
|
||||||
<avatar />
|
|
||||||
</el-icon>
|
|
||||||
<!-- <Search /> -->
|
|
||||||
<el-dropdown>
|
<el-dropdown>
|
||||||
<div class="dp-flex justify-content-center align-items height-full width-full">
|
<div class="dp-flex justify-content-center align-items height-full width-full">
|
||||||
<span class="header-avatar" style="cursor: pointer">
|
<span class="header-avatar" style="cursor: pointer">
|
||||||
@@ -61,7 +57,6 @@
|
|||||||
import CustomPic from "@/components/customPic/index.vue";
|
import CustomPic from "@/components/customPic/index.vue";
|
||||||
import { tenantStore } from '@/store/modules/tenant'
|
import { tenantStore } from '@/store/modules/tenant'
|
||||||
import { settingsStore } from '@/store/modules/settings'
|
import { settingsStore } from '@/store/modules/settings'
|
||||||
import { Action, ElMessage, ElMessageBox } from "element-plus";
|
|
||||||
|
|
||||||
// -- IMPORT --
|
// -- IMPORT --
|
||||||
const useTenantStore = tenantStore()
|
const useTenantStore = tenantStore()
|
||||||
@@ -73,20 +68,6 @@ const useSettingsStore = settingsStore()
|
|||||||
|
|
||||||
// -- EVENT DEFINITION
|
// -- EVENT DEFINITION
|
||||||
const toPerson = () => {
|
const toPerson = () => {
|
||||||
|
|
||||||
}
|
|
||||||
const open = () => {
|
|
||||||
ElMessageBox.alert('This is a message', 'Title', {
|
|
||||||
// if you want to disable its autofocus
|
|
||||||
// autofocus: false,
|
|
||||||
confirmButtonText: 'OK',
|
|
||||||
callback: (action: Action) => {
|
|
||||||
ElMessage({
|
|
||||||
type: 'info',
|
|
||||||
message: `action: ${action}`,
|
|
||||||
})
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
useTenantStore.reflush()
|
useTenantStore.reflush()
|
||||||
|
|||||||
+7
-116
@@ -2,136 +2,27 @@ import { createApp } from 'vue'
|
|||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
import ElementPlus from "element-plus";
|
import ElementPlus from "element-plus";
|
||||||
import 'element-plus/dist/index.css'
|
import 'element-plus/dist/index.css'
|
||||||
import router from './router'
|
|
||||||
import { store } from './store'
|
import { store } from './store'
|
||||||
|
import router from './router'
|
||||||
|
import '@/permission'
|
||||||
|
|
||||||
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
|
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
|
||||||
|
|
||||||
let app = createApp(App)
|
|
||||||
|
|
||||||
|
|
||||||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
|
||||||
app.component(key, component)
|
|
||||||
}
|
|
||||||
|
|
||||||
import contentmenu from 'v-contextmenu'
|
import contentmenu from 'v-contextmenu'
|
||||||
import 'v-contextmenu/dist/themes/default.css'
|
import 'v-contextmenu/dist/themes/default.css'
|
||||||
app.use(contentmenu)
|
|
||||||
|
|
||||||
import { setupMock } from '../mock'
|
import { setupMock } from '../mock'
|
||||||
|
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
setupMock()
|
setupMock()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let app = createApp(App)
|
||||||
|
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||||||
|
app.component(key, component)
|
||||||
|
}
|
||||||
|
app.use(contentmenu)
|
||||||
app.use(router)
|
app.use(router)
|
||||||
app.use(ElementPlus)
|
app.use(ElementPlus)
|
||||||
app.use(store)
|
app.use(store)
|
||||||
import { getToken, getTenant, setToken, setTenant } from './utils/auth'
|
|
||||||
import { Tenant } from './entity/index'
|
|
||||||
import Cookies from 'js-cookie'
|
|
||||||
import { tenantStore } from './store/modules/tenant'
|
|
||||||
const whiteList = ['/login', '/register', '/sorryPage']
|
|
||||||
let url = window.location.href
|
|
||||||
|
|
||||||
async function checktoken(url: string) {
|
|
||||||
|
|
||||||
if (url.search("register") != -1) {
|
|
||||||
let arr = url.split('?')
|
|
||||||
let parameters = arr[1].split('&')
|
|
||||||
let query_data: { [key: string]: any } = {}
|
|
||||||
parameters.forEach(parameter => {
|
|
||||||
let parameter_list = parameter.split("=")
|
|
||||||
query_data[parameter_list[0]] = parameter_list[1]
|
|
||||||
})
|
|
||||||
router.push({
|
|
||||||
path: '/register',
|
|
||||||
query: query_data
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (url.search("/home/") != -1) {
|
|
||||||
let arr = url.split('?')
|
|
||||||
let parameters = arr[1].split('&')
|
|
||||||
let query_data: { [key: string]: any } = {}
|
|
||||||
parameters.forEach(parameter => {
|
|
||||||
let parameter_list = parameter.split("=")
|
|
||||||
query_data[parameter_list[0]] = parameter_list[1]
|
|
||||||
})
|
|
||||||
const tenant = {
|
|
||||||
tenant_id: query_data.tenantId,
|
|
||||||
account: query_data.account
|
|
||||||
}
|
|
||||||
const tenant_store = tenantStore()
|
|
||||||
await tenant_store.login(tenant, query_data.token).then(() => {
|
|
||||||
const { href } = router.resolve({
|
|
||||||
path: '/'
|
|
||||||
});
|
|
||||||
window.open(href, '_self');
|
|
||||||
}).catch((error) => {
|
|
||||||
const { href } = router.resolve({
|
|
||||||
path: '/login'
|
|
||||||
});
|
|
||||||
window.open(href, '_self');
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if (url.search("sorryPage") != -1) {
|
|
||||||
router.push({
|
|
||||||
path: '/sorryPage',
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
checktoken(url)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ルーター監視
|
|
||||||
* 1、トーケン取得
|
|
||||||
* 2、トーケンなし場合はログイン画面に遷移
|
|
||||||
* 3、トーケンあり場合:
|
|
||||||
* 既にログイン場合はデフォルト / に遷移
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
router.beforeEach((to, from, next) => {
|
|
||||||
console.log(from.path, to.path)
|
|
||||||
|
|
||||||
const token = getToken()
|
|
||||||
|
|
||||||
if (typeof token === 'string') {
|
|
||||||
switch (to.path) {
|
|
||||||
case '/login':
|
|
||||||
next('/')
|
|
||||||
break;
|
|
||||||
case '/':
|
|
||||||
const tenant = <Tenant>(JSON.parse(getTenant() as string))
|
|
||||||
if (url.search("write") != -1) {
|
|
||||||
next('/BlogEditer')
|
|
||||||
} else if (url.search("view") != -1) {
|
|
||||||
let bid = Cookies.get('bid')
|
|
||||||
router.push({
|
|
||||||
path: '/BlogViewer',
|
|
||||||
query: { bid: bid }
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
router.push({
|
|
||||||
path: '/home',
|
|
||||||
query: tenant
|
|
||||||
})
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
next()
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (whiteList.indexOf(to.path) !== -1) {
|
|
||||||
next()
|
|
||||||
} else {
|
|
||||||
next('/login')
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
app.mount('#app')
|
app.mount('#app')
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,93 @@
|
|||||||
|
import router from './router'
|
||||||
|
import Cookies from 'js-cookie'
|
||||||
|
import { getToken, getTenant } from './utils/auth'
|
||||||
|
import { Tenant } from './entity/index'
|
||||||
|
import { tenantStore } from './store/modules/tenant'
|
||||||
|
|
||||||
|
const whiteList = ['/login', '/register', '/sorryPage']
|
||||||
|
let url = window.location.href
|
||||||
|
|
||||||
|
router.beforeEach(async (to, from, next) => {
|
||||||
|
console.log(url)
|
||||||
|
console.log(from.path, to.path)
|
||||||
|
|
||||||
|
const token = getToken()
|
||||||
|
|
||||||
|
if (typeof token === 'string') {
|
||||||
|
switch (to.path) {
|
||||||
|
case '/login':
|
||||||
|
next('/')
|
||||||
|
break;
|
||||||
|
case '/':
|
||||||
|
const tenant = <Tenant>(JSON.parse(getTenant() as string))
|
||||||
|
if (url.search("write") != -1) {
|
||||||
|
next('/BlogEditer')
|
||||||
|
} else if (url.search("view") != -1) {
|
||||||
|
let bid = Cookies.get('bid')
|
||||||
|
router.push({
|
||||||
|
path: '/BlogViewer',
|
||||||
|
query: { bid: bid }
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
router.push({
|
||||||
|
path: '/home',
|
||||||
|
query: tenant
|
||||||
|
})
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
next()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (url.search("register") != -1) {
|
||||||
|
let arr = url.split('?')
|
||||||
|
let parameters = arr[1].split('&')
|
||||||
|
let query_data: { [key: string]: any } = {}
|
||||||
|
parameters.forEach(parameter => {
|
||||||
|
let parameter_list = parameter.split("=")
|
||||||
|
query_data[parameter_list[0]] = parameter_list[1]
|
||||||
|
})
|
||||||
|
router.push({
|
||||||
|
path: '/register',
|
||||||
|
query: query_data
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (url.search("/home/") != -1) {
|
||||||
|
let arr = url.split('?')
|
||||||
|
let parameters = arr[1].split('&')
|
||||||
|
let query_data: { [key: string]: any } = {}
|
||||||
|
parameters.forEach(parameter => {
|
||||||
|
let parameter_list = parameter.split("=")
|
||||||
|
query_data[parameter_list[0]] = parameter_list[1]
|
||||||
|
})
|
||||||
|
const tenant = {
|
||||||
|
tenant_id: query_data.tenantId,
|
||||||
|
account: query_data.account
|
||||||
|
}
|
||||||
|
const tenant_store = tenantStore()
|
||||||
|
await tenant_store.login(tenant, query_data.token).then(() => {
|
||||||
|
const { href } = router.resolve({
|
||||||
|
path: '/'
|
||||||
|
});
|
||||||
|
window.open(href, '_self');
|
||||||
|
}).catch((error) => {
|
||||||
|
const { href } = router.resolve({
|
||||||
|
path: '/login'
|
||||||
|
});
|
||||||
|
window.open(href, '_self');
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (url.search("sorryPage") != -1) {
|
||||||
|
router.push({
|
||||||
|
path: '/sorryPage',
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (whiteList.indexOf(to.path) !== -1) {
|
||||||
|
next()
|
||||||
|
} else {
|
||||||
|
next('/login')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
+3
-10
@@ -27,10 +27,10 @@ const routes: Array<RouteRecordRaw> = [
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/school',
|
path: '/onenote',
|
||||||
component: () => import('../view/school/index.vue'),
|
component: () => import('../view/onenote/index.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
name: '学习'
|
name: 'onenote'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -61,13 +61,6 @@ const routes: Array<RouteRecordRaw> = [
|
|||||||
name: '资金管理'
|
name: '资金管理'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// {
|
|
||||||
// path: '/trader',
|
|
||||||
// component: () => import('../view/trader/index.vue'),
|
|
||||||
// meta: {
|
|
||||||
// name: 'trader'
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
{
|
{
|
||||||
path: '/strategy',
|
path: '/strategy',
|
||||||
component: () => import('../view/trader/cta_strategy_file.vue'),
|
component: () => import('../view/trader/cta_strategy_file.vue'),
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ const service = axios.create()
|
|||||||
|
|
||||||
export function Commits(page: number) {
|
export function Commits(page: number) {
|
||||||
return service({
|
return service({
|
||||||
url: 'https://api.github.com/repos/flipped-aurora/gin-vue-admin/commits?page=' + page,
|
url: 'https://api.github.com/repos/simple321vip/violin-home/commits?page=' + page,
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
|
|
||||||
const weatherInfo = ref('今日晴,0℃ - 10℃,天气寒冷,注意添加衣物。')
|
const weatherInfo = ref('对不起主人,我还没有获得天气信息,暂时无法显示哟。')
|
||||||
const amapKey = '8e8baa8a7317586c29ec694895de6e0a'
|
const amapKey = '8e8baa8a7317586c29ec694895de6e0a'
|
||||||
|
|
||||||
export const useWeatherInfo = () => {
|
export const useWeatherInfo = () => {
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ export const tenantStore = defineStore('tenant', () => {
|
|||||||
tenant.value.token = ''
|
tenant.value.token = ''
|
||||||
tenant.value.id = ''
|
tenant.value.id = ''
|
||||||
resetToken()
|
resetToken()
|
||||||
|
window.location.reload()
|
||||||
}
|
}
|
||||||
|
|
||||||
const reflush = async () => {
|
const reflush = async () => {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<div class="gva-card-box">
|
<div class="gva-card-box">
|
||||||
<div class="gva-card gva-top-card">
|
<div class="gva-card gva-top-card">
|
||||||
<div class="gva-top-card-left">
|
<div class="gva-top-card-left">
|
||||||
<div class="gva-top-card-left-title">早安,管理员,请开始一天的工作吧</div>
|
<div class="gva-top-card-left-title">我的主人,我们又见面了,我有什么能帮助你么^_^</div>
|
||||||
<div class="gva-top-card-left-dot">{{ weatherInfo }}</div>
|
<div class="gva-top-card-left-dot">{{ weatherInfo }}</div>
|
||||||
<div class="gva-top-card-left-rows">
|
<div class="gva-top-card-left-rows">
|
||||||
<el-row>
|
<el-row>
|
||||||
|
|||||||
Reference in New Issue
Block a user