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

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