mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-07 01:46:42 +08:00
Compare commits
8 Commits
250408-bug
...
250422-dem
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ffbc4ef808 | ||
|
|
5936183912 | ||
|
|
702881c100 | ||
|
|
b0229f6cde | ||
|
|
9c6c1708fc | ||
|
|
b67d7f4311 | ||
|
|
c5e54f0170 | ||
|
|
5c5a71ec55 |
@@ -341,6 +341,13 @@ export const constantRoutes = [{
|
||||
name: 'hotforum',
|
||||
meta: {title: '热点论坛', icon: 'dashboard', noCache: true, affix: true},
|
||||
},
|
||||
{
|
||||
path: '/lexiang',
|
||||
hidden: true,
|
||||
component: (resolve) => require(['@/views/sso/lexiang'], resolve),
|
||||
name: 'lexiang',
|
||||
meta: {title: '单点登录', icon: 'dashboard', noCache: true, affix: true},
|
||||
},
|
||||
{
|
||||
path: '/404',
|
||||
component: (resolve) => require(['@/views/error/404'], resolve),
|
||||
|
||||
53
src/views/sso/lexiang.vue
Normal file
53
src/views/sso/lexiang.vue
Normal file
@@ -0,0 +1,53 @@
|
||||
<template>
|
||||
<div>
|
||||
<p v-if="loading">正在跳转,请稍候...</p>
|
||||
<p v-if="error" class="error">{{ errorMessage }}</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
error: false,
|
||||
errorMessage: ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchCode()
|
||||
},
|
||||
methods: {
|
||||
async fetchCode() {
|
||||
try {
|
||||
// 替换为你的实际API地址
|
||||
const response = await axios.post('/userbasic/sso/getCode', {})
|
||||
const code = response.data.result
|
||||
if (code) {
|
||||
// 替换为你的目标外部链接,并确保参数名称正确
|
||||
const redirectUrl = `https://lexiangla.com?company_from=d1f3b156e9ed11ef9dc9720f77c5afa9&login_way=sso&sso_auth_code=${encodeURIComponent(code)}`
|
||||
window.location.href = redirectUrl
|
||||
} else {
|
||||
this.handleError('未获取到有效code')
|
||||
}
|
||||
} catch (error) {
|
||||
this.handleError(`请求失败: ${error.message}`)
|
||||
}
|
||||
},
|
||||
handleError(message) {
|
||||
this.loading = false
|
||||
this.error = true
|
||||
this.errorMessage = message
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.error {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
@@ -380,15 +380,19 @@ export default {
|
||||
getExperience() {//经验值
|
||||
let data = {
|
||||
aid:this.userInfo.aid,// #用户id
|
||||
statType:21, // #统计类型 10学习时长 11 学习天数 20表经验值 30表u币 40表获取天数
|
||||
statType:20, // #统计类型 10学习时长 11 学习天数 20表经验值 30表u币 40表获取天数
|
||||
field:this.experience.field,// #统计周期 todays-当天,weeks-周,months-月,years-年 total-总计
|
||||
num:10,// #显示的条数
|
||||
}
|
||||
if(data.field == 'now'){
|
||||
data.statType = 20
|
||||
data.field = 'years'
|
||||
this.experience.field = 'years'
|
||||
this.isNow = true
|
||||
}else{
|
||||
data.statType = 20
|
||||
data.field = 'total'
|
||||
this.experience.field = 'total'
|
||||
this.isNow = true
|
||||
}
|
||||
apiStat.getRanking(data).then(res=>{
|
||||
if(res.status==200){
|
||||
@@ -402,12 +406,15 @@ export default {
|
||||
}
|
||||
this.getUserData([res.result.currentUserRankingData.aid],[res.result.currentUserRankingData])
|
||||
this.experience.data = res.result.currentUserRankingData;
|
||||
if(this.experience.field == 'total') {
|
||||
this.currentUserRankingTotalData.rankNo = res.result.currentUserRankingData.rankingNo;
|
||||
this.currentUserRankingTotalData.endValue = this.current.endValue;
|
||||
if(data.field == 'total') {
|
||||
this.current = this.experienceValue(res.result.currentUserRankingData.total);
|
||||
this.currentUserRankingTotalData.rankNo = res.result.currentUserRankingData.rankingNo;
|
||||
this.currentUserRankingTotalData.rankValue = res.result.currentUserRankingData.total;
|
||||
this.currentUserRankingTotalData.endValue = this.current.endValue;
|
||||
}else if(data.field == 'years'){
|
||||
this.currentUserRankingTotalData.rankValue = res.result.currentUserRankingData.years;
|
||||
}
|
||||
|
||||
}
|
||||
this.current.total=res.result.currentUserRankingData.total;//当前用户的经验值是固定的
|
||||
const ids= [];
|
||||
@@ -434,9 +441,15 @@ export default {
|
||||
}
|
||||
});
|
||||
});
|
||||
this.experience.list = listData.sort((a,b)=>{
|
||||
return b.total-a.total
|
||||
}).slice(0,5);
|
||||
if(data.field == 'total') {
|
||||
this.experience.list = listData.sort((a,b)=>{
|
||||
return b.total-a.total
|
||||
}).slice(0,5);
|
||||
}else if(data.field == 'years'){
|
||||
this.experience.list = listData.sort((a,b)=>{
|
||||
return b.years-a.years
|
||||
}).slice(0,5);
|
||||
}
|
||||
} else {
|
||||
this.$message.error(res.message);
|
||||
}
|
||||
@@ -447,15 +460,19 @@ export default {
|
||||
getDuration() {//学习时长
|
||||
let data = {
|
||||
aid:this.userInfo.aid,// #用户id
|
||||
statType:12, // #统计类型 10学习时长 11 学习天数 20表经验值 30表u币 40表获取天数
|
||||
statType:10, // #统计类型 10学习时长 11 学习天数 20表经验值 30表u币 40表获取天数
|
||||
field:this.learningDuration.field,// #统计周期 todays-当天,weeks-周,months-月,years-年 total-总计
|
||||
num:10,// #显示的条数
|
||||
}
|
||||
if(data.field == 'now'){
|
||||
data.statType = 10
|
||||
data.field = 'total'
|
||||
this.learningDuration.field = 'total'
|
||||
this.isStudyTime = true
|
||||
data.statType = 10;
|
||||
data.field = 'years';
|
||||
this.learningDuration.field = 'years';
|
||||
this.isStudyTime = true;
|
||||
}else{
|
||||
data.statType = 10;
|
||||
data.field = 'total';
|
||||
this.learningDuration.field = 'total';
|
||||
}
|
||||
apiStat.getRanking(data).then(res=>{
|
||||
if(res.status==200){
|
||||
@@ -469,9 +486,11 @@ export default {
|
||||
}
|
||||
this.getUserData([res.result.currentUserRankingData.aid],[res.result.currentUserRankingData])
|
||||
this.learningDuration.data = res.result.currentUserRankingData;
|
||||
this.learningDurationTotalData.rankNo = res.result.currentUserRankingData.rankingNo;
|
||||
if(data.field == 'total'){
|
||||
this.learningDurationTotalData.rankNo = res.result.currentUserRankingData.rankingNo;
|
||||
this.learningDurationTotalData.rankValue = res.result.currentUserRankingData.total;
|
||||
} else if(data.field == 'years'){
|
||||
this.learningDurationTotalData.rankValue = res.result.currentUserRankingData.years;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -500,9 +519,16 @@ export default {
|
||||
}
|
||||
});
|
||||
});
|
||||
this.learningDuration.list = listData.sort((a,b)=>{
|
||||
return b.total-a.total
|
||||
}).slice(0,5);
|
||||
if(data.field == 'total'){
|
||||
this.learningDuration.list = listData.sort((a,b)=>{
|
||||
return b.total-a.total
|
||||
}).slice(0,5)
|
||||
} else if(data.field == 'years'){
|
||||
this.learningDuration.list = listData.sort((a,b)=>{
|
||||
return b.years-a.years
|
||||
}).slice(0,5)
|
||||
}
|
||||
;
|
||||
} else {
|
||||
this.$message.error(res.message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user