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

361 lines
9.8 KiB

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