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

release 1.0

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