feat: 轮播组件优化

This commit is contained in:
duanshuwen
2025-07-14 17:02:21 +08:00
parent e5d908701f
commit 7f270dafe8
11 changed files with 227 additions and 31 deletions

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["components/ImageSwiper/index.vue","E:/Program Files/HBuilderX/plugins/uniapp-cli-vite/uniComponent:/RDovWUdDaGF0Q1MvY29tcG9uZW50cy9JbWFnZVN3aXBlci9pbmRleC52dWU"],"sourcesContent":["<template>\n <view class=\"image-swiper\">\n <swiper\n class=\"swiper-box\"\n :autoplay=\"false\"\n :interval=\"3000\"\n :duration=\"1000\"\n :current=\"active\"\n >\n <swiper-item\n class=\"swiper-item\"\n v-for=\"(item, index) in thumbnails\"\n :key=\"index\"\n >\n <image :src=\"item.url\" mode=\"aspectFill\"></image>\n </swiper-item>\n </swiper>\n\n <view class=\"custom-indicator\">\n 图片{{ active + 1 }}/{{ thumbnails.length }}\n </view>\n\n <view class=\"thumbnail-box\">\n <view\n v-for=\"(thumb, index) in thumbnails\"\n :key=\"index\"\n class=\"thumbnail-item\"\n @click=\"handleThumbnailClick(index)\"\n >\n <image :src=\"thumb.url\" mode=\"aspectFill\"></image>\n <text>{{ thumb.description }}</text>\n </view>\n </view>\n </view>\n</template>\n\n<script setup>\nimport { ref } from \"vue\";\n\nconst active = ref(0);\n\nconst thumbnails = ref([\n {\n url: \"https://fastly.picsum.photos/id/866/654/400.jpg?hmac=z3vI4CYrpnXEgimSlJCDwXRxEa-UDHiRwzGEyB8V-po\",\n description: \"瑶山古寨\",\n },\n {\n url: \"https://fastly.picsum.photos/id/284/654/400.jpg?hmac=89XRCJxYTblKIFGLOp6hJ9U0GC8BQrcnJwE5pG21NAk\",\n description: \"民俗表演\",\n },\n {\n url: \"https://fastly.picsum.photos/id/281/654/400.jpg?hmac=hcAJB7y2Xz3DVuz6S4XeQZgzaTJ_QWnxtbnaagZL6Fs\",\n description: \"特色美食\",\n },\n {\n url: \"https://fastly.picsum.photos/id/435/654/400.jpg?hmac=TSVDxfo-zXbunxNQK0erSG_nmKcS20xfhbQsCAXLlHo\",\n description: \"传统服饰\",\n },\n {\n url: \"https://fastly.picsum.photos/id/737/654/400.jpg?hmac=VED05oEK3XB0Aa_DUVoZjTAf0bHjAmNYyJky4lq5vVo\",\n description: \"其他\",\n },\n]);\n\nconst handleThumbnailClick = (index) => {\n active.value = index;\n};\n</script>\n\n<style scoped lang=\"scss\">\n@import \"./styles/index.scss\";\n</style>\n","import Component from 'D:/YGChatCS/components/ImageSwiper/index.vue'\nwx.createComponent(Component)"],"names":["ref"],"mappings":";;;;;AAuCA,UAAM,SAASA,cAAAA,IAAI,CAAC;AAEpB,UAAM,aAAaA,cAAAA,IAAI;AAAA,MACrB;AAAA,QACE,KAAK;AAAA,QACL,aAAa;AAAA,MACd;AAAA,MACD;AAAA,QACE,KAAK;AAAA,QACL,aAAa;AAAA,MACd;AAAA,MACD;AAAA,QACE,KAAK;AAAA,QACL,aAAa;AAAA,MACd;AAAA,MACD;AAAA,QACE,KAAK;AAAA,QACL,aAAa;AAAA,MACd;AAAA,MACD;AAAA,QACE,KAAK;AAAA,QACL,aAAa;AAAA,MACd;AAAA,IACH,CAAC;AAED,UAAM,uBAAuB,CAAC,UAAU;AACtC,aAAO,QAAQ;AAAA,IACjB;;;;;;;;;;;;;;;;;;;;;;;;;ACjEA,GAAG,gBAAgB,SAAS;"}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,57 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const _sfc_main = {
__name: "index",
setup(__props) {
const active = common_vendor.ref(0);
const thumbnails = common_vendor.ref([
{
url: "https://fastly.picsum.photos/id/866/654/400.jpg?hmac=z3vI4CYrpnXEgimSlJCDwXRxEa-UDHiRwzGEyB8V-po",
description: "瑶山古寨"
},
{
url: "https://fastly.picsum.photos/id/284/654/400.jpg?hmac=89XRCJxYTblKIFGLOp6hJ9U0GC8BQrcnJwE5pG21NAk",
description: "民俗表演"
},
{
url: "https://fastly.picsum.photos/id/281/654/400.jpg?hmac=hcAJB7y2Xz3DVuz6S4XeQZgzaTJ_QWnxtbnaagZL6Fs",
description: "特色美食"
},
{
url: "https://fastly.picsum.photos/id/435/654/400.jpg?hmac=TSVDxfo-zXbunxNQK0erSG_nmKcS20xfhbQsCAXLlHo",
description: "传统服饰"
},
{
url: "https://fastly.picsum.photos/id/737/654/400.jpg?hmac=VED05oEK3XB0Aa_DUVoZjTAf0bHjAmNYyJky4lq5vVo",
description: "其他"
}
]);
const handleThumbnailClick = (index) => {
active.value = index;
};
return (_ctx, _cache) => {
return {
a: common_vendor.f(thumbnails.value, (item, index, i0) => {
return {
a: item.url,
b: index
};
}),
b: active.value,
c: common_vendor.t(active.value + 1),
d: common_vendor.t(thumbnails.value.length),
e: common_vendor.f(thumbnails.value, (thumb, index, i0) => {
return {
a: thumb.url,
b: common_vendor.t(thumb.description),
c: index,
d: common_vendor.o(($event) => handleThumbnailClick(index), index)
};
})
};
};
}
};
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-cc2009df"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/components/ImageSwiper/index.js.map

