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

330 lines
8.8 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
  1. <template>
  2. <view>
  3. <swiper class="head" :current="banner_current" >
  4. <swiper-item @click="clickBanner" v-for="(item,index) of banner">
  5. <image :src="item.url" 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">
  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/article')">详情</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" @click="$url('/pages/goodsList/index')">
  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. <swiper class="lf-m-t-40 ad" :current="banner_current" >
  36. <swiper-item @click="clickAD">
  37. <image :src="home_ad1" class="lf-w-100 lf-h-100"></image>
  38. </swiper-item>
  39. </swiper>
  40. <!-- 人气爆款 -->
  41. <view class="lf-row-between lf-m-t-40">
  42. <view class="lf-font-36 lf-font-bold lf-color-333">人气爆款</view>
  43. <view class="lf-flex lf-color-555" @click="$url('/pages/activityList/index')">
  44. <view class="lf-m-r-10">更多</view>
  45. <view class="lf-iconfont lf-icon-xiangyou lf-text-vertical"></view>
  46. </view>
  47. </view>
  48. <view class="recomm lf-m-t-20 lf-m-b-30">
  49. <view class="lf-row-between">
  50. <view class="max-recomm-img" @click="$url('/pages/activityList/index')">
  51. <image :src="hot_list[0].product.picture" class="lf-w-100 lf-h-100"></image>
  52. <view class="recomm-title">
  53. <view class="lf-line-2 lf-m-b-10">{{hot_list[0].product.title}}</view>
  54. <lf-price :price="hot_number" v-if="hot_number"></lf-price>
  55. <!-- <view class="lf-font-42 lf-font-bold lf-m-t-10" style="color: #FF0000;">3999.00</view> -->
  56. </view>
  57. </view>
  58. <view>
  59. <view class="recomm-img" @click="$url('/pages/activityList/index')">
  60. <image :src="hot_list[1].product.picture" class="lf-w-100 lf-h-100"></image>
  61. </view>
  62. <view class="recomm-img lf-m-t-10" @click="$url('/pages/activityList/index')">
  63. <image :src="hot_list[2].product.picture" class="lf-w-100 lf-h-100"></image>
  64. </view>
  65. </view>
  66. </view>
  67. <view class="lf-row-between lf-m-t-10">
  68. <view class="recomm-img" @click="$url('/pages/activityList/index')" v-for="(item,index) of hot_list" v-if="index>2">
  69. <image :src="item.product.picture" class="lf-w-100 lf-h-100"></image>
  70. </view>
  71. </view>
  72. </view>
  73. <!-- tab标签 -->
  74. <!-- <view class="lf-m-t-40">
  75. <u-tabs :list="tab_list" :is-scroll="true" :current="current" @change="tabChange"></u-tabs>
  76. </view> -->
  77. <!-- 推荐 -->
  78. <!-- <view class="lf-row-between lf-m-t-40 lf-m-b-10">
  79. <view class="lf-font-36 lf-font-bold lf-color-333">推荐</view>
  80. <view class="lf-flex lf-color-555">
  81. <view class="lf-m-r-10">更多</view>
  82. <u-icon name="lock-fill lf-text-vertical"></u-icon>
  83. </view>
  84. </view> -->
  85. </view>
  86. <!-- 猜你喜欢 -->
  87. <lf-title-line></lf-title-line>
  88. <!-- 商品列表-瀑布流 -->
  89. <view style="padding: 0 20rpx;">
  90. <lf-waterfall :list="recomm_list"></lf-waterfall>
  91. <!-- <u-loadmore v-if="recomm_list.length" status="已加载全部数据~" @loadmore="addRandomData"></u-loadmore> -->
  92. <view class="loading-more">
  93. <text :class="{'loading-more-text': loading_class}" v-if="recomm_list.length">{{ loading_text }}</text>
  94. <lf-nocontent v-else></lf-nocontent>
  95. </view>
  96. </view>
  97. <!-- 回到顶部 -->
  98. <u-back-top :scroll-top="pageScrollTop" :custom-style="{background: 'rgba(51, 51 51, 0.3)'}"></u-back-top>
  99. </view>
  100. </template>
  101. <script>
  102. import lfWaterfall from '@/components/lf-waterfall/lf-waterfall.vue';
  103. import lfTitleLine from '@/components/lf-title-line/lf-title-line.vue';
  104. export default {
  105. components: {
  106. lfWaterfall,
  107. lfTitleLine
  108. },
  109. data() {
  110. return {
  111. banner: [],
  112. banner_current: 0,
  113. recomm_list: [],
  114. channel_list: [],
  115. current: 0,
  116. loading_class: false,
  117. hot_list: [],
  118. loading_text: '已加载全部数据~',
  119. home_ad1: '',
  120. hot_number: '',
  121. list: [],
  122. notice: []
  123. }
  124. },
  125. onLoad() {
  126. // this.addRandomData();
  127. this.getIndexData()
  128. this.getFavourite()
  129. },
  130. methods: {
  131. // 瀑布流随机模拟数据
  132. addRandomData() {
  133. for(let i = 0; i < 10; i++) {
  134. let index = this.$u.random(0, this.list.length - 1);
  135. // 先转成字符串再转成对象,避免数组对象引用导致数据混乱
  136. let item = JSON.parse(JSON.stringify(this.list[index]))
  137. item.id = this.$u.guid();
  138. this.recomm_list.push(item);
  139. }
  140. },
  141. //获取猜你喜欢
  142. getFavourite() {
  143. this.$http(this.API.API_FAVOURITE).then(res => {
  144. this.recomm_list = res.data.data
  145. console.log(res)
  146. }).catch(err => {
  147. })
  148. },
  149. getIndexData() {
  150. this.$http(this.API.API_INDEX).then(res => {
  151. this.notice = res.data?.notice
  152. this.hot_list = res.data?.hots
  153. this.hot_number = parseInt(this.hot_list[0].price)
  154. this.banner = res.data?.slide
  155. this.channel_list = res.data?.my_channels
  156. this.home_ad1 = res.data?.home_ad1
  157. console.log(res)
  158. }).catch(err => {
  159. })
  160. },
  161. // tabs标签切换时件,现已费弃
  162. tabChange(current){
  163. this.current = current;
  164. },
  165. // swiper页面被滑动切换
  166. pageChange(event){
  167. console.log(event)
  168. this.current = event.detail.current;
  169. },
  170. // banner图被点击
  171. clickBanner(){
  172. this.$msg('您点击了banner图')
  173. },
  174. // ad被点击
  175. clickAD(){
  176. this.$msg('您点击了ad广告')
  177. }
  178. },
  179. onReachBottom() {
  180. },
  181. onPullDownRefresh(){
  182. uni.stopPullDownRefresh();
  183. },
  184. onShareAppMessage(){
  185. let shareInfo = {
  186. title: '欢迎使用海南旅游小程序',
  187. path: '/pages/route/index?route=home'
  188. }
  189. return shareInfo;
  190. }
  191. }
  192. </script>
  193. <style>
  194. page{
  195. background-color: #F6F6F6;
  196. }
  197. </style>
  198. <style lang="scss" scoped>
  199. .head{
  200. width: 750rpx;
  201. height: 360rpx;
  202. .swipe-img{
  203. width: 100%;
  204. height: 100%;
  205. }
  206. }
  207. .content{
  208. width: 750rpx;
  209. // height: 600rpx;
  210. height: max-content;
  211. border-radius: 30rpx 30rpx 0rpx 0rpx;
  212. position: relative;
  213. top: -30rpx;
  214. background-color: #FFFFFF;
  215. box-sizing: border-box;
  216. padding: 40rpx 32rpx 10rpx;
  217. .message-box{
  218. width: 686rpx;
  219. height: 53rpx;
  220. background: #CFE7FD;
  221. border-radius: 27rpx;
  222. color: #1998FE;
  223. box-sizing: border-box;
  224. padding: 0 20rpx;
  225. font-size: 24rpx;
  226. .message-btn{
  227. width: 80rpx;
  228. height: 33rpx;
  229. border-radius: 10rpx;
  230. border: 1rpx solid #1998FE;
  231. text-align: center;
  232. line-height: 31rpx;
  233. }
  234. }
  235. }
  236. .channel-item{
  237. width: 160rpx;
  238. height: 160rpx;
  239. border-radius: 15rpx;
  240. margin-top: 15rpx;
  241. margin-right: 15rpx;
  242. position: relative;
  243. overflow: hidden;
  244. &:nth-child(4n){
  245. margin-right: 0;
  246. }
  247. image{
  248. width: 160rpx;
  249. height: 160rpx;
  250. position: absolute;
  251. z-index: 0;
  252. }
  253. // view{
  254. // position: absolute;
  255. // right: 0;
  256. // bottom: 0;
  257. // background-color: rgba(255,255,255,0.5);
  258. // width: 42rpx;
  259. // height: 42rpx;
  260. // color: #FFFFFF;
  261. // display: flex;
  262. // justify-content: center;
  263. // align-items: center;
  264. // border-radius: 10rpx 0rpx 15rpx 0rpx;
  265. // z-index: 2;
  266. // }
  267. .channel-mask::after{
  268. width: 100%;
  269. height: 100%;
  270. content: '';
  271. position: absolute;
  272. z-index: 1;
  273. background: rgba(0, 0, 0, 0.5);
  274. top: 0;
  275. left: 0;
  276. }
  277. .channe-text{
  278. position: absolute;
  279. top: 0;
  280. left: 0;
  281. width: 100%;
  282. height: 100%;
  283. z-index: 2;
  284. color: #FFFFFF;
  285. font-size: 28rpx;
  286. }
  287. }
  288. .ad{
  289. height: 230rpx;
  290. width: 100%;
  291. }
  292. .recomm{
  293. width: 100%;
  294. height: max-content;
  295. .recomm-img{
  296. width: 222rpx;
  297. height: 222rpx;
  298. border-radius: 5rpx;
  299. }
  300. .max-recomm-img{
  301. width: 455rpx;
  302. height: 455rpx;
  303. position: relative;
  304. border-radius: 5rpx;
  305. overflow: hidden;
  306. .recomm-title{
  307. // height: 142rpx;
  308. height: max-content;
  309. width: 100%;
  310. background-color: rgba(0,0,0,0.65);
  311. box-sizing: border-box;
  312. padding: 15rpx;
  313. position: absolute;
  314. bottom: 0;
  315. color: #FFFFFF;
  316. border-radius: 0rpx 0rpx 20rpx 20rpx;
  317. }
  318. }
  319. }
  320. </style>