You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

281 lines
6.3 KiB

8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
  1. <template>
  2. <view class="content">
  3. <mNavbar title="实名认证" :leftClick="leftClick" />
  4. <view class="item-card">
  5. <view class="flex">
  6. <view class="head-line"/>
  7. <view class="tt">姓名</view>
  8. </view>
  9. <view class="from-line">
  10. <input placeholder="请输入姓名" v-model="form.name"/>
  11. </view>
  12. </view>
  13. <view class="item-card">
  14. <view class="flex">
  15. <view class="head-line"/>
  16. <view class="tt">身份证号码</view>
  17. </view>
  18. <view class="from-line">
  19. <input placeholder="请输入身份证号码" v-model="form.idCard"/>
  20. </view>
  21. </view>
  22. <view class="item-card">
  23. <view class="flex">
  24. <view class="head-line"/>
  25. <view class="tt">身份证正面上传</view>
  26. </view>
  27. <view :class="{ii : !form.idImg}" style="width: 172rpx;
  28. margin-top: 40rpx;" @click="selectImage('idImg')">
  29. <image :src="form.idImg" mode="aspectFill" class="ii-image"></image>
  30. </view>
  31. </view>
  32. <view class="item-card">
  33. <view class="flex">
  34. <view class="head-line"/>
  35. <view class="tt">身份证反面上传</view>
  36. </view>
  37. <view :class="{ii : !form.idImg2}" style="width: 172rpx;
  38. margin-top: 40rpx;" @click="selectImage('idImg2')">
  39. <image :src="form.idImg2" mode="aspectFill" class="ii-image"></image>
  40. </view>
  41. </view>
  42. <view class="item-card">
  43. <view class="flex">
  44. <view class="head-line"/>
  45. <view class="tt">健康证上传</view>
  46. </view>
  47. <view :class="{ii : !form.idImage}" style="width: 172rpx;
  48. margin-top: 40rpx;" @click="selectImage('idImage')">
  49. <image :src="form.idImage" mode="aspectFill" class="ii-image"></image>
  50. </view>
  51. </view>
  52. <view class="item-card">
  53. <view class="flex">
  54. <view class="head-line"/>
  55. <view class="tt">营业证上传</view>
  56. </view>
  57. <view :class="{ii : !form.idImage2}" style="width: 172rpx;
  58. margin-top: 40rpx;" @click="selectImage('idImage2')">
  59. <image :src="form.idImage2" mode="aspectFill" class="ii-image"></image>
  60. </view>
  61. </view>
  62. <view class="b-fiexd">
  63. <view class="button-submit" @click="submit">提交</view>
  64. </view>
  65. </view>
  66. </template>
  67. <script>
  68. import mNavbar from '@/components/base/m-navbar.vue'
  69. export default {
  70. components: {
  71. mNavbar,
  72. },
  73. data() {
  74. return {
  75. form : {
  76. idImage : '',
  77. idImg : '',
  78. idImg2 : '',
  79. idCard : '',
  80. name : '',
  81. idImage2 : ''
  82. }
  83. }
  84. },
  85. onShow() {
  86. this.getTenRealName()
  87. },
  88. methods: {
  89. getTenRealName(){
  90. this.$api('getTenRealName', {}, res => {
  91. if(res.code == 200 && res.result){
  92. this.form = res.result
  93. }
  94. })
  95. },
  96. selectImage(key){
  97. uni.chooseImage({
  98. count: 1, // 默认9,设置为1表示单选
  99. sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
  100. sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
  101. success: (res) => {
  102. //上传单张图片逻辑
  103. this.uploadFileToOSS(res.tempFiles[0]).then(imgPath => {
  104. this.form[key] = imgPath;
  105. })
  106. }
  107. });
  108. },
  109. parameterVerification(){ //验证用户参数合法性
  110. let { name , idCard , idImage , idImg , idImg2 , idImage2 } = this.form
  111. if(name && name.trim() == ''){
  112. return { title : '请填写用户名' , auth : false }
  113. }else if(idCard && idCard.trim() == ''){
  114. return { title : '请填写身份证号码' , auth : false }
  115. }else if(!idImg || idImg.trim() == ''){
  116. return { title : '请上传身份证正面' , auth : false }
  117. }else if(!idImg2 || idImg2.trim() == ''){
  118. return { title : '请上传身份证反面' , auth : false }
  119. }else if(!idImage || idImage.trim() == ''){
  120. return { title : '请上传健康证' , auth : false }
  121. }else if(!idImage2 || idImage2.trim() == ''){
  122. return { title : '请上传营业证' , auth : false }
  123. }
  124. return { title : '验证通过' , auth : true }
  125. },
  126. submit(){
  127. let isOk = this.parameterVerification()
  128. if(!isOk.auth){
  129. return uni.showToast({
  130. title : isOk.title,
  131. icon : 'none'
  132. })
  133. }
  134. this.$api('tenRealName', this.form, res => {
  135. if (res.code == 200) {
  136. uni.showToast({
  137. title : '认证成功',
  138. icon : 'none'
  139. })
  140. setTimeout(() => {
  141. uni.switchTab({
  142. url: '/pages/index/center'
  143. })
  144. }, 1000)
  145. }
  146. })
  147. },
  148. clickBanner(){ uni.navigateTo({ url: '/pages/login/login' }) },
  149. clickInfo(id){ uni.navigateTo({ url: `/pages/index/infod?id=${id}`}) },
  150. leftClick(){ uni.switchTab({
  151. url: '/pages/index/center'
  152. }) },
  153. }
  154. }
  155. </script>
  156. <style scoped>
  157. .content{
  158. padding-bottom: 100rpx;
  159. }
  160. body{
  161. background-color: #f3f3f3;
  162. }
  163. .from-line {
  164. margin-top: 40rpx;
  165. }
  166. .from-body{
  167. background-color: #fff;
  168. display: flex;
  169. flex-direction: column;
  170. align-items: center;
  171. }
  172. .from-body input {
  173. width: 612rpx;
  174. height: 90rpx;
  175. line-height: 90rpx;
  176. background: #f5f5f5;
  177. border-radius: 46rpx;
  178. padding: 0 50rpx;
  179. font-size: 28rpx;
  180. font-family: PingFang SC, PingFang SC-Regular;
  181. font-weight: 400;
  182. text-align: left;
  183. color: #333;
  184. margin: 10rpx;
  185. }
  186. .head-line{
  187. width: 8rpx;
  188. height: 34rpx;
  189. background: #60bda2;
  190. border-radius: 4rpx;
  191. margin: 8rpx 0;
  192. }
  193. .item-card{
  194. position: relative;
  195. padding: 40rpx 48rpx;
  196. background-color: #fff;
  197. margin-bottom: 20rpx;
  198. width: 100vw;
  199. border-radius: 15rpx;
  200. overflow: hidden;
  201. }
  202. .button-submit{
  203. width: 596rpx;
  204. height: 90rpx;
  205. line-height: 90rpx;
  206. background: linear-gradient(180deg,#6fdfbe, #5ac796);
  207. border-radius: 46rpx;
  208. margin: 20rpx auto;
  209. font-size: 28rpx;
  210. font-family: PingFang SC, PingFang SC-Regular;
  211. font-weight: 400;
  212. text-align: center;
  213. color: #ffffff;
  214. }
  215. .tt{
  216. line-height: 48rpx;
  217. font-size: 28rpx;
  218. font-family: PingFang SC, PingFang SC-Bold;
  219. font-weight: 700;
  220. text-align: left;
  221. color: #333333;
  222. padding-left: 14rpx;
  223. }
  224. .ii{
  225. width: 172rpx;
  226. height: 172rpx;
  227. background-color: #f4f4f4;
  228. border-radius: 16rpx;
  229. margin-top: 40rpx;
  230. position: relative;
  231. }
  232. .ii-image{
  233. width: 172rpx;
  234. height: 172rpx;
  235. }
  236. .ii::after{
  237. content: " ";
  238. width: 8rpx;
  239. height: 50rpx;
  240. background-color: #dfdfdf;
  241. position: absolute;
  242. top: calc(172rpx / 2 - 25rpx);
  243. left: calc(172rpx / 2 - 4rpx);
  244. }
  245. .ii::before{
  246. content: " ";
  247. width: 50rpx;
  248. height: 8rpx;
  249. background-color: #dfdfdf;
  250. position: absolute;
  251. top: calc(172rpx / 2 - 4rpx);
  252. left: calc(172rpx / 2 - 25rpx);
  253. }
  254. </style>