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

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