fillNonprofitArchives.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <view class="common_page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title="填写公益档案" bgColor="transparent"></cus-header>
  4. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/19/54b75bc8-d926-449b-95a5-1126f700b481.png" class="top_bg_img" mode="widthFix"></image>
  5. <div class="box">
  6. <div class="box-title">活动信息</div>
  7. <div class="box-pre adf">
  8. <div class="box-pre-left">活动名称</div>
  9. <div class="box-pre-right">{{'让孩子成为小小自然守护者'}}</div>
  10. </div>
  11. <div class="box-pre adf">
  12. <div class="box-pre-left">学生姓名</div>
  13. <div class="box-pre-right">{{'周飒然'}}</div>
  14. </div>
  15. <div class="box-pre adf">
  16. <div class="box-pre-left">参与时间</div>
  17. <div class="box-pre-right">{{'2025年7月30日'}}</div>
  18. </div>
  19. <div class="box-pre adf">
  20. <div class="box-pre-left">公益支持</div>
  21. <div class="box-pre-right">{{'种植沙漠沙沙树2棵'}}</div>
  22. </div>
  23. </div>
  24. <div class="box">
  25. <div class="box-title">活动心得</div>
  26. <up-textarea v-model="xxx" placeholder="请分享参加公益活动心得,至少输入10个字~" count border="none" style="height: 250rpx;margin-top: 28rpx;padding: 0;font-size: 26rpx;color: #252525;"></up-textarea>
  27. </div>
  28. <div class="box">
  29. <div class="box-title">活动照片<text>(分享活动照片)</text></div>
  30. <div class="box-img">
  31. <up-upload
  32. :fileList="fileList"
  33. @afterRead="afterRead"
  34. @delete="deletePic"
  35. multiple
  36. :maxCount="3"
  37. width="160rpx"
  38. height="160rpx"
  39. >
  40. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/29/b04d6b0e-0d30-4043-a2b1-d639e15e2aac.png"
  41. mode="widthFix" style="width: 160rpx;height: 160rpx;"></image>
  42. </up-upload>
  43. </div>
  44. </div>
  45. <div class="btn" @click="handleSubmit">提交</div>
  46. </view>
  47. </template>
  48. <script setup name="">
  49. import CusHeader from '@/components/CusHeader/index.vue'
  50. import { ref } from 'vue'
  51. const xxx = ref('')
  52. const fileList = ref([])
  53. const deletePic = (event) => {
  54. fileList.value.splice(event.index, 1);
  55. };
  56. // 新增图片
  57. const afterRead = async (event) => {
  58. let lists = [].concat(event.file);
  59. let fileListLen = fileList.value.length;
  60. lists.map((item) => {
  61. fileList.value.push({
  62. ...item,
  63. status: 'uploading',
  64. message: '上传中',
  65. });
  66. });
  67. for (let i = 0; i < lists.length; i++) {
  68. const result = await uploadFilePromise(lists[i].url);
  69. let item = fileList.value[fileListLen];
  70. fileList.value.splice(fileListLen, 1, {
  71. ...item,
  72. status: 'success',
  73. message: '',
  74. url: result,
  75. });
  76. fileListLen++;
  77. }
  78. };
  79. const uploadFilePromise = (url) => {
  80. return new Promise((resolve, reject) => {
  81. let a = uni.uploadFile({
  82. url: 'http://192.168.2.21:7001/upload', // 仅为示例,非真实的接口地址
  83. filePath: url,
  84. name: 'file',
  85. formData: {
  86. user: 'test',
  87. },
  88. success: (res) => {
  89. setTimeout(() => {
  90. resolve(res.data.data);
  91. }, 1000);
  92. },
  93. });
  94. });
  95. };
  96. const handleSubmit = () => {
  97. uni.navigateTo({
  98. url:'/pagesHome/fillNonprofitResult'
  99. })
  100. }
  101. </script>
  102. <style scoped lang="scss">
  103. .common_page{
  104. padding-bottom: 64rpx;
  105. .box{
  106. background: #FFFFFF;
  107. border-radius: 24rpx;
  108. margin-top: 20rpx;
  109. padding: 36rpx 24rpx;
  110. position: relative;
  111. &-title{
  112. font-family: PingFang-SC, PingFang-SC;
  113. font-weight: bold;
  114. font-size: 36rpx;
  115. color: #151B29;
  116. line-height: 48rpx;
  117. text{
  118. font-weight: 400;
  119. font-size: 26rpx;
  120. color: #B2B2B2;
  121. line-height: 37rpx;
  122. margin-left: 16rpx;
  123. }
  124. }
  125. &-pre{
  126. margin-top: 35rpx;
  127. &-left{
  128. width: 160rpx;
  129. font-family: PingFangSC, PingFang SC;
  130. font-weight: 400;
  131. font-size: 28rpx;
  132. color: #676775;
  133. line-height: 30rpx;
  134. text-align: left;
  135. }
  136. &-right{
  137. width: calc(100% - 160rpx);
  138. font-family: PingFangSC, PingFang SC;
  139. font-weight: 400;
  140. font-size: 30rpx;
  141. color: #252525;
  142. line-height: 30rpx;
  143. }
  144. }
  145. &-img{
  146. margin-top: 47rpx;
  147. }
  148. }
  149. .btn{
  150. width: calc(100% - 32rpx);
  151. height: 90rpx;
  152. background: #B7F358;
  153. border-radius: 45rpx;
  154. font-family: PingFang-SC, PingFang-SC;
  155. font-weight: bold;
  156. font-size: 32rpx;
  157. color: #151B29;
  158. line-height: 90rpx;
  159. text-align: center;
  160. letter-spacing: 2rpx;
  161. margin: 40rpx auto 0;
  162. }
  163. }
  164. </style>