index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  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--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--input
  22. v-model="userRealNameAuth.name"
  23. placeholder="请输入真实姓名"
  24. border="bottom"
  25. type="text"
  26. maxlength="11"
  27. ></u--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--input
  37. v-model="userRealNameAuth.idCard"
  38. disabledColor="#ffffff"
  39. placeholder="请输入身份证号"
  40. border="bottom"
  41. maxlength="20"
  42. ></u--input>
  43. </u-form-item>
  44. </u--form>
  45. </view>
  46. </view>
  47. <!-- 保存备案信息 -->
  48. <view class="uploadBox">
  49. <view v-if="userRealNameAuth.isAudit != 1" @click="saveUserRealNameAuth" class="leftBtn text-white text-lg text-center">下一步</view>
  50. <view v-else class="leftBtn text-white text-lg text-center">审核中不允许修改</view>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="footer"></view>
  55. </view>
  56. </template>
  57. <script>
  58. export default {
  59. components: {
  60. },
  61. data() {
  62. return {
  63. reqParm: {
  64. auth: true,
  65. ossId: null,
  66. },
  67. userRealNameAuth: {
  68. auth: true,
  69. idCard: '',
  70. idCardBack: '',
  71. idCardFront: '',
  72. idCardBackUrl: '',
  73. idCardFrontUrl: '',
  74. name: ''
  75. },
  76. userInfo: {
  77. },
  78. list1: [
  79. '隐私说明:请按要求上传真实的证件照片,您所上传的行驶证仅用于平台账户绑定,请放心上传'
  80. ],
  81. imgUrl1: '',
  82. imgUrl2: '',
  83. show: false,
  84. list: [
  85. ],
  86. rules: {
  87. name: [
  88. {
  89. required: true,
  90. min: 1,
  91. max: 12,
  92. message: '请输入姓名',
  93. trigger: ['blur', 'change'],
  94. },
  95. {
  96. // 此为同步验证,可以直接返回true或者false,如果是异步验证,稍微不同,见下方说明
  97. validator: (rule, value, callback) => {
  98. // 调用uView自带的js验证规则,详见:https://www.uviewui.com/js/test.html
  99. return !this.$isDataEmpty(value);
  100. },
  101. message: "请认真填写姓名",
  102. trigger: ['blur', 'change'],
  103. }
  104. ],
  105. idCard: [
  106. {
  107. required: true,
  108. message: '请输入身份证号',
  109. trigger: ['blur', 'change'],
  110. },
  111. {
  112. // 此为同步验证,可以直接返回true或者false,如果是异步验证,稍微不同,见下方说明
  113. validator: (rule, value, callback) => {
  114. // 调用uView自带的js验证规则,详见:https://www.uviewui.com/js/test.html
  115. return this.$u.test.idCard(value);
  116. },
  117. message: "请认真填写身份证号",
  118. trigger: ['blur', 'change'],
  119. }
  120. ],
  121. },
  122. }
  123. },
  124. onReady() {
  125. // 初始化静音验证
  126. this.$refs.form1.setRules(this.rules)
  127. // 用户信息
  128. let user = uni.getStorageSync('userInfo');
  129. console.log(user,'22222222222222')
  130. this.userRealNameAuth.name = user.name;
  131. this.userRealNameAuth.idCard = user.idCard;
  132. },
  133. onLoad(option) {
  134. },
  135. methods: {
  136. // 保存实名信息
  137. saveUserRealNameAuth(){
  138. let that = this;
  139. that.$refs.form1.validate().then(res => {
  140. // 保存数据
  141. this.$api.userRealNameAuth(this.userRealNameAuth).then((res)=>{
  142. console.log(res)
  143. // 刷新用户信息
  144. uni.setStorageSync('userInfo',res.data.data)
  145. uni.showToast({
  146. title: "操作成功"
  147. })
  148. setTimeout(()=>{
  149. uni.navigateBack({
  150. data:1,
  151. })
  152. },1000)
  153. }).catch((err) =>{
  154. uni.showToast({
  155. icon:'error',
  156. title: err
  157. })
  158. });
  159. }).catch(errors => {
  160. uni.$u.toast('校验失败,请认真填写')
  161. })
  162. },
  163. }
  164. }
  165. </script>
  166. <style scoped lang="scss">
  167. page,body{
  168. background: #fff;
  169. }
  170. .login-wrap {
  171. display: flex;
  172. justify-content: center;
  173. .login-form{
  174. width: 90%;
  175. }
  176. .account{
  177. display: flex;
  178. }
  179. .identifying-code{
  180. }
  181. }
  182. .h-input-wrap{
  183. padding-left: 12px;
  184. padding-right: 12px;
  185. display: flex;
  186. align-items: center;
  187. height: 40px;
  188. font-family: PingFangSC-Regular, PingFang SC;
  189. font-size: 14px;
  190. .h-name{
  191. font-weight: 400;
  192. color: #333333;
  193. line-height: 22px;
  194. margin-right: 6px;
  195. }
  196. .input-style{
  197. border-radius: 4px;
  198. font-weight: 400;
  199. color: #999999;
  200. line-height: 22px;
  201. font-size: 14px;
  202. }
  203. }
  204. page{
  205. background: #F8F8F8;
  206. }
  207. .keep-on-record-wrap{
  208. width: 96%;
  209. margin: 0 auto;
  210. color: #676767;
  211. }
  212. .keep-on-record-content{
  213. margin-top: 12px;
  214. }
  215. .container {
  216. height: 100%;
  217. }
  218. // 图片上传
  219. .uploadBox {
  220. margin: 0 auto;
  221. width: 100%;
  222. text-align: center;
  223. padding-left: 12px;
  224. padding-right: 12px;
  225. margin-top: 12px;
  226. .leftBtn {
  227. height: 42px;
  228. background: #FFE05C;
  229. border-radius: 27px;
  230. color: #333333;
  231. line-height: 42px;
  232. margin-top: 12px;
  233. width: 680rpx;
  234. }
  235. .uploadItem {
  236. width: 100%;
  237. height: 198px;
  238. border-width: 1px;
  239. border-style: dashed;
  240. border-color: #999;
  241. .imgUrl {
  242. width: 100%;
  243. height: 100%;
  244. }
  245. }
  246. .h-desc{
  247. font-size: 12px;
  248. font-family: PingFangSC-Regular, PingFang SC;
  249. font-weight: 400;
  250. color: #666666;
  251. line-height: 50px;
  252. text-align: center;
  253. }
  254. .bg-img1{
  255. background-image: url('https://jje.admin.xinyuekj.com.cn/static/me/u11.png');
  256. background-size: cover;
  257. background-repeat: repeat;
  258. }
  259. .bg-img2{
  260. background-image: url("https://jje.admin.xinyuekj.com.cn/static/me/u12.png");
  261. background-size: cover;
  262. background-repeat: repeat;
  263. }
  264. }
  265. /* 底部 */
  266. .footer{
  267. margin-top: 30px;
  268. height: 160px;
  269. font-size: 12px;
  270. text-align: center;
  271. color: #666;
  272. }
  273. </style>