medicationSurvey.vue 9.9 KB

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