普兆健康管家前端代码仓库
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.

241 lines
5.6 KiB

  1. <template>
  2. <view class="page__view">
  3. <navbar title="身份认证" leftClick @leftClick="$utils.navigateBack" color="#191919" bgColor="#FFFFFF" />
  4. <view class="main">
  5. <view class="card">
  6. <view class="card-header">
  7. <view>身份认证</view>
  8. <view class="card-desc">信息仅用于身份认证平台将保障你的信息安全</view>
  9. </view>
  10. <view class="form">
  11. <uv-form
  12. ref="form"
  13. :model="form"
  14. :rules="rules"
  15. errorType="toast"
  16. >
  17. <view class="form-item">
  18. <uv-form-item prop="idFront" :customStyle="formItemStyle">
  19. <view class="form-item-content">
  20. <view class="upload" @click="onUpload('idFront')">
  21. <image v-if="form.idFront" class="upload-img" :src="form.idFront" mode="scaleToFill" />
  22. <view v-else class="flex upload-default">
  23. <image class="upload-default-img" src="@/pages_order/static/order/id-front-default.png" mode="aspectFill" />
  24. </view>
  25. </view>
  26. </view>
  27. <view class="form-item-label">身份证国徽面点击上传</view>
  28. </uv-form-item>
  29. </view>
  30. <view class="form-item">
  31. <uv-form-item prop="idBack" :customStyle="formItemStyle">
  32. <view class="form-item-content">
  33. <view class="upload" @click="onUpload('idBack')">
  34. <image v-if="form.idBack" class="upload-img" :src="form.idBack" mode="scaleToFill" />
  35. <view v-else class="flex upload-default">
  36. <image class="upload-default-img" src="@/pages_order/static/order/id-back-default.png" mode="aspectFill" />
  37. </view>
  38. </view>
  39. </view>
  40. <view class="form-item-label">身份证人像面点击上传</view>
  41. </uv-form-item>
  42. </view>
  43. </uv-form>
  44. </view>
  45. </view>
  46. </view>
  47. <view class="bottom">
  48. <button class="btn" @click="onConfirm">确认</button>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. export default {
  54. data() {
  55. return {
  56. form: {
  57. idFront: null,
  58. idBack: null,
  59. },
  60. rules: {
  61. 'idFront': {
  62. type: 'string',
  63. required: true,
  64. message: '请上传身份证国徽面',
  65. },
  66. 'idBack': {
  67. type: 'string',
  68. required: true,
  69. message: '请上传身份证人像面',
  70. },
  71. },
  72. formItemStyle: { padding: 0 },
  73. }
  74. },
  75. methods: {
  76. onUpload(key) {
  77. uni.chooseImage({
  78. count: 1,
  79. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  80. success: res => {
  81. let avatarUrl = res.tempFilePaths[0] // 将选择的图片赋值给我们定义的cover
  82. this.$Oss.ossUpload(avatarUrl)
  83. .then(url => {
  84. this.form[key] = url
  85. })
  86. }
  87. });
  88. },
  89. async onConfirm() {
  90. try {
  91. const res = await this.$refs.form.validate()
  92. console.log('onSave res', res)
  93. // todo: save
  94. // todo: check
  95. // this.$utils.redirectTo(`/pages_order/order/userInfo/facialVerify`)
  96. this.$utils.redirectTo('/pages_order/order/userInfo/facialVerifyCustom')
  97. } catch (err) {
  98. console.log('onSave err', err)
  99. }
  100. },
  101. },
  102. }
  103. </script>
  104. <style lang="scss" scoped>
  105. .page__view {
  106. width: 100vw;
  107. min-height: 100vh;
  108. background-color: $uni-bg-color;
  109. position: relative;
  110. /deep/ .nav-bar__view {
  111. position: fixed;
  112. top: 0;
  113. left: 0;
  114. }
  115. }
  116. .main {
  117. padding: calc(var(--status-bar-height) + 144rpx) 32rpx 224rpx 32rpx;
  118. }
  119. .card {
  120. padding: 32rpx;
  121. background: #FAFAFF;
  122. border: 2rpx solid #FFFFFF;
  123. border-radius: 32rpx;
  124. & + & {
  125. margin-top: 40rpx;
  126. }
  127. &-header {
  128. font-family: PingFang SC;
  129. font-weight: 500;
  130. font-size: 36rpx;
  131. line-height: 1.4;
  132. color: #252545;
  133. margin-bottom: 48rpx;
  134. }
  135. &-desc {
  136. margin-top: 4rpx;
  137. font-family: PingFang SC;
  138. font-weight: 400;
  139. font-size: 26rpx;
  140. line-height: 1.4;
  141. color: #4E4E69;
  142. }
  143. }
  144. .form {
  145. padding: 8rpx 0 0 0;
  146. &-item {
  147. & + & {
  148. margin-top: 48rpx;
  149. }
  150. &-label {
  151. margin-top: 32rpx;
  152. text-align: center;
  153. font-family: PingFang SC;
  154. font-weight: 400;
  155. font-size: 30rpx;
  156. line-height: 1.4;
  157. color: #4E4E69;
  158. }
  159. }
  160. }
  161. .upload {
  162. position: relative;
  163. width: 100%;
  164. height: 386rpx;
  165. overflow: hidden;
  166. border-radius: 32rpx;
  167. box-shadow: -5rpx -5rpx 10rpx 0 #FFFFFF,
  168. 10rpx 10rpx 20rpx 0 #AAAACC80,
  169. 4rpx 4rpx 10rpx 0 #AAAACC40,
  170. -2rpx -2rpx 5rpx 0 #FFFFFF;
  171. &-img {
  172. width: 100%;
  173. height: 100%;
  174. }
  175. &-default {
  176. width: 100%;
  177. height: 100%;
  178. background-image: linear-gradient(#FAFAFF, #F3F3F3);
  179. &-img {
  180. width: 240rpx;
  181. height: 240rpx;
  182. }
  183. }
  184. }
  185. .bottom {
  186. position: fixed;
  187. left: 0;
  188. bottom: 0;
  189. width: 100vw;
  190. height: 200rpx;
  191. padding: 24rpx 40rpx;
  192. background: #FFFFFF;
  193. box-sizing: border-box;
  194. .btn {
  195. width: 100%;
  196. padding: 16rpx 0;
  197. box-sizing: border-box;
  198. font-family: PingFang SC;
  199. font-weight: 500;
  200. font-size: 36rpx;
  201. line-height: 1;
  202. color: #FFFFFF;
  203. background-image: linear-gradient(to right, #4B348F, #845CFA);
  204. border-radius: 41rpx;
  205. }
  206. }
  207. </style>