feat: 放开金种子接口
This commit is contained in:
+3
-3
@@ -426,7 +426,7 @@
|
||||
};
|
||||
|
||||
const fetchTrend = async () => {
|
||||
return
|
||||
// return
|
||||
const params = buildTrendParams();
|
||||
const res: any = await api.goldSeedTrend(params);
|
||||
if (res?.code !== 0) {
|
||||
@@ -548,7 +548,7 @@
|
||||
return has0 || has1;
|
||||
});
|
||||
const fetchPoolGrowth = async () => {
|
||||
return
|
||||
// return
|
||||
const res: any = await api.goldSeedPoolGrowth();
|
||||
if (res?.code !== 0) {
|
||||
poolGrowthData.value = null;
|
||||
@@ -629,7 +629,7 @@
|
||||
return n >= 0 ? '#e54035' : '#777777';
|
||||
});
|
||||
const fetchFluctuation = async () => {
|
||||
return
|
||||
// return
|
||||
const res: any = await api.goldSeedFluctuation();
|
||||
if (res?.code !== 0) {
|
||||
fluctuationData.value = null;
|
||||
|
||||
+13
-174
@@ -39,13 +39,7 @@
|
||||
<image class="search-icon-white" src="/static/icon/search.svg" mode="aspectFit" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="bar-rank-card" v-if="index === 0">
|
||||
<scroll-view class="bar-scroll" scroll-x :show-scrollbar="false" enhanced>
|
||||
<view class="bar-scroll__inner" :style="{ width: barChartWidth }">
|
||||
<card_echart :options="barChartOptions" />
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<aistore_bar_chart v-if="index === 0" :list="barRankList" :colors="barColors" />
|
||||
<!-- <view class="m-t-16 m-b-8" v-if="timeRound.length && index === 0">
|
||||
<scroll-view scroll-x class="time-scroll">
|
||||
<view class="flex">
|
||||
@@ -140,13 +134,13 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch, computed, nextTick } from 'vue';
|
||||
import { onLoad, onShow, onHide, onUnload } from '@dcloudio/uni-app';
|
||||
import { ref, watch, computed } from 'vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
import * as api from '@/sheep/api/ai/index';
|
||||
import card_echart from '@/components/card_echart/card_echart.vue';
|
||||
import card_pages from '@/components/card_pages/card_pages';
|
||||
import card_payment from '@/components/card_payment/card_payment';
|
||||
import aistore_bar_chart from './components/aistore_bar_chart.vue';
|
||||
import aistore_tab1 from './components/aistore_tab1.vue';
|
||||
import aistore_tab2 from './components/aistore_tab2.vue';
|
||||
|
||||
@@ -188,121 +182,17 @@
|
||||
const timeRound = ref([]);
|
||||
const selectedTimeId = ref(null);
|
||||
const navName = ref('');
|
||||
const barColors = ref(['#FF6B6B', '#FFB020', '#2ED573', '#1E90FF', '#A66BFF']);
|
||||
const barRankList = ref([
|
||||
{ id: 1, value: 88, avatar: '/static/head_null.png', color: '#FF6B6B' },
|
||||
{ id: 2, value: 52, avatar: '/static/head_null.png', color: '#FFB020' },
|
||||
{ id: 3, value: 120, avatar: '/static/head_null.png', color: '#2ED573' },
|
||||
{ id: 4, value: 76, avatar: '/static/head_null.png', color: '#1E90FF' },
|
||||
{ id: 5, value: 76, avatar: '/static/head_null.png', color: '#A66BFF' },
|
||||
{ id: 6, value: 66, avatar: '/static/head_null.png', color: '#A66BFF' },
|
||||
{ id: 7, value: 16, avatar: '/static/head_null.png', color: '#A66BFF' },
|
||||
{ id: 8, value: 86, avatar: '/static/head_null.png', color: '#A66BFF' },
|
||||
{ id: 1, value: 88, avatar: '/static/head_null.png' },
|
||||
{ id: 2, value: 52, avatar: '/static/head_null.png' },
|
||||
{ id: 3, value: 120, avatar: '/static/head_null.png' },
|
||||
{ id: 4, value: 76, avatar: '/static/head_null.png' },
|
||||
{ id: 5, value: 76, avatar: '/static/head_null.png' },
|
||||
{ id: 6, value: 66, avatar: '/static/head_null.png' },
|
||||
{ id: 7, value: 16, avatar: '/static/head_null.png' },
|
||||
{ id: 8, value: 86, avatar: '/static/head_null.png' },
|
||||
]);
|
||||
const barRankDisplayList = ref(barRankList.value.map((it) => ({ ...it })));
|
||||
const barChartAnimatedOnce = ref(false);
|
||||
let barIntroTimer = null;
|
||||
const barChartWidth = computed(() => {
|
||||
const list = Array.isArray(barRankList.value) ? barRankList.value : [];
|
||||
if (list.length <= 6) return '100%';
|
||||
return `${list.length * 120}rpx`;
|
||||
});
|
||||
const resetBarDisplay = () => {
|
||||
barRankDisplayList.value = barRankList.value.map((it) => ({ ...it }));
|
||||
};
|
||||
const startBarIntroAnimation = async () => {
|
||||
if (barChartAnimatedOnce.value) return;
|
||||
if (barIntroTimer) {
|
||||
clearTimeout(barIntroTimer);
|
||||
barIntroTimer = null;
|
||||
}
|
||||
barRankDisplayList.value = barRankList.value.map((it) => ({ ...it, value: 0 }));
|
||||
await nextTick();
|
||||
barIntroTimer = setTimeout(() => {
|
||||
resetBarDisplay();
|
||||
barChartAnimatedOnce.value = true;
|
||||
barIntroTimer = null;
|
||||
}, 80);
|
||||
};
|
||||
const barChartOptions = computed(() => {
|
||||
const list = Array.isArray(barRankDisplayList.value) ? barRankDisplayList.value : [];
|
||||
const xData = list.map((_, i) => `Top${i + 1}`);
|
||||
const barData = list.map((it) => ({
|
||||
name: String(it?.id ?? ''),
|
||||
value: Number(it?.value) || 0,
|
||||
itemStyle: {
|
||||
color: it?.color || '#3d5efb',
|
||||
borderRadius: [0, 0, 0, 0],
|
||||
},
|
||||
}));
|
||||
const avatarData = list.map((it) => ({
|
||||
name: String(it?.id ?? ''),
|
||||
value: Number(it?.value) || 0,
|
||||
symbol: `image://${it?.avatar || '/static/head_null.png'}`,
|
||||
}));
|
||||
|
||||
return {
|
||||
animation: true,
|
||||
animationDuration: 900,
|
||||
animationEasing: 'cubicOut',
|
||||
animationDurationUpdate: 900,
|
||||
animationEasingUpdate: 'cubicOut',
|
||||
grid: { left: 0, right: 0, top: 46, bottom: 22, containLabel: false },
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: xData,
|
||||
axisLine: {
|
||||
show: true,
|
||||
lineStyle: {
|
||||
color: 'rgba(255,255,255,0.45)',
|
||||
width: 1,
|
||||
},
|
||||
},
|
||||
axisTick: { show: false },
|
||||
axisLabel: {
|
||||
show: true,
|
||||
color: 'rgba(255,255,255,0.85)',
|
||||
fontSize: 10,
|
||||
margin: 10,
|
||||
},
|
||||
},
|
||||
yAxis: { type: 'value', show: false, min: 0 },
|
||||
series: [
|
||||
{
|
||||
id: 'bars',
|
||||
type: 'bar',
|
||||
data: barData,
|
||||
barWidth: '42%',
|
||||
barCategoryGap: '42%',
|
||||
universalTransition: true,
|
||||
label: {
|
||||
show: true,
|
||||
position: 'inside',
|
||||
color: '#ffffff',
|
||||
fontSize: 12,
|
||||
fontWeight: 700,
|
||||
formatter: (p) => {
|
||||
const v = Number(p?.value) || 0;
|
||||
return v ? String(v) : '';
|
||||
},
|
||||
},
|
||||
animationDelay: (idx) => idx * 140,
|
||||
animationDelayUpdate: (idx) => idx * 140,
|
||||
},
|
||||
{
|
||||
id: 'avatars',
|
||||
type: 'pictorialBar',
|
||||
data: avatarData,
|
||||
symbolSize: [28, 28],
|
||||
symbolPosition: 'end',
|
||||
symbolOffset: [0, -34],
|
||||
z: 10,
|
||||
universalTransition: true,
|
||||
animationDelay: (idx) => idx * 140,
|
||||
animationDelayUpdate: (idx) => idx * 140,
|
||||
},
|
||||
],
|
||||
};
|
||||
});
|
||||
|
||||
function changeTimeRound(e) {
|
||||
navName.value = e.name;
|
||||
@@ -400,27 +290,6 @@
|
||||
}
|
||||
getSpuTimeList();
|
||||
getCartList();
|
||||
if (index.value === 0) {
|
||||
startBarIntroAnimation();
|
||||
} else {
|
||||
resetBarDisplay();
|
||||
}
|
||||
});
|
||||
|
||||
onHide(() => {
|
||||
if (barIntroTimer) {
|
||||
clearTimeout(barIntroTimer);
|
||||
barIntroTimer = null;
|
||||
}
|
||||
resetBarDisplay();
|
||||
});
|
||||
|
||||
onUnload(() => {
|
||||
if (barIntroTimer) {
|
||||
clearTimeout(barIntroTimer);
|
||||
barIntroTimer = null;
|
||||
}
|
||||
resetBarDisplay();
|
||||
});
|
||||
|
||||
const update = () => {
|
||||
@@ -442,21 +311,6 @@
|
||||
const height = ref(`${baseHeight}px`);
|
||||
const hasPaymentBar = ref(false);
|
||||
|
||||
watch(
|
||||
() => index.value,
|
||||
(val) => {
|
||||
if (val === 0) {
|
||||
startBarIntroAnimation();
|
||||
return;
|
||||
}
|
||||
if (barIntroTimer) {
|
||||
clearTimeout(barIntroTimer);
|
||||
barIntroTimer = null;
|
||||
}
|
||||
resetBarDisplay();
|
||||
},
|
||||
);
|
||||
|
||||
watch(
|
||||
() => hasPaymentBar.value,
|
||||
() => {
|
||||
@@ -666,21 +520,6 @@
|
||||
filter: brightness(0) invert(1);
|
||||
}
|
||||
|
||||
.bar-rank-card {
|
||||
margin-top: 18rpx;
|
||||
padding: 18rpx 24rpx 22rpx;
|
||||
height: 300rpx;
|
||||
}
|
||||
|
||||
.bar-scroll {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.bar-scroll__inner {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.time-scroll {
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
|
||||
@@ -0,0 +1,229 @@
|
||||
<template>
|
||||
<view class="bar-rank-card">
|
||||
<scroll-view class="bar-scroll" scroll-x :show-scrollbar="false" enhanced>
|
||||
<view class="bar-scroll__inner" :style="{ width: chartWidth }">
|
||||
<card_echart :options="chartOptions" />
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, nextTick, onUnmounted, ref, watch } from 'vue';
|
||||
import card_echart from '@/components/card_echart/card_echart.vue';
|
||||
|
||||
const props = defineProps({
|
||||
active: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
list: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
colors: {
|
||||
type: Array,
|
||||
default: () => ['#FF6B6B', '#FFB020', '#2ED573', '#1E90FF', '#A66BFF'],
|
||||
},
|
||||
maxVisible: {
|
||||
type: Number,
|
||||
default: 6,
|
||||
},
|
||||
itemWidthRpx: {
|
||||
type: Number,
|
||||
default: 120,
|
||||
},
|
||||
yMaxFactor: {
|
||||
type: Number,
|
||||
default: 1.25,
|
||||
},
|
||||
animateOnce: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
});
|
||||
|
||||
const animatedOnce = ref(false);
|
||||
const displayList = ref([]);
|
||||
let introTimer = null;
|
||||
|
||||
const normalizedList = computed(() => {
|
||||
const raw = Array.isArray(props.list) ? props.list : [];
|
||||
return raw.map((it, idx) => {
|
||||
const id = it?.id ?? idx + 1;
|
||||
const value = Number(it?.value) || 0;
|
||||
const avatar = it?.avatar || '/static/head_null.png';
|
||||
const label = String(it?.label || `Top${idx + 1}`);
|
||||
return { id, value, avatar, label };
|
||||
});
|
||||
});
|
||||
|
||||
const chartWidth = computed(() => {
|
||||
const n = normalizedList.value.length;
|
||||
if (n <= props.maxVisible) return '100%';
|
||||
return `${n * 96}rpx`;
|
||||
});
|
||||
|
||||
const resetDisplay = () => {
|
||||
displayList.value = normalizedList.value.map((it) => ({ ...it }));
|
||||
};
|
||||
|
||||
const clearIntroTimer = () => {
|
||||
if (introTimer) {
|
||||
clearTimeout(introTimer);
|
||||
introTimer = null;
|
||||
}
|
||||
};
|
||||
|
||||
const startIntroAnimation = async () => {
|
||||
if (!props.active) return;
|
||||
if (!props.animateOnce) {
|
||||
resetDisplay();
|
||||
return;
|
||||
}
|
||||
if (animatedOnce.value) {
|
||||
resetDisplay();
|
||||
return;
|
||||
}
|
||||
clearIntroTimer();
|
||||
displayList.value = normalizedList.value.map((it) => ({ ...it, value: 0 }));
|
||||
await nextTick();
|
||||
introTimer = setTimeout(() => {
|
||||
resetDisplay();
|
||||
animatedOnce.value = true;
|
||||
introTimer = null;
|
||||
}, 80);
|
||||
};
|
||||
|
||||
watch(
|
||||
() => normalizedList.value,
|
||||
() => {
|
||||
if (!props.active) return;
|
||||
if (animatedOnce.value && props.animateOnce) {
|
||||
resetDisplay();
|
||||
return;
|
||||
}
|
||||
startIntroAnimation();
|
||||
},
|
||||
{ deep: true, immediate: true },
|
||||
);
|
||||
|
||||
watch(
|
||||
() => props.active,
|
||||
(val) => {
|
||||
if (val) {
|
||||
startIntroAnimation();
|
||||
return;
|
||||
}
|
||||
clearIntroTimer();
|
||||
resetDisplay();
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
onUnmounted(() => {
|
||||
clearIntroTimer();
|
||||
});
|
||||
|
||||
const chartOptions = computed(() => {
|
||||
const list = Array.isArray(displayList.value) ? displayList.value : [];
|
||||
const xData = list.map((it) => it.label);
|
||||
const palette =
|
||||
Array.isArray(props.colors) && props.colors.length ? props.colors : ['#3d5efb'];
|
||||
|
||||
const barData = list.map((it, i) => ({
|
||||
name: String(it?.id ?? ''),
|
||||
value: Number(it?.value) || 0,
|
||||
itemStyle: {
|
||||
color: palette[i % palette.length],
|
||||
borderRadius: [0, 0, 0, 0],
|
||||
},
|
||||
}));
|
||||
|
||||
const avatarData = list.map((it) => ({
|
||||
name: String(it?.id ?? ''),
|
||||
value: Number(it?.value) || 0,
|
||||
symbol: `image://${it?.avatar || '/static/head_null.png'}`,
|
||||
}));
|
||||
|
||||
const maxV = Math.max(...list.map((it) => Number(it?.value) || 0), 1);
|
||||
const yMax = Math.ceil(maxV * (Number(props.yMaxFactor) || 1.25));
|
||||
|
||||
return {
|
||||
animation: true,
|
||||
animationDuration: 900,
|
||||
animationEasing: 'cubicOut',
|
||||
animationDurationUpdate: 900,
|
||||
animationEasingUpdate: 'cubicOut',
|
||||
grid: { left: 0, right: 0, top: 46, bottom: 22, containLabel: false },
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: xData,
|
||||
axisLine: {
|
||||
show: true,
|
||||
lineStyle: { color: 'rgba(255,255,255,0.45)', width: 1 },
|
||||
},
|
||||
axisTick: { show: false },
|
||||
axisLabel: {
|
||||
show: true,
|
||||
color: 'rgba(255,255,255,0.85)',
|
||||
fontSize: 10,
|
||||
margin: 10,
|
||||
},
|
||||
},
|
||||
yAxis: { type: 'value', show: false, min: 0, max: yMax },
|
||||
series: [
|
||||
{
|
||||
id: 'bars',
|
||||
type: 'bar',
|
||||
data: barData,
|
||||
barWidth: 20,
|
||||
barCategoryGap: 8,
|
||||
universalTransition: true,
|
||||
label: {
|
||||
show: true,
|
||||
position: 'inside',
|
||||
color: '#ffffff',
|
||||
fontSize: 10,
|
||||
fontWeight: 700,
|
||||
formatter: (p) => {
|
||||
const v = Number(p?.value) || 0;
|
||||
return v ? String(v) : '';
|
||||
},
|
||||
},
|
||||
animationDelay: (idx) => idx * 140,
|
||||
animationDelayUpdate: (idx) => idx * 140,
|
||||
},
|
||||
{
|
||||
id: 'avatars',
|
||||
type: 'pictorialBar',
|
||||
data: avatarData,
|
||||
symbolSize: [24, 24],
|
||||
symbolPosition: 'end',
|
||||
symbolOffset: [0, -28],
|
||||
z: 10,
|
||||
universalTransition: true,
|
||||
animationDelay: (idx) => idx * 140,
|
||||
animationDelayUpdate: (idx) => idx * 140,
|
||||
},
|
||||
],
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.bar-rank-card {
|
||||
margin-top: 18rpx;
|
||||
padding: 12rpx 24rpx 12rpx;
|
||||
height: 240rpx;
|
||||
}
|
||||
|
||||
.bar-scroll {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.bar-scroll__inner {
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -368,9 +368,7 @@
|
||||
}
|
||||
|
||||
.notice-card {
|
||||
margin-top: 18rpx;
|
||||
margin-bottom: 18rpx;
|
||||
padding: 20rpx 0;
|
||||
padding: 20rpx 0 10rpx;
|
||||
}
|
||||
|
||||
.notice-item {
|
||||
|
||||
Reference in New Issue
Block a user