feat: WeChat Pay integration, translation quota management, login UX fixes

- WeChat Pay APIv3 integration (JSAPI + Native) with cert-based auth
- TranslationQuota model + admin management UI (配额 tab)
- Alibaba MT provider now checks quota before translation
- Fix: admin tabs scrollable on mobile, remove header-card
- Fix: profile/login navigation - logout stays on profile, login returns to profile
- Fix: login form now visible by default (no extra click to show)
- Fix: home page translate link uses navigateTo (was switchTab to non-tabBar page)
- Add .coverage and apiclient_key.pem to gitignore
This commit is contained in:
TradeMate Dev
2026-05-20 18:30:12 +08:00
parent a60aac4638
commit c397740748
22 changed files with 828 additions and 35 deletions
+12 -3
View File
@@ -103,6 +103,7 @@
<script setup>
import { ref, computed, onMounted } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import { authApi } from '@/utils/api.js'
import AiAssistant from '@/components/ai-assistant.vue'
import { STORAGE_KEYS, PAGES, TIER_LABELS } from '@/config.js'
@@ -121,11 +122,18 @@ const initials = computed(() => {
const tierLabel = computed(() => TIER_LABELS[user.value.tier] || '免费版')
const loadUser = async () => {
const token = uni.getStorageSync(STORAGE_KEYS.TOKEN)
if (!token) {
user.value = { tier: 'guest' }
return
}
try {
const res = await authApi.getUserInfo()
user.value = res
editForm.value = { username: res.username || '', email: res.email || '' }
} catch {}
} catch {
user.value = { tier: 'guest' }
}
}
const saveProfile = async () => {
@@ -162,7 +170,7 @@ const changePwd = async () => {
}
}
const goLogin = () => uni.reLaunch({ url: PAGES.LOGIN })
const goLogin = () => uni.navigateTo({ url: PAGES.LOGIN })
const goUpgrade = () => uni.navigateTo({ url: PAGES.UPGRADE })
const goFeedback = () => uni.navigateTo({ url: PAGES.FEEDBACK })
const goAgreement = (type) => uni.navigateTo({ url: `/pages/agreement/${type}` })
@@ -175,13 +183,14 @@ const logout = () => {
if (res.confirm) {
uni.removeStorageSync(STORAGE_KEYS.TOKEN)
uni.removeStorageSync(STORAGE_KEYS.REFRESH_TOKEN)
uni.reLaunch({ url: PAGES.LOGIN })
user.value = { tier: 'guest' }
}
},
})
}
onMounted(loadUser)
onShow(loadUser)
</script>
<style scoped>