helpDetail.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. <template>
  2. <view class="container">
  3. <view class="swiper">
  4. <view class="swiper-box">
  5. <swiper circular="true" autoplay="true" @change="swiperChange">
  6. <swiper-item v-for="swiper in banner" :key="swiper"><image :src="baseURL + swiper"></image></swiper-item>
  7. </swiper>
  8. <view class="indicator"><view class="dots" v-for="(swiper, index) in banner" :class="[swiperCurrent >= index ? 'on' : '']" :key="index"></view></view>
  9. </view>
  10. </view>
  11. <view class="info-item">
  12. <view class="flex_item">
  13. <view class="list-tip">{{list.cname}}</view>
  14. <view class="info-title clamp">{{list.title}}</view>
  15. </view>
  16. <view class="info-tip">{{list.info}}</view>
  17. <view class="info-number">
  18. <view>资金:{{ list.amount || 0 }}</view>
  19. <view>帮扶人:{{ '' }}</view>
  20. </view>
  21. </view>
  22. <view class="introduce-item">
  23. <view class="introduce-title ellipsis">项目介绍</view>
  24. <view class="introduce-info">
  25. <rich-text :nodes="list.content"></rich-text>
  26. </view>
  27. </view>
  28. <view class="introduce-item" v-if="list.arr">
  29. <view class="introduce-title ellipsis">帮扶详情</view>
  30. <view class="introduce-info">
  31. <view>{{ list.arr.info1.remark }}</view>
  32. <view class="img-box">
  33. <image class="img-info" v-for="item in imgList" :src="item" mode="widthFix"></image>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  41. import { one_detail, enroll } from '@/api/applyHelp.js';
  42. import { timeComputed } from '@/utils/rocessor.js';
  43. import { getHelpDetail } from '@/api/help.js'
  44. import {
  45. mapState,
  46. mapMutations
  47. } from 'vuex';
  48. import uniCountdown from '@/components/uni-countdown/uni-countdown.vue';
  49. export default {
  50. components: {
  51. uniPopup,
  52. uniCountdown
  53. },
  54. data() {
  55. return {
  56. id:'',
  57. list: {},
  58. description:'',
  59. swiperCurrent: 0, //轮播图
  60. swiperHeight: 300,
  61. banner:[],//轮播图
  62. startday:0,
  63. starthour:0,//距离今天开始时间
  64. startminute:0,
  65. startsecond:0,
  66. endTime:'',//结束时间
  67. starting: false, //判断活动是否结束
  68. imgList: [], // 图片
  69. };
  70. },
  71. onLoad(option) {
  72. this.id = option.id;
  73. this.loadData();
  74. },
  75. computed: {
  76. ...mapState(['baseURL'])
  77. },
  78. methods: {
  79. loadData(){
  80. let obj = this;
  81. getHelpDetail({
  82. // id: obj.id
  83. },obj.id).then(data => {
  84. obj.list = data.data;
  85. console.log(data.data)
  86. // if (data.data.arr.info1.img) {
  87. // obj.imgList = data.data.arr.info1.img.split(';'); // 上传资料图片
  88. // }
  89. obj.banner = data.data.userimages.split(',');
  90. // if (obj.list.description) {
  91. // obj.description = obj.list.description.replace(/\<img/gi, '<img class="rich-img"');
  92. // } //小程序商品详情图超出屏幕问题
  93. // let time = data.data.endActivityTime;
  94. // this.endTime = time*1000;
  95. // obj.StartDate();
  96. })
  97. },
  98. StartDate() {
  99. let obj = this;
  100. // 获取当前时间
  101. let now = new Date();
  102. let year = now.getFullYear(); //得到年份
  103. let month = now.getMonth(); //得到月份
  104. let date = now.getDate(); //得到日期
  105. let hour = now.getHours(); //得到小时
  106. let minu = now.getMinutes(); //得到分钟
  107. let sec = now.getSeconds(); //得到秒
  108. //获取现在时间的时间戳
  109. let time = new Date(year, month, date, hour, minu, sec);
  110. let nowTime = time.getTime();
  111. if (nowTime < obj.endTime) {
  112. console.log(nowTime,obj.endTime)
  113. console.log('现在时间小于活动时间,活动进行中');
  114. obj.starting = true;
  115. let starTime = obj.endTime - nowTime;
  116. console.log(starTime,'starTime')
  117. let day = Math.floor(starTime / 1000 / 60 / 60 / 24); //获取剩余天数
  118. let hours = Math.floor((starTime / 1000 / 60 / 60) % 24); //获取剩余小时数
  119. let minutes = Math.floor((starTime / 1000 / 60) % 60); //获取分钟
  120. let seconds = Math.floor((starTime / 1000) % 60); //获取秒数
  121. obj.startday = day;
  122. obj.starthour = hours;
  123. obj.startminute = minutes;
  124. obj.startsecond = seconds;
  125. console.log('时间差是: '+ obj.startday + '天, ' + obj.starthour + '小时, ' + obj.startminute + '分钟, ' + obj.startsecond + '秒', '距离活动结束还剩多少时间');
  126. }else{
  127. obj.starting = false;
  128. }
  129. },
  130. //轮播图
  131. swiperChange(e) {
  132. const index = e.detail.current;
  133. this.swiperCurrent = index;
  134. },
  135. // 申请援助
  136. shenqing() {
  137. this.$refs.popup.open()
  138. },
  139. // 关闭弹窗
  140. close() {
  141. this.$refs.popup.close()
  142. },
  143. // 确认
  144. corfim() {
  145. enroll({
  146. hid: this.id,
  147. }).then(res => {
  148. this.close();
  149. this.$api.msg('申请成功');
  150. this.loadData();
  151. })
  152. }
  153. }
  154. }
  155. </script>
  156. <style lang="scss">
  157. page {
  158. background: #F5F5F5;
  159. .container{
  160. height: 100%;
  161. padding-bottom: 180rpx;
  162. }
  163. }
  164. .rich-img {
  165. width: 100% !important;
  166. height: auto;
  167. }
  168. //轮播图
  169. .swiper {
  170. width: 100%;
  171. display: flex;
  172. justify-content: center;
  173. .swiper-box {
  174. width: 100%;
  175. height:650rpx;
  176. overflow: hidden;
  177. // box-shadow: 0upx 8upx 25upx rgba(0, 0, 0, 0.2);
  178. //兼容ios,微信小程序
  179. position: relative;
  180. z-index: 1;
  181. swiper {
  182. width: 100%;
  183. height: 100%;
  184. swiper-item {
  185. image {
  186. width: 100%;
  187. height: 100%;
  188. }
  189. }
  190. }
  191. .indicator {
  192. position: absolute;
  193. bottom: 20upx;
  194. left: 20upx;
  195. background-color: rgba(255, 255, 255, 0.4);
  196. width: 150upx;
  197. height: 5upx;
  198. border-radius: 3upx;
  199. overflow: hidden;
  200. display: flex;
  201. .dots {
  202. width: 0upx;
  203. background-color: rgba(255, 255, 255, 1);
  204. transition: all 0.3s ease-out;
  205. &.on {
  206. width: (100%/3);
  207. }
  208. }
  209. }
  210. }
  211. }
  212. .info-item{
  213. background-color: #FFFFFF;
  214. padding: 45rpx 25rpx;
  215. .list-tip{
  216. background-color: $motif-color;
  217. color: #FFFFFF;
  218. border-radius:8rpx;
  219. padding: 5rpx 12rpx;
  220. padding-bottom: 8rpx !important;
  221. margin-right: 15rpx;
  222. text-align: center;
  223. font-size: 24rpx;
  224. }
  225. .info-title{
  226. max-width: 75%;
  227. font-size:36rpx;
  228. font-weight:500;
  229. color:rgba(34,34,34,1);
  230. }
  231. .info-tip{
  232. font-weight:400;
  233. color:rgba(102,102,102,1);
  234. font-size: 28rpx;
  235. padding: 15rpx 0rpx;
  236. }
  237. .info-number{
  238. padding-top: 25rpx;
  239. color: #EF3D28;
  240. font-size: 24rpx;
  241. font-weight: normal;
  242. display: flex;
  243. align-items: center;
  244. justify-content: space-between;
  245. .name-text{
  246. color: #666666;
  247. }
  248. .starting{
  249. font-size: 32rpx;
  250. font-weight: bold;
  251. }
  252. }
  253. }
  254. .introduce-item{
  255. background-color: #FFFFFF;
  256. padding: 45rpx 25rpx;
  257. margin-top: 25rpx;
  258. .introduce-title{
  259. padding-bottom: 40rpx;
  260. font-size: 36rpx;
  261. font-family: PingFang;
  262. font-weight: 500;
  263. color: #222222;
  264. }
  265. .introduce-info{
  266. font-size: 28rpx;
  267. font-weight: 500;
  268. color: #222222;
  269. }
  270. .img-box {
  271. width: 100%;
  272. }
  273. .img-info {
  274. width: 100%;
  275. display: block;
  276. margin-top: 30rpx;
  277. }
  278. }
  279. .static{
  280. padding: 0rpx !important;
  281. width: 70%;
  282. padding-left:25rpx !important;
  283. }
  284. .submit{
  285. position:fixed;
  286. bottom: 0rpx;
  287. width: 100%;
  288. color: #FFFFFF;
  289. text-align: center;
  290. background-color: #FFFFFF;
  291. padding: 50rpx 0rpx;
  292. font-size: $font-lg;
  293. text{
  294. padding: 25rpx 180rpx;
  295. // background:rgba(223,36,18,1);
  296. background: $motif-color;
  297. border-radius:50rpx;
  298. }
  299. }
  300. .yijieshu {
  301. text{
  302. background: #999999;
  303. }
  304. }
  305. .red{
  306. text{
  307. padding: 25rpx 180rpx;
  308. background:rgba(223,36,18,0.6);
  309. border-radius:50rpx;
  310. }
  311. }
  312. .pop-box {
  313. .pop-img {
  314. width: 542rpx;
  315. height: 280rpx;
  316. display: block;
  317. }
  318. .pop-frame {
  319. margin: 0 16rpx;
  320. padding: 35rpx 40rpx;
  321. background: #FFFFFF;
  322. box-shadow: 0px 5rpx 20rpx 0px rgba(0, 0, 0, 0.1);
  323. border-radius: 0 0 10rpx 10rpx;
  324. .pop-text {
  325. margin-top: 30rpx;
  326. font-size: 36rpx;
  327. font-family: PingFang SC;
  328. font-weight: 500;
  329. color: #333C4C;
  330. line-height: 40rpx;
  331. text-align: center;
  332. }
  333. .pop-btnBox {
  334. margin-top: 78rpx;
  335. display: flex;
  336. align-items: center;
  337. justify-content: space-between;
  338. .pop-btn {
  339. width: 199rpx;
  340. height: 78rpx;
  341. border: 1px solid #FF727E;
  342. border-radius: 10rpx;
  343. font-size: 32rpx;
  344. font-family: PingFang SC;
  345. font-weight: 500;
  346. color: #FF727E;
  347. display: flex;
  348. align-items: center;
  349. justify-content: center;
  350. }
  351. .queren {
  352. background: #FF727E;
  353. color: #FFFFFF;
  354. }
  355. }
  356. }
  357. }
  358. </style>