index.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  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">
  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. export default {
  104. data() {
  105. return {
  106. carouselList: [],//轮播图
  107. };
  108. },
  109. computed: {
  110. },
  111. // 切换或显示后变动tabbar颜色
  112. onHide() {
  113. },
  114. onLoad: function(option) {
  115. // #ifndef MP
  116. if (option.spread) {
  117. // 存储其他邀请人
  118. uni.setStorageSync('spread', option.spread);
  119. }
  120. // #endif
  121. // #ifdef MP
  122. if (option.scene) {
  123. // 存储小程序邀请人
  124. uni.setStorage({
  125. key: 'spread_code',
  126. data: option.scene
  127. });
  128. }
  129. // #endif
  130. },
  131. onShow() {
  132. },
  133. onReady() {
  134. },
  135. // #ifdef MP
  136. onShareAppMessage(options) {
  137. // 设置菜单中的转发按钮触发转发事件时的转发内容
  138. let pages = getCurrentPages(); //获取加载的页面
  139. let currentPage = pages[pages.length - 1]; //获取当前页面的对象
  140. let url = currentPage.route; //当前页面url
  141. let item = currentPage.options; //如果要获取url中所带的参数可以查看options
  142. let shareObj = {
  143. title: '租电', // 默认是小程序的名称(可以写slogan等)
  144. path: url, // 默认是当前页面,必须是以‘/’开头的完整路径
  145. imageUrl: '',
  146. desc:'',
  147. success: function(res) {
  148. // 转发成功之后的回调
  149. if (res.errMsg == 'shareAppMessage:ok') {}
  150. },
  151. fail: function() {
  152. // 转发失败之后的回调
  153. if (res.errMsg == 'shareAppMessage:fail cancel') {
  154. // 用户取消转发
  155. } else if (res.errMsg == 'shareAppMessage:fail') {
  156. // 转发失败,其中 detail message 为详细失败信息
  157. }
  158. }
  159. };
  160. // 判断是否可以邀请
  161. // if (this.userInfo.uid) {
  162. // shareObj.path += '&spread=' + this.userInfo.uid;
  163. // }
  164. return shareObj;
  165. },
  166. // #endif
  167. methods: {
  168. navTo(url) {
  169. if(url.indexOf('http') != -1 ) {
  170. window.location.href = url
  171. }else {
  172. uni.navigateTo({
  173. url,
  174. fail() {
  175. uni.switchTab({
  176. url
  177. })
  178. }
  179. })
  180. }
  181. },
  182. }
  183. };
  184. </script>
  185. <style lang="scss">
  186. page {
  187. background: #ffff;
  188. min-height: 100%;
  189. height: auto;
  190. }
  191. // 顶部搜索
  192. .top-search {
  193. height: 80rpx;
  194. padding: 0 20rpx;
  195. background-color: #fff;
  196. .top-logo {
  197. width: 50rpx;
  198. // height: 50rpx;
  199. margin-right: 10rpx;
  200. image {
  201. width: 48rpx;
  202. }
  203. }
  204. .search-box {
  205. justify-content: center;
  206. width: 698rpx;
  207. height: 60rpx;
  208. background: #EEEEEE;
  209. // box-shadow: 0px 10rpx 20rpx 0px rgba(4, 114, 69, 0.22);
  210. border-radius: 30rpx;
  211. .search {
  212. width: 34rpx;
  213. height: 34rpx;
  214. }
  215. .search-font {
  216. margin-left: 14rpx;
  217. font-size: 28rpx;
  218. font-family: PingFang SC;
  219. font-weight: 500;
  220. color: #CBCBCB;
  221. }
  222. }
  223. }
  224. // 顶部轮播图
  225. .top-swiper {
  226. width: 750rpx;
  227. height: 473rpx;
  228. // margin: 20rpx 0 0;
  229. image {
  230. width: 750rpx;
  231. height: 473rpx;
  232. }
  233. }
  234. .jg {
  235. height: 20rpx;
  236. background: #F8F8F8;
  237. }
  238. // 分类
  239. .cate-section {
  240. justify-content: space-around;
  241. background-color: #fff;
  242. padding: 0rpx 0 30rpx;
  243. .cate-item {
  244. flex-grow: 0;
  245. width: 20%;
  246. flex-direction: column;
  247. text-align: center;
  248. align-items: center;
  249. justify-content: center;
  250. .img-wrapper {
  251. width: 112rpx;
  252. height: 112rpx;
  253. border-radius: 20rpx;
  254. position: relative;
  255. image {
  256. width: 112rpx;
  257. height: 112rpx;
  258. position: absolute;
  259. left: 50%;
  260. top: 50%;
  261. transform: translate(-50%, -50%);
  262. }
  263. }
  264. .item-title {
  265. margin-top: 15rpx;
  266. font-size: 26rpx;
  267. font-weight: 500;
  268. color: #666666;
  269. }
  270. }
  271. }
  272. .rznow {
  273. font-weight: 500;
  274. font-size: 26rpx;
  275. color: #FFFFFF;
  276. background-color: #78797a;
  277. height: 74rpx;
  278. padding: 0 42rpx 0 52rpx;
  279. .rztit {
  280. line-height: 74rpx;
  281. }
  282. .rzbtn {
  283. width: 127rpx;
  284. height: 47rpx;
  285. text-align: center;
  286. line-height: 47rpx;
  287. background: #35d9b7;
  288. border-radius: 24rpx;
  289. font-size: 22rpx;
  290. }
  291. }
  292. .gn-wrap {
  293. margin: 45rpx auto;
  294. width: 670rpx;
  295. height: 219rpx;
  296. background: #FFFFFF;
  297. box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(50,50,52,0.06);
  298. border-radius: 30rpx;
  299. padding-right: 47rpx;
  300. .gn-icon {
  301. flex-shrink: 0;
  302. width: 210rpx;
  303. height: 100%;
  304. justify-content: center;
  305. image {
  306. height: 112rpx;
  307. }
  308. }
  309. .gn-tit {
  310. flex-grow: 1;
  311. font-weight: bold;
  312. color: #333333;
  313. font-size: 36rpx;
  314. flex-direction: column;
  315. justify-content: center;
  316. align-items: flex-start;
  317. .tit-jj {
  318. font-size: 25rpx;
  319. font-weight: 500;
  320. color: #666666;
  321. padding-top: 32rpx;
  322. }
  323. }
  324. .gn-btn {
  325. flex-shrink: 0;
  326. width: 127rpx;
  327. border: 1px solid $base-color;
  328. border-radius: 28rpx;
  329. font-size: 25rpx;
  330. font-weight: 500;
  331. color: $base-color;
  332. line-height: 55rpx;
  333. text-align: center;
  334. }
  335. }
  336. .fjmd {
  337. width: 708rpx;
  338. height: 233rpx;
  339. margin: 20rpx auto;
  340. image {
  341. width: 100%;
  342. height: 100%;
  343. }
  344. }
  345. .sygl {
  346. .sy-top {
  347. position: relative;
  348. height: 100rpx;
  349. image {
  350. width: 369rpx;
  351. height: 8rpx;
  352. position: absolute;
  353. top: 0;
  354. bottom: 0;
  355. left: 0;
  356. right: 0;
  357. margin: auto;
  358. }
  359. .top-tit {
  360. font-size: 32rpx;
  361. font-weight: bold;
  362. color: #4A2723;
  363. text-align: center;
  364. line-height: 100rpx;
  365. }
  366. }
  367. .sy-content {
  368. padding: 0 10rpx 65rpx ;
  369. .content-item {
  370. flex-grow: 1;
  371. flex-direction: column;
  372. justify-content: center;
  373. align-items: center;
  374. font-size: 22rpx;
  375. font-weight: 500;
  376. color: #4A2723;
  377. }
  378. .sy-icon {
  379. width: 90rpx;
  380. height: 90rpx;
  381. margin-bottom: 15rpx;
  382. }
  383. .jt {
  384. flex-shrink: 0;
  385. width: 14rpx;
  386. height: 15rpx;
  387. margin-top: 40rpx;
  388. align-self: flex-start;
  389. }
  390. }
  391. }
  392. </style>