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

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