详情小程序
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.

227 lines
5.9 KiB

  1. <template>
  2. <view class="lf-w-100 lf-h-100">
  3. <view class="lf-row-between lf-p-t-30 lf-p-b-30 lf-p-l-32 lf-p-r-32 title-border">
  4. <view class="input-title">
  5. <text style="color: #E21196;">*</text>
  6. <text class="lf-m-l-10" style="color: #131315;">真实姓名</text>
  7. </view>
  8. <view>
  9. <input type="text" placeholder="请填写真实姓名" style="text-align: right;" />
  10. </view>
  11. </view>
  12. <view class="lf-row-between lf-p-t-30 lf-p-b-30 lf-p-l-32 lf-p-r-32">
  13. <view class="input-title">
  14. <text style="color: #E21196;">*</text>
  15. <text class="lf-m-l-10" style="color: #131315;">身份证号</text>
  16. </view>
  17. <view>
  18. <input type="text" placeholder="请填写身份证号" style="text-align: right;" />
  19. </view>
  20. </view>
  21. <view class="flr"></view>
  22. <view>
  23. <view class="lf-color-777 lf-font-32 lf-p-t-30 lf-p-b-30 lf-p-l-32">
  24. 请根据示例图上传清晰照片
  25. </view>
  26. <view class="authen-pic">
  27. <view>
  28. <image src="../../static/logo.png" mode="aspectFill" style="width: 200rpx;height: 135rpx;"></image>
  29. </view>
  30. <view @tap="ChooseImage">
  31. <view>
  32. <u-icon name="camera-fill" style="font-size: 80rpx;"></u-icon>
  33. </view>
  34. <view class="lf-color-999 lf-font-24">点击上传照片</view>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="lf-row-center lf-font-28 lf-m-t-20">
  39. <text style="color: #E21196;">*</text><text class="lf-m-l-10 lf-color-222">上传身份证正面</text>
  40. </view>
  41. <view class="authen-pic" style="margin-top: 60rpx;">
  42. <view>
  43. <image src="../../static/logo.png" mode="aspectFill" style="width: 200rpx;height: 135rpx;"></image>
  44. </view>
  45. <view @tap="ChooseImage">
  46. <view>
  47. <u-icon name="camera-fill" style="font-size: 80rpx;"></u-icon>
  48. </view>
  49. <view class="lf-color-999 lf-font-24">点击上传照片</view>
  50. </view>
  51. </view>
  52. <view class="lf-row-center lf-font-28 lf-m-t-20">
  53. <text style="color: #E21196;">*</text><text class="lf-m-l-10 lf-color-222">上传身份证反面</text>
  54. </view>
  55. <view class="apply-btn">
  56. 申请认证
  57. </view>
  58. </view>
  59. </template>
  60. <script>
  61. export default {
  62. data() {
  63. return {
  64. hostImg: '',
  65. frontPic: '',
  66. backPic: ''
  67. }
  68. },
  69. methods: {
  70. checkImgInfo(tempFilePath, suc){
  71. uni.getImageInfo({
  72. src: tempFilePath,
  73. success (res) {
  74. let type = res.type;
  75. console.log('checkImgInfo...', type);
  76. if(type == 'png' || type == 'jpeg' || type == 'jpg'){
  77. suc && suc(true);
  78. } else {
  79. suc && suc(false);
  80. }
  81. },
  82. fail(err) {
  83. suc && suc(false);
  84. }
  85. })
  86. },
  87. // 选择图片
  88. ChooseImage(e) {
  89. let that = this;
  90. uni.chooseImage({
  91. count: 1,
  92. sizeType: ['original'], // 可以指定是原图original还是压缩图compressed ,默认二者都有
  93. sourceType: ['album', 'camera'], // album 从相册选图,camera 使用相机,默认二者都有
  94. success: res => {
  95. that.hostImg = res.tempFilePaths[0];
  96. let tempFile = res.tempFiles.shift();
  97. let tempFilePath = res.tempFilePaths.shift();
  98. console.log('临时路径',res)
  99. that.checkImgInfo(tempFilePath, (res) => {
  100. // 过滤不是图片不是png、jpeg 格式
  101. if(res){
  102. if(tempFile.size > 10000000){
  103. uni.showModal({
  104. title: '',
  105. content: '您选择的图片过大:'+ (tempFile.size / 1024000).toFixed(2) +"M,请点击确定重新上传",
  106. success: res2 => {
  107. if(res2.confirm){
  108. uni.chooseImage({
  109. count: 1,
  110. sizeType: ['compressed'],
  111. sourceType: ['album', 'camera'],
  112. success: (res3) => {
  113. console.log(res3)
  114. let tempFilePath = res3.tempFilePaths.shift();
  115. that.frontPic = res3.tempFilePaths
  116. that.is_wx_reduce = true;
  117. }
  118. })
  119. }
  120. }
  121. })
  122. } else{
  123. that.frontPic = res3.tempFilePaths
  124. }
  125. } else {
  126. uni.showModal({
  127. title: '',
  128. content: '选择的图片须为jpg、jpeg或png格式',
  129. showCancel: false,
  130. confirmColor: '#1697EE'
  131. })
  132. }
  133. });
  134. }
  135. });
  136. },
  137. // 上传图片到服务器
  138. upload(url){
  139. let that = this;
  140. let uploads = [];
  141. // 商品banner图上传
  142. if (that.img_list.length > 0) {
  143. for (let i = 0; i < that.img_list.length; i++) {
  144. let upload_img = new Promise((resolve, reject) => {
  145. that.uploadFile(that.img_list[i], (res) => {
  146. resolve(res);
  147. }, (err) => {
  148. reject(err);
  149. });
  150. })
  151. uploads.push(upload_img);
  152. }
  153. }
  154. if(uploads.length == 0) {
  155. that.realSubmitInfo([]);
  156. return
  157. }
  158. Promise.all(uploads).then((result) => {
  159. let img_url_list = [];
  160. if(result.length > 0){
  161. img_url_list = result;
  162. }
  163. if(img_url_list) {
  164. that.realSubmitInfo(img_url_list);
  165. }
  166. }).catch(err => {
  167. that.is_publish = false; // 恢复提交按钮
  168. uni.showModal({
  169. title: '',
  170. content: '图片上传失败,请重新提交',
  171. confirmColor: '#1697EE'
  172. })
  173. })
  174. },
  175. }
  176. }
  177. </script>
  178. <style>
  179. .apply-btn {
  180. width: 686rpx;
  181. height: 100rpx;
  182. background: #E21196;
  183. border-radius: 60rpx;
  184. margin: 0 auto;
  185. font-size: 36rpx;
  186. color: white;
  187. display: flex;
  188. justify-content: center;
  189. align-items: center;
  190. margin-top: 60rpx;
  191. }
  192. .flr{
  193. width: 100%;
  194. height: 20rpx;
  195. background: #F5F5F5;
  196. }
  197. .title-border {
  198. border-bottom: 1rpx solid rgba(0,0,0,0.1);
  199. border-top: 1rpx solid rgba(0,0,0,0.1) ;
  200. }
  201. .input-title {
  202. font-size: 32rpx;
  203. color: #131315;
  204. display: flex;
  205. justify-content: center;
  206. align-items: center;
  207. }
  208. .authen-pic {
  209. width: 686rpx;
  210. height: 349rpx;
  211. background: #F5F5F5;
  212. border-radius: 10rpx;
  213. margin: 0 auto;
  214. display: flex;
  215. flex-direction: column;
  216. justify-content: space-around;
  217. align-items: center;
  218. text-align: center;
  219. }
  220. </style>