海南旅游项目 前端仓库
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.

324 lines
8.8 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. <template>
  2. <view>
  3. <swiper class="head" :current="banner_current" >
  4. <swiper-item @click="clickBanner" v-for="(item,index) of banner" :key="index">
  5. <image :src="item.url" class="swipe-img" mode="aspectFill"></image>
  6. </swiper-item>
  7. </swiper>
  8. <view class="content">
  9. <!-- 消息模块 -->
  10. <view class="lf-row-between lf-m-b-34 message-box" v-for="(item,index) of notice" :key="index">
  11. <view class="lf-flex">
  12. <text class="lf-iconfont lf-icon-tongzhi lf-text-vertical"></text>
  13. <view class="lf-m-l-12 lf-line-1" style="max-width: 510rpx;">{{item.title}}</view>
  14. </view>
  15. <view class="message-btn" hover-class="lf-opacity" @click="$url('/pages/notice/notice?notice_id='+item.id)">详情</view>
  16. </view>
  17. <!-- 频道 -->
  18. <view class="lf-row-between lf-m-b-10">
  19. <view class="lf-font-36 lf-font-bold lf-color-333">添加频道</view>
  20. <view class="lf-flex lf-color-555" @click="$url('/pages/channel/index')">
  21. <view class="lf-m-r-10">编辑</view>
  22. <view class="lf-iconfont lf-icon-xiangyou lf-text-vertical"></view>
  23. </view>
  24. </view>
  25. <view class="lf-flex-wrap">
  26. <view class="channel-item" v-for="(item, index) in channel_list" :key="index" @click="$url('/pages/goodsList/index?channel_id='+item.id)">
  27. <image :src="item.icon" class="channel-mask" mode="aspectFill"></image>
  28. <view class="lf-row-center channe-text lf-font-bold">{{item.name}}</view>
  29. <!-- <view>
  30. <u-icon name="lock-fill lf-text-vertical"></u-icon>
  31. </view> -->
  32. </view>
  33. </view>
  34. <!-- 中间广告模块 -->
  35. <view class="lf-m-t-40 ad" v-for="(item,index) of home_ad1" :key="index">
  36. <image @click="clickAD(item.id)" :src="item.picture_ad" mode="aspectFill" class="lf-w-100 lf-h-100"></image>
  37. </view>
  38. <!-- <swiper class="lf-m-t-40 ad" :current="banner_current" >
  39. <swiper-item @click="clickAD">
  40. <image :src="home_ad1" class="lf-w-100 lf-h-100"></image>
  41. </swiper-item>
  42. </swiper> -->
  43. <!-- 人气爆款 -->
  44. <view class="lf-row-between lf-m-t-40">
  45. <view class="lf-font-36 lf-font-bold lf-color-333">人气爆款</view>
  46. <view class="lf-flex lf-color-555" @click="$url('/pages/hot/index')">
  47. <view class="lf-m-r-10">更多</view>
  48. <view class="lf-iconfont lf-icon-xiangyou lf-text-vertical"></view>
  49. </view>
  50. </view>
  51. <view class="recomm lf-m-t-20 lf-m-b-30">
  52. <view class="lf-row-between">
  53. <view class="max-recomm-img" @click="$url('/pages/goodsDetail/index?goods_id='+hot_list[0].id)">
  54. <image :src="hot_list[0].product.picture" class="lf-w-100 lf-h-100"></image>
  55. <view class="recomm-title">
  56. <view class="lf-line-2 lf-m-b-10">{{hot_list[0].product.title}}</view>
  57. <lf-price :price="hot_number" v-if="hot_number"></lf-price>
  58. <!-- <view class="lf-font-42 lf-font-bold lf-m-t-10" style="color: #FF0000;">3999.00</view> -->
  59. </view>
  60. </view>
  61. <view>
  62. <view class="recomm-img" @click="$url('/pages/goodsDetail/index?goods_id='+hot_list[1].id)">
  63. <image :src="hot_list[1].product.picture" class="lf-w-100 lf-h-100"></image>
  64. </view>
  65. <view class="recomm-img lf-m-t-10" @click="$url('/pages/goodsDetail/index?goods_id='+hot_list[2].id)">
  66. <image :src="hot_list[2].product.picture" class="lf-w-100 lf-h-100"></image>
  67. </view>
  68. </view>
  69. </view>
  70. <view class="lf-row-between lf-m-t-10">
  71. <view class="recomm-img" @click="$url('/pages/goodsDetail/index?goods_id='+item.id)" :key="index" v-for="(item,index) of hot_list" v-if="index>2">
  72. <image :src="item.product.picture" class="lf-w-100 lf-h-100"></image>
  73. </view>
  74. </view>
  75. </view>
  76. <!-- tab标签 -->
  77. <!-- <view class="lf-m-t-40">
  78. <u-tabs :list="tab_list" :is-scroll="true" :current="current" @change="tabChange"></u-tabs>
  79. </view> -->
  80. <!-- 推荐 -->
  81. <!-- <view class="lf-row-between lf-m-t-40 lf-m-b-10">
  82. <view class="lf-font-36 lf-font-bold lf-color-333">推荐</view>
  83. <view class="lf-flex lf-color-555">
  84. <view class="lf-m-r-10">更多</view>
  85. <u-icon name="lock-fill lf-text-vertical"></u-icon>
  86. </view>
  87. </view> -->
  88. </view>
  89. <!-- 猜你喜欢 -->
  90. <lf-title-line></lf-title-line>
  91. <!-- 商品列表-瀑布流 -->
  92. <view style="padding: 0 20rpx;">
  93. <lf-waterfall :list="recomm_list" ref="uWaterfall"></lf-waterfall>
  94. <!-- <u-loadmore v-if="recomm_list.length" status="已加载全部数据~" @loadmore="addRandomData"></u-loadmore> -->
  95. <view class="loading-more">
  96. <text :class="{'loading-more-text': loading_class}" v-if="recomm_list.length">{{ loading_text }}</text>
  97. <lf-nocontent v-else></lf-nocontent>
  98. </view>
  99. </view>
  100. <!-- 回到顶部 -->
  101. <u-back-top :scroll-top="pageScrollTop" :custom-style="{background: 'rgba(51, 51 51, 0.3)'}"></u-back-top>
  102. </view>
  103. </template>
  104. <script>
  105. import lfWaterfall from '@/components/lf-waterfall/lf-waterfall.vue';
  106. import lfTitleLine from '@/components/lf-title-line/lf-title-line.vue';
  107. export default {
  108. components: {
  109. lfWaterfall,
  110. lfTitleLine
  111. },
  112. data() {
  113. return {
  114. banner: [],
  115. banner_current: 0,
  116. recomm_list: [],
  117. channel_list: [],
  118. current: 0,
  119. loading_class: false,
  120. hot_list: [],
  121. loading_text: '已加载全部数据~',
  122. home_ad1: [],
  123. hot_number: '',
  124. list: [],
  125. notice: []
  126. }
  127. },
  128. onShow() {
  129. this.getIndexData()
  130. this.getFavourite()
  131. },
  132. methods: {
  133. //获取猜你喜欢
  134. getFavourite() {
  135. this.$http(this.API.API_FAVOURITE).then(res => {
  136. this.recomm_list = res.data.data
  137. }).catch(err => {
  138. })
  139. },
  140. getIndexData() {
  141. this.$http(this.API.API_INDEX).then(res => {
  142. this.notice = res.data?.notice
  143. this.hot_list = res.data?.hots
  144. this.hot_number = this.hot_list[0].price
  145. this.banner = res.data?.slide
  146. this.channel_list = res.data?.my_channels
  147. this.home_ad1 = res.data?.special
  148. uni.stopPullDownRefresh();
  149. console.log(this.home_ad1)
  150. }).catch(err => {})
  151. },
  152. // tabs标签切换时件,现已费弃
  153. tabChange(current){
  154. this.current = current;
  155. },
  156. // swiper页面被滑动切换
  157. pageChange(event){
  158. console.log(event)
  159. this.current = event.detail.current;
  160. },
  161. // banner图被点击
  162. clickBanner(){
  163. this.$msg('您点击了banner图')
  164. },
  165. // ad被点击
  166. clickAD(id){
  167. // this.$msg('您点击了ad广告')
  168. this.$url('/pages/activityList/index?special_id='+id)
  169. }
  170. },
  171. onReachBottom() {
  172. },
  173. onPullDownRefresh(){
  174. this.getIndexData()
  175. this.getFavourite()
  176. },
  177. onShareAppMessage(){
  178. let shareInfo = {
  179. title: '欢迎使用海南旅游小程序',
  180. path: '/pages/route/index?route=home'
  181. }
  182. return shareInfo;
  183. }
  184. }
  185. </script>
  186. <style>
  187. page{
  188. background-color: #F6F6F6;
  189. }
  190. </style>
  191. <style lang="scss" scoped>
  192. .head{
  193. width: 750rpx;
  194. height: 360rpx;
  195. .swipe-img{
  196. width: 100%;
  197. height: 100%;
  198. }
  199. }
  200. .content{
  201. width: 750rpx;
  202. // height: 600rpx;
  203. height: max-content;
  204. border-radius: 30rpx 30rpx 0rpx 0rpx;
  205. position: relative;
  206. top: -30rpx;
  207. background-color: #FFFFFF;
  208. box-sizing: border-box;
  209. padding: 40rpx 32rpx 10rpx;
  210. .message-box{
  211. width: 686rpx;
  212. height: 53rpx;
  213. background: #CFE7FD;
  214. border-radius: 27rpx;
  215. color: #1998FE;
  216. box-sizing: border-box;
  217. padding: 0 20rpx;
  218. font-size: 24rpx;
  219. .message-btn{
  220. width: 80rpx;
  221. height: 33rpx;
  222. border-radius: 10rpx;
  223. border: 1rpx solid #1998FE;
  224. text-align: center;
  225. line-height: 31rpx;
  226. }
  227. }
  228. }
  229. .channel-item{
  230. width: 160rpx;
  231. height: 160rpx;
  232. border-radius: 15rpx;
  233. margin-top: 15rpx;
  234. margin-right: 15rpx;
  235. position: relative;
  236. overflow: hidden;
  237. &:nth-child(4n){
  238. margin-right: 0;
  239. }
  240. image{
  241. width: 160rpx;
  242. height: 160rpx;
  243. position: absolute;
  244. z-index: 0;
  245. }
  246. // view{
  247. // position: absolute;
  248. // right: 0;
  249. // bottom: 0;
  250. // background-color: rgba(255,255,255,0.5);
  251. // width: 42rpx;
  252. // height: 42rpx;
  253. // color: #FFFFFF;
  254. // display: flex;
  255. // justify-content: center;
  256. // align-items: center;
  257. // border-radius: 10rpx 0rpx 15rpx 0rpx;
  258. // z-index: 2;
  259. // }
  260. .channel-mask::after{
  261. width: 100%;
  262. height: 100%;
  263. content: '';
  264. position: absolute;
  265. z-index: 1;
  266. background: rgba(0, 0, 0, 0.5);
  267. top: 0;
  268. left: 0;
  269. }
  270. .channe-text{
  271. position: absolute;
  272. top: 0;
  273. left: 0;
  274. width: 100%;
  275. height: 100%;
  276. z-index: 2;
  277. color: #FFFFFF;
  278. font-size: 28rpx;
  279. }
  280. }
  281. .ad{
  282. height: 230rpx;
  283. width: 100%;
  284. }
  285. .recomm{
  286. width: 100%;
  287. height: max-content;
  288. .recomm-img{
  289. width: 222rpx;
  290. height: 222rpx;
  291. border-radius: 5rpx;
  292. }
  293. .max-recomm-img{
  294. width: 455rpx;
  295. height: 455rpx;
  296. position: relative;
  297. border-radius: 5rpx;
  298. overflow: hidden;
  299. .recomm-title{
  300. // height: 142rpx;
  301. height: max-content;
  302. width: 100%;
  303. background-color: rgba(0,0,0,0.65);
  304. box-sizing: border-box;
  305. padding: 15rpx;
  306. position: absolute;
  307. bottom: 0;
  308. color: #FFFFFF;
  309. border-radius: 0rpx 0rpx 20rpx 20rpx;
  310. }
  311. }
  312. }
  313. </style>