先提交保留一下

This commit is contained in:
daihh
2022-06-03 10:36:26 +08:00
parent 5b9ce7fa75
commit cce3e21837
14 changed files with 88 additions and 32 deletions

View File

@@ -14,7 +14,10 @@ VUE_APP_BOE_WEB_URL = 'https://u.boe.com'
VUE_APP_BOE_MOBILE_URL = 'http://192.168.0.10:8082/mobile'
# File路径的基础url
VUE_APP_FILE_BASE_URL = '/cdn/upload'
VUE_APP_FILE_BASE_URL = 'http://localhost:9090/cdn/upload'
# File路径的基础url的相对路径加此项是为了不影响之前的路径配置
VUE_APP_FILE_RELATIVE_PATH = 'http://localhost:9090/cdn/upload'
# 登录地址
VUE_APP_LOGIN_URL='/pc/login'

26
.env.preview Normal file
View File

@@ -0,0 +1,26 @@
# 生产环境配置
ENV = 'production'
# 管理系统/生产环境
VUE_APP_BASE_API = '/systemapi'
# BOE管理系统/开发环境
VUE_APP_BOE_BASE_API = '/uboeApi'
# BOE系统网址
VUE_APP_BOE_WEB_URL = 'https://u.boe.com'
# BOE 移动端url
VUE_APP_BOE_MOBILE_URL = 'http://u.boe.com'
# File路径的基础url
VUE_APP_FILE_BASE_URL='http://u-pre.boe.com/upload'
# File路径的基础url的相对路径加此项是为了不影响之前的路径配置
VUE_APP_FILE_RELATIVE_PATH = '/upload'
# 虚拟目录的变量,结尾的/在vue.config.js中添加
VUE_APP_PUBLIC_PATH='/pc'
# 登录地址
VUE_APP_LOGIN_URL='https://u-pre.boe.com/web/'

View File

@@ -16,6 +16,9 @@ VUE_APP_BOE_MOBILE_URL = 'http://u.boe.com'
# File路径的基础url
VUE_APP_FILE_BASE_URL='http://u-pre.boe.com/upload'
# File路径的基础url的相对路径加此项是为了不影响之前的路径配置
VUE_APP_FILE_RELATIVE_PATH = '/upload'
# 虚拟目录的变量,结尾的/在vue.config.js中添加
VUE_APP_PUBLIC_PATH='/pc'

26
.env.test Normal file
View File

@@ -0,0 +1,26 @@
# 生产环境配置
ENV = 'production'
# 管理系统/生产环境
VUE_APP_BASE_API = '/systemapi'
# BOE管理系统/开发环境
VUE_APP_BOE_BASE_API = '/uboeApi'
# BOE系统网址
VUE_APP_BOE_WEB_URL = 'https://u.boe.com'
# BOE 移动端url
VUE_APP_BOE_MOBILE_URL = 'http://u.boe.com'
# File路径的基础url
VUE_APP_FILE_BASE_URL='http://u-pre.boe.com/upload'
# File路径的基础url的相对路径加此项是为了不影响之前的路径配置
VUE_APP_FILE_RELATIVE_PATH = '/upload'
# 虚拟目录的变量,结尾的/在vue.config.js中添加
VUE_APP_PUBLIC_PATH='/pc'
# 登录地址
VUE_APP_LOGIN_URL='https://u-pre.boe.com/web/'

View File

