|
|
@@ -2,9 +2,27 @@
|
|
|
<div class="home-market g-flex">
|
|
|
<app-navbar title="市场" :show-back-button="false"></app-navbar>
|
|
|
<div class="home-market__container g-flex__body">
|
|
|
- <Grid :column-num="3" style="margin-bottom:.2rem">
|
|
|
+ <Grid :column-num="3" style="margin-bottom: .2rem;">
|
|
|
<GridItem icon="photo-o" text="商品" :to="{ name: 'order' }" v-for="index in 6" :key="index" />
|
|
|
</Grid>
|
|
|
+ <table style="width: 100%;text-align: center;background-color: #fff;margin-bottom: .2rem;">
|
|
|
+ <tr>
|
|
|
+ <th style="padding: .1rem 0;">合约</th>
|
|
|
+ <th>最新</th>
|
|
|
+ <th>最高</th>
|
|
|
+ <th>最低</th>
|
|
|
+ <th>买量</th>
|
|
|
+ <th>卖量</th>
|
|
|
+ </tr>
|
|
|
+ <tr v-for="(item, index) in quoteList" :key="index">
|
|
|
+ <td style="padding: .1rem 0;">{{ item.goodscode }}</td>
|
|
|
+ <td :class="handlePriceColor(item.last, item.presettle)">{{ handleNoneValue(item.last) }}</td>
|
|
|
+ <td :class="handlePriceColor(item.highest, item.presettle)">{{ handleNoneValue(item.highest) }}</td>
|
|
|
+ <td :class="handlePriceColor(item.lowest, item.presettle)">{{ handleNoneValue(item.lowest) }}</td>
|
|
|
+ <td :class="handlePriceColor(item.bid, item.presettle)">{{ handleNoneValue(item.bidvolume) }}</td>
|
|
|
+ <td :class="handlePriceColor(item.ask, item.presettle)">{{ handleNoneValue(item.askvolume) }}</td>
|
|
|
+ </tr>
|
|
|
+ </table>
|
|
|
<Button @click="showAction = true" plain block>更换主题</Button>
|
|
|
</div>
|
|
|
<ActionSheet v-model:show="showAction" :actions="actions" teleport="body" cancel-text="取消" @select="onSelect" />
|
|
|
@@ -12,11 +30,18 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { ref } from 'vue'
|
|
|
+import { ref, onActivated, onDeactivated } from 'vue'
|
|
|
+import { v4 } from 'uuid'
|
|
|
import { Grid, GridItem, Button, ActionSheet, ActionSheetAction } from 'vant'
|
|
|
-import Theme from '@/hooks/theme'
|
|
|
+import { addSubscribe, removeSubscribe } from '@/business/quote'
|
|
|
+import { globalState } from '@/store'
|
|
|
+import { handlePriceColor, handleNoneValue } from '@/filters'
|
|
|
+import theme from '@/hooks/theme'
|
|
|
|
|
|
+const uuid = v4();
|
|
|
const showAction = ref(false);
|
|
|
+const quoteList = globalState.getRef('quoteList');
|
|
|
+
|
|
|
const actions: ActionSheetAction[] = [
|
|
|
{ name: '默认' },
|
|
|
{ name: '浅色' },
|
|
|
@@ -26,20 +51,28 @@ const actions: ActionSheetAction[] = [
|
|
|
const onSelect = (action: ActionSheetAction) => {
|
|
|
switch (action.name) {
|
|
|
case '默认': {
|
|
|
- Theme.setTheme('default');
|
|
|
+ theme.setTheme('default');
|
|
|
break;
|
|
|
}
|
|
|
case '浅色': {
|
|
|
- Theme.setTheme('light');
|
|
|
+ theme.setTheme('light');
|
|
|
break;
|
|
|
}
|
|
|
case '深色': {
|
|
|
- Theme.setTheme('dark')
|
|
|
+ theme.setTheme('dark')
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
showAction.value = false;
|
|
|
}
|
|
|
+
|
|
|
+onActivated(() => {
|
|
|
+ addSubscribe(['pp2205', 'pp2206', 'b2205', 'b2206'], uuid);
|
|
|
+})
|
|
|
+
|
|
|
+onDeactivated(() => {
|
|
|
+ removeSubscribe(uuid)
|
|
|
+})
|
|
|
</script>
|
|
|
|
|
|
<style lang="less">
|