index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <!-- 调配计划页面 -->
  2. <template>
  3. <view class="deploy-plan">
  4. <view class="plan-list-box" v-for="(plan, index) in deployList" :key="index">
  5. <custom-collapse>
  6. <template #collapseTitle>
  7. <view class="title-box">
  8. {{plan.plan}}
  9. </view>
  10. </template>
  11. <template #collapseContent>
  12. <view class="plan-list">
  13. <view class="plan-list-item" v-for="(item,index) in plan.fileList" :key="index"
  14. @tap="handleOpenFile(item)">
  15. <view class="left">
  16. <view class="icon">
  17. <image style="width: 100%; height: 100%;"
  18. :src="`/static/images/index/deploy/${item.type}.svg`" mode="scaleToFill">
  19. </image>
  20. </view>
  21. <view class="title">
  22. {{item.title}}
  23. </view>
  24. </view>
  25. <view class="right">
  26. <image style="width: 100%; height: 100%;"
  27. src="/static/images/index/deploy/right-arrow.svg" mode="scaleToFill"></image>
  28. </view>
  29. </view>
  30. </view>
  31. </template>
  32. </custom-collapse>
  33. </view>
  34. </view>
  35. </template>
  36. <script lang="ts">
  37. export default {
  38. options:{
  39. styleIsolation: 'shared'
  40. }
  41. }
  42. </script>
  43. <script setup lang="ts">
  44. import {
  45. reactive
  46. } from 'vue';
  47. import CustomCollapse from '@/components/Collapse/CustomCollapse.vue';
  48. const deployList = reactive([{
  49. id: 1,
  50. plan: "年度配水计划",
  51. number: 3,
  52. fileList: [{
  53. title: "2024年度配水计划",
  54. type: "pdf",
  55. url: "/static/files/hlt_file.pdf"
  56. },
  57. {
  58. title: "2024年度配水计划",
  59. type: "pdf",
  60. url: "/static/files/hlt_file.pdf"
  61. },
  62. {
  63. title: "2024年度配水计划",
  64. type: "docx",
  65. url: "/static/files/hlt_file.docx"
  66. }
  67. ]
  68. },
  69. {
  70. id: 2,
  71. plan: "春灌配水计划",
  72. number: 1,
  73. fileList: [{
  74. title: "黑龙滩灌区2024年育秧用水",
  75. type: "xlsx",
  76. url: "/static/files/hlt_file.xlsx"
  77. }]
  78. },
  79. {
  80. id: 3,
  81. plan: "其他计划",
  82. number: 2,
  83. fileList: [{
  84. title: "其他配水计划",
  85. type: "docx",
  86. url: "/static/files/hlt_file.docx"
  87. },
  88. {
  89. title: "其他配水计划",
  90. type: "xlsx",
  91. url: "/static/files/hlt_file.xlsx"
  92. }
  93. ]
  94. }
  95. ])
  96. const handleOpenFile = (file) => {
  97. console.log(file)
  98. uni.openDocument({
  99. filePath: file.url,
  100. showMenu: true,
  101. success: function(res) {
  102. console.log('打开文档成功');
  103. }
  104. });
  105. }
  106. </script>
  107. <style lang="scss" scoped>
  108. .deploy-plan {
  109. min-height: calc(100vh - var(--window-top) - 40rpx);
  110. background-color: $uni-user-page-bgc;
  111. padding: 20rpx;
  112. .plan-list-box {
  113. margin-bottom: 20rpx;
  114. background-color: #fff;
  115. border-radius: 20rpx;
  116. padding: 40rpx;
  117. .custom-collapse {
  118. .title-box {
  119. padding-bottom: 20rpx;
  120. font-family: Source Han Sans;
  121. font-size: 40rpx;
  122. font-weight: 500;
  123. font-feature-settings: "kern" on;
  124. color: $uni-text-color;
  125. }
  126. .plan-list {
  127. &-item {
  128. padding: 0 30rpx;
  129. margin-bottom: 20rpx;
  130. height: 100rpx;
  131. display: flex;
  132. justify-content: space-between;
  133. align-items: center;
  134. background: #F7F9FD;
  135. border-radius: 12rpx;
  136. &:last-child {
  137. margin-bottom: 0;
  138. }
  139. .left {
  140. display: flex;
  141. align-items: center;
  142. .icon {
  143. width: 40rpx;
  144. height: 52rpx;
  145. }
  146. .title {
  147. margin-left: 30rpx;
  148. font-family: 思源黑体;
  149. font-size: 36rpx;
  150. font-feature-settings: "kern" on;
  151. color: $uni-text-color;
  152. }
  153. }
  154. .right {
  155. width: 20rpx;
  156. height: 36rpx;
  157. }
  158. // &:last-child{
  159. // margin-bottom: 0;
  160. // }
  161. }
  162. }
  163. }
  164. }
  165. }
  166. </style>