acdr-ui/dist/dev/mp-weixin/pages/permission/real-name-auth.js.map

1 line
5.6 KiB
Plaintext
Raw Normal View History

2024-09-19 07:20:14 +08:00
{"version":3,"file":"real-name-auth.js","sources":["../../../../../src/pages/permission/real-name-auth.vue","../../../../../uniPage:/cGFnZXMvcGVybWlzc2lvbi9yZWFsLW5hbWUtYXV0aC52dWU"],"sourcesContent":["<route lang=\"json5\">\n{\n style: {\n navigationBarTitleText: '实名认证',\n navigationStyle: 'custom',\n },\n}\n</route>\n\n<template>\n <!-- 返回按钮 -->\n <TopBar />\n <image\n class=\"absolute w-full h-full\"\n src=\"/static/certification/certification_bg.png\"\n mode=\"aspectFill\"\n ></image>\n <view class=\"absolute w-full top-[75vw]\">\n <view v-if=\"!user.userInfo.isRealName\">\n <!-- 实名认证部分 -->\n <view class=\"p-4\">\n <text class=\"text-lg text-gray-800 mb-2\">请进行身份证实名认证</text>\n\n <view class=\"flex justify-center items-center flex-col gap-[10px]\">\n <view class=\"text-center\">\n <image\n class=\"w-[60vw]\"\n mode=\"widthFix\"\n :src=\"frontImage\"\n @click=\"chooseFrontImage\"\n ></image>\n <view class=\"pt-1\">身份证人像面</view>\n </view>\n <view class=\"text-center\">\n <image\n class=\"w-[60vw]\"\n mode=\"widthFix\"\n :src=\"backImage\"\n @click=\"chooseBackImage\"\n ></image>\n <view class=\"pt-1\">身份证国徽面</view>\n </view>\n </view>\n\n <button\n class=\"w-full bg-[#FCCB30] text-black text-center rounded-full py-1 mt-4\"\n @click=\"submitAuth\"\n >\n 提交认证材料\n </button>\n\n <button\n class=\"w-full bg-[#ff7f50] text-black text-center rounded-full py-1 mt-4\"\n @click=\"toPath('/')\"\n >\n 返回首页\n </button>\n </view>\n </view>\n <view class=\"w-full h-full text-center flex justify-center items-center content-center\" v-else>\n <view class=\"mt-[30vw]\">您已经完成了实名认证!</view>\n </view>\n </view>\n</template>\n\n<script setup lang=\"js\">\nimport { ref } from 'vue'\nimport { httpUploadFile } from '@/utils/http'\nimport { useUserStore } from '@/store'\nimport TopBar from '@/components/TopBar.vue'\nimport { toPath } from '@/utils/commUtils'\n\nconst frontImage = ref('/static/permission/idcard.png')\nconst backImage = ref('/static/permission/idcard_back.png')\nconst frontImagePath = ref(null)\nconst backImagePath = ref(null)\n\nconst user = useUserStore()\n\n// 选择身份证人像面图片\nconst chooseFrontImage = () => {\n uni.chooseImage({\n count: 1,\n success: (res) => {\n frontImagePath.value = res.tempFilePaths[0]\n frontImage.value = frontImagePath.value // 更新图片显示\n },\n })\n}\n\n// 选择身份证国徽面图片\nconst chooseBackImage = () => {\n uni.chooseImage({\n count: 1,\n success: (res) => {\n backImagePath.value = res.tempFilePaths[0]\n backImage.value = backImagePath.value // 更新图片显示\n },\n })\n}\n\n// 提交认证逻辑\nconst submitAuth = async () => {\n // 提交的文件不能为空\n if (!frontImagePath.value) {\n uni.showToast({ title: '请选择身份证人像面图片', icon: 'none' })\n return\n }\n if (!backImagePath.value) {\n uni.showToast({ title: '请选择身份证国徽面图片', icon: 'none' })\n return\n }\n\n try {\n uni.showToast({ title: '提交认证中', icon: 'loading' })\n\n if (frontImagePath.value) {\n const uploadRes = await httpUploadFile('/auth', frontImagePath.value, 'file', {\n type: 'front',\n })\n console.log(uploadRes)\n user.setUserInfo({ isRealName: true })\n }\n\n // if (backImagePath.value) {\n // await httpUploadFile('/auth', backImagePath.value, 'file', { type: 'back' })\n // }\n\n uni.showToast({ title: '提交认证成功', icon: 'none' })\n } catch (error) {\n console.error(error)\n if (error.statusCode == 413) {\n uni.showToast({ title: '<27><>