View File

@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@@ -0,0 +1 @@
<view class="image-swiper data-v-cc2009df"><swiper class="swiper-box data-v-cc2009df" autoplay="{{false}}" interval="{{3000}}" duration="{{1000}}" current="{{b}}"><swiper-item wx:for="{{a}}" wx:for-item="item" wx:key="b" class="swiper-item data-v-cc2009df"><image class="data-v-cc2009df" src="{{item.a}}" mode="aspectFill"></image></swiper-item></swiper><view class="custom-indicator data-v-cc2009df"> 图片{{c}}/{{d}}</view><view class="thumbnail-box data-v-cc2009df"><view wx:for="{{e}}" wx:for-item="thumb" wx:key="c" class="thumbnail-item data-v-cc2009df" bindtap="{{thumb.d}}"><image class="data-v-cc2009df" src="{{thumb.a}}" mode="aspectFill"></image><text class="data-v-cc2009df">{{thumb.b}}</text></view></view></view>

View File

@@ -0,0 +1,71 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.image-swiper.data-v-cc2009df {
position: relative;
width: 100%;
}
.swiper-box.data-v-cc2009df {
border-radius: 8px;
height: 200px;
overflow: hidden;
}
.swiper-item image.data-v-cc2009df {
width: 100%;
height: 100%;
}
.custom-indicator.data-v-cc2009df {
position: absolute;
top: 8px;
right: 8px;
z-index: 10;
background: rgba(0, 0, 0, 0.5);
border-radius: 50px;
padding: 3px 8px;
font-size: 8px;
color: #fff;
}
.thumbnail-box.data-v-cc2009df {
position: absolute;
left: 12px;
right: 12px;
bottom: 36px;
display: flex;
gap: 5px;
}
.thumbnail-item.data-v-cc2009df {
text-align: center;
}
.thumbnail-item image.data-v-cc2009df {
width: 48px;
height: 38px;
border-radius: 4px;
border: 1px solid #fff;
}
.thumbnail-item text.data-v-cc2009df {
color: #fff;
font-size: 8px;
display: block;
}

