index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. <template>
  2. <view class="">
  3. <view class="swiper">
  4. <u-swiper :list="swiper" keyName="url" height="100%" :autoplay="false"></u-swiper>
  5. <view class="banner">
  6. <view class="logo">
  7. <image :src="msg.logo" mode="widthFix"></image>
  8. </view>
  9. <view class="bannertitle">
  10. {{msg.title?msg.title:''}}
  11. </view>
  12. <view class="subtitle">
  13. {{msg.subtitle?msg.subtitle:''}}
  14. </view>
  15. </view>
  16. </view>
  17. <view class="contentTops">
  18. <view class="contentTop">
  19. <view class="iconl">
  20. </view>
  21. <view class="contentTop-title">
  22. 日月峡森林康养
  23. </view>
  24. <view class="iconr">
  25. <image src="../../static/senlinicon@2x.png" mode="widthFix"></image>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="videobox">
  30. <view class="list" v-for="(item,index) in video" :key="index">
  31. <view class="video">
  32. <!-- 这是视频 -->
  33. <video :src="item.url" object-fit="fill"></video>
  34. </view>
  35. <view class="contentfooter">
  36. <view class="contentfooter-title">
  37. {{item.title?item.title:""}}
  38. </view>
  39. <view class="contentfooter-subtitle">
  40. {{item.description?item.description:''}}
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. <!-- <view class="list">
  46. <view class="video">
  47. <video src="https://zhengda.oss-cn-chengdu.aliyuncs.com/riyuexia/Worker%20on%20Tulum%20Beach.mp4" object-fit="fill"></video>
  48. </view>
  49. <view class="contentfooter">
  50. <view class="contentfooter-title">
  51. 森林瑜伽
  52. </view>
  53. <view class="contentfooter-subtitle">
  54. 夏日的森林,雨水充沛了山林,鲜花盛放,溪水潺潺。漫步于自然之中,感受清新的空气,放空心灵,沉醉于山雾之中,感受不同于城市的静谧与轻松
  55. </view>
  56. </view>
  57. </view> -->
  58. <view class="" style="padding-top: 80rpx;width: 100%;"></view>
  59. </view>
  60. </template>
  61. <script>
  62. export default {
  63. data() {
  64. return {
  65. swiper: [
  66. ],
  67. msg: null,
  68. video: null,
  69. route: ''
  70. }
  71. },
  72. onLoad() {
  73. },
  74. onShow() {
  75. let curPage = getCurrentPages();
  76. this.route = curPage[curPage.length - 1].route; //获取当前页面的路由
  77. this.init()
  78. },
  79. onShareTimeline() {
  80. return {
  81. title: '日月峽',
  82. path: '/pages/index/index'
  83. }
  84. },
  85. onShareAppMessage(res) {
  86. return {
  87. title: '日月峽',
  88. path: '/pages/index/index'
  89. }
  90. },
  91. methods: {
  92. init() {
  93. // uni.showLoading()
  94. uni.$u.http.post('/api/config/home', {
  95. custom: {
  96. auth: true
  97. }
  98. }).then((res) => {
  99. uni.setStorageSync("home", res)
  100. let home = uni.getStorageSync("home")
  101. this.msg = res.page
  102. this.video = res.videos
  103. this.swiper.push(res.page.bg_picture)
  104. // uni.hideLoading()
  105. }).catch((err) => {
  106. console.log(err)
  107. })
  108. let phone = uni.getStorageSync("phone")
  109. let code = uni.getStorageSync("code")
  110. uni.$u.http.post('/api/config/list', {
  111. phone,
  112. code
  113. }, {
  114. custom: {
  115. auth: true
  116. }
  117. }).then((res) => {
  118. // console.log(res)
  119. // this.swiper=res[9].value
  120. uni.setStorageSync("data", res)
  121. }).catch((err) => {
  122. console.log(err)
  123. })
  124. let obj = {
  125. page: this.route,
  126. code: code
  127. }
  128. if (code) {
  129. uni.$u.http.post('/api/visit/add', obj, {
  130. custom: {
  131. auth: true
  132. }
  133. }).then((res) => {}).catch((err) => {})
  134. }
  135. }
  136. }
  137. }
  138. </script>
  139. <style lang="less">
  140. page {
  141. font-family: PingFang-SC-Heavy, PingFang-SC;
  142. background: #ffffff;
  143. }
  144. .swiper {
  145. height: 100vh;
  146. // width: 100%;
  147. position: relative;
  148. }
  149. .banner {
  150. width: 100%;
  151. position: absolute;
  152. left: 0;
  153. top: 0;
  154. // background-color: rgba(0,0,0,.5);
  155. height: 100vh;
  156. text-align: center;
  157. .logo {
  158. // text-align: center;
  159. padding-top: 160rpx;
  160. image {
  161. width: 114rpx;
  162. height: 106rpx;
  163. }
  164. }
  165. .bannertitle {
  166. font-size: 64rpx;
  167. // text-align: center;
  168. margin: 138rpx 0 37rpx;
  169. margin-bottom: 30rpx;
  170. color: #FFFFFF;
  171. }
  172. .subtitle {
  173. font-size: 44rpx;
  174. color: #FFFFFF;
  175. }
  176. }
  177. .contentTops {
  178. position: relative;
  179. }
  180. .contentTop {
  181. position: absolute;
  182. top: -48rpx;
  183. right: 0;
  184. width: 93%;
  185. display: flex;
  186. align-items: center;
  187. background-color: #FCFCFC;
  188. z-index: 9999 !important;
  189. padding: 56rpx 30rpx 38rpx;
  190. border-radius: 0px 56rpx 0px 0px;
  191. box-shadow: 0px 8rpx 14rpx 0px rgba(0, 21, 3, 0.05);
  192. .iconl {
  193. border-radius: 50%;
  194. width: 48rpx;
  195. height: 48rpx;
  196. background: linear-gradient(140deg, #2F8F49 0%, rgba(119, 204, 168, 0) 100%);
  197. opacity: 0.3;
  198. margin-top: -24rpx;
  199. margin-right: -10rpx;
  200. }
  201. .contentTop-title {
  202. font-size: 32rpx;
  203. font-weight: 800;
  204. color: #333333;
  205. margin: 0 20rpx 0 -26rpx;
  206. }
  207. .iconr {
  208. image {
  209. width: 32rpx;
  210. }
  211. }
  212. }
  213. .videobox {
  214. // &:first-child{
  215. margin-top: 92rpx;
  216. // }
  217. }
  218. .list {
  219. background-color: #FCFCFC;
  220. // margin-top: 92rpx;
  221. width: 100%;
  222. margin-bottom: 40rpx;
  223. // background-color: #fff;
  224. border-radius: 0px 0px 16rpx 100rpx;
  225. ;
  226. box-shadow: 0px 8rpx 14rpx 0px rgba(0, 21, 3, 0.08);
  227. .video {
  228. margin: 0 30rpx;
  229. height: 390rpx;
  230. // background-color: skyblue;
  231. video {
  232. width: 100%;
  233. height: 100%;
  234. }
  235. }
  236. .contentfooter {
  237. .contentfooter-title {
  238. font-size: 30rpx;
  239. font-family: PingFang-SC-Bold, PingFang-SC;
  240. font-weight: bold;
  241. color: #333333;
  242. text-shadow: 0px 8rpx 14rpx rgba(0, 21, 3, 0.05);
  243. margin: 40rpx 0rpx 20rpx 56rpx;
  244. }
  245. .contentfooter-subtitle {
  246. font-size: 26rpx;
  247. font-weight: 500;
  248. color: #333333;
  249. overflow: hidden;
  250. white-space: nowrap;
  251. text-overflow: ellipsis;
  252. padding: 0rpx 71rpx 40rpx 56rpx;
  253. }
  254. }
  255. }
  256. </style>