index.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  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. required: true,
  107. min: 16,
  108. max: 20,
  109. message: '请输入身份证号',
  110. trigger: ['blur', 'change'],
  111. },
  112. },
  113. }
  114. },
  115. onReady() {
  116. // 初始化静音验证
  117. this.$refs.form1.setRules(this.rules)
  118. // 用户信息
  119. let user = uni.getStorageSync('userInfo');
  120. console.log(user,'22222222222222')
  121. this.userRealNameAuth.name = user.name;
  122. this.userRealNameAuth.idCard = user.idCard;
  123. },
  124. onLoad(option) {
  125. },
  126. methods: {
  127. // 保存实名信息
  128. saveUserRealNameAuth(){
  129. let that = this;
  130. that.$refs.form1.validate().then(res => {
  131. // 保存数据
  132. this.$api.userRealNameAuth(this.userRealNameAuth).then((res)=>{
  133. console.log(res)
  134. // 刷新用户信息
  135. uni.setStorageSync('userInfo',res.data.data)
  136. uni.showToast({
  137. title: "操作成功"
  138. })
  139. setTimeout(()=>{
  140. uni.switchTab({
  141. url: '/pages/my/index',
  142. })
  143. },1000)
  144. }).catch((err) =>{
  145. uni.showToast({
  146. icon:'error',
  147. title: err
  148. })
  149. });
  150. }).catch(errors => {
  151. uni.$u.toast('校验失败,请认真填写')
  152. })
  153. },
  154. }
  155. }
  156. </script>
  157. <style scoped lang="scss">
  158. page,body{
  159. background: #fff;
  160. }
  161. .login-wrap {
  162. display: flex;
  163. justify-content: center;
  164. .login-form{
  165. width: 90%;
  166. }
  167. .account{
  168. display: flex;
  169. }
  170. .identifying-code{
  171. }
  172. }
  173. .h-input-wrap{
  174. padding-left: 12px;
  175. padding-right: 12px;
  176. display: flex;
  177. align-items: center;
  178. height: 40px;
  179. font-family: PingFangSC-Regular, PingFang SC;
  180. font-size: 14px;
  181. .h-name{
  182. font-weight: 400;
  183. color: #333333;
  184. line-height: 22px;
  185. margin-right: 6px;
  186. }
  187. .input-style{
  188. border-radius: 4px;
  189. font-weight: 400;
  190. color: #999999;
  191. line-height: 22px;
  192. font-size: 14px;
  193. }
  194. }
  195. page{
  196. background: #F8F8F8;
  197. }
  198. .keep-on-record-wrap{
  199. width: 96%;
  200. margin: 0 auto;
  201. color: #676767;
  202. }
  203. .keep-on-record-content{
  204. margin-top: 12px;
  205. }
  206. .container {
  207. height: 100%;
  208. }
  209. // 图片上传
  210. .uploadBox {
  211. margin: 0 auto;
  212. width: 100%;
  213. text-align: center;
  214. padding-left: 12px;
  215. padding-right: 12px;
  216. margin-top: 12px;
  217. .leftBtn {
  218. height: 42px;
  219. background: #FFE05C;
  220. border-radius: 27px;
  221. color: #333333;
  222. line-height: 42px;
  223. margin-top: 12px;
  224. }
  225. .uploadItem {
  226. width: 100%;
  227. height: 198px;
  228. border-width: 1px;
  229. border-style: dashed;
  230. border-color: #999;
  231. .imgUrl {
  232. width: 100%;
  233. height: 100%;
  234. }
  235. }
  236. .h-desc{
  237. font-size: 12px;
  238. font-family: PingFangSC-Regular, PingFang SC;
  239. font-weight: 400;
  240. color: #666666;
  241. line-height: 50px;
  242. text-align: center;
  243. }
  244. .bg-img1{
  245. background-image: url('https://jje.admin.xinyuekj.com.cn/static/me/u11.png');
  246. background-size: cover;
  247. background-repeat: repeat;
  248. }
  249. .bg-img2{
  250. background-image: url("https://jje.admin.xinyuekj.com.cn/static/me/u12.png");
  251. background-size: cover;
  252. background-repeat: repeat;
  253. }
  254. }
  255. /* 底部 */
  256. .footer{
  257. margin-top: 30px;
  258. height: 160px;
  259. font-size: 12px;
  260. text-align: center;
  261. color: #666;
  262. }
  263. </style>