myFu.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. <template>
  2. <view class="content">
  3. <view class="navbar">
  4. <view v-for="(item, index) in navList" :key="index" class="nav-item" :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
  5. </view>
  6. <swiper :current="tabCurrentIndex" class="swiper-box" duration="300" @change="changeTab">
  7. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  8. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
  9. <!-- 空白页 -->
  10. <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
  11. <!-- 订单列表 -->
  12. <view class="fu-box" v-for="(item, index) in tabItem.orderList" :key='index' @click="toDetail(item)" v-if="item.info.title">
  13. <image class="fu-img" :src="baseURL + item.info.userimage" mode="aspectFill"></image>
  14. <view class="fu-right">
  15. <view>
  16. <view class="fu-tit">{{ item.info.title }}</view>
  17. <view class="fu-text">{{ item.info.info }}</view>
  18. </view>
  19. <view class="fu-bottom" v-if="tabCurrentIndex == 2 && item.info && item.info.title">
  20. <!-- <text class="fu-jifen">+{{ item.info.integral }}积分</text> -->
  21. <!-- <view class="fu-sczl" v-if="!item.remark" @click.stop="upInfo(item.hid)">上传资料</view> -->
  22. <view class="fu-shenqing" v-if="item.status == 3">公示中</view>
  23. </view>
  24. <view class="fu-bottom" v-if="tabCurrentIndex == 3 && item.info && item.info.title">
  25. <!-- <text class="fu-jifen">+{{ item.info.integral }}积分</text> -->
  26. <!-- <view class="fu-sczl" @click.stop="upInfo(item.hid, 1)">修改资料</view> -->
  27. </view>
  28. <view class="fu-bottom" v-if="tabCurrentIndex !== 2 && tabCurrentIndex !== 3 && tabCurrentIndex !== 4 && item.info && item.info.title ">
  29. <view class="fu-shenqing">已有{{ item.info.apply_sum }}人申请</view>
  30. <!-- <text class="fu-jifen">+{{ item.info.integral }}积分</text> -->
  31. </view>
  32. <view class="fu-bottom" v-if="tabCurrentIndex == 4 && item.info && item.info.title ">
  33. <view class="fu-shenqing"></view>
  34. <text class="fu-yjs">已结束</text>
  35. </view>
  36. <view class="fu-bottom" v-if="item.info && !item.info.title ">
  37. <view class="fu-shenqing"></view>
  38. <text class="fu-yjs">该项目已删除</text>
  39. </view>
  40. </view>
  41. </view>
  42. <uni-load-more :status="tabItem.loadingType"></uni-load-more>
  43. </scroll-view>
  44. </swiper-item>
  45. </swiper>
  46. </view>
  47. </template>
  48. <script>
  49. import { my_enroll } from '@/api/applyHelp.js';
  50. import { userapplylst } from '@/api/help.js'
  51. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  52. import empty from '@/components/empty';
  53. import {
  54. mapState,
  55. mapMutations
  56. } from 'vuex';
  57. export default {
  58. components: {
  59. uniLoadMore,
  60. empty
  61. },
  62. computed: {
  63. ...mapState(['baseURL'])
  64. },
  65. data() {
  66. return {
  67. tabCurrentIndex: 0,
  68. navList: [
  69. {
  70. state: 0,
  71. text: '审核中',
  72. loadingType: 'more',
  73. orderList: [],
  74. page: 1, //当前页数
  75. limit: 10 //每次信息条数
  76. },
  77. {
  78. state: -1,
  79. text: '已拒绝',
  80. loadingType: 'more',
  81. orderList: [],
  82. page: 1, //当前页数
  83. limit: 10 //每次信息条数
  84. },
  85. {
  86. state: 1,
  87. text: '已通过',
  88. loadingType: 'more',
  89. orderList: [],
  90. page: 1, //当前页数
  91. limit: 10 //每次信息条数
  92. },
  93. // {
  94. // state: 5,
  95. // text: '公示中',
  96. // loadingType: 'more',
  97. // orderList: [],
  98. // page: 1, //当前页数
  99. // limit: 10 //每次信息条数
  100. // },
  101. // {
  102. // state: 4,
  103. // text: '已结束',
  104. // loadingType: 'more',
  105. // orderList: [],
  106. // page: 1, //当前页数
  107. // limit: 10 //每次信息条数
  108. // },
  109. ],
  110. }
  111. },
  112. onLoad() {
  113. },
  114. onShow() {
  115. if (this.tabCurrentIndex == 0) {
  116. let index = this.tabCurrentIndex;
  117. this.navList[index].page = 1;
  118. this.navList[index].orderList = [];
  119. this.navList[index].loadingType = 'more';
  120. this.loadData();
  121. }
  122. },
  123. methods: {
  124. //swiper 切换
  125. changeTab(e) {
  126. this.tabCurrentIndex = e.target.current;
  127. this.loadData('tabChange');
  128. },
  129. //顶部tab点击
  130. tabClick(index) {
  131. this.tabCurrentIndex = index;
  132. },
  133. loadData(source) {
  134. console.log(getApp(),'getapp')
  135. let index = this.tabCurrentIndex;
  136. let navItem = this.navList[index];
  137. let state = navItem.state;
  138. if (source === 'tabChange' && navItem.loaded === true) {
  139. //tab切换只有第一次需要加载数据
  140. return;
  141. }
  142. if (navItem.loadingType === 'noMore') {
  143. //防止重复加载
  144. return;
  145. }
  146. // 修改当前对象状态为加载中
  147. navItem.loadingType = 'loading';
  148. userapplylst({
  149. page: navItem.page,
  150. limit:navItem.limit,
  151. status: state,
  152. }).then(res => {
  153. // navItem.orderList = navItem.orderList.concat(res.data.filter(word => !!word.info.title));
  154. navItem.orderList = navItem.orderList.concat(res.data);
  155. navItem.page++;
  156. if (navItem.limit == res.data.length) {
  157. //判断是否还有数据, 有改为 more, 没有改为noMore
  158. navItem.loadingType = 'more';
  159. return;
  160. } else {
  161. //判断是否还有数据, 有改为 more, 没有改为noMore
  162. navItem.loadingType = 'noMore';
  163. }
  164. this.$set(navItem, 'loaded', true);
  165. }).catch(err => {
  166. console.log(err);
  167. });
  168. },
  169. // 上传资料
  170. upInfo(id, type) {
  171. let url = '/pages/fu/upLoadInfo?id=' + id;
  172. if (type) {
  173. url += '&type=' + type
  174. }
  175. uni.navigateTo({
  176. url: url
  177. })
  178. },
  179. // 跳转详情
  180. toDetail(item) {
  181. uni.navigateTo({
  182. url: '/pages/fu/fuInfo?id=' + item.help_id
  183. })
  184. // if (item.remark) {
  185. // uni.navigateTo({
  186. // url: '/pages/fu/helpDetail?id=' + item.id
  187. // })
  188. // } else {
  189. // uni.navigateTo({
  190. // url: '/pages/fu/fuInfo?id=' + item.id
  191. // })
  192. // }
  193. }
  194. }
  195. }
  196. </script>
  197. <style lang="scss">
  198. page {
  199. height: 100%;
  200. background: #F4F5F4;
  201. }
  202. .content {
  203. height: 100%;
  204. .navbar {
  205. display: flex;
  206. height: 40px;
  207. padding: 0 5px;
  208. background: #fff;
  209. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  210. position: relative;
  211. z-index: 10;
  212. .nav-item {
  213. flex: 1;
  214. display: flex;
  215. justify-content: center;
  216. align-items: center;
  217. height: 100%;
  218. font-size: 15px;
  219. color: $font-color-dark;
  220. position: relative;
  221. &.current {
  222. color: $motif-color;
  223. &:after {
  224. content: '';
  225. position: absolute;
  226. left: 50%;
  227. bottom: 0;
  228. transform: translateX(-50%);
  229. width: 44px;
  230. height: 0;
  231. border-bottom: 2px solid $motif-color;
  232. }
  233. }
  234. }
  235. }
  236. .swiper-box {
  237. height: calc(100% - 40px);
  238. padding: 20rpx 30rpx;
  239. }
  240. .list-scroll-content {
  241. height: 100%;
  242. }
  243. .fu-box {
  244. padding: 14rpx 20rpx 28rpx 20rpx;
  245. background: #FFFFFF;
  246. box-shadow: 0px 0px 40rpx 0px rgba(0, 0, 0, 0.06);
  247. border-radius: 12rpx;
  248. display: flex;
  249. align-items: center;
  250. margin-bottom: 20rpx;
  251. .fu-img {
  252. width: 220rpx;
  253. height: 182rpx;
  254. border-radius: 8rpx;
  255. }
  256. .fu-right {
  257. margin-left: 20rpx;
  258. width: 62%;
  259. .fu-tit {
  260. overflow: hidden;
  261. text-overflow: ellipsis;
  262. white-space: nowrap;
  263. font-size: 36rpx;
  264. font-family: PingFang SC;
  265. font-weight: 500;
  266. color: #222222;
  267. }
  268. .fu-text {
  269. margin-top: 17rpx;
  270. overflow : hidden;
  271. text-overflow: ellipsis;
  272. display: -webkit-box;
  273. -webkit-line-clamp: 2;
  274. -webkit-box-orient: vertical;
  275. font-size: $font-sm;
  276. font-family: PingFang SC;
  277. font-weight: 500;
  278. color: #666666;
  279. }
  280. .fu-bottom {
  281. margin-top: 20rpx;
  282. display: flex;
  283. align-items: center;
  284. justify-content: space-between;
  285. .fu-shenqing {
  286. font-size: 21rpx;
  287. font-family: PingFang;
  288. font-weight: 500;
  289. color: #FF727E;
  290. }
  291. .fu-jifen {
  292. padding: 0 5rpx;
  293. border: 1px solid #FF0000;
  294. border-radius: 5rpx;
  295. font-size: 21rpx;
  296. font-family: PingFang SC;
  297. font-weight: 500;
  298. color: #FF0000;
  299. }
  300. .fu-yjs {
  301. font-size: 21rpx;
  302. font-family: PingFang;
  303. font-weight: 500;
  304. color: #999999;
  305. }
  306. .fu-sczl {
  307. padding: 5rpx 17rpx;
  308. font-size: 21rpx;
  309. font-family: PingFang SC;
  310. font-weight: 500;
  311. color: #FFFFFF;
  312. background: #FF727E;
  313. border-radius: 23rpx;
  314. }
  315. }
  316. }
  317. }
  318. }
  319. </style>