myHome.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <view>
  3. <view class="swiper-wrap">
  4. <u-swiper :list="list1" indicator indicatorMode="dot"
  5. autoplay
  6. @change="change" @click="click">
  7. </u-swiper>
  8. </view>
  9. <view>
  10. <u-upload
  11. :fileList="fileList1"
  12. @afterRead="afterRead"
  13. @delete="deletePic"
  14. name="1"
  15. multiple
  16. :maxCount="10"
  17. ></u-upload>
  18. </view>
  19. <!-- <u-skeleton
  20. rows="3"
  21. title
  22. loading
  23. ></u-skeleton> -->
  24. <view class="company-title">
  25. <u--input v-model="companyData.companyName" placeholder="请选择性别" border="none" ></u--input>
  26. </view>
  27. <view class="intro">
  28. <u--input v-model="companyData.companyIntroduction" placeholder="请选择性别" border="none" ></u--input>
  29. </view>
  30. <view class="scope">
  31. <u--input v-model="companyData.scopeOfBusiness" placeholder="请选择性别" border="none" ></u--input>
  32. </view>
  33. <u-list>
  34. <u-list-item>
  35. <u--input v-model="companyData.companyAddress" placeholder="请选择性别" border="none" ></u--input>
  36. </u-list-item>
  37. <u-list-item>
  38. <u--input v-model="companyData.phone" placeholder="请选择性别" border="none" ></u--input>
  39. </u-list-item>
  40. <u-list-item>
  41. <u--input v-model="companyData.portraiture" placeholder="请选择性别" border="none" ></u--input>
  42. </u-list-item>
  43. <u-list-item>
  44. <u--input v-model="companyData.postbox" placeholder="请选择性别" border="none" ></u--input>
  45. </u-list-item>
  46. </u-list>
  47. <view class="footer">
  48. <view @click='edit' class='button'>编辑</view>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. export default {
  54. data() {
  55. return {
  56. list1: [],
  57. companyData:{},
  58. }
  59. },
  60. methods: {
  61. edit(){
  62. // uni.showLoading({
  63. // title: '数据加载中'
  64. // })
  65. // this.$request.baseRequest('personalHomepageInfo', 'list', {
  66. // remark2: this.route,
  67. // carpoolingType: this.type,
  68. // companyId: 1,
  69. // pageNum: page.num,
  70. // pageSize: page.size,
  71. // }, failres => {
  72. // console.log('res+++++', failres.errmsg)
  73. // this.$refs.uToast.show({
  74. // type: 'error',
  75. // message: failres.errmsg,
  76. // })
  77. // uni.hideLoading()
  78. // }).then(res => {
  79. // // if (res.errno == 200) {
  80. // uni.hideLoading()
  81. // console.log(11)
  82. // let curPageData = res.data.items;
  83. // let totalPage = res.data.total;
  84. // let curPageLen = curPageData.length;
  85. // this.mescroll.endByPage(curPageLen, totalPage);
  86. // console.log(res.data)
  87. // // this.makeData(res.data)
  88. // if (page.num == 1) this.infoList = []; //如果是第一页需手动置空列表
  89. // this.infoList = this.infoList.concat(curPageData); //追加新数据
  90. // // }
  91. // })
  92. // uni.navigateTo({
  93. // url:_url
  94. // })
  95. },
  96. deletePic(event) {
  97. this[`fileList${event.name}`].splice(event.index, 1)
  98. },
  99. // 新增图片
  100. async afterRead(event) {
  101. // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
  102. let lists = [].concat(event.file)
  103. let fileListLen = this[`fileList${event.name}`].length
  104. lists.map((item) => {
  105. this[`fileList${event.name}`].push({
  106. ...item,
  107. status: 'uploading',
  108. message: '上传中'
  109. })
  110. })
  111. for (let i = 0; i < lists.length; i++) {
  112. const result = await this.uploadFilePromise(lists[i].url)
  113. let item = this[`fileList${event.name}`][fileListLen]
  114. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  115. status: 'success',
  116. message: '',
  117. url: result
  118. }))
  119. fileListLen++
  120. }
  121. },
  122. uploadFilePromise(url) {
  123. return new Promise((resolve, reject) => {
  124. // uploadImage(res.tempFilePaths[0], 'cardImages/',
  125. // result => {
  126. // // this.trainImg = result
  127. // uni.hideLoading();
  128. // }
  129. // )
  130. // let a = uni.uploadFile({
  131. // url: 'http://192.168.2.21:7001/upload', // 仅为示例,非真实的接口地址
  132. // filePath: url,
  133. // name: 'file',
  134. // formData: {
  135. // user: 'test'
  136. // },
  137. // success: (res) => {
  138. // setTimeout(() => {
  139. // resolve(res.data.data)
  140. // }, 1000)
  141. // }
  142. // });
  143. })
  144. },
  145. }
  146. }
  147. </script>
  148. <style>
  149. </style>