Selaa lähdekoodia

🎨 按要求更换轮播图

快乐的梦鱼 4 päivää sitten
vanhempi
commit
0f42c40ddf

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "uni-preset-vue",
-  "version": "0.0.0",
+  "version": "1.0.0",
   "scripts": {
     "dev:custom": "uni -p",
     "dev:h5": "uni",

+ 2 - 1
src/api/system/ConfigurationApi.ts

@@ -16,7 +16,8 @@ export interface IConfigurationItem {
   articleMark: string,
   banners: {
     name: string,
-    images: string[]
+    images: string[],
+    height: number,
   }[],
   homeBackground: string,
   homeTitle: {

+ 2 - 0
src/api/system/DefaultConfiguration.json

@@ -9,6 +9,7 @@
   "banners": [
     {
       "name": "store",
+      "height": 450,
       "images": [
         "https://mn.wenlvti.net/app_static/xiangyuan/images/causel/01/B1.png",
         "https://mn.wenlvti.net/app_static/xiangyuan/images/causel/01/B2.jpg",
@@ -17,6 +18,7 @@
     },
     {
       "name": "dig",
+      "height": 450,
       "images": [
         "https://mn.wenlvti.net/app_static/xiangyuan/images/causel/01/A1.png"
       ]

+ 11 - 1
src/common/components/parts/ImageSwiper.vue

@@ -14,13 +14,18 @@
       <view 
         class="item"
         :style="{
+          height: `${height}rpx`,
           backgroundImage: `url(${item})`,
           backgroundSize: 'cover',
         }"
       >
         <image
           :src="item"
-          :style="{ width: '100%', borderRadius: '20rpx' }"
+          :style="{ 
+            width: '100%',
+            height: `${height}rpx`,
+            borderRadius: '20rpx'
+          }"
           mode="aspectFit"
           @click="onPreviewImage(key)"
         />
@@ -50,6 +55,11 @@ const { onPreviewImage } = useSwiperImagePreview(() => props.images || [])
 
 <style lang="scss">
 .image-swiper {
+  .item {
+    display: flex;
+    justify-content: center;
+    align-items: center;
+  }
   image {
     border-radius: 20rpx;
   }

+ 1 - 1
src/common/config/AppCofig.ts

@@ -5,7 +5,7 @@ const buildInfo = `${__BUILD_GUID__}`
  * 说明:应用静态配置
  */
 export default {
-  version: '1.0.8',
+  version: '1.0.9',
   buildTime,
   buildInfo,
   appId: 'wx954621c03f2fa912',

+ 1 - 1
src/pages/dig/index.vue

@@ -1,7 +1,7 @@
 <template>
   <FlexCol>
     <ImageSwiper
-      :height="300"
+      :height="appConfiguration?.banners.find(p => p.name === 'dig')?.height || 450"
       :images="appConfiguration?.banners.find(p => p.name === 'dig')?.images || []"
     />
     <FlexCol :padding="30">

+ 1 - 1
src/pages/home/store/index.vue

@@ -3,7 +3,7 @@
     <SearchBar placeholder="输入关键词搜索" @search="discoverLoader.loadData(undefined, true)" />
     <FlexCol :radius="15" overflow="hidden">
       <ImageSwiper 
-        :height="300"
+        :height="appConfiguration?.banners.find(p => p.name === 'store')?.height || 450"
         :images="appConfiguration?.banners.find(p => p.name === 'store')?.images || []"
       />
     </FlexCol>