master
杜函宇 3 weeks ago
parent 288b78b8f1
commit 602f5b9527

@ -8,7 +8,7 @@ const userStore = useUserStore()
const userInfo = computed(() => userStore.userInfo)
const info = countStore()
const nickName = Cookies.get('nickName')
const userName = Cookies.get('userName')
</script>
<template>
@ -26,14 +26,14 @@ const nickName = Cookies.get('nickName')
</div>
<div class="flex-1 min-w-0 ml-2">
<h2 class="overflow-hidden font-bold text-md text-ellipsis whitespace-nowrap">
{{ nickName }}
{{ userName }}
</h2>
<p class="overflow-hidden text-xs text-gray-500 text-ellipsis whitespace-nowrap">
<!-- <span
v-if="isString(userInfo.description) && userInfo.description !== ''"
v-html="userInfo.description"
/> -->
今日剩余次数{{ info.count1 }}/10
今日剩余次数{{ info.count1 }}/50
</p>
</div>
</div>

@ -3,25 +3,25 @@ import { defineStore } from 'pinia'
interface CountState {
count1: number
userId: any
nickName: string
userName: string
}
export const countStore = defineStore(
'count-store',
{
state: (): CountState => ({
count1: 10,
count1: 50,
userId: null,
nickName: '',
userName: '',
}),
actions: {
randomizeCounter(count: number) {
this.count1 = count
},
setNameAId(userId: any, nickName: string) {
setNameAId(userId: any, userName: string) {
return new Promise<void>((resolve) => {
this.userId = userId
this.nickName = nickName
this.userName = userName
resolve()
})
},

@ -91,8 +91,8 @@ async function onConversation() {
},
)
if (response.data.code == 200) {
a1.randomizeCounter(9 - response.data.data > 0 ? 9 - response.data.data : 0)
if (response.data.data < 10) {
a1.randomizeCounter(49 - response.data.data > 0 ? 49 - response.data.data : 0)
if (response.data.data < 50) {
try {
const response = await axios.post<AddResponse>(
`${import.meta.env.VITE_APP_API_BASE_URL}/deepSeekLog`,
@ -540,8 +540,8 @@ const handleLogin = async () => {
)
try {
if (response.data.code == 200) {
a1.randomizeCounter(10 - response.data.data)
if (response.data.data < 10) {
a1.randomizeCounter(50 - response.data.data)
if (response.data.data < 50) {
}
else {
ElMessage({

@ -32,7 +32,7 @@ interface InfoRes {
code: Number
user: {
userId: Number
nickName: string
userName: string
}
}
@ -119,9 +119,9 @@ const executeLogin = async () => {
},
)
if (res.data.code == 200) {
Cookies.set('nickName', res.data.user.nickName)
Cookies.set('userName', res.data.user.userName)
info
.setNameAId(res.data.user.userId, res.data.user.nickName)
.setNameAId(res.data.user.userId, res.data.user.userName)
.then(() => {
router.replace('/chat').catch(() => {})
})

Loading…
Cancel
Save