@@ -1,5 +1,5 @@
<template>
<div class="portal-footer">
<div class="portal-footer" :style="`background-image:url(${this.webBaseUrl}/images/bg_foot.png)`">
<div class="center">
<div class="center-img1" style="margin-left: 100px;"><img :src="`${this.webBaseUrl}/images/foot_center.png`"/> </div>
<div class="center-img2"><img :src="`${this.webBaseUrl}/images/foot_code.png`"/> </div>
@@ -47,7 +47,7 @@ export default {
margin-top: 30px;
box-sizing: border-box;
height: 300px;
background-image: url(/pc/images/bg_foot.png);
//background-image: url(/pc/images/bg_foot.png);
background-position: center;
background-repeat: no-repeat;
background-size:cover;

View File

@@ -28,6 +28,7 @@ Vue.config.productionTip = false
Vue.prototype.$Constants = constants;
Vue.prototype.msgSuccess = function(msg) {
this.$message({ showClose: true, message: msg, type: "success", offset: 50 });
}

View File

@@ -6,6 +6,7 @@ import 'nprogress/nprogress.css'
import { getToken } from '@/utils/token'
import { routers } from "@/data/pages"
import watermark from './utils/warterMark.js'
import constants from '@/utils/constants'
NProgress.configure({ showSpinner: false })
@@ -13,14 +14,24 @@ const whiteList = ['/login','/logout','/loading','/pc/loading','/500','/auth-red
router.beforeEach((to, from, next) => {
watermark.set("");
//动态计算文件的路径
let configPath=process.env.VUE_APP_FILE_RELATIVE_PATH;
if(configPath.startsWith('http')){
constants.fileBaseUrl=configPath;
}else{
constants.fileBaseUrl = window.location.protocol+'//'+window.location.host+configPath;
}
NProgress.start();
if (whiteList.indexOf(to.path) !== -1) {
// 在免登录白名单,直接进入
next()
}else{
if(getToken()){
if(to.path === '/login'){
next({ path: '/pc/index' })
next({ path: process.env.VUE_APP_PUBLIC_PATH+'/index' })
NProgress.done();
} else {
//后续这里需要增加一定的控制

View File

@@ -1,10 +1,6 @@
/**页面设置的一些常量*/
const constants={
Cookies:{
name:'login_name',
password:'login_password',
rememberMe:'login_rememberMe',
}
fileBaseUrl:'http://127.0.0.1/pc/cdn/upload'
}
export default constants

View File

@@ -7,14 +7,16 @@ export const deepCopy = (obj) => {
/**文件的基础路径*/
export function getFileBaseUrl() {
const protocol='https:'==window.location.protocol;
let protocol=window.location.protocol;
let configPath=process.env.VUE_APP_FILE_BASE_URL;
let baseUrl='';
if(configPath.startsWith('http')){
return configPath;
baseUrl = configPath;
}else{
let domain = window.location.host;
return protocol+='//'+domain+configPath;
baseUrl = protocol+'//'+domain+configPath;
}
return baseUrl;
}
/**

View File

@@ -293,7 +293,7 @@ import ad from '@/components/Portal/adFloat.vue';
import interactRowBar from '@/components/Portal/interactRowBar.vue';
import courseImage from '@/components/Course/courseImage.vue';
import articleImage from '@/components/Article/articleImage.vue';
import { toScore } from '@/utils/tools.js';
import { toScore,getFileBaseUrl} from '@/utils/tools.js';
export default {
name: 'index',
components: { portalHeader,ad, portalFooter, articleImage, portalFloatTools, authorInfo, interactRowBar, interactBar, courseImage },
@@ -331,6 +331,8 @@ export default {
};
},
mounted() {
//console.log(getFileBaseUrl(),'getFileBaseUrl')
console.log(this.$Constants.fileBaseUrl,'fileBaseUrl地址');
this.getCourseData(1);
this.getCaseData();
this.getArticleData();

View File

@@ -35,6 +35,7 @@
<script>
import { mapGetters } from 'vuex';
import loginApi from "@/api/login";
import constants from '@/utils/constants'
export default {
computed: {
...mapGetters(['portalLoginRememberMe'])
@@ -67,6 +68,7 @@
}
},
mounted() {
console.log(constants,'this.$constants.fileBaseUrl');
this.refreshCode();
if(this.portalLoginRememberMe && this.portalLoginRememberMe.rememberMe){
this.rememberMe = true;

View File

@@ -325,7 +325,7 @@ export default {
tags: [],
numberToLetter: numberToLetter,
// resOwnerListMap: resOwnerIndexName,
fileBaseUrl: process.env.VUE_APP_FILE_BASE_URL,
fileBaseUrl: this.$Constants.fileBaseUrl,
blobUrl:'',//播放的文件地址新添加采用blob方式
getType: getType,
courseType,
@@ -509,6 +509,7 @@ export default {
//this.blobUrl=process.env.VUE_APP_BASE_API+'/xboe/course/resource?fid='+fid;
//this.blobUrl='http://localhost:9090/xboe/course/resource?fid='+fid;
this.blobUrl=this.fileBaseUrl+u;
console.log(this.blobUrl,'this.blobUrl');
},
createVideoBlob(url){
let $this=this;

View File

@@ -290,30 +290,15 @@ computed: {
},
jumpRouter(item) {
if(item.isOld){
// this.$router.push({path:'/course/boeframe',query:{id:item.id,type:item.courseType}})
location.href=`${this.webBaseUrl}/course/boeframe?id=${item.id}&type=${item.courseType}`
//window.open(`${this.webBaseUrl}/course/boeframe?id=${item.id}&type=${item.courseType}`,'_self' )
} else {
if(item.courseType==10){
// let routeData = this.$router.resolve({ path: '/course/micro?id='+item.courseId}); // , query: { id: 1 }
// console.log(routeData,'routeData');
// window.open(this.webBaseUrl+routeData.href, '_blank');
// window.open('/pc/course/micro?id='+item.courseId,'_blank')
this.$router.push({path:'/course/micro',query:{id:item.courseId}})
}
if(item.courseType==20){
if(item.progress>0 && item.progress<100) {
//let routeData = this.$router.resolve({ path: '/course/studyindex?id='+item.courseId}); // , query: { id: 1 }
// console.log(routeData,'routeData');
//window.open(this.webBaseUrl+routeData.href, '_blank');
// window.open('/pc/course/studyindex?id='+item.courseId,'_blank')
this.$router.push({path:'/course/studyindex',query:{id:item.courseId}})
this.$router.push({path:'/course/studyindex',query:{id:item.courseId}})
} else {
//let routeData = this.$router.resolve({ path: '/course/detail?id='+item.courseId}); // , query: { id: 1 }
// console.log(routeData,'routeData');
// window.open(this.webBaseUrl+routeData.href, '_blank');
// window.open('/pc/course/detail?id='+item.courseId,'_blank')
this.$router.push({path:'/course/detail',query:{id:item.courseId}})
}
}

View File

@@ -36,9 +36,7 @@
<div class="uc-course-time">推送时间{{ formatsec(Number(item.updated_at) * 1000 )}}</div>
</div>
<div class="uc-course-btns">
<!-- <a :href="item.type == 1 ? '/pc/course/recorded' : '/pc/course/micro'" target="_blank"> -->
<el-button @click="jumpRouter(item)" type="primary" size="small">开始学习</el-button>
<!-- </a> -->
</div>
</div>
<div style="height:150px; text-align: center; margin-top:57px;" >