fillNonprofitArchives.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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" v-if="activity">
  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">{{activity?.activityName||''}}</div>
  10. </div>
  11. <div class="box-pre adf">
  12. <div class="box-pre-left">人员姓名</div>
  13. <div class="box-pre-right">{{activity?.memberName||''}}</div>
  14. </div>
  15. <div class="box-pre adf">
  16. <div class="box-pre-left">参与时间</div>
  17. <div class="box-pre-right">{{activity?.signinTime||''}}</div>
  18. </div>
  19. <div class="box-pre adf">
  20. <div class="box-pre-left">公益支持</div>
  21. <div class="box-pre-right">{{activity?.channelName||''}}</div>
  22. </div>
  23. </div>
  24. <div class="box">
  25. <div class="box-title">活动心得</div>
  26. <up-textarea v-model="experience" 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 { BaseApi } from '../common/api/baseApi';
  51. import { onLoad } from '@dcloudio/uni-app'
  52. import { ref, getCurrentInstance } from 'vue'
  53. const { proxy } = getCurrentInstance()
  54. const activity = ref(null)
  55. const experience = ref('')
  56. const fileList = ref([])
  57. const deletePic = (event) => {
  58. fileList.value.splice(event.index, 1);
  59. };
  60. // 新增图片
  61. const afterRead = async (event) => {
  62. let lists = [].concat(event.file);
  63. let fileListLen = fileList.value.length;
  64. lists.map((item) => {
  65. fileList.value.push({
  66. ...item,
  67. status: 'uploading',
  68. message: '上传中',
  69. });
  70. });
  71. for (let i = 0; i < lists.length; i++) {
  72. const result = await uploadFilePromise(lists[i].url);
  73. let item = fileList.value[fileListLen];
  74. fileList.value.splice(fileListLen, 1, {
  75. ...item,
  76. status: 'success',
  77. message: '',
  78. url: result,
  79. });
  80. fileListLen++;
  81. }
  82. };
  83. const uploadFilePromise = (url) => {
  84. return new Promise((resolve, reject) => {
  85. let a = uni.uploadFile({
  86. url: BaseApi+'/uploadFile',
  87. filePath: url,
  88. name: 'file',
  89. success: (res) => {
  90. setTimeout(() => {
  91. let data = JSON.parse(res.data)
  92. if(data&&data.code===0){
  93. resolve(data.data);
  94. }else proxy.$showToast(data?.msg)
  95. }, 1000);
  96. },
  97. fail: err =>{
  98. resolve('');
  99. }
  100. });
  101. });
  102. };
  103. const handleSubmit = () => {
  104. if(!experience.value) return proxy.$showToast('请输入活动心得')
  105. if(fileList.value.length===0) return proxy.$showToast('请上传活动照片')
  106. let activityFile = fileList.value.map(f=>f.url).join(';')
  107. proxy.$api.post('/core/activity/signup/addArchive',{
  108. activityFile,
  109. activityId:activity.value?.activityId,
  110. experience:experience.value,
  111. memberId:activity.value?.memberId
  112. }).then(({data:res})=>{
  113. if(res.code!==0) return proxy.$showToast(res.msg)
  114. uni.navigateTo({
  115. url:'/pagesHome/fillNonprofitResult'
  116. })
  117. })
  118. }
  119. onLoad((options)=>{
  120. if(options.activity) activity.value = JSON.parse(decodeURIComponent(options.activity));
  121. })
  122. </script>
  123. <style scoped lang="scss">
  124. .common_page{
  125. padding-bottom: 64rpx;
  126. .box{
  127. background: #FFFFFF;
  128. border-radius: 24rpx;
  129. margin-top: 20rpx;
  130. padding: 36rpx 24rpx;
  131. position: relative;
  132. &-title{
  133. font-family: PingFang-SC, PingFang-SC;
  134. font-weight: bold;
  135. font-size: 36rpx;
  136. color: #151B29;
  137. line-height: 48rpx;
  138. text{
  139. font-weight: 400;
  140. font-size: 26rpx;
  141. color: #B2B2B2;
  142. line-height: 37rpx;
  143. margin-left: 16rpx;
  144. }
  145. }
  146. &-pre{
  147. margin-top: 35rpx;
  148. &-left{
  149. width: 160rpx;
  150. font-family: PingFangSC, PingFang SC;
  151. font-weight: 400;
  152. font-size: 28rpx;
  153. color: #676775;
  154. line-height: 30rpx;
  155. text-align: left;
  156. }
  157. &-right{
  158. width: calc(100% - 160rpx);
  159. font-family: PingFangSC, PingFang SC;
  160. font-weight: 400;
  161. font-size: 30rpx;
  162. color: #252525;
  163. line-height: 30rpx;
  164. }
  165. }
  166. &-img{
  167. margin-top: 47rpx;
  168. }
  169. }
  170. .btn{
  171. width: calc(100% - 32rpx);
  172. height: 90rpx;
  173. background: #B7F358;
  174. border-radius: 45rpx;
  175. font-family: PingFang-SC, PingFang-SC;
  176. font-weight: bold;
  177. font-size: 32rpx;
  178. color: #151B29;
  179. line-height: 90rpx;
  180. text-align: center;
  181. letter-spacing: 2rpx;
  182. margin: 40rpx auto 0;
  183. }
  184. }
  185. </style>