feat: ai店铺添加柱状图

This commit is contained in:
2026-06-25 11:10:18 +08:00
parent c8eb96b64c
commit a7f80af1de
7 changed files with 329 additions and 120 deletions
+116
View File
@@ -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;