Showing
1 changed file
with
29 additions
and
0 deletions
src/composables/useValidIdCard.js
0 → 100644
| 1 | +import { ref } from 'vue' | ||
| 2 | +import axios from '@/utils/axios'; | ||
| 3 | +import { Toast } from 'vant'; | ||
| 4 | + | ||
| 5 | +export const idCard = () => { | ||
| 6 | + /** | ||
| 7 | + * 检查用户是否已实名认证 (实名认证后可以上传作品,留言) | ||
| 8 | + */ | ||
| 9 | + const can_use = ref(false) | ||
| 10 | + axios.get('/srv/?a=can_upload') | ||
| 11 | + .then(res => { | ||
| 12 | + if (res.data.code === 1) { | ||
| 13 | + can_use.value = res.data.data.can_upload ? true : false; | ||
| 14 | + } else { | ||
| 15 | + console.warn(res); | ||
| 16 | + Toast({ | ||
| 17 | + icon: 'close', | ||
| 18 | + message: res.data.msg | ||
| 19 | + }); | ||
| 20 | + } | ||
| 21 | + }) | ||
| 22 | + .catch(err => { | ||
| 23 | + console.error(err); | ||
| 24 | + }) | ||
| 25 | + | ||
| 26 | + return { | ||
| 27 | + can_use | ||
| 28 | + } | ||
| 29 | + } | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment