app: Adapt api changes

This commit is contained in:
LittleChest 2025-10-03 17:02:41 +08:00
parent 64faa51853
commit 8d2b4ed48b

View File

@ -32,9 +32,10 @@
<v-progress-linear :indeterminate="true" color="primary" v-if="loading" <v-progress-linear :indeterminate="true" color="primary" v-if="loading"
class="mt-4"></v-progress-linear> class="mt-4"></v-progress-linear>
<div v-if="debug" class="mt-4"> <div v-if="Array.isArray(debug) && debug.length" class="mt-4">
<div>调试信息</div> <div v-for="(item) in debug" class="mb-2">
<pre class="bg-gray-100 p-3 rounded overflow-auto">{{ debug }}</pre> <pre class="bg-gray-100 p-3 rounded overflow-auto">{{ item }}</pre>
</div>
</div> </div>
<div v-if="age !== null || gender !== null" class="mt-4 text-center"> <div v-if="age !== null || gender !== null" class="mt-4 text-center">
@ -42,8 +43,8 @@
<div>性别{{ genderDisplay }}</div> <div>性别{{ genderDisplay }}</div>
</div> </div>
<v-switch v-model="legacyModel" color="primary" hide-details class="mt-4" label="使用旧版方案" /> <v-switch v-model="saveConsent" color="primary" hide-details class="mt-4"
<v-switch v-model="saveConsent" color="primary" hide-details label="允许littlew.top将此信息与你的账户关联" /> label="允许 littlew.top 将此信息与你的账户关联" />
</v-card-text> </v-card-text>
</v-card> </v-card>
</v-col> </v-col>
@ -63,7 +64,6 @@ 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)
@ -159,7 +159,6 @@ async function uploadPhoto() {
let url = 'https://api.littlew.top/age' let url = 'https://api.littlew.top/age'
const params = [] const params = []
if (saveConsent.value) params.push('save=true') if (saveConsent.value) params.push('save=true')
if (legacyModel.value) params.push('legacy=true')
if (params.length) url += '?' + params.join('&') 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()