index.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  1. <template>
  2. <view class="container">
  3. <view class="status_bar"></view>
  4. <!-- 轮播图 start -->
  5. <swiper class="top-swiper" autoplay="true" duration="400" interval="5000" @change="swiperChange">
  6. <swiper-item v-for="(item, index) in carouselList" :key="index" class="carousel-item"
  7. @click="bannerNavToUrl(item)">
  8. <image :src="item.pic" />
  9. </swiper-item>
  10. </swiper>
  11. <!-- 轮播图 end -->
  12. <!-- 认证提示 statr-->
  13. <view class="rznow flex">
  14. <view class="rztit">
  15. 您尚未完成身份认证,前往认证>>
  16. </view>
  17. <view class="rzbtn" @click="navTo('/pages/shop/attestation')">
  18. 立即认证
  19. </view>
  20. </view>
  21. <!-- 认证提示 ed-->
  22. <!-- 功能区 start-->
  23. <view class="gn-wrap flex">
  24. <view class="gn-icon flex">
  25. <image src="../../static/icon/in1.png" mode="heightFix"></image>
  26. </view>
  27. <view class="gn-tit">
  28. <view class="">
  29. 租电
  30. </view>
  31. <view class="tit-jj">
  32. 以租代购 方便省钱
  33. </view>
  34. </view>
  35. <view class="gn-btn" @click="navTo('/pages/shop/rent')">
  36. 立即租电
  37. </view>
  38. </view>
  39. <view class="gn-wrap flex">
  40. <view class="gn-icon flex">
  41. <image src="../../static/icon/in2.png" mode="heightFix"></image>
  42. </view>
  43. <view class="gn-tit">
  44. <view class="">
  45. 配件购买
  46. </view>
  47. <view class="tit-jj">
  48. 扫码租电
  49. </view>
  50. </view>
  51. <view class="gn-btn" @click="navTo('/pages/shop/accessory')">
  52. 立即购买
  53. </view>
  54. </view>
  55. <!-- 功能区 ed-->
  56. <!-- 附近门店 start -->
  57. <view class="fjmd" @click="navTo('/pages/shop/shopTab')">
  58. <image src="../../static/img/md.png" mode=""></image>
  59. </view>
  60. <!-- 附近门店 end -->
  61. <!-- 使用攻略 start -->
  62. <view class="sygl">
  63. <view class="sy-top">
  64. <image src="../../static/icon/gl-top.png" mode=""></image>
  65. <view class="top-tit">
  66. 使用攻略
  67. </view>
  68. </view>
  69. <view class="sy-content flex">
  70. <view class="content-item flex">
  71. <image src="../../static/icon/sy1.png" mode="" class="sy-icon"></image>
  72. <view class="">
  73. 注册账号
  74. </view>
  75. </view>
  76. <image src="../../static/icon/jt.png" mode="" class="jt"></image>
  77. <view class="content-item flex">
  78. <image src="../../static/icon/sy2.png" mode="" class="sy-icon"></image>
  79. <view class="">
  80. 实名认证
  81. </view>
  82. </view>
  83. <image src="../../static/icon/jt.png" mode="" class="jt"></image>
  84. <view class="content-item flex">
  85. <image src="../../static/icon/sy3.png" mode="" class="sy-icon"></image>
  86. <view class="">
  87. 购买租电
  88. </view>
  89. </view>
  90. <image src="../../static/icon/jt.png" mode="" class="jt"></image>
  91. <view class="content-item flex">
  92. <image src="../../static/icon/sy4.png" mode="" class="sy-icon"></image>
  93. <view class="">
  94. 开始使用
  95. </view>
  96. </view>
  97. </view>
  98. </view>
  99. <!-- 使用攻略 ed-->
  100. </view>
  101. </template>
  102. <script>
  103. import { loadIndexs } from '@/api/index.js'
  104. export default {
  105. data() {
  106. return {
  107. carouselList: [],//轮播图
  108. };
  109. },
  110. computed: {
  111. },
  112. // 切换或显示后变动tabbar颜色
  113. onHide() {
  114. },
  115. onLoad: function(option) {
  116. // #ifndef MP
  117. if (option.spread) {
  118. // 存储其他邀请人
  119. uni.setStorageSync('spread', option.spread);
  120. }
  121. // #endif
  122. // #ifdef MP
  123. if (option.scene) {
  124. // 存储小程序邀请人
  125. uni.setStorage({
  126. key: 'spread_code',
  127. data: option.scene
  128. });
  129. }
  130. // #endif
  131. },
  132. onShow() {
  133. this.getIndex()
  134. },
  135. onReady() {
  136. },
  137. // #ifdef MP
  138. onShareAppMessage(options) {
  139. // 设置菜单中的转发按钮触发转发事件时的转发内容
  140. let pages = getCurrentPages(); //获取加载的页面
  141. let currentPage = pages[pages.length - 1]; //获取当前页面的对象
  142. let url = currentPage.route; //当前页面url
  143. let item = currentPage.options; //如果要获取url中所带的参数可以查看options
  144. let shareObj = {
  145. title: '租电', // 默认是小程序的名称(可以写slogan等)
  146. path: url, // 默认是当前页面,必须是以‘/’开头的完整路径
  147. imageUrl: '',
  148. desc:'',
  149. success: function(res) {
  150. // 转发成功之后的回调
  151. if (res.errMsg == 'shareAppMessage:ok') {}
  152. },
  153. fail: function() {
  154. // 转发失败之后的回调
  155. if (res.errMsg == 'shareAppMessage:fail cancel') {
  156. // 用户取消转发
  157. } else if (res.errMsg == 'shareAppMessage:fail') {
  158. // 转发失败,其中 detail message 为详细失败信息
  159. }
  160. }
  161. };
  162. // 判断是否可以邀请
  163. // if (this.userInfo.uid) {
  164. // shareObj.path += '&spread=' + this.userInfo.uid;
  165. // }
  166. return shareObj;
  167. },
  168. // #endif
  169. methods: {
  170. getIndex() {
  171. loadIndexs().then(res => {
  172. })
  173. },
  174. navTo(url) {
  175. if(url.indexOf('http') != -1 ) {
  176. window.location.href = url
  177. }else {
  178. uni.navigateTo({
  179. url,
  180. fail() {
  181. uni.switchTab({
  182. url
  183. })
  184. }
  185. })
  186. }
  187. },
  188. }
  189. };
  190. </script>
  191. <style lang="scss">
  192. page {
  193. background: #ffff;
  194. min-height: 100%;
  195. height: auto;
  196. }
  197. // 顶部搜索
  198. .top-search {
  199. height: 80rpx;
  200. padding: 0 20rpx;
  201. background-color: #fff;
  202. .top-logo {
  203. width: 50rpx;
  204. // height: 50rpx;
  205. margin-right: 10rpx;
  206. image {
  207. width: 48rpx;
  208. }
  209. }
  210. .search-box {
  211. justify-content: center;
  212. width: 698rpx;
  213. height: 60rpx;
  214. background: #EEEEEE;
  215. // box-shadow: 0px 10rpx 20rpx 0px rgba(4, 114, 69, 0.22);
  216. border-radius: 30rpx;
  217. .search {
  218. width: 34rpx;
  219. height: 34rpx;
  220. }
  221. .search-font {
  222. margin-left: 14rpx;
  223. font-size: 28rpx;
  224. font-family: PingFang SC;
  225. font-weight: 500;
  226. color: #CBCBCB;
  227. }
  228. }
  229. }
  230. // 顶部轮播图
  231. .top-swiper {
  232. width: 750rpx;
  233. height: 473rpx;
  234. // margin: 20rpx 0 0;
  235. image {
  236. width: 750rpx;
  237. height: 473rpx;
  238. }
  239. }
  240. .jg {
  241. height: 20rpx;
  242. background: #F8F8F8;
  243. }
  244. // 分类
  245. .cate-section {
  246. justify-content: space-around;
  247. background-color: #fff;
  248. padding: 0rpx 0 30rpx;
  249. .cate-item {
  250. flex-grow: 0;
  251. width: 20%;
  252. flex-direction: column;
  253. text-align: center;
  254. align-items: center;
  255. justify-content: center;
  256. .img-wrapper {
  257. width: 112rpx;
  258. height: 112rpx;
  259. border-radius: 20rpx;
  260. position: relative;
  261. image {
  262. width: 112rpx;
  263. height: 112rpx;
  264. position: absolute;
  265. left: 50%;
  266. top: 50%;
  267. transform: translate(-50%, -50%);
  268. }
  269. }
  270. .item-title {
  271. margin-top: 15rpx;
  272. font-size: 26rpx;
  273. font-weight: 500;
  274. color: #666666;
  275. }
  276. }
  277. }
  278. .rznow {
  279. font-weight: 500;
  280. font-size: 26rpx;
  281. color: #FFFFFF;
  282. background-color: #78797a;
  283. height: 74rpx;
  284. padding: 0 42rpx 0 52rpx;
  285. .rztit {
  286. line-height: 74rpx;
  287. }
  288. .rzbtn {
  289. width: 127rpx;
  290. height: 47rpx;
  291. text-align: center;
  292. line-height: 47rpx;
  293. background: #35d9b7;
  294. border-radius: 24rpx;
  295. font-size: 22rpx;
  296. }
  297. }
  298. .gn-wrap {
  299. margin: 45rpx auto;
  300. width: 670rpx;
  301. height: 219rpx;
  302. background: #FFFFFF;
  303. box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(50,50,52,0.06);
  304. border-radius: 30rpx;
  305. padding-right: 47rpx;
  306. .gn-icon {
  307. flex-shrink: 0;
  308. width: 210rpx;
  309. height: 100%;
  310. justify-content: center;
  311. image {
  312. height: 112rpx;
  313. }
  314. }
  315. .gn-tit {
  316. flex-grow: 1;
  317. font-weight: bold;
  318. color: #333333;
  319. font-size: 36rpx;
  320. flex-direction: column;
  321. justify-content: center;
  322. align-items: flex-start;
  323. .tit-jj {
  324. font-size: 25rpx;
  325. font-weight: 500;
  326. color: #666666;
  327. padding-top: 32rpx;
  328. }
  329. }
  330. .gn-btn {
  331. flex-shrink: 0;
  332. width: 127rpx;
  333. border: 1px solid $base-color;
  334. border-radius: 28rpx;
  335. font-size: 25rpx;
  336. font-weight: 500;
  337. color: $base-color;
  338. line-height: 55rpx;
  339. text-align: center;
  340. }
  341. }
  342. .fjmd {
  343. width: 708rpx;
  344. height: 233rpx;
  345. margin: 20rpx auto;
  346. image {
  347. width: 100%;
  348. height: 100%;
  349. }
  350. }
  351. .sygl {
  352. .sy-top {
  353. position: relative;
  354. height: 100rpx;
  355. image {
  356. width: 369rpx;
  357. height: 8rpx;
  358. position: absolute;
  359. top: 0;
  360. bottom: 0;
  361. left: 0;
  362. right: 0;
  363. margin: auto;
  364. }
  365. .top-tit {
  366. font-size: 32rpx;
  367. font-weight: bold;
  368. color: #4A2723;
  369. text-align: center;
  370. line-height: 100rpx;
  371. }
  372. }
  373. .sy-content {
  374. padding: 0 10rpx 65rpx ;
  375. .content-item {
  376. flex-grow: 1;
  377. flex-direction: column;
  378. justify-content: center;
  379. align-items: center;
  380. font-size: 22rpx;
  381. font-weight: 500;
  382. color: #4A2723;
  383. }
  384. .sy-icon {
  385. width: 90rpx;
  386. height: 90rpx;
  387. margin-bottom: 15rpx;
  388. }
  389. .jt {
  390. flex-shrink: 0;
  391. width: 14rpx;
  392. height: 15rpx;
  393. margin-top: 40rpx;
  394. align-self: flex-start;
  395. }
  396. }
  397. }
  398. </style>