Browse Source

feat:对接部分任务接口

dxj
杜贤金 1 year ago
parent
commit
917668f7dc
  1. BIN
      src/assets/fonts/DingTalk JinBuTi.ttf
  2. 13
      src/assets/fonts/fonts.css
  3. BIN
      src/assets/fonts/方正清刻本悦宋简体.ttf
  4. 82
      src/components/AppRecharge/index.vue
  5. 14
      src/components/AppUserInfo/index.vue
  6. 5
      src/main.ts
  7. 5
      src/views/login/index.vue
  8. 20
      src/views/task/components/BasicTask/index.vue
  9. 6
      src/views/task/components/DailyTask/index.d.ts
  10. 47
      src/views/task/components/DailyTask/index.vue
  11. 5
      src/views/task/components/HisTory/index.d.ts
  12. 57
      src/views/task/components/HisTory/index.vue
  13. 17
      src/views/task/components/InviteForm/index.vue
  14. 3
      src/views/task/components/NoviceTask/index.d.ts
  15. 19
      src/views/task/components/NoviceTask/index.vue
  16. 6
      src/views/task/components/OtherTask/index.d.ts
  17. 67
      src/views/task/components/OtherTask/index.vue
  18. 3
      src/views/task/components/TaskList/index.d.ts
  19. 28
      src/views/task/components/TaskList/index.vue

BIN
src/assets/fonts/DingTalk JinBuTi.ttf

Binary file not shown.

13
src/assets/fonts/fonts.css

@ -0,0 +1,13 @@
@font-face {
font-family: 'jinbuti';
src: url('./DingTalk JinBuTi.ttf');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: '方正清刻本悦宋简体';
src: url('./方正清刻本悦宋简体.ttf');
font-weight: normal;
font-style: normal;
}

BIN
src/assets/fonts/方正清刻本悦宋简体.ttf

Binary file not shown.

82
src/components/AppRecharge/index.vue

@ -42,7 +42,6 @@ function getType() {
function getgoodsList(type: string) {
goodsList({ type }).then((res) => {
goodslists.value = res
console.log(res, 7777)
})
}
@ -110,23 +109,23 @@ function tabClass(index: number) {
}
}
//
const extreme = ref([{
num: 10000,
unit: '点数',
name: '同聪点数',
}, {
num: '无限',
unit: '',
name: '可回答3.5版本问题',
}, {
num: 5000,
unit: '条',
name: '可回答4.0版本问题',
}, {
num: 10000,
unit: '幅',
name: '可生成图片',
}])
// const extreme = ref([{
// num: 10000,
// unit: '',
// name: '',
// }, {
// num: '',
// unit: '',
// name: '3.5',
// }, {
// num: 5000,
// unit: '',
// name: '4.0',
// }, {
// num: 10000,
// unit: '',
// name: '',
// }])
//
function onPrevClick() {
@ -159,7 +158,7 @@ function onNextClick() {
</div>
<div class="bottom">
<div v-if="activeTab !== tabs.length - 1" class="basic-meal">
<div class="prev-button prev" @click="onPrevClick">
<div v-show="goodslists.length > 3" class="prev-button prev" @click="onPrevClick">
<LeftOutlined />
</div>
<Carousel ref="carouselRef" arrows :dots="false" :autoplay="false" :slides-to-show="goodslists.length > 3 ? 3 : goodslists.length" :slides-to-scroll="1">
@ -219,7 +218,7 @@ function onNextClick() {
</div>
</div>
</Carousel>
<div class="next-button next" @click="onNextClick">
<div v-show="goodslists.length > 3" class="next-button next" @click="onNextClick">
<RightOutlined />
</div>
<div class="line">
@ -263,13 +262,42 @@ function onNextClick() {
</div>
<div class="extremeequitynum">
<div v-for="(item, index) in extreme" :key="index" class="extremeequitynum-box">
<div class="extremeequitynum-box">
<div class="extremeequitynum-box-top">
<span class="num">{{ item.num }}</span>
<span class="unit">{{ item.unit }}</span>
<span class="num">{{ goodslists[0].giveNum }}</span>
<span class="unit">点数</span>
</div>
<div class="extremeequitynum-box-bottom">
{{ item.name }}
同聪点数
</div>
</div>
<div class="extremeequitynum-box">
<div class="extremeequitynum-box-top">
<span class="num">无限</span>
</div>
<div class="extremeequitynum-box-bottom">
可回答3.5版本问题
</div>
</div>
<div class="extremeequitynum-box">
<div class="extremeequitynum-box-top">
<span class="num">{{ goodslists[0].gpt40Num }}</span>
<span class="unit"></span>
</div>
<div class="extremeequitynum-box-bottom">
可回答4.0版本问题
</div>
</div>
<div class="extremeequitynum-box">
<div class="extremeequitynum-box-top">
<span class="num">{{ goodslists[0].pictureNum }}</span>
<span class="unit"></span>
</div>
<div class="extremeequitynum-box-bottom">
可生成图片
</div>
</div>
</div>
@ -278,13 +306,13 @@ function onNextClick() {
<div class="openleft">
<span class="freeprice">畅享价</span>
<span class="newprice">¥{{ goodslists[0].price }}</span>
<span class="oldprice">¥4999</span>
<span class="oldprice">¥{{ goodslists[0].costPrice }}</span>
</div>
<div class="openright">
<div class="year">
使用期限1年
</div>
<div class="immediately">
<div class="immediately" @click="handlePay(goodslists[0].id)">
立即开通
</div>
</div>
@ -474,7 +502,7 @@ function onNextClick() {
left: 40px;
.bigname {
font-size: 30px;
font-family: FZQKBYSJW--GB1, FZQKBYSJW--GB1;
font-family: '方正清刻本悦宋简体';
font-weight: normal;
color: #141c3b;
letter-spacing: 9px;

14
src/components/AppUserInfo/index.vue

@ -13,6 +13,12 @@ const info = userStore.getChatInfo
function handleRecharge() {
rechargeStore.rechargeOpen()
}
//
function separator(num: number | string) {
const numParts = num.toString().split('.')
numParts[0] = numParts[0].replace(/\B(?=(\d{3})+(?!\d))/g, '`')
return numParts.join('.')
}
</script>
<template>
@ -34,7 +40,7 @@ function handleRecharge() {
<div class="app-user-info-bottom">
<div>
<div class="accumulative">
{{ info?.messageCount }}
{{ separator(info?.messageCount || 0) }}
</div>
<div class="accumulativename">
累计提问
@ -43,7 +49,7 @@ function handleRecharge() {
<Divider type="vertical" style="height: 30px; background-color: #e1e9f9" />
<div>
<div class="accumulative">
{{ info?.createdDay }}
{{ separator(info?.createdDay || 0) }}
</div>
<div class="accumulativename">
来到同聪
@ -90,7 +96,7 @@ function handleRecharge() {
}
.num {
font-size: 14px;
font-family: DingTalk, DingTalk;
font-family: 'jinbuti';
font-weight: normal;
color: #000000;
line-height: 21px;
@ -120,7 +126,7 @@ function handleRecharge() {
.accumulative {
text-align: center;
font-size: 15px;
font-family: DingTalk, DingTalk;
font-family: 'jinbuti';
font-weight: normal;
color: #000000;
}

5
src/main.ts

@ -2,8 +2,8 @@
* @Description:
* @Author: yeke
* @Date: 2024-01-14 15:47:49
* @LastEditors: lipenghui
* @LastEditTime: 2024-01-16 15:24:25
* @LastEditors: 1960116313@qq.com
* @LastEditTime: 2024-01-23 14:35:03
*/
import { createApp } from 'vue'
@ -14,6 +14,7 @@ import App from './App.vue'
import { setupStore } from '@/store'
import { router, setupRouter } from '@/router'
import { setupRouterGuard } from '@/router/guard'
import '@/assets/fonts/fonts.css'
// svg图标
import 'virtual:svg-icons-register'

5
src/views/login/index.vue

@ -55,11 +55,10 @@ function handleLogin() {
phoneCode: ruleForm.code,
type: TypeEnum.PHONE,
}).then(() => {
createMessage.success('登录成功')
message.success('登录成功')
loading.value = false
router.push('/')
}).catch(() => {
createMessage.error('登录失败')
loading.value = false
})
})
@ -125,7 +124,7 @@ function timer() {
欢迎使用
</div>
<div class="zh">
青鸟语言大模型-同聪
青鸟AI助手-同聪
</div>
<div class="en">
THE BIG LANGUAGE MODEL BLUEBIRO - Tong Cong

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

@ -11,6 +11,8 @@ import money from '@/assets/images/task/money.png'
import receive from '@/assets/images/task/ylq.png'
import unclaimed from '@/assets/images/task/dlq.png'
//
const visible = ref<boolean>(false)
//
const signData = ref<SignType>({
continueDays: 0,
@ -28,16 +30,12 @@ function getCurrent() {
getCurrent()
//
function handleSign() {
function handleSign(type: string) {
logUserSign().then(() => {
signData.value.isSign = 1
signData.value.continueDays += 1
if (signData.value.continueDays === 7) {
signData.value.totalIntegral += 10
}
else {
signData.value.totalIntegral += 1
if (type === 'history') {
visible.value = false
}
getCurrent()
message.success('签到成功!')
})
}
@ -81,9 +79,9 @@ function handleInvite() {
<div class="historyBox">
<img class="historyImg" :src="History" alt="">
<Popover placement="bottomRight" trigger="click">
<Popover v-model:open="visible" placement="bottomRight" trigger="click">
<template #content>
<HisTory />
<HisTory :visible="visible" @handle-hsigns="handleSign('history')" />
</template>
<div class="historyName">
历史
@ -114,7 +112,7 @@ function handleInvite() {
</div>
<div v-if="item <= signData.signDays">
<div v-if="item === signData.signDays && !signData.isSign" class="sign-get" @click="handleSign">
<div v-if="item === signData.signDays && !signData.isSign" class="sign-get" @click="handleSign('')">
领取
</div>
<div v-else class="sign-day">

6
src/views/task/components/DailyTask/index.d.ts vendored

@ -0,0 +1,6 @@
export interface TaskType {
name: string
score: number
status: number
id: string
}

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

@ -1,38 +1,27 @@
<script lang="ts" setup>
import { ref } from 'vue'
import { onMounted, ref } from 'vue'
import { TaskList } from '../TaskList/index.ts'
import type { TaskType } from './index.d'
import { noviceTask } from '@/api/task/index'
const earn = ref([
{
title: '完成一次同聪3.5对话',
dot: 1,
status: 1,
},
{
title: '完成一次同聪4.0对话',
dot: 1,
status: 0,
},
{
title: '完成一次角色对话',
dot: 1,
status: 1,
},
{
title: '完成一次充值',
dot: 200,
status: 0,
},
{
title: '完成一次xxxxxxxxx',
dot: 2,
status: 1,
},
])
const totalScore = ref(0)
const list = ref<TaskType[]>([])
const finishedTaskCount = ref(0)
function getTaskList() {
noviceTask().then((res) => {
list.value = res.taskCenterList
totalScore.value = res.totalScore
finishedTaskCount.value = res.finishedTaskCount
})
}
onMounted(() => {
getTaskList()
})
</script>
<template>
<TaskList title="每日任务" :list="earn" />
<TaskList title="每日任务" :list="list" :total-score="totalScore" :finished-task-count="finishedTaskCount" @update-list="getTaskList()" />
</template>
<style lang="scss" scoped>

5
src/views/task/components/HisTory/index.d.ts vendored

@ -0,0 +1,5 @@
export interface HistoryType {
awardIntegral: number
dateTime: string
signType: number
}

57
src/views/task/components/HisTory/index.vue

@ -1,18 +1,27 @@
<script lang="ts" setup>
import { onMounted, ref } from 'vue'
import { ref, watch, watchEffect } from 'vue'
import dayjs from 'dayjs'
import { Button, Calendar } from 'ant-design-vue'
import {
LeftOutlined,
RightOutlined,
} from '@ant-design/icons-vue'
import type { HistoryType } from './index.d'
import { history } from '@/api/task/index'
const props = defineProps({
visible: {
type: Boolean,
default: false,
},
})
const emit = defineEmits(['handleHsigns'])
const data = ref(dayjs())
const yam = ref(dayjs(data.value).format('YYYY-MM'))
const datesData = ref<any>([])
const datesData = ref<HistoryType[]>([])
const month = ref(data.value.month() + 1)
const formerly = ref(false)
//
function changeMonth(type: number) {
if (type > 0) {
@ -39,10 +48,26 @@ function format(val: string | number | dayjs.Dayjs | Date | null | undefined) {
const newVal = dayjs(val).format('YYYY年MM月')
return newVal
}
//
function getHistory(time: string) {
history({ yearAndMonth: time }).then((res) => {
datesData.value = res
})
}
// 0 1
const getCellTypeClass = function (value: { $D: string | number }) {
const getData: any = datesData.value[value.$D - 1]
watchEffect(() => {
if (props.visible) {
getHistory(yam.value)
}
})
//
function handleGet() {
emit('handleHsigns')
}
//
const getCellTypeClass = function (value: { $D: number }) {
const getData = datesData.value[value.$D - 1]
if (!getData && !formerly.value) {
return 'future-date'
}
@ -51,22 +76,16 @@ const getCellTypeClass = function (value: { $D: string | number }) {
}
switch (getData.signType) {
case 0:
return 'past-date'
if (dayjs().format('YYYY-MM-DD') === getData.dateTime) {
return 'future-date'
}
else {
return 'past-date'
}
case 1:
return 'current-date'
}
}
function getHistory(time: string) {
history({ yearAndMonth: time }).then((res) => {
console.log(res, 666)
datesData.value = res
})
}
onMounted(async () => {
getHistory(yam.value)
})
</script>
<template>
@ -89,12 +108,12 @@ onMounted(async () => {
<template #dateFullCellRender="{ current: value }">
<div v-if="value.month() === data.month() && value.year() === data.year()">
<div class="cellBox">
<div class="cellItem" :class="getCellTypeClass(value)">
<div class="cellItem" :class="datesData.length > 0 ? getCellTypeClass(value) : ''">
<div class="count">
{{ datesData[value.$D - 1]?.awardIntegral ? datesData[value.$D - 1]?.awardIntegral : "1" }}点数
</div>
</div>
<div v-if="dayjs(value).isSame(dayjs(), 'day') && datesData[value.$D - 1]?.signType === 0 " class="getbtn">
<div v-if="dayjs(value).isSame(dayjs(), 'day') && datesData[value.$D - 1]?.signType === 0 " class="getbtn" @click="handleGet">
领取
</div>
<div v-else class="monthday">

17
src/views/task/components/InviteForm/index.vue

@ -2,9 +2,9 @@
import {
CloseOutlined,
} from '@ant-design/icons-vue'
import { Button, Divider, QRCode, message } from 'ant-design-vue'
import { Button, Divider, QRCode } from 'ant-design-vue'
import { ref } from 'vue'
import copy from 'clipboard-copy'
import { copyText } from '@/utils/copyTextToClipboard'
defineProps({
show: {
@ -31,17 +31,6 @@ async function dowloadChange() {
}
const code = ref('你好啊')
function copyText() {
copy(code.value)
.then(() => {
message.success({
content: () => '复制成功',
class: 'message-class',
})
})
}
</script>
<template>
@ -72,7 +61,7 @@ function copyText() {
{{ code }}
</div>
<div class="i-copy">
<Button class="copy-btn" @click="copyText">
<Button class="copy-btn" @click="copyText(code)">
复制邀请码
</Button>
</div>

3
src/views/task/components/NoviceTask/index.d.ts vendored

@ -1,5 +1,6 @@
export interface NoviceType {
export interface TaskType {
name: string
score: number
status: number
id: string
}

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

@ -1,25 +1,26 @@
<script lang="ts" setup>
import { onMounted, ref } from 'vue'
import { TaskList } from '../TaskList/index.ts'
import type { NoviceType } from './index.d'
import type { TaskType } from './index.d'
import { noviceTask } from '@/api/task/index'
const total = ref(0)
const earn = ref<NoviceType[]>([])
function getnoviceTaskList() {
const totalScore = ref(0)
const list = ref<TaskType[]>([])
const finishedTaskCount = ref(0)
function getTaskList() {
noviceTask().then((res) => {
earn.value = res.taskCenterList
total.value = res.totalScore
list.value = res.taskCenterList
totalScore.value = res.totalScore
finishedTaskCount.value = res.finishedTaskCount
})
}
onMounted(() => {
getnoviceTaskList()
getTaskList()
})
</script>
<template>
<TaskList title="新手任务" :list="earn" :total="total" />
<TaskList title="新手任务" :list="list" :total-score="totalScore" :finished-task-count="finishedTaskCount" @update-list="getTaskList()" />
</template>
<style lang="scss" scoped>

6
src/views/task/components/OtherTask/index.d.ts vendored

@ -0,0 +1,6 @@
export interface TaskType {
name: string
score: number
status: number
id: string
}

67
src/views/task/components/OtherTask/index.vue

@ -1,58 +1,27 @@
<script lang="ts" setup>
import { ref } from 'vue'
import { onMounted, ref } from 'vue'
import { TaskList } from '../TaskList/index.ts'
import type { TaskType } from './index.d'
import { noviceTask } from '@/api/task/index'
const earn = ref([
{
title: '完成一次同聪3.5对话',
dot: 1,
status: 1,
},
{
title: '完成一次同聪4.0对话',
dot: 1,
status: 0,
},
{
title: '完成一次角色对话',
dot: 1,
status: 1,
},
{
title: '完成一次充值',
dot: 200,
status: 0,
},
{
title: '完成一次xxxxxxxxx',
dot: 2,
status: 1,
},
{
title: '完成一次充值',
dot: 200,
status: 0,
},
{
title: '完成一次xxxxxxxxx',
dot: 2,
status: 1,
},
{
title: '完成一次充值',
dot: 200,
status: 0,
},
{
title: '完成一次xxxxxxxxx',
dot: 2,
status: 1,
},
])
const totalScore = ref(0)
const list = ref<TaskType[]>([])
const finishedTaskCount = ref(0)
function getTaskList() {
noviceTask().then((res) => {
list.value = res.taskCenterList
totalScore.value = res.totalScore
finishedTaskCount.value = res.finishedTaskCount
})
}
onMounted(() => {
getTaskList()
})
</script>
<template>
<TaskList title="其他任务" :list="earn" />
<TaskList title="其他任务" :list="list" :total-score="totalScore" :finished-task-count="finishedTaskCount" @update-list="getTaskList()" />
</template>
<style lang="scss" scoped>

3
src/views/task/components/TaskList/index.d.ts vendored

@ -1,5 +1,6 @@
export interface NoviceType {
export interface TaskType {
name: string
score: number
status: number
id: string
}

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

@ -4,25 +4,35 @@ import {
DownOutlined,
UpOutlined,
} from '@ant-design/icons-vue'
import type { NoviceType } from './index.d'
import { message } from 'ant-design-vue'
import type { TaskType } from './index.d'
import money from '@/assets/images/task/money.png'
const { title, list, total } = defineProps({
const { title, list, totalScore } = defineProps({
title: {
type: String,
},
total: {
totalScore: {
type: Number,
},
finishedTaskCount: {
type: Number,
},
list: {
type: Array as PropType<NoviceType[]>,
type: Array as PropType<TaskType[]>,
default: () => [],
},
})
const emit = defineEmits(['updateList'])
//
function hanndleGetDot(id) {
message.success('领取成功')
emit('updateList')
}
const isExpanded = ref(false)//
const singleItemHeight = 45 //
//
const dynamicStyle = computed(() => {
let maxHeight
if (isExpanded.value) {
@ -47,10 +57,10 @@ const dynamicStyle = computed(() => {
<div class="nvoice-contant">
<div class="top flex justify-between">
<div class="left">
全部完成可获得 {{ total }} 点数
全部完成可获得 {{ totalScore }} 点数
</div>
<div class="right">
已完成 1/12
已完成 {{ finishedTaskCount }}/{{ list.length }}
</div>
</div>
@ -81,7 +91,7 @@ const dynamicStyle = computed(() => {
已完成
</div>
<div v-show="item.status === 1" class="add-dot-btn finished">
<div v-show="item.status === 1" class="add-dot-btn finished" @click="hanndleGetDot(item.id)">
领取
</div>

Loading…
Cancel
Save