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

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