editHome.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <view class="content">
  3. <view class="content1">
  4. <u--form labelPosition="left" :model="homeInfo" ref="uForm">
  5. <u-form-item label="公司/机构名称" prop="userInfo.name" borderBottom ref="item1">
  6. <u--input v-model="homeInfo.name" border="none" placeholder="输入公司名称"></u--input>
  7. </u-form-item>
  8. <view class="">
  9. <view class="">
  10. 公司/机构简介
  11. </view>
  12. <u--textarea v-model="value2" placeholder="输入公司/机构简介,不超过1000个字" count maxlength="1000"></u--textarea>
  13. </view>
  14. <view class="">
  15. <view class="">
  16. 业务范围
  17. </view>
  18. <u--textarea v-model="value2" placeholder="输入业务范围,不超过500个字" count maxlength="500"></u--textarea>
  19. </view>
  20. <u-form-item label="公司地址" prop="userInfo.name" borderBottom ref="item1">
  21. <u--input v-model="homeInfo.name" border="none" placeholder="输入地址"></u--input>
  22. </u-form-item>
  23. <u-form-item label="联系电话" prop="userInfo.name" borderBottom ref="item1">
  24. <u--input v-model="homeInfo.name" border="none" placeholder="输入地址"></u--input>
  25. </u-form-item>
  26. <u-form-item label="传真" prop="userInfo.name" borderBottom ref="item1">
  27. <u--input v-model="homeInfo.name" border="none" placeholder="输入地址"></u--input>
  28. </u-form-item>
  29. <u-form-item label="邮箱" prop="userInfo.name" borderBottom ref="item1">
  30. <u--input v-model="homeInfo.name" border="none" placeholder="输入地址"></u--input>
  31. </u-form-item>
  32. <view class="">
  33. <view class="">
  34. 企业风采
  35. </view>
  36. <u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple
  37. :maxCount="10"></u-upload>
  38. </view>
  39. </u--form>
  40. </view>
  41. <view class="bottom">
  42. <button>提交</button>
  43. </view>
  44. </view>
  45. </template>
  46. <script>
  47. import uploadImage from '@/components/ossutil/uploadFile.js';
  48. export default {
  49. data() {
  50. return {
  51. fileList1: [],
  52. value2:'',
  53. homeInfo:{
  54. name:''
  55. }
  56. };
  57. },
  58. methods:{
  59. // 删除图片
  60. deletePic(event) {
  61. this[`fileList${event.name}`].splice(event.index, 1)
  62. },
  63. // 新增图片
  64. async afterRead(event) {
  65. // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
  66. let lists = [].concat(event.file)
  67. let fileListLen = this[`fileList${event.name}`].length
  68. lists.map((item) => {
  69. this[`fileList${event.name}`].push({
  70. ...item,
  71. status: 'uploading',
  72. message: '上传中'
  73. })
  74. })
  75. for (let i = 0; i < lists.length; i++) {
  76. const result = await this.uploadFilePromise(lists[i].url)
  77. let item = this[`fileList${event.name}`][fileListLen]
  78. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  79. status: 'success',
  80. message: '',
  81. url: result
  82. }))
  83. fileListLen++
  84. }
  85. },
  86. uploadFilePromise(url) {
  87. return new Promise((resolve, reject) => {
  88. // uploadImage(res.tempFilePaths[0], 'cardImages/',
  89. // result => {
  90. // // this.trainImg = result
  91. // uni.hideLoading();
  92. // }
  93. // )
  94. // let a = uni.uploadFile({
  95. // url: 'http://192.168.2.21:7001/upload', // 仅为示例,非真实的接口地址
  96. // filePath: url,
  97. // name: 'file',
  98. // formData: {
  99. // user: 'test'
  100. // },
  101. // success: (res) => {
  102. // setTimeout(() => {
  103. // resolve(res.data.data)
  104. // }, 1000)
  105. // }
  106. // });
  107. })
  108. },
  109. }
  110. }
  111. </script>
  112. <style lang="scss">
  113. </style>