applypartner.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  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. console.log(options);
  124. this.grade = options.grade ? options.grade : ''
  125. },
  126. methods: {
  127. //提交注册
  128. submit() {
  129. this.$refs.personData.submit().then(res => {
  130. if (this.id) {
  131. this.$http.post('/user/updateUserInfo1/' + this.id, {
  132. esmUserImageVo: this.personData.esmUserImageVo,
  133. sysUser: this.personData,
  134. sysUserInfo: this.personData,
  135. }).then(res => {
  136. if (res.code == 200) {
  137. let obj = JSON.stringify({
  138. id: this.id,
  139. mobile: this.personData.mobile
  140. });
  141. uni.redirectTo({
  142. url: "/pages/index/success?data=" + obj
  143. })
  144. } else {
  145. uni.showModal({
  146. showCancel: false,
  147. title: res.msg
  148. })
  149. }
  150. })
  151. } else {
  152. this.$http.post('/user/newSaveUserInfoByPartner', {
  153. sysUser: {
  154. ...this.personData,
  155. roleId: "97",
  156. referrerId: this.userInfo.sysUser.userId,
  157. grade: this.grade,
  158. },
  159. esmUserImageVo: this.personData.esmUserImageVo
  160. }).then(res => {
  161. if (res.code == 200) {
  162. let obj = JSON.stringify({
  163. id: res.data.id,
  164. mobile: res.data.mobile
  165. });
  166. uni.redirectTo({
  167. url: "/pages/index/success?data=" + obj
  168. })
  169. } else {
  170. uni.showModal({
  171. showCancel: false,
  172. title: res.msg
  173. })
  174. }
  175. })
  176. }
  177. }).catch(err => {
  178. console.log('err', err);
  179. })
  180. },
  181. async userfrontChange() {
  182. let [chooseImageErr, chooseImageRes] = await uni.chooseImage({
  183. count: 1,
  184. sizeType: ['compressed']
  185. });
  186. let size = chooseImageRes.tempFiles[0].size / 1024 / 1024 < 5;
  187. if (!size) {
  188. this.$refs.uToast.show({
  189. title: '上传图片大小不能超过 5MB!',
  190. type: 'error',
  191. })
  192. return false
  193. }
  194. if (chooseImageRes) {
  195. this.userfrontImg = chooseImageRes.tempFilePaths[0];
  196. uni.uploadFile({
  197. url: this.$base.baseUrl + '/ins/taskImage/uploadFileByPartner',
  198. filePath: chooseImageRes.tempFilePaths[0],
  199. name: "multipartFile",
  200. formData: {
  201. 'type': 'image',
  202. },
  203. // header: {
  204. // Authorization: store.state.token,
  205. // },
  206. success: (imgRes) => {
  207. let data = JSON.parse(imgRes.data);
  208. if (data.code == '200') {
  209. if (this.personData.esmUserImageVo.some(v => v.type == 'SFZ_01')) {
  210. this.personData.esmUserImageVo.map(val => {
  211. if (val.imageType == 'SFZ_01') {
  212. val.imageId = data.data.id;
  213. }
  214. })
  215. } else {
  216. this.personData.esmUserImageVo.push({
  217. imageId: data.data.id,
  218. type: "SFZ_01",
  219. })
  220. }
  221. }
  222. }
  223. });
  224. }
  225. },
  226. async userbackChange() {
  227. let [chooseImageErr, chooseImageRes] = await uni.chooseImage({
  228. count: 1,
  229. sizeType: ['compressed']
  230. });
  231. let size = chooseImageRes.tempFiles[0].size / 1024 / 1024 < 5;
  232. if (!size) {
  233. this.$refs.uToast.show({
  234. title: '上传图片大小不能超过 5MB!',
  235. type: 'error',
  236. })
  237. return false
  238. }
  239. if (chooseImageRes) {
  240. this.userbackImg = chooseImageRes.tempFilePaths[0];
  241. uni.uploadFile({
  242. url: this.$base.baseUrl + '/ins/taskImage/uploadFileByPartner',
  243. filePath: chooseImageRes.tempFilePaths[0],
  244. name: "multipartFile",
  245. formData: {
  246. 'type': 'image',
  247. },
  248. // header: {
  249. // Authorization: store.state.token,
  250. // },
  251. success: (imgRes) => {
  252. let data = JSON.parse(imgRes.data);
  253. if (data.code == '200') {
  254. if (this.personData.esmUserImageVo.some(v => v.type == 'SFZ_02')) {
  255. this.personData.esmUserImageVo.map(val => {
  256. if (val.imageType == 'SFZ_02') {
  257. val.imageId = data.data.id;
  258. }
  259. })
  260. } else {
  261. this.personData.esmUserImageVo.push({
  262. imageId: data.data.id,
  263. type: "SFZ_02",
  264. })
  265. }
  266. }
  267. }
  268. });
  269. }
  270. },
  271. },
  272. }
  273. </script>
  274. <style lang="scss" scoped>
  275. .box {
  276. height: 330px;
  277. width: 100%;
  278. background: #F9F9F9;
  279. background: url(/static/image/my/shenqing.png) no-repeat;
  280. background-size: contain;
  281. padding: 130px 15px 0 15px;
  282. // padding: 200px 16px 15px 16px;
  283. }
  284. .box-con {
  285. background: #FFFFFF;
  286. padding: 10px 15px;
  287. border-radius: 5px 5px 5px 5px;
  288. }
  289. .userBox {
  290. border-radius: 5px 5px 5px 5px;
  291. margin: 10px 15px;
  292. padding: 10px 15px;
  293. background: #fff;
  294. font-size: 15px;
  295. color: #666666;
  296. .imgOcr-border {
  297. // position: relative;
  298. width: 48%;
  299. text-align: center;
  300. image {
  301. display: inline-block;
  302. height: 95px;
  303. width: 100%;
  304. }
  305. // .del_btn {
  306. // position: absolute;
  307. // cursor: pointer;
  308. // position: absolute;
  309. // top: 5rpx;
  310. // right: 0;
  311. // width: 50rpx;
  312. // height: 50rpx;
  313. // border-radius: 50%;
  314. // z-index: 20;
  315. // }
  316. }
  317. }
  318. .submit {
  319. margin: 15px;
  320. text-align: center;
  321. color: #fff;
  322. height: 46px;
  323. line-height: 46px;
  324. background: linear-gradient(133deg, #2DD9FF 0%, #2D6DFF 100%);
  325. border-radius: 31px 31px 31px 31px;
  326. }
  327. </style>