wonderful.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <view class="">
  3. <u-upload :action="action" :file-list="fileList" @on-success='uploadSuccess' :form-data='imageDate'></u-upload>
  4. <view class="buttom" @click="upLoad">
  5. 点击上传
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. export default {
  11. data() {
  12. return {
  13. action: '',
  14. imageDate: {
  15. file_type: 'img',
  16. type: 'activity_scenes'
  17. }, //上传图片携带参数
  18. fileList: [],
  19. paths:[],
  20. activity_id:'',//活动id
  21. }
  22. },
  23. onLoad(options) {
  24. this.activity_id=options.activity_id
  25. this.action = '/api/common/upload'
  26. },
  27. methods: {
  28. uploadSuccess(data) {
  29. this.paths.push(data.data)
  30. },
  31. upLoad(){
  32. let data={
  33. activity_id:this.activity_id,
  34. organization_id:this.$store.state.vuex_user.organization_id,
  35. paths:this.paths
  36. }
  37. this.$u.post('/page/organization-activity-scenes',data).then(res=>{
  38. uni.reLaunch({
  39. url:'active_detail?id='+this.activity_id
  40. })
  41. })
  42. //点击上传
  43. }
  44. }
  45. }
  46. </script>
  47. <style lang="scss" scoped>
  48. page {
  49. padding: 0 15px;
  50. }
  51. .buttom {
  52. height: 45px;
  53. line-height: 45px;
  54. color: #fff;
  55. font-size: 14px;
  56. text-align: center;
  57. border-radius: 8px;
  58. width: 45%;
  59. margin: 0 auto;
  60. margin-top:30%;
  61. background-color: #79573D;
  62. }
  63. </style>