applyMaintenance.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <view class="content">
  3. <view class="box1">
  4. <view class="steps hflex acenter jcenter">
  5. <u-steps :current="current">
  6. <u-steps-item title="个人信息"></u-steps-item>
  7. <u-steps-item title="工作信息"></u-steps-item>
  8. <u-steps-item title="审核"></u-steps-item>
  9. </u-steps>
  10. </view>
  11. <view v-if="current == 0">
  12. <view class="title">个人信息</view>
  13. <view class="hflex acenter jbetween cell">
  14. <view class="left">姓名</view>
  15. <u-input v-model="userInfo.name" placeholder="请输入您的姓名" inputAlign="right" border="none"></u-input>
  16. </view>
  17. <view class="hflex acenter jbetween cell">
  18. <view class="left">身份证号</view>
  19. <u-input v-model="userInfo.idNumber" placeholder="请输入您的身份证号" inputAlign="right" border="none"></u-input>
  20. </view>
  21. <view class="hflex acenter jbetween cell">
  22. <view class="left">邮箱</view>
  23. <u-input v-model="userInfo.eamil" placeholder="请输入您的邮箱" inputAlign="right" border="none"></u-input>
  24. </view>
  25. <view class="hflex acenter jbetween cell">
  26. <view class="left">地址</view>
  27. <u-input v-model="userInfo.address" placeholder="请输入您的地址" inputAlign="right" border="none"></u-input>
  28. </view>
  29. <view class="line"></view>
  30. <view class="cell">
  31. <view class="img_title">身份证人像面照片</view>
  32. <view class="upload_img hflex acenter jcenter">
  33. <u-upload :fileList="userInfo.just_img" @afterRead="afterRead(1)" @delete="deletePic(1)" :maxCount="1" name="1" multiple :previewFullImage="true" width="110" height="110">
  34. <image src="/static/images/comment/upload-just.png" style="width: 550rpx;height: 324rpx;"></image>
  35. </u-upload>
  36. </view>
  37. </view>
  38. <view class="cell">
  39. <view class="img_title">身份证人像面照片</view>
  40. <view class="upload_img hflex acenter jcenter">
  41. <u-upload :fileList="userInfo.back_img" @afterRead="afterRead(2)" @delete="deletePic(2)" :maxCount="1" name="1" multiple :previewFullImage="true" width="110" height="110">
  42. <image src="/static/images/comment/upload-back.png" style="width: 550rpx;height: 324rpx;"></image>
  43. </u-upload>
  44. </view>
  45. </view>
  46. <view class="bottom">
  47. <view class="btn" @click="next">下一步</view>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </template>
  53. <script>
  54. import $api from '@/static/js/api.js'
  55. var that = ''
  56. export default {
  57. data() {
  58. return {
  59. current: 0,
  60. userInfo: {
  61. name: '',
  62. idNumber: '',
  63. eamil: '',
  64. address: '',
  65. just_img: [],
  66. back_img: [],
  67. }
  68. }
  69. },
  70. onLoad() {
  71. that = this
  72. },
  73. methods: {
  74. // 删除图片
  75. deletePic(event) {
  76. // that.userInfo.imgList.splice(event.index, 1)
  77. console.log(event)
  78. if(event == 1) {
  79. that.just_img = []
  80. } else {
  81. that.back_img = []
  82. }
  83. },
  84. // 新增图片
  85. async afterRead(event) {
  86. var imgList = []
  87. // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
  88. if(event == 1) {
  89. imgList = that.just_img
  90. } else {
  91. imgList = that.back_img
  92. }
  93. let lists = [].concat(event.file)
  94. let imgListLen = imgList.length
  95. lists.map((item) => {
  96. imgList.push({
  97. ...item,
  98. status: 'uploading',
  99. message: '上传中'
  100. })
  101. })
  102. for (let i = 0; i < lists.length; i++) {
  103. const result = await this.uploadFilePromise(lists[i].url)
  104. let item = imgList[imgListLen]
  105. imgList.splice(imgListLen, 1, Object.assign(item, {
  106. status: 'success',
  107. message: '',
  108. url: result
  109. }))
  110. imgListLen++
  111. }
  112. if (event == 1) {
  113. that.just_img = imgList
  114. } else {
  115. that.back_img = imgList
  116. }
  117. },
  118. // 上传图片
  119. uploadFilePromise(url) {
  120. return new Promise((resolve, reject) => {
  121. let a = uni.uploadFile({
  122. url: 'http://192.168.2.21:7001/upload', // 仅为示例,非真实的接口地址
  123. filePath: url,
  124. name: 'file',
  125. formData: {
  126. user: 'test'
  127. },
  128. success: (res) => {
  129. setTimeout(() => {
  130. resolve(res.data.data)
  131. }, 1000)
  132. }
  133. });
  134. })
  135. },
  136. next() {
  137. that.current = that.current + 1
  138. // if ($api.formCheck(that.userInfo.name,'truename') && $api.formCheck(that.userInfo.idNumber,'identity') && $api.formCheck(that.userInfo.eamil,'email') && $api.formCheck(that.userInfo.address,'required') && $api.formCheck(that.userInfo.just_img,'required') && $api.formCheck(that.userInfo.back_img,'required')) {
  139. // that.current = that.current + 1
  140. // }
  141. }
  142. },
  143. }
  144. </script>
  145. <style lang="scss" scoped>
  146. .content::v-deep {
  147. padding: 0 40rpx;
  148. .box1 {
  149. .steps {
  150. width: 100%;
  151. height: 188rpx;
  152. }
  153. .title {
  154. font-size: 32rpx;
  155. color: #444;
  156. margin: 8rpx 0;
  157. position: relative;
  158. z-index: 9;
  159. }
  160. .title::before {
  161. width: 120rpx;
  162. height: 16rpx;
  163. background: linear-gradient(270deg, #506dff 0%, #fff 100%);
  164. content: "";
  165. position: absolute;
  166. left: 0;
  167. bottom: 0;
  168. z-index: 2;
  169. opacity: 0.8;
  170. }
  171. .u-input {
  172. width: 100%;
  173. margin-top: 30rpx;
  174. }
  175. .cell {
  176. width: 100%;
  177. padding: 20rpx 0;
  178. .left {
  179. font-size: 28rpx;
  180. color: #222;
  181. }
  182. .u-input {
  183. font-size: 28rpx;
  184. color: #222;
  185. }
  186. .img_title {
  187. font-size: 28rpx;
  188. color: #444;
  189. }
  190. .upload_img {
  191. width: 670rpx;
  192. height: 404rpx;
  193. background-color: #f4f4f4;
  194. border-radius: 20rpx;
  195. margin: 28rpx 0 40rpx;
  196. }
  197. .u-upload__wrap {
  198. display: flex;
  199. align-items: center !important;
  200. justify-content: center !important;
  201. }
  202. }
  203. .line {
  204. width: 100%;
  205. height: 1rpx;
  206. background-color: #f4f4f4;
  207. }
  208. .bottom {
  209. width: 100%;
  210. margin: 40rpx 0 64rpx;
  211. .btn {
  212. width: 690rpx;
  213. height: 88rpx;
  214. text-align: center;
  215. line-height: 88rpx;
  216. border-radius: 44rpx;
  217. background-color: #506dff;
  218. color: #fff;
  219. font-size: 36rpx;
  220. }
  221. }
  222. }
  223. }
  224. </style>