去除无用排序

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

View File

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