medicationSurvey.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  1. <template>
  2. <view class="container">
  3. <!-- 标签栏 -->
  4. <view class="tabs-bar">
  5. <view class="tab-item"
  6. :class="{ active: currentTab === item.value }"
  7. v-for="(item, index) in tabs"
  8. :key="index"
  9. @click="switchTab(item.value)">
  10. {{ item.label }}
  11. </view>
  12. </view>
  13. <!-- 调研列表 -->
  14. <scroll-view class="content" scroll-y>
  15. <view class="survey-card" v-for="(item, index) in surveyList" :key="index" @click="goToDetail(item)">
  16. <!-- 卡片头部背景 -->
  17. <view class="card-header-bg" :style="{ backgroundImage: `url(${item.bannerImage})` }">
  18. <view class="banner-content">
  19. <!-- <view class="banner-title">{{ item.bannerTitle }}</view> -->
  20. <view class="collection-time">
  21. 征集时间: {{ item.collectionStartTime }} 至 {{ item.collectionEndTime }}
  22. </view>
  23. <view class="banner-info" v-if="item.bannerInfo">{{ item.bannerInfo }}</view>
  24. </view>
  25. </view>
  26. <!-- 卡片内容 -->
  27. <view class="card-body">
  28. <view class="description">{{ item.description }}</view>
  29. <view class="x-bc">
  30. <view class="progress-section">
  31. <view class="progress-bar">
  32. <view class="progress-fill" :style="{ width: item.progressPercent + '%' }"></view>
  33. </view>
  34. <view class="progress-text">{{ item.completedCount }}/{{ item.totalCount }}</view>
  35. </view>
  36. <view class="card-action">
  37. <view class="action-btn" :class="item.buttonClass" @click.stop="handleAction(item)">
  38. {{ item.buttonText }}
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="no-more">没有更多了~</view>
  45. </scroll-view>
  46. </view>
  47. </template>
  48. <script>
  49. import { getMedicationSurveyList } from '@/api-js/medicationSurvey'
  50. export default {
  51. data() {
  52. return {
  53. statusBarHeight: uni.getSystemInfoSync().statusBarHeight + 'px',
  54. currentTab: 'incomplete',
  55. tabs: [
  56. { label: '未完成', value: 'incomplete' },
  57. { label: '未开始', value: 'notStarted' },
  58. { label: '已结束', value: 'ended' }
  59. ],
  60. surveyList: []
  61. }
  62. },
  63. onLoad() {
  64. this.loadData()
  65. },
  66. onReachBottom() {
  67. this.loadMore()
  68. },
  69. methods: {
  70. goBack() {
  71. uni.navigateBack()
  72. },
  73. switchTab(tab) {
  74. this.currentTab = tab
  75. this.loadData()
  76. },
  77. goToDetail(item) {
  78. uni.navigateTo({
  79. url: `/pages_task/activityDetail?id=${item.id}`
  80. })
  81. },
  82. handleAction(item) {
  83. if (item.status === 'notStarted') {
  84. uni.showToast({
  85. icon: 'none',
  86. title: '活动未开始'
  87. })
  88. } else if (item.status === 'ended') {
  89. uni.showToast({
  90. icon: 'none',
  91. title: '活动已结束'
  92. })
  93. } else {
  94. // 跳转到填写问卷或上传病例页面
  95. uni.navigateTo({
  96. url: `/pages_task/caseCollection?activityId=${item.id}`
  97. })
  98. }
  99. },
  100. async loadData() {
  101. try {
  102. uni.showLoading({ title: '加载中...' })
  103. const res = await getMedicationSurveyList({
  104. status: this.currentTab,
  105. page: 1,
  106. pageSize: 20
  107. })
  108. uni.hideLoading()
  109. if (res.code === 200 && res.data) {
  110. this.surveyList = res.data.list || this.getDefaultData()
  111. } else {
  112. this.surveyList = this.getDefaultData()
  113. }
  114. } catch (e) {
  115. uni.hideLoading()
  116. console.error('加载数据失败', e)
  117. this.surveyList = this.getDefaultData()
  118. }
  119. },
  120. async loadMore() {
  121. // 加载更多数据
  122. },
  123. getDefaultData() {
  124. if (this.currentTab === 'notStarted') {
  125. return [
  126. {
  127. id: 1,
  128. bannerImage: 'https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20240516/b091048293f142608f99eaf1b0b1510a.png',
  129. bannerTitle: '正规医院体检',
  130. bannerSubtitle: '守护您的健康',
  131. collectionStartTime: '2025-05-29 00:00',
  132. collectionEndTime: '2025-05-29 00:00',
  133. description: '全国14家医院抗菌药物合理用药调研',
  134. completedCount: 0,
  135. totalCount: 3,
  136. progressPercent: 0,
  137. status: 'notStarted',
  138. buttonText: '未开始',
  139. buttonClass: 'not-started'
  140. },
  141. {
  142. id: 2,
  143. bannerImage: 'https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20240516/b091048293f142608f99eaf1b0b1510a.png',
  144. bannerTitle: '2025广东省医师协会眼科医师分会',
  145. bannerSubtitle: '眼外伤与眼眶病学术会议',
  146. bannerInfo: '·暨眼外伤诊疗新进展学习班·',
  147. collectionStartTime: '2025-05-29 00:00',
  148. collectionEndTime: '2025-05-29 00:00',
  149. description: '全国14家医院抗菌药物合理用药调研',
  150. completedCount: 0,
  151. totalCount: 3,
  152. progressPercent: 0,
  153. status: 'notStarted',
  154. buttonText: '未开始',
  155. buttonClass: 'not-started'
  156. }
  157. ]
  158. } else if (this.currentTab === 'incomplete') {
  159. return [
  160. {
  161. id: 3,
  162. bannerImage: 'https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20240516/b091048293f142608f99eaf1b0b1510a.png',
  163. bannerTitle: '正规医院体检',
  164. bannerSubtitle: '守护您的健康',
  165. collectionStartTime: '2025-05-29 00:00',
  166. collectionEndTime: '2025-05-29 00:00',
  167. description: '全国14家医院抗菌药物合理用药调研',
  168. completedCount: 0,
  169. totalCount: 3,
  170. progressPercent: 0,
  171. status: 'incomplete',
  172. buttonText: '填写问卷',
  173. buttonClass: 'fill-questionnaire'
  174. },
  175. {
  176. id: 4,
  177. bannerImage: 'https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20240516/b091048293f142608f99eaf1b0b1510a.png',
  178. bannerTitle: '2025广东省医师协会眼科医师分会',
  179. bannerSubtitle: '眼外伤与眼眶病学术会议',
  180. bannerInfo: '·暨眼外伤诊疗新进展学习班·',
  181. collectionStartTime: '2025-05-29 00:00',
  182. collectionEndTime: '2025-05-29 00:00',
  183. description: '全国14家医院抗菌药物合理用药调研',
  184. completedCount: 1,
  185. totalCount: 3,
  186. progressPercent: 33,
  187. status: 'incomplete',
  188. buttonText: '填写问卷',
  189. buttonClass: 'fill-questionnaire'
  190. }
  191. ]
  192. } else {
  193. return [
  194. {
  195. id: 5,
  196. bannerImage: 'https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20240516/b091048293f142608f99eaf1b0b1510a.png',
  197. bannerTitle: '正规医院体检',
  198. bannerSubtitle: '守护您的健康',
  199. collectionStartTime: '2025-05-29 00:00',
  200. collectionEndTime: '2025-05-29 00:00',
  201. description: '全国14家医院抗菌药物合理用药调研',
  202. completedCount: 0,
  203. totalCount: 3,
  204. progressPercent: 0,
  205. status: 'ended',
  206. buttonText: '活动已结束',
  207. buttonClass: 'ended'
  208. },
  209. {
  210. id: 6,
  211. bannerImage: 'https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20240516/b091048293f142608f99eaf1b0b1510a.png',
  212. bannerTitle: '2025广东省医师协会眼科医师分会',
  213. bannerSubtitle: '眼外伤与眼眶病学术会议',
  214. bannerInfo: '·暨眼外伤诊疗新进展学习班·',
  215. collectionStartTime: '2025-05-29 00:00',
  216. collectionEndTime: '2025-05-29 00:00',
  217. description: '全国14家医院抗菌药物合理用药调研',
  218. completedCount: 0,
  219. totalCount: 3,
  220. progressPercent: 0,
  221. status: 'ended',
  222. buttonText: '活动已结束',
  223. buttonClass: 'ended'
  224. }
  225. ]
  226. }
  227. }
  228. }
  229. }
  230. </script>
  231. <style lang="scss" scoped>
  232. .container {
  233. min-height: 100vh;
  234. background: #f5f5f5;
  235. display: flex;
  236. flex-direction: column;
  237. }
  238. .status-bar {
  239. width: 100%;
  240. background: #fff;
  241. }
  242. .header {
  243. position: relative;
  244. height: 88rpx;
  245. display: flex;
  246. align-items: center;
  247. justify-content: center;
  248. background: #fff;
  249. border-bottom: 1rpx solid #f0f0f0;
  250. .back-btn {
  251. position: absolute;
  252. left: 24rpx;
  253. width: 40rpx;
  254. height: 40rpx;
  255. image {
  256. width: 100%;
  257. height: 100%;
  258. }
  259. }
  260. .title {
  261. font-size: 36rpx;
  262. font-weight: bold;
  263. color: #333;
  264. }
  265. .header-right {
  266. position: absolute;
  267. right: 24rpx;
  268. display: flex;
  269. align-items: center;
  270. gap: 16rpx;
  271. .more-icon {
  272. font-size: 32rpx;
  273. color: #333;
  274. }
  275. }
  276. }
  277. .tabs-bar {
  278. display: flex;
  279. background: #fff;
  280. border-bottom: 1rpx solid #f0f0f0;
  281. .tab-item {
  282. flex: 1;
  283. height: 88rpx;
  284. line-height: 88rpx;
  285. text-align: center;
  286. font-family: PingFang SC, PingFang SC;
  287. font-weight: 400;
  288. font-size: 28rpx;
  289. color: #969799;
  290. position: relative;
  291. &.active {
  292. font-family: PingFang SC, PingFang SC;
  293. font-weight: 500;
  294. font-size: 28rpx;
  295. color: #333333;
  296. font-weight: bold;
  297. &::after {
  298. content: '';
  299. position: absolute;
  300. bottom: 0;
  301. left: 50%;
  302. transform: translateX(-50%);
  303. right: 0;
  304. width: 80rpx;
  305. height: 6rpx;
  306. border-radius: 3rpx 3rpx 3rpx 3rpx;
  307. background: #388BFF;
  308. }
  309. }
  310. }
  311. }
  312. .content {
  313. flex: 1;
  314. padding: 24rpx;
  315. box-sizing: border-box;
  316. }
  317. .survey-card {
  318. background: #fff;
  319. border-radius: 16rpx;
  320. margin-bottom: 24rpx;
  321. overflow: hidden;
  322. .card-header-bg {
  323. position: relative;
  324. height: 240rpx;
  325. background: linear-gradient(135deg, #87CEEB 0%, #98D8C8 100%);
  326. display: flex;
  327. align-items: flex-start;
  328. justify-content: flex-end;
  329. flex-direction: column;
  330. padding: 24rpx;
  331. .banner-content {
  332. width: 100%;
  333. text-align:left;
  334. .collection-time {
  335. font-family: PingFang SC, PingFang SC;
  336. font-weight: 600;
  337. font-size: 26rpx;
  338. color: #FFFFFF;
  339. }
  340. .banner-info {
  341. font-size: 24rpx;
  342. color: #fff;
  343. margin-bottom: 8rpx;
  344. }
  345. }
  346. }
  347. .card-body {
  348. padding: 24rpx;
  349. .description {
  350. font-family: PingFang SC, PingFang SC;
  351. font-weight: 500;
  352. font-size: 28rpx;
  353. color: #333333;
  354. margin-bottom: 30rpx;
  355. }
  356. .progress-section {
  357. width: 60%;
  358. display: flex;
  359. align-items: center;
  360. justify-content: space-between;
  361. gap: 16rpx;
  362. .progress-bar {
  363. flex: 1;
  364. height: 12rpx;
  365. background: #f0f0f0;
  366. border-radius: 4rpx;
  367. overflow: hidden;
  368. .progress-fill {
  369. height: 100%;
  370. background: #388BFF;
  371. border-radius: 4rpx;
  372. transition: width 0.3s;
  373. }
  374. }
  375. .progress-text {
  376. font-size: 24rpx;
  377. color: #388BFF;
  378. min-width: 60rpx;
  379. }
  380. }
  381. .card-action {
  382. display: flex;
  383. justify-content: flex-end;
  384. .action-btn {
  385. display: flex;
  386. justify-content: center;
  387. align-items: center;
  388. padding: 12rpx 24rpx;
  389. background: #388BFF;
  390. border-radius: 34rpx 34rpx 34rpx 34rpx;
  391. font-family: PingFang SC, PingFang SC;
  392. font-weight: 500;
  393. font-size: 24rpx;
  394. color: #FFFFFF;
  395. &.fill-questionnaire {
  396. background: #388BFF;
  397. }
  398. &.not-started {
  399. background: #EFEFEF;
  400. color: #999999;
  401. }
  402. &.ended {
  403. background: #EFEFEF;
  404. color: #999999;
  405. }
  406. }
  407. }
  408. }
  409. }
  410. .no-more {
  411. text-align: center;
  412. padding: 48rpx 0;
  413. font-size: 24rpx;
  414. color: #999;
  415. }
  416. </style>