提交 08f3f29a authored 作者: 王鹏飞's avatar 王鹏飞

release 1.0

上级 97f0c27f
......@@ -30,5 +30,5 @@ export function uploadFile(data: object) {
// 获取导学视频详情
export function getVideoView(params: { id: string }) {
return httpRequest.get('/api/psp/v1/learning/video-view', { params })
return httpRequest.get('/api/psp/v1/admission/video-view', { params })
}
......@@ -14,7 +14,7 @@ const studyStatus = (progress: number) => {
</script>
<template>
<div class="course-item">
<router-link :to="{ path: `/course/view/${data.id}` }" class="course-item-inner">
<router-link :to="{ path: `/learn/course/${data.id}` }" class="course-item-inner">
<img :src="data.course_picture" class="course-item-pic" />
<div class="course-item-content">
<h5>{{ data.course_name }}</h5>
......
import httpRequest from '@/utils/axios'
// 获取文档数据
export function getDocView(params: { id: string }) {
return httpRequest.get('/api/psp/v1/admission/doc-view', { params })
}
......@@ -3,8 +3,8 @@ import AppLayout from '@/components/layout/Index.vue'
export const routes: Array<RouteRecordRaw> = [
{
path: '/message',
path: '/admission',
component: AppLayout,
children: [{ path: '', component: () => import('./views/View.vue') }]
children: [{ path: 'doc/:id', component: () => import('./views/DocView.vue'), props: true }]
}
]
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { getDocView } from '../api'
const props = defineProps<{ id: string }>()
const data = ref()
function fetchDocView() {
getDocView({ id: props.id }).then(res => {
data.value = res.data
})
}
onMounted(() => {
fetchDocView()
})
</script>
<template>
<AppContainer backgroundColor="#fff" headerAlign="center" v-if="data" class="doc">
<div class="doc-hd">
<h1>{{ data.title }}</h1>
<p>
<span>{{ data.created_time }}</span>
<span>{{ data.pv }}观看</span>
</p>
</div>
<div class="doc-bd">
<article v-html="data.desc"></article>
</div>
</AppContainer>
</template>
<style lang="scss" scoped>
.doc-hd {
h1 {
font-size: 0.32rem;
font-weight: 500;
line-height: 0.45rem;
color: #333333;
}
p {
margin-top: 0.15rem;
font-size: 0.24rem;
font-weight: 400;
color: #b2b2b2;
span + span {
margin-left: 0.5rem;
}
}
}
.doc-bd {
padding: 0.5rem 0;
font-size: 0.24rem;
font-weight: 400;
color: #666666;
line-height: 0.42rem;
}
</style>
<script setup lang="ts"></script>
<template>
<div class="home"></div>
</template>
<script setup lang="ts">
import { useRouter } from 'vue-router'
import { Notify } from 'vant'
import { Swiper, SwiperSlide } from 'swiper/vue'
import 'swiper/css'
......@@ -8,6 +9,11 @@ import type { IDocItem, IVideoItem } from '../types'
defineProps<{ docs: IDocItem[]; videos: IVideoItem[] }>()
const router = useRouter()
function handleViewDoc(data: IDocItem) {
router.push('/admission/doc/' + data.id)
}
function showTips() {
Notify({ type: 'primary', message: '尚未开放' })
}
......@@ -20,7 +26,7 @@ function showTips() {
<h2>解释文档</h2>
<div class="box">
<ul>
<li v-for="item in docs" :key="item.id">
<li v-for="item in docs" :key="item.id" @click="handleViewDoc(item)">
<p>{{ item.title }}</p>
<span>{{ item.pv }}</span>
<van-icon name="arrow" />
......@@ -84,6 +90,7 @@ function showTips() {
align-items: center;
font-size: 0.2rem;
color: #adadad;
cursor: pointer;
}
p {
flex: 1;
......
<script setup lang="ts">
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import { Notify } from 'vant'
import type { IDocItem } from '../types'
import LearningMapVideo from './LearningMapVideo.vue'
import LearningMapCourse from './LearningMapCourse.vue'
defineProps<{ docs: IDocItem[] }>()
const router = useRouter()
const active = ref<number>(0)
function handleViewDoc(data: IDocItem) {
router.push('/learn/doc/' + data.id)
}
function showTips() {
Notify({ type: 'primary', message: '尚未开放' })
}
......@@ -29,7 +37,7 @@ function showTips() {
<van-tab title="解释文档">
<div class="learn-box learn-docs">
<ul>
<li v-for="item in docs" :key="item.id">
<li v-for="item in docs" :key="item.id" @click="handleViewDoc(item)">
<p>{{ item.title }}</p>
<span>{{ item.pv }}</span>
<van-icon name="arrow" />
......@@ -80,13 +88,22 @@ function showTips() {
overflow: hidden;
}
li {
margin: 0.3rem 0.14rem 0;
position: relative;
display: flex;
align-items: center;
font-size: 0.2rem;
color: #adadad;
cursor: pointer;
&::before {
content: '';
width: 0.08rem;
height: 0.08rem;
background: #033974;
border-radius: 50%;
}
}
p {
margin-left: 0.1rem;
flex: 1;
font-size: 0.24rem;
color: #4e4e4e;
......@@ -95,6 +112,7 @@ function showTips() {
overflow: hidden;
}
span {
margin: 0 0.1rem;
min-width: 0.44rem;
font-size: 0.2rem;
color: #c6c6c6;
......
......@@ -16,27 +16,27 @@ const menus: Array<{
path: '#learning',
name: '学习地图',
icon: 'https://webapp-pub.ezijing.com/project/prp-h5/home_menu_2.png'
},
{
path: '#query',
name: '权益查看',
icon: 'https://webapp-pub.ezijing.com/project/prp-h5/home_menu_3.png'
},
{
path: '#team',
name: '荣誉总榜',
icon: 'https://webapp-pub.ezijing.com/project/prp-h5/home_menu_4.png'
},
{
path: '#exam',
name: '考试攻略',
icon: 'https://webapp-pub.ezijing.com/project/prp-h5/home_menu_6.png'
},
{
path: '#qa',
name: '陪伴问答',
icon: 'https://webapp-pub.ezijing.com/project/prp-h5/home_menu_5.png'
}
// {
// path: '#query',
// name: '权益查看',
// icon: 'https://webapp-pub.ezijing.com/project/prp-h5/home_menu_3.png'
// },
// {
// path: '#team',
// name: '荣誉总榜',
// icon: 'https://webapp-pub.ezijing.com/project/prp-h5/home_menu_4.png'
// },
// {
// path: '#exam',
// name: '考试攻略',
// icon: 'https://webapp-pub.ezijing.com/project/prp-h5/home_menu_6.png'
// },
// {
// path: '#qa',
// name: '陪伴问答',
// icon: 'https://webapp-pub.ezijing.com/project/prp-h5/home_menu_5.png'
// }
]
</script>
......
......@@ -6,9 +6,9 @@ import Banner from '../components/Banner.vue'
import Menu from '../components/Menu.vue'
import AdmissionGuide from '../components/AdmissionGuide.vue'
import LearningMap from '../components/LearningMap.vue'
import ExamStrategy from '../components/ExamStrategy.vue'
import TeamRanking from '../components/TeamRanking.vue'
import Questions from '../components/Questions.vue'
// import ExamStrategy from '../components/ExamStrategy.vue'
// import TeamRanking from '../components/TeamRanking.vue'
// import Questions from '../components/Questions.vue'
const data = ref<HomeInfo>({
banner: [],
......@@ -37,9 +37,9 @@ onMounted(() => {
<LearningMap :docs="data.learning_map_docs"></LearningMap>
<!-- 权益查看 -->
<!-- 荣誉总榜 -->
<TeamRanking></TeamRanking>
<!-- <TeamRanking></TeamRanking> -->
<!-- 考试攻略 -->
<ExamStrategy></ExamStrategy>
<!-- <ExamStrategy></ExamStrategy> -->
<!-- 陪伴问答 -->
<Questions :data="data.questions"></Questions>
<!-- <Questions :data="data.questions"></Questions> -->
</template>
......@@ -35,3 +35,8 @@ export function createCourseComment(data: { entity_id: string; to_comment_id?: s
export function getRecordComment(params: { id: string; page_size?: number; page?: number }) {
return httpRequest.get('/api/psp/v1/learning/record-comments', { params })
}
// 获取文档数据
export function getDocView(params: { id: string }) {
return httpRequest.get('/api/psp/v1/learning/doc-view', { params })
}
......@@ -3,11 +3,12 @@ import AppLayout from '@/components/layout/Index.vue'
export const routes: Array<RouteRecordRaw> = [
{
path: '/course',
path: '/learn',
component: AppLayout,
children: [
{ path: '', component: () => import('./views/Index.vue') },
{ name: 'courseView', path: 'view/:id', component: () => import('./views/View.vue'), props: true },
{ name: 'learnCourse', path: 'course', component: () => import('./views/Course.vue') },
{ name: 'learnCourseView', path: 'course/:id', component: () => import('./views/CourseView.vue'), props: true },
{ path: 'doc/:id', component: () => import('./views/DocView.vue'), props: true },
{ path: 'publish', component: () => import('./views/Publish.vue'), meta: { requireLogin: true } }
]
}
......
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { getDocView } from '../api'
const props = defineProps<{ id: string }>()
const data = ref()
function fetchDocView() {
getDocView({ id: props.id }).then(res => {
data.value = res.data
})
}
onMounted(() => {
fetchDocView()
})
</script>
<template>
<AppContainer backgroundColor="#fff" headerAlign="center" v-if="data" class="doc">
<div class="doc-hd">
<h1>{{ data.title }}</h1>
<p>
<span>{{ data.created_time }}</span>
<span>{{ data.pv }}观看</span>
</p>
</div>
<div class="doc-bd">
<article v-html="data.desc"></article>
</div>
</AppContainer>
</template>
<style lang="scss" scoped>
.doc-hd {
h1 {
font-size: 0.32rem;
font-weight: 500;
line-height: 0.45rem;
color: #333333;
}
p {
margin-top: 0.15rem;
font-size: 0.24rem;
font-weight: 400;
color: #b2b2b2;
span + span {
margin-left: 0.5rem;
}
}
}
.doc-bd {
padding: 0.5rem 0;
font-size: 0.24rem;
font-weight: 400;
color: #666666;
line-height: 0.42rem;
}
</style>
......@@ -14,7 +14,7 @@ function onSubmit() {
const params = Object.assign({}, form, { picture: JSON.stringify(form.picture) })
createCourseRecord(params).then(() => {
Toast.success('发布成功')
router.push({ name: 'courseView', params: { id: form.course_id } })
router.push({ name: 'learnCourseView', params: { id: form.course_id } })
})
}
</script>
......
......@@ -8,10 +8,16 @@ const router = createRouter({
router.beforeEach(async (to, from, next) => {
const user = useUserStore()
if (to.meta.requireLogin) {
try {
await user.getUser()
if (to.meta.requireLogin && !user.isLogin) {
} catch (error) {
console.log(error)
}
if (!user.isLogin) {
location.href = `${import.meta.env.VITE_LOGIN_URL}?rd=${encodeURIComponent(location.href)}`
}
}
next()
})
......
......@@ -40,8 +40,8 @@ httpRequest.interceptors.response.use(
return Promise.reject(data)
}
if (data.code === 1) {
Toast.fail(data.message)
// return Promise.reject(data)
Toast.fail(data.message || data.msg)
return Promise.reject(data)
}
return data
},
......
......@@ -18,12 +18,7 @@ export default defineConfig(({ mode }) => {
cert: fs.readFileSync(path.join(__dirname, './https/dev.ezijing.com.pem'))
},
proxy: {
'/api/psp': {
target: 'https://psp-api.ezijing.com',
changeOrigin: true,
rewrite: path => path.replace('/api/psp/', '/')
},
'/api': 'https://project-api.ezijing.com'
'/api': 'https://psp-show-h5.ezijing.com'
}
},
resolve: {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论