index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <view class="status_bar"><!-- 这里是状态栏 --></view>
  5. <view class="body-title">
  6. <view class="goback-box">
  7. </view>
  8. <view class="header">实名认证</view>
  9. </view>
  10. <view class="content-bg">
  11. <image src="../../users/static/sm.png" mode=""></image>
  12. </view>
  13. </view>
  14. <view class="yanzheng">
  15. <view class="top">
  16. <view class="tex">真实姓名</view>
  17. <input class="inp" type="text" placeholder="请输入真实姓名" v-model="name" required />
  18. </view>
  19. <view class="top">
  20. <view class="tex">身份证号</view>
  21. <input class="inp" type="text" placeholder="请输入身份证号" v-model="num" required />
  22. </view>
  23. </view>
  24. <view class="sc">
  25. <view class="poto">上传人脸正面照片</view>
  26. <image class="pto" @click="uploadpic" :src="image||`../../users/static/pto.png`" mode="widthFix"></image>
  27. </view>
  28. <view class="btn">
  29. <button class="bt" :class="{loding:uploding}" @click="uploding?'':setCheck()">立即认证</button>
  30. </view>
  31. <canvas canvas-id="canvas" v-if="canvasStatus"
  32. :style="{width: canvasWidth + 'px', height: canvasHeight + 'px',position: 'absolute',left:'-100000px',top:'-100000px'}"></canvas>
  33. </view>
  34. </template>
  35. <script>
  36. import {
  37. setCheck,
  38. getCheckMy
  39. } from "@/api/newapi";
  40. export default {
  41. data() {
  42. return {
  43. name: '',
  44. num: '',
  45. image: '',
  46. canvasWidth: "",
  47. canvasHeight: "",
  48. canvasStatus: false,
  49. uploding:false,//是否不允许提交
  50. };
  51. },
  52. onLoad() {
  53. getCheckMy().then(
  54. (res) => {
  55. console.log(res)
  56. if(res.data){
  57. if(res.data.info){
  58. if(res.data.info.status==0){
  59. this.uploding = true;
  60. uni.showModal({
  61. title: '提示',
  62. content: '正在审核中',
  63. showCancel: false,
  64. });
  65. }
  66. if(res.data.info.status==1){
  67. this.uploding = true;
  68. this.name = res.data.info.real_name;
  69. this.num = res.data.info.id_card;
  70. this.image = res.data.info.image;
  71. uni.showModal({
  72. title: '提示',
  73. content: '审核已通过',
  74. showCancel: false,
  75. });
  76. }
  77. if(res.data.info.status==-1){
  78. this.uploding = true;
  79. uni.showModal({
  80. title: '提示',
  81. content: '审核未通过,原因:'+res.data.info.fail_msg,
  82. showCancel: false,
  83. });
  84. }
  85. }
  86. }
  87. }
  88. )
  89. },
  90. onShow() {
  91. },
  92. methods: {
  93. setCheck() {
  94. uni.showLoading({
  95. title: '提交中。。。',
  96. mask: true
  97. });
  98. setCheck({
  99. real_name: this.name,
  100. id_card: this.num,
  101. image: this.image
  102. }).then((res) => {
  103. uni.showToast({
  104. title:res.msg,
  105. duration:2000
  106. })
  107. }).catch((err) => {
  108. uni.showToast({
  109. title: err,
  110. icon: 'none'
  111. });
  112. })
  113. },
  114. /**
  115. * 上传文件
  116. *
  117. */
  118. uploadpic: function() {
  119. let that = this;
  120. this.canvasStatus = true
  121. that.$util.uploadImageChange('upload/image', function(res) {
  122. that.image = res.data.url;
  123. }, (res) => {
  124. this.canvasStatus = false
  125. }, (res) => {
  126. this.canvasWidth = res.w
  127. this.canvasHeight = res.h
  128. });
  129. },
  130. }
  131. };
  132. </script>
  133. <style lang="scss">
  134. page {
  135. background: #fff;
  136. height: 100%;
  137. }
  138. .status_bar {
  139. height: var(--status-bar-height);
  140. width: 100%;
  141. }
  142. .content-money {
  143. height: 480rpx;
  144. .content-bg {
  145. position: absolute;
  146. top: 0;
  147. left: 0;
  148. right: 0;
  149. width: 750rpx;
  150. height: 480rpx;
  151. image {
  152. width: 100%;
  153. height: 100%;
  154. }
  155. }
  156. .body-title {
  157. height: 80rpx;
  158. text-align: center;
  159. font-size: 35rpx;
  160. position: relative;
  161. .header {
  162. position: absolute;
  163. left: 0;
  164. top: 0;
  165. width: 100%;
  166. font-size: 36rpx;
  167. font-family: PingFang SC;
  168. font-weight: bold;
  169. color: #fff;
  170. height: 80rpx;
  171. font-size: 36rpx;
  172. font-weight: 700;
  173. z-index: 9;
  174. display: flex;
  175. justify-content: center;
  176. align-items: center;
  177. }
  178. .goback-box {
  179. position: absolute;
  180. left: 18rpx;
  181. top: 0;
  182. height: 80rpx;
  183. display: flex;
  184. align-items: center;
  185. }
  186. .goback {
  187. z-index: 100;
  188. width: 34rpx;
  189. height: 34rpx;
  190. }
  191. }
  192. }
  193. .yanzheng {
  194. width: 660rpx;
  195. height: 220rpx;
  196. background-color: #fff;
  197. margin-left: 45rpx;
  198. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  199. border-radius: 20rpx;
  200. margin: -100rpx auto 0;
  201. position: relative;
  202. z-index: 2;
  203. .top {
  204. display: flex;
  205. justify-content: start;
  206. padding-top: 40rpx;
  207. .tex {
  208. size: 50rpx;
  209. padding-left: 25rpx;
  210. padding-top: 5rpx;
  211. }
  212. .inp {
  213. padding-left: 25rpx;
  214. }
  215. }
  216. }
  217. .sc {
  218. width: 660rpx;
  219. height: 400rpx;
  220. background-color: #fff;
  221. margin-top: 20rpx;
  222. margin-left: 45rpx;
  223. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  224. border-radius: 20rpx;
  225. .poto {
  226. padding-top: 30rpx;
  227. margin-left: 25rpx;
  228. size: 50rpx;
  229. }
  230. .pto {
  231. width: 312rpx;
  232. min-height: 202rpx;
  233. margin-left: 175rpx;
  234. margin-top: 60rpx;
  235. }
  236. }
  237. .bt {
  238. width: 650rpx;
  239. background: linear-gradient(90deg, #ff8f3b, #ff3107);
  240. border-radius: 45rpx;
  241. margin-top: 90rpx;
  242. margin-left: 38rpx;
  243. color: #fff;
  244. height: 80rpx !important;
  245. line-height: 80rpx !important;
  246. &.loding{
  247. background: #e3e3e3;
  248. }
  249. }
  250. </style>