index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. <template>
  2. <view class="main">
  3. <navbar :config="config" backColor="#666"></navbar>
  4. <view class="swiper">
  5. <view class="uni-margin-wrap">
  6. <swiper class="swiper" :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000"
  7. circular=false>
  8. <swiper-item v-for="item in bannerList" :key="item.id">
  9. <view class="swiper-item" @click="
  10. imgLink(item.model_type, item.model_id, item.url, item.shop_id)
  11. ">
  12. <image class="cover" :src="item.cover" mode="aspectFill"></image>
  13. </view>
  14. </swiper-item>
  15. </swiper>
  16. </view>
  17. </view>
  18. <image @click="goAboutMe()" class="cover2" src="/static/publicWelfareZone/cover2.png"></image>
  19. <view v-if="list.length>0">
  20. <view class="block" v-if="list.length>0">
  21. <image class="img" src="/static/publicWelfareZone/block1.png"></image>
  22. <view class="desc">
  23. <view class="title">{{list[0].title}}</view>
  24. <view class="tip">{{list[0].intro}}</view>
  25. </view>
  26. </view>
  27. <view class="block" v-if="list.length>1">
  28. <view class="desc">
  29. <view class="title">{{list[1].title}}</view>
  30. <view class="tip">{{list[1].intro}}</view>
  31. </view>
  32. <image class="img" src="/static/publicWelfareZone/block2.png"></image>
  33. </view>
  34. <view class="block" v-if="list.length>2">
  35. <image class="img" src="/static/publicWelfareZone/block3.png"></image>
  36. <view class="desc">
  37. <view class="title">{{list[2].title}}</view>
  38. <view class="tip">{{list[2].intro}}</view>
  39. </view>
  40. </view>
  41. </view>
  42. <image class="cover3" src="/static/publicWelfareZone/cover3.png"></image>
  43. <view class="moudle-title">公益记录</view>
  44. <donation-news :listData="historyList"></donation-news>
  45. <view class="seat"></view>
  46. <view class="bottom-box">
  47. <button @click="goPhone()">
  48. <text class="iconfont2">&#xe638;</text>
  49. 电话咨询
  50. </button>
  51. </view>
  52. </view>
  53. </template>
  54. <script>
  55. export default {
  56. data() {
  57. return {
  58. config: {
  59. back: true,
  60. title: '关于绿马助残公益基金',
  61. color: '#1a1a1a',
  62. backgroundColor: [1, '#fff'],
  63. statusBarFontColor: 'black'
  64. },
  65. bannerList: [],
  66. list: [],
  67. historyList: []
  68. }
  69. },
  70. onLoad() {
  71. this.getBanner();
  72. this.getList();
  73. this.getList2();
  74. },
  75. onPullDownRefresh() {
  76. this.getBanner();
  77. this.getList();
  78. this.getList2();
  79. uni.stopPullDownRefresh();
  80. },
  81. methods: {
  82. getBanner() {
  83. this.$http.get(`/ad/ad/getShopAdByAdL/0/publicwelfarezone-banner`, {}, false)
  84. .then((res) => {
  85. this.loading = false;
  86. if (res && res.code == 200) {
  87. this.bannerList = res.list;
  88. }
  89. })
  90. },
  91. goAboutMe(){
  92. uni.navigateTo({
  93. url: '/pages/protocol/index?code=about-us'
  94. })
  95. },
  96. getList(){
  97. this.$http.get('/about/us/list',{limit: 3})
  98. .then(res => {
  99. if(res.code==200){
  100. this.list = res.list
  101. }
  102. })
  103. },
  104. getList2() {
  105. let that = this;
  106. this.$http.get('/donation/msg/list',{
  107. limit: 6,
  108. type: 0 //0 捐赠类型
  109. })
  110. .then(res=>{
  111. if (res.code == 200) {
  112. that.historyList = res.list;
  113. }
  114. })
  115. },
  116. goPhone(){
  117. this.$http.get('/system/info/info', {}).then(res => {
  118. if (res && res.code == 200) {
  119. if(res.data.hotline){
  120. uni.makePhoneCall({
  121. phoneNumber: res.data.hotline
  122. });
  123. }
  124. }})
  125. },
  126. /**轮播图跳转 */
  127. imgLink(type, id, url, shopid) {
  128. if (type == "goods") {
  129. uni.navigateTo({
  130. url: "/pages/product/goods/goods?id=" + id + "&shopid=" + shopid,
  131. });
  132. } else if (type == "service") {
  133. // uni.navigateTo({
  134. // url: "/pages/product/goods/serviceGood?id=" + id
  135. // });
  136. } else if (type == "point_goods") {
  137. // uni.navigateTo({
  138. // url: "/pages/product/goods/IntegralGood?id=" + id
  139. // });
  140. } else if (type == "url") {
  141. if(/^http/.test(url)){
  142. uni.navigateTo({
  143. url: "/pages/index/webView?linkUrl=" + url,
  144. });
  145. }else{
  146. uni.navigateTo({
  147. url
  148. });
  149. }
  150. }
  151. }
  152. }
  153. };
  154. </script>
  155. <style lang="scss" scoped>
  156. .main{
  157. .cover{
  158. width: 100%;
  159. height: 450rpx;
  160. }
  161. .cover2{
  162. display: block;
  163. width: 690rpx;
  164. height: 156rpx;
  165. margin: 40rpx auto;
  166. }
  167. .block{
  168. width: 690rpx;
  169. margin: 0 auto;
  170. box-sizing: border-box;
  171. padding: 50rpx 50rpx;
  172. display: flex;
  173. align-items: center;
  174. justify-content: space-between;
  175. border-radius: 16rpx;
  176. &:nth-child(2){
  177. background-color: #20a634;
  178. color: white;
  179. .desc{
  180. .tip{
  181. color: white;
  182. }
  183. }
  184. }
  185. .img{
  186. width: 120rpx;
  187. height: 120rpx;
  188. }
  189. .desc{
  190. width: 350rpx;
  191. .title{
  192. font-size: 38rpx;
  193. font-family: PingFang SC, PingFang SC-Bold;
  194. font-weight: 700;
  195. text-align: left;
  196. margin-bottom: 16rpx;
  197. }
  198. .tip{
  199. font-size: 28rpx;
  200. font-family: PingFang SC, PingFang SC-Regular;
  201. font-weight: 400;
  202. text-align: left;
  203. color: #999999;
  204. }
  205. }
  206. }
  207. .cover3{
  208. width: 690rpx;
  209. height: 472rpx;
  210. margin: 40rpx 30rpx;
  211. background-color: #f2f2f2;
  212. border-radius: 16rpx;
  213. }
  214. .moudle-title{
  215. font-size: 36rpx;
  216. font-family: PingFang SC, PingFang SC-Bold;
  217. font-weight: 700;
  218. color: #1a1a1a;
  219. margin: 0 0 26rpx 30rpx;
  220. }
  221. .seat{
  222. height: 148rpx;
  223. width: 100%;
  224. padding-bottom: constant(safe-area-inset-bottom);
  225. padding-bottom: env(safe-area-inset-bottom);
  226. }
  227. .bottom-box {
  228. position: fixed;
  229. left: 0;
  230. bottom: 0;
  231. z-index: 100;
  232. display: flex;
  233. align-items: center;
  234. padding: 30rpx;
  235. box-sizing: border-box;
  236. width: 100%;
  237. height: 148rpx;
  238. padding: 0 30rpx 0 36rpx;
  239. padding-bottom: constant(safe-area-inset-bottom);
  240. padding-bottom: env(safe-area-inset-bottom);
  241. background-color: white;
  242. border-top: 1px solid #f5f5f5;
  243. button{
  244. width: 690rpx;
  245. height: 80rpx;
  246. border-radius: 40rpx;
  247. text-align: center;
  248. padding: 0 30rpx;
  249. font-size: 32rpx;
  250. font-family: PingFang SC, PingFang SC-Regular;
  251. font-weight: 400;
  252. text-align: center;
  253. color: #ffffff;
  254. line-height: 80rpx;
  255. background-color: #0b844a;
  256. color: white;
  257. .iconfont2{
  258. font-size: 35rpx;
  259. margin-right: 15rpx;
  260. }
  261. }
  262. }
  263. }
  264. </style>