增加 bk futrue mock, 增加日历加载式样

This commit is contained in:
simple321vip
2023-01-29 23:27:20 +08:00
parent d1a4e48708
commit 01e222e7fc
3 changed files with 155 additions and 13 deletions
+33 -1
View File
@@ -9,5 +9,37 @@ export default [
count: 53, count: 53,
} }
} }
} },
{
url: '/bookmark/api/v1/bookmark',
method: 'get',
response: () => {
return [
{
bk_id: '001',
bk_type_id: '2',
bk_type_name: '3',
comment: '4',
url: '5'
},
{
bk_id: '002',
bk_type_id: '2',
bk_type_name: '3',
comment: '4',
url: '5'
}
]
}
},
{
url: '/bookmark/api/v1/bookmark_type',
method: 'get',
response: () => {
return [
]
}
},
] as MockMethod[] ] as MockMethod[]
+102
View File
@@ -130,5 +130,107 @@ export default [
} }
} }
}, },
{
url: '/trader/api/v1/accounts',
method: 'get',
response: ({ body, query }) => {
return {
accounts: [
{
gateway_name: 'cpt',
account_id: '7788',
balance: '7',
frozen: '8',
},
{
gateway_name: 'cpt',
account_id: '778899',
balance: '8',
frozen: '9',
}
],
positions: [
{
symbol: 'czce',
exchange: 'RM301',
direction: '1',
volume: 222,
price: 2500,
frozen: 3,
pnl: 2,
yd_volume: 1,
}
],
trades: [
{
symbol: 'string',
exchange: 'string',
direction: 'string',
volume: 2,
price: 4,
orderid: 'string',
tradeid: 'string',
offset: 'string',
}
],
orders: [{
symbol: 'string',
exchange: 'string',
direction: 'string',
volume: 6,
price: 4,
orderid: 'string',
type: 'string',
offset: 'string',
traded: 7,
status: 'string',
// datetime :datetime
reference: 'string',
}]
}
}
},
{
url: '/trader/api/v1/strategy_file',
method: 'get',
response: ({ body, query }) => {
return [
{
file_name: 'string',
class_name: 'string',
status: 'string',
}
]
}
},
{
url: '/trader/api/v1/strategies',
method: 'get',
response: ({ body, query }) => {
return [
{
strategy_name: 'string',
class_name: 'string',
vt_symbol: 'string',
setting: Object,
status: 1,
}
]
}
},
{
url: '/trader/api/v1/strategy_file/load',
method: 'get',
response: ({ body, query }) => {
return [
{
class_names: 'asdasdas'
}
]
}
},
] as MockMethod[] ] as MockMethod[]
+20 -12
View File
@@ -1,6 +1,7 @@
<template> <template>
<el-calendar v-model="value"> <el-calendar v-model="value" v-if="isComponentActive" v-loading="isComponentLoading"
<template #dateCell="{ data }"> element-loading-text="主人别着急我在努力加载中^_^">
<template #dateCell="{ data }" lo>
<div class="date-cell-holiday" v-if="Object.keys(holidays).includes(toLocalDate(data.date))"> <div class="date-cell-holiday" v-if="Object.keys(holidays).includes(toLocalDate(data.date))">
<span style="color: red;" @click="onclick(data.date)"> {{ data.date.getDate() }}</span><br> <span style="color: red;" @click="onclick(data.date)"> {{ data.date.getDate() }}</span><br>
<span>{{ holidays[toLocalDate(data.date)] }}</span> <span>{{ holidays[toLocalDate(data.date)] }}</span>
@@ -55,7 +56,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { nextTick, reactive, ref } from 'vue' import { nextTick, onMounted, reactive, ref } from 'vue'
import { get_holiday } from '@/service/calendar' import { get_holiday } from '@/service/calendar'
import { toLocalDate } from '@/utils/date' import { toLocalDate } from '@/utils/date'
import { get_event, put_event } from "@/api/calendar" import { get_event, put_event } from "@/api/calendar"
@@ -80,6 +81,8 @@ const form = reactive({
const value = ref(new Date()) const value = ref(new Date())
const dialogFormVisible = ref(false) const dialogFormVisible = ref(false)
const formLabelWidth = '140px' const formLabelWidth = '140px'
const isComponentActive = ref(false)
const isComponentLoading = ref(true)
const checkedalerts = ref([]) const checkedalerts = ref([])
const alerts = ['email', 'messageBox', '手机短信', '微信通知'] const alerts = ['email', 'messageBox', '手机短信', '微信通知']
@@ -116,19 +119,24 @@ const handleCommand = (command: string) => {
/** /**
* AUTO INVOKE FUNCTION * AUTO INVOKE FUNCTION
*/ */
get_holiday().then((resp) => { onMounted(async () => {
Object.keys(resp.data).forEach(element => { await get_holiday().then((resp) => {
holidays[element] = resp.data[element] Object.keys(resp.data).forEach(element => {
holidays[element] = resp.data[element]
})
}) })
}) await get_event().then((response) => {
get_event().then((response) => { eventDataList.length = 0
eventDataList.length = 0 response.data.forEach((record: Event) => {
response.data.forEach((record: Event) => { eventDataList.push(record)
eventDataList.push(record) eventDataObject[record.date] = record.title
eventDataObject[record.date] = record.title })
}) })
isComponentActive.value = true
isComponentLoading.value = false
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>