You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

222 lines
5.4 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <template>
  2. <view class="app">
  3. <!-- <view class="nav-view">
  4. <text class="nav-title">云商城</text>
  5. </view> -->
  6. <swiper class="swiper" indicator-active-color="white" :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval" :duration="duration">
  7. <swiper-item @click="toYunProduct()">
  8. <view class="swiper-item uni-bg-red">
  9. <image class="swiper-img swiper-img-tt" src="/static/shop/677088217d8a00aa.jpg"></image>
  10. </view>
  11. </swiper-item>
  12. <swiper-item @click="toYunProduct()">
  13. <view class="swiper-item uni-bg-green">
  14. <image class="swiper-img" src="/static/shop/rem.jpg"></image>
  15. </view>
  16. </swiper-item>
  17. <swiper-item @click="toYunProduct()">
  18. <view class="swiper-item uni-bg-blue">
  19. <image class="swiper-img" src="/static/shop/b7f2be6053cc88b4.jpg"></image>
  20. </view>
  21. </swiper-item>
  22. </swiper>
  23. <view class="menu-item">
  24. <text class="menu-txt">云仓备货</text>
  25. <text class="menu-txt" style="border-left-width: 0rpx;">云仓提货</text>
  26. </view>
  27. <view class="shop-list">
  28. <view class="shop-item" @click="toNewDetail">
  29. <view class="shop-item-left">
  30. <text class="shop-item-left-title">通知 | 关于轻未来超轻维阻燃粉外包装升级通知</text>
  31. <text class="shop-item-left-time">2021年4月23日</text>
  32. </view>
  33. <image src="/static/shop/677088217d8a00aa.jpg" class="shop-item-img">
  34. </image>
  35. </view>
  36. <view class="shop-item" @click="toNewDetail">
  37. <view class="shop-item-left">
  38. <text class="shop-item-left-title">通知 | 关于轻未来超轻维阻燃粉外包装升级通知</text>
  39. <text class="shop-item-left-time">2021年4月23日</text>
  40. </view>
  41. <image src="/static/shop/677088217d8a00aa.jpg" class="shop-item-img">
  42. </image>
  43. </view>
  44. <view class="shop-item" @click="toNewDetail">
  45. <view class="shop-item-left">
  46. <text class="shop-item-left-title">通知 | 关于轻未来超轻维阻燃粉外包装升级通知</text>
  47. <text class="shop-item-left-time">2021年4月23日</text>
  48. </view>
  49. <image src="/static/shop/677088217d8a00aa.jpg" class="shop-item-img">
  50. </image>
  51. </view>
  52. </view>
  53. </view>
  54. </template>
  55. <script>
  56. import tabbarMixin from './mixin/tabbar'
  57. import homeMixin from './mixin/home'
  58. import pageHeader from './components/page-header.vue'
  59. import banner from './components/banner.vue'
  60. import productList from '@/pages/product/components/product-list.vue'
  61. import homeAdvertModal from './components/home-advert-modal.vue'
  62. export default {
  63. components: {
  64. pageHeader,
  65. banner,
  66. productList,
  67. homeAdvertModal
  68. },
  69. mixins: [homeMixin, tabbarMixin],
  70. data() {
  71. return {
  72. navList: [],//导航列表
  73. advertList: [],//广告列表
  74. hotList: [],//热门推荐
  75. indicatorDots: true,
  76. autoplay: true,
  77. interval: 2000,
  78. duration: 500,
  79. swipeImgs:['/static/shop/677088217d8a00aa.jpg','/static/shop/rem.jpg','/static/shop/b7f2be6053cc88b4.jpg']
  80. }
  81. },
  82. computed: {
  83. changeIndicatorDots(e) {
  84. this.indicatorDots = !this.indicatorDots
  85. },
  86. changeAutoplay(e) {
  87. this.autoplay = !this.autoplay
  88. },
  89. intervalChange(e) {
  90. this.interval = e.target.value
  91. },
  92. durationChange(e) {
  93. this.duration = e.target.value
  94. },
  95. midAdvert(){
  96. if(this.advertList.length === 0) return {};
  97. const res = this.advertList.filter(item=> item.advert_type === 'middle');
  98. return res.length > 0 ? res[0]: {};
  99. },
  100. carousel(){
  101. return this.advertList.filter(item=> item.advert_type === 'carousel');
  102. }
  103. },
  104. onLoad() {
  105. this.loadAdvert();
  106. this.loadNavList();
  107. setTimeout(()=>{
  108. //this.navTo('/pages/address/list')
  109. }, 1000)
  110. },
  111. methods: {
  112. toNewDetail(){
  113. this.navTo(`/pages/yunProduct/newDetail`);
  114. },
  115. toYunProduct(){
  116. let keyword=1
  117. this.navTo(`/pages/yunProduct/detail?keyword=${keyword}`);
  118. },
  119. //加载广告 缓存10分钟
  120. async loadAdvert(){
  121. const res = await this.$request('advert', 'getAdvertList', {}, {
  122. cache: 10*60
  123. });
  124. this.advertList = res.data;
  125. this.log(res);
  126. },
  127. //加载导航 缓存1小时
  128. async loadNavList(){
  129. const res = await this.$request('advert', 'getNavList', {}, {
  130. cache: 60*60*0,
  131. });
  132. this.navList = res.data;
  133. },
  134. }
  135. }
  136. </script>
  137. <style>
  138. page{
  139. background-color: white;
  140. }
  141. </style>
  142. <style scoped lang="scss">
  143. /* 分类 */
  144. .swiper{
  145. height: 375rpx;
  146. }
  147. .swiper-item{
  148. }
  149. .swiper-img{
  150. width: 100%;
  151. }
  152. .menu-item{
  153. display: flex;
  154. flex-direction: row;
  155. align-items: center;
  156. }
  157. .menu-txt{
  158. height: 90rpx;
  159. line-height: 90rpx;
  160. text-align: center;
  161. flex: 1;
  162. font-size: 18px;
  163. font-weight: 500;
  164. color: #EDAF8B;
  165. border: 1px solid #EDAF8B;
  166. }
  167. .shop-list{
  168. }
  169. .shop-item{
  170. display: flex;
  171. justify-content: space-between;
  172. align-items: center;
  173. flex-direction: row;
  174. margin: 40rpx 20rpx;
  175. }
  176. .shop-item-left{
  177. flex: 1;
  178. height: 200rpx;
  179. position: relative;
  180. margin: 0rpx 40rpx 0rpx 0rpx;
  181. }
  182. .shop-item-img{
  183. width: 200rpx;
  184. height: 200rpx;
  185. border-radius: 10rpx;
  186. }
  187. .shop-item-left-title{
  188. font-size: 16px;
  189. // font-weight: 500;
  190. color: #333333;
  191. }
  192. .shop-item-left-time{
  193. position: absolute;
  194. bottom: 10rpx;
  195. left: 0rpx;
  196. font-size: 13px;
  197. font-weight: 500;
  198. color: #999999;
  199. }
  200. </style>