applypartner.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. <template>
  2. <view>
  3. <public-module></public-module>
  4. <view class="box"
  5. :style="{background:`url(${indexBackgroundImage})`,backgroundSize: 'contain',backgroundRepeat: 'no-repeat'}">
  6. <view class="box-con">
  7. <uni-forms ref="personData" :rules="rules" :value="personData" label-width="100" validate-trigger="bind"
  8. err-show-type="toast">
  9. <uni-forms-item label="姓名" required name="name">
  10. <input class="uni-input-input textColor" placeholder="输入姓名" v-model="personData.name"
  11. placeholder-style="font-size:28upx" />
  12. </uni-forms-item>
  13. <uni-forms-item label="手机号" required name="mobile">
  14. <input class="uni-input-input textColor" maxlength="11" placeholder="输入手机号"
  15. v-model="personData.mobile" placeholder-style="font-size:28upx" />
  16. </uni-forms-item>
  17. <uni-forms-item label="证件号" required name="identity">
  18. <input class="uni-input-input textColor" placeholder="输入证件号" v-model="personData.identity"
  19. placeholder-style="font-size:28upx" />
  20. </uni-forms-item>
  21. <uni-forms-item label="密码" required name="password">
  22. <input class="uni-input-input textColor" placeholder="输入密码" v-model="personData.password"
  23. placeholder-style="font-size:28upx" />
  24. </uni-forms-item>
  25. <uni-forms-item label="地址" required name="address">
  26. <input class="uni-input-input textColor" placeholder="输入地址" v-model="personData.address"
  27. placeholder-style="font-size:28upx" />
  28. </uni-forms-item>
  29. </uni-forms>
  30. </view>
  31. </view>
  32. <view class="userBox" style="margin-top:10px">
  33. <text>身份证件照</text>
  34. <view class="dis j-s" style="margin: 10px 0;">
  35. <view class="imgOcr-border">
  36. <image :src=" userfrontImg?userfrontImg:'/static/image/my/shenfenzz.png'" mode=""
  37. @click="userfrontChange"></image>
  38. <view>人像面</view>
  39. </view>
  40. <view class="imgOcr-border">
  41. <image :src="userbackImg?userbackImg:'/static/image/my/shenzf.png'" mode="" @click="userbackChange">
  42. </image>
  43. <view>国徽面</view>
  44. </view>
  45. </view>
  46. </view>
  47. <view class="submit" @click="submit()">
  48. 提交
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. import indexBackgroundImage from "@/static/shenqing.png"
  54. import {
  55. mapState,
  56. mapMutations
  57. } from "vuex"
  58. export default {
  59. data() {
  60. return {
  61. indexBackgroundImage: indexBackgroundImage,
  62. checked: false,
  63. userfrontImg: "",
  64. userbackImg: "",
  65. personData: {
  66. name: '',
  67. mobile: '',
  68. identity: '',
  69. password: '',
  70. address: '',
  71. esmUserImageVo: []
  72. },
  73. rules: {
  74. name: {
  75. rules: [{
  76. required: true,
  77. errorMessage: '姓名不能为空'
  78. }]
  79. },
  80. mobile: {
  81. rules: [{
  82. required: true,
  83. errorMessage: '请输入手机号',
  84. },
  85. {
  86. pattern: /^1[3-9]\d{9}$/,
  87. errorMessage: '请输入正确的手机号',
  88. }
  89. ]
  90. },
  91. identity: {
  92. rules: [{
  93. required: true,
  94. errorMessage: '请输入身份证号',
  95. },
  96. {
  97. pattern: /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/,
  98. errorMessage: '请输入正确的身份证号',
  99. }
  100. ]
  101. },
  102. password: {
  103. rules: [{
  104. required: true,
  105. errorMessage: '请输入密码'
  106. }]
  107. },
  108. address: {
  109. rules: [{
  110. required: true,
  111. errorMessage: '请输入地址',
  112. }]
  113. },
  114. },
  115. grade: '',
  116. id: '',
  117. }
  118. },
  119. computed: {
  120. ...mapState(['userInfo', "userCheckInfo"]),
  121. },
  122. async onLoad(options) {
  123. this.grade = options.grade ? options.grade : ''
  124. },
  125. methods: {
  126. //提交注册
  127. submit() {
  128. this.$refs.personData.submit().then(res => {
  129. if (this.id) {
  130. this.$http.post('/user/updateUserInfo1/' + this.id, {
  131. esmUserImageVo: this.personData.esmUserImageVo,
  132. sysUser: this.personData,
  133. sysUserInfo: this.personData,
  134. }).then(res => {
  135. if (res.code == 200) {
  136. let obj = JSON.stringify({
  137. id: this.id,
  138. mobile: this.personData.mobile
  139. });
  140. uni.redirectTo({
  141. url: "/pages/index/success?data=" + obj
  142. })
  143. } else {
  144. uni.showModal({
  145. showCancel: false,
  146. title: res.msg
  147. })
  148. }
  149. })
  150. } else {
  151. this.$http.post('/user/newSaveUserInfoByPartner', {
  152. sysUser: {
  153. ...this.personData,
  154. roleId: "97",
  155. referrerId: this.userInfo.sysUser.userId,
  156. grade: this.grade,
  157. },
  158. esmUserImageVo: this.personData.esmUserImageVo
  159. }).then(res => {
  160. if (res.code == 200) {
  161. let obj = JSON.stringify({
  162. id: res.data.id,
  163. mobile: res.data.mobile
  164. });
  165. uni.redirectTo({
  166. url: "/pages/index/success?data=" + obj
  167. })
  168. } else {
  169. uni.showModal({
  170. showCancel: false,
  171. title: res.msg
  172. })
  173. }
  174. })
  175. }
  176. }).catch(err => {
  177. console.log('err', err);
  178. })
  179. },
  180. async userfrontChange() {
  181. let [chooseImageErr, chooseImageRes] = await uni.chooseImage({
  182. count: 1,
  183. sizeType: ['compressed']
  184. });
  185. let size = chooseImageRes.tempFiles[0].size / 1024 / 1024 < 5;
  186. if (!size) {
  187. this.$refs.uToast.show({
  188. title: '上传图片大小不能超过 5MB!',
  189. type: 'error',
  190. })
  191. return false
  192. }
  193. if (chooseImageRes) {
  194. this.userfrontImg = chooseImageRes.tempFilePaths[0];
  195. uni.uploadFile({
  196. url: this.$base.baseUrl + '/ins/taskImage/uploadFileByPartner',
  197. filePath: chooseImageRes.tempFilePaths[0],
  198. name: "multipartFile",
  199. formData: {
  200. 'type': 'image',
  201. },
  202. // header: {
  203. // Authorization: store.state.token,
  204. // },
  205. success: (imgRes) => {
  206. let data = JSON.parse(imgRes.data);
  207. if (data.code == '200') {
  208. if (this.personData.esmUserImageVo.some(v => v.type == 'SFZ_01')) {
  209. this.personData.esmUserImageVo.map(val => {
  210. if (val.imageType == 'SFZ_01') {
  211. val.imageId = data.data.id;
  212. }
  213. })
  214. } else {
  215. this.personData.esmUserImageVo.push({
  216. imageId: data.data.id,
  217. type: "SFZ_01",
  218. })
  219. }
  220. }
  221. }
  222. });
  223. }
  224. },
  225. async userbackChange() {
  226. let [chooseImageErr, chooseImageRes] = await uni.chooseImage({
  227. count: 1,
  228. sizeType: ['compressed']
  229. });
  230. let size = chooseImageRes.tempFiles[0].size / 1024 / 1024 < 5;
  231. if (!size) {
  232. this.$refs.uToast.show({
  233. title: '上传图片大小不能超过 5MB!',
  234. type: 'error',
  235. })
  236. return false
  237. }
  238. if (chooseImageRes) {
  239. this.userbackImg = chooseImageRes.tempFilePaths[0];
  240. uni.uploadFile({
  241. url: this.$base.baseUrl + '/ins/taskImage/uploadFileByPartner',
  242. filePath: chooseImageRes.tempFilePaths[0],
  243. name: "multipartFile",
  244. formData: {
  245. 'type': 'image',
  246. },
  247. // header: {
  248. // Authorization: store.state.token,
  249. // },
  250. success: (imgRes) => {
  251. let data = JSON.parse(imgRes.data);
  252. if (data.code == '200') {
  253. if (this.personData.esmUserImageVo.some(v => v.type == 'SFZ_02')) {
  254. this.personData.esmUserImageVo.map(val => {
  255. if (val.imageType == 'SFZ_02') {
  256. val.imageId = data.data.id;
  257. }
  258. })
  259. } else {
  260. this.personData.esmUserImageVo.push({
  261. imageId: data.data.id,
  262. type: "SFZ_02",
  263. })
  264. }
  265. }
  266. }
  267. });
  268. }
  269. },
  270. },
  271. }
  272. </script>
  273. <style lang="scss" scoped>
  274. .box {
  275. height: 330px;
  276. width: 100%;
  277. background: #F9F9F9;
  278. background: url(/static/image/my/shenqing.png) no-repeat;
  279. background-size: contain;
  280. padding: 130px 15px 0 15px;
  281. // padding: 200px 16px 15px 16px;
  282. }
  283. .box-con {
  284. background: #FFFFFF;
  285. padding: 10px 15px;
  286. border-radius: 5px 5px 5px 5px;
  287. }
  288. .userBox {
  289. border-radius: 5px 5px 5px 5px;
  290. margin: 10px 15px;
  291. padding: 10px 15px;
  292. background: #fff;
  293. font-size: 15px;
  294. color: #666666;
  295. .imgOcr-border {
  296. // position: relative;
  297. width: 48%;
  298. text-align: center;
  299. image {
  300. display: inline-block;
  301. height: 95px;
  302. width: 100%;
  303. }
  304. // .del_btn {
  305. // position: absolute;
  306. // cursor: pointer;
  307. // position: absolute;
  308. // top: 5rpx;
  309. // right: 0;
  310. // width: 50rpx;
  311. // height: 50rpx;
  312. // border-radius: 50%;
  313. // z-index: 20;
  314. // }
  315. }
  316. }
  317. .submit {
  318. margin: 15px;
  319. text-align: center;
  320. color: #fff;
  321. height: 46px;
  322. line-height: 46px;
  323. background: linear-gradient(133deg, #2DD9FF 0%, #2D6DFF 100%);
  324. border-radius: 31px 31px 31px 31px;
  325. }
  326. </style>