useValidIdCard.js
925 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
* @Date: 2024-05-15 10:28:10
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-11-26 12:50:03
* @FilePath: /tswj/src/composables/useValidIdCard.js
* @Description: 文件描述
*/
import { ref } from 'vue'
import axios from '@/utils/axios';
import { showToast } from 'vant';
export const idCard = () => {
/**
* 检查用户是否已实名认证 (实名认证后可以上传作品,留言)
*/
const can_use = ref(false)
axios.get('/srv/?a=can_upload')
.then(res => {
if (res.data.code === 1) {
can_use.value = res.data.data.can_upload ? true : false;
} else {
console.warn(res);
if (!res.data.show) return false;
showToast({
icon: 'close',
message: res.data.msg
});
}
})
.catch(err => {
console.error(err);
})
return {
can_use
}
}