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

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