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

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