app: Legacy model

This commit is contained in:
LittleChest 2025-09-27 10:24:55 +08:00
parent 71a0253683
commit b9c9cac679

View File

@ -42,7 +42,8 @@
<div>性别{{ genderDisplay }}</div> <div>性别{{ genderDisplay }}</div>
</div> </div>
<v-switch v-model="saveConsent" color="primary" hide-details class="mt-4" <v-switch v-model="legacyModel" color="primary" hide-details class="mt-4" label="使用旧版方案" />
<v-switch v-model="saveConsent" color="primary" hide-details class="mt-2"
label="允许littlew.top将此信息与你的账户关联" /> label="允许littlew.top将此信息与你的账户关联" />
</v-card-text> </v-card-text>
</v-card> </v-card>
@ -63,6 +64,7 @@ const photoBlob = ref(null)
const loading = ref(false) const loading = ref(false)
const debug = ref('') const debug = ref('')
const errorMsg = ref('') const errorMsg = ref('')
const legacyModel = ref(false)
const saveConsent = ref(true) const saveConsent = ref(true)
const age = ref(null) const age = ref(null)
const gender = ref(null) const gender = ref(null)
@ -153,7 +155,10 @@ async function uploadPhoto() {
const form = new FormData() const form = new FormData()
form.append('face', photoBlob.value, 'selfie.jpg') form.append('face', photoBlob.value, 'selfie.jpg')
let url = 'https://api.littlew.top/age' let url = 'https://api.littlew.top/age'
if (saveConsent.value) url += '?save=true' const params = []
if (saveConsent.value) params.push('save=true')
if (legacyModel.value) params.push('legacy=true')
if (params.length) url += '?' + params.join('&')
const resp = await fetch(url, { method: 'POST', body: form }, { credentials: 'include' }) const resp = await fetch(url, { method: 'POST', body: form }, { credentials: 'include' })
const text = await resp.text() const text = await resp.text()
try { try {