View File

@@ -3,7 +3,7 @@ const common_vendor = require("../../common/vendor.js");
const common_assets = require("../../common/assets.js");
const model_ChatModel = require("../../model/ChatModel.js");
if (!Math) {
(ChatTopBgImg + ChatTopNavBar + ChatTopBanner + OneFeelMK001 + ResponseIntro + ResponseWrapper + ChatCardAI + ChatCardMine + ChatMoreTips + ChatQuickAccess)();
(ChatTopBgImg + ChatTopNavBar + ChatTopBanner + OneFeelMK001 + ResponseIntro + ImageSwiper + ResponseWrapper + ChatCardAI + ChatCardMine + ChatMoreTips + ChatQuickAccess)();
}
const ChatTopBanner = () => "./ChatTopBanner.js";
const ChatTopBgImg = () => "./ChatTopBgImg.js";
@@ -15,6 +15,7 @@ const ChatMoreTips = () => "./ChatMoreTips.js";
const OneFeelMK001 = () => "../module/OneFeelMK001.js";
const ResponseIntro = () => "../../components/ResponseIntro/index.js";
const ResponseWrapper = () => "../../components/ResponseWrapper/index.js";
const ImageSwiper = () => "../../components/ImageSwiper/index.js";
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
__name: "ChatMainList",
emits: ["openDrawer"],
@@ -32,7 +33,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
const emits = __emit;
const openDrawer = () => {
emits("openDrawer");
common_vendor.index.__f__("log", "at pages/chat/ChatMainList.vue:170", "=============打开抽屉");
common_vendor.index.__f__("log", "at pages/chat/ChatMainList.vue:172", "=============打开抽屉");
};
const handleReply = (text) => {
loadMessage(text);
@@ -98,7 +99,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
}
};
chatMsgList.value.push(newMsgAI);
common_vendor.index.__f__("log", "at pages/chat/ChatMainList.vue:254", "发送的新消息:", JSON.stringify(newMsg));
common_vendor.index.__f__("log", "at pages/chat/ChatMainList.vue:256", "发送的新消息:", JSON.stringify(newMsg));
};
const scrollToBottom = () => {
lastMsgId.value = `${chatMsgList.value[chatMsgList.value.length - 1].msgId}`;
@@ -119,13 +120,13 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
}, item.msgContent && item.msgContent.type === common_vendor.unref(model_ChatModel.MessageType).IMAGE ? {
c: common_assets._imports_0$1
} : {}, {
d: "d7316ec5-9-" + i0 + "," + ("d7316ec5-8-" + i0),
e: "d7316ec5-8-" + i0,
d: "d7316ec5-10-" + i0 + "," + ("d7316ec5-9-" + i0),
e: "d7316ec5-9-" + i0,
f: common_vendor.p({
text: item.msg
})
}) : item.msgType === common_vendor.unref(model_ChatModel.MessageRole).ME ? {
h: "d7316ec5-10-" + i0,
h: "d7316ec5-11-" + i0,
i: common_vendor.p({
text: item.msg
})

View File

@@ -10,6 +10,7 @@
"chat-more-tips": "./ChatMoreTips",
"one-feel-m-k001": "../module/OneFeelMK001",
"response-intro": "../../components/ResponseIntro/index",
"response-wrapper": "../../components/ResponseWrapper/index"
"response-wrapper": "../../components/ResponseWrapper/index",
"image-swiper": "../../components/ImageSwiper/index"
}
}

View File

@@ -1 +1 @@
<view class="chat-container data-v-d7316ec5" bindtouchend="{{q}}"><chat-top-bg-img class="chat-container-bg data-v-d7316ec5" u-i="d7316ec5-0" bind:__l="__l"></chat-top-bg-img><view class="nav-bar-container data-v-d7316ec5" style="{{'padding-top:' + b + ';' + ('background-color:' + c)}}"><chat-top-nav-bar class="data-v-d7316ec5" bindopenDrawer="{{a}}" u-i="d7316ec5-1" bind:__l="__l"></chat-top-nav-bar></view><view class="chat-container-msg-list data-v-d7316ec5"><chat-top-banner class="chat-container-top-bannar data-v-d7316ec5" u-i="d7316ec5-2" bind:__l="__l"></chat-top-banner><scroll-view scroll-y scroll-into-view="{{f}}" scroll-with-animation="{{true}}" class="area-msg-list data-v-d7316ec5"><view class="data-v-d7316ec5" style="padding:6px 12px"><one-feel-m-k001 class="data-v-d7316ec5" u-i="d7316ec5-3" bind:__l="__l"></one-feel-m-k001></view><view class="data-v-d7316ec5" style="padding:6px 12px"><one-feel-m-k001 class="data-v-d7316ec5" u-i="d7316ec5-4" bind:__l="__l"></one-feel-m-k001></view><view class="data-v-d7316ec5" style="padding:6px 12px"><one-feel-m-k001 class="data-v-d7316ec5" u-i="d7316ec5-5" bind:__l="__l"></one-feel-m-k001></view><response-wrapper class="data-v-d7316ec5" u-s="{{['d']}}" u-i="d7316ec5-6" bind:__l="__l"><response-intro class="data-v-d7316ec5" u-i="d7316ec5-7,d7316ec5-6" bind:__l="__l"/></response-wrapper><view wx:for="{{d}}" wx:for-item="item" wx:key="k" class="area-msg-list-content data-v-d7316ec5" id="{{item.l}}"><block wx:if="{{item.a}}"><chat-card-a-i wx:if="{{item.f}}" u-s="{{['d']}}" class="message-item message-item-ai data-v-d7316ec5" u-i="{{item.e}}" bind:__l="__l" u-p="{{item.f}}"><image wx:if="{{item.b}}" class="data-v-d7316ec5" src="{{item.c}}" style="width:100px;height:100px"></image><one-feel-m-k001 class="data-v-d7316ec5" u-i="{{item.d}}" bind:__l="__l"></one-feel-m-k001></chat-card-a-i></block><block wx:elif="{{item.g}}"><chat-card-mine wx:if="{{item.i}}" class="message-item message-item-mine data-v-d7316ec5" u-i="{{item.h}}" bind:__l="__l" u-p="{{item.i}}"></chat-card-mine></block><block wx:else><text class="message-item message-item-other data-v-d7316ec5">{{item.j}}</text></block></view><view class="data-v-d7316ec5" id="{{e}}"></view></scroll-view><view class="footer-area data-v-d7316ec5"><chat-more-tips class="data-v-d7316ec5" bindreplySent="{{g}}" u-i="d7316ec5-11" bind:__l="__l"></chat-more-tips><chat-quick-access class="data-v-d7316ec5" bindreplySent="{{h}}" u-i="d7316ec5-12" bind:__l="__l"></chat-quick-access><view class="area-input data-v-d7316ec5"><view class="input-container-voice data-v-d7316ec5"><image class="data-v-d7316ec5" src="{{i}}"></image></view><block wx:if="{{r0}}"><textarea class="textarea data-v-d7316ec5" type="text" placeholder="快速订票,呼叫服务" cursor-spacing="65" confirm-type="done" bindconfirm="{{j}}" bindtouchend="{{k}}" confirm-hold="{{true}}" auto-height show-confirm-bar="{{false}}" hold-keyboard="{{l}}" maxlength="300" value="{{m}}" bindinput="{{n}}"/></block><view class="input-container-send data-v-d7316ec5" bindtap="{{p}}"><image class="data-v-d7316ec5" src="{{o}}"></image></view></view></view></view></view>
<view class="chat-container data-v-d7316ec5" bindtouchend="{{q}}"><chat-top-bg-img class="chat-container-bg data-v-d7316ec5" u-i="d7316ec5-0" bind:__l="__l"></chat-top-bg-img><view class="nav-bar-container data-v-d7316ec5" style="{{'padding-top:' + b + ';' + ('background-color:' + c)}}"><chat-top-nav-bar class="data-v-d7316ec5" bindopenDrawer="{{a}}" u-i="d7316ec5-1" bind:__l="__l"></chat-top-nav-bar></view><view class="chat-container-msg-list data-v-d7316ec5"><chat-top-banner class="chat-container-top-bannar data-v-d7316ec5" u-i="d7316ec5-2" bind:__l="__l"></chat-top-banner><scroll-view scroll-y scroll-into-view="{{f}}" scroll-with-animation="{{true}}" class="area-msg-list data-v-d7316ec5"><view class="data-v-d7316ec5" style="padding:6px 12px"><one-feel-m-k001 class="data-v-d7316ec5" u-i="d7316ec5-3" bind:__l="__l"></one-feel-m-k001></view><view class="data-v-d7316ec5" style="padding:6px 12px"><one-feel-m-k001 class="data-v-d7316ec5" u-i="d7316ec5-4" bind:__l="__l"></one-feel-m-k001></view><view class="data-v-d7316ec5" style="padding:6px 12px"><one-feel-m-k001 class="data-v-d7316ec5" u-i="d7316ec5-5" bind:__l="__l"></one-feel-m-k001></view><response-wrapper class="data-v-d7316ec5" u-s="{{['d']}}" u-i="d7316ec5-6" bind:__l="__l"><response-intro class="data-v-d7316ec5" u-i="d7316ec5-7,d7316ec5-6" bind:__l="__l"/><image-swiper class="data-v-d7316ec5" u-i="d7316ec5-8,d7316ec5-6" bind:__l="__l"/></response-wrapper><view wx:for="{{d}}" wx:for-item="item" wx:key="k" class="area-msg-list-content data-v-d7316ec5" id="{{item.l}}"><block wx:if="{{item.a}}"><chat-card-a-i wx:if="{{item.f}}" u-s="{{['d']}}" class="message-item message-item-ai data-v-d7316ec5" u-i="{{item.e}}" bind:__l="__l" u-p="{{item.f}}"><image wx:if="{{item.b}}" class="data-v-d7316ec5" src="{{item.c}}" style="width:100px;height:100px"></image><one-feel-m-k001 class="data-v-d7316ec5" u-i="{{item.d}}" bind:__l="__l"></one-feel-m-k001></chat-card-a-i></block><block wx:elif="{{item.g}}"><chat-card-mine wx:if="{{item.i}}" class="message-item message-item-mine data-v-d7316ec5" u-i="{{item.h}}" bind:__l="__l" u-p="{{item.i}}"></chat-card-mine></block><block wx:else><text class="message-item message-item-other data-v-d7316ec5">{{item.j}}</text></block></view><view class="data-v-d7316ec5" id="{{e}}"></view></scroll-view><view class="footer-area data-v-d7316ec5"><chat-more-tips class="data-v-d7316ec5" bindreplySent="{{g}}" u-i="d7316ec5-12" bind:__l="__l"></chat-more-tips><chat-quick-access class="data-v-d7316ec5" bindreplySent="{{h}}" u-i="d7316ec5-13" bind:__l="__l"></chat-quick-access><view class="area-input data-v-d7316ec5"><view class="input-container-voice data-v-d7316ec5"><image class="data-v-d7316ec5" src="{{i}}"></image></view><block wx:if="{{r0}}"><textarea class="textarea data-v-d7316ec5" type="text" placeholder="快速订票,呼叫服务" cursor-spacing="65" confirm-type="done" bindconfirm="{{j}}" bindtouchend="{{k}}" confirm-hold="{{true}}" auto-height show-confirm-bar="{{false}}" hold-keyboard="{{l}}" maxlength="300" value="{{m}}" bindinput="{{n}}"/></block><view class="input-container-send data-v-d7316ec5" bindtap="{{p}}"><image class="data-v-d7316ec5" src="{{o}}"></image></view></view></view></view></view>