modify recommend page

This commit is contained in:
simple321vip
2022-12-28 21:25:22 +08:00
parent ab326d5cbb
commit b23d35c29b
15 changed files with 527 additions and 226 deletions
+28
View File
@@ -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) {