讲师工作台
@@ -68,13 +68,17 @@
import {defineComponent, reactive, ref} from 'vue'
import teacherApplyUpload from './Upload/TeacherApplyUpload';
import { ElMessage } from 'element-plus'
-import { addTeacher, getTeacherInfo, editTeacher, getUserInfo } from "../../api/teacher"
+import { addTeacher, getTeacherInfo, editTeacher, judgeIsTeacher } from "../../api/teacher"
export default defineComponent({
name: 'TeacherApplyModal',
+ props:{
+ uid:undefined
+ },
components:{
teacherApplyUpload
},
- setup() {
+ setup(props) {
+ const isTeacher = ref(false);
const dialogVisible = ref(false);
const qrDialogVisible = ref(false);
const submitLoading = ref(false);
@@ -87,29 +91,31 @@ export default defineComponent({
introduction: '',
avatar:'',
})
- const showModal = () => {
- dialogVisible.value = true
+ const judgeIfTeacher = async () => {
+ const judgeRes = await judgeIsTeacher(props.uid)
+ if (judgeRes.code === 200){
+ isTeacher.value = judgeRes.data;
+ }
}
- // 获取讲师资料
+ judgeIfTeacher();
const getInfo = async () => {
- const userInfoRes = await getUserInfo();
+ console.log('获取用户资料');
const res = await getTeacherInfo();
- if (userInfoRes.code === 200 && userInfoRes.data){
- const {mobile} = userInfoRes.data;
- form.phone = mobile;
- }
if (res.code === 200 && res.data){
- const {name = '', avatar = '',introduction = '', id= ''} = res.data;
+ const {name = '', avatar = '',introduction = '', id= '', phone=''} = res.data;
+ form.phone = phone;
form.name = name;
form.avatar = avatar;
form.introduction = introduction;
form.teacherId = id;
form.status=res.data.approvalState;
}
- console.log('讲师资料是');
- console.log(res);
}
- getInfo();
+ const showModal = () => {
+ getInfo();
+ dialogVisible.value = true
+ }
+ // 获取讲师资料
const rules = reactive({
name: [
{ required: true, message: '请输入讲师姓名', trigger: 'blur' },
@@ -168,6 +174,7 @@ export default defineComponent({
})
}
return {
+ isTeacher,
dialogVisible,
form,
ruleFormRef,
diff --git a/workspace.code-workspace b/workspace.code-workspace
deleted file mode 100644
index 876a149..0000000
--- a/workspace.code-workspace
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "folders": [
- {
- "path": "."
- }
- ],
- "settings": {}
-}
\ No newline at end of file
From 645aca396bba5a32309be0b07e589f669b6cda92 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Wangwei-=E7=8E=8B=E4=BC=9F?= <870653736@qq.com>
Date: Fri, 28 Oct 2022 14:26:17 +0800
Subject: [PATCH 03/10] =?UTF-8?q?feat:=E5=88=A4=E6=96=AD=E8=AE=BE=E5=A4=87?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/Header.vue | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/components/Header.vue b/src/components/Header.vue
index 34d2fbf..f5bb278 100644
--- a/src/components/Header.vue
+++ b/src/components/Header.vue
@@ -149,7 +149,7 @@
-
+
@@ -359,6 +359,7 @@
setup() {
const { proxy } = getCurrentInstance();
const state = reactive({
+ isPc: document.body.clientWidth > 1200,
allMenu: [],
leftMenu: [],
rightMenu: [],
From 573b48ec57485529b98e3dcc4ddcaed74f9627f2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Wangwei-=E7=8E=8B=E4=BC=9F?= <870653736@qq.com>
Date: Fri, 28 Oct 2022 14:34:40 +0800
Subject: [PATCH 04/10] =?UTF-8?q?update:=E5=88=A4=E6=96=AD=E8=AE=BE?=
=?UTF-8?q?=E5=A4=87?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/Header.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/Header.vue b/src/components/Header.vue
index f5bb278..b65096d 100644
--- a/src/components/Header.vue
+++ b/src/components/Header.vue
@@ -168,7 +168,7 @@
-
+
From e363d61a0cdd48583bdf8897dee2a8d6de7fbb75 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Wangwei-=E7=8E=8B=E4=BC=9F?= <870653736@qq.com>
Date: Thu, 3 Nov 2022 12:31:06 +0800
Subject: [PATCH 05/10] fix:MARKET-4497
---
src/views/live/live_view.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/views/live/live_view.vue b/src/views/live/live_view.vue
index 0e3940e..43754f3 100644
--- a/src/views/live/live_view.vue
+++ b/src/views/live/live_view.vue
@@ -112,7 +112,7 @@
From c4bdf6ae9e29196c38233faeeb10792e57d5f2e0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Wangwei-=E7=8E=8B=E4=BC=9F?= <870653736@qq.com>
Date: Wed, 9 Nov 2022 12:33:16 +0800
Subject: [PATCH 07/10] fix:MARKET-4284
---
src/router.js | 2 +-
src/views/class/play.vue | 11 ++++++-----
src/views/video/play.vue | 4 +++-
3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/router.js b/src/router.js
index e0ad32f..65f1cb2 100644
--- a/src/router.js
+++ b/src/router.js
@@ -369,7 +369,7 @@ router.beforeEach((to, from, next) => {
// 监听登录
function callback(data){
console.log('callback_data',data);
- if(!get_ticket && data.uid && isLogin < 1){
+ if(!get_ticket && data.uid > 0 ){
console.log('跳转到通行证登录',isLogin);
window.location.replace(process.env.VUE_APP_ID_URL+'/login/signin/?app=edu&protocol=cas&referrer='+encodeURIComponent(process.env.VUE_APP_EDU_URL));
}
diff --git a/src/views/class/play.vue b/src/views/class/play.vue
index 6cbc408..0232f53 100644
--- a/src/views/class/play.vue
+++ b/src/views/class/play.vue
@@ -148,7 +148,7 @@
timerPrss: null,
showAutoBox: false,
is_duration: true,
- playThisId:route.params.playid
+ playThisId:route.params.videoid
})
// 获取视频 待删 MARKET-4168
@@ -191,6 +191,7 @@
// 列表点击切换视频
const getvideo_click = async (id, replay=0) => {
+
state.playThisId = id;
state.is_duration = false;
clearInterval(state.timerTxt);
@@ -199,7 +200,7 @@
state.ckPlayer.videoClear();
state.ckPlayer = null;
document.getElementById("VideoPlay").innerHTML = "";
-
+
setTimeout(function () {
getvideoDom(id, replay);
getNextId(id);
@@ -215,7 +216,7 @@
* @replay 1=重播
* @resOne 1=第一次进入页面播放
**/
- const getvideoDom = async (id, replay=0, resOne=0) => {
+ const getvideoDom = async (id, replay=0, resOne=0) => {
// 获取视频
const res = await getVideo(classid, id);
@@ -224,7 +225,7 @@
state.video = res.data;
state.play_title = res.data.title;
state.videoObject.video = res.data.videourl;
- state.arrVideo.push(res.data);
+ state.arrVideo.push(res.data);
if (res.data.playtime > 0) {
state.videoObject.seek = res.data.playtime;
@@ -326,7 +327,7 @@
// 重置新id
state.logid = res.data.logid;
state.videoid = res.data.id;
- console.log('videoid',state.videoid);
+ console.log('log_videoid',state.videoid);
// 修改路由
let winState = { url: id };
diff --git a/src/views/video/play.vue b/src/views/video/play.vue
index 0a8db1f..54036bc 100644
--- a/src/views/video/play.vue
+++ b/src/views/video/play.vue
@@ -242,6 +242,8 @@
state.play_title = res.data.it618_name;
state.videoObject.video = res.data.it618_videourl;
+ console.log('res.data',res.data);
+
if (res.data.playtime > 0) {
state.videoObject.seek = res.data.playtime;
}
@@ -348,7 +350,7 @@
// 重置新id
state.logid = res.data.logid;
state.videoid = res.data.id;
- console.log('videoid',state.videoid);
+ console.log('log_videoid',state.videoid);
// 修改路由
let winState = { url: id };
From e1e8452b01eca0027911961ca04fd1eeda7d7a1c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Wangwei-=E7=8E=8B=E4=BC=9F?= <870653736@qq.com>
Date: Wed, 9 Nov 2022 15:16:19 +0800
Subject: [PATCH 08/10] =?UTF-8?q?update:=E5=9F=8B=E7=82=B9=E4=BC=98?=
=?UTF-8?q?=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/video/play.vue | 46 +++++++++++++++++++++++-----------------
1 file changed, 26 insertions(+), 20 deletions(-)
diff --git a/src/views/video/play.vue b/src/views/video/play.vue
index 54036bc..1ba293c 100644
--- a/src/views/video/play.vue
+++ b/src/views/video/play.vue
@@ -18,8 +18,7 @@
-
+
@@ -138,7 +137,7 @@
showAutoBox: false,
is_duration: true,
is_scroll: false,
- playThisId:route.params.playid
+ playThisId: route.params.playid
})
@@ -178,20 +177,24 @@
const postSourceDeviceLog = async () => {
let get_from = route.query.from || null;
const params = {
- source:get_from,
- device:isMobileValue()
+ source: get_from,
+ device: isMobileValue()
}
await sourceDeviceLog(params);
}
-
+
// 埋点请求
const postlogData = async (logData) => {
- await classlog(logData);
+ let logParams = {
+ ...logData,
+ vid: state.videoid
+ }
+ await classlog(logParams);
}
// 列表点击切换视频
- const getvideo_click = async (id, replay=0) => {
+ const getvideo_click = async (id, replay = 0) => {
state.playThisId = id;
state.is_duration = false;
clearInterval(state.timerTxt);
@@ -201,7 +204,7 @@
state.ckPlayer = null;
document.getElementById("VideoPlay").innerHTML = "";
- setTimeout(function () {
+ setTimeout(function () {
getvideoDom(id, replay);
getNextId(id);
state.videoObject.autoplay = true;
@@ -227,10 +230,10 @@
* @replay 1=重播
* @resOne 1=第一次进入页面播放
**/
- const getvideoDom = async (id, replay=0, resOne=0) => {
+ const getvideoDom = async (id, replay = 0, resOne = 0) => {
// 首次播放埋点
- if(resOne === 1){
+ if (resOne === 1) {
postSourceDeviceLog();
}
@@ -242,7 +245,7 @@
state.play_title = res.data.it618_name;
state.videoObject.video = res.data.it618_videourl;
- console.log('res.data',res.data);
+ console.log('res.data', res.data);
if (res.data.playtime > 0) {
state.videoObject.seek = res.data.playtime;
@@ -252,7 +255,7 @@
}
// console.log('replay',replay);
// console.log('seek',state.videoObject.seek);
-
+
state.msg = res.message;
if (res.status === -1) {
state.isAuth = false;
@@ -338,7 +341,7 @@
// 发送埋点 切换视频发送 第一次播放不发送
let get_duration = localStorage.getItem(state.videoid + '_duration_video');
- if(resOne !=1 && get_duration){
+ if (resOne != 1 && get_duration) {
let logData = {
logid: state.logid,
pytime: localStorage.getItem(state.videoid + '_playTime_video'),
@@ -350,7 +353,7 @@
// 重置新id
state.logid = res.data.logid;
state.videoid = res.data.id;
- console.log('log_videoid',state.videoid);
+ console.log('log_videoid', state.videoid);
// 修改路由
let winState = { url: id };
@@ -535,16 +538,18 @@
font-size: 24px;
padding-bottom: 20px;
}
- .txt_next{
+
+ .txt_next {
color: #fff;
font-size: 16px;
margin-bottom: 36px;
}
- .sel_btn_box{
+ .sel_btn_box {
width: 310px;
margin: 0 auto;
- .btn_sty{
+
+ .btn_sty {
width: 46%;
height: 40px;
line-height: 40px;
@@ -554,6 +559,7 @@
border: 1px solid #fff;
border-radius: 6px;
cursor: pointer;
+
&:hover {
background-color: #0082fc;
border: 1px solid #0082fc;
@@ -785,7 +791,7 @@
display: block !important;
}
- .autotime{
+ .autotime {
height: 35vh;
top: 50px;
}
From 4da9a9932eaec0427d824c76a345d5a3c9f9952b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Wangwei-=E7=8E=8B=E4=BC=9F?= <870653736@qq.com>
Date: Thu, 10 Nov 2022 20:20:04 +0800
Subject: [PATCH 09/10] cas
---
src/components/Header.vue | 4 +-
src/router-jump-cas.js | 439 +++++++++++++++++++
src/{router-bak.js => router-refresh-cas.js} | 1 +
src/router.js | 34 +-
4 files changed, 449 insertions(+), 29 deletions(-)
create mode 100644 src/router-jump-cas.js
rename src/{router-bak.js => router-refresh-cas.js} (99%)
diff --git a/src/components/Header.vue b/src/components/Header.vue
index b65096d..3d3f18d 100644
--- a/src/components/Header.vue
+++ b/src/components/Header.vue
@@ -139,9 +139,9 @@
diff --git a/src/router-jump-cas.js b/src/router-jump-cas.js
new file mode 100644
index 0000000..d0d0ad6
--- /dev/null
+++ b/src/router-jump-cas.js
@@ -0,0 +1,439 @@
+import { createRouter, createWebHistory } from 'vue-router';
+import Layout from '@/layout/index.vue';
+import store from '@/store';
+import { refreshToken, casLogin } from '@/api/auth';
+import '@/utils/fineClubSDK';
+import { getUid, getExpiresTime } from '@/utils/cookie';
+import { delUrlParams } from '@/utils/urlQuery';
+
+const routes = [
+ {
+ path: '/',
+ name: 'index',
+ component: Layout,
+ children: [
+ {
+ path: '/',
+ name: 'index',
+ component: () => import('@/views/index.vue'),
+ meta: {
+ title: '帆软学院-培养企业亟需的数据人才',
+ isMobile: 1,
+ },
+ },
+
+ {
+ path: '/cityclass',
+ name: 'cityclass',
+ component: () => import('@/views/cityclass.vue'),
+ meta: {
+ title: '城市课堂 - 帆软学院',
+ active: 'cityclass',
+ },
+ },
+
+ /**
+ * 视频课
+ */
+ {
+ path: '/video',
+ name: 'videoindex',
+ component: () => import('@/views/video/indexVideo.vue'),
+ meta: {
+ title: '视频课 - 帆软学院',
+ isMobile: 1,
+ },
+ },
+ {
+ path: '/video/:courseid',
+ name: 'video_course',
+ component: () => import('@/views/video/video_course.vue'),
+ meta: {
+ title: '视频课 - 帆软学院',
+ active: 'video',
+ isMobile: 1,
+ },
+ },
+ {
+ path: '/video/play/:playid',
+ name: 'video_course_play',
+ component: () => import('@/views/video/play.vue'),
+ meta: {
+ title: '播放课程 - 视频课',
+ active: 'video',
+ isMobile: 1,
+ },
+ },
+ /**
+ * 班级
+ */
+ {
+ path: '/class',
+ name: 'StudyClass',
+ component: () => import('@/views/class/indexClass.vue'),
+ meta: {
+ title: '学习班 - 帆软学院',
+ },
+ },
+
+ /**
+ * 进入班级教室
+ */
+ {
+ path: '/class/:classid',
+ name: 'layoutClass',
+ component: () => import('@/views/class/class.vue'),
+ meta: {
+ title: '课程章节 - 学习班',
+ active: 'class',
+ },
+ children: [
+ {
+ path: '/class/:classid',
+ name: 'class_lesson',
+ component: () => import('@/views/class/class_lesson.vue'),
+ meta: {
+ title: '课程章节 - 学习班',
+ active: 'class',
+ tab: 'class_lesson',
+ },
+ },
+ {
+ path: '/class/homework/:classid',
+ name: 'class_homework',
+ component: () => import('@/views/class/class_homework.vue'),
+ meta: {
+ title: '我的作业 - 学习班',
+ active: 'class',
+ },
+ },
+ {
+ path: '/class/forum/:classid',
+ name: 'class_forum',
+ component: () => import('@/views/class/class_forum.vue'),
+ meta: {
+ title: '班级论坛 - 学习班',
+ active: 'class',
+ tab: 'class_forum',
+ },
+ },
+ {
+ path: '/class/forum/:classid/:tid',
+ name: 'class_forum_thread',
+ component: () => import('@/views/class/class_forum_thread.vue'),
+ meta: {
+ title: '班级论坛 - 学习班',
+ active: 'class',
+ tab: 'class_forum',
+ },
+ },
+ ],
+ },
+ /**
+ * 老师后台管理
+ */
+ {
+ path: '/class/admin/:classid',
+ name: 'adminLayoutClass',
+ component: () => import('@/views/class/admin/index_admin_class.vue'),
+ meta: {
+ title: '学生管理 - 学习班',
+ active: 'class',
+ },
+ children: [
+ {
+ path: '/class/admin/student/:classid',
+ name: 'student_admin_class',
+ component: () =>
+ import('@/views/class/admin/student_admin_class.vue'),
+ meta: {
+ title: '学生管理 - 学习班',
+ active: 'class',
+ },
+ },
+ {
+ path: '/class/admin/homework/:classid',
+ name: 'homework_admin_class',
+ component: () =>
+ import('@/views/class/admin/homework_admin_class.vue'),
+ meta: {
+ title: '批改作业 - 学习班',
+ active: 'class',
+ },
+ },
+ {
+ path: '/class/admin/schedule/:classid',
+ name: 'schedule_admin_class',
+ component: () =>
+ import('@/views/class/admin/schedule_admin_class.vue'),
+ meta: {
+ title: '教学进度管理 - 学习班',
+ active: 'class',
+ },
+ },
+ {
+ path: '/class/admin/notice/:classid',
+ name: 'notice_admin_class',
+ component: () =>
+ import('@/views/class/admin/notice_admin_class.vue'),
+ meta: {
+ title: '公告栏管理 - 学习班',
+ active: 'class',
+ },
+ },
+ ],
+ },
+
+ /**
+ * 直播
+ */
+ {
+ path: '/live',
+ name: 'live',
+ component: () => import('@/views/live/live.vue'),
+ meta: {
+ title: '直播 - 帆软学院',
+ },
+ },
+
+ {
+ path: '/live/:liveid',
+ name: 'live_view',
+ component: () => import('@/views/live/live_view.vue'),
+ meta: {
+ title: '直播 - 帆软学院',
+ active: 'live',
+ isMobile: 1,
+ },
+ },
+ // 资源导航
+ {
+ path: '/more',
+ name: 'more',
+ component: () => import('@/views/more.vue'),
+ meta: {
+ title: '资源导航 - 帆软学院',
+ active: 'more',
+ },
+ },
+
+ // 新手入门-地图 finereport
+ {
+ path: '/guide/finereport',
+ name: 'guide_finereport',
+ component: () => import('@/views/video/guide/finereport.vue'),
+ meta: {
+ title: 'FineReport入门学习路径 - 帆软学院',
+ active: 'studypath',
+ },
+ },
+
+ // 新手入门-地图 finebi
+ {
+ path: '/guide/finebi',
+ name: 'guide_finebi',
+ component: () => import('@/views/video/guide/finebi.vue'),
+ meta: {
+ title: 'FineBI入门学习路径 - 帆软学院',
+ active: 'studypath',
+ },
+ },
+
+ // 新手入门-地图 jiandaoyun
+ {
+ path: '/guide/jiandaoyun',
+ name: 'guide_jiandaoyun',
+ component: () => import('@/views/video/guide/jiandaoyun.vue'),
+ meta: {
+ title: '简道云入门学习路径 - 帆软学院',
+ active: 'studypath',
+ },
+ },
+
+ // fr-学习路径首页
+ {
+ path: '/studypath/finereport',
+ name: 'studypathfr',
+ component: () => import('@/views/studypath/finereport.vue'),
+ meta: {
+ title: '报表开发工程师 - 学习路径 - 帆软学院',
+ active: 'studypath',
+ isMobile: 1,
+ },
+ },
+ // bi-学习路径首页
+ {
+ path: '/studypath/finebi',
+ name: 'studypathbi',
+ component: () => import('@/views/studypath/finebi.vue'),
+ meta: {
+ title: 'BI分析师 - 学习路径 - 帆软学院',
+ active: 'studypath',
+ isMobile: 1,
+ },
+ },
+ // bi-学习路径首页
+ {
+ path: '/studypath/finebiAdmin',
+ name: 'studypathbiAdmin',
+ component: () => import('@/views/studypath/finebiAdmin.vue'),
+ meta: {
+ title: 'FineBI管理员 - 学习路径 - 帆软学院',
+ active: 'studypath',
+ isMobile: 1,
+ },
+ },
+
+ // 简道云-学习路径首页
+ {
+ path: '/studypath/jiandaoyun',
+ name: 'studypath_page_jdy',
+ component: () => import('@/views/studypath/jiandaoyun.vue'),
+ meta: {
+ title: '零代码开发工程师 - 学习路径 - 帆软学院',
+ active: 'studypath',
+ isMobile: 1,
+ },
+ },
+ ],
+ },
+
+ {
+ path: '/class/play/:classid/:videoid',
+ name: 'classPlay',
+ component: () => import('@/views/class/play.vue'),
+ meta: {
+ title: '播放课程 - 学习班',
+ active: 'class',
+ },
+ },
+
+ {
+ path: '/live/play/:liveid',
+ name: 'live_play',
+ component: () => import('@/views/live/live_play.vue'),
+ meta: {
+ title: '进入直播 - 直播',
+ active: 'live',
+ isMobile: 1,
+ },
+ },
+
+ // 404
+ {
+ path: '/:catchAll(.*)',
+ name: '请求错误',
+ component: () => import('@/components/404.vue'),
+ },
+];
+
+const router = createRouter({
+ history: createWebHistory(),
+ routes,
+ linkActiveClass: 'active',
+ linkExactActiveClass: 'active',
+ scrollBehavior() {
+ return { top: 0 };
+ },
+});
+
+// 通过导航守卫 判断并刷新token
+let accessToken = store.getters.get_token;
+let expires = getExpiresTime();
+let getdate = parseInt(new Date().getTime() / 1000);
+
+router.beforeEach((to, from, next) => {
+ // const { title } = to.meta;
+ // document.title = getPageTitle(title);
+
+ const get_ticket = to.query.ticket || 0;
+ const get_type = to.query.type ? to.query.type : '0';
+
+ // ticket空执行删除
+ const is_ticket_null = new URL(window.location);
+ if(is_ticket_null.searchParams.has("ticket")){
+ if(get_ticket===0){
+ console.log('ticket空');
+ window.location.replace(process.env.VUE_APP_ID_URL+'/login/token/logout?referrer='+encodeURIComponent(process.env.VUE_APP_EDU_URL));
+ }
+ }
+
+ // fineClubSDK接入
+ let app = 'edu';
+ let isDev = process.env.VUE_APP_ENV == 'dist' ? false : true;
+ const isLogin = getUid() || 0;
+ function getLoginUid() {
+ return getUid() || 0;
+ }
+ window.fineClub.config({ app, getLoginUid, debug: isDev, dev: isDev });
+ // 监听登录
+ function callback(data){
+ console.log('callback_data',data);
+ if(!get_ticket && data.uid > 0 ){
+ console.log('跳转到通行证登录',isLogin);
+ window.location.replace(process.env.VUE_APP_ID_URL+'/login/signin/?app=edu&protocol=cas&referrer='+encodeURIComponent(window.location.href));
+ }
+ // else{
+ // if(isLogin > 1 && process.env.VUE_APP_ENV != 'development'){
+ // console.log('callback','del_token');
+ // console.log('isLogin',isLogin);
+ // store.commit('del_token');
+ // setTimeout(function() {
+ // window.location.replace(process.env.VUE_APP_EDU_URL+to.path);
+ // }, 250);
+ // }
+ // }
+ }
+ window.fineClub.onLoginChange(callback);
+
+
+ if (to.meta.title) {
+ document.title = to.meta.title;
+ }
+
+ // 如果有token和过期时间,然后快过期了执行刷新token
+ if (!get_ticket && accessToken && expires && expires - getdate < 60 * 2) {
+ refreshToken().then((res) => {
+ if (res.code === 200 && res.message != -1) {
+ store.commit('set_token', res.data);
+ } else {
+ // 如果刷新失败,清空所有登录信息
+ console.log('router刷新token', 'del_token');
+ store.commit('del_token');
+ }
+ });
+ // 刷新完毕后,延时进度页面
+ setTimeout(function () {
+ next();
+ }, 500);
+ } else if (get_ticket) {
+ casLogin(get_ticket).then((res) => {
+ if (res.code === 200 && res.status != -1) {
+ console.log('casLogin', res);
+ store.commit('set_token', res.data);
+ setTimeout(function () {
+ window.location.replace(process.env.VUE_APP_EDU_URL + to.path);
+ // parent.location.reload();
+ // let jumpUrl = delUrlParams(location.href,['ticket','sid']);
+ // console.log('jumpUrl',jumpUrl);
+ // parent.window.location.replace(jumpUrl);
+ }, 250);
+ } else {
+ next();
+ }
+ });
+
+ } else if (get_type === 'logout') {
+ console.log('logout', 'del_token');
+ store.commit('del_token');
+ setTimeout(function () {
+ let jumpUrl = delUrlParams(location.href,['type']);
+ window.location.replace(jumpUrl);
+ // next();
+ }, 500);
+ } else {
+ next();
+ }
+});
+
+export default router;
diff --git a/src/router-bak.js b/src/router-refresh-cas.js
similarity index 99%
rename from src/router-bak.js
rename to src/router-refresh-cas.js
index 9c048ae..e28ecf5 100644
--- a/src/router-bak.js
+++ b/src/router-refresh-cas.js
@@ -349,6 +349,7 @@ router.beforeEach((to, from, next) => {
const get_ticket = to.query.ticket || 0;
const get_type = to.query.type ? to.query.type : '0';
+ // ticket空执行删除
const is_ticket_null = new URL(window.location);
if(is_ticket_null.searchParams.has("ticket")){
if(get_ticket===0){
diff --git a/src/router.js b/src/router.js
index 65f1cb2..e28ecf5 100644
--- a/src/router.js
+++ b/src/router.js
@@ -349,43 +349,23 @@ router.beforeEach((to, from, next) => {
const get_ticket = to.query.ticket || 0;
const get_type = to.query.type ? to.query.type : '0';
- // ticket空执行删除
+ // ticket空执行删除
const is_ticket_null = new URL(window.location);
if(is_ticket_null.searchParams.has("ticket")){
if(get_ticket===0){
console.log('ticket空');
- window.location.replace(process.env.VUE_APP_ID_URL+'/login/token/logout?referrer='+encodeURIComponent(process.env.VUE_APP_EDU_URL));
+ parent.window.location.replace(process.env.VUE_APP_ID_URL+'/login/token/logout?referrer='+encodeURIComponent(process.env.VUE_APP_EDU_URL));
}
}
// fineClubSDK接入
let app = 'edu';
let isDev = process.env.VUE_APP_ENV == 'dist' ? false : true;
- const isLogin = getUid() || 0;
function getLoginUid() {
return getUid() || 0;
}
window.fineClub.config({ app, getLoginUid, debug: isDev, dev: isDev });
- // 监听登录
- function callback(data){
- console.log('callback_data',data);
- if(!get_ticket && data.uid > 0 ){
- console.log('跳转到通行证登录',isLogin);
- window.location.replace(process.env.VUE_APP_ID_URL+'/login/signin/?app=edu&protocol=cas&referrer='+encodeURIComponent(process.env.VUE_APP_EDU_URL));
- }
- // else{
- // if(isLogin > 1 && process.env.VUE_APP_ENV != 'development'){
- // console.log('callback','del_token');
- // console.log('isLogin',isLogin);
- // store.commit('del_token');
- // setTimeout(function() {
- // window.location.replace(process.env.VUE_APP_EDU_URL+to.path);
- // }, 250);
- // }
- // }
- }
- window.fineClub.onLoginChange(callback);
-
+ window.fineClub.autoReloadOnLoginChange({ loginUrl: process.env.VUE_APP_ID_URL + '/login/signin/?app=edu&protocol=cas&referrer=' + encodeURIComponent(window.location.href) });
if (to.meta.title) {
document.title = to.meta.title;
@@ -412,11 +392,11 @@ router.beforeEach((to, from, next) => {
console.log('casLogin', res);
store.commit('set_token', res.data);
setTimeout(function () {
- window.location.replace(process.env.VUE_APP_EDU_URL + to.path);
+ // parent.window.location.replace(process.env.VUE_APP_EDU_URL + to.path);
// parent.location.reload();
- // let jumpUrl = delUrlParams(location.href,['ticket','sid']);
- // console.log('jumpUrl',jumpUrl);
- // parent.window.location.replace(jumpUrl);
+ let jumpUrl = delUrlParams(location.href,['ticket','sid']);
+ console.log('jumpUrl',jumpUrl);
+ parent.window.location.replace(jumpUrl);
}, 250);
} else {
next();
From 7ad172eac7a020461710c1506f3ae27098786e3c Mon Sep 17 00:00:00 2001
From: Wangwei <870653736@qq.com>
Date: Mon, 21 Nov 2022 09:17:47 +0800
Subject: [PATCH 10/10] =?UTF-8?q?feat:=E6=94=AF=E6=8C=81cas?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.env.development | 2 +-
src/components/msgLogin.vue | 2 +-
src/mixins/mixins.js | 5 ++++-
src/router.js | 2 +-
src/views/class/indexClass.vue | 2 +-
src/views/class/play-old.vue | 2 +-
src/views/class/play.vue | 2 +-
src/views/live/live_play.vue | 2 +-
src/views/live/live_view.vue | 2 +-
src/views/play.vue | 4 ++--
src/views/video/guide/finebi.vue | 2 +-
src/views/video/guide/finereport.vue | 2 +-
src/views/video/guide/jiandaoyun.vue | 2 +-
src/views/video/play.vue | 2 +-
src/views/video/video_course.vue | 3 +--
15 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/.env.development b/.env.development
index 2151311..0e72089 100644
--- a/.env.development
+++ b/.env.development
@@ -9,6 +9,6 @@ VUE_APP_SHEQU_URL = https://frbbs
VUE_APP_ID_URL = https://id
#VUE_APP_ID_URL = https://passport.fanruan.com
#VUE_APP_CIDAPI_URL = https://cid.fanruan.com/api
-VUE_APP_CIDAPI_URL = https://test-cid/api
+VUE_APP_CIDAPI_URL = https://cid/api
VUE_APP_PASS_URL = http://localhost:8080
VUE_APP_CERT_URL = https://admin.shequ.fanruan.com
diff --git a/src/components/msgLogin.vue b/src/components/msgLogin.vue
index b9a2f10..08487d6 100644
--- a/src/components/msgLogin.vue
+++ b/src/components/msgLogin.vue
@@ -2,7 +2,7 @@
- 无权限查看,当前页面需要
登录
+ 无权限查看,当前页面需要
登录
diff --git a/src/mixins/mixins.js b/src/mixins/mixins.js
index cc66f1a..950d256 100644
--- a/src/mixins/mixins.js
+++ b/src/mixins/mixins.js
@@ -7,6 +7,8 @@
*/
//import { getToken } from "@/utils/cookie";
import store from '@/store'
+// import { useRoute } from 'vue-router'
+
export const mixins = {
data() {
return {
@@ -17,7 +19,8 @@ export const mixins = {
com_node_env: process.env.VUE_APP_ENV || 'production',
com_pass_url: process.env.VUE_APP_PASS_URL || 'https://fanruanclub.com',
com_cert_url:process.env.VUE_APP_CERT_URL || 'https://cert.fanruan.com',
- com_jump_url:encodeURIComponent(window.location.href)
+ com_jump_url:encodeURIComponent(window.location.href),
+ com_login_url:process.env.VUE_APP_ID_URL+'/signin/'+'?app=edu&protocol=cas&referrer='+window.location.href
}
},
created() {
diff --git a/src/router.js b/src/router.js
index e28ecf5..4a263a5 100644
--- a/src/router.js
+++ b/src/router.js
@@ -352,7 +352,7 @@ router.beforeEach((to, from, next) => {
// ticket空执行删除
const is_ticket_null = new URL(window.location);
if(is_ticket_null.searchParams.has("ticket")){
- if(get_ticket===0){
+ if(get_ticket===0 || get_ticket=='null'){
console.log('ticket空');
parent.window.location.replace(process.env.VUE_APP_ID_URL+'/login/token/logout?referrer='+encodeURIComponent(process.env.VUE_APP_EDU_URL));
}
diff --git a/src/views/class/indexClass.vue b/src/views/class/indexClass.vue
index 4936fc5..de99da6 100644
--- a/src/views/class/indexClass.vue
+++ b/src/views/class/indexClass.vue
@@ -18,7 +18,7 @@
diff --git a/src/views/class/play-old.vue b/src/views/class/play-old.vue
index a75014d..3679f17 100644
--- a/src/views/class/play-old.vue
+++ b/src/views/class/play-old.vue
@@ -3,7 +3,7 @@
无权限查看,当前页面需要 登录
+ :href="com_login_url" class="col008">登录
diff --git a/src/views/class/play.vue b/src/views/class/play.vue
index 0232f53..5dd4ddd 100644
--- a/src/views/class/play.vue
+++ b/src/views/class/play.vue
@@ -3,7 +3,7 @@
无权限查看,当前页面需要 登录
+ :href="com_login_url" class="col008">登录
diff --git a/src/views/live/live_play.vue b/src/views/live/live_play.vue
index cd2748c..db89f32 100644
--- a/src/views/live/live_play.vue
+++ b/src/views/live/live_play.vue
@@ -5,7 +5,7 @@
diff --git a/src/views/live/live_view.vue b/src/views/live/live_view.vue
index 43754f3..dbac116 100644
--- a/src/views/live/live_view.vue
+++ b/src/views/live/live_view.vue
@@ -133,7 +133,7 @@
您还未登录哦~~登录后再报名吧!
diff --git a/src/views/play.vue b/src/views/play.vue
index 168578a..8e2725b 100644
--- a/src/views/play.vue
+++ b/src/views/play.vue
@@ -16,8 +16,8 @@
-
抱歉,本站注册会员可以看课程!
-
会员登录
+
抱歉,本站注册用户可以看课程!
+
马上登录
diff --git a/src/views/video/guide/finebi.vue b/src/views/video/guide/finebi.vue
index 342a613..0f63448 100644
--- a/src/views/video/guide/finebi.vue
+++ b/src/views/video/guide/finebi.vue
@@ -3,7 +3,7 @@
diff --git a/src/views/video/guide/finereport.vue b/src/views/video/guide/finereport.vue
index e140312..287356c 100644
--- a/src/views/video/guide/finereport.vue
+++ b/src/views/video/guide/finereport.vue
@@ -3,7 +3,7 @@
diff --git a/src/views/video/guide/jiandaoyun.vue b/src/views/video/guide/jiandaoyun.vue
index 3a092de..c8d7a22 100644
--- a/src/views/video/guide/jiandaoyun.vue
+++ b/src/views/video/guide/jiandaoyun.vue
@@ -3,7 +3,7 @@
diff --git a/src/views/video/play.vue b/src/views/video/play.vue
index 1ba293c..d8c6f56 100644
--- a/src/views/video/play.vue
+++ b/src/views/video/play.vue
@@ -18,7 +18,7 @@
diff --git a/src/views/video/video_course.vue b/src/views/video/video_course.vue
index daa0c41..000045d 100644
--- a/src/views/video/video_course.vue
+++ b/src/views/video/video_course.vue
@@ -104,8 +104,7 @@
您还未登录哦~~登录后再购买吧!