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

360 lines
10 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 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="https://picsum.photos/375/230" 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="../../static/logo.png" class="lf-w-100 lf-h-100"></image>
  52. <view class="recomm-title">
  53. <view class="lf-line-2 lf-m-b-10">土耳其双人游飞机往返酒店五星级各大热门景点豪华双人游纯江湖救急</view>
  54. <lf-price price="3999.00"></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="../../static/logo.png" 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="../../static/logo.png" 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')">
  69. <image src="../../static/logo.png" class="lf-w-100 lf-h-100"></image>
  70. </view>
  71. <view class="recomm-img" @click="$url('/pages/activityList/index')">
  72. <image src="../../static/logo.png" class="lf-w-100 lf-h-100"></image>
  73. </view>
  74. <view class="recomm-img" @click="$url('/pages/activityList/index')">
  75. <image src="../../static/logo.png" class="lf-w-100 lf-h-100"></image>
  76. </view>
  77. </view>
  78. </view>
  79. <!-- tab标签 -->
  80. <!-- <view class="lf-m-t-40">
  81. <u-tabs :list="tab_list" :is-scroll="true" :current="current" @change="tabChange"></u-tabs>
  82. </view> -->
  83. <!-- 推荐 -->
  84. <!-- <view class="lf-row-between lf-m-t-40 lf-m-b-10">
  85. <view class="lf-font-36 lf-font-bold lf-color-333">推荐</view>
  86. <view class="lf-flex lf-color-555">
  87. <view class="lf-m-r-10">更多</view>
  88. <u-icon name="lock-fill lf-text-vertical"></u-icon>
  89. </view>
  90. </view> -->
  91. </view>
  92. <!-- 猜你喜欢 -->
  93. <lf-title-line></lf-title-line>
  94. <!-- 商品列表-瀑布流 -->
  95. <view style="padding: 0 20rpx;">
  96. <lf-waterfall :list="recomm_list"></lf-waterfall>
  97. <!-- <u-loadmore v-if="recomm_list.length" status="已加载全部数据~" @loadmore="addRandomData"></u-loadmore> -->
  98. <view class="loading-more">
  99. <text :class="{'loading-more-text': loading_class}" v-if="recomm_list.length">{{ loading_text }}</text>
  100. <lf-nocontent v-else></lf-nocontent>
  101. </view>
  102. </view>
  103. <!-- 回到顶部 -->
  104. <u-back-top :scroll-top="pageScrollTop" :custom-style="{background: 'rgba(51, 51 51, 0.3)'}"></u-back-top>
  105. </view>
  106. </template>
  107. <script>
  108. import lfWaterfall from '@/components/lf-waterfall/lf-waterfall.vue';
  109. import lfTitleLine from '@/components/lf-title-line/lf-title-line.vue';
  110. export default {
  111. components: {
  112. lfWaterfall,
  113. lfTitleLine
  114. },
  115. data() {
  116. return {
  117. banner: [],
  118. banner_current: 0,
  119. recomm_list: [],
  120. channel_list: [],
  121. current: 0,
  122. loading_class: false,
  123. loading_text: '已加载全部数据~',
  124. home_ad1: '',
  125. list: [
  126. {
  127. price: 35,
  128. title: '北国风光,千里冰封,万里雪飘',
  129. shop: '李白杜甫白居易旗舰店',
  130. image: 'http://pic.sc.chinaz.com/Files/pic/pic9/202002/zzpic23327_s.jpg',
  131. },
  132. {
  133. price: 75,
  134. title: '望长城内外,惟余莽莽',
  135. shop: '李白杜甫白居易旗舰店',
  136. image: 'http://pic.sc.chinaz.com/Files/pic/pic9/202002/zzpic23325_s.jpg',
  137. },
  138. {
  139. price: 385,
  140. title: '大河上下,顿失滔滔',
  141. shop: '李白杜甫白居易旗舰店',
  142. image: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg',
  143. },
  144. {
  145. price: 784,
  146. title: '欲与天公试比高',
  147. shop: '李白杜甫白居易旗舰店',
  148. image: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/zzpic23369_s.jpg',
  149. },
  150. {
  151. price: 7891,
  152. title: '须晴日,看红装素裹,分外妖娆',
  153. shop: '李白杜甫白居易旗舰店',
  154. image: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2130_s.jpg',
  155. },
  156. {
  157. price: 2341,
  158. shop: '李白杜甫白居易旗舰店',
  159. title: '江山如此多娇,引无数英雄竞折腰',
  160. image: 'http://pic1.sc.chinaz.com/Files/pic/pic9/202002/zzpic23346_s.jpg',
  161. }
  162. ],
  163. notice: []
  164. }
  165. },
  166. onLoad() {
  167. // this.addRandomData();
  168. this.getIndexData()
  169. },
  170. methods: {
  171. // 瀑布流随机模拟数据
  172. addRandomData() {
  173. for(let i = 0; i < 10; i++) {
  174. let index = this.$u.random(0, this.list.length - 1);
  175. // 先转成字符串再转成对象,避免数组对象引用导致数据混乱
  176. let item = JSON.parse(JSON.stringify(this.list[index]))
  177. item.id = this.$u.guid();
  178. this.recomm_list.push(item);
  179. }
  180. },
  181. getIndexData() {
  182. this.$http(this.API.API_INDEX).then(res => {
  183. this.notice = res.data?.notice
  184. this.recomm_list = res.data?.hots
  185. this.banner = res.data?.slide
  186. this.channel_list = res.data?.my_channels
  187. this.home_ad1 = res.data?.home_ad1
  188. console.log(res)
  189. }).catch(err => {
  190. })
  191. },
  192. // tabs标签切换时件,现已费弃
  193. tabChange(current){
  194. this.current = current;
  195. },
  196. // swiper页面被滑动切换
  197. pageChange(event){
  198. console.log(event)
  199. this.current = event.detail.current;
  200. },
  201. // banner图被点击
  202. clickBanner(){
  203. this.$msg('您点击了banner图')
  204. },
  205. // ad被点击
  206. clickAD(){
  207. this.$msg('您点击了ad广告')
  208. }
  209. },
  210. onReachBottom() {
  211. },
  212. onPullDownRefresh(){
  213. uni.stopPullDownRefresh();
  214. },
  215. onShareAppMessage(){
  216. let shareInfo = {
  217. title: '欢迎使用海南旅游小程序',
  218. path: '/pages/route/index?route=home'
  219. }
  220. return shareInfo;
  221. }
  222. }
  223. </script>
  224. <style>
  225. page{
  226. background-color: #F6F6F6;
  227. }
  228. </style>
  229. <style lang="scss" scoped>
  230. .head{
  231. width: 750rpx;
  232. height: 360rpx;
  233. .swipe-img{
  234. width: 100%;
  235. height: 100%;
  236. }
  237. }
  238. .content{
  239. width: 750rpx;
  240. // height: 600rpx;
  241. height: max-content;
  242. border-radius: 30rpx 30rpx 0rpx 0rpx;
  243. position: relative;
  244. top: -30rpx;
  245. background-color: #FFFFFF;
  246. box-sizing: border-box;
  247. padding: 40rpx 32rpx 10rpx;
  248. .message-box{
  249. width: 686rpx;
  250. height: 53rpx;
  251. background: #CFE7FD;
  252. border-radius: 27rpx;
  253. color: #1998FE;
  254. box-sizing: border-box;
  255. padding: 0 20rpx;
  256. font-size: 24rpx;
  257. .message-btn{
  258. width: 80rpx;
  259. height: 33rpx;
  260. border-radius: 10rpx;
  261. border: 1rpx solid #1998FE;
  262. text-align: center;
  263. line-height: 31rpx;
  264. }
  265. }
  266. }
  267. .channel-item{
  268. width: 160rpx;
  269. height: 160rpx;
  270. border-radius: 15rpx;
  271. margin-top: 15rpx;
  272. margin-right: 15rpx;
  273. position: relative;
  274. overflow: hidden;
  275. &:nth-child(4n){
  276. margin-right: 0;
  277. }
  278. image{
  279. width: 160rpx;
  280. height: 160rpx;
  281. position: absolute;
  282. z-index: 0;
  283. }
  284. // view{
  285. // position: absolute;
  286. // right: 0;
  287. // bottom: 0;
  288. // background-color: rgba(255,255,255,0.5);
  289. // width: 42rpx;
  290. // height: 42rpx;
  291. // color: #FFFFFF;
  292. // display: flex;
  293. // justify-content: center;
  294. // align-items: center;
  295. // border-radius: 10rpx 0rpx 15rpx 0rpx;
  296. // z-index: 2;
  297. // }
  298. .channel-mask::after{
  299. width: 100%;
  300. height: 100%;
  301. content: '';
  302. position: absolute;
  303. z-index: 1;
  304. background: rgba(0, 0, 0, 0.5);
  305. top: 0;
  306. left: 0;
  307. }
  308. .channe-text{
  309. position: absolute;
  310. top: 0;
  311. left: 0;
  312. width: 100%;
  313. height: 100%;
  314. z-index: 2;
  315. color: #FFFFFF;
  316. font-size: 28rpx;
  317. }
  318. }
  319. .ad{
  320. height: 230rpx;
  321. width: 100%;
  322. }
  323. .recomm{
  324. width: 100%;
  325. height: max-content;
  326. .recomm-img{
  327. width: 222rpx;
  328. height: 222rpx;
  329. border-radius: 5rpx;
  330. }
  331. .max-recomm-img{
  332. width: 455rpx;
  333. height: 455rpx;
  334. position: relative;
  335. border-radius: 5rpx;
  336. overflow: hidden;
  337. .recomm-title{
  338. // height: 142rpx;
  339. height: max-content;
  340. width: 100%;
  341. background-color: rgba(0,0,0,0.65);
  342. box-sizing: border-box;
  343. padding: 15rpx;
  344. position: absolute;
  345. bottom: 0;
  346. color: #FFFFFF;
  347. border-radius: 0rpx 0rpx 20rpx 20rpx;
  348. }
  349. }
  350. }
  351. </style>