login-real-name-auth.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  1. <template>
  2. <view class="keep-on-record-wrap">
  3. <!-- 提示内容 -->
  4. <!-- <u-toast ref="uToast" />-->
  5. <!-- <view class="keep-on-record-content">-->
  6. <!-- <view class="container">-->
  7. <!-- <view class="login-wrap">-->
  8. <!-- <view class="login-form">-->
  9. <!-- <u&#45;&#45;form-->
  10. <!-- labelPosition="left"-->
  11. <!-- :model="userRealNameAuth"-->
  12. <!-- :rules="rules"-->
  13. <!-- ref="form1"-->
  14. <!-- >-->
  15. <!-- <u-form-item-->
  16. <!-- label="真实姓名"-->
  17. <!-- prop="name"-->
  18. <!-- labelWidth="auto"-->
  19. <!-- labelAlign="right"-->
  20. <!-- >-->
  21. <!-- <u&#45;&#45;input-->
  22. <!-- v-model="userRealNameAuth.name"-->
  23. <!-- placeholder="请输入真实姓名"-->
  24. <!-- border="bottom"-->
  25. <!-- type="text"-->
  26. <!-- maxlength="11"-->
  27. <!-- ></u&#45;&#45;input>-->
  28. <!-- </u-form-item>-->
  29. <!-- <u-form-item-->
  30. <!-- labelWidth="auto"-->
  31. <!-- labelAlign="right"-->
  32. <!-- label="身份证号"-->
  33. <!-- prop="idCard"-->
  34. <!-- width="120"-->
  35. <!-- >-->
  36. <!-- <u&#45;&#45;input-->
  37. <!-- v-model="userRealNameAuth.idCard"-->
  38. <!-- disabledColor="#ffffff"-->
  39. <!-- placeholder="请输入身份证号"-->
  40. <!-- border="bottom"-->
  41. <!-- maxlength="20"-->
  42. <!-- ></u&#45;&#45;input>-->
  43. <!-- </u-form-item>-->
  44. <!-- </u&#45;&#45;form>-->
  45. <!-- </view>-->
  46. <!-- </view>-->
  47. <!-- <view class="">-->
  48. <!-- <view class="uploadBox">-->
  49. <!-- <view @click="uploadImg1(1)">-->
  50. <!-- <view class="uploadItem bg-img1">-->
  51. <!-- <image class="imgUrl" :src="imgUrl1"></image>-->
  52. <!-- </view>-->
  53. <!-- <view class="h-desc">-->
  54. <!-- <text>点击上传身份证人像面图片</text>-->
  55. <!-- </view>-->
  56. <!-- </view>-->
  57. <!-- <view @click="uploadImg1(2)">-->
  58. <!-- <view class="uploadItem bg-img2">-->
  59. <!-- <image class="imgUrl" :src="imgUrl2"></image>-->
  60. <!-- </view>-->
  61. <!-- <view class="h-desc">-->
  62. <!-- <text>点击上传身份证国徽面图片</text>-->
  63. <!-- </view>-->
  64. <!-- </view>-->
  65. <!-- </view>-->
  66. <!-- </view>-->
  67. <!-- &lt;!&ndash; 保存备案信息 &ndash;&gt;-->
  68. <!-- <view class="uploadBox">-->
  69. <!-- <view v-if="userRealNameAuth.isAudit != 1" @click="saveUserRealNameAuth" class="leftBtn text-white text-lg text-center">下一步</view>-->
  70. <!-- <view v-else class="leftBtn text-white text-lg text-center">审核中不允许修改</view>-->
  71. <!-- </view>-->
  72. <!-- </view>-->
  73. <!-- </view>-->
  74. <!-- <view class="footer"></view>-->
  75. <!-- <u-popup :show="errShow" :round="10" mode="center" >-->
  76. <!-- <view class="h-popo-content">-->
  77. <!-- <view class="h-img">-->
  78. <!-- &lt;!&ndash; <u-icon name="close" color="red" size="40"></u-icon> &ndash;&gt;-->
  79. <!-- <u-icon name="/static/login/u01.png" color="red" size="50"></u-icon>-->
  80. <!-- </view>-->
  81. <!-- <view class="h-text">-->
  82. <!-- <text>该身份证号已开通实名认证</text>-->
  83. <!-- </view>-->
  84. <!-- <view class="h-text">-->
  85. <!-- <text>无法继续操作</text>-->
  86. <!-- </view>-->
  87. <!-- <view class="h-btn-wrap">-->
  88. <!-- <view @click="surebtn()" class="h-right-btn">-->
  89. <!-- <text>确定</text>-->
  90. <!-- </view>-->
  91. <!-- </view>-->
  92. <!-- </view>-->
  93. <!-- </u-popup>-->
  94. </view>
  95. </template>
  96. <script>
  97. export default {
  98. components: {
  99. },
  100. data() {
  101. return {
  102. errShow: false,
  103. userRealNameAuth: {
  104. auth: true,
  105. idCard: '',
  106. idCardBack: '',
  107. idCardFront: '',
  108. name: '',
  109. phone: '',
  110. openId: '',
  111. type: ''
  112. },
  113. userInfo: {
  114. },
  115. list1: [
  116. '隐私说明:请按要求上传真实的证件照片,您所上传的行驶证仅用于平台账户绑定,请放心上传'
  117. ],
  118. imgUrl1: '',
  119. imgUrl2: '',
  120. show: false,
  121. list: [
  122. ],
  123. queryParms: {
  124. userId:'',
  125. extId: 1
  126. },
  127. rules: {
  128. name: [
  129. {
  130. required: true,
  131. min: 1,
  132. max: 12,
  133. message: '请输入姓名',
  134. trigger: ['blur', 'change'],
  135. },
  136. {
  137. // 此为同步验证,可以直接返回true或者false,如果是异步验证,稍微不同,见下方说明
  138. validator: (rule, value, callback) => {
  139. // 调用uView自带的js验证规则,详见:https://www.uviewui.com/js/test.html
  140. return !this.$isDataEmpty(value);
  141. },
  142. message: "请认真填写姓名",
  143. trigger: ['blur', 'change'],
  144. }
  145. ],
  146. idCard: {
  147. required: true,
  148. min: 16,
  149. max: 20,
  150. message: '请输入身份证号',
  151. trigger: ['blur', 'change'],
  152. },
  153. },
  154. }
  155. },
  156. onReady() {
  157. // 初始化静音验证
  158. this.$refs.form1.setRules(this.rules)
  159. },
  160. onLoad(option) {
  161. console.log("999999999999999999")
  162. console.log(option)
  163. // 判断Openid是否为空
  164. if(!this.$isDataEmpty(option.data)){
  165. let udata = JSON.parse(option.data);
  166. this.userRealNameAuth.openId = udata.openId;
  167. this.userRealNameAuth.phone = udata.phonenumber;
  168. // 判断Openid是否为空
  169. this.userRealNameAuth.type = udata.type;
  170. }
  171. },
  172. methods: {
  173. // 确定
  174. surebtn(){
  175. this.errShow = false,
  176. uni.$u.route({
  177. url: '/pages/login/login',
  178. params: {
  179. }
  180. })
  181. },
  182. // 保存实名信息
  183. saveUserRealNameAuth(){
  184. let that = this;
  185. console.log(this.userRealNameAuth)
  186. if(!this.userRealNameAuth.idCardFront){
  187. uni.showToast({
  188. title: '请上传身份证正面',
  189. })
  190. return;
  191. }
  192. if(!this.userRealNameAuth.idCardBack){
  193. uni.showToast({
  194. title: '请上传身份证背面'
  195. })
  196. return;
  197. }
  198. that.$refs.form1.validate().then(res => {
  199. // 验证数据
  200. this.$api.idCardIsExist({data:this.userRealNameAuth}).then((res)=>{
  201. console.log(res)
  202. if(res.idCardIsExist){
  203. this.errShow = true;
  204. } else {
  205. uni.navigateTo({
  206. url: '/loginPages/login/bind-account-password?data='+JSON.stringify(that.userRealNameAuth)
  207. })
  208. }
  209. }).catch(() =>{
  210. uni.showToast({
  211. title: "操作失败"
  212. })
  213. });
  214. }).catch(errors => {
  215. uni.$u.toast('校验失败,请认真填写')
  216. })
  217. },
  218. //头像上传
  219. uploadImg1(imgIndex) {
  220. let that = this;
  221. uni.chooseImage({
  222. count: 1,
  223. success: (chooseImageRes) => {
  224. const tempFilePaths = chooseImageRes.tempFilePaths;
  225. uni.uploadFile({
  226. url: that.$host + '/resource/oss/upload', //仅为示例,非真实的接口地址
  227. filePath: tempFilePaths[0],
  228. name: 'file',
  229. header: {
  230. // "Content-Type": "multipart/form-data",
  231. // 'X-Access-Token': uni.getStorageSync('token'),
  232. 'Authorization': 'Bearer ' + that.$store.state.loginState.accessToken,
  233. },
  234. success: (uploadFileRes) => {
  235. let res = JSON.parse(uploadFileRes.data)
  236. console.log(res.data)
  237. if(imgIndex == 1){ // 身份证正面
  238. that.imgUrl1 = tempFilePaths[0];
  239. that.userRealNameAuth.idCardFront = res.data.ossId
  240. that.reqParm.ossId = res.data.ossId
  241. }
  242. if(imgIndex == 2){ // 微信证背面
  243. that.imgUrl2 = tempFilePaths[0];;
  244. that.userRealNameAuth.idCardBack = res.data.ossId
  245. }
  246. }
  247. });
  248. }
  249. });
  250. }
  251. }
  252. }
  253. </script>
  254. <style scoped lang="scss">
  255. page,body{
  256. background: #fff;
  257. }
  258. // 弹出框
  259. .h-popo-content{
  260. height: 190px;
  261. padding: 12px;
  262. width: 300px;
  263. text-align: center;
  264. font-size: 14px;
  265. font-family: PingFangSC-Semibold, PingFang SC;
  266. .h-img{
  267. display: flex;
  268. justify-content: center;
  269. }
  270. .h-text{
  271. margin-top: 12px;
  272. font-weight: 400;
  273. color: #666666;
  274. }
  275. .text{
  276. margin-top: 6px;
  277. font-weight: 400;
  278. color: #666666;
  279. }
  280. .h-btn-wrap{
  281. display: flex;
  282. justify-content: space-between;
  283. color: #333333;
  284. text-align: center;
  285. margin-top: 14px;
  286. .h-left-btn{
  287. height: 32px;
  288. line-height: 30px;
  289. background: #EEEEEE;
  290. width: 100px;
  291. text-align: center;
  292. border-radius: 16px;
  293. margin: 0 auto;
  294. }
  295. .h-right-btn{
  296. height: 32px;
  297. line-height: 30px;
  298. background: #FFE05C;
  299. width: 100px;
  300. border-radius: 16px;
  301. margin: 0 auto;
  302. }
  303. }
  304. }
  305. .login-wrap {
  306. display: flex;
  307. justify-content: center;
  308. .login-form{
  309. width: 90%;
  310. }
  311. .account{
  312. display: flex;
  313. }
  314. .identifying-code{
  315. }
  316. }
  317. .h-input-wrap{
  318. padding-left: 12px;
  319. padding-right: 12px;
  320. display: flex;
  321. align-items: center;
  322. height: 40px;
  323. font-family: PingFangSC-Regular, PingFang SC;
  324. font-size: 14px;
  325. .h-name{
  326. font-weight: 400;
  327. color: #333333;
  328. line-height: 22px;
  329. margin-right: 6px;
  330. }
  331. .input-style{
  332. border-radius: 4px;
  333. font-weight: 400;
  334. color: #999999;
  335. line-height: 22px;
  336. font-size: 14px;
  337. }
  338. }
  339. .keep-on-record-wrap{
  340. width: 96%;
  341. margin: 0 auto;
  342. color: #676767;
  343. }
  344. .keep-on-record-content{
  345. margin-top: 12px;
  346. }
  347. .container {
  348. height: 100%;
  349. }
  350. // 图片上传
  351. .uploadBox {
  352. margin: 0 auto;
  353. width: 100%;
  354. padding-left: 12px;
  355. padding-right: 12px;
  356. margin-top: 12px;
  357. .leftBtn {
  358. height: 42px;
  359. background: #FFE05C;
  360. border-radius: 27px;
  361. color: #333333;
  362. line-height: 42px;
  363. margin-top: 12px;
  364. }
  365. .uploadItem {
  366. width: 100%;
  367. height: 198px;
  368. border-width: 1px;
  369. border-style: dashed;
  370. border-color: #999;
  371. .imgUrl {
  372. width: 100%;
  373. height: 100%;
  374. }
  375. }
  376. .h-desc{
  377. font-size: 12px;
  378. font-family: PingFangSC-Regular, PingFang SC;
  379. font-weight: 400;
  380. color: #666666;
  381. line-height: 50px;
  382. text-align: center;
  383. }
  384. .bg-img1{
  385. background-image: url('http://222.85.201.140:10000/static/me/u11.png');
  386. background-size: cover;
  387. background-repeat: repeat;
  388. }
  389. .bg-img2{
  390. background-image: url("http://222.85.201.140:10000/static/me/u12.png");
  391. background-size: cover;
  392. background-repeat: repeat;
  393. }
  394. }
  395. /* 底部 */
  396. .footer{
  397. margin-top: 30px;
  398. height: 160px;
  399. font-size: 12px;
  400. text-align: center;
  401. color: #666;
  402. }
  403. </style>