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

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