去除无用排序

This commit is contained in:
2023-10-16 18:25:49 +08:00
parent 2980496abc
commit 998391413c

View File

@@ -3,11 +3,16 @@
<template v-if="typeNum === 1"> <template v-if="typeNum === 1">
<view class="card" v-for="(item,index) in list as any[]" :key="index"> <view class="card" v-for="(item,index) in list as any[]" :key="index">
<view> <view>
<view>{{ item.Periods }}期开奖: <view
>{{ item.Periods }}期开奖:
<!-- <text style="color: red">{{ item.Start }},{{ item.End }}</text>--> <!-- <text style="color: red">{{ item.Start }},{{ item.End }}</text>-->
<text v-for="(num,i) in item.Name" :key="i" :style="{ <text
color: numColor(num) v-for="(num, i) in item.Name"
}">{{ num }}, :key="i"
:style="{
color: numColor(num),
}"
>{{ num }},
</text> </text>
</view> </view>
<!-- <view class="sub">开奖个数:--> <!-- <view class="sub">开奖个数:-->
@@ -21,14 +26,24 @@
</template> </template>
<template v-else> <template v-else>
<view v-if="list.length > 0"> <view v-if="list.length > 0">
<view class="card desc" v-for="(item,index) in list as any[]" :key="index"> <view
class="card desc"
v-for="(item,index) in list as any[]"
:key="index"
>
<view> <view>
<view>{{ item.Periods }}期投注:</view> <view>{{ item.Periods }}期投注:</view>
<view>点数:<text style="color: red">{{ item.Name }}</text></view> <view
<view class="sub">投注时间:<text>{{ item.DrawTime }}</text></view> >点数:<text style="color: red">{{ item.Name }}</text></view
>
<view class="sub"
>投注时间:<text>{{ item.DrawTime }}</text></view
>
</view> </view>
<view style="text-align: right"> <view style="text-align: right">
<view style="color: red" v-if="item.State === 1">+{{ item.DrawNum }}积分</view> <view style="color: red" v-if="item.State === 1"
>+{{ item.DrawNum }}积分</view
>
<view style="color: green">-{{ item.Number }}豆子</view> <view style="color: green">-{{ item.Number }}豆子</view>
</view> </view>
</view> </view>
@@ -36,65 +51,64 @@
<view v-else> <view v-else>
<view style="margin-top: 100px">暂无记录.....</view> <view style="margin-top: 100px">暂无记录.....</view>
</view> </view>
</template> </template>
</view> </view>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import {ref} from 'vue' import { ref } from "vue";
import Taro from '@tarojs/taro' import Taro from "@tarojs/taro";
import {getKaiJiangList, getTzJl} from '@/api' import { getKaiJiangList, getTzJl } from "@/api";
const list = ref<any[]>([]) const list = ref<any[]>([]);
const typeNum = ref(0) const typeNum = ref(0);
Taro.useLoad((options) => { Taro.useLoad((options) => {
typeNum.value = Number(options.type) typeNum.value = Number(options.type);
Taro.setNavigationBarTitle({title: options.type === '1' ? '开奖记录' : '投注记录'}) Taro.setNavigationBarTitle({
getData() title: options.type === "1" ? "开奖记录" : "投注记录",
}) });
getData();
});
Taro.usePullDownRefresh(() => { Taro.usePullDownRefresh(() => {
getData() getData();
}) });
const numColor = (num: string) => { const numColor = (num: string) => {
switch (num) { switch (num) {
case '大': case "大":
return 'red' return "red";
case '小': case "小":
return 'green' return "green";
case '单': case "单":
return 'orange' return "orange";
case '双': case "双":
return 'blue' return "blue";
case '和': case "和":
return 'purple' return "purple";
default: default:
return 'black' return "black";
}
} }
};
const getData = async () => { const getData = async () => {
let res: any let res: any;
if (typeNum.value === 1) { if (typeNum.value === 1) {
res = await getKaiJiangList() res = await getKaiJiangList();
list.value = res.data.data.map((item: any) => { list.value = res.data.data.map((item: any) => {
return { return {
...item, ...item,
Name: item.Name.split('-') Name: item.Name.split("-"),
} };
}) });
} else { } else {
res = await getTzJl(Taro.getStorageSync('uid')) res = await getTzJl(Taro.getStorageSync("uid"));
list.value = res.data.data.sort( list.value = res.data.data || [];
(a: any, b: any) => b.Periods - a.Periods
)
}
Taro.stopPullDownRefresh()
} }
Taro.stopPullDownRefresh();
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -128,5 +142,4 @@ const getData = async () => {
align-items: center; align-items: center;
width: 100%; width: 100%;
} }
</style> </style>