index.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <view class="content">
  3. <!-- 轮播 -->
  4. <view class="carousel-section">
  5. <swiper class="carousel" :autoplay="true" :interval="3000" :duration="1000">
  6. <swiper-item v-for="item in carouselList" :key="item.id">
  7. <image :src="baseURL + item.image"></image>
  8. </swiper-item>
  9. </swiper>
  10. </view>
  11. <!-- 分类 -->
  12. <view class="cate-section flex">
  13. <view class="cate-item flex" @click="navTo('/pages/index/aixin')">
  14. <view class="img-wrapper flex">
  15. <image src="../../static/index/index_icon_1.png" mode="" class="img"></image>
  16. </view>
  17. <view class="item-title clamp2">爱心捐款</view>
  18. </view>
  19. <view class="cate-item flex" @click="navTo('/pages/form/applicationForm')" >
  20. <view class="img-wrapper flex">
  21. <image src="../../static/index/index_icon_2.png" mode="" class="img" style="width: 110rpx;"></image>
  22. </view>
  23. <view class="item-title clamp2">遗体器官捐献</view>
  24. </view>
  25. <view class="cate-item flex" @click="navTo('/pages/applic/appliSystem')">
  26. <view class="img-wrapper flex">
  27. <image src="../../static/index/index_icon_3.png" mode="" class="img"></image>
  28. </view>
  29. <view class="item-title clamp2">造血干细胞捐献</view>
  30. </view>
  31. <view class="cate-item flex" @click="navTo('/pages/applic/info?id=337')">
  32. <view class="img-wrapper flex">
  33. <image src="../../static/index/index_icon_4.png" mode="" class="img"></image>
  34. </view>
  35. <view class="item-title clamp2">志愿者报名</view>
  36. </view>
  37. <view class="cate-item flex" @click="navTo('/pages/applic/info?id=337')">
  38. <view class="img-wrapper flex">
  39. <image src="../../static/index/index_icon_5.png" mode="" class="img"></image>
  40. </view>
  41. <view class="item-title clamp2">会员登记</view>
  42. </view>
  43. <view class="cate-item flex" @click="navTo('/pages/train/index')">
  44. <view class="img-wrapper flex">
  45. <image src="../../static/index/index_icon_6.png" mode="" class="img"></image>
  46. </view>
  47. <view class="item-title clamp2">普及培训报名</view>
  48. </view>
  49. <!-- <view class="cate-item flex" @click="tohelpActi3">
  50. <view class="img-wrapper flex">
  51. <image src="../../static/index/index08.png" mode="" class="img"></image>
  52. </view>
  53. <view class="item-title">AED智能系统</view>
  54. <image src="../../static/index/in8.png" mode=""></image>
  55. </view> -->
  56. <view class="cate-item flex" @click="navTo('/pages/applic/itemred')">
  57. <view class="img-wrapper flex">
  58. <image src="../../static/index/index_icon_7.png" mode="" class="img"></image>
  59. </view>
  60. <view class="item-title clamp2">红十字会基层组织</view>
  61. </view>
  62. <view class="cate-item flex" @click="navTo('/pages/applic/aid')">
  63. <view class="img-wrapper flex">
  64. <image src="../../static/index/index_icon_8.png" mode="" class="img"></image>
  65. </view>
  66. <view class="item-title clamp2">救护站智能系统</view>
  67. </view>
  68. <view class="cate-item flex" @click="navTo('/pages/applic/location')">
  69. <view class="img-wrapper flex">
  70. <image src="../../static/index/index_icon_9.png" mode="" class="img"></image>
  71. </view>
  72. <view class="item-title clamp2">救在身边</view>
  73. </view>
  74. <view class="cate-item flex" @click="navTo('/pages/share/card')">
  75. <view class="img-wrapper flex">
  76. <image src="../../static/index/index_icon_10.png" mode="" class="img"></image>
  77. </view>
  78. <view class="item-title clamp2">电子名片</view>
  79. </view>
  80. </view>
  81. </view>
  82. </template>
  83. <script>
  84. import {
  85. loadIndexs
  86. } from '@/api/index.js';
  87. import {
  88. saveUrl,
  89. interceptor
  90. } from '@/utils/loginUtils.js';
  91. import {
  92. mapState,
  93. mapMutations
  94. } from 'vuex';
  95. export default {
  96. data() {
  97. return {
  98. carouselList: [], //轮播
  99. };
  100. },
  101. onShow() {
  102. saveUrl();
  103. // let token = uni.getStorageSync('token');
  104. console.log(11, this);
  105. if (!this.hasLogin) {
  106. // 登录拦截
  107. // interceptor();
  108. uni.showModal({
  109. title: '登录',
  110. content: '您未登录,是否马上登陆?',
  111. success: e => {
  112. if (e.confirm) {
  113. interceptor();
  114. }
  115. },
  116. fail: e => {
  117. console.log(e);
  118. }
  119. });
  120. } else {
  121. // this.loadData();
  122. }
  123. },
  124. onLoad() {
  125. this.loadIndex()
  126. saveUrl();
  127. },
  128. computed: {
  129. ...mapState('user', [ 'hasLogin']),
  130. ...mapState(['baseURL']),
  131. },
  132. // 下拉加载
  133. // onReachBottom() {
  134. // this.loadData();
  135. // },
  136. methods: {
  137. loadIndex() {
  138. loadIndexs({}).then(({
  139. data
  140. }) => {
  141. console.log(data, 'index')
  142. this.carouselList = data.banner; //轮播图
  143. });
  144. },
  145. tohelpActi3() {
  146. uni.navigateTo({
  147. url: '../applic/aed'
  148. })
  149. },
  150. navTo(url) {
  151. uni.navigateTo({
  152. url
  153. });
  154. }
  155. }
  156. };
  157. </script>
  158. <style lang="scss">
  159. a {
  160. text-decoration: none;
  161. color: #5f5f5f;
  162. }
  163. .content {
  164. // line-height: 1;
  165. background-color: #ffabab;
  166. // padding-bottom: 60rpx;
  167. }
  168. .content {
  169. background-color: #f8f6f9;
  170. height: 100%;
  171. /* 头部 轮播图 */
  172. .carousel-section {
  173. // padding-top: 10px;
  174. overflow: hidden;
  175. // background-color: #fff;
  176. .carousel {
  177. width: 744rpx;
  178. height: 470rpx;
  179. margin: 0 auto;
  180. border-radius: 20rpx;
  181. overflow: hidden;
  182. .carousel-item {
  183. width: 100%;
  184. height: 100%;
  185. // padding-left: 30rpx;
  186. // padding-right: 30rpx;
  187. overflow: hidden;
  188. }
  189. image {
  190. width: 100%;
  191. height: 470rpx;
  192. border-radius: 20rpx;
  193. }
  194. }
  195. }
  196. // 分类
  197. .cate-section {
  198. justify-content: space-between;
  199. flex-wrap: wrap;
  200. background-color: #f8f6f9;
  201. padding: 20rpx 30rpx 20rpx;
  202. height: 100%;
  203. font-family: PingFang SC;
  204. .cate-item {
  205. width: 335rpx;
  206. min-height: 190rpx;
  207. background: #FFFFFF;
  208. box-shadow: 0 0 20rpx 0 rgba(50, 50, 52, 0.06);
  209. border-radius: 20rpx;
  210. flex-direction: column;
  211. text-align: center;
  212. align-items: center;
  213. justify-content: center;
  214. margin-bottom: 20rpx;
  215. .img-wrapper {
  216. padding-top: 20rpx;
  217. .img {
  218. width: 102rpx;
  219. height: 102rpx;
  220. }
  221. }
  222. .item-title {
  223. margin-top: 6rpx;
  224. font-weight: bold;
  225. height:2rem;
  226. }
  227. }
  228. }
  229. }
  230. </style>