build(projects): 增加代码规范

This commit is contained in:
2023-11-03 18:17:27 +08:00
parent 9a0b0505e9
commit 5e64ea27de
38 changed files with 14545 additions and 11926 deletions

View File

@@ -3,15 +3,16 @@
<template v-if="typeNum === 1">
<view class="card" v-for="(item,index) in list as any[]" :key="index">
<view>
<view
>{{ item.Periods }}期开奖:
<view>
{{ item.Periods }}期开奖:
<text
v-for="(num, i) in item.Name"
:key="i"
:style="{
color: numColor(num),
}"
>{{ num }},
>
{{ num }},
</text>
</view>
</view>
@@ -19,24 +20,20 @@
</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"
>+{{ item.DrawNum }}积分</view
>
<view style="color: red">+{{ item.DrawNum }}积分</view>
<view style="color: green">-{{ item.Number }}豆子</view>
</view>
</view>
@@ -49,59 +46,59 @@
</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);
typeNum.value = Number(options.type)
Taro.setNavigationBarTitle({
title: options.type === "1" ? "开奖记录" : "投注记录",
});
getData();
});
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 || [];
res = await getTzJl(Taro.getStorageSync('uid'))
list.value = res.data.data || []
}
Taro.stopPullDownRefresh();
};
Taro.stopPullDownRefresh()
}
</script>
<style lang="scss" scoped>