build(custom): 修正提交规范

This commit is contained in:
2023-11-09 19:49:24 +08:00
parent 76d57cea37
commit 29c1d4280f
105 changed files with 29374 additions and 18618 deletions

View File

@@ -1,3 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '我的账户'
})
navigationBarTitleText: "我的账户",
});

View File

@@ -1,316 +1,306 @@
<script lang="ts" setup>
import {computed, ref} from "vue";
import {showToast, useLoad, getStorageSync} from "@tarojs/taro";
import {getIntegralDetail, getBeanDetail, getGiftRecord} from "@/api/user";
import { computed, ref } from "vue";
import { showToast, useLoad, getStorageSync } from "@tarojs/taro";
import { getIntegralDetail, getBeanDetail, getGiftRecord } from "@/api/user";
const tabValue = ref(1);
const tabsList = ref([
{
title: "兑换明细",
value: 1,
},
{
title: "赠送明细",
value: 3,
},
{
title: "豆子明细",
value: 2,
},
{
title: "活动赠送",
value: 4,
}
{
title: "兑换明细",
value: 1,
},
{
title: "赠送明细",
value: 3,
},
{
title: "豆子明细",
value: 2,
},
{
title: "活动赠送",
value: 4,
},
]);
const computerType = computed(() => {
return (val: number) => {
switch (val) {
case 5:
return '注册赠送';
case 6:
return '签到赠送';
case 7:
return '系统赠送';
}
return (val: number) => {
switch (val) {
case 5:
return "注册赠送";
case 6:
return "签到赠送";
case 7:
return "系统赠送";
}
})
};
});
const tabChange = (index: number) => {
tabValue.value = index;
data.value = [];
getList();
page.value.PageNum = 1;
tabValue.value = index;
data.value = [];
getList();
page.value.PageNum = 1;
};
const data = ref([]);
const data = ref<any>([]);
const userInfo = ref<any>({});
useLoad(() => {
getList();
userInfo.value = getStorageSync("userInfo");
getList();
userInfo.value = getStorageSync("userInfo");
});
const page = ref({
PageNum: 1,
PageSize: 10,
ItemCount: 0,
PageNum: 1,
PageSize: 10,
ItemCount: 0,
});
const pageChange = (e: number) => {
page.value.PageNum = e;
getList();
page.value.PageNum = e;
getList();
};
const getList = async () => {
try {
let res: any;
const newData = {
PageNum: page.value.PageNum,
PageSize: page.value.PageSize,
Type: tabValue.value,
};
if (tabValue.value === 1 || tabValue.value === 3) {
res = await getBeanDetail(newData);
} else if (tabValue.value === 2) {
delete data.Type;
res = await getIntegralDetail(newData);
} else {
res = await getGiftRecord(newData);
}
console.log(res);
data.value = res.data.data || [];
page.value.ItemCount = res.data.count;
} catch (error) {
showToast({
title: error.msg,
icon: "none",
});
try {
let res: any;
const newData = {
PageNum: page.value.PageNum,
PageSize: page.value.PageSize,
Type: tabValue.value,
};
if (tabValue.value === 1 || tabValue.value === 3) {
res = await getBeanDetail(newData);
} else if (tabValue.value === 2) {
// delete data.value.Type;
Reflect.deleteProperty(data.value, "Type");
res = await getIntegralDetail(newData);
} else {
res = await getGiftRecord(newData);
}
data.value = res.data.data || [];
page.value.ItemCount = res.data.count;
} catch (error) {
showToast({
title: error.msg,
icon: "none",
});
}
};
</script>
<template>
<view>
<view class="card">
<!-- <view class="greeting">Hello! YuanHuakk</view> -->
<view class="info">
<view class="left">
<view>
<view class="num">豆子: {{ userInfo.pulse }}</view>
</view>
<view>
<view class="num">积分: {{ userInfo.integral }}</view>
</view>
</view>
<!-- <image class="img" src="https://picdm.sunbangyan.cn/2023/08/15/ste192.png"/> -->
</view>
<view>
<view class="card">
<!-- <view class="greeting">Hello! YuanHuakk</view> -->
<view class="info">
<view class="left">
<view>
<view class="num">豆子: {{ userInfo.pulse }}</view>
</view>
<view>
<view class="num">积分: {{ userInfo.integral }}</view>
</view>
</view>
<view class="tabs-box">
<view
v-for="item in tabsList"
:key="item.value"
@click="tabChange(item.value)"
>
<view class="text">{{ item.title }}</view>
<view
class="line"
:class="{ lineColor: item.value === tabValue }"
></view>
</view>
</view>
<view v-if="data.length > 0">
<view v-if="tabValue === 1 || tabValue === 3">
<view
class="card-list"
v-for="(item, index) in (data as any[])"
:key="index"
>
<view class="left">
<view>商品{{ item.goods_name }}</view>
<view>时间{{ item.add_time.slice(0, 10) }}</view>
</view>
<view class="right">
<view v-if="tabValue === 1" style="color: green"
>-
<text>{{ item.number }}积分</text>
</view
>
<view v-if="tabValue === 3" style="color: red"
>+
<text>{{ item.number }}
</text
>
积分
</view
>
</view>
</view>
</view>
<view v-else-if="tabValue === 2">
<view
class="card-list"
v-for="(item, index) in (data as any[])"
:key="index"
>
<view class="left">
<view class="text">商品{{ item.goods_name }}</view>
<view>金额{{ item.order_number }}</view>
<view>时间{{ item.add_time.slice(0, 10) }}</view>
</view>
<view class="right">
<view style="color: red"
>+
<text>{{ item.number }}
</text
>
豆子
</view
>
</view>
</view>
</view>
<view v-else-if="tabValue === 4">
<view
class="card-list"
v-for="(item, index) in (data as any[])"
:key="index"
>
<view class="left">
<view class="text">类型{{ computerType(item.type) }}</view>
<view>时间{{ item.add_time.slice(0, 10) }}</view>
</view>
<view class="right">
<view style="color: red"
>+
<text>{{ item.number }}
</text
>
豆子
</view
>
</view>
</view>
</view>
<nut-pagination
v-model="page.PageNum"
:total-items="page.ItemCount"
:items-per-page="page.PageSize"
@change="pageChange"
/>
</view>
<nut-empty v-else description="暂无明细"></nut-empty>
<!-- <image class="img" src="https://picdm.sunbangyan.cn/2023/08/15/ste192.png"/> -->
</view>
</view>
<view class="tabs-box">
<view
v-for="item in tabsList"
:key="item.value"
@click="tabChange(item.value)"
>
<view class="text">{{ item.title }}</view>
<view
class="line"
:class="{ lineColor: item.value === tabValue }"
></view>
</view>
</view>
<view v-if="data.length > 0">
<view v-if="tabValue === 1 || tabValue === 3">
<view
class="card-list"
v-for="(item, index) in (data as any[])"
:key="index"
>
<view class="left">
<view>商品{{ item.goods_name }}</view>
<view>时间{{ item.add_time.slice(0, 10) }}</view>
</view>
<view class="right">
<view v-if="tabValue === 1" style="color: green"
>-
<text>{{ item.number }}积分</text>
</view>
<view v-if="tabValue === 3" style="color: red"
>+
<text>{{ item.number }} </text>
积分
</view>
</view>
</view>
</view>
<view v-else-if="tabValue === 2">
<view
class="card-list"
v-for="(item, index) in (data as any[])"
:key="index"
>
<view class="left">
<view class="text">商品{{ item.goods_name }}</view>
<view>金额{{ item.order_number }}</view>
<view>时间{{ item.add_time.slice(0, 10) }}</view>
</view>
<view class="right">
<view style="color: red"
>+
<text>{{ item.number }} </text>
豆子
</view>
</view>
</view>
</view>
<view v-else-if="tabValue === 4">
<view
class="card-list"
v-for="(item, index) in (data as any[])"
:key="index"
>
<view class="left">
<view class="text">类型{{ computerType(item.type) }}</view>
<view>时间{{ item.add_time.slice(0, 10) }}</view>
</view>
<view class="right">
<view style="color: red"
>+
<text>{{ item.number }} </text>
豆子
</view>
</view>
</view>
</view>
<nut-pagination
v-model="page.PageNum"
:total-items="page.ItemCount"
:items-per-page="page.PageSize"
@change="pageChange"
/>
</view>
<nut-empty v-else description="暂无明细"></nut-empty>
</view>
</template>
<style lang="scss">
.nut-pagination {
position: absolute;
left: 50%;
transform: translateX(-50%);
position: absolute;
left: 50%;
transform: translateX(-50%);
}
.card {
width: 90%;
height: 300px;
border-radius: 20px;
background-color: #282828;
box-shadow: 0 0 10px rgba(40, 40, 40, 0.1);
background-size: 100% 100%;
background-repeat: no-repeat;
margin: 10px auto;
color: #d0a568;
padding: 20px;
width: 90%;
height: 300px;
border-radius: 20px;
background-color: #282828;
box-shadow: 0 0 10px rgba(40, 40, 40, 0.1);
background-size: 100% 100%;
background-repeat: no-repeat;
margin: 10px auto;
color: #d0a568;
padding: 20px;
.greeting {
font-size: 35px;
.greeting {
font-size: 35px;
font-weight: bold;
}
.info {
display: flex;
justify-content: space-between;
.left {
height: 300px;
width: 50%;
text-align: left;
margin-left: 50px;
display: flex;
flex-direction: column;
justify-content: center;
.num {
font-size: 40px;
font-weight: bold;
margin-top: 10px;
}
}
.info {
display: flex;
justify-content: space-between;
.left {
height: 300px;
width: 50%;
text-align: left;
margin-left: 50px;
display: flex;
flex-direction: column;
justify-content: center;
.num {
font-size: 40px;
font-weight: bold;
margin-top: 10px;
}
}
.img {
width: 380px;
height: 270px;
}
.img {
width: 380px;
height: 270px;
}
}
}
.tabs-box {
display: flex;
flex-direction: row;
justify-content: space-evenly;
display: flex;
flex-direction: row;
justify-content: space-evenly;
align-items: center;
height: auto;
background-color: #fff;
padding: 0 20px;
text-align: center;
.text {
margin: 10px 20px;
align-items: center;
height: auto;
background-color: #fff;
padding: 0 20px;
text-align: center;
}
.text {
margin: 10px 20px;
align-items: center;
}
.line {
margin: 0 auto;
width: 50px;
height: 5px;
border-radius: 30px;
transition: all 0.3s ease-in-out;
}
.line {
margin: 0 auto;
width: 50px;
height: 5px;
border-radius: 30px;
transition: all 0.3s ease-in-out;
}
.lineColor {
background-color: #ff0000;
}
.lineColor {
background-color: #ff0000;
}
}
.card-list {
margin: 10px 20px;
background-color: #fff;
display: flex;
border-radius: 10px;
padding: 20px;
justify-content: space-between;
align-items: center;
margin: 10px 20px;
background-color: #fff;
display: flex;
border-radius: 10px;
padding: 20px;
justify-content: space-between;
align-items: center;
.left {
width: 500px;
.left {
width: 500px;
.text {
text-align: left;
width: 100%;
// 超出一行隐藏
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
overflow: hidden;
word-break: break-word;
}
.text {
text-align: left;
width: 100%;
// 超出一行隐藏
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
overflow: hidden;
word-break: break-word;
}
}
.right {
flex: 1;
text-align: right;
}
.right {
flex: 1;
text-align: right;
}
}
</style>