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

336 lines
9.0 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
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(item.type,item.url)" v-for="(item,index) of banner" :key="index">
  5. <image :src="item.picture" 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.type,item.url)" :src="item.picture" 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(type,url){
  163. if(url) {
  164. if(type == 0) {
  165. this.$url(url);
  166. }else {
  167. this.$url('/pages/index/urlWeb?url='+url);
  168. }
  169. }
  170. },
  171. // ad被点击
  172. clickAD(type,url){
  173. // this.$msg('您点击了ad广告')
  174. if(url) {
  175. if(type == 0) {
  176. this.$url(url);
  177. }else {
  178. this.$url('/pages/index/urlWeb?url='+url);
  179. }
  180. }
  181. }
  182. },
  183. onReachBottom() {
  184. },
  185. onPullDownRefresh(){
  186. this.getIndexData()
  187. this.getFavourite()
  188. },
  189. onShareAppMessage(){
  190. let shareInfo = {
  191. title: '欢迎使用海南旅游小程序',
  192. path: '/pages/route/index?route=home'
  193. }
  194. return shareInfo;
  195. }
  196. }
  197. </script>
  198. <style>
  199. page{
  200. background-color: #F6F6F6;
  201. }
  202. </style>
  203. <style lang="scss" scoped>
  204. .head{
  205. width: 750rpx;
  206. height: 360rpx;
  207. .swipe-img{
  208. width: 100%;
  209. height: 100%;
  210. }
  211. }
  212. .content{
  213. width: 750rpx;
  214. // height: 600rpx;
  215. height: max-content;
  216. border-radius: 30rpx 30rpx 0rpx 0rpx;
  217. position: relative;
  218. top: -30rpx;
  219. background-color: #FFFFFF;
  220. box-sizing: border-box;
  221. padding: 40rpx 32rpx 10rpx;
  222. .message-box{
  223. width: 686rpx;
  224. height: 53rpx;
  225. background: #CFE7FD;
  226. border-radius: 27rpx;
  227. color: #1998FE;
  228. box-sizing: border-box;
  229. padding: 0 20rpx;
  230. font-size: 24rpx;
  231. .message-btn{
  232. width: 80rpx;
  233. height: 33rpx;
  234. border-radius: 10rpx;
  235. border: 1rpx solid #1998FE;
  236. text-align: center;
  237. line-height: 31rpx;
  238. }
  239. }
  240. }
  241. .channel-item{
  242. width: 160rpx;
  243. height: 160rpx;
  244. border-radius: 15rpx;
  245. margin-top: 15rpx;
  246. margin-right: 15rpx;
  247. position: relative;
  248. overflow: hidden;
  249. &:nth-child(4n){
  250. margin-right: 0;
  251. }
  252. image{
  253. width: 160rpx;
  254. height: 160rpx;
  255. position: absolute;
  256. z-index: 0;
  257. }
  258. // view{
  259. // position: absolute;
  260. // right: 0;
  261. // bottom: 0;
  262. // background-color: rgba(255,255,255,0.5);
  263. // width: 42rpx;
  264. // height: 42rpx;
  265. // color: #FFFFFF;
  266. // display: flex;
  267. // justify-content: center;
  268. // align-items: center;
  269. // border-radius: 10rpx 0rpx 15rpx 0rpx;
  270. // z-index: 2;
  271. // }
  272. .channel-mask::after{
  273. width: 100%;
  274. height: 100%;
  275. content: '';
  276. position: absolute;
  277. z-index: 1;
  278. background: rgba(0, 0, 0, 0.5);
  279. top: 0;
  280. left: 0;
  281. }
  282. .channe-text{
  283. position: absolute;
  284. top: 0;
  285. left: 0;
  286. width: 100%;
  287. height: 100%;
  288. z-index: 2;
  289. color: #FFFFFF;
  290. font-size: 28rpx;
  291. }
  292. }
  293. .ad{
  294. height: 230rpx;
  295. width: 100%;
  296. }
  297. .recomm{
  298. width: 100%;
  299. height: max-content;
  300. .recomm-img{
  301. width: 222rpx;
  302. height: 222rpx;
  303. border-radius: 5rpx;
  304. }
  305. .max-recomm-img{
  306. width: 455rpx;
  307. height: 455rpx;
  308. position: relative;
  309. border-radius: 5rpx;
  310. overflow: hidden;
  311. .recomm-title{
  312. // height: 142rpx;
  313. height: max-content;
  314. width: 100%;
  315. background-color: rgba(0,0,0,0.65);
  316. box-sizing: border-box;
  317. padding: 15rpx;
  318. position: absolute;
  319. bottom: 0;
  320. color: #FFFFFF;
  321. border-radius: 0rpx 0rpx 20rpx 20rpx;
  322. }
  323. }
  324. }
  325. </style>