index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. <script setup>
  2. import {
  3. ref
  4. } from 'vue';
  5. import {
  6. onLoad,
  7. onUnload,
  8. onPullDownRefresh,
  9. onReachBottom,
  10. onPageScroll
  11. } from "@dcloudio/uni-app";
  12. import {
  13. getFocusList,
  14. } from "@/api/work/focus.js";
  15. import {
  16. addFocus,
  17. cancelFocus
  18. } from "@/api/work/focus.js";
  19. let scrollTop = ref(0)
  20. let loading = ref(true)
  21. // 参数
  22. let searchInfo = ref({
  23. pageNo: 1,
  24. pageSize: 10,
  25. })
  26. // 触底加载flag
  27. let moreListFlag = true
  28. // 获取列表
  29. let projectList = ref([]);
  30. let listTotal = ref(0);
  31. // 折叠/展开
  32. const changeFoldItem = (status, id) => {
  33. let item = projectList.value.find(item => item.id === id);
  34. item.unfold = status;
  35. }
  36. function getList() {
  37. if (searchInfo.value.pageNo == 1) {
  38. loading.value = true
  39. }
  40. getFocusList(searchInfo.value).then(res => {
  41. loading.value = false
  42. projectList.value = projectList.value.concat(res.data.list);
  43. listTotal.value = res.data.total;
  44. if (res.data.total == searchInfo.value.pageNo * searchInfo.value.pageSize - (10 - res.data.list
  45. .length)) moreListFlag = false;
  46. }).catch(() => {
  47. loading.value = false
  48. })
  49. }
  50. function goToDetail(id, subName) {
  51. uni.navigateTo({
  52. url: `/pages/projectInfo/detail/index?id=${id}&subName=${subName}`
  53. })
  54. }
  55. function goToPage(url) {
  56. uni.navigateTo({
  57. url
  58. })
  59. }
  60. function goToReport(type, subId, subName) {
  61. if (type === 'wtdb') {
  62. uni.navigateTo({
  63. url: `/pages/problemSupervision/index?type=${type}&subId=${subId}&subName=${subName}`
  64. })
  65. } else if (type === 'qtldjbm') {
  66. uni.navigateTo({
  67. url: `/pages/leadersList/index?type=${type}&subId=${subId}&subName=${subName}`
  68. })
  69. } else if (type === 'xcyx') {
  70. uni.navigateTo({
  71. url: `/pages/projectImageAndVideo/index?type=${type}&subId=${subId}&subName=${subName}`
  72. })
  73. } else if (type === 'more') {
  74. uni.navigateTo({
  75. url: `/pages/morePage/index?type=${type}&subId=${subId}&subName=${subName}`
  76. })
  77. } else {
  78. uni.navigateTo({
  79. url: `/pages/projectInfo/report/index?type=${type}&subId=${subId}&subName=${subName}`
  80. })
  81. }
  82. }
  83. // 收藏/取消
  84. function changeFocus(id, status) {
  85. let item = projectList.value.find(item => item.id === id);
  86. if (status) {
  87. cancelFocus({
  88. subId: id
  89. }).then(res => {
  90. if (res.code === 200) {
  91. item.isAttention = 0;
  92. }
  93. }).catch(() => {
  94. uni.showToast({
  95. title: "更改收藏状态失败。",
  96. icon: "none",
  97. duration: 2000
  98. })
  99. })
  100. } else {
  101. addFocus({
  102. subId: id
  103. }).then(res => {
  104. if (res.code === 200) {
  105. item.isAttention = 1;
  106. }
  107. }).catch(() => {
  108. uni.showToast({
  109. title: "更改收藏状态失败。",
  110. icon: "none",
  111. duration: 2000
  112. })
  113. })
  114. }
  115. }
  116. onLoad((options) => {
  117. uni.$on('projectInfoSearch', resolve => {
  118. searchInfo.value = Object.assign(searchInfo.value, resolve);
  119. searchInfo.value.pageNo = 1;
  120. projectList.value = [];
  121. listTotal.value = 0;
  122. moreListFlag = true;
  123. getList();
  124. });
  125. getList();
  126. });
  127. onUnload(() => {
  128. uni.$off('projectInfoSearch');
  129. })
  130. onPageScroll((e) => {
  131. scrollTop.value = e.scrollTop
  132. })
  133. onPullDownRefresh(() => {
  134. searchInfo.value.pageNo = 1;
  135. projectList.value = [];
  136. moreListFlag = true;
  137. try {
  138. getList();
  139. } finally {
  140. uni.stopPullDownRefresh()
  141. }
  142. })
  143. let cardCurrut = ref(0)
  144. function onChangeCard(e) {
  145. if (cardCurrut.value == e) {
  146. projectList.value[cardCurrut.value].isOpen = !projectList.value[cardCurrut.value].isOpen
  147. } else {
  148. projectList.value[cardCurrut.value].isOpen = false
  149. projectList.value[e].isOpen = true
  150. cardCurrut.value = e
  151. }
  152. }
  153. onReachBottom(() => {
  154. if (!moreListFlag) {
  155. return uni.showToast({
  156. title: "已经到底了。",
  157. icon: "none",
  158. duration: 2000
  159. })
  160. }
  161. searchInfo.value.pageNo++;
  162. getList();
  163. })
  164. </script>
  165. <template>
  166. <view class="container">
  167. <page-title>关注项目</page-title>
  168. <view class="cards-list" :style="isUnfold ? {marginTop:'30rpx'} :''">
  169. <view v-for="(item,index) in projectList" :key="index">
  170. <view class="card">
  171. <view class="project-layer" :style="!item.isOpen ? {border:'none'}:''">
  172. <text class="card-name-num">{{(index+1<10?'0'+(index+1):index+1)}}</text>
  173. <view class="name">
  174. {{item.subName ?? "--"}}
  175. </view>
  176. </view>
  177. <view class="card-status" @click="onChangeCard(index)">
  178. <image class="status-light" src="../../static/images/red.svg" mode="" v-if="item.status_fgw=='2'"></image>
  179. <image class="status-light" src="../../static/images/green.svg" mode=""
  180. v-if="item.status_fgw=='0'||item.status_fgw==null"></image>
  181. <image class="status-light" src="../../static/images/yellow.svg" mode="" v-if="item.status_fgw=='1'"></image>
  182. {{item.status ?? "--"}}
  183. <image src="../../static/images/liaghtUp.svg" mode=""
  184. :class="item.isOpen ?'card-status-icon-change' :''"></image>
  185. </view>
  186. <view class="card-content-box" :style="item.isOpen ? {height:'250rpx'} :''">
  187. <view class="card-item" style="margin-top: 5rpx;">
  188. <view class="card-item-name">总 投 资 金 额</view>
  189. <view class="card-item-content">{{item.amtTotal ?? "--"}}</view>
  190. </view>
  191. <!-- 年度计划投资-申报单位(万元) -->
  192. <view class="card-item">
  193. <view class="card-item-name">年度计划投资</view>
  194. <view class="card-item-content">{{item.yearAmt ?? "--"}}</view>
  195. </view>
  196. <!-- 已完成投资(万元)-->
  197. <view class="card-item">
  198. <view class="card-item-name">年度完成投资</view>
  199. <view class="card-item-content">{{item.yearAmtSj ?? "--"}}</view>
  200. </view>
  201. <!-- 当前状态 -->
  202. <view class="card-item">
  203. <view class="card-item-name">项目状态</view>
  204. <view class="card-item-content" :class="item.status?'red' :''">{{item.status ?? "--"}}</view>
  205. </view>
  206. <view class="card-btn-list">
  207. <view class="button" @click="goToReport('weekly',item.id,item.subName)">
  208. 周报
  209. </view>
  210. <view class="button" @click="goToReport('monthly',item.id,item.subName)">
  211. 月报
  212. </view>
  213. <view class="button" v-if="!item.isAttention" @click="changeFocus(item.id,item.isAttention)">
  214. 关注
  215. </view>
  216. <view class="button" @click="changeFocus(item.id,item.isAttention)" v-else>
  217. 取消关注
  218. </view>
  219. <view class="button" v-if="item.usersub == 1" @click="goToDetail(item.id,item.subName)">
  220. 项目详情
  221. </view>
  222. <view class="button" v-else @click="goToDetail(item.id,item.subName)">
  223. 查看
  224. </view>
  225. <view class="button" @click="goToReport('more',item.id,item.subName)">
  226. 更多
  227. </view>
  228. </view>
  229. </view>
  230. </view>
  231. </view>
  232. <empty-show v-if="projectList.length===0"></empty-show>
  233. </view>
  234. <u-back-top :scroll-top="scrollTop"></u-back-top>
  235. <u-loading-page :loading="loading"></u-loading-page>
  236. </view>
  237. </template>
  238. <style lang="scss" scoped>
  239. .red{
  240. color: #E02020 !important;
  241. }
  242. .card .card-status {
  243. top: 32rpx;
  244. height: 64rpx;
  245. background: #F2F7FF;
  246. font-weight: 500;
  247. font-size: 12px;
  248. color: #98B7DC;
  249. }
  250. .status-light {
  251. width: 60rpx !important;
  252. height: 60rpx !important;
  253. position: absolute !important;
  254. right: 0;
  255. top: -46rpx !important;
  256. }
  257. .card-name-num {
  258. width: 64rpx;
  259. height: 64rpx;
  260. border-radius: 4rpx;
  261. border: 2rpx solid #F4F4F4;
  262. font-size: 24rpx;
  263. color: #B5B5B5;
  264. display: flex;
  265. align-items: center;
  266. justify-content: center;
  267. }
  268. .card .project-layer {
  269. justify-content: flex-start;
  270. // padding-bottom: 20rpx !important;
  271. .name {
  272. width: 64% !important;
  273. font-weight: 500;
  274. font-size: 28rpx;
  275. color: #222222;
  276. }
  277. }
  278. .card{
  279. padding-top: 20rpx !important;
  280. padding-bottom: 0rpx !important;
  281. .card-item{
  282. .card-item-name{
  283. width: 200rpx;
  284. }
  285. }
  286. }
  287. .project-btn {
  288. width: 48% !important;
  289. background: #1869F6;
  290. }
  291. .focus-btn {
  292. width: 48% !important;
  293. background-color: #fff;
  294. border-radius: 16rpx 16rpx 16rpx 16rpx;
  295. border: 3rpx solid #1869F6;
  296. color: #1869F6;
  297. }
  298. .focus-btn-no {
  299. width: 48% !important;
  300. background-color: #fff;
  301. border-radius: 16rpx 16rpx 16rpx 16rpx;
  302. border: 3rpx solid #FF2D2D;
  303. color: #FF2D2D;
  304. }
  305. .more-btn {
  306. background-color: #fff;
  307. color: #1869F6;
  308. font-size: 32rpx;
  309. }
  310. .focusText {
  311. font-size: 12rpx;
  312. margin-right: 12rpx;
  313. }
  314. .card {
  315. padding-top: 16rpx;
  316. // overflow: hidden;
  317. }
  318. .light-item {
  319. margin-bottom: 32rpx;
  320. }
  321. .card-light {
  322. display: flex;
  323. align-items: center;
  324. justify-content: center;
  325. }
  326. .card-light-bottom {
  327. width: 122rpx;
  328. height: 44rpx;
  329. margin: auto 0;
  330. background-size: 100% 100%;
  331. }
  332. .light-red {
  333. background-image: url('@/static/icon-light-red.png');
  334. }
  335. .light-yellow {
  336. background-image: url('@/static/icon-light-yellow.png');
  337. }
  338. .light-green {
  339. background-image: url('@/static/icon-light-green.png');
  340. }
  341. .focus {
  342. width: 46rpx;
  343. height: 40rpx;
  344. background-image: url("@/static/focus-off.png");
  345. background-size: 100% 100%;
  346. }
  347. .focus-on {
  348. background-image: url("@/static/focus-on.png");
  349. }
  350. .special-btn {
  351. background: linear-gradient(225deg, #2428F1 0%, #12C8C2 94%);
  352. }
  353. .bottom-item {
  354. display: flex;
  355. flex-wrap: wrap;
  356. justify-content: space-between;
  357. align-content: flex-start;
  358. row-gap: 20rpx;
  359. margin-bottom: 64rpx;
  360. }
  361. .lamp {
  362. display: flex;
  363. justify-content: center;
  364. align-items: center;
  365. image {
  366. width: 72rpx;
  367. height: 72rpx;
  368. margin-right: 20rpx;
  369. }
  370. text {
  371. font-size: 32rpx;
  372. }
  373. }
  374. .card-box2 {
  375. padding: 0 0 36rpx 0;
  376. border-radius: 28rpx 28rpx 28rpx 28rpx;
  377. }
  378. .card-value {
  379. position: absolute;
  380. bottom: 0;
  381. right: 0;
  382. width: 255rpx;
  383. height: 68rpx;
  384. padding-right: 22rpx;
  385. text-align: right;
  386. line-height: 68rpx;
  387. color: #1869F6;
  388. font-size: 32rpx;
  389. background: linear-gradient(270deg, #B2CEFF 0%, rgba(219, 232, 255, 0) 100%);
  390. }
  391. .card-fold {
  392. position: relative;
  393. width: 100%;
  394. min-height: 152rpx;
  395. margin-bottom: 20rpx;
  396. padding: 24rpx 30rpx 52rpx;
  397. box-sizing: border-box;
  398. background: #FFFFFF;
  399. border-radius: 40rpx;
  400. overflow: hidden;
  401. }
  402. .card-fold-option {
  403. position: absolute;
  404. display: flex;
  405. justify-content: space-between;
  406. align-items: center;
  407. left: 0;
  408. bottom: 0;
  409. width: 100%;
  410. height: 38rpx;
  411. padding: 0 40rpx;
  412. box-sizing: border-box;
  413. background: linear-gradient(270deg, #CADDFF 4%, rgba(219, 232, 255, 0) 100%);
  414. z-index: 999;
  415. .card-fold-count {
  416. flex: 1;
  417. font-size: 28rpx;
  418. color: #1869F6;
  419. }
  420. .card-fold-center {
  421. flex: 1;
  422. .card-fold-btn {
  423. width: 32rpx;
  424. height: 20rpx;
  425. margin: 0 auto;
  426. background-image: url("@/static/icon-fold.png");
  427. background-size: 100% 100%;
  428. }
  429. .card-unfold-btn {
  430. transform: rotate(180deg);
  431. }
  432. }
  433. .card-fold-chaos {
  434. flex: 1;
  435. }
  436. }
  437. .card-fold-red {
  438. background: linear-gradient(270deg, #FF8080 0%, rgba(219, 232, 255, 0) 100%);
  439. .card-fold-count {
  440. color: #FF0000;
  441. }
  442. .card-fold-center {
  443. .card-fold-btn {
  444. background-image: url("@/static/icon-fold-red.png");
  445. }
  446. }
  447. }
  448. .card-fold-yellow {
  449. background: linear-gradient(270deg, #FFAA00 4%, rgba(219, 232, 255, 0) 100%);
  450. .card-fold-count {
  451. color: #E19703;
  452. }
  453. .card-fold-center {
  454. .card-fold-btn {
  455. background-image: url("@/static/icon-fold-yellow.png");
  456. }
  457. }
  458. }
  459. </style>