feat: ai店铺添加柱状图
This commit is contained in:
@@ -51,10 +51,10 @@
|
||||
<span class="c_FF2D2D">*</span>
|
||||
{{ `提现时间为${config.brokerageWithdrawTime}` }}
|
||||
</view>
|
||||
<view>
|
||||
<!-- <view>
|
||||
<span class="c_FF2D2D">*</span>
|
||||
一天(24小时)内只可提现1次
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="submit-btn" @click="onSubmit">提现</view>
|
||||
|
||||
+168
-107
@@ -39,42 +39,14 @@
|
||||
<image class="search-icon-white" src="/static/icon/search.svg" mode="aspectFit" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="notice-card" v-if="mesArr.length && index === 0">
|
||||
<view class="notice-marquee-viewport">
|
||||
<view
|
||||
class="notice-marquee-track"
|
||||
:class="{ 'is-scroll': mesArr.length > 1 }"
|
||||
:style="mesArr.length > 1 ? { '--marquee-duration': marqueeDuration } : {}"
|
||||
>
|
||||
<view class="notice-marquee-content">
|
||||
<view
|
||||
v-for="(line, i) in mesArr"
|
||||
:key="line.id || i"
|
||||
class="notice-item notice-marquee-item flex-center h100"
|
||||
>
|
||||
<view class="notice-icon flex-center shrink">
|
||||
<uni-icons type="person-filled" color="#2556EC" size="16" />
|
||||
</view>
|
||||
<view class="notice-text lineOne" v-html="line.messageContent"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="notice-marquee-content" v-if="mesArr.length > 1" aria-hidden="true">
|
||||
<view
|
||||
v-for="(line, i) in mesArr"
|
||||
:key="`dup-${line.id || i}`"
|
||||
class="notice-item notice-marquee-item flex-center h100"
|
||||
>
|
||||
<view class="notice-icon flex-center shrink">
|
||||
<uni-icons type="person-filled" color="#2556EC" size="16" />
|
||||
</view>
|
||||
<view class="notice-text lineOne" v-html="line.messageContent"></view>
|
||||
</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>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<view class="m-t-16 m-b-8" v-if="timeRound.length && index === 0">
|
||||
<!-- <view class="m-t-16 m-b-8" v-if="timeRound.length && index === 0">
|
||||
<scroll-view scroll-x class="time-scroll">
|
||||
<view class="flex">
|
||||
<view
|
||||
@@ -88,7 +60,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view> -->
|
||||
<view style="padding: 80rpx 0 120rpx" v-if="index === 1">
|
||||
<view style="position: relative">
|
||||
<view class="shop-summary-card">
|
||||
@@ -168,10 +140,11 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch, computed } from 'vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import { ref, watch, computed, nextTick } from 'vue';
|
||||
import { onLoad, onShow, onHide, onUnload } 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_tab1 from './components/aistore_tab1.vue';
|
||||
@@ -215,11 +188,120 @@
|
||||
const timeRound = ref([]);
|
||||
const selectedTimeId = ref(null);
|
||||
const navName = ref('');
|
||||
const mesArr = ref([]);
|
||||
const marqueeDuration = computed(() => {
|
||||
const n = Array.isArray(mesArr.value) ? mesArr.value.length : 0;
|
||||
const seconds = Math.max(14, n * 2);
|
||||
return `${seconds}s`;
|
||||
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' },
|
||||
]);
|
||||
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) {
|
||||
@@ -245,11 +327,6 @@
|
||||
}
|
||||
};
|
||||
|
||||
const getMessageList = async () => {
|
||||
const res = await api.getMessageList({ pageNo: 1, pageSize: 10 }).catch(() => ({ code: -1 }));
|
||||
mesArr.value = res?.code === 0 ? res?.data || [] : [];
|
||||
};
|
||||
|
||||
onLoad((options) => {
|
||||
const tab = Number(options?.tab);
|
||||
if (tab === 1) {
|
||||
@@ -323,7 +400,27 @@
|
||||
}
|
||||
getSpuTimeList();
|
||||
getCartList();
|
||||
getMessageList();
|
||||
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 = () => {
|
||||
@@ -345,6 +442,21 @@
|
||||
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,
|
||||
() => {
|
||||
@@ -554,70 +666,19 @@
|
||||
filter: brightness(0) invert(1);
|
||||
}
|
||||
|
||||
.notice-card {
|
||||
.bar-rank-card {
|
||||
margin-top: 18rpx;
|
||||
padding: 20rpx 40rpx;
|
||||
padding: 18rpx 24rpx 22rpx;
|
||||
height: 300rpx;
|
||||
}
|
||||
|
||||
.notice-item {
|
||||
height: 50rpx;
|
||||
padding: 0 20rpx;
|
||||
border-radius: 999rpx;
|
||||
background: rgba(255, 255, 255, 0.95);
|
||||
.bar-scroll {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.notice-icon {
|
||||
width: 34rpx;
|
||||
height: 34rpx;
|
||||
border-radius: 50%;
|
||||
background: rgba(37, 86, 236, 0.12);
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
|
||||
.notice-text {
|
||||
// flex: 1;
|
||||
width: 300rpx;
|
||||
font-size: 22rpx;
|
||||
color: #111111;
|
||||
line-height: 50rpx;
|
||||
}
|
||||
|
||||
.notice-marquee-viewport {
|
||||
overflow: hidden;
|
||||
height: 50rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-radius: 30rpx;
|
||||
}
|
||||
|
||||
.notice-marquee-track {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
transform: translateX(0);
|
||||
will-change: transform;
|
||||
&.is-scroll {
|
||||
animation: notice-marquee-move var(--marquee-duration, 16s) linear infinite;
|
||||
}
|
||||
}
|
||||
|
||||
.notice-marquee-content {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.notice-marquee-item {
|
||||
flex-shrink: 0;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
@keyframes notice-marquee-move {
|
||||
0% {
|
||||
transform: translateX(0);
|
||||
}
|
||||
100% {
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
.bar-scroll__inner {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.time-scroll {
|
||||
|
||||
@@ -31,6 +31,41 @@
|
||||
</view>
|
||||
<view class="pages">
|
||||
<!-- <s-custom-navbarIndex /> -->
|
||||
<view class="notice-card" v-if="mesArr.length">
|
||||
<view class="notice-marquee-viewport">
|
||||
<view
|
||||
class="notice-marquee-track"
|
||||
:class="{ 'is-scroll': mesArr.length > 1 }"
|
||||
:style="mesArr.length > 1 ? { '--marquee-duration': marqueeDuration } : {}"
|
||||
>
|
||||
<view class="notice-marquee-content">
|
||||
<view
|
||||
v-for="(line, i) in mesArr"
|
||||
:key="line.id || i"
|
||||
class="notice-item notice-marquee-item flex-center h100"
|
||||
>
|
||||
<view class="notice-icon flex-center shrink">
|
||||
<uni-icons type="person-filled" color="#2556EC" size="16" />
|
||||
</view>
|
||||
<view class="notice-text lineOne" v-html="line.messageContent"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="notice-marquee-content" v-if="mesArr.length > 1" aria-hidden="true">
|
||||
<view
|
||||
v-for="(line, i) in mesArr"
|
||||
:key="`dup-${line.id || i}`"
|
||||
class="notice-item notice-marquee-item flex-center h100"
|
||||
>
|
||||
<view class="notice-icon flex-center shrink">
|
||||
<uni-icons type="person-filled" color="#2556EC" size="16" />
|
||||
</view>
|
||||
<view class="notice-text lineOne" v-html="line.messageContent"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<s-banner
|
||||
v-if="template?.components[0]?.property.items?.length"
|
||||
:data="template.components[0].property"
|
||||
@@ -88,6 +123,7 @@
|
||||
import sheep from '@/sheep';
|
||||
import $share from '@/sheep/platform/share';
|
||||
import * as api from '@/sheep/api/index/index';
|
||||
import * as aiApi from '@/sheep/api/ai/index';
|
||||
const HOME_DEFAULT_TAB_STORAGE_KEY = 'home.goods.defaultTabName';
|
||||
const defaultTabName = ref('');
|
||||
let template = ref({
|
||||
@@ -204,6 +240,19 @@
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const mesArr = ref([]);
|
||||
const marqueeDuration = computed(() => {
|
||||
const n = Array.isArray(mesArr.value) ? mesArr.value.length : 0;
|
||||
const seconds = Math.max(14, n * 2);
|
||||
return `${seconds}s`;
|
||||
});
|
||||
|
||||
const getMessageList = async () => {
|
||||
const res = await aiApi.getMessageList({ pageNo: 1, pageSize: 10 }).catch(() => ({ code: -1 }));
|
||||
mesArr.value = res?.code === 0 ? res?.data || [] : [];
|
||||
};
|
||||
|
||||
const getData = () => {
|
||||
// banner
|
||||
getBanner();
|
||||
@@ -211,6 +260,7 @@
|
||||
getproducttaglist();
|
||||
getnotification();
|
||||
getappbanner();
|
||||
getMessageList();
|
||||
};
|
||||
onLoad((options) => {
|
||||
getData();
|
||||
@@ -317,6 +367,72 @@
|
||||
height: 52rpx;
|
||||
}
|
||||
|
||||
.notice-card {
|
||||
margin-top: 18rpx;
|
||||
margin-bottom: 18rpx;
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
|
||||
.notice-item {
|
||||
height: 50rpx;
|
||||
padding: 0 20rpx;
|
||||
border-radius: 999rpx;
|
||||
background: rgba(242, 242, 242, 0.95);
|
||||
}
|
||||
|
||||
.notice-icon {
|
||||
width: 34rpx;
|
||||
height: 34rpx;
|
||||
border-radius: 50%;
|
||||
background: rgba(37, 86, 236, 0.12);
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
|
||||
.notice-text {
|
||||
width: 300rpx;
|
||||
font-size: 22rpx;
|
||||
color: #111111;
|
||||
line-height: 50rpx;
|
||||
}
|
||||
|
||||
.notice-marquee-viewport {
|
||||
overflow: hidden;
|
||||
height: 50rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-radius: 30rpx;
|
||||
}
|
||||
|
||||
.notice-marquee-track {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
transform: translateX(0);
|
||||
will-change: transform;
|
||||
&.is-scroll {
|
||||
animation: notice-marquee-move var(--marquee-duration, 16s) linear infinite;
|
||||
}
|
||||
}
|
||||
|
||||
.notice-marquee-content {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.notice-marquee-item {
|
||||
flex-shrink: 0;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
@keyframes notice-marquee-move {
|
||||
0% {
|
||||
transform: translateX(0);
|
||||
}
|
||||
100% {
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
}
|
||||
|
||||
.ai-store-entry {
|
||||
padding: 24rpx 28rpx;
|
||||
margin-bottom: 22rpx;
|
||||
|
||||
Reference in New Issue
Block a user