Browse Source

fix:修改报错提示

dxj
杜贤金 1 year ago
parent
commit
55e00580d8
  1. 3
      src/components/AppTaskMenuList/index.vue
  2. 33
      src/components/AppUserInfo/index.vue
  3. 6
      src/store/moules/userStore/index.d.ts
  4. 2
      src/utils/axios/index.ts
  5. 12
      src/views/task/components/BasicTask/index.vue
  6. 7
      src/views/task/components/DailyTask/index.vue
  7. 7
      src/views/task/components/NoviceTask/index.vue
  8. 8
      src/views/task/components/TaskList/index.vue
  9. 12
      src/views/task/index.vue

3
src/components/AppTaskMenuList/index.vue

@ -5,6 +5,7 @@ import { computed, inject, ref } from 'vue'
import type { Task } from './index.d'
import { useTaskListStore } from '@/store/moules/taskListStore'
const emits = defineEmits(['select'])
const taskListStore = useTaskListStore()
const sectionRefs = inject<Task<ComponentPublicInstance>>('sectionRefs')
const taskContainer = inject<Ref<HTMLElement>>('taskContainer')
@ -35,7 +36,7 @@ const list = computed(() => [
//
function handleClick(index: number, task: string) {
activeIndex.value = index
emits('select', task)
if (!sectionRefs) {
return
}

33
src/components/AppUserInfo/index.vue

@ -1,6 +1,6 @@
<!-- 子菜单与内容容器布局组件 -->
<script setup lang="ts">
import { Divider } from 'ant-design-vue'
import { Divider, Popover } from 'ant-design-vue'
import { computed } from 'vue'
import money from '@/assets/images/money.png'
@ -33,7 +33,35 @@ function separator(num: number | string) {
</div>
</div>
<div class="num">
{{ (info?.totalPoints ?? 0) > 0 ? separator(info?.totalPoints as number) : 0 }}
<Popover placement="top" trigger="hover">
<template #title>
<span> 当前套餐{{ info?.goodsName }}</span>
</template>
<template #content>
<div class="meal flex justify-between p-t-10px">
<div>GPT3.5版本</div>
<div>{{ separator(info?.gpt35Num as number) }}</div>
</div>
<div class="meal flex justify-between p-t-10px">
<div>GPT4.0版本</div>
<div>{{ separator(info?.gpt40Num as number) }}</div>
</div>
<div class="meal flex justify-between p-t-10px">
<div>AI绘图</div>
<div>{{ separator(info?.pictureNum as number) }}</div>
</div>
<div class="meal flex justify-between p-t-10px">
<div>图片分析</div>
<div>{{ separator(info?.imageAnalysisNum as number) }}</div>
</div>
<div class="meal flex justify-between p-t-10px">
<div>知识库</div>
<div>{{ separator(info?.knowledgeBaseNum as string) }}</div>
</div>
</template>
{{ (info?.totalPoints ?? 0) > 0 ? separator(info?.totalPoints as number) : 0 }}
</Popover>
</div>
<div class="pay" @click="handleRecharge">
充值
@ -100,6 +128,7 @@ function separator(num: number | string) {
font-weight: normal;
color: #000000;
line-height: 21px;
cursor: pointer;
}
.pay {
width: 45px;

6
src/store/moules/userStore/index.d.ts vendored

@ -24,4 +24,10 @@ export interface ChatInfoType {
createdDay: number
newUserFlag: boolean
inviteCode: string
goodsName: string
gpt35Num: number
gpt40Num: number
pictureNum: number
imageAnalysisNum: number
knowledgeBaseNum: string
}

2
src/utils/axios/index.ts

@ -231,7 +231,7 @@ const transform: AxiosTransform = {
responseInterceptorsCatch: (axiosInstance: AxiosInstance, error: any) => {
const { response, code, message, config } = error || {}
const errorMessageMode = config?.requestOptions?.errorMessageMode || 'none'
const msg: string = response?.data?.msg ?? ''
const msg: string = response?.data?.msg || response?.data?.error_description
const err: string = error?.toString?.() ?? ''
let errMessage = ''

12
src/views/task/components/BasicTask/index.vue

@ -13,9 +13,13 @@ import receive from '@/assets/images/task/ylq.png'
import unclaimed from '@/assets/images/task/dlq.png'
import { useUserStore } from '@/store/moules/userStore/index'
const { active } = defineProps({
active: {
type: Boolean,
},
})
const userStore = useUserStore()
const taskListStore = useTaskListStore()
//
const visible = ref<boolean>(false)
//
@ -75,7 +79,7 @@ function handleInvite() {
<template>
<div class="basic-task-box">
<div class="title">
<div class="title" :class="{ 'slant-shadow': active }">
基础任务
</div>
<div class="contant flex flex-row">
@ -470,4 +474,8 @@ function handleInvite() {
}
}
}
.slant-shadow {
color: #000000;
}
</style>

7
src/views/task/components/DailyTask/index.vue

@ -5,6 +5,11 @@ import type { TaskType } from '../TaskList/index.d'
import { dailyTask } from '@/api/task/index'
import { useTaskListStore } from '@/store/moules/taskListStore'
const { active } = defineProps({
active: {
type: Boolean,
},
})
const taskListStore = useTaskListStore()
const totalScore = ref(0)
const list = ref<TaskType[]>([])
@ -24,7 +29,7 @@ onMounted(() => {
</script>
<template>
<TaskList title="每日任务" :list="list" :total-score="totalScore" :finished-task-count="finishedTaskCount" @update-list="getTaskList()" />
<TaskList title="每日任务" :active="active" :list="list" :total-score="totalScore" :finished-task-count="finishedTaskCount" @update-list="getTaskList()" />
</template>
<style lang="scss" scoped>

7
src/views/task/components/NoviceTask/index.vue

@ -5,6 +5,11 @@ import type { TaskType } from '../TaskList/index.d'
import { noviceTask } from '@/api/task/index'
import { useTaskListStore } from '@/store/moules/taskListStore'
const { active } = defineProps({
active: {
type: Boolean,
},
})
const taskListStore = useTaskListStore()
const totalScore = ref(0)
const list = ref<TaskType[]>([])
@ -23,7 +28,7 @@ onBeforeMount(() => {
</script>
<template>
<TaskList v-if="list" title="新手任务" :list="list" :total-score="totalScore" :finished-task-count="finishedTaskCount" @update-list="getTaskList()" />
<TaskList title="新手任务" :active="active" :list="list" :total-score="totalScore" :finished-task-count="finishedTaskCount" @update-list="getTaskList()" />
</template>
<style lang="scss" scoped>

8
src/views/task/components/TaskList/index.vue

@ -25,6 +25,9 @@ const props = defineProps({
type: Array as PropType<TaskType[]>,
default: (): TaskType[] => [], // [],
},
active: {
type: Boolean,
},
})
const emit = defineEmits(['updateList'])
const reactiveList: ComputedRef<TaskType[]> = computed(() => props.list)
@ -59,7 +62,7 @@ const dynamicStyle = computed(() => {
<template>
<div class="nvoice-task-box">
<div class="title">
<div class="title" :class="{ 'slant-shadow': active }">
{{ title }}
</div>
<div class="nvoice-contant">
@ -257,4 +260,7 @@ const dynamicStyle = computed(() => {
}
}
}
.slant-shadow {
color: #000000;
}
</style>

12
src/views/task/index.vue

@ -19,21 +19,23 @@ const task4 = ref<Ref<ComponentPublicInstance> | null>(null)
const sectionRefs = { task1, task2, task3, task4 }
provide('sectionRefs', sectionRefs)
provide('taskContainer', taskContainer)
const selected = ref('task1')
</script>
<template>
<AppContainerBox>
<template #subMenu>
<AppSubMenuTitle title="任务中心"></AppSubMenuTitle>
<AppTaskMenuList></AppTaskMenuList>
<AppTaskMenuList @select="selected = $event"></AppTaskMenuList>
<AppUserInfo />
</template>
<template #content>
<div ref="taskContainer" class="w-full h-full overflow-auto">
<BasicTask ref="task1" />
<NoviceTask ref="task2" />
<DailyTask ref="task3" />
<!-- <OtherTask ref="task4" /> -->
<BasicTask ref="task1" :active="selected === 'task1'" />
<NoviceTask ref="task2" :active="selected === 'task2'" />
<DailyTask ref="task3" :active="selected === 'task3'" />
<!-- <OtherTask ref="task4" :active="selected === 'task4'" /> -->
</div>
</template>
</AppContainerBox>

Loading…
Cancel
Save