提交 517bb1be authored 作者: haodaking's avatar haodaking

chore: update

上级 c57bedee
......@@ -38,6 +38,8 @@
"ignorableWatch": true,
"inject": true,
"isDefined": true,
"isProxy": true,
"isReactive": true,
"isReadonly": true,
"isRef": true,
"logicAnd": true,
......@@ -235,6 +237,8 @@
"watchIgnorable": true,
"watchOnce": true,
"watchPausable": true,
"watchPostEffect": true,
"watchSyncEffect": true,
"watchThrottled": true,
"watchWithFilter": true,
"whenever": true
......
......@@ -39,6 +39,8 @@ declare global {
const ignorableWatch: typeof import('@vueuse/core')['ignorableWatch']
const inject: typeof import('vue')['inject']
const isDefined: typeof import('@vueuse/core')['isDefined']
const isProxy: typeof import('vue')['isProxy']
const isReactive: typeof import('vue')['isReactive']
const isReadonly: typeof import('vue')['isReadonly']
const isRef: typeof import('vue')['isRef']
const logicAnd: typeof import('@vueuse/core')['logicAnd']
......@@ -236,6 +238,8 @@ declare global {
const watchIgnorable: typeof import('@vueuse/core')['watchIgnorable']
const watchOnce: typeof import('@vueuse/core')['watchOnce']
const watchPausable: typeof import('@vueuse/core')['watchPausable']
const watchPostEffect: typeof import('vue')['watchPostEffect']
const watchSyncEffect: typeof import('vue')['watchSyncEffect']
const watchThrottled: typeof import('@vueuse/core')['watchThrottled']
const watchWithFilter: typeof import('@vueuse/core')['watchWithFilter']
const whenever: typeof import('@vueuse/core')['whenever']
......
差异被折叠。
......@@ -44,9 +44,9 @@
"eslint-plugin-vue": "^8.7.1",
"sass": "^1.52.1",
"typescript": "~4.6.4",
"unplugin-auto-import": "^0.8.5",
"unplugin-auto-import": "^0.8.6",
"vite": "^2.9.9",
"vite-plugin-checker": "^0.4.6",
"vue-tsc": "^0.34.16"
"vue-tsc": "^0.35.0"
}
}
......@@ -12,7 +12,11 @@ defineProps<{ docs: IDocItem[]; videos: IVideoItem[] }>()
const router = useRouter()
function handleViewDoc(data: IDocItem) {
router.push('/admission/doc/' + data.id)
if (data.desc_type === '2') {
location.href = data.url
} else {
router.push('/admission/doc/' + data.id)
}
}
function showTips() {
Notify({ type: 'primary', message: '尚未开放' })
......
......@@ -8,7 +8,11 @@ defineProps<{ docs: IDocItem[] }>()
const router = useRouter()
function handleViewDoc(data: IDocItem) {
router.push('/learn/doc/' + data.id)
if (data.desc_type === '2') {
location.href = data.url
} else {
router.push('/learn/doc/' + data.id)
}
}
</script>
......
......@@ -13,7 +13,11 @@ const router = useRouter()
const active = ref<number>(0)
function handleViewDoc(data: IDocItem) {
router.push('/learn/doc/' + data.id)
if (data.desc_type === '2') {
location.href = data.url
} else {
router.push('/learn/doc/' + data.id)
}
}
function showTips() {
......
......@@ -23,6 +23,8 @@ export interface IDocItem {
id: string
title: string
pv: string
desc_type: '1' | '2'
url: string
}
export { IVideoItem, ICourseItem, ITeam }
......@@ -40,6 +40,9 @@ onMounted(() => {
<LearningMap :docs="data.learning_map_docs"></LearningMap>
<!-- 权益查看 -->
<QueryView></QueryView>
<RouterLink to="/qa">
<img src="https://webapp-pub.ezijing.com/project/prp-h5/qa_banner.png" style="width: 100%" />
</RouterLink>
<!-- 荣誉总榜 -->
<TeamRanking :teams="data.ranking"></TeamRanking>
<!-- 考试攻略 -->
......
<script setup lang="ts"></script>
<script setup lang="ts">
import { Toast } from 'vant'
import PublishItem from '@/components/PublishItem.vue'
import { getQuestionList, createQuestionComment } from '../api'
interface Info {
loading: boolean
page: number
total: number
list: any[]
}
const dataset = reactive<Info>({ loading: false, page: 1, total: 0, list: [] })
// 获取打卡评论
const getQuestions = (isReset?: boolean) => {
if (isReset) {
dataset.page = 1
}
dataset.loading = true
getQuestionList({ page: dataset.page, page_size: 10 })
.then(res => {
const { total, list } = res.data
dataset.total = total
dataset.list = isReset ? list : dataset.list.concat(list)
if (dataset.list.length <= total) {
dataset.page++
}
})
.finally(() => {
dataset.loading = false
})
}
// 滚动加载
useInfiniteScroll(
document,
() => {
!dataset.loading && getQuestions()
},
{ distance: 10 }
)
// 评论
const onSubmitComment = (data: any, action: string) => {
if (action === 'comment') {
// 评论
createQuestionComment({
question_id: data.id,
content: data.comment
}).then(() => {
Toast.success('评论成功')
getQuestions(true)
})
} else {
// 回复
createQuestionComment({
question_id: data.entity_id,
content: data.comment,
to_comment_id: data.id
}).then(() => {
Toast.success('回复成功')
getQuestions(true)
})
}
}
</script>
<template>
<div class="home"></div>
<RouterLink to="/share">
<img src="https://webapp-pub.ezijing.com/project/prp-h5/banner_qa.png" style="width: 100%" />
</RouterLink>
<div class="list-card">
<h2 class="title">最新动态</h2>
<div class="tips">
<p>晒出你的【知识输出者】 留下知识践行的足迹 得到你的星星权益</p>
<RouterLink to="/qa/publish" class="tips-button">去拍照得星星</RouterLink>
</div>
<div style="margin: 0.2rem">
<template v-if="dataset.list?.length">
<PublishItem v-for="item in dataset.list" :data="item" :key="item.id" @submitComment="onSubmitComment"></PublishItem>
</template>
<van-empty description="暂无内容" v-else />
</div>
</div>
</template>
<style lang="scss" scoped>
.list-card {
margin-top: 0.52rem;
margin-bottom: 0.2rem;
background: #fff;
border-radius: 0.2rem;
overflow: hidden;
.title {
padding: 0 0.3rem;
font-size: 0.28rem;
line-height: 0.9rem;
background: #f7f7f7;
}
.tips {
position: relative;
margin: 0.2rem;
padding: 0.24rem;
background-color: #f7f7f7;
border-radius: 0.2rem;
p {
font-size: 0.24rem;
line-height: 0.36rem;
color: #033974;
}
.tips-button {
position: absolute;
right: 0.24rem;
bottom: 0.2rem;
padding: 0 0.15rem;
height: 0.4rem;
font-size: 0.22rem;
line-height: 0.4rem;
color: #fff;
background: linear-gradient(164deg, #f7c988 0%, #e5a448 100%);
border-radius: 0.2rem;
}
}
}
</style>
......@@ -12,7 +12,7 @@ function onSubmit() {
const params = Object.assign({}, form, { picture: JSON.stringify(form.picture) })
createQuestion(params).then(() => {
Toast.success('发布成功')
router.push({ path: '/#qa' })
router.push({ path: '/qa' })
})
}
</script>
......@@ -20,18 +20,8 @@ function onSubmit() {
<template>
<AppContainer title="发布问题" backgroundColor="#fff" headerAlign="center">
<van-form @submit="onSubmit">
<van-field
v-model="form.title"
placeholder="请输入问题标题"
:rules="[{ required: true, message: '请输入问题标题' }]"
/>
<van-field
v-model="form.desc"
type="textarea"
placeholder="请输入问题内容"
:autosize="{ minHeight: 200 }"
:rules="[{ required: true, message: '请输入问题内容' }]"
/>
<van-field v-model="form.title" placeholder="请输入问题标题" :rules="[{ required: true, message: '请输入问题标题' }]" />
<van-field v-model="form.desc" type="textarea" placeholder="请输入问题内容" :autosize="{ minHeight: 200 }" :rules="[{ required: true, message: '请输入问题内容' }]" />
<van-field>
<template #input>
<AppUpload v-model="form.picture"></AppUpload>
......
......@@ -63,6 +63,11 @@ async function getShareInfo() {
}
init()
}
onMounted(() => {
getShareInfo()
})
// 生成分享二维码
let qrcodeUrl = $ref<string>()
async function genQrcode() {
......@@ -99,10 +104,6 @@ function handleDownload() {
saveAs(previewUrl, Date.now().toString())
}
onMounted(() => {
getShareInfo()
})
function handleTabClick(index: number) {
controls.active = index
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论