Showing
2 changed files
with
61 additions
and
15 deletions
| ... | @@ -11,16 +11,13 @@ declare module 'vue' { | ... | @@ -11,16 +11,13 @@ declare module 'vue' { |
| 11 | ElBreadcrumbItem: typeof import('element-ui/lib/breadcrumb-item')['default'] | 11 | ElBreadcrumbItem: typeof import('element-ui/lib/breadcrumb-item')['default'] |
| 12 | ElCarousel: typeof import('element-ui/lib/carousel')['default'] | 12 | ElCarousel: typeof import('element-ui/lib/carousel')['default'] |
| 13 | ElCarouselItem: typeof import('element-ui/lib/carousel-item')['default'] | 13 | ElCarouselItem: typeof import('element-ui/lib/carousel-item')['default'] |
| 14 | - ElCheckbox: typeof import('element-ui/lib/checkbox')['default'] | ||
| 15 | ElCol: typeof import('element-ui/lib/col')['default'] | 14 | ElCol: typeof import('element-ui/lib/col')['default'] |
| 16 | ElCollapse: typeof import('element-ui/lib/collapse')['default'] | 15 | ElCollapse: typeof import('element-ui/lib/collapse')['default'] |
| 17 | ElCollapseItem: typeof import('element-ui/lib/collapse-item')['default'] | 16 | ElCollapseItem: typeof import('element-ui/lib/collapse-item')['default'] |
| 18 | ElCollapseTransition: typeof import('element-ui/lib/transitions/collapse-transition')['default'] | 17 | ElCollapseTransition: typeof import('element-ui/lib/transitions/collapse-transition')['default'] |
| 19 | ElImage: typeof import('element-ui/lib/image')['default'] | 18 | ElImage: typeof import('element-ui/lib/image')['default'] |
| 20 | ElInput: typeof import('element-ui/lib/input')['default'] | 19 | ElInput: typeof import('element-ui/lib/input')['default'] |
| 21 | - ElOption: typeof import('element-ui/lib/option')['default'] | ||
| 22 | ElRow: typeof import('element-ui/lib/row')['default'] | 20 | ElRow: typeof import('element-ui/lib/row')['default'] |
| 23 | - ElSelect: typeof import('element-ui/lib/select')['default'] | ||
| 24 | ElTabPane: typeof import('element-ui/lib/tab-pane')['default'] | 21 | ElTabPane: typeof import('element-ui/lib/tab-pane')['default'] |
| 25 | ElTabs: typeof import('element-ui/lib/tabs')['default'] | 22 | ElTabs: typeof import('element-ui/lib/tabs')['default'] |
| 26 | ElTooltip: typeof import('element-ui/lib/tooltip')['default'] | 23 | ElTooltip: typeof import('element-ui/lib/tooltip')['default'] | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2024-10-20 16:57:48 | 2 | * @Date: 2024-10-20 16:57:48 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2024-10-20 18:50:25 | 4 | + * @LastEditTime: 2024-10-22 17:41:01 |
| 5 | * @FilePath: /hager/src/views/search.vue | 5 | * @FilePath: /hager/src/views/search.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -13,23 +13,33 @@ | ... | @@ -13,23 +13,33 @@ |
| 13 | <el-tab-pane name="product"> | 13 | <el-tab-pane name="product"> |
| 14 | <div slot="label" class="customer-label">产品 <span>2</span></div> | 14 | <div slot="label" class="customer-label">产品 <span>2</span></div> |
| 15 | <div class="search-product-list"> | 15 | <div class="search-product-list"> |
| 16 | - <div class="search-product-item" v-for="(item, index) in 6" :key="index"> | 16 | + <div :class="['search-product-item', is_xs ? 'xs' : '']" v-for="(item, index) in product_list" :key="index"> |
| 17 | - <div class="search-product-item-img"> | 17 | + <div :class="['search-product-item-img', is_xs ? 'xs' : '']" :style="{ 'background-image': 'url('+ item.img +')' }"></div> |
| 18 | - <el-image style="width: 100%; height: 100%;" src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg" fit="fit"></el-image> | 18 | + <p @click="goToDetail(item)" class="search-product-item-title">{{ item.title }}</p> |
| 19 | - </div> | ||
| 20 | - <p @click="goToP(item)" class="search-product-item-title">acb hw 空气断路器</p> | ||
| 21 | </div> | 19 | </div> |
| 22 | </div> | 20 | </div> |
| 23 | <div style="height: 5rem;"></div> | 21 | <div style="height: 5rem;"></div> |
| 24 | </el-tab-pane> | 22 | </el-tab-pane> |
| 25 | <el-tab-pane name="news"> | 23 | <el-tab-pane name="news"> |
| 26 | - <div slot="label" class="customer-label">新闻和解决方案 <span>3</span></div> | 24 | + <div slot="label" class="customer-label">新闻 <span>3</span></div> |
| 27 | <div style="margin-top: 1rem;" v-for="(item, index) in news_list" :key="index"> | 25 | <div style="margin-top: 1rem;" v-for="(item, index) in news_list" :key="index"> |
| 28 | - <el-breadcrumb separator="/"> | 26 | + <!-- <el-breadcrumb separator="/"> |
| 29 | <el-breadcrumb-item>首页</el-breadcrumb-item> | 27 | <el-breadcrumb-item>首页</el-breadcrumb-item> |
| 30 | <el-breadcrumb-item>新闻中心</el-breadcrumb-item> | 28 | <el-breadcrumb-item>新闻中心</el-breadcrumb-item> |
| 31 | - </el-breadcrumb> | 29 | + </el-breadcrumb> --> |
| 32 | - <div class="search-news-wrapper"> | 30 | + <div :class="['search-news-wrapper', is_xs ? 'xs' : '']"> |
| 31 | + <div class="search-news-title" v-html="highlightKeyword(keyword, item.title)"></div> | ||
| 32 | + <div class="search-news-content" v-html="highlightKeyword(keyword, item.content)"></div> | ||
| 33 | + <div class="search-news-more"> | ||
| 34 | + <div class="search-news-more-btn" @click="goTo(item.id)">MORE</div> | ||
| 35 | + </div> | ||
| 36 | + </div> | ||
| 37 | + </div> | ||
| 38 | + </el-tab-pane> | ||
| 39 | + <el-tab-pane name="solution"> | ||
| 40 | + <div slot="label" class="customer-label">解决方案 <span>3</span></div> | ||
| 41 | + <div style="margin-top: 1rem;" v-for="(item, index) in news_list" :key="index"> | ||
| 42 | + <div :class="['search-news-wrapper', is_xs ? 'xs' : '']"> | ||
| 33 | <div class="search-news-title" v-html="highlightKeyword(keyword, item.title)"></div> | 43 | <div class="search-news-title" v-html="highlightKeyword(keyword, item.title)"></div> |
| 34 | <div class="search-news-content" v-html="highlightKeyword(keyword, item.content)"></div> | 44 | <div class="search-news-content" v-html="highlightKeyword(keyword, item.content)"></div> |
| 35 | <div class="search-news-more"> | 45 | <div class="search-news-more"> |
| ... | @@ -47,6 +57,7 @@ | ... | @@ -47,6 +57,7 @@ |
| 47 | import mixin from 'common/mixin'; | 57 | import mixin from 'common/mixin'; |
| 48 | import hagerBox from '@/components/common/hagerBox'; | 58 | import hagerBox from '@/components/common/hagerBox'; |
| 49 | import $ from 'jquery'; | 59 | import $ from 'jquery'; |
| 60 | +import objectFitImages from 'object-fit-images'; | ||
| 50 | 61 | ||
| 51 | export default { | 62 | export default { |
| 52 | components: { hagerBox }, | 63 | components: { hagerBox }, |
| ... | @@ -63,6 +74,19 @@ export default { | ... | @@ -63,6 +74,19 @@ export default { |
| 63 | id: '456', | 74 | id: '456', |
| 64 | title: '里程碑时刻!海格电气首台全新一代HW+空气断路器', | 75 | title: '里程碑时刻!海格电气首台全新一代HW+空气断路器', |
| 65 | content: '全新一代HW+空气断路器的整机下线,标志着海格电气在低压配电领域的进一步技术升级。作为海格电气在中国市场重磅推出的里程碑式产品,全新一代HW+空气断路器为大型建筑复杂、高负荷的用电需求提供高质量解决方案。', | 76 | content: '全新一代HW+空气断路器的整机下线,标志着海格电气在低压配电领域的进一步技术升级。作为海格电气在中国市场重磅推出的里程碑式产品,全新一代HW+空气断路器为大型建筑复杂、高负荷的用电需求提供高质量解决方案。', |
| 77 | + }], | ||
| 78 | + product_list: [{ | ||
| 79 | + id: '', | ||
| 80 | + img: 'https://cdn.ipadbiz.cn/hager/img/product/t01.jpg', | ||
| 81 | + title: 'acb hw 空气断路器' | ||
| 82 | + }, { | ||
| 83 | + id: '', | ||
| 84 | + img: 'https://cdn.ipadbiz.cn/hager/img/product/t01.jpg', | ||
| 85 | + title: 'acb hw 空气断路器' | ||
| 86 | + }, { | ||
| 87 | + id: '', | ||
| 88 | + img: 'https://cdn.ipadbiz.cn/hager/img/product/t01.jpg', | ||
| 89 | + title: 'acb hw 空气断路器' | ||
| 66 | }] | 90 | }] |
| 67 | } | 91 | } |
| 68 | }, | 92 | }, |
| ... | @@ -72,6 +96,7 @@ export default { | ... | @@ -72,6 +96,7 @@ export default { |
| 72 | } | 96 | } |
| 73 | }, | 97 | }, |
| 74 | mounted () { | 98 | mounted () { |
| 99 | + objectFitImages(this.$el); // 对当前组件的 DOM 元素应用 | ||
| 75 | }, | 100 | }, |
| 76 | methods: { | 101 | methods: { |
| 77 | handleClick(tab, event) { | 102 | handleClick(tab, event) { |
| ... | @@ -93,6 +118,14 @@ export default { | ... | @@ -93,6 +118,14 @@ export default { |
| 93 | id: id | 118 | id: id |
| 94 | } | 119 | } |
| 95 | }); | 120 | }); |
| 121 | + }, | ||
| 122 | + goToDetail (v) { // 跳转产品详情 | ||
| 123 | + this.$router.push({ | ||
| 124 | + path: '/product/detail', | ||
| 125 | + query: { | ||
| 126 | + id: v.id | ||
| 127 | + } | ||
| 128 | + }); | ||
| 96 | } | 129 | } |
| 97 | } | 130 | } |
| 98 | } | 131 | } |
| ... | @@ -114,7 +147,7 @@ export default { | ... | @@ -114,7 +147,7 @@ export default { |
| 114 | margin-top: 1rem; | 147 | margin-top: 1rem; |
| 115 | } | 148 | } |
| 116 | .search-product-item { | 149 | .search-product-item { |
| 117 | - width: calc(33.33% - 1rem); | 150 | + width: calc(33.54% - 1rem); |
| 118 | &.xs { | 151 | &.xs { |
| 119 | width: calc(50% - 1rem); | 152 | width: calc(50% - 1rem); |
| 120 | } | 153 | } |
| ... | @@ -129,11 +162,23 @@ export default { | ... | @@ -129,11 +162,23 @@ export default { |
| 129 | box-sizing: border-box; | 162 | box-sizing: border-box; |
| 130 | border-radius: 5px; | 163 | border-radius: 5px; |
| 131 | border: 1px solid #ECECEC; | 164 | border: 1px solid #ECECEC; |
| 165 | + background-position: center; | ||
| 166 | + background-size: 70%; | ||
| 167 | + background-repeat: no-repeat; | ||
| 168 | + &.xs { | ||
| 169 | + padding: 3rem 1rem; | ||
| 170 | + background-size: 100%; | ||
| 171 | + img { | ||
| 172 | + width: 100%; | ||
| 173 | + } | ||
| 174 | + } | ||
| 132 | } | 175 | } |
| 133 | .search-product-item-title { | 176 | .search-product-item-title { |
| 134 | - text-align: center; | 177 | + text-align: left; |
| 135 | margin-top: 0.75rem; | 178 | margin-top: 0.75rem; |
| 136 | color: @text-color; | 179 | color: @text-color; |
| 180 | + padding-left: 0.5rem; | ||
| 181 | + font-weight: bold; | ||
| 137 | &:hover { | 182 | &:hover { |
| 138 | cursor: pointer; | 183 | cursor: pointer; |
| 139 | text-decoration: underline; | 184 | text-decoration: underline; |
| ... | @@ -142,6 +187,9 @@ export default { | ... | @@ -142,6 +187,9 @@ export default { |
| 142 | 187 | ||
| 143 | .search-news-wrapper { | 188 | .search-news-wrapper { |
| 144 | margin: 1.5rem 0; | 189 | margin: 1.5rem 0; |
| 190 | + &.xs { | ||
| 191 | + border-bottom: 1px solid #ECECEC; | ||
| 192 | + } | ||
| 145 | .search-news-title { | 193 | .search-news-title { |
| 146 | font-size: 1.15rem; | 194 | font-size: 1.15rem; |
| 147 | font-weight: bold; | 195 | font-weight: bold; |
| ... | @@ -157,6 +205,7 @@ export default { | ... | @@ -157,6 +205,7 @@ export default { |
| 157 | color: #F56400; | 205 | color: #F56400; |
| 158 | padding: 0.5rem 2rem; | 206 | padding: 0.5rem 2rem; |
| 159 | border: 1px solid #F56400; | 207 | border: 1px solid #F56400; |
| 208 | + margin: 1rem 0; | ||
| 160 | &:hover { | 209 | &:hover { |
| 161 | cursor: pointer; | 210 | cursor: pointer; |
| 162 | } | 211 | } | ... | ... |
-
Please register or login to post a comment