receivingOrder.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <template>
  2. <view class="content">
  3. <view class="box">
  4. <view class="hflex acenter jbetween cell">
  5. <view class="label">姓名</view>
  6. <u-input v-model="name" placeholder="请填写姓名" inputAlign="right" border="none"></u-input>
  7. </view>
  8. <view class="hflex acenter jbetween cell">
  9. <view class="label">所在单位</view>
  10. <u-input v-model="work" placeholder="请填写所在单位名称" inputAlign="right" border="none"></u-input>
  11. </view>
  12. <view class="cell">
  13. <view class="label">营业执照照片</view>
  14. <view class="upload hflex acenter jcenter">
  15. <u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" :maxCount="1" name="1" multiple :previewFullImage="true" width="530rpx" height="324rpx">
  16. <image src="/static/images/comment/upload-business.png" style="width: 530rpx;height: 324rpx;"></image>
  17. <image class="upload_img" src="/static/images/comment/upload-top.png"></image>
  18. </u-upload>
  19. </view>
  20. </view>
  21. <view class="cell" style="border: none;">
  22. <view class="label">身份证正反面</view>
  23. <view class="hflex acenter jbetween" style="margin-top: 28rpx;">
  24. <u-upload :fileList="fileList2" @afterRead="afterRead" @delete="deletePic" :maxCount="1" name="2" multiple :previewFullImage="true" width="310rpx" height="188rpx">
  25. <image src="/static/images/comment/upload-just.png" style="width: 310rpx;height: 188rpx;"></image>
  26. </u-upload>
  27. <view class="upload2">
  28. <u-upload :fileList="fileList3" @afterRead="afterRead" @delete="deletePic" :maxCount="1" name="3" multiple :previewFullImage="true" width="310rpx" height="188rpx">
  29. <image src="/static/images/comment/upload-back.png" style="width: 310rpx;height: 188rpx;"></image>
  30. <image class="upload_img2" src="/static/images/comment/upload-top.png"></image>
  31. </u-upload>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="box">
  37. <view class="hflex acenter jbetween cell">
  38. <view class="label">手机号</view>
  39. <u-input v-model="phone" placeholder="请填写你的手机号" inputAlign="right" border="none"></u-input>
  40. </view>
  41. <view class="hflex acenter jbetween cell">
  42. <view class="label">邮箱</view>
  43. <u-input v-model="eamil" placeholder="请填写你的邮箱" inputAlign="right" border="none"></u-input>
  44. </view>
  45. <view class="hflex acenter jbetween cell" style="border: none;">
  46. <view class="label">地址</view>
  47. <u-input v-model="address" placeholder="请填写你的详细地址" inputAlign="right" border="none"></u-input>
  48. </view>
  49. </view>
  50. <view class="box" style="margin-bottom: 186rpx;">
  51. <view class="cell vflex jbetween">
  52. <view class="label">工作简历</view>
  53. <u-input v-model="resume" placeholder="请详细描述你的工作经历" border="none"></u-input>
  54. </view>
  55. <view class="cell vflex jbetween" style="border: none;">
  56. <view class="label">特长</view>
  57. <u-input v-model="resume" placeholder="请简单叙述一下你的优点及特长" border="none"></u-input>
  58. </view>
  59. </view>
  60. <view class="bottom">
  61. <view class="bottom_btn" @click="open">立即发布</view>
  62. </view>
  63. </view>
  64. </template>
  65. <script>
  66. import $api from '@/static/js/api.js'
  67. var that = ''
  68. export default {
  69. data() {
  70. return {
  71. name: '',
  72. work: '',
  73. fileList1: [],
  74. fileList2: [],
  75. fileList3: [],
  76. phone: '',
  77. email: '',
  78. address: '',
  79. resume: '',
  80. speciality: '',
  81. }
  82. },
  83. onLoad() {
  84. that = this
  85. },
  86. methods: {
  87. // 立即发布
  88. open() {
  89. if($api.formCheck(that.name,'required') && $api.formCheck(that.work,'required') && $api.formCheck(that.fileList1,'required') && $api.formCheck(that.fileList2,'required') && $api.formCheck(that.fileList3,'required')
  90. && $api.formCheck(that.phone,'mobile') && $api.formCheck(that.email,'email') && $api.formCheck(that.address,'required')&& $api.formCheck(that.resume,'required')&& $api.formCheck(that.speciality,'required')) {
  91. }
  92. },
  93. // 删除图片
  94. deletePic(event) {
  95. this[`fileList${event.name}`].splice(event.index, 1)
  96. },
  97. // 新增图片
  98. async afterRead(event) {
  99. console.log(event);
  100. // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
  101. let lists = [].concat(event.file)
  102. let fileListLen = this[`fileList${event.name}`].length
  103. lists.map((item) => {
  104. this[`fileList${event.name}`].push({
  105. ...item,
  106. status: 'uploading',
  107. message: '上传中'
  108. })
  109. })
  110. for (let i = 0; i < lists.length; i++) {
  111. const result = await this.uploadFilePromise(lists[i].url)
  112. let item = this[`fileList${event.name}`][fileListLen]
  113. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  114. status: 'success',
  115. message: '',
  116. url: result
  117. }))
  118. fileListLen++
  119. }
  120. },
  121. uploadFilePromise(url) {
  122. return new Promise((resolve, reject) => {
  123. let a = uni.uploadFile({
  124. url: 'http://192.168.2.21:7001/upload', // 仅为示例,非真实的接口地址
  125. filePath: url,
  126. name: 'file',
  127. formData: {
  128. user: 'test'
  129. },
  130. success: (res) => {
  131. setTimeout(() => {
  132. resolve(res.data.data)
  133. }, 1000)
  134. }
  135. });
  136. })
  137. },
  138. },
  139. }
  140. </script>
  141. <style lang="scss" scoped>
  142. .content::v-deep {
  143. background: #F4F4F4;
  144. .box {
  145. width: 690rpx;
  146. margin: 20rpx 30rpx 0;
  147. background: #FFFFFF;
  148. border-radius: 10px;
  149. box-sizing: border-box;
  150. padding: 20rpx;
  151. .cell {
  152. width: 100%;
  153. padding: 32rpx 0 24rpx;
  154. border-bottom: 1rpx solid #F4F4F4;
  155. .label {
  156. font-size: 28rpx;
  157. font-weight: 400;
  158. color: #222222;
  159. line-height: 40rpx;
  160. }
  161. .upload {
  162. box-sizing: border-box;
  163. padding: 40rpx 60rpx;
  164. position: relative;
  165. width: 100%;
  166. height: 400rpx;
  167. background: #F4F4F4;
  168. border-radius: 16rpx;
  169. margin-top: 24rpx;
  170. .upload_img {
  171. position: absolute;
  172. width: 120rpx;
  173. height: 120rpx;
  174. top: 142rpx;
  175. left: 266rpx;
  176. }
  177. }
  178. .upload2 {
  179. position: relative;
  180. .upload_img2 {
  181. position: absolute;
  182. width: 80rpx;
  183. height: 80rpx;
  184. top: 40rpx;
  185. left: 116rpx;
  186. }
  187. }
  188. }
  189. }
  190. .bottom {
  191. width: 100%;
  192. z-index: 9;
  193. position: fixed;
  194. bottom: 0;
  195. height: 166rpx;
  196. background: #FFFFFF;
  197. box-sizing: border-box;
  198. padding: 8rpx 40rpx 74rpx;
  199. .bottom_btn {
  200. width: 100%;
  201. height: 84rpx;
  202. background: #506DFF;
  203. border-radius: 42rpx;
  204. font-size: 36rpx;
  205. font-weight: 500;
  206. color: #FFFFFF;
  207. text-align: center;
  208. line-height: 84rpx;
  209. }
  210. }
  211. }
  212. </style>