diff --git a/mock/blog.ts b/mock/blog.ts
index a0dfabf..7cb2919 100644
--- a/mock/blog.ts
+++ b/mock/blog.ts
@@ -75,4 +75,3 @@ export default [
},
},
] as MockMethod[]
-// /auth/api/v1/author/blog/content
\ No newline at end of file
diff --git a/mock/future.ts b/mock/future.ts
new file mode 100644
index 0000000..e3cb5d6
--- /dev/null
+++ b/mock/future.ts
@@ -0,0 +1,134 @@
+import { MockMethod } from 'vite-plugin-mock'
+
+export default [
+ {
+ url: '/trader/api/v1/exchanges',
+ method: 'get',
+ response: ({ body, query }) => {
+ return {
+ "exchanges": [
+ "CFFEX",
+ "SHFE",
+ "CZCE",
+ // "DCE",
+ // "INE",
+ // "GFEX"
+ ]
+ }
+ }
+ },
+ {
+ url: '/trader/api/v1/subscribe/vt_symbols',
+ method: 'get',
+ response: ({ body, query }) => {
+ return {
+ "vt_symbols": [
+ "RM301.CZCE",
+ "RM303.CZCE",
+ ]
+ }
+ }
+ },
+ {
+ url: '/trader/api/v1/vt_symbols',
+ method: 'get',
+ response: ({ body, query }) => {
+ return {
+ "vt_symbols": {
+ "CFFEX": [],
+ "SHFE": [],
+ "CZCE": ["RM301.CZCE", "RM303.CZCE", "RM305.CZCE",],
+ }
+ }
+ }
+ },
+ {
+ url: '/trader/api/v1/ticks',
+ method: 'get',
+ response: ({ body, query }) => {
+ return {
+ "ticks": [
+ {
+ "ask_price_1": 3159.0,
+ "ask_price_2": 0,
+ "ask_price_3": 0,
+ "ask_price_4": 0,
+ "ask_price_5": 0,
+ "bid_price_1": 3156.0,
+ "bid_price_2": 0,
+ "bid_price_3": 0,
+ "bid_price_4": 0,
+ "bid_price_5": 0,
+ "exchange": "CZCE",
+ "high_price": 3167.0,
+ "last_price": 3156.0,
+ "last_volume": 0,
+ "limit_down": 2900.0,
+ "limit_up": 3406.0,
+ "low_price": 3156.0,
+ "name": "\u83dc\u7c951\u6708",
+ "open_interest": 10099.0,
+ "open_price": 3160.0,
+ "pre_close": 3160.0,
+ "symbol": "RM301",
+ "turnover": 4149080.0,
+ "volume": 1313
+ },
+ {
+ "ask_price_1": 3094.0,
+ "ask_price_2": 0,
+ "ask_price_3": 0,
+ "ask_price_4": 0,
+ "ask_price_5": 0,
+ "bid_price_1": 3093.0,
+ "bid_price_2": 0,
+ "bid_price_3": 0,
+ "bid_price_4": 0,
+ "bid_price_5": 0,
+ "exchange": "CZCE",
+ "high_price": 3104.0,
+ "last_price": 3093.0,
+ "last_volume": 0,
+ "limit_down": 2839.0,
+ "limit_up": 3333.0,
+ "low_price": 3084.0,
+ "name": "\u83dc\u7c953\u6708",
+ "open_interest": 136677.0,
+ "open_price": 3088.0,
+ "pre_close": 3087.0,
+ "symbol": "RM303",
+ "turnover": 12512136.0,
+ "volume": 4044
+ },
+ {
+ "ask_price_1": 0.0,
+ "ask_price_2": 0,
+ "ask_price_3": 0,
+ "ask_price_4": 0,
+ "ask_price_5": 0,
+ "bid_price_1": 0.0,
+ "bid_price_2": 0,
+ "bid_price_3": 0,
+ "bid_price_4": 0,
+ "bid_price_5": 0,
+ "exchange": "CZCE",
+ "high_price": 0,
+ "last_price": 0,
+ "last_volume": 0,
+ "limit_down": 2684.0,
+ "limit_up": 3560.0,
+ "low_price": 0,
+ "name": "\u666e\u9ea65\u6708",
+ "open_interest": 0.0,
+ "open_price": 0,
+ "pre_close": 0,
+ "symbol": "PM305",
+ "turnover": 0.0,
+ "volume": 0
+ }
+ ]
+ }
+ }
+ },
+] as MockMethod[]
+
diff --git a/package-lock.json b/package-lock.json
index 6908d08..8aab8e8 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -449,6 +449,16 @@
"picomatch": "^2.0.4"
}
},
+ "aplayer": {
+ "version": "1.10.1",
+ "resolved": "https://registry.npmjs.org/aplayer/-/aplayer-1.10.1.tgz",
+ "integrity": "sha512-HAfyxgCUTLAqtYlxzzK9Fyqg6y+kZ9CqT1WfeWE8FSzwspT6oBqWOZHANPHF3RGTtC33IsyEgrfthPDzU5r9kQ==",
+ "requires": {
+ "balloon-css": "^0.5.0",
+ "promise-polyfill": "7.1.0",
+ "smoothscroll": "0.4.0"
+ }
+ },
"asap": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz",
@@ -491,6 +501,11 @@
"@babel/types": "^7.9.6"
}
},
+ "balloon-css": {
+ "version": "0.5.2",
+ "resolved": "https://registry.npmjs.org/balloon-css/-/balloon-css-0.5.2.tgz",
+ "integrity": "sha512-zheJpzwyNrG4t39vusA67v3BYg1HTVXOF8cErPEHzWK88PEOFwgo6Ea9VHOgOWNMgeuOtFVtB73NE2NWl9uDyQ=="
+ },
"binary-extensions": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
@@ -1450,6 +1465,11 @@
"asap": "~2.0.3"
}
},
+ "promise-polyfill": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/promise-polyfill/-/promise-polyfill-7.1.0.tgz",
+ "integrity": "sha512-P6NJ2wU/8fac44ENORsuqT8TiolKGB2u0fEClPtXezn7w5cmLIjM/7mhPlTebke2EPr6tmqZbXvnX0TxwykGrg=="
+ },
"pug": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/pug/-/pug-3.0.2.tgz",
@@ -1673,6 +1693,11 @@
"object-inspect": "^1.9.0"
}
},
+ "smoothscroll": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/smoothscroll/-/smoothscroll-0.4.0.tgz",
+ "integrity": "sha512-sggQ3U2Un38b3+q/j1P4Y4fCboCtoUIaBYoge+Lb6Xg1H8RTIif/hugVr+ErMtIDpvBbhQfTjtiTeYAfbw1ZGQ=="
+ },
"sortablejs": {
"version": "1.14.0",
"resolved": "https://registry.npmjs.org/sortablejs/-/sortablejs-1.14.0.tgz",
diff --git a/package.json b/package.json
index ee033f3..b4f8da5 100644
--- a/package.json
+++ b/package.json
@@ -13,6 +13,7 @@
"@element-plus/icons-vue": "^1.1.4",
"@types/node": "^17.0.23",
"axios": "^0.26.1",
+ "aplayer": "^1.10.1",
"clipboard": "^2.0.10",
"copy-to-clipboard": "^3.3.1",
"echarts": "^5.3.2",
diff --git a/src/api/capital.ts b/src/api/capital.ts
index 5283994..648ce13 100644
--- a/src/api/capital.ts
+++ b/src/api/capital.ts
@@ -1,10 +1,10 @@
-import { trader_service } from '../utils/request'
+import { service } from '../utils/request'
"CTA strategy"
"query account"
const get_accounts = () => {
- return trader_service({
+ return service({
url: '/trader/api/v1/accounts',
method: 'GET',
})
@@ -12,7 +12,7 @@ const get_accounts = () => {
"get contract"
const get_contract = (symbol: string) => {
- return trader_service({
+ return service({
url: '/trader/api/v1/contract/' + symbol,
method: 'GET',
})
@@ -20,7 +20,7 @@ const get_contract = (symbol: string) => {
"get tick"
const get_tick = (symbol: string) => {
- return trader_service({
+ return service({
url: '/trader/api/v1/tick/' + symbol,
method: 'GET',
})
@@ -28,7 +28,7 @@ const get_tick = (symbol: string) => {
"get ticks"
const get_ticks = () => {
- return trader_service({
+ return service({
url: '/trader/api/v1/ticks',
method: 'GET',
})
@@ -36,16 +36,16 @@ const get_ticks = () => {
"send_order"
const send_order = (data: any) => {
- return trader_service({
+ return service({
url: '/trader/api/v1/order',
method: 'POST',
data: data
})
}
-"get tick"
+"subscribe tick"
const subscribe = (symbol: string) => {
- return trader_service({
+ return service({
url: '/trader/api/v1/subscribe/' + symbol,
method: 'GET',
})
@@ -53,7 +53,7 @@ const subscribe = (symbol: string) => {
"get subscribe vt_symbols"
const get_subscribe_vt_symbols = () => {
- return trader_service({
+ return service({
url: '/trader/api/v1/subscribe/vt_symbols',
method: 'GET',
})
@@ -61,7 +61,7 @@ const get_subscribe_vt_symbols = () => {
"get all vt_symbols"
const get_vt_symbols = () => {
- return trader_service({
+ return service({
url: '/trader/api/v1/vt_symbols',
method: 'GET',
})
@@ -69,7 +69,7 @@ const get_vt_symbols = () => {
"get exchanges"
const get_exchanges = () => {
- return trader_service({
+ return service({
url: '/trader/api/v1/exchanges',
method: 'GET',
})
diff --git a/src/api/cta_strategy.ts b/src/api/cta_strategy.ts
index 78a3e9b..63a5deb 100644
--- a/src/api/cta_strategy.ts
+++ b/src/api/cta_strategy.ts
@@ -1,10 +1,10 @@
-import { trader_service } from '../utils/request'
+import { service } from '../utils/request'
"CTA strategy"
"strategy file list"
const get_strategy_files = () => {
- return trader_service({
+ return service({
url: '/trader/api/v1/strategy_file',
method: 'GET',
})
@@ -12,7 +12,7 @@ const get_strategy_files = () => {
"strategy file list"
const get_strategy_load_files = () => {
- return trader_service({
+ return service({
url: '/trader/api/v1/strategy_file/load',
method: 'GET',
})
@@ -22,7 +22,7 @@ const get_strategy_load_files = () => {
const upload_strategy_file = (file: any) => {
const formData = new FormData();
formData.append("file", file)
- return trader_service({
+ return service({
url: '/trader/api/v1/strategy_file',
method: 'POST',
data: formData,
@@ -34,7 +34,7 @@ const upload_strategy_file = (file: any) => {
"load a strategy file"
const load_strategy_file = (file_name: string) => {
- return trader_service({
+ return service({
url: '/trader/api/v1/strategy_file/' + file_name,
method: 'PUT',
})
@@ -42,7 +42,7 @@ const load_strategy_file = (file_name: string) => {
"unload a strategy file"
const unload_strategy_file = (class_name: string) => {
- return trader_service({
+ return service({
url: '/trader/api/v1/strategy_file/' + class_name,
method: 'PATCH',
})
@@ -50,7 +50,7 @@ const unload_strategy_file = (class_name: string) => {
"remove a strategy file"
const remove_strategy_file = (file_name: string) => {
- return trader_service({
+ return service({
url: '/trader/api/v1/strategy_file/' + file_name,
method: 'DELETE',
})
@@ -59,7 +59,7 @@ const remove_strategy_file = (file_name: string) => {
"get strategy list"
const get_strategies = () => {
- return trader_service({
+ return service({
url: '/trader/api/v1/strategies',
method: 'GET',
})
@@ -67,7 +67,7 @@ const get_strategies = () => {
"create a strategy"
const create_strategy = (ruleForm: any) => {
- return trader_service({
+ return service({
url: '/trader/api/v1/strategy/' + ruleForm.strategy_name,
method: 'POST',
data: ruleForm
@@ -76,7 +76,7 @@ const create_strategy = (ruleForm: any) => {
"init a strategy"
const init_strategy = (strategy_name: string) => {
- return trader_service({
+ return service({
url: '/trader/api/v1/strategy/init/' + strategy_name,
method: 'PUT',
})
@@ -84,7 +84,7 @@ const init_strategy = (strategy_name: string) => {
"start a strategy"
const start_strategy = (strategy_name: string) => {
- return trader_service({
+ return service({
url: '/trader/api/v1/strategy/' + strategy_name,
method: 'PUT',
})
@@ -92,7 +92,7 @@ const start_strategy = (strategy_name: string) => {
"stop a strategy"
const stop_strategy = (strategy_name: string) => {
- return trader_service({
+ return service({
url: '/trader/api/v1/strategy/' + strategy_name,
method: 'PATCH',
})
@@ -100,7 +100,7 @@ const stop_strategy = (strategy_name: string) => {
"remove a strategy"
const remove_strategy = (strategy_name: string) => {
- return trader_service({
+ return service({
url: '/trader/api/v1/strategy/' + strategy_name,
method: 'DELETE',
})
@@ -108,7 +108,7 @@ const remove_strategy = (strategy_name: string) => {
"get a strategy status"
const get_strategy_status = (strategy_name: string) => {
- return trader_service({
+ return service({
url: '/trader/api/v1/strategy/status/' + strategy_name,
method: 'GET',
})
diff --git a/src/components/cloud/player.vue b/src/components/cloud/player.vue
new file mode 100644
index 0000000..9971cf2
--- /dev/null
+++ b/src/components/cloud/player.vue
@@ -0,0 +1,146 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/store/index.ts b/src/store/index.ts
index 7c9c5ba..fb5d399 100644
--- a/src/store/index.ts
+++ b/src/store/index.ts
@@ -1,19 +1,69 @@
-import { defineStore } from 'pinia'
-import { Tables } from './table'
+import { defineStore, acceptHMRUpdate } from 'pinia'
+import { authorize } from '../api/user'
+import { getToken, setToken, resetToken, setTenant, getTenant } from '../utils/auth'
+import { Tenant } from '../entity/index'
+
+
+interface Record {
+ isFolder: boolean
+ path: string
+ records: Set
+}
+
+/**
+ * skeleton
+ *
+ *
+ */
+export const tenantStore = defineStore({
+ id: 'cloud',
+ state: () => ({
+ cloud: new Set(),
+ }),
-export const cloudStore = defineStore({
- id: 'cloudStore',
- state: () => {
- return {
- tableData: 1,
- showDocument: false,
- tableSize: 12
- }
- },
getters: {
},
actions: {
+ logout() {
+ this.$patch({
+ })
+ resetToken()
+ // we could do other stuff like redirecting the user
+ },
- }
-})
\ No newline at end of file
+ /**
+ * Attempt to login a user
+ * @param {string} user_id
+ * @param {string} user_password
+ */
+ async login(tenant: any, token: string) {
+
+ try {
+ await authorize({
+ tenant_id: tenant.tenant_id, token: token
+ })
+ setToken(token)
+ setTenant(tenant)
+ } catch {
+ Promise.resolve("authorize error")
+ }
+
+ },
+
+
+ async reflush() {
+ if (getToken()) {
+ const tenant = (JSON.parse(getTenant() as string))
+ const token = getToken()
+ this.$patch({
+
+ })
+ }
+ }
+ },
+})
+
+if (import.meta.hot) {
+ import.meta.hot.accept(acceptHMRUpdate(tenantStore, import.meta.hot))
+}
\ No newline at end of file
diff --git a/src/store/strategy.ts b/src/store/strategy.ts
index 540d46b..77a71fc 100644
--- a/src/store/strategy.ts
+++ b/src/store/strategy.ts
@@ -1,4 +1,5 @@
import { acceptHMRUpdate, defineStore } from "pinia"
+import { get_vt_symbols, get_exchanges, get_subscribe_vt_symbols } from '../api/capital'
export const strategyStore = defineStore({
id: 'strategy',
@@ -8,6 +9,33 @@ export const strategyStore = defineStore({
subscribe_vt_symbols: [],
exchanges: []
}),
+
+ actions: {
+ async select_exchanges() {
+ if (this.exchanges.length == 0) {
+ get_exchanges().then(res => {
+ this.$patch({ exchanges: res.data.exchanges })
+ })
+ }
+ },
+ async select_vt_symbols() {
+ if (this.vt_symbols.size == 0) {
+ get_vt_symbols().then(res => {
+ let keys = Object.keys(res.data.vt_symbols)
+ keys.forEach(key => {
+ this.vt_symbols.set(key, res.data.vt_symbols[key])
+ })
+ })
+ }
+ },
+ async select_subscribe_vt_symbols() {
+ if (this.subscribe_vt_symbols.length == 0) {
+ get_subscribe_vt_symbols().then(res => {
+ this.$patch({ subscribe_vt_symbols: res.data.vt_symbols })
+ })
+ }
+ }
+ }
})
if (import.meta.hot) {
diff --git a/src/store/tenant.ts b/src/store/tenant.ts
index 3e017e5..2c2a753 100644
--- a/src/store/tenant.ts
+++ b/src/store/tenant.ts
@@ -37,9 +37,9 @@ export const tenantStore = defineStore({
},
/**
- * Attempt to login a user
- * @param {string} user_id
- * @param {string} user_password
+ * Attempt to login a tenant
+ * @param {object} tenant
+ * @param {string} token
*/
async login(tenant: any, token: string) {
diff --git a/src/utils/request.ts b/src/utils/request.ts
index 15dfbf1..4474694 100644
--- a/src/utils/request.ts
+++ b/src/utils/request.ts
@@ -2,7 +2,7 @@ import axios from 'axios'
import router from '../router'
import { getToken, getTenant, resetToken } from '../utils/auth'
-// violin-book
+// violin-wiki
const service = axios.create(
{
baseURL: import.meta.env.VITE_APP_URL as string,
@@ -10,14 +10,6 @@ const service = axios.create(
}
)
-// violin-trader
-const trader_service = axios.create(
- {
- baseURL: import.meta.env.VITE_APP_URL2 as string,
- timeout: 5000
- }
-)
-
service.interceptors.request.use(
config => {
if (typeof getToken() === 'string') {
@@ -47,52 +39,4 @@ service.interceptors.response.use(
}
)
-
-trader_service.interceptors.request.use(
- config => {
- if (typeof getToken() === 'string') {
- (config as any).headers['Authorization'] = 'Bearer' + getToken()
- }
- const tenant = getTenant()
- if (typeof tenant === 'string') {
- (config as any).headers['id'] = JSON.parse(tenant).id
- }
-
- return config
- },
- error => {
- console.log(error)
- return Promise.reject(error)
- }
-)
-
-
-// service.interceptors.response.use(
-// response => {
-// if (response.headers['content-dispostion']
-// && response.headers['content-dispostion'].split(';')[0] === 'attachment') {
-// return response
-// } else {
-// return response.data
-// }
-// },
-// async error => {
-// if (error.code === 'ECONNABORTED') {
-// const error = {
-// message: '通信タイムアウト'
-// }
-// return Promise.reject(error)
-// } else if (!error.response) {
-// const error = {
-// message: 'サーバーエラー'
-// }
-// return Promise.reject(error)
-// } else if (error.response && error.response.status && (error.response.status === 403 || error.response.status === 403)) {
-
-// } else {
-// return Promise.reject(error.response.data)
-// }
-// }
-// )
-
-export { service, trader_service }
\ No newline at end of file
+export { service }
\ No newline at end of file
diff --git a/src/view/blog/createBlog.vue b/src/view/blog/createBlog.vue
index f664ce9..a2b97e3 100644
--- a/src/view/blog/createBlog.vue
+++ b/src/view/blog/createBlog.vue
@@ -64,14 +64,10 @@
-
-
-
-
-
+
@@ -140,20 +136,20 @@ import {
import { copy } from '../../utils/copyutil'
import draggable from "vuedraggable"
-type Blog = {
- bid: string,
- btId: string,
- title: string,
- blog_prex: string,
- autosave_control: string,
- content: string,
+interface Blog {
+ bid: string
+ btId: string
+ title: string
+ blog_prex: string
+ autosave_control: string
+ content: string
order: number
}
-type BlogType = {
- btId: string,
- btName: string,
- blogs: Blog[],
+interface BlogType {
+ btId: string
+ btName: string
+ blogs: Blog[]
order: number
}
const blogTypes = reactive([])
@@ -173,22 +169,7 @@ let current_blog = reactive({
content: "",
})
-/*
-draggable 对CSS样式没有什么要求万物皆可拖拽
-:list="state.list" //需要绑定的数组
-animation="300" //动画效果
-@start="onStart" //拖拽开始的事件
-@end="onEnd" //拖拽结束的事件
-*/
-const state = reactive({
- modules: {
- group1: [
-
- ]
- },
-})
-
-// 関数定義
+// FUNCTION DEFINITION
/**
* Blog一覧取得
*/
@@ -544,6 +525,25 @@ window.addEventListener('keydown', async function (event) {
}
})
+const onUploadImg = async (files: FileList, callback: (urls: string[]) => void) => {
+ const res = await Promise.all(
+ Array.from(files).map((file) => {
+ return new Promise((resolve, reject) => {
+ const formData = new FormData()
+ formData.append('img', file)
+ onUploadImg(formData,)
+ })
+ })
+ )
+ callback(res.map((item: any) => item.data.data))
+}
+
+const onUploadProcess = (e: number) => {
+ if (e == 100) {
+ setTimeout(() => { }, 1000)
+ }
+}
+
// サイズ調整部分
//拖拽开始的事件
const id = ref("")
diff --git a/src/view/cloud/index.vue b/src/view/cloud/index.vue
index f92f5f6..29145f2 100644
--- a/src/view/cloud/index.vue
+++ b/src/view/cloud/index.vue
@@ -45,15 +45,22 @@
+
+
diff --git a/src/view/recommend/index.vue b/src/view/recommend/index.vue
index 491e138..26a78aa 100644
--- a/src/view/recommend/index.vue
+++ b/src/view/recommend/index.vue
@@ -5,14 +5,14 @@
-
+
-
+
@@ -43,30 +43,27 @@