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

整体调整

上级 9cfd4f3c
module.exports = {
url: '/api',
url: '/',
DesDir: './client-dist',
apiBaseURL: '/api',
isUploadStatic: false,
webpack: {
externals: {
......
module.exports = {
url: 'https://transport2.ezijing.com/api',
url: '/',
DesDir: './client-dist',
apiBaseURL: 'https://transport2.ezijing.com/api',
isUploadStatic: false,
webpack: {
externals: {
......
......@@ -2603,6 +2603,7 @@
"version": "7.10.2",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.10.2.tgz",
"integrity": "sha512-6sF3uQw2ivImfVIl62RZ7MXhO2tap69WeWK57vAaimT6AZbE4FbqjdEJIN1UqoD6wI6B+1n9UiagafH1sxjOtg==",
"dev": true,
"requires": {
"regenerator-runtime": "^0.13.4"
},
......@@ -2610,7 +2611,8 @@
"regenerator-runtime": {
"version": "0.13.5",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz",
"integrity": "sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA=="
"integrity": "sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA==",
"dev": true
}
}
},
......@@ -2810,16 +2812,6 @@
}
}
},
"@vant/icons": {
"version": "1.2.5",
"resolved": "https://registry.npm.taobao.org/@vant/icons/download/@vant/icons-1.2.5.tgz",
"integrity": "sha1-89tDxLMAMAgp48TpCb6qM9HL54Y="
},
"@vue/babel-helper-vue-jsx-merge-props": {
"version": "1.0.0",
"resolved": "https://registry.npm.taobao.org/@vue/babel-helper-vue-jsx-merge-props/download/@vue/babel-helper-vue-jsx-merge-props-1.0.0.tgz",
"integrity": "sha1-BI/leZWNpAj7eosqPsBQtQpmEEA="
},
"@vue/component-compiler-utils": {
"version": "3.2.0",
"resolved": "https://registry.npm.taobao.org/@vue/component-compiler-utils/download/@vue/component-compiler-utils-3.2.0.tgz?cache=0&sync_timestamp=1595427694165&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40vue%2Fcomponent-compiler-utils%2Fdownload%2F%40vue%2Fcomponent-compiler-utils-3.2.0.tgz",
......@@ -5211,14 +5203,6 @@
"entities": "^2.0.0"
}
},
"dom7": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/dom7/-/dom7-2.1.5.tgz",
"integrity": "sha512-xnhwVgyOh3eD++/XGtH+5qBwYTgCm0aW91GFgPJ3XG+jlsRLyJivnbP0QmUBFhI+Oaz9FV0s7cxgXHezwOEBYA==",
"requires": {
"ssr-window": "^2.0.0"
}
},
"domain-browser": {
"version": "1.2.0",
"resolved": "https://registry.npm.taobao.org/domain-browser/download/domain-browser-1.2.0.tgz?cache=0&sync_timestamp=1604239910191&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdomain-browser%2Fdownload%2Fdomain-browser-1.2.0.tgz",
......@@ -11074,11 +11058,6 @@
"tweetnacl": "~0.14.0"
}
},
"ssr-window": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ssr-window/-/ssr-window-2.0.0.tgz",
"integrity": "sha512-NXzN+/HPObKAx191H3zKlYomE5WrVIkoCB5IaSdvKokxTpjBdWfr0RaP+1Z5KOfDT0ZVz+2tdtiBkhsEQ9p+0A=="
},
"ssri": {
"version": "6.0.1",
"resolved": "https://registry.npm.taobao.org/ssri/download/ssri-6.0.1.tgz",
......@@ -11315,15 +11294,6 @@
"has-flag": "^3.0.0"
}
},
"swiper": {
"version": "5.4.5",
"resolved": "https://registry.npmjs.org/swiper/-/swiper-5.4.5.tgz",
"integrity": "sha512-7QjA0XpdOmiMoClfaZ2lYN6ICHcMm72LXiY+NF4fQLFidigameaofvpjEEiTQuw3xm5eksG5hzkaRsjQX57vtA==",
"requires": {
"dom7": "^2.1.5",
"ssr-window": "^2.0.0"
}
},
"table": {
"version": "5.4.6",
"resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz",
......@@ -12040,17 +12010,6 @@
"spdx-expression-parse": "^3.0.0"
}
},
"vant": {
"version": "2.10.3",
"resolved": "https://registry.npm.taobao.org/vant/download/vant-2.10.3.tgz",
"integrity": "sha1-+LejKpH17mgEVKwRW1vkaD/SA9E=",
"requires": {
"@babel/runtime": "7.x",
"@vant/icons": "1.2.5",
"@vue/babel-helper-vue-jsx-merge-props": "^1.0.0",
"vue-lazyload": "1.2.3"
}
},
"vary": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
......@@ -12099,11 +12058,6 @@
"resolved": "https://registry.npm.taobao.org/vue/download/vue-2.6.12.tgz?cache=0&sync_timestamp=1598480719140&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fvue%2Fdownload%2Fvue-2.6.12.tgz",
"integrity": "sha1-9evU+mvShpQD4pqJau1JBEVskSM="
},
"vue-awesome-swiper": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/vue-awesome-swiper/-/vue-awesome-swiper-4.1.1.tgz",
"integrity": "sha512-50um10t6N+lJaORkpwSi1wWuMmBI1sgFc9Znsi5oUykw2cO5DzLaBHcO2JNX21R+Ue4TGoIJDhhxjBHtkFrTEQ=="
},
"vue-eslint-parser": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-7.1.0.tgz",
......@@ -12145,11 +12099,6 @@
"resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-8.18.2.tgz",
"integrity": "sha512-0X5nBTCZAVjlwcrPaYJwNs3iipBBTv0AUHwQUOa8yP3XbQGWKbRHqBb3OhCYtum/IHDD21d/df5Xd2VgyxbxfA=="
},
"vue-lazyload": {
"version": "1.2.3",
"resolved": "https://registry.npm.taobao.org/vue-lazyload/download/vue-lazyload-1.2.3.tgz",
"integrity": "sha1-kB+ewVx+bKeHgaK65KNDaGve2yw="
},
"vue-loader": {
"version": "15.9.3",
"resolved": "https://registry.npm.taobao.org/vue-loader/download/vue-loader-15.9.3.tgz",
......
......@@ -2,37 +2,37 @@ import httpRequest from '@/utils/axios'
// 登录
export function login(data) {
return httpRequest.post('/passport/rest/login', data)
return httpRequest.post('/api/passport/rest/login', data)
}
// 绑定微信
export function bindWechat(data) {
return httpRequest.post('/passport/rest/wechat/bind-unionid', data)
return httpRequest.post('/api/passport/rest/wechat/bind-unionid', data)
}
// 重置密码
export function resetPassword(data) {
return httpRequest.post('/usercenter/user/update-pwd', data)
return httpRequest.post('/api/usercenter/user/update-pwd', data)
}
// 发送重置验证码
export function sendResetPasswordCode(data) {
return httpRequest.post('/usercenter/user/send-code', data)
return httpRequest.post('/api/usercenter/user/send-code', data)
}
// 登出
export function logout() {
return httpRequest.get('/passport/rest/logout')
return httpRequest.get('/api/passport/rest/logout')
}
// 获取用户信息
export function getUser() {
return httpRequest.get('/zy/user/getinfo')
return httpRequest.get('/api/zy/user/getinfo')
}
// 绑定游客
export function bindVisitor(data) {
return httpRequest.post('/zy/user/bind-account', data)
return httpRequest.post('/api/zy/user/bind-account', data)
}
// 获取是否VIP
export function getIsVip() {
return httpRequest.get('/zy/user/is-vip')
return httpRequest.get('/api/zy/user/is-vip')
}
// 创建游客用户
export function createGuestUser() {
return httpRequest.get('/zy/user/create-guest-user')
return httpRequest.get('/api/zy/user/create-guest-user')
}
......@@ -3,20 +3,20 @@ import httpRequest from '@/utils/axios'
* 获取免费课程列表
*/
export function getFreeCourseList() {
return httpRequest.get('/zy/v2/education/freecourse')
return httpRequest.get('/api/zy/v2/education/freecourse')
}
/**
* 获取课程列表
*/
export function getCourseModule() {
return httpRequest.get('/zy/v2/education/mokuai')
return httpRequest.get('/api/zy/v2/education/mokuai')
}
/**
* 获取课程列表
*/
export function getCourseList() {
return httpRequest.get('/zy/v2/education/courses/list')
return httpRequest.get('/api/zy/v2/education/courses/list')
}
/**
......@@ -24,7 +24,7 @@ export function getCourseList() {
* @param {string} courseId 课程ID
*/
export function getCourse(courseId) {
return httpRequest.get(`/zy/v2/education/courses/${courseId}`)
return httpRequest.get(`/api/zy/v2/education/courses/${courseId}`)
}
/**
......@@ -32,7 +32,7 @@ export function getCourse(courseId) {
* @param {string} courseId 课程ID
*/
export function getCourseTagList(courseId) {
return httpRequest.get(`/zy/v2/education/tag/tree/${courseId}`)
return httpRequest.get(`/api/zy/v2/education/tag/tree/${courseId}`)
}
/**
......@@ -40,33 +40,33 @@ export function getCourseTagList(courseId) {
* @param {string} tagId 知识点ID
*/
export function getCourseTag(tagId) {
return httpRequest.get(`/zy/v2/education/tag/${tagId}`)
return httpRequest.get(`/api/zy/v2/education/tag/${tagId}`)
}
/**
* 获取搜索记录
*/
export function getSearchTips() {
return httpRequest.get('/zy/v2/education/search/tips')
return httpRequest.get('/api/zy/v2/education/search/tips')
}
/**
* 知识点搜索
*/
export function getSearchTagList(data) {
return httpRequest.post('/zy/v2/education/search/tag', data)
return httpRequest.post('/api/zy/v2/education/search/tag', data)
}
/**
* 视频课程搜索
*/
export function getSearchCourseVideoList(data) {
return httpRequest.post('/zy/v2/education/search/chapter1', data)
return httpRequest.post('/api/zy/v2/education/search/chapter1', data)
}
/**
* 课程搜索
*/
export function getSearchCourseList(data) {
return httpRequest.post('/zy/v2/education/search/chapter2', data)
return httpRequest.post('/api/zy/v2/education/search/chapter2', data)
}
......@@ -4,31 +4,31 @@ import httpRequest from '@/utils/axios'
* 随堂测试课程章节列表
*/
export function getCourseChapterList() {
return httpRequest.get('/zy/v2/education/courses/my')
return httpRequest.get('/api/zy/v2/education/courses/my')
}
/* 模拟考试设置角色 */
export function setRole(data) {
return httpRequest.post('/zy/v2/examination/role', data, {
return httpRequest.post('/api/zy/v2/examination/role', data, {
headers: { 'Content-Type': 'multipart/form-data' }
})
}
/* 获取考试状态 */
export function getExamStatus(data) {
return httpRequest.get('/zy/v2/examination/examination-papers-status', data, {
return httpRequest.get('/api/zy/v2/examination/examination-papers-status', data, {
headers: { 'Content-Type': 'multipart/form-data' }
})
}
/* 知识点考题获取 */
export function getExam(data) {
return httpRequest.get('/zy/v2/examination/course-papers', data)
return httpRequest.get('/api/zy/v2/examination/course-papers', data)
}
/* 知识点考题缓存 */
export function cacheExam(data) {
return httpRequest.post('/zy/v2/examination/course-papers', data, {
return httpRequest.post('/api/zy/v2/examination/course-papers', data, {
headers: { 'Content-Type': 'multipart/form-data' }
})
}
......@@ -4,7 +4,7 @@ import httpRequest from '@/utils/axios'
* 获取我的已做试题
*/
export function getMyQuestion(data) {
return httpRequest.get('/zy/v2/examination/my-question', data, {
return httpRequest.get('/api/zy/v2/examination/my-question', data, {
headers: { 'Content-Type': 'multipart/form-data' }
})
}
......@@ -13,47 +13,47 @@ export function getMyQuestion(data) {
* 获取我的试题详情
*/
export function getMyQuestionDetail(data) {
return httpRequest.get('/zy/v2/examination/question/detail', data)
return httpRequest.get('/api/zy/v2/examination/question/detail', data)
}
/**
* 获取我的所有试题
*/
export function getAllQuestion(data) {
return httpRequest.get('/zy/v2/examination/my-question-all', data)
return httpRequest.get('/api/zy/v2/examination/my-question-all', data)
}
/* 删除试题 */
export function deleteQuestion(data) {
return httpRequest.post('/zy/v2/examination/delete-my-question', data, {
return httpRequest.post('/api/zy/v2/examination/delete-my-question', data, {
headers: { 'Content-Type': 'multipart/form-data' }
})
}
/* 收藏试题 */
export function collectQuestion(data) {
return httpRequest.post('/zy/v2/examination/add-collection', data, {
return httpRequest.post('/api/zy/v2/examination/add-collection', data, {
headers: { 'Content-Type': 'multipart/form-data' }
})
}
/* 缓存试题 */
export function cacheQuestion(data) {
return httpRequest.post('/zy/v2/examination/cache-question', data, {
return httpRequest.post('/api/zy/v2/examination/cache-question', data, {
headers: { 'Content-Type': 'multipart/form-data' }
})
}
/* 意见反馈 */
export function submitFeedback(data) {
return httpRequest.post('/zy/v2/feedback/commit', data, {
return httpRequest.post('/api/zy/v2/feedback/commit', data, {
headers: { 'Content-Type': 'multipart/form-data' }
})
}
// /* 获取考试状态 */
// export function getExamStatus(data) {
// return httpRequest.get('/zy/v2/examination/examination-papers-status', data, {
// return httpRequest.get('/api/zy/v2/examination/examination-papers-status', data, {
// headers: { 'Content-Type': 'multipart/form-data' }
// })
// }
......@@ -4,14 +4,14 @@ import httpRequest from '@/utils/axios'
* 获取商品详情
*/
export function getGoodsDetails(id) {
return httpRequest.get(`/zy/v2/mall/product/${id}`)
return httpRequest.get(`/api/zy/v2/mall/product/${id}`)
}
/**
* 获取我的购买订单
*/
export function getMyOrder() {
return httpRequest.get('/zy/v2/mall/order/my')
return httpRequest.get('/api/zy/v2/mall/order/my')
}
/* 获取openid */
......@@ -21,5 +21,5 @@ export function getOpenid(data) {
/* 监听支付状态 */
export function getOrderStatus() {
return httpRequest.get('/zy/v2/mall/order/status')
return httpRequest.get('/api/zy/v2/mall/order/status')
}
<template>
<div id="app">
<router-view :key="$route.fullPath" />
<router-view />
</div>
</template>
<template>
<div class="card">
<div class="card-hd">
<h3 class="card-hd__title">{{ title }}</h3>
<div class="card-hd__aside">
<slot name="aside"></slot>
</div>
</div>
<div class="card-bd">
<slot></slot>
</div>
</div>
</template>
<script>
export default {
name: 'Card',
props: {
title: String
}
}
</script>
<style lang="scss">
.card-hd {
display: flex;
justify-content: space-between;
}
.card-hd__title {
margin: 0;
padding-bottom: 0.1rem;
font-size: 0.3rem;
font-weight: bold;
line-height: 1;
color: #333;
border-bottom: 0.06rem solid #c62245;
}
.card-bd {
padding: 0.2rem 0;
}
</style>
<template>
<van-button native-type="button" :disabled="currentDisabled" :loading="loading">{{ curretnValue }}</van-button>
</template>
<script>
export default {
name: 'CountdownButton',
props: {
step: { type: Number, default: 1000 },
disabled: { type: Boolean, default: false },
seconds: { type: Number, default: 60 },
defaultValue: { type: String, default: '获取验证码' }
},
data() {
return {
currentDisabled: false,
currentSeconds: 0,
loading: false,
timer: null
}
},
computed: {
curretnValue() {
const longTime = this.seconds - this.currentSeconds
return longTime < this.seconds ? `${longTime}秒后重发` : this.defaultValue
}
},
methods: {
genTimer() {
this.timer && clearInterval(this.timer)
this.timer = setInterval(() => {
this.currentSeconds++
if (this.currentSeconds === this.seconds) {
this.stop()
}
}, this.step)
},
start() {
this.loading = false
this.currentDisabled = true
this.genTimer()
},
stop() {
this.timer && clearInterval(this.timer)
this.currentSeconds = 0
this.currentDisabled = false
}
}
}
</script>
<style lang="scss" scoped>
.van-button {
height: 40px;
line-height: 38px;
}
.van-button--default {
border-color: #ccc;
}
</style>
<template>
<van-collapse v-model="activeNames">
<van-collapse-item :title="item.name" :name="item.id" v-for="item in data" :key="item.id">
<template #right-icon>
<van-icon name="arrow" />
<van-icon name="arrow-down" />
</template>
<el-collapse v-model="activeNames">
<el-collapse-item :title="item.name" :name="item.id" v-for="item in data" :key="item.id">
<ul>
<li v-for="subItem in item.children" :key="subItem.id" @click="$emit('on-click', subItem)">
<div class="name">
{{subItem.name}}
<template v-if="subItem.free">(免费)</template>
</div>
<div
class="progress"
v-if="showProgress"
>{{ progressText(subItem.video_progress, subItem.free) }}</div>
<div class="name">{{ subItem.name }}</div>
<div class="progress" v-if="showProgress">{{ progressText(subItem.video_progress) }}</div>
</li>
</ul>
</van-collapse-item>
</van-collapse>
</el-collapse-item>
</el-collapse>
</template>
<script>
......@@ -33,16 +23,11 @@ export default {
activeNames: []
}
},
computed: {
isVip() {
return this.$store.state.isVip
}
},
methods: {
progressText(value, isFree) {
progressText(value) {
value = parseInt(value)
if (value === 0) {
return isFree || this.isVip ? '未开始' : '未开通'
return '未开始'
}
if (value === 100) {
return '已学完'
......@@ -54,37 +39,31 @@ export default {
</script>
<style lang="scss" scoped>
::v-deep .van-cell {
padding-left: 0;
padding-right: 0;
.el-collapse {
border: 0;
}
::v-deep .van-collapse-item__content {
padding: 0;
::v-deep .el-collapse-item__header {
font-size: 14px;
font-weight: 600;
color: #222;
}
::v-deep .van-collapse-item--border::after {
left: 0;
right: 0;
}
::v-deep .van-collapse-item__title--expanded::after {
display: none;
::v-deep .el-collapse-item__content {
padding-bottom: 10px;
}
li {
display: flex;
padding: 10px 0;
&:first-child {
padding-top: 0;
}
&:last-child {
padding-bottom: 20px;
padding: 5px 0;
cursor: pointer;
color: #666;
&:hover {
color: #c01540;
}
.name {
flex: 1;
font-size: 13px;
overflow: hidden;
}
.progress {
margin-left: 20px;
font-size: 12px;
color: #999;
}
}
......
<template>
<div class="list" v-show="loaded">
<div class="course-list" v-loading="!loaded">
<template v-if="list.length">
<course-list-item
v-for="item in list"
:data="item"
:key="item.id"
v-bind="$attrs"
v-on="$listeners"
/>
<course-list-item v-for="item in list" :data="item" :key="item.id" v-bind="$attrs" v-on="$listeners" />
</template>
<template v-else>
<slot name="empty">
<van-empty description="暂无内容" />
<p class="empty-tips">暂无内容</p>
</slot>
</template>
</div>
......
<template>
<div class="course-item" @click="onClick(data)">
<div class="course-item-content">
<h3 class="course-item__title">{{data.course_name}}</h3>
<p class="course-item__text" v-if="data.describe">{{data.describe}}</p>
</div>
<div class="course-item-pic" v-if="data.picture">
<img :src="data.picture" />
</div>
</div>
</template>
<script>
export default {
name: 'CourseItem',
props: {
data: { type: Object, required: true }
},
computed: {
isWeapp() {
return this.$store.state.isWeapp
}
},
methods: {
onClick(data) {
if (this.isWeapp) {
wx.miniProgram.navigateTo({
url: `/pages/course/free?id=${data.course_id}`
})
} else {
window.alert('请在微信小程序中打开')
}
}
}
}
</script>
<style lang="scss" scoped>
.course-item {
display: flex;
padding: 0.2rem 0;
border-bottom: 1px solid #f1f1f1;
}
.course-item-content {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
overflow: hidden;
}
.course-item-pic {
width: 2.4rem;
height: 1.35rem;
margin-left: 10px;
border-radius: 6px;
overflow: hidden;
img {
width: 100%;
height: 100%;
object-fit: cover;
}
}
.course-item__title {
margin: 0;
font-size: 0.3rem;
font-weight: 400;
color: #222;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
.course-item__text {
font-size: 0.26rem;
line-height: 0.42rem;
color: #999;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
</style>
<template>
<div class="course-item custom-class" :style="isOpen ? 'padding-bottom:0;' : ''">
<div class="course-item-top" @click="toggleChild">
<div class="course-arrow" :class="isOpen ? 'course-arrow__up' : 'course-arrow__down'"></div>
<div class="course-item">
<div class="course-item-top">
<img class="course-item-pic" :src="data.photo" v-if="data.photo" />
<div class="course-item-content">
<div class="course-item__title">{{ data.title }}</div>
<div class="course-item__tools">
<div>
<div
class="course-item__text course-item__text__freevideo"
>{{ data.free_video_num }}个免费视频</div>
</div>
<div class="course-item__text course-item__text__freevideo">{{ data.free_video_num }}个免费视频</div>
<div class="course-item__text course-item__text__video">{{ data.video_num }}节视频课</div>
<div class="course-item__text course-item__text__course">{{ data.course_num }}节课</div>
</div>
</div>
</div>
<div class="course-item-bottom" v-show="isOpen">
<div class="course-child" v-for="item in data.child" :key="item.id" @click="onClick(item)">
<div class="name">{{item.course_name}}</div>
<div class="progress" v-if="showProgress">{{item.video_progress | progressText}}</div>
<div class="course-item-bottom">
<div class="course-child" v-for="item in data.child" :key="item.id" @click="handleClick(item)">
<div class="name">{{ item.course_name }}</div>
<div class="progress" v-if="showProgress">{{ item.video_progress | progressText }}</div>
</div>
</div>
</div>
......@@ -33,9 +28,7 @@ export default {
showProgress: { type: Boolean, default: false }
},
data() {
return {
isOpen: false
}
return {}
},
filters: {
progressText(value) {
......@@ -50,11 +43,8 @@ export default {
}
},
methods: {
toggleChild() {
this.isOpen = !this.isOpen
},
onClick(data) {
this.$emit('on-click', data)
handleClick(data) {
this.$router.push({ name: 'courseLearnItem', params: { id: data.id } })
}
}
}
......@@ -62,31 +52,19 @@ export default {
<style lang="scss" scoped>
.course-item {
padding: 0.3rem 0;
border-bottom: 1px solid #ccc;
}
.course-arrow {
width: 0.6rem;
height: 2rem;
}
.course-arrow__up {
background: url('https://zws-imgs-pub.ezijing.com/transport/weapp/icon_arrow_up.png') no-repeat left center;
background-size: 0.3rem 0.3rem;
}
.course-arrow__down {
background: url('https://zws-imgs-pub.ezijing.com/transport/weapp/icon_arrow_down.png') no-repeat left center;
background-size: 0.3rem 0.3rem;
background: #ffffff;
border-radius: 8px;
padding: 30px;
margin-bottom: 20px;
}
.course-item-top {
display: flex;
}
.course-item-bottom {
padding-left: 0.6rem;
}
.course-item-pic {
width: 3.15rem;
height: 2rem;
margin-right: 0.15rem;
width: 160px;
height: 90px;
margin-right: 20px;
border-radius: 2px;
overflow: hidden;
}
.course-item-content {
......@@ -97,8 +75,8 @@ export default {
overflow: hidden;
}
.course-item__title {
font-size: 0.26rem;
color: #666;
font-size: 18px;
color: #222;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
......@@ -106,43 +84,30 @@ export default {
}
.course-item__text {
display: inline-block;
height: 0.48rem;
padding: 0 0.2rem;
font-size: 0.24rem;
line-height: 0.48rem;
text-align: center;
box-sizing: border-box;
font-size: 14px;
}
.course-item__text + .course-item__text {
margin-left: 0.1rem;
}
.course-item__text__course {
color: #fff;
background-color: #75b0ff;
color: #88bbff;
}
.course-item__text__video {
min-width: 1.8rem;
color: #fff;
background-color: #5ad0b2;
color: #5ad0b2;
}
.course-item__text__freevideo {
min-width: 1.8rem;
margin-bottom: 0.1rem;
color: #fff;
background-color: #d05a5a;
color: #d05a5a;
}
.course-child {
display: flex;
align-items: center;
padding: 15px 15px 15px 0;
padding: 20px 0;
border-bottom: 1px solid #eee;
background: url('https://zws-imgs-pub.ezijing.com/transport/weapp/icon_arrow.png') no-repeat right center;
background-size: 5px 10px;
cursor: pointer;
.name {
flex: 1;
font-size: 13px;
color: #666;
font-size: 18px;
}
.progress {
margin-left: 20px;
......@@ -150,7 +115,4 @@ export default {
color: #999;
}
}
.course-child:last-child {
border-bottom: 0;
}
</style>
<template>
<el-collapse v-model="activeNames">
<el-collapse-item :title="item.name" :name="item.id" v-for="item in data" :key="item.id">
<template #right-icon>
<van-icon name="arrow" />
<van-icon name="arrow-down" />
</template>
<ul>
<li v-for="subItem in item.children" :key="subItem.id" @click="$emit('on-click', subItem)">
<div class="name">
{{ subItem.name }}
<template v-if="subItem.free">(免费)</template>
</div>
<div class="progress" v-if="showProgress">{{ progressText(subItem.video_progress, subItem.free) }}</div>
</li>
</ul>
</el-collapse-item>
</el-collapse>
</template>
<script>
export default {
props: {
courseId: { type: String },
data: { type: Array, required: true, default: () => [] },
showProgress: { type: Boolean, default: false }
},
data() {
return {
activeNames: []
}
},
computed: {
isVip() {
return this.$store.state.isVip
}
},
methods: {
progressText(value, isFree) {
value = parseInt(value)
if (value === 0) {
return isFree || this.isVip ? '未开始' : '未开通'
}
if (value === 100) {
return '已学完'
}
return `已学${value}%`
}
}
}
</script>
<style lang="scss" scoped>
::v-deep .van-cell {
padding-left: 0;
padding-right: 0;
}
::v-deep .el-collapse-item__content {
padding: 0;
}
::v-deep .el-collapse-item--border::after {
left: 0;
right: 0;
}
::v-deep .el-collapse-item__title--expanded::after {
display: none;
}
li {
display: flex;
padding: 10px 0;
&:first-child {
padding-top: 0;
}
&:last-child {
padding-bottom: 20px;
}
.name {
flex: 1;
font-size: 13px;
overflow: hidden;
}
.progress {
margin-left: 20px;
font-size: 12px;
color: #999;
}
}
</style>
import Before from './Before'
export default () => {
return new Before()
}
......@@ -72,6 +72,9 @@ export default {
flex-direction: column;
align-items: center;
padding-top: 20px;
&:hover {
background-color: #fff4f7;
}
}
.user-avatar {
width: 60px;
......@@ -79,6 +82,11 @@ export default {
background-color: #999;
border-radius: 50%;
overflow: hidden;
img {
width: 100%;
height: 100%;
object-fit: contain;
}
}
.user-tools {
padding: 10px 0;
......@@ -94,11 +102,13 @@ export default {
li {
text-align: center;
font-size: 16px;
font-weight: 600;
color: #666;
a {
display: block;
padding: 16px 0;
}
&:hover,
&.is-active {
color: #c01540;
background-color: #fff4f7;
......
......@@ -33,6 +33,7 @@ export default {
.title {
font-size: 24px;
font-weight: 600;
color: #222;
}
......
import Vue from 'vue' // 引入vue框架
import router from './router' // router定义
import Vue from 'vue'
import router from './router'
import store from './store'
import App from './app.vue' // 初始化 vue页面
import './style.scss' // 公共样式
// import createBefore from './components/beforeEnter'
import App from './app.vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import './style.scss'
import BeforeEnter from './utils/beforeEnter'
const before = new BeforeEnter()
Vue.use(ElementUI)
/* 创建实例之前,通过导航守卫,处理部分逻辑,如:是否直接进入系统 */
// const before = createBefore()
/* 导航守卫 */
router.beforeEach((to, from, next) => {
// before.update(to, from, next)
before.update(to, from, next)
next()
})
......
......@@ -3,6 +3,8 @@ export default class Exam extends BaseAPI {
getExam = (obj, url) => this.get(url, obj)
getPower = (obj, url) => this.post(url, obj, { headers: { 'Content-Type': 'multipart/form-data' } })
examSubmit = (obj, url) => this.post(url, obj, { headers: { 'Content-Type': 'multipart/form-data' } })
deleteCollect = (obj) => this.post('/zy/v2/examination/delete-my-question', obj, { headers: { 'Content-Type': 'multipart/form-data' } })
collectQuestion = (obj) => this.post('/zy/v2/examination/add-collection', obj, { headers: { 'Content-Type': 'multipart/form-data' } })
deleteCollect = obj =>
this.post('/api/zy/v2/examination/delete-my-question', obj, { headers: { 'Content-Type': 'multipart/form-data' } })
collectQuestion = obj =>
this.post('/api/zy/v2/examination/add-collection', obj, { headers: { 'Content-Type': 'multipart/form-data' } })
}
......@@ -11,14 +11,14 @@ export function getOpenId(params) {
* 获取商品
*/
export function getProduct(productId) {
return httpRequest.get(`/zy/v2/mall/product/${productId}`)
return httpRequest.get(`/api/zy/v2/mall/product/${productId}`)
}
/**
* 生成订单
*/
export function genOrder(data) {
return httpRequest.post('/zy/v2/mall/order/pre', data, {
return httpRequest.post('/api/zy/v2/mall/order/pre', data, {
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
})
}
......@@ -27,12 +27,12 @@ export function genOrder(data) {
* 获取订单
*/
export function getOrder(orderId) {
return httpRequest.get(`/zy/v2/mall/order/${orderId}`)
return httpRequest.get(`/api/zy/v2/mall/order/${orderId}`)
}
/**
* 获取订单状态
*/
export function getOrderStatus() {
return httpRequest.get('/zy/v2/mall/order/status')
return httpRequest.get('/api/zy/v2/mall/order/status')
}
<template>
<div class="main-container" style="margin:0 0.15rem">
<course-list @on-click="handleClick" />
</div>
<course-list />
</template>
<script>
......@@ -9,24 +7,6 @@ import CourseList from '@/components/CourseList.vue'
export default {
name: 'CourseLearn',
components: { CourseList },
metaInfo: {
title: '考证课程'
},
computed: {
isWeapp() {
return this.$store.state.isWeapp
}
},
methods: {
handleClick(data) {
if (this.isWeapp) {
const url = `/pages/web/index?src=${window.location.origin}/course/learn/${data.id}`
wx.miniProgram.navigateTo({ url })
} else {
this.$router.push({ name: 'courseLearnItem', params: { id: data.id } })
}
}
}
components: { CourseList }
}
</script>
<template>
<div class="main-container" v-if="loaded">
<div class="course-title">{{detail.course_name}}</div>
<van-tabs
class="main-tabs"
v-model="tabActive"
color="#c62245"
:line-width="80"
:line-height="2"
:border="true"
:swipeable="true"
>
<van-tab title="按章节学习">
<template v-if="detail.chapters && detail.chapters.length">
<div class="main-container" v-loading="!loaded">
<div class="course-top" v-if="detail.curriculum">
<div class="course-top-hd">
<div class="course-top__title">{{ detail.curriculum.curriculum_name }}</div>
</div>
<div class="course-top-bd">
<div class="course-top__pic"><img :src="detail.curriculum.curriculum_picture" /></div>
<div class="course-top__content" v-html="detail.curriculum.curriculum_represent"></div>
</div>
</div>
<el-tabs v-model="tabActive">
<el-tab-pane label="按章节学习">
<course-chapter :courseId="courseId" :data="detail.chapters" @on-click="handleClick"></course-chapter>
</template>
<van-empty description="暂无内容" v-else />
</van-tab>
<van-tab title="按考点学习">
<div class="tab-content">
</el-tab-pane>
<el-tab-pane label="按考点学习">
<course-tag :courseId="courseId"></course-tag>
</div>
</van-tab>
</van-tabs>
</el-tab-pane>
</el-tabs>
</div>
</template>
......@@ -47,36 +42,22 @@ export default {
computed: {
courseId() {
return this.$route.params.id
},
isWeapp() {
return this.$store.state.isWeapp
},
isVip() {
return this.$store.state.isVip
}
},
methods: {
// 课程学习
getCourse() {
this.loaded = false
api.getCourse(this.courseId).then(response => {
this.loaded = true
response.chapters = response.chapters.filter(item => {
item.children = item.children.filter(
child => child.type === 2 && child.resource_id && child.resource_id !== '6684350363920760832'
)
return item.children.length
})
api
.getCourse(this.courseId)
.then(response => {
this.detail = response
})
.finally(() => {
this.loaded = true
})
},
handleClick(data) {
if (this.isWeapp) {
wx.miniProgram.navigateTo({ url: `/pages/course/item?id=${this.courseId}&chapter_id=${data.id}` })
} else {
window.alert('请在微信小程序中打开')
}
}
handleClick(data) {}
},
beforeMount() {
this.getCourse()
......@@ -85,17 +66,44 @@ export default {
</script>
<style lang="scss" scoped>
.course-title {
font-size: 15px;
font-weight: 600;
color: #222;
padding: 20px 0 10px;
.main-container {
height: 100%;
padding: 30px;
background-color: #fff;
border-radius: 8px;
box-sizing: border-box;
}
.course-top {
padding-bottom: 20px;
}
.course-top-hd {
padding-bottom: 8px;
margin-bottom: 10px;
border-bottom: 1px solid #ccc;
}
.course-top__title {
font-size: 18px;
font-weight: bold;
line-height: 1;
}
.course-top-bd {
display: flex;
}
.course-top__pic {
width: 160px;
height: 90px;
margin-right: 20px;
border-radius: 2px;
overflow: hidden;
img {
width: 100%;
height: 100%;
object-fit: cover;
}
}
.tab-content {
margin-left: -0.4rem;
margin-right: -0.4rem;
min-height: 100vh;
background: #eee;
padding: 0.4rem;
.course-top__content {
flex: 1;
line-height: 24px;
overflow: hidden;
}
</style>
......@@ -6,5 +6,5 @@ const httpRequest = new BaseAPI(webConf)
* 获取课程列表
*/
export function getCourseList() {
return httpRequest.get('/zy/v2/education/mokuai')
return httpRequest.get('/api/zy/v2/education/mokuai')
}
......@@ -10,7 +10,6 @@ export default {
data() {
return {
navList: [
{ title: '我的已购课程', path: '/my/order' },
{ title: '我的已学课程', path: '/my/course' },
{ title: '我的已做试题', path: '/my/test' }
]
......
<template>
<app-container> </app-container>
</template>
<script>
import AppContainer from '@/components/AppContainer'
export default {
components: { AppContainer }
}
</script>
......@@ -4,26 +4,26 @@ import httpRequest from '@/utils/axios'
* 获取搜索记录
*/
export function getSearchTips() {
return httpRequest.get('/zy/v2/education/search/tips')
return httpRequest.get('/api/zy/v2/education/search/tips')
}
/**
* 知识点搜索
*/
export function getSearchTagList(data) {
return httpRequest.post('/zy/v2/education/search/tag', data)
return httpRequest.post('/api/zy/v2/education/search/tag', data)
}
/**
* 视频课程搜索
*/
export function getSearchCourseVideoList(data) {
return httpRequest.post('/zy/v2/education/search/chapter1', data)
return httpRequest.post('/api/zy/v2/education/search/chapter1', data)
}
/**
* 课程搜索
*/
export function getSearchCourseList(data) {
return httpRequest.post('/zy/v2/education/search/chapter2', data)
return httpRequest.post('/api/zy/v2/education/search/chapter2', data)
}
import Layout from '@/components/layout'
export default [
{ path: '/', redirect: '/index' },
/* 课程检测 */
{
path: '/exam/abilityAnswer',
name: 'abilityAnswer',
component: () => import('../pages/courseExam/abilityAnswer.vue')
},
/* 能力自测首页 */
{
path: '/exam/index',
name: 'examIndex',
component: () => import('../pages/courseExam/index.vue')
},
/* 能力自测答题页面 */
{
path: '/exam/answer',
name: 'examAnswer',
component: () => import('../pages/courseExam/answer.vue')
},
/* 能力自测答题结果 */
{
path: '/exam/result',
name: 'examResult',
component: () => import('../pages/courseExam/answerResult.vue')
},
/* 知识点详情 */
{
path: '/exam/courseNode',
name: 'courseNode',
component: () => import('../pages/courseExam/courseNode.vue')
},
/* 知识点考试 */
{
path: '/exam/courseNodeExam',
name: 'courseNodeExam',
component: () => import('../pages/courseExam/courseNodeExam.vue')
},
/* 模拟考试 */
{
path: '/mock/index',
name: 'mockIndex',
component: () => import('../pages/mockExam/index.vue')
// meta: { requiredLogin: true }
},
/* 模拟考试答题页面 */
{
path: '/mock/answer',
name: 'mockAnswer',
component: () => import('../pages/mockExam/answer.vue')
},
/* 模拟考试答题页面 */
{
path: '/mock/result',
name: 'mockResult',
component: () => import('../pages/mockExam/answerResult.vue')
},
// 课程学习
{
path: '/course/learn',
name: 'courseLearn',
component: () => import('../pages/course/learn/index.vue')
},
// 考证课程
const courseRoutes = [
// 课程学习列表
{ path: '/course/learn', component: () => import(/* webpackChunkName: "course-learn" */ '@/pages/course/learn') },
// 课程学习详情
{
path: '/course/learn/:id',
name: 'courseLearnItem',
component: () => import('../pages/course/learn/item.vue')
},
// 听课列表
{
path: '/course/player',
name: 'coursePlayer',
component: () => import('../pages/course/player/index.vue')
},
// 听课详情
{
path: '/course/player/:id',
name: 'coursePlayerItem',
component: () => import('../pages/course/player/item.vue')
},
// 课程知识点
{
path: '/course/learn/:courseId/tag/:chapterId',
name: 'courseTag',
component: () => import('../pages/course/tag/list.vue')
},
// 课程知识点详情
{
path: '/course/tag/:id',
name: 'courseTagItem',
component: () => import('../pages/course/tag/item.vue')
},
// 登录
{
path: '/login',
name: 'login',
component: () => import('../pages/login/login.vue')
},
// 我的-已购课程
{
path: '/my/buyCourses',
name: 'buyCourses',
component: () => import('../pages/my/buyCourses.vue'),
meta: { requiredLogin: true }
},
// 我的-已做试题
{
path: '/my/questionsList',
name: 'questionsList',
component: () => import('../pages/my/questionsList.vue')
},
// 错题列表
{
path: '/errorQuestionList',
name: 'errorQuestionList',
component: () => import('../pages/my/errorQuestionList.vue')
},
// 我的-已做试题详情
{
path: '/my/questionsDetails',
name: 'questionsDetails',
component: () => import('../pages/my/questionsDetails.vue')
},
// 我的-试题详情-答题卡
{
path: '/my/answerCard',
name: 'answerCard',
component: () => import('../pages/my/answerCard.vue')
},
// 我的-收藏试题
{
path: '/my/collectQuestions',
name: 'collectQuestions',
component: () => import('../pages/my/collectQuestions.vue')
},
// 我的-发票页面
{
path: '/my/invoice',
name: 'myInvoice',
component: () => import('../pages/my/invoice.vue'),
meta: { requiredLogin: true }
},
// 我的-联系客服
{
path: '/my/service',
name: 'myService',
component: () => import('../pages/my/service.vue')
},
// 我的-意见反馈
{
path: '/my/feedback',
name: 'myFeedback',
component: () => import('../pages/my/feedback.vue')
},
{
path: '/buy',
name: 'buy',
component: () => import('../pages/buy/index.vue')
component: () => import(/* webpackChunkName: "course-learn" */ '@/pages/course/learn/item')
}
]
export default [
{ path: '*', redirect: '/index' },
{ path: '/', redirect: '/index' },
// /* 课程检测 */
// {
// path: '/exam/abilityAnswer',
// name: 'abilityAnswer',
// component: () => import('../pages/courseExam/abilityAnswer.vue')
// },
// /* 能力自测首页 */
// {
// path: '/exam/index',
// name: 'examIndex',
// component: () => import('../pages/courseExam/index.vue')
// },
// /* 能力自测答题页面 */
// {
// path: '/exam/answer',
// name: 'examAnswer',
// component: () => import('../pages/courseExam/answer.vue')
// },
// /* 能力自测答题结果 */
// {
// path: '/exam/result',
// name: 'examResult',
// component: () => import('../pages/courseExam/answerResult.vue')
// },
// /* 知识点详情 */
// {
// path: '/exam/courseNode',
// name: 'courseNode',
// component: () => import('../pages/courseExam/courseNode.vue')
// },
// /* 知识点考试 */
// {
// path: '/exam/courseNodeExam',
// name: 'courseNodeExam',
// component: () => import('../pages/courseExam/courseNodeExam.vue')
// },
// /* 模拟考试 */
// {
// path: '/mock/index',
// name: 'mockIndex',
// component: () => import('../pages/mockExam/index.vue')
// // meta: { requiredLogin: true }
// },
// /* 模拟考试答题页面 */
// {
// path: '/mock/answer',
// name: 'mockAnswer',
// component: () => import('../pages/mockExam/answer.vue')
// },
// /* 模拟考试答题页面 */
// {
// path: '/mock/result',
// name: 'mockResult',
// component: () => import('../pages/mockExam/answerResult.vue')
// },
// // 听课列表
// {
// path: '/course/player',
// name: 'coursePlayer',
// component: () => import('../pages/course/player/index.vue')
// },
// // 听课详情
// {
// path: '/course/player/:id',
// name: 'coursePlayerItem',
// component: () => import('../pages/course/player/item.vue')
// },
// // 课程知识点
// {
// path: '/course/learn/:courseId/tag/:chapterId',
// name: 'courseTag',
// component: () => import('../pages/course/tag/list.vue')
// },
// // 课程知识点详情
// {
// path: '/course/tag/:id',
// name: 'courseTagItem',
// component: () => import('../pages/course/tag/item.vue')
// },
// // 我的-已购课程
// {
// path: '/my/buyCourses',
// name: 'buyCourses',
// component: () => import('../pages/my/buyCourses.vue'),
// meta: { requiredLogin: true }
},
// 学习提醒
{
path: '/my/alarm',
name: 'MyAlarm',
component: () => import('../pages/my/alarm/index.vue'),
meta: { requiredLogin: true }
},
// 已学课程
{
path: '/my/learn',
name: 'MyLearn',
component: () => import('../pages/my/learn/index.vue')
},
// 课程学习详情
{
path: '/my/learn/:id',
name: 'myLearnItem',
component: () => import('../pages/my/learn/item.vue')
},
/* 首页 */
{
path: '/index',
component: Layout,
children: [{ path: '', component: () => import(/* webpackChunkName: "feedback" */ '@/pages/home') }]
},
/* 搜索 */
{
path: '/search',
// },
// // 我的-已做试题
// {
// path: '/my/questionsList',
// name: 'questionsList',
// component: () => import('../pages/my/questionsList.vue')
// },
// // 错题列表
// {
// path: '/errorQuestionList',
// name: 'errorQuestionList',
// component: () => import('../pages/my/errorQuestionList.vue')
// },
// // 我的-已做试题详情
// {
// path: '/my/questionsDetails',
// name: 'questionsDetails',
// component: () => import('../pages/my/questionsDetails.vue')
// },
// // 我的-试题详情-答题卡
// {
// path: '/my/answerCard',
// name: 'answerCard',
// component: () => import('../pages/my/answerCard.vue')
// },
// // 我的-收藏试题
// {
// path: '/my/collectQuestions',
// name: 'collectQuestions',
// component: () => import('../pages/my/collectQuestions.vue')
// },
// // 我的-发票页面
// {
// path: '/my/invoice',
// name: 'myInvoice',
// component: () => import('../pages/my/invoice.vue'),
// meta: { requiredLogin: true }
// },
// // 我的-联系客服
// {
// path: '/my/service',
// name: 'myService',
// component: () => import('../pages/my/service.vue')
// },
// // 我的-意见反馈
// {
// path: '/my/feedback',
// name: 'myFeedback',
// component: () => import('../pages/my/feedback.vue')
// },
// {
// path: '/buy',
// name: 'buy',
// component: () => import('../pages/buy/index.vue')
// // meta: { requiredLogin: true }
// },
// // 已学课程
// {
// path: '/my/learn',
// name: 'MyLearn',
// component: () => import('../pages/my/learn/index.vue')
// },
// // 课程学习详情
// {
// path: '/my/learn/:id',
// name: 'myLearnItem',
// component: () => import('../pages/my/learn/item.vue')
// },
{
path: '/',
component: Layout,
children: [{ path: '', component: () => import(/* webpackChunkName: "search" */ '@/pages/search') }]
},
children: [
/* 首页 */
{ path: '/index', component: () => import(/* webpackChunkName: "feedback" */ '@/pages/home') },
// 搜索
{ path: '/search', component: () => import(/* webpackChunkName: "search" */ '@/pages/search') },
/* 意见反馈 */
{
path: '/feedback',
component: Layout,
children: [{ path: '', component: () => import(/* webpackChunkName: "feedback" */ '@/pages/feedback') }]
},
{ path: '/feedback', component: () => import(/* webpackChunkName: "feedback" */ '@/pages/feedback') },
/* 联系客服 */
{
path: '/contact',
component: Layout,
children: [{ path: '', component: () => import(/* webpackChunkName: "contact" */ '@/pages/contact') }]
},
{ path: '/contact', component: () => import(/* webpackChunkName: "contact" */ '@/pages/contact') },
/* 通知 */
{ path: '/messages', component: () => import(/* webpackChunkName: "messages" */ '@/pages/messages') },
/* 修改密码 */
{
path: '/messages',
component: Layout,
children: [{ path: '', component: () => import(/* webpackChunkName: "messages" */ '@/pages/messages') }]
path: '/account/password',
component: () => import(/* webpackChunkName: "account" */ '@/pages/account/password')
},
/* 账号 */
{
path: '/account',
component: Layout,
redirect: '/account/password',
children: [
{ path: 'password', component: () => import(/* webpackChunkName: "account" */ '@/pages/account/password') }
/* 考证课程 */
...courseRoutes
]
},
/* 我的 */
{
path: '/my',
component: () => import('@/pages/my/layout'),
redirect: '/my/order',
redirect: '/my/course',
children: [
{ path: 'order', component: () => import(/* webpackChunkName: "my" */ '@/pages/my/order') },
{ path: 'course', component: () => import(/* webpackChunkName: "my" */ '@/pages/my/course') },
{ path: 'test', component: () => import(/* webpackChunkName: "my" */ '@/pages/my/test') }
]
......
......@@ -89,3 +89,10 @@ body {
'Hiragino Sans GB', 'Wenquanyi Micro Hei', sans-serif;
background-color: #f9f9f9;
}
.empty-tips {
padding: 120px;
text-align: center;
font-size: 18px;
color: #999;
}
import store from '@/store'
export default class Before {
export default class BeforeEnter {
constructor(opt) {
this.opt = opt || {}
}
......@@ -14,12 +15,9 @@ export default class Before {
// await store.dispatch('createGuestUser')
const isLogin = store.state.isLogin || (await store.dispatch('checkLogin'))
isLogin && wx.miniProgram.postMessage({ data: { token: store.state.token } })
if (to.meta.requiredLogin && !isLogin) {
store.state.isWeapp
? wx.miniProgram.redirectTo({ url: '/pages/login/index' })
: next(`/login?redirect_uri=${encodeURIComponent(window.location.href)}`)
next(`/login?redirect_uri=${encodeURIComponent(window.location.href)}`)
return
}
next()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论