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

365 lines
9.9 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
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. onLoad(options) {
  139. if (options.scene) {
  140. // 单个参数
  141. let str = decodeURIComponent(options.scene);
  142. this.$http(this.API.API_CONFIRM_CODE, {verify_code: str}).then(res => {
  143. this.$msg('核销成功!');
  144. });
  145. }
  146. },
  147. methods: {
  148. //获取猜你喜欢
  149. getFavourite() {
  150. this.$http(this.API.API_FAVOURITE).then(res => {
  151. this.recomm_list = res.data.data
  152. }).catch(err => {
  153. })
  154. },
  155. getIndexData() {
  156. this.$http(this.API.API_INDEX).then(res => {
  157. this.notice = res.data?.notice
  158. this.hot_list = res.data?.hots
  159. this.hot_number = this.hot_list[0].price
  160. this.banner = res.data?.slide
  161. this.channel_list = res.data?.my_channels
  162. this.home_ad1 = res.data?.special
  163. uni.stopPullDownRefresh();
  164. console.log(this.home_ad1)
  165. }).catch(err => {})
  166. },
  167. // tabs标签切换时件,现已费弃
  168. tabChange(current){
  169. this.current = current;
  170. },
  171. // swiper页面被滑动切换
  172. pageChange(event){
  173. console.log(event)
  174. this.current = event.detail.current;
  175. },
  176. // banner图被点击
  177. clickBanner(type,url){
  178. if(url) {
  179. if(type == 0) {
  180. this.$url(url);
  181. }else {
  182. this.$url('/pages/index/urlWeb?url='+url);
  183. }
  184. }
  185. },
  186. // ad被点击
  187. clickAD(type,url){
  188. // this.$msg('您点击了ad广告')
  189. if(url) {
  190. if(type == 0) {
  191. console.log(url)
  192. this.$url(url);
  193. }else {
  194. this.$url('/pages/index/urlWeb?url='+url);
  195. }
  196. }
  197. }
  198. },
  199. onReachBottom() {
  200. },
  201. onPullDownRefresh(){
  202. this.getIndexData()
  203. this.getFavourite()
  204. uni.stopPullDownRefresh()
  205. },
  206. onShareAppMessage(){
  207. let shareInfo = {
  208. title: '欢迎使用海南旅游小程序',
  209. path: '/pages/route/index?route=home'
  210. }
  211. return shareInfo;
  212. }
  213. }
  214. </script>
  215. <style>
  216. page{
  217. background-color: #F6F6F6;
  218. }
  219. </style>
  220. <style lang="scss" scoped>
  221. .my_chancel {
  222. display: flex;
  223. justify-content: center;
  224. text-align: center;
  225. min-height: 200rpx;
  226. }
  227. .channel-mask1 {
  228. width: 60rpx;
  229. height: 60rpx;
  230. }
  231. .head{
  232. width: 750rpx;
  233. height: 360rpx;
  234. .swipe-img{
  235. width: 100%;
  236. height: 100%;
  237. }
  238. }
  239. .content{
  240. width: 750rpx;
  241. // height: 600rpx;
  242. height: max-content;
  243. border-radius: 30rpx 30rpx 0rpx 0rpx;
  244. position: relative;
  245. top: -30rpx;
  246. background-color: #FFFFFF;
  247. box-sizing: border-box;
  248. padding: 40rpx 32rpx 10rpx;
  249. .message-box{
  250. width: 686rpx;
  251. height: 53rpx;
  252. background: #CFE7FD;
  253. border-radius: 27rpx;
  254. color: #1998FE;
  255. box-sizing: border-box;
  256. padding: 0 20rpx;
  257. font-size: 24rpx;
  258. .message-btn{
  259. width: 80rpx;
  260. height: 33rpx;
  261. border-radius: 10rpx;
  262. border: 1rpx solid #1998FE;
  263. text-align: center;
  264. line-height: 31rpx;
  265. }
  266. }
  267. }
  268. .channel-item{
  269. width: 160rpx;
  270. height: 160rpx;
  271. border-radius: 15rpx;
  272. margin-top: 15rpx;
  273. margin-right: 15rpx;
  274. position: relative;
  275. overflow: hidden;
  276. &:nth-child(4n){
  277. margin-right: 0;
  278. }
  279. image{
  280. width: 160rpx;
  281. height: 160rpx;
  282. position: absolute;
  283. z-index: 0;
  284. }
  285. // view{
  286. // position: absolute;
  287. // right: 0;
  288. // bottom: 0;
  289. // background-color: rgba(255,255,255,0.5);
  290. // width: 42rpx;
  291. // height: 42rpx;
  292. // color: #FFFFFF;
  293. // display: flex;
  294. // justify-content: center;
  295. // align-items: center;
  296. // border-radius: 10rpx 0rpx 15rpx 0rpx;
  297. // z-index: 2;
  298. // }
  299. .channel-mask::after{
  300. width: 100%;
  301. height: 100%;
  302. content: '';
  303. position: absolute;
  304. z-index: 1;
  305. // background: rgba(0, 0, 0, 0.5);
  306. top: 0;
  307. left: 0;
  308. }
  309. .channe-text{
  310. position: absolute;
  311. top: 0;
  312. left: 0;
  313. width: 100%;
  314. height: 100%;
  315. z-index: 2;
  316. color: #FFFFFF;
  317. font-size: 28rpx;
  318. }
  319. }
  320. .ad{
  321. height: 230rpx;
  322. width: 100%;
  323. }
  324. .recomm{
  325. width: 100%;
  326. height: max-content;
  327. .recomm-img{
  328. width: 222rpx;
  329. height: 222rpx;
  330. border-radius: 15rpx;
  331. overflow: hidden;
  332. }
  333. .max-recomm-img{
  334. width: 455rpx;
  335. height: 455rpx;
  336. position: relative;
  337. border-radius: 15rpx;
  338. overflow: hidden;
  339. .recomm-title{
  340. // height: 142rpx;
  341. height: max-content;
  342. width: 100%;
  343. background-color: rgba(0,0,0,0.65);
  344. box-sizing: border-box;
  345. padding: 15rpx;
  346. position: absolute;
  347. bottom: 0;
  348. color: #FFFFFF;
  349. border-radius: 0rpx 0rpx 20rpx 20rpx;
  350. }
  351. }
  352. }
  353. </style>