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

337 lines
9.1 KiB

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