mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-08 10:26:43 +08:00
Compare commits
6 Commits
20251121-f
...
251114-fea
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
223e3abe43 | ||
|
|
e7581efddf | ||
|
|
57b233601d | ||
|
|
e53da5d324 | ||
|
|
e6b319bce3 | ||
|
|
c11fb55ce3 |
241
src/api/ajax.js
241
src/api/ajax.js
@@ -19,93 +19,88 @@ import errorCode from '@/utils/errorCode'
|
||||
|
||||
|
||||
// const ReLoginUrl=process.env.VUE_APP_LOGIN_URL;
|
||||
const TokenName = 'XBOE-Access-Token';
|
||||
const TokenName='XBOE-Access-Token';
|
||||
/**axios.defaults.headers['Content-Type'] = 'application/x-www-form-urlencoded'**/
|
||||
//只是用于发送json对象数据时使用post,put,patch
|
||||
/**axios.defaults.headers['Content-Type'] = 'application/x-www-form-urlencoded'**/
|
||||
//只是用于发送json对象数据时使用post,put,patch
|
||||
//用于普通的发送请求
|
||||
const formRequest = axios.create({
|
||||
// headers:{'Content-Type':'application/x-www-form-urlencoded'},
|
||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||
// baseURL: process.env.VUE_APP_CESOURCE_BASE_API,
|
||||
//超时
|
||||
timeout: 60000,
|
||||
})
|
||||
//发送json对象的拦截器
|
||||
formRequest.interceptors.request.use(config => {
|
||||
//是否需要设置 token
|
||||
const isToken = (config.headers || {}).isToken === false
|
||||
if (getToken() && !isToken) {
|
||||
config.headers[TokenName] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||
}
|
||||
return config
|
||||
}, error => {
|
||||
console.log(error)
|
||||
Promise.reject(error)
|
||||
});
|
||||
formRequest.interceptors.response.use(res => {
|
||||
const code = res.data.status || 200;
|
||||
if (code === 200) {
|
||||
return res.data
|
||||
} else {
|
||||
if (code === 401) {
|
||||
//Message({message: msg, type: 'error'});
|
||||
store.dispatch('LogOut').then(() => {
|
||||
if (top !== window) { // 判断当前是否在iframe内
|
||||
top.location.href = this.webBaseUrl + ReLoginUrl;
|
||||
} else {
|
||||
window.location.href = this.webBaseUrl + ReLoginUrl;
|
||||
}
|
||||
// location.href = this.webBaseUrl + ReLoginUrl;
|
||||
})
|
||||
} else if (code === 403) {
|
||||
var msg = '当前操作没有权限';
|
||||
Message({ message: msg, type: 'error' });
|
||||
return Promise.reject(new Error(msg))
|
||||
} else {
|
||||
//Message({message: res.data.message, type: 'error'});
|
||||
//console.log('err' + res.data.error);
|
||||
return res.data
|
||||
}
|
||||
}
|
||||
},
|
||||
error => {
|
||||
const formRequest=axios.create({
|
||||
// headers:{'Content-Type':'application/x-www-form-urlencoded'},
|
||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||
// baseURL: process.env.VUE_APP_CESOURCE_BASE_API,
|
||||
//超时
|
||||
timeout: 60000,
|
||||
})
|
||||
//发送json对象的拦截器
|
||||
formRequest.interceptors.request.use(config => {
|
||||
//是否需要设置 token
|
||||
const isToken = (config.headers || {}).isToken === false
|
||||
if (getToken() && !isToken) {
|
||||
config.headers[TokenName] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||
}
|
||||
return config
|
||||
}, error => {
|
||||
console.log(error)
|
||||
Promise.reject(error)
|
||||
});
|
||||
formRequest.interceptors.response.use(res => {
|
||||
const code = res.data.status || 200;
|
||||
if(code===200){
|
||||
return res.data
|
||||
}else{
|
||||
if(code === 401){
|
||||
//Message({message: msg, type: 'error'});
|
||||
store.dispatch('LogOut').then(() => {
|
||||
location.href = this.webBaseUrl + ReLoginUrl;
|
||||
})
|
||||
}else if(code===403){
|
||||
var msg='当前操作没有权限';
|
||||
Message({message: msg, type: 'error'});
|
||||
return Promise.reject(new Error(msg))
|
||||
}else{
|
||||
//Message({message: res.data.message, type: 'error'});
|
||||
//console.log('err' + res.data.error);
|
||||
return res.data
|
||||
}
|
||||
}
|
||||
},
|
||||
error => {
|
||||
console.log('err' + error)
|
||||
let { message } = error;
|
||||
if (message == "Network Error") {
|
||||
message = "网络异常,请稍后重试";
|
||||
message = "网络异常,请稍后重试";
|
||||
}
|
||||
else if (message.includes("timeout")) {
|
||||
message = "网络异常或接口错误,请求超时";
|
||||
message = "网络异常或接口错误,请求超时";
|
||||
}
|
||||
else if (message.includes("Request failed with status code")) {
|
||||
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
||||
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
||||
}
|
||||
Message({
|
||||
message: message,
|
||||
type: 'error',
|
||||
duration: 5 * 1000
|
||||
message: message,
|
||||
type: 'error',
|
||||
duration: 5 * 1000
|
||||
})
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
/**
|
||||
* request请求,可以自定义参数
|
||||
*/
|
||||
const request = formRequest.request;
|
||||
const request=formRequest.request;
|
||||
|
||||
/**
|
||||
* get请求 ,只有url
|
||||
*/
|
||||
const get = function (baseURL, url) {
|
||||
return request({
|
||||
baseURL,
|
||||
url: url,
|
||||
method: 'get',
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
|
||||
})
|
||||
const get = function(baseURL,url){
|
||||
return request({
|
||||
baseURL,
|
||||
url: url,
|
||||
method: 'get',
|
||||
headers:{'Content-Type':'application/x-www-form-urlencoded'}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,61 +108,61 @@ const get = function (baseURL, url) {
|
||||
* @param {Object} url
|
||||
* @param {Object} postData
|
||||
*/
|
||||
const post = function (baseURL, url, postData) {
|
||||
if (postData) {
|
||||
postData = qs.stringify(postData);
|
||||
const post=function(baseURL,url,postData){
|
||||
if(postData){
|
||||
postData=qs.stringify(postData);
|
||||
}
|
||||
return request({
|
||||
baseURL,
|
||||
url: url,
|
||||
method: 'post',
|
||||
data: postData,
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
|
||||
baseURL,
|
||||
url: url,
|
||||
method: 'post',
|
||||
data:postData,
|
||||
headers:{'Content-Type':'application/x-www-form-urlencoded'}
|
||||
})
|
||||
}
|
||||
//post请求
|
||||
const postForm = function (baseURL, url, data) {
|
||||
return request({
|
||||
baseURL,
|
||||
url,
|
||||
data,
|
||||
method: 'post',
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
|
||||
});
|
||||
}
|
||||
const postForm=function(baseURL,url,data){
|
||||
return request({
|
||||
baseURL,
|
||||
url,
|
||||
data,
|
||||
method: 'post',
|
||||
headers:{'Content-Type':'application/x-www-form-urlencoded'}
|
||||
});
|
||||
}
|
||||
// const postJson=jsonRequest.post;
|
||||
|
||||
const postJson = function (baseURL, url, postData) {
|
||||
const postJson=function(baseURL,url,postData){
|
||||
return request({
|
||||
baseURL,
|
||||
url: url,
|
||||
method: 'post',
|
||||
data: postData,
|
||||
headers: { 'Content-Type': 'application/json;charset=utf-8' },
|
||||
baseURL,
|
||||
url: url,
|
||||
method: 'post',
|
||||
data:postData,
|
||||
headers:{'Content-Type':'application/json;charset=utf-8'},
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const postPdf = function (baseURL, url, postData) {
|
||||
const postPdf=function(baseURL,url,postData){
|
||||
return request({
|
||||
baseURL,
|
||||
url: url,
|
||||
responseType: 'blob',
|
||||
method: 'post',
|
||||
data: postData,
|
||||
headers: { 'Content-Type': 'application/pdf' },
|
||||
baseURL,
|
||||
url: url,
|
||||
responseType: 'blob',
|
||||
method: 'post',
|
||||
data:postData,
|
||||
headers:{'Content-Type':'application/pdf'},
|
||||
})
|
||||
}
|
||||
|
||||
// 导出文件请求定义
|
||||
const postJsonToFile = function (baseURL, url, postData) {
|
||||
const postJsonToFile=function(baseURL,url,postData){
|
||||
return request({
|
||||
baseURL,
|
||||
url: url,
|
||||
method: 'post',
|
||||
data: postData,
|
||||
headers: { 'Content-Type': 'application/json;charset=utf-8' },
|
||||
responseType: 'blob'
|
||||
baseURL,
|
||||
url: url,
|
||||
method: 'post',
|
||||
data:postData,
|
||||
headers:{'Content-Type':'application/json;charset=utf-8'},
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
||||
@@ -175,39 +170,39 @@ const postJsonToFile = function (baseURL, url, postData) {
|
||||
/**
|
||||
* put请求
|
||||
*/
|
||||
const put = function (baseURL, url, data) {
|
||||
if (data) {
|
||||
data = qs.stringify(data);
|
||||
const put=function(baseURL,url,data){
|
||||
if(data){
|
||||
data=qs.stringify(data);
|
||||
}
|
||||
return request({
|
||||
baseURL,
|
||||
url: url,
|
||||
method: 'put',
|
||||
data: data,
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
|
||||
baseURL,
|
||||
url: url,
|
||||
method: 'put',
|
||||
data:data,
|
||||
headers:{'Content-Type':'application/x-www-form-urlencoded'}
|
||||
})
|
||||
}
|
||||
|
||||
const putJson = function (baseURL, url, data) {
|
||||
const putJson=function(baseURL,url,data){
|
||||
return request({
|
||||
baseURL,
|
||||
url: url,
|
||||
method: 'put',
|
||||
data: data,
|
||||
headers: { 'Content-Type': 'application/json;charset=utf-8' },
|
||||
baseURL,
|
||||
url: url,
|
||||
method: 'put',
|
||||
data:data,
|
||||
headers:{'Content-Type':'application/json;charset=utf-8'},
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
export default {
|
||||
tokenName: TokenName,
|
||||
request,
|
||||
get,
|
||||
post,
|
||||
postJson,
|
||||
postJsonToFile,
|
||||
put,
|
||||
putJson,
|
||||
postPdf,
|
||||
tokenName:TokenName,
|
||||
request,
|
||||
get,
|
||||
post,
|
||||
postJson,
|
||||
postJsonToFile,
|
||||
put,
|
||||
putJson,
|
||||
postPdf,
|
||||
}
|
||||
|
||||
@@ -19,95 +19,90 @@ import errorCode from '@/utils/errorCode'
|
||||
|
||||
|
||||
// const ReLoginUrl=process.env.VUE_APP_LOGIN_URL;
|
||||
const TokenName = 'token';
|
||||
const TokenName='token';
|
||||
/**axios.defaults.headers['Content-Type'] = 'application/x-www-form-urlencoded'**/
|
||||
//只是用于发送json对象数据时使用post,put,patch
|
||||
/**axios.defaults.headers['Content-Type'] = 'application/x-www-form-urlencoded'**/
|
||||
//只是用于发送json对象数据时使用post,put,patch
|
||||
//用于普通的发送请求
|
||||
const formRequest = axios.create({
|
||||
// headers:{'Content-Type':'application/x-www-form-urlencoded'},
|
||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||
// baseURL: process.env.VUE_APP_CESOURCE_BASE_API,
|
||||
//超时
|
||||
timeout: 10000,
|
||||
})
|
||||
//发送json对象的拦截器
|
||||
formRequest.interceptors.request.use(config => {
|
||||
//是否需要设置 token
|
||||
const isToken = (config.headers || {}).isToken === false
|
||||
let curToken = getToken();
|
||||
//curToken='eyJ0eXBlIjoidG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC91LmJvZS5jb20iLCJpYXQiOjE2NzIzMTE2MTIsImV4cCI6MTY3MjMxODgxMiwiR2l2ZW5OYW1lIjoiYm9ldSIsInVzZXJJZCI6IjZCMDQ5RkFGLUMzMTQtN0NDRi0wRDI4LTBEMjNGNEM0MjUzMSIsInVJZCI6Ijk2NTM0MjAyNzQ5NzYwNzE2OCIsInBlcm1pc3Npb24iOiIifQ==.a4f41376e994c5fcd3ab537ce17572ef4c633863f87785cf7b6ffa353e2ed51c';
|
||||
if (curToken && !isToken) {
|
||||
config.headers[TokenName] = curToken // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||
}
|
||||
return config
|
||||
}, error => {
|
||||
console.log(error)
|
||||
Promise.reject(error)
|
||||
});
|
||||
formRequest.interceptors.response.use(res => {
|
||||
//console.log(res);
|
||||
const code = res.data.status || 200;
|
||||
if (code === 200) {
|
||||
return res.data
|
||||
} else {
|
||||
if (code === 401) {
|
||||
store.dispatch('LogOut').then(() => {
|
||||
if (top !== window) { // 判断当前是否在iframe内
|
||||
top.location.href = this.webBaseUrl + ReLoginUrl;
|
||||
} else {
|
||||
window.location.href = this.webBaseUrl + ReLoginUrl;
|
||||
}
|
||||
// location.href = this.webBaseUrl + ReLoginUrl;
|
||||
})
|
||||
} else if (code === 403) {
|
||||
var msg = '当前操作没有权限';
|
||||
Message({ message: msg, type: 'error' });
|
||||
return Promise.reject(new Error(msg))
|
||||
} else {
|
||||
//Message({message: res.data.message, type: 'error'});
|
||||
//console.log('err' + res.data.error);
|
||||
return res.data
|
||||
}
|
||||
}
|
||||
},
|
||||
error => {
|
||||
console.log('err', error)
|
||||
const formRequest=axios.create({
|
||||
// headers:{'Content-Type':'application/x-www-form-urlencoded'},
|
||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||
// baseURL: process.env.VUE_APP_CESOURCE_BASE_API,
|
||||
//超时
|
||||
timeout: 10000,
|
||||
})
|
||||
//发送json对象的拦截器
|
||||
formRequest.interceptors.request.use(config => {
|
||||
//是否需要设置 token
|
||||
const isToken = (config.headers || {}).isToken === false
|
||||
let curToken=getToken();
|
||||
//curToken='eyJ0eXBlIjoidG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC91LmJvZS5jb20iLCJpYXQiOjE2NzIzMTE2MTIsImV4cCI6MTY3MjMxODgxMiwiR2l2ZW5OYW1lIjoiYm9ldSIsInVzZXJJZCI6IjZCMDQ5RkFGLUMzMTQtN0NDRi0wRDI4LTBEMjNGNEM0MjUzMSIsInVJZCI6Ijk2NTM0MjAyNzQ5NzYwNzE2OCIsInBlcm1pc3Npb24iOiIifQ==.a4f41376e994c5fcd3ab537ce17572ef4c633863f87785cf7b6ffa353e2ed51c';
|
||||
if (curToken && !isToken) {
|
||||
config.headers[TokenName] = curToken // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||
}
|
||||
return config
|
||||
}, error => {
|
||||
console.log(error)
|
||||
Promise.reject(error)
|
||||
});
|
||||
formRequest.interceptors.response.use(res => {
|
||||
//console.log(res);
|
||||
const code = res.data.status || 200;
|
||||
if(code===200){
|
||||
return res.data
|
||||
}else{
|
||||
if(code === 401){
|
||||
store.dispatch('LogOut').then(() => {
|
||||
location.href = this.webBaseUrl + ReLoginUrl;
|
||||
})
|
||||
}else if(code===403){
|
||||
var msg='当前操作没有权限';
|
||||
Message({message: msg, type: 'error'});
|
||||
return Promise.reject(new Error(msg))
|
||||
}else{
|
||||
//Message({message: res.data.message, type: 'error'});
|
||||
//console.log('err' + res.data.error);
|
||||
return res.data
|
||||
}
|
||||
}
|
||||
},
|
||||
error => {
|
||||
console.log('err',error)
|
||||
let { message } = error;
|
||||
if (message == "Network Error") {
|
||||
message = "网络异常,请稍后重试";
|
||||
message = "网络异常,请稍后重试";
|
||||
}
|
||||
else if (message.includes("timeout")) {
|
||||
message = "网络异常或接口错误,请求超时";
|
||||
message = "网络异常或接口错误,请求超时";
|
||||
}
|
||||
else if (message.includes("Request failed with status code")) {
|
||||
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
||||
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
||||
}
|
||||
Message({
|
||||
message: message,
|
||||
type: 'error',
|
||||
duration: 5 * 1000
|
||||
message: message,
|
||||
type: 'error',
|
||||
duration: 5 * 1000
|
||||
})
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
/**
|
||||
* request请求,可以自定义参数
|
||||
*/
|
||||
const request = formRequest.request;
|
||||
const request=formRequest.request;
|
||||
|
||||
/**
|
||||
* get请求 ,只有url
|
||||
*/
|
||||
const get = function (baseURL, url) {
|
||||
return request({
|
||||
baseURL,
|
||||
url: url,
|
||||
method: 'get',
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
|
||||
})
|
||||
const get = function(baseURL,url){
|
||||
return request({
|
||||
baseURL,
|
||||
url: url,
|
||||
method: 'get',
|
||||
headers:{'Content-Type':'application/x-www-form-urlencoded'}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,49 +110,49 @@ const get = function (baseURL, url) {
|
||||
* @param {Object} url
|
||||
* @param {Object} postData
|
||||
*/
|
||||
const post = function (baseURL, url, postData) {
|
||||
if (postData) {
|
||||
postData = qs.stringify(postData);
|
||||
const post=function(baseURL,url,postData){
|
||||
if(postData){
|
||||
postData=qs.stringify(postData);
|
||||
}
|
||||
return request({
|
||||
baseURL,
|
||||
url: url,
|
||||
method: 'post',
|
||||
data: postData,
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
|
||||
baseURL,
|
||||
url: url,
|
||||
method: 'post',
|
||||
data:postData,
|
||||
headers:{'Content-Type':'application/x-www-form-urlencoded'}
|
||||
})
|
||||
}
|
||||
//post请求
|
||||
const postForm = function (baseURL, url, data) {
|
||||
return request({
|
||||
baseURL,
|
||||
url,
|
||||
data,
|
||||
method: 'post',
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
|
||||
});
|
||||
}
|
||||
const postForm=function(baseURL,url,data){
|
||||
return request({
|
||||
baseURL,
|
||||
url,
|
||||
data,
|
||||
method: 'post',
|
||||
headers:{'Content-Type':'application/x-www-form-urlencoded'}
|
||||
});
|
||||
}
|
||||
// const postJson=jsonRequest.post;
|
||||
|
||||
const postJson = function (baseURL, url, postData) {
|
||||
const postJson=function(baseURL,url,postData){
|
||||
return request({
|
||||
baseURL,
|
||||
url: url,
|
||||
method: 'post',
|
||||
data: postData,
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
baseURL,
|
||||
url: url,
|
||||
method: 'post',
|
||||
data:postData,
|
||||
headers:{'Content-Type':'application/json'},
|
||||
})
|
||||
}
|
||||
|
||||
// 导出文件请求定义
|
||||
const postJsonToFile = function (baseURL, url, postData) {
|
||||
const postJsonToFile=function(baseURL,url,postData){
|
||||
return request({
|
||||
baseURL,
|
||||
url: url,
|
||||
method: 'post',
|
||||
data: postData,
|
||||
headers: { 'Content-Type': 'application/json;charset=utf-8' },
|
||||
responseType: 'blob'
|
||||
baseURL,
|
||||
url: url,
|
||||
method: 'post',
|
||||
data:postData,
|
||||
headers:{'Content-Type':'application/json;charset=utf-8'},
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
||||
@@ -165,38 +160,38 @@ const postJsonToFile = function (baseURL, url, postData) {
|
||||
/**
|
||||
* put请求
|
||||
*/
|
||||
const put = function (baseURL, url, data) {
|
||||
if (data) {
|
||||
data = qs.stringify(data);
|
||||
const put=function(baseURL,url,data){
|
||||
if(data){
|
||||
data=qs.stringify(data);
|
||||
}
|
||||
return request({
|
||||
baseURL,
|
||||
url: url,
|
||||
method: 'put',
|
||||
data: data,
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
|
||||
baseURL,
|
||||
url: url,
|
||||
method: 'put',
|
||||
data:data,
|
||||
headers:{'Content-Type':'application/x-www-form-urlencoded'}
|
||||
})
|
||||
}
|
||||
|
||||
const putJson = function (baseURL, url, data) {
|
||||
const putJson=function(baseURL,url,data){
|
||||
return request({
|
||||
baseURL,
|
||||
url: url,
|
||||
method: 'put',
|
||||
data: data,
|
||||
headers: { 'Content-Type': 'application/json;charset=utf-8' },
|
||||
baseURL,
|
||||
url: url,
|
||||
method: 'put',
|
||||
data:data,
|
||||
headers:{'Content-Type':'application/json;charset=utf-8'},
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
export default {
|
||||
tokenName: TokenName,
|
||||
request,
|
||||
get,
|
||||
post,
|
||||
postJson,
|
||||
postJsonToFile,
|
||||
put,
|
||||
putJson,
|
||||
tokenName:TokenName,
|
||||
request,
|
||||
get,
|
||||
post,
|
||||
postJson,
|
||||
postJsonToFile,
|
||||
put,
|
||||
putJson,
|
||||
}
|
||||
|
||||
@@ -18,201 +18,191 @@ import errorCode from '@/utils/errorCode'
|
||||
*delete请求 axios.delete(url[, config])
|
||||
*/
|
||||
|
||||
const ReLoginUrl = process.env.VUE_APP_LOGIN_URL;
|
||||
const TokenName = 'token';
|
||||
const ReLoginUrl=process.env.VUE_APP_LOGIN_URL;
|
||||
const TokenName='token';
|
||||
|
||||
/**axios.defaults.headers['Content-Type'] = 'application/x-www-form-urlencoded'**/
|
||||
//只是用于发送json对象数据时使用post,put,patch
|
||||
const jsonRequest = axios.create({
|
||||
headers: { 'Content-Type': 'application/json;charset=utf-8' },
|
||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||
baseURL: process.env.VUE_APP_BOE_BASE_API,
|
||||
//超时
|
||||
timeout: 10000,
|
||||
const jsonRequest=axios.create({
|
||||
headers:{'Content-Type':'application/json;charset=utf-8'},
|
||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||
baseURL: process.env.VUE_APP_BOE_BASE_API,
|
||||
//超时
|
||||
timeout: 10000,
|
||||
});
|
||||
//发送json对象的拦截器
|
||||
jsonRequest.interceptors.request.use(config => {
|
||||
//是否需要设置 token
|
||||
const isToken = (config.headers || {}).isToken === false
|
||||
if (getToken() && !isToken) {
|
||||
config.headers[TokenName] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||
}
|
||||
return config
|
||||
//是否需要设置 token
|
||||
const isToken = (config.headers || {}).isToken === false
|
||||
if (getToken() && !isToken) {
|
||||
config.headers[TokenName] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||
}
|
||||
return config
|
||||
}, error => {
|
||||
console.log(error)
|
||||
Promise.reject(error)
|
||||
console.log(error)
|
||||
Promise.reject(error)
|
||||
})
|
||||
|
||||
// 响应拦截器
|
||||
jsonRequest.interceptors.response.use(res => {
|
||||
|
||||
const code1 = res.data.status || 200;
|
||||
const code = parseInt(code1);
|
||||
if (code === 200) {
|
||||
return res.data
|
||||
} else {
|
||||
if (code == 6001) { //对方是字符串,所以这里不要使用三个等号
|
||||
store.dispatch('LogOut').then(() => {
|
||||
if (top !== window) { // 判断当前是否在iframe内
|
||||
top.location.href = ReLoginUrl;
|
||||
} else {
|
||||
window.location.href = ReLoginUrl;
|
||||
}
|
||||
// location.href = ReLoginUrl;
|
||||
})
|
||||
} else if (code === 403) {
|
||||
var msg = '当前操作没有权限';
|
||||
Message({ message: msg, type: 'error' });
|
||||
return Promise.reject(new Error(msg))
|
||||
//return res.data;
|
||||
} else {
|
||||
//Message({message: res.data.message, type: 'error'});
|
||||
//console.log('err:' + res.data.error);
|
||||
//return Promise.reject(new Error(res.data.message))
|
||||
return res.data;
|
||||
}
|
||||
}
|
||||
},
|
||||
error => {
|
||||
console.log('err' + error)
|
||||
let { message } = error;
|
||||
if (message == "Network Error") {
|
||||
message = "网络异常,请稍后重试";
|
||||
}
|
||||
else if (message.includes("timeout")) {
|
||||
message = "系统接口请求超时";
|
||||
//location.href = this.webBaseUrl + ReLoginUrl;
|
||||
}
|
||||
else if (message.includes("Request failed with status code")) {
|
||||
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
||||
}
|
||||
Message({
|
||||
message: message,
|
||||
type: 'error',
|
||||
duration: 5 * 1000
|
||||
})
|
||||
return Promise.reject(error)
|
||||
}
|
||||
const code1 = res.data.status || 200;
|
||||
const code=parseInt(code1);
|
||||
if(code===200){
|
||||
return res.data
|
||||
}else{
|
||||
if(code == 6001){ //对方是字符串,所以这里不要使用三个等号
|
||||
store.dispatch('LogOut').then(() => {
|
||||
location.href = ReLoginUrl;
|
||||
})
|
||||
}else if(code===403){
|
||||
var msg='当前操作没有权限';
|
||||
Message({message: msg, type: 'error'});
|
||||
return Promise.reject(new Error(msg))
|
||||
//return res.data;
|
||||
}else{
|
||||
//Message({message: res.data.message, type: 'error'});
|
||||
//console.log('err:' + res.data.error);
|
||||
//return Promise.reject(new Error(res.data.message))
|
||||
return res.data;
|
||||
}
|
||||
}
|
||||
},
|
||||
error => {
|
||||
console.log('err' + error)
|
||||
let { message } = error;
|
||||
if (message == "Network Error") {
|
||||
message = "网络异常,请稍后重试";
|
||||
}
|
||||
else if (message.includes("timeout")) {
|
||||
message = "系统接口请求超时";
|
||||
//location.href = this.webBaseUrl + ReLoginUrl;
|
||||
}
|
||||
else if (message.includes("Request failed with status code")) {
|
||||
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
||||
}
|
||||
Message({
|
||||
message: message,
|
||||
type: 'error',
|
||||
duration: 5 * 1000
|
||||
})
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
//用于普通的发送请求
|
||||
const formRequest = axios.create({
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||
baseURL: process.env.VUE_APP_BOE_BASE_API,
|
||||
//超时
|
||||
timeout: 10000,
|
||||
const formRequest=axios.create({
|
||||
headers:{'Content-Type':'application/x-www-form-urlencoded'},
|
||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||
baseURL: process.env.VUE_APP_BOE_BASE_API,
|
||||
//超时
|
||||
timeout: 10000,
|
||||
})
|
||||
//发送json对象的拦截器
|
||||
formRequest.interceptors.request.use(config => {
|
||||
//是否需要设置 token
|
||||
const isToken = (config.headers || {}).isToken === false
|
||||
if (getToken() && !isToken) {
|
||||
config.headers[TokenName] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||
}
|
||||
return config
|
||||
//是否需要设置 token
|
||||
const isToken = (config.headers || {}).isToken === false
|
||||
if (getToken() && !isToken) {
|
||||
config.headers[TokenName] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||
}
|
||||
return config
|
||||
}, error => {
|
||||
console.log(error)
|
||||
Promise.reject(error)
|
||||
console.log(error)
|
||||
Promise.reject(error)
|
||||
});
|
||||
formRequest.interceptors.response.use(res => {
|
||||
const code = res.data.status || 200;
|
||||
if (code === 200) {
|
||||
return res.data
|
||||
} else {
|
||||
if (code == 6001) { //对方是字符串,所以这里不要使用三个等号
|
||||
store.dispatch('LogOut').then(() => {
|
||||
if (top !== window) { // 判断当前是否在iframe内
|
||||
top.location.href = ReLoginUrl;
|
||||
} else {
|
||||
window.location.href = ReLoginUrl;
|
||||
}
|
||||
// location.href = ReLoginUrl;
|
||||
})
|
||||
} else if (code === 403) {
|
||||
var msg = '当前操作没有权限';
|
||||
Message({ message: msg, type: 'error' });
|
||||
return Promise.reject(new Error(msg))
|
||||
} else {
|
||||
//Message({message: res.data.message, type: 'error'});
|
||||
//console.log('err' + res.data.error);
|
||||
//return Promise.reject(new Error(res.data.message))
|
||||
return res.data;//返回给用户做业务处理
|
||||
}
|
||||
}
|
||||
},
|
||||
error => {
|
||||
console.log('err' + error)
|
||||
let { message } = error;
|
||||
if (message == "Network Error") {
|
||||
message = "网络异常,请稍后重试";
|
||||
}
|
||||
else if (message.includes("timeout")) {
|
||||
message = "系统接口请求超时";
|
||||
//location.href = this.webBaseUrl + ReLoginUrl;
|
||||
}
|
||||
else if (message.includes("Request failed with status code")) {
|
||||
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
||||
}
|
||||
Message({
|
||||
message: message,
|
||||
type: 'error',
|
||||
duration: 5 * 1000
|
||||
})
|
||||
return Promise.reject(error)
|
||||
}
|
||||
const code = res.data.status || 200;
|
||||
if(code===200){
|
||||
return res.data
|
||||
}else{
|
||||
if(code == 6001){ //对方是字符串,所以这里不要使用三个等号
|
||||
store.dispatch('LogOut').then(() => {
|
||||
location.href = ReLoginUrl;
|
||||
})
|
||||
}else if(code===403){
|
||||
var msg='当前操作没有权限';
|
||||
Message({message: msg, type: 'error'});
|
||||
return Promise.reject(new Error(msg))
|
||||
}else{
|
||||
//Message({message: res.data.message, type: 'error'});
|
||||
//console.log('err' + res.data.error);
|
||||
//return Promise.reject(new Error(res.data.message))
|
||||
return res.data;//返回给用户做业务处理
|
||||
}
|
||||
}
|
||||
},
|
||||
error => {
|
||||
console.log('err' + error)
|
||||
let { message } = error;
|
||||
if (message == "Network Error") {
|
||||
message = "网络异常,请稍后重试";
|
||||
}
|
||||
else if (message.includes("timeout")) {
|
||||
message = "系统接口请求超时";
|
||||
//location.href = this.webBaseUrl + ReLoginUrl;
|
||||
}
|
||||
else if (message.includes("Request failed with status code")) {
|
||||
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
||||
}
|
||||
Message({
|
||||
message: message,
|
||||
type: 'error',
|
||||
duration: 5 * 1000
|
||||
})
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
//request请求
|
||||
const request = function (cfg) {
|
||||
if (cfg.data) {
|
||||
cfg.data = qs.stringify(cfg.data);
|
||||
const request=function(cfg){
|
||||
if(cfg.data){
|
||||
cfg.data=qs.stringify(cfg.data);
|
||||
}
|
||||
};
|
||||
//requestJson请求
|
||||
const requestJson = jsonRequest.request;
|
||||
const requestJson=jsonRequest.request;
|
||||
//get请求
|
||||
const get = formRequest.request;
|
||||
const get=formRequest.request;
|
||||
//post请求
|
||||
const post = function (url, data, config) {
|
||||
if (data) {
|
||||
data = qs.stringify(data);
|
||||
const post=function(url,data,config){
|
||||
if(data){
|
||||
data=qs.stringify(data);
|
||||
}
|
||||
return formRequest.post(url, data, config);
|
||||
return formRequest.post(url,data,config);
|
||||
}
|
||||
//postJson请求
|
||||
const postJson = jsonRequest.post;
|
||||
const postJson=jsonRequest.post;
|
||||
//put请求
|
||||
const put = function (url, data, config) {
|
||||
if (data) {
|
||||
data = qs.stringify(data);
|
||||
const put=function(url,data,config){
|
||||
if(data){
|
||||
data=qs.stringify(data);
|
||||
}
|
||||
return formRequest.put(url, data, config);
|
||||
return formRequest.put(url,data,config);
|
||||
}
|
||||
//putJson请求
|
||||
const putJson = jsonRequest.put;
|
||||
const putJson=jsonRequest.put;
|
||||
//patch请求
|
||||
const patch = function (url, data, config) {
|
||||
if (data) {
|
||||
data = qs.stringify(data);
|
||||
const patch=function(url,data,config){
|
||||
if(data){
|
||||
data=qs.stringify(data);
|
||||
}
|
||||
return formRequest.patch(url, data, config);
|
||||
return formRequest.patch(url,data,config);
|
||||
}
|
||||
//patchJson请求
|
||||
const patchJson = jsonRequest.patch;
|
||||
const patchJson=jsonRequest.patch;
|
||||
//delete请求
|
||||
const del = formRequest.delete;
|
||||
const del=formRequest.delete;
|
||||
|
||||
|
||||
export default {
|
||||
request,
|
||||
requestJson,
|
||||
get,
|
||||
post,
|
||||
postJson,
|
||||
put,
|
||||
putJson,
|
||||
patch,
|
||||
patchJson,
|
||||
del
|
||||
request,
|
||||
requestJson,
|
||||
get,
|
||||
post,
|
||||
postJson,
|
||||
put,
|
||||
putJson,
|
||||
patch,
|
||||
patchJson,
|
||||
del
|
||||
}
|
||||
|
||||
@@ -103,6 +103,14 @@ const getUsersByIds = function(ids) {
|
||||
return ajax.postJson(baseURL,'/user/getUserMessageToDai',ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据关键字检索用户(创建人下拉)
|
||||
* @param {string} keyword
|
||||
*/
|
||||
const selectUser = function(keyword = '') {
|
||||
return ajax.postJson(baseURL,'/user/selectuser',{ keyword });
|
||||
}
|
||||
|
||||
export default {
|
||||
userParentOrg,
|
||||
findOrgsByKeyword,
|
||||
@@ -116,5 +124,6 @@ export default {
|
||||
getInAudienceIds,
|
||||
getUsersByIds,
|
||||
updateUser,
|
||||
logout
|
||||
logout,
|
||||
selectUser
|
||||
}
|
||||
|
||||
@@ -16,196 +16,186 @@ import errorCode from '@/utils/errorCode'
|
||||
*patchJson请求 axios.patch(url[, data[, config]])
|
||||
*delete请求 axios.delete(url[, config])
|
||||
*/
|
||||
|
||||
const ReLoginUrl = "/login";
|
||||
const TokenName = 'XBOE-Access-Token';
|
||||
|
||||
const ReLoginUrl="/login";
|
||||
const TokenName='XBOE-Access-Token';
|
||||
/**axios.defaults.headers['Content-Type'] = 'application/x-www-form-urlencoded'**/
|
||||
//只是用于发送json对象数据时使用post,put,patch
|
||||
const jsonRequest = axios.create({
|
||||
headers: { 'Content-Type': 'application/json;charset=utf-8' },
|
||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||
baseURL: process.env.VUE_APP_CESOURCE_BASE_API,
|
||||
//超时
|
||||
timeout: 10000,
|
||||
const jsonRequest=axios.create({
|
||||
headers:{'Content-Type':'application/json;charset=utf-8'},
|
||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||
baseURL: process.env.VUE_APP_CESOURCE_BASE_API,
|
||||
//超时
|
||||
timeout: 10000,
|
||||
});
|
||||
//发送json对象的拦截器
|
||||
jsonRequest.interceptors.request.use(config => {
|
||||
//是否需要设置 token
|
||||
const isToken = (config.headers || {}).isToken === false
|
||||
if (getToken() && !isToken) {
|
||||
config.headers[TokenName] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||
}
|
||||
return config
|
||||
//是否需要设置 token
|
||||
const isToken = (config.headers || {}).isToken === false
|
||||
if (getToken() && !isToken) {
|
||||
config.headers[TokenName] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||
}
|
||||
return config
|
||||
}, error => {
|
||||
console.log(error)
|
||||
Promise.reject(error)
|
||||
console.log(error)
|
||||
Promise.reject(error)
|
||||
})
|
||||
|
||||
// 响应拦截器
|
||||
jsonRequest.interceptors.response.use(res => {
|
||||
|
||||
const code = res.data.status || 200;
|
||||
if (code === 200) {
|
||||
return res.data
|
||||
} else {
|
||||
if (code === 401) {
|
||||
store.dispatch('LogOut').then(() => {
|
||||
if (top !== window) { // 判断当前是否在iframe内
|
||||
top.location.href = this.webBaseUrl + ReLoginUrl;
|
||||
} else {
|
||||
window.location.href = this.webBaseUrl + ReLoginUrl;
|
||||
}
|
||||
// location.href = this.webBaseUrl + ReLoginUrl;
|
||||
})
|
||||
} else if (code === 403) {
|
||||
var msg = '当前操作没有权限';
|
||||
Message({ message: msg, type: 'error' });
|
||||
return Promise.reject(new Error(msg))
|
||||
} else {
|
||||
//Message({message: res.data.message, type: 'error'});
|
||||
//console.log('err:' + res.data.error);
|
||||
return res.data;
|
||||
//return Promise.reject(new Error(res.data.message))
|
||||
}
|
||||
}
|
||||
},
|
||||
error => {
|
||||
console.log('err' + error)
|
||||
let { message } = error;
|
||||
if (message == "Network Error") {
|
||||
message = "网络异常,请稍后重试";
|
||||
}
|
||||
else if (message.includes("timeout")) {
|
||||
message = "系统接口请求超时";
|
||||
}
|
||||
else if (message.includes("Request failed with status code")) {
|
||||
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
||||
}
|
||||
Message({
|
||||
message: message,
|
||||
type: 'error',
|
||||
duration: 5 * 1000
|
||||
})
|
||||
return Promise.reject(error)
|
||||
}
|
||||
const code = res.data.status || 200;
|
||||
if(code===200){
|
||||
return res.data
|
||||
}else{
|
||||
if(code === 401){
|
||||
store.dispatch('LogOut').then(() => {
|
||||
location.href = this.webBaseUrl + ReLoginUrl;
|
||||
})
|
||||
}else if(code===403){
|
||||
var msg='当前操作没有权限';
|
||||
Message({message: msg, type: 'error'});
|
||||
return Promise.reject(new Error(msg))
|
||||
}else{
|
||||
//Message({message: res.data.message, type: 'error'});
|
||||
//console.log('err:' + res.data.error);
|
||||
return res.data;
|
||||
//return Promise.reject(new Error(res.data.message))
|
||||
}
|
||||
}
|
||||
},
|
||||
error => {
|
||||
console.log('err' + error)
|
||||
let { message } = error;
|
||||
if (message == "Network Error") {
|
||||
message = "网络异常,请稍后重试";
|
||||
}
|
||||
else if (message.includes("timeout")) {
|
||||
message = "系统接口请求超时";
|
||||
}
|
||||
else if (message.includes("Request failed with status code")) {
|
||||
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
||||
}
|
||||
Message({
|
||||
message: message,
|
||||
type: 'error',
|
||||
duration: 5 * 1000
|
||||
})
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
//用于普通的发送请求
|
||||
const formRequest = axios.create({
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||
baseURL: process.env.VUE_APP_CESOURCE_BASE_API,
|
||||
//超时
|
||||
timeout: 10000,
|
||||
const formRequest=axios.create({
|
||||
headers:{'Content-Type':'application/x-www-form-urlencoded'},
|
||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||
baseURL: process.env.VUE_APP_CESOURCE_BASE_API,
|
||||
//超时
|
||||
timeout: 10000,
|
||||
})
|
||||
//发送json对象的拦截器
|
||||
formRequest.interceptors.request.use(config => {
|
||||
//是否需要设置 token
|
||||
const isToken = (config.headers || {}).isToken === false
|
||||
if (getToken() && !isToken) {
|
||||
config.headers[TokenName] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||
}
|
||||
return config
|
||||
//是否需要设置 token
|
||||
const isToken = (config.headers || {}).isToken === false
|
||||
if (getToken() && !isToken) {
|
||||
config.headers[TokenName] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||
}
|
||||
return config
|
||||
}, error => {
|
||||
console.log(error)
|
||||
Promise.reject(error)
|
||||
console.log(error)
|
||||
Promise.reject(error)
|
||||
});
|
||||
formRequest.interceptors.response.use(res => {
|
||||
const code = res.data.status || 200;
|
||||
if (code === 200) {
|
||||
return res.data
|
||||
} else {
|
||||
if (code === 401) {
|
||||
store.dispatch('LogOut').then(() => {
|
||||
if (top !== window) { // 判断当前是否在iframe内
|
||||
top.location.href = this.webBaseUrl + ReLoginUrl;
|
||||
} else {
|
||||
window.location.href = this.webBaseUrl + ReLoginUrl;
|
||||
}
|
||||
// location.href = this.webBaseUrl + ReLoginUrl;
|
||||
})
|
||||
} else if (code === 403) {
|
||||
var msg = '当前操作没有权限';
|
||||
Message({ message: msg, type: 'error' });
|
||||
return Promise.reject(new Error(msg))
|
||||
} else {
|
||||
//Message({message: res.data.message, type: 'error'});
|
||||
//console.log('err' + res.data.error);
|
||||
const code = res.data.status || 200;
|
||||
if(code===200){
|
||||
return res.data
|
||||
}
|
||||
}
|
||||
},
|
||||
error => {
|
||||
console.log('err' + error)
|
||||
let { message } = error;
|
||||
if (message == "Network Error") {
|
||||
message = "网络异常,请稍后重试";
|
||||
}
|
||||
else if (message.includes("timeout")) {
|
||||
message = "系统接口请求超时";
|
||||
}
|
||||
else if (message.includes("Request failed with status code")) {
|
||||
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
||||
}
|
||||
Message({
|
||||
message: message,
|
||||
type: 'error',
|
||||
duration: 5 * 1000
|
||||
})
|
||||
return Promise.reject(error)
|
||||
}
|
||||
}else{
|
||||
if(code === 401){
|
||||
store.dispatch('LogOut').then(() => {
|
||||
location.href = this.webBaseUrl + ReLoginUrl;
|
||||
})
|
||||
}else if(code===403){
|
||||
var msg='当前操作没有权限';
|
||||
Message({message: msg, type: 'error'});
|
||||
return Promise.reject(new Error(msg))
|
||||
}else{
|
||||
//Message({message: res.data.message, type: 'error'});
|
||||
//console.log('err' + res.data.error);
|
||||
return res.data
|
||||
}
|
||||
}
|
||||
},
|
||||
error => {
|
||||
console.log('err' + error)
|
||||
let { message } = error;
|
||||
if (message == "Network Error") {
|
||||
message = "网络异常,请稍后重试";
|
||||
}
|
||||
else if (message.includes("timeout")) {
|
||||
message = "系统接口请求超时";
|
||||
}
|
||||
else if (message.includes("Request failed with status code")) {
|
||||
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
||||
}
|
||||
Message({
|
||||
message: message,
|
||||
type: 'error',
|
||||
duration: 5 * 1000
|
||||
})
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
//request请求
|
||||
const request = function (cfg) {
|
||||
if (cfg.data) {
|
||||
cfg.data = qs.stringify(cfg.data);
|
||||
const request=function(cfg){
|
||||
if(cfg.data){
|
||||
cfg.data=qs.stringify(cfg.data);
|
||||
}
|
||||
};
|
||||
//requestJson请求
|
||||
const requestJson = jsonRequest.request;
|
||||
const requestJson=jsonRequest.request;
|
||||
//get请求
|
||||
const get = formRequest.request;
|
||||
const get=formRequest.request;
|
||||
//post请求
|
||||
const post = function (url, data, config) {
|
||||
if (data) {
|
||||
data = qs.stringify(data);
|
||||
const post=function(url,data,config){
|
||||
if(data){
|
||||
data=qs.stringify(data);
|
||||
}
|
||||
return formRequest.post(url, data, config);
|
||||
return formRequest.post(url,data,config);
|
||||
}
|
||||
//postJson请求
|
||||
const postJson = jsonRequest.post;
|
||||
const postJson=jsonRequest.post;
|
||||
//put请求
|
||||
const put = function (url, data, config) {
|
||||
if (data) {
|
||||
data = qs.stringify(data);
|
||||
const put=function(url,data,config){
|
||||
if(data){
|
||||
data=qs.stringify(data);
|
||||
}
|
||||
return formRequest.put(url, data, config);
|
||||
return formRequest.put(url,data,config);
|
||||
}
|
||||
//putJson请求
|
||||
const putJson = jsonRequest.put;
|
||||
const putJson=jsonRequest.put;
|
||||
//patch请求
|
||||
const patch = function (url, data, config) {
|
||||
if (data) {
|
||||
data = qs.stringify(data);
|
||||
const patch=function(url,data,config){
|
||||
if(data){
|
||||
data=qs.stringify(data);
|
||||
}
|
||||
return formRequest.patch(url, data, config);
|
||||
return formRequest.patch(url,data,config);
|
||||
}
|
||||
//patchJson请求
|
||||
const patchJson = jsonRequest.patch;
|
||||
const patchJson=jsonRequest.patch;
|
||||
//delete请求
|
||||
const del = formRequest.delete;
|
||||
const del=formRequest.delete;
|
||||
|
||||
|
||||
export default {
|
||||
request,
|
||||
requestJson,
|
||||
get,
|
||||
post,
|
||||
postJson,
|
||||
put,
|
||||
putJson,
|
||||
patch,
|
||||
patchJson,
|
||||
del
|
||||
request,
|
||||
requestJson,
|
||||
get,
|
||||
post,
|
||||
postJson,
|
||||
put,
|
||||
putJson,
|
||||
patch,
|
||||
patchJson,
|
||||
del
|
||||
}
|
||||
|
||||
@@ -17,195 +17,185 @@ import errorCode from '@/utils/errorCode'
|
||||
*delete请求 axios.delete(url[, config])
|
||||
*/
|
||||
|
||||
const ReLoginUrl = "/login";
|
||||
const TokenName = 'XBOE-Access-Token';
|
||||
const ReLoginUrl="/login";
|
||||
const TokenName='XBOE-Access-Token';
|
||||
/**axios.defaults.headers['Content-Type'] = 'application/x-www-form-urlencoded'**/
|
||||
//只是用于发送json对象数据时使用post,put,patch
|
||||
const jsonRequest = axios.create({
|
||||
headers: { 'Content-Type': 'application/json;charset=utf-8' },
|
||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||
baseURL: process.env.VUE_APP_STAT_BASE_API,
|
||||
//超时
|
||||
timeout: 10000,
|
||||
const jsonRequest=axios.create({
|
||||
headers:{'Content-Type':'application/json;charset=utf-8'},
|
||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||
baseURL: process.env.VUE_APP_STAT_BASE_API,
|
||||
//超时
|
||||
timeout: 10000,
|
||||
});
|
||||
//发送json对象的拦截器
|
||||
jsonRequest.interceptors.request.use(config => {
|
||||
//是否需要设置 token
|
||||
const isToken = (config.headers || {}).isToken === false
|
||||
if (getToken() && !isToken) {
|
||||
config.headers[TokenName] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||
}
|
||||
return config
|
||||
//是否需要设置 token
|
||||
const isToken = (config.headers || {}).isToken === false
|
||||
if (getToken() && !isToken) {
|
||||
config.headers[TokenName] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||
}
|
||||
return config
|
||||
}, error => {
|
||||
console.log(error)
|
||||
Promise.reject(error)
|
||||
console.log(error)
|
||||
Promise.reject(error)
|
||||
})
|
||||
|
||||
// 响应拦截器
|
||||
jsonRequest.interceptors.response.use(res => {
|
||||
|
||||
const code = res.data.status || 200;
|
||||
if (code === 200) {
|
||||
return res.data
|
||||
} else {
|
||||
if (code === 401) {
|
||||
store.dispatch('LogOut').then(() => {
|
||||
if (top !== window) { // 判断当前是否在iframe内
|
||||
top.location.href = this.webBaseUrl + ReLoginUrl;
|
||||
} else {
|
||||
window.location.href = this.webBaseUrl + ReLoginUrl;
|
||||
}
|
||||
// location.href = this.webBaseUrl + ReLoginUrl;
|
||||
})
|
||||
} else if (code === 403) {
|
||||
var msg = '当前操作没有权限';
|
||||
Message({ message: msg, type: 'error' });
|
||||
return Promise.reject(new Error(msg))
|
||||
} else {
|
||||
//Message({message: res.data.message, type: 'error'});
|
||||
//console.log('err:' + res.data.error);
|
||||
return res.data;
|
||||
//return Promise.reject(new Error(res.data.message))
|
||||
}
|
||||
}
|
||||
},
|
||||
error => {
|
||||
console.log('err' + error)
|
||||
let { message } = error;
|
||||
if (message == "Network Error") {
|
||||
message = "网络异常,请稍后重试";
|
||||
}
|
||||
else if (message.includes("timeout")) {
|
||||
message = "系统接口请求超时";
|
||||
}
|
||||
else if (message.includes("Request failed with status code")) {
|
||||
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
||||
}
|
||||
Message({
|
||||
message: message,
|
||||
type: 'error',
|
||||
duration: 5 * 1000
|
||||
})
|
||||
return Promise.reject(error)
|
||||
}
|
||||
const code = res.data.status || 200;
|
||||
if(code===200){
|
||||
return res.data
|
||||
}else{
|
||||
if(code === 401){
|
||||
store.dispatch('LogOut').then(() => {
|
||||
location.href = this.webBaseUrl + ReLoginUrl;
|
||||
})
|
||||
}else if(code===403){
|
||||
var msg='当前操作没有权限';
|
||||
Message({message: msg, type: 'error'});
|
||||
return Promise.reject(new Error(msg))
|
||||
}else{
|
||||
//Message({message: res.data.message, type: 'error'});
|
||||
//console.log('err:' + res.data.error);
|
||||
return res.data;
|
||||
//return Promise.reject(new Error(res.data.message))
|
||||
}
|
||||
}
|
||||
},
|
||||
error => {
|
||||
console.log('err' + error)
|
||||
let { message } = error;
|
||||
if (message == "Network Error") {
|
||||
message = "网络异常,请稍后重试";
|
||||
}
|
||||
else if (message.includes("timeout")) {
|
||||
message = "系统接口请求超时";
|
||||
}
|
||||
else if (message.includes("Request failed with status code")) {
|
||||
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
||||
}
|
||||
Message({
|
||||
message: message,
|
||||
type: 'error',
|
||||
duration: 5 * 1000
|
||||
})
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
//用于普通的发送请求
|
||||
const formRequest = axios.create({
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||
baseURL: process.env.VUE_APP_STAT_BASE_API,
|
||||
//超时
|
||||
timeout: 10000,
|
||||
const formRequest=axios.create({
|
||||
headers:{'Content-Type':'application/x-www-form-urlencoded'},
|
||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||
baseURL: process.env.VUE_APP_STAT_BASE_API,
|
||||
//超时
|
||||
timeout: 10000,
|
||||
})
|
||||
//发送json对象的拦截器
|
||||
formRequest.interceptors.request.use(config => {
|
||||
//是否需要设置 token
|
||||
const isToken = (config.headers || {}).isToken === false
|
||||
if (getToken() && !isToken) {
|
||||
config.headers[TokenName] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||
}
|
||||
return config
|
||||
//是否需要设置 token
|
||||
const isToken = (config.headers || {}).isToken === false
|
||||
if (getToken() && !isToken) {
|
||||
config.headers[TokenName] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||
}
|
||||
return config
|
||||
}, error => {
|
||||
console.log(error)
|
||||
Promise.reject(error)
|
||||
console.log(error)
|
||||
Promise.reject(error)
|
||||
});
|
||||
formRequest.interceptors.response.use(res => {
|
||||
const code = res.data.status || 200;
|
||||
if (code === 200) {
|
||||
return res.data
|
||||
} else {
|
||||
if (code === 401) {
|
||||
store.dispatch('LogOut').then(() => {
|
||||
if (top !== window) { // 判断当前是否在iframe内
|
||||
top.location.href = this.webBaseUrl + ReLoginUrl;
|
||||
} else {
|
||||
window.location.href = this.webBaseUrl + ReLoginUrl;
|
||||
}
|
||||
// location.href = this.webBaseUrl + ReLoginUrl;
|
||||
})
|
||||
} else if (code === 403) {
|
||||
var msg = '当前操作没有权限';
|
||||
Message({ message: msg, type: 'error' });
|
||||
return Promise.reject(new Error(msg))
|
||||
} else {
|
||||
//Message({message: res.data.message, type: 'error'});
|
||||
//console.log('err' + res.data.error);
|
||||
const code = res.data.status || 200;
|
||||
if(code===200){
|
||||
return res.data
|
||||
}
|
||||
}
|
||||
},
|
||||
error => {
|
||||
console.log('err' + error)
|
||||
let { message } = error;
|
||||
if (message == "Network Error") {
|
||||
message = "网络异常,请稍后重试";
|
||||
}
|
||||
else if (message.includes("timeout")) {
|
||||
message = "系统接口请求超时";
|
||||
}
|
||||
else if (message.includes("Request failed with status code")) {
|
||||
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
||||
}
|
||||
Message({
|
||||
message: message,
|
||||
type: 'error',
|
||||
duration: 5 * 1000
|
||||
})
|
||||
return Promise.reject(error)
|
||||
}
|
||||
}else{
|
||||
if(code === 401){
|
||||
store.dispatch('LogOut').then(() => {
|
||||
location.href = this.webBaseUrl + ReLoginUrl;
|
||||
})
|
||||
}else if(code===403){
|
||||
var msg='当前操作没有权限';
|
||||
Message({message: msg, type: 'error'});
|
||||
return Promise.reject(new Error(msg))
|
||||
}else{
|
||||
//Message({message: res.data.message, type: 'error'});
|
||||
//console.log('err' + res.data.error);
|
||||
return res.data
|
||||
}
|
||||
}
|
||||
},
|
||||
error => {
|
||||
console.log('err' + error)
|
||||
let { message } = error;
|
||||
if (message == "Network Error") {
|
||||
message = "网络异常,请稍后重试";
|
||||
}
|
||||
else if (message.includes("timeout")) {
|
||||
message = "系统接口请求超时";
|
||||
}
|
||||
else if (message.includes("Request failed with status code")) {
|
||||
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
||||
}
|
||||
Message({
|
||||
message: message,
|
||||
type: 'error',
|
||||
duration: 5 * 1000
|
||||
})
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
//request请求
|
||||
const request = function (cfg) {
|
||||
if (cfg.data) {
|
||||
cfg.data = qs.stringify(cfg.data);
|
||||
const request=function(cfg){
|
||||
if(cfg.data){
|
||||
cfg.data=qs.stringify(cfg.data);
|
||||
}
|
||||
};
|
||||
//requestJson请求
|
||||
const requestJson = jsonRequest.request;
|
||||
const requestJson=jsonRequest.request;
|
||||
//get请求
|
||||
const get = formRequest.request;
|
||||
const get=formRequest.request;
|
||||
//post请求
|
||||
const post = function (url, data, config) {
|
||||
if (data) {
|
||||
data = qs.stringify(data);
|
||||
const post=function(url,data,config){
|
||||
if(data){
|
||||
data=qs.stringify(data);
|
||||
}
|
||||
return formRequest.post(url, data, config);
|
||||
return formRequest.post(url,data,config);
|
||||
}
|
||||
//postJson请求
|
||||
const postJson = jsonRequest.post;
|
||||
const postJson=jsonRequest.post;
|
||||
//put请求
|
||||
const put = function (url, data, config) {
|
||||
if (data) {
|
||||
data = qs.stringify(data);
|
||||
const put=function(url,data,config){
|
||||
if(data){
|
||||
data=qs.stringify(data);
|
||||
}
|
||||
return formRequest.put(url, data, config);
|
||||
return formRequest.put(url,data,config);
|
||||
}
|
||||
//putJson请求
|
||||
const putJson = jsonRequest.put;
|
||||
const putJson=jsonRequest.put;
|
||||
//patch请求
|
||||
const patch = function (url, data, config) {
|
||||
if (data) {
|
||||
data = qs.stringify(data);
|
||||
const patch=function(url,data,config){
|
||||
if(data){
|
||||
data=qs.stringify(data);
|
||||
}
|
||||
return formRequest.patch(url, data, config);
|
||||
return formRequest.patch(url,data,config);
|
||||
}
|
||||
//patchJson请求
|
||||
const patchJson = jsonRequest.patch;
|
||||
const patchJson=jsonRequest.patch;
|
||||
//delete请求
|
||||
const del = formRequest.delete;
|
||||
const del=formRequest.delete;
|
||||
|
||||
|
||||
export default {
|
||||
request,
|
||||
requestJson,
|
||||
get,
|
||||
post,
|
||||
postJson,
|
||||
put,
|
||||
putJson,
|
||||
patch,
|
||||
patchJson,
|
||||
del
|
||||
request,
|
||||
requestJson,
|
||||
get,
|
||||
post,
|
||||
postJson,
|
||||
put,
|
||||
putJson,
|
||||
patch,
|
||||
patchJson,
|
||||
del
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -102,6 +102,24 @@ const courseSearch=function(query){
|
||||
const detailStudy = function(courseId,aid) {
|
||||
return ajax.get(`/xboe/m/course/portal/detail-study?courseId=${courseId}&aid=${aid}`);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 课程学习进度的详细信息-分页
|
||||
* @param {Object} data
|
||||
*/
|
||||
const detailStudyPage = function(data) {
|
||||
return ajax.get(`/xboe/m/course/portal/detail-study-page?courseId=${data.courseId}&aid=${data.aid}&pageIndex=${data.pageIndex}&pageSize=${data.pageSize}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 资源学习情况列列表-分页
|
||||
* @param {Object} data
|
||||
*/
|
||||
const pageListResource=function(data){
|
||||
return ajax.post('/xboe/school/study/course/pagelist-resource',data);
|
||||
}
|
||||
|
||||
export default {
|
||||
list,
|
||||
pageList,
|
||||
@@ -112,5 +130,7 @@ export default {
|
||||
studyCounts,
|
||||
courseSearch,
|
||||
detailStudy,
|
||||
detailPost
|
||||
detailPost,
|
||||
detailStudyPage,
|
||||
pageListResource
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ const appendStudyTime = function(data) {
|
||||
* name: 学习人的姓名
|
||||
*/
|
||||
const studyRecords = function(data) {
|
||||
return ajax.post('/xboe/school/study/course/pagelist',data);
|
||||
return ajax.post('/xboe/school/study/course/pagelistEx',data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -189,7 +189,7 @@ const studyContentRecords = function(data) {
|
||||
}
|
||||
*/
|
||||
const studyExport = function(data) {
|
||||
return ajax.post('/xboe/school/study/course/export',data);
|
||||
return ajax.post('/xboe/school/study/course/export',data, { responseType: 'blob' });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -402,6 +402,31 @@ const findByIds=function (ids){
|
||||
return ajax.postJson('/xboe/school/study/es/list-by-ids',ids);
|
||||
}
|
||||
|
||||
const exportSignup=function (data){
|
||||
return ajax.post('/xboe/school/study/course/export-signup',data, { responseType: 'blob' });
|
||||
}
|
||||
|
||||
// 作业导出
|
||||
const exportHomework=function (data){
|
||||
return ajax.post('/xboe/school/study/course/contents-homework-export',data, { responseType: 'blob' });
|
||||
}
|
||||
|
||||
// 考试导出
|
||||
const exportExam=function (data){
|
||||
return ajax.post('/xboe/school/study/course/contents-exam-export',data, { responseType: 'blob' });
|
||||
}
|
||||
|
||||
// 评估类型资源
|
||||
const contentsAssess=function (data){
|
||||
return ajax.post('/xboe/school/study/course/contents-assess',data);
|
||||
}
|
||||
|
||||
// 考试类型资源
|
||||
const contentsExam=function (data){
|
||||
return ajax.post('/xboe/school/study/course/contents-exam',data);
|
||||
}
|
||||
|
||||
|
||||
export default {
|
||||
hasSignup,
|
||||
signup,
|
||||
@@ -438,5 +463,10 @@ export default {
|
||||
deleteSignUp,
|
||||
ids,
|
||||
followIds,
|
||||
studyIndexPost
|
||||
studyIndexPost,
|
||||
exportSignup,
|
||||
exportHomework,
|
||||
exportExam,
|
||||
contentsAssess,
|
||||
contentsExam
|
||||
}
|
||||
|
||||
234
src/components/Course/TopCourseSorter.vue
Normal file
234
src/components/Course/TopCourseSorter.vue
Normal file
@@ -0,0 +1,234 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
title="置顶排序"
|
||||
:visible.sync="dialogVisible"
|
||||
custom-class="g-dialog top-course-sorter-dialog"
|
||||
width="820px"
|
||||
:close-on-click-modal="false"
|
||||
@closed="handleClosed"
|
||||
append-to-body
|
||||
>
|
||||
<div class="top-course-sorter" v-loading="loading">
|
||||
<div class="top-course-sorter__table" v-if="topList.length">
|
||||
<div class="sorter-header">
|
||||
<div class="header-cell header-cell--handle"></div>
|
||||
<div class="header-cell header-cell--order">排序</div>
|
||||
<div class="header-cell header-cell--name">课程名称</div>
|
||||
<div class="header-cell header-cell--teacher">授课教师</div>
|
||||
</div>
|
||||
<div
|
||||
class="sorter-row"
|
||||
v-for="(item, index) in topList"
|
||||
:key="item.id"
|
||||
draggable="true"
|
||||
@dragstart="handleDragStart(index, $event)"
|
||||
@dragover.prevent
|
||||
@drop="handleDrop(index)"
|
||||
@dragend="handleDragEnd"
|
||||
:class="{ 'is-dragging': draggingIndex === index }"
|
||||
>
|
||||
<div class="row-cell row-cell--handle">
|
||||
<i class="el-icon-s-operation"></i>
|
||||
</div>
|
||||
<div class="row-cell row-cell--order">{{ index + 1 }}</div>
|
||||
<div class="row-cell row-cell--name" :title="item.name">{{ item.name }}</div>
|
||||
<div class="row-cell row-cell--teacher" :title="item.teacherName || '-'">
|
||||
{{ item.teacherName || '-' }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-empty v-else-if="!loading" description="暂无置顶课程"></el-empty>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" :disabled="!topList.length" :loading="saving" @click="handleSave">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import apiCourse from '@/api/modules/course.js';
|
||||
|
||||
export default {
|
||||
name: 'TopCourseSorter',
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
loading: false,
|
||||
saving: false,
|
||||
topList: [],
|
||||
draggingIndex: null,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
this.dialogVisible = true;
|
||||
this.fetchTopList();
|
||||
},
|
||||
async fetchTopList() {
|
||||
this.loading = true;
|
||||
try {
|
||||
const res = await apiCourse.fetchTopCourseList();
|
||||
if (res.status === 200) {
|
||||
this.topList = Array.isArray(res.result) ? [...res.result] : [];
|
||||
} else {
|
||||
this.$message.error(res.message || '获取置顶课程失败');
|
||||
this.topList = [];
|
||||
}
|
||||
} catch (error) {
|
||||
this.$message.error(error.message || '获取置顶课程失败');
|
||||
this.topList = [];
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
handleDragStart(index, event) {
|
||||
this.draggingIndex = index;
|
||||
if (event && event.dataTransfer) {
|
||||
event.dataTransfer.effectAllowed = 'move';
|
||||
event.dataTransfer.setData('text/plain', index);
|
||||
}
|
||||
},
|
||||
handleDrop(targetIndex) {
|
||||
if (this.draggingIndex === null || this.draggingIndex === targetIndex) {
|
||||
return;
|
||||
}
|
||||
const movingItem = this.topList.splice(this.draggingIndex, 1)[0];
|
||||
this.topList.splice(targetIndex, 0, movingItem);
|
||||
this.draggingIndex = targetIndex;
|
||||
},
|
||||
handleDragEnd() {
|
||||
this.draggingIndex = null;
|
||||
},
|
||||
async handleSave() {
|
||||
if (!this.topList.length) {
|
||||
this.$message.warning('暂无需要保存的排序');
|
||||
return;
|
||||
}
|
||||
const payload = this.topList.map((item, index) => ({
|
||||
id: item.id,
|
||||
sortWeight: index,
|
||||
}));
|
||||
this.saving = true;
|
||||
try {
|
||||
const res = await apiCourse.updateTopCourseSort(payload);
|
||||
if (res.status === 200) {
|
||||
this.$message.success('排序更新成功');
|
||||
this.$emit('sorted');
|
||||
this.dialogVisible = false;
|
||||
} else {
|
||||
throw new Error(res.message || '排序更新失败');
|
||||
}
|
||||
} catch (error) {
|
||||
this.$message.error(error.message || '排序更新失败');
|
||||
} finally {
|
||||
this.saving = false;
|
||||
}
|
||||
},
|
||||
handleClosed() {
|
||||
this.topList = [];
|
||||
this.draggingIndex = null;
|
||||
this.loading = false;
|
||||
this.saving = false;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.top-course-sorter {
|
||||
min-height: 200px;
|
||||
padding-top: 8px;
|
||||
}
|
||||
|
||||
.top-course-sorter__table {
|
||||
border: 1px solid #ebeef5;
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.sorter-header,
|
||||
.sorter-row {
|
||||
display: grid;
|
||||
grid-template-columns: 60px 80px 1fr 160px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.sorter-header {
|
||||
background-color: #f5f7fa;
|
||||
height: 48px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
}
|
||||
|
||||
.sorter-row {
|
||||
min-height: 56px;
|
||||
border-bottom: 1px solid #f2f6fc;
|
||||
cursor: move;
|
||||
transition: background-color 0.2s ease;
|
||||
}
|
||||
|
||||
.sorter-row:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.sorter-row:hover {
|
||||
background-color: #f9fbff;
|
||||
}
|
||||
|
||||
.sorter-row.is-dragging {
|
||||
opacity: 0.7;
|
||||
background-color: #ecf5ff;
|
||||
}
|
||||
|
||||
.header-cell,
|
||||
.row-cell {
|
||||
padding: 0 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.header-cell--handle,
|
||||
.row-cell--handle {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.header-cell--order,
|
||||
.row-cell--order {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.row-cell--name,
|
||||
.row-cell--teacher {
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.row-cell--name {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.row-cell--teacher {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.row-cell--handle i {
|
||||
font-size: 20px;
|
||||
color: #c0c4cc;
|
||||
}
|
||||
|
||||
.dialog-footer {
|
||||
text-align: right;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -897,7 +897,7 @@ export default {
|
||||
}
|
||||
|
||||
} else {
|
||||
//console.log(editData,'editData');
|
||||
console.log(editData,'editData');
|
||||
this.weikeReset = editData.id;
|
||||
this.onlineReset = editData.id;
|
||||
//console.log("编辑课程?");
|
||||
|
||||
@@ -414,6 +414,11 @@ export default {
|
||||
if(meta.title == '添加受众' || meta.title == '查看受众'){
|
||||
meta.activeMenu = '/manage/ugroups'
|
||||
}
|
||||
|
||||
if(route.path == '/course/coursemanage'){
|
||||
console.log('进入课程管理');
|
||||
meta.activeMenu = '/need/course'
|
||||
}
|
||||
if (meta.activeMenu) {
|
||||
return meta.activeMenu;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,8 @@ export const pages=[
|
||||
{title:'课程首页',path:'index',component:'course/Index',hidden:true},
|
||||
{title:'课程建设',path:'mylist',component:'course/TeacherList',hidden:true},
|
||||
{title:'课程管理',path:'manage',component:'course/ManageList',hidden:false},
|
||||
{title:'课程管理',path:'coursemanage',component:'course/CourseManage',hidden:true},
|
||||
{title:'课程管理新版',path:'manage-remote',component:'course/ManageListRemote',hidden:false},
|
||||
{title:'课程统计',path:'stat',component:'course/StatIndex',hidden:false},
|
||||
{title:'课件管理',path:'courseware',component:'course/Courseware',hidden:false},
|
||||
{title:'报名管理',path:'msignup',component:'study/ManageSignup',hidden:true},
|
||||
@@ -117,6 +119,7 @@ export const iframes=[
|
||||
{title:'嵌入测试', path:'/iframe/index',hidden:false,component:'portal/iframe'},
|
||||
{title:'课件管理', path:'/iframe/course/coursewares',hidden:false,component:'course/Courseware'},
|
||||
{title:'课程管理', path:'/iframe/course/manages',hidden:false,component:'course/ManageList'},
|
||||
{title:'课程管理新版', path:'/iframe/course/manage-remote',hidden:false,component:'course/ManageListRemote'},
|
||||
{title:'考试试题管理', path:'/iframe/exam/questions',hidden:false,component:'exam/Question'},
|
||||
{title:'查看答卷', path:'/iframe/exam/viewanswer',hidden:false,component:'exam/viewAnswer'},
|
||||
{title:'考试试卷管理', path:'/iframe/exam/papers',hidden:false,component:'exam/TestPaper'},
|
||||
|
||||
14
src/icons/svg/del.svg
Normal file
14
src/icons/svg/del.svg
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="11px" height="12px" viewBox="0 0 11 12" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>shanchu</title>
|
||||
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="icon" transform="translate(-436, -918)" fill="#FF1818" fill-rule="nonzero">
|
||||
<g id="shanchu" transform="translate(436, 918)">
|
||||
<path d="M10.4999537,3.19289906 L0.500046316,3.19289906 C0.223878361,3.19289906 0,2.97107081 0,2.6974318 C0,2.42379279 0.223878361,2.20196454 0.500046316,2.20196454 L10.4999537,2.20196454 C10.7761216,2.20196454 11,2.42379279 11,2.6974318 C11,2.97107081 10.7761216,3.19289906 10.4999537,3.19289906 Z" id="路径"></path>
|
||||
<path d="M8.27763883,12 L2.72210644,12 C1.83281125,11.9990263 1.11214015,11.2849546 1.11115743,10.4038029 L1.11115743,2.6974318 C1.11115743,2.42379279 1.33503579,2.20196454 1.61120374,2.20196454 C1.8873717,2.20196454 2.11125006,2.42379279 2.11125006,2.6974318 L2.11125006,10.4038029 C2.11125006,10.738359 2.38496787,11.0095703 2.7226159,11.0095703 L8.2781483,11.0095703 C8.61579634,11.0095703 8.88951415,10.738359 8.88951415,10.4038029 L8.88951415,2.6974318 C8.88951415,2.42379279 9.11339251,2.20196454 9.38956046,2.20196454 C9.66572842,2.20196454 9.88960678,2.42379279 9.88960678,2.6974318 L9.88960678,10.4038029 C9.88862317,11.2853484 9.16733192,11.9995828 8.27763883,12 Z M7.72206011,3.19289906 C7.4459504,3.1927598 7.22215435,2.9710131 7.22201381,2.6974318 L7.22201381,1.59619712 C7.22201381,1.43553761 7.15760223,1.2814583 7.04294889,1.16785488 C6.92829555,1.05425145 6.77279226,0.990429712 6.61064795,0.990429715 L4.3890973,0.990429715 C4.05144927,0.990429715 3.77773146,1.26164102 3.77773146,1.59619712 L3.77773146,2.6974318 C3.77773146,2.97107081 3.5538531,3.19289906 3.27768515,3.19289906 C3.00151719,3.19289906 2.77763883,2.97107081 2.77763883,2.6974318 L2.77763883,1.59619712 C2.77862156,0.715045435 3.49929265,0.000973720991 4.38858784,0 L6.6109027,0 C7.50019788,0.000973727448 8.22086897,0.71504544 8.2218517,1.59619712 L8.2218517,2.6974318 C8.22171131,2.97091464 7.99807034,3.19262061 7.72206011,3.19289906 L7.72206011,3.19289906 Z" id="形状"></path>
|
||||
<path d="M4.3890973,9.2475444 C4.11292935,9.2475444 3.88905099,9.02571608 3.88905099,8.75207707 L3.88905099,5.44938266 C3.88902352,5.27235111 3.9843258,5.10875556 4.13905195,5.02023193 C4.2937781,4.93170829 4.48441652,4.93170829 4.63914267,5.02023193 C4.79386882,5.10875556 4.8891711,5.27235111 4.88914369,5.44938266 L4.88914369,8.75207707 C4.88921124,8.88350369 4.83654966,9.00956666 4.74275812,9.10249932 C4.64896658,9.19543199 4.52173855,9.24761133 4.3890973,9.2475444 L4.3890973,9.2475444 Z" id="路径"></path>
|
||||
<path d="M6.61115743,9.24754433 C6.33498947,9.24754433 6.11111111,9.02571608 6.11111111,8.75207707 L6.11111111,5.44938266 C6.11111111,5.17574365 6.33498947,4.9539154 6.61115743,4.9539154 C6.88732538,4.9539154 7.11120374,5.17574365 7.11120374,5.44938266 L7.11120374,8.75207707 C7.11120374,9.02571608 6.88732538,9.24754433 6.61115743,9.24754433 L6.61115743,9.24754433 Z" id="路径"></path>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.2 KiB |
11
src/icons/svg/detail.svg
Normal file
11
src/icons/svg/detail.svg
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="12px" height="12px" viewBox="0 0 12 12" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>chakan</title>
|
||||
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="icon" transform="translate(-326, -920)" fill="#4284F7" fill-rule="nonzero">
|
||||
<g id="chakan" transform="translate(326, 920)">
|
||||
<path d="M8.94642857,0 C9.61213393,0 10.1517857,0.539651786 10.1517857,1.20535714 L10.1517857,3.16071429 L11.0625,3.16071429 C11.5750848,3.16071429 11.9915893,3.57208929 11.9998661,4.08270536 L12,4.09821429 L12,10.7946429 C12,11.453692 11.4710759,11.989192 10.8145714,11.9998393 L10.7946429,12 L1.20535714,12 C0.546308036,12 0.0108080357,11.4710759 0.000160714286,10.8145714 L0,10.7946429 L0,4.09821429 C0,3.58562946 0.411375,3.169125 0.921991071,3.16084821 L0.9375,3.16071429 L1.84821429,3.16071429 L1.84821429,1.20535714 C1.84821429,0.546308036 2.37713839,0.0108080357 3.03364286,0.000160714286 L3.05357143,0 L8.94642857,0 Z M11.1964286,8.83928571 L0.803571429,8.83928571 L0.803571429,10.7946429 C0.803571429,11.0143259 0.979875,11.1928259 1.19871429,11.196375 L1.20535714,11.1964286 L10.7946429,11.1964286 C11.0143259,11.1964286 11.1928259,11.020125 11.1964286,10.8012857 L11.1964286,10.7946429 L11.1964286,8.83928571 Z M1.84821429,3.96428571 L0.9375,3.96428571 C0.864776786,3.96428571 0.805607143,4.02223661 0.803625,4.09446429 L0.803571429,4.09821429 L0.803571429,8.03571429 L1.84821429,8.03571429 L1.84821429,3.96428571 Z M11.0625,3.96428571 L10.1517857,3.96428571 L10.1517857,8.03571429 L11.1964286,8.03571429 L11.1964286,4.09821429 C11.1964286,4.02549107 11.1384777,3.96632143 11.06625,3.96433929 L11.0625,3.96428571 Z M8.95307143,0.803571429 L3.05357143,0.803571429 C2.83166518,0.803571429 2.65178571,0.983450893 2.65178571,1.20535714 L2.65178571,8.03571429 L9.34821429,8.03571429 L9.34821429,1.20535714 C9.34821429,0.985674107 9.17191071,0.807174107 8.95307143,0.803571429 Z M5.69866071,1.47321429 C7.1595,1.47321429 8.34375,2.65746429 8.34375,4.11830357 C8.34375,4.70375893 8.15354464,5.24479018 7.83155357,5.68297768 L8.65222768,6.50366518 C8.80913839,6.6605625 8.80913839,6.91495982 8.65222768,7.07187054 C8.49531696,7.22878125 8.24093304,7.22878125 8.08402232,7.07187054 L7.26333482,6.25119643 C6.82513393,6.5731875 6.28411607,6.76339286 5.69866071,6.76339286 C4.23782143,6.76339286 3.05357143,5.57914286 3.05357143,4.11830357 C3.05357143,2.65746429 4.23782143,1.47321429 5.69866071,1.47321429 Z M5.69866071,2.27678571 C4.68160714,2.27678571 3.85714286,3.10125 3.85714286,4.11830357 C3.85714286,5.13535714 4.68160714,5.95982143 5.69866071,5.95982143 C6.71571429,5.95982143 7.54017857,5.13535714 7.54017857,4.11830357 C7.54017857,3.10125 6.71571429,2.27678571 5.69866071,2.27678571 Z" id="形状"></path>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.9 KiB |
9
src/icons/svg/edit.svg
Normal file
9
src/icons/svg/edit.svg
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="10px" height="10px" viewBox="0 0 10 10" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>形状</title>
|
||||
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" opacity="0.4">
|
||||
<g id="自定义考试_弹框2备份" transform="translate(-735, -435)" fill="#4284F7" fill-rule="nonzero">
|
||||
<path d="M743.186667,436.766237 L741.615,435.165652 C741.398056,434.944783 741.046389,434.944783 740.829444,435.165652 L735.929444,440.155811 L735.102778,442.682575 C735.03591,442.885968 735.087729,443.110381 735.236598,443.262109 C735.385467,443.413836 735.605784,443.466786 735.805556,443.398849 L738.286667,442.556406 L743.186667,437.566813 C743.403546,437.345876 743.403546,436.987739 743.186667,436.766803 L743.186667,436.766237 Z M742.402222,437.166808 L737.884444,441.768278 L736.107778,442.374791 L736.705556,440.567698 L741.223889,435.966793 L742.402222,437.166808 L742.402222,437.166808 Z M735,444.151333 L745,444.151333 L745,445 L735,445 L735,444.151333 Z" id="形状"></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
11
src/icons/svg/ercode.svg
Normal file
11
src/icons/svg/ercode.svg
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="12px" height="12px" viewBox="0 0 12 12" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>erweima</title>
|
||||
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="icon" transform="translate(-258, -919)" fill="#4284F7" fill-rule="nonzero">
|
||||
<g id="erweima" transform="translate(258, 919)">
|
||||
<path d="M4,6.66666667 L1.33333333,6.66666667 C0.6,6.66666667 0,7.26666667 0,8 L0,10.6666667 C0,11.4 0.6,12 1.33333333,12 L4,12 C4.73333333,12 5.33333333,11.4 5.33333333,10.6666667 L5.33333333,8 C5.33333333,7.26666667 4.73333333,6.66666667 4,6.66666667 Z M4.44444444,10.6666667 C4.44444444,10.9111111 4.24444444,11.1111111 4,11.1111111 L1.33333333,11.1111111 C1.08888889,11.1111111 0.888888889,10.9111111 0.888888889,10.6666667 L0.888888889,8 C0.888888889,7.75555556 1.08888889,7.55555556 1.33333333,7.55555556 L4,7.55555556 C4.24444444,7.55555556 4.44444444,7.75555556 4.44444444,8 L4.44444444,10.6666667 Z M4,0 L1.33333333,0 C0.6,0 0,0.6 0,1.33333333 L0,4 C0,4.73333333 0.6,5.33333333 1.33333333,5.33333333 L4,5.33333333 C4.73333333,5.33333333 5.33333333,4.73333333 5.33333333,4 L5.33333333,1.33333333 C5.33333333,0.6 4.73333333,0 4,0 Z M4.44444444,4 C4.44444444,4.24444444 4.24444444,4.44444444 4,4.44444444 L1.33333333,4.44444444 C1.08888889,4.44444444 0.888888889,4.24444444 0.888888889,4 L0.888888889,1.33333333 C0.888888889,1.08888889 1.08888889,0.888888889 1.33333333,0.888888889 L4,0.888888889 C4.24444444,0.888888889 4.44444444,1.08888889 4.44444444,1.33333333 L4.44444444,4 Z M11.3333333,6.66666667 C11.0888889,6.66666667 10.8888889,6.86666667 10.8888889,7.11111111 L10.8888889,11.5555556 C10.8888889,11.8 11.0888889,12 11.3333333,12 C11.5777778,12 11.7777778,11.8 11.7777778,11.5555556 L11.7777778,7.11111111 C11.7777778,6.86666667 11.5777778,6.66666667 11.3333333,6.66666667 Z M10.6666667,0 L8,0 C7.26666667,0 6.66666667,0.6 6.66666667,1.33333333 L6.66666667,4 C6.66666667,4.73333333 7.26666667,5.33333333 8,5.33333333 L10.6666667,5.33333333 C11.4,5.33333333 12,4.73333333 12,4 L12,1.33333333 C12,0.6 11.4,0 10.6666667,0 Z M11.1111111,4 C11.1111111,4.24444444 10.9111111,4.44444444 10.6666667,4.44444444 L8,4.44444444 C7.75555556,4.44444444 7.55555556,4.24444444 7.55555556,4 L7.55555556,1.33333333 C7.55555556,1.08888889 7.75555556,0.888888889 8,0.888888889 L10.6666667,0.888888889 C10.9111111,0.888888889 11.1111111,1.08888889 11.1111111,1.33333333 L11.1111111,4 Z M7.33333333,7.33333333 C7.08888889,7.33333333 6.88888889,7.53333333 6.88888889,7.77777778 L6.88888889,11.5555556 C6.88888889,11.8 7.08888889,12 7.33333333,12 C7.57777778,12 7.77777778,11.8 7.77777778,11.5555556 L7.77777778,7.77777778 C7.77777778,7.53333333 7.57777778,7.33333333 7.33333333,7.33333333 Z M9.33333333,8.66666667 C9.08888889,8.66666667 8.88888889,8.86666667 8.88888889,9.11111111 L8.88888889,11.5555556 C8.88888889,11.8 9.08888889,12 9.33333333,12 C9.57777778,12 9.77777778,11.8 9.77777778,11.5555556 L9.77777778,9.11111111 C9.77777778,8.86666667 9.57777778,8.66666667 9.33333333,8.66666667 Z" id="形状"></path>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.1 KiB |
11
src/icons/svg/manage.svg
Normal file
11
src/icons/svg/manage.svg
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="12px" height="12px" viewBox="0 0 12 12" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>guanli</title>
|
||||
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="icon" transform="translate(-124, -920)" fill="#4284F7" fill-rule="nonzero">
|
||||
<g id="guanli" transform="translate(124, 920)">
|
||||
<path d="M4.49064449,5.50676379 L0.997920994,5.50676379 C0.449064449,5.50676379 0,5.05723205 0,4.50780437 L0,1.01144641 C0,0.462018737 0.449064449,0.0124869995 0.997920994,0.0124869995 L4.49064449,0.0124869995 C5.03950104,0.0124869995 5.48856549,0.462018737 5.48856549,1.01144641 L5.48856549,4.50780437 C5.48856549,5.05723205 5.03950104,5.50676379 4.49064449,5.50676379 Z M4.5347973,4.50780437 L4.5347973,5.00728409 L4.5347973,4.50780437 Z M0.997920994,1.01144641 L0.997920994,4.50780437 L4.49064449,4.50780437 L4.49064449,1.01144641 L0.997920994,1.01144641 Z M9.00623701,6.0062435 C8.75675676,6.0062435 8.53222453,5.90634756 8.35758836,5.73152966 L6.28690229,3.65868887 C6.11226612,3.48387098 6.01247401,3.25910511 6.01247401,3.00936525 C6.01247401,2.75962539 6.11226611,2.53485953 6.28690229,2.36004162 L8.35758836,0.26222685 C8.70686072,-0.0874089499 9.30561332,-0.0874089499 9.65488566,0.26222685 L11.7255717,2.36004162 C11.9002079,2.53485952 12,2.75962539 12,3.00936525 C12,3.25910511 11.9002079,3.48387097 11.7255717,3.65868887 L9.65488566,5.73152966 C9.48024949,5.90634755 9.25571726,6.0062435 9.00623701,6.0062435 L9.00623701,6.0062435 Z M7.06029106,3.00936525 L9.03118504,4.98231009 L10.977131,3.00936525 L9.00623701,1.03642041 L7.06029106,3.00936525 Z M4.49064449,12 L0.997920994,12 C0.449064449,12 0,11.5504683 0,11.0010406 L0,7.50468262 C0,6.95525495 0.449064449,6.50572321 0.997920994,6.50572321 L4.49064449,6.50572321 C5.03950104,6.50572321 5.48856549,6.95525495 5.48856549,7.50468262 L5.48856549,11.0010406 C5.48856549,11.5504683 5.03950104,12 4.49064449,12 Z M4.5347973,11.0010406 L4.5347973,11.5005203 L4.5347973,11.0010406 Z M0.997920994,7.50468262 L0.997920994,11.0010406 L4.49064449,11.0010406 L4.49064449,7.50468262 L0.997920994,7.50468262 Z M11.002079,12 L7.50935551,12 C6.96049896,12 6.51143451,11.5504683 6.51143451,11.0010406 L6.51143451,7.50468262 C6.51143451,6.95525495 6.96049896,6.50572321 7.50935551,6.50572321 L11.002079,6.50572321 C11.5509356,6.50572321 12,6.95525495 12,7.50468262 L12,11.0010406 C12,11.5504683 11.5509356,12 11.002079,12 Z M11.0462318,11.0010406 L11.0462318,11.5005203 L11.0462318,11.0010406 Z M7.50935551,7.50468262 L7.50935551,11.0010406 L11.002079,11.0010406 L11.002079,7.50468262 L7.50935551,7.50468262 Z" id="形状"></path>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.7 KiB |
109
src/security.js
109
src/security.js
@@ -11,16 +11,16 @@ import xpage from '@/utils/xpage'
|
||||
|
||||
NProgress.configure({ showSpinner: false })
|
||||
|
||||
const whiteList = ['/login', '/logout', '/loading', '/pc/loading', '/500', '/auth-redirect', '/forget', '/reset/password']
|
||||
const whiteList = ['/login','/logout','/loading','/pc/loading','/500','/auth-redirect','/forget','/reset/password']
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
watermark.set("");
|
||||
//动态计算文件的路径
|
||||
let configPath = process.env.VUE_APP_FILE_RELATIVE_PATH;
|
||||
if (configPath.startsWith('http')) {
|
||||
xpage.constants.fileBaseUrl = configPath;
|
||||
} else {
|
||||
xpage.constants.fileBaseUrl = window.location.protocol + '//' + window.location.host + configPath;
|
||||
let configPath=process.env.VUE_APP_FILE_RELATIVE_PATH;
|
||||
if(configPath.startsWith('http')){
|
||||
xpage.constants.fileBaseUrl=configPath;
|
||||
}else{
|
||||
xpage.constants.fileBaseUrl=window.location.protocol+'//'+window.location.host+configPath;
|
||||
}
|
||||
|
||||
NProgress.start();
|
||||
@@ -28,71 +28,66 @@ router.beforeEach((to, from, next) => {
|
||||
if (whiteList.indexOf(to.path) !== -1) {
|
||||
// 在免登录白名单,直接进入
|
||||
next()
|
||||
} else {
|
||||
if (getToken()) {
|
||||
if (to.path === '/login') {
|
||||
}else{
|
||||
if(getToken()){
|
||||
if(to.path === '/login'){
|
||||
// 如果是外部用户,把配置的路由跳转到个人中心
|
||||
if (store.getters.userInfo.role === 2) {
|
||||
next({ path: process.env.VUE_APP_PUBLIC_PATH + '/uc/study/courses' })
|
||||
} else {
|
||||
next({ path: process.env.VUE_APP_PUBLIC_PATH + '/index' })
|
||||
if(store.getters.userInfo.role === 2){
|
||||
next({ path: process.env.VUE_APP_PUBLIC_PATH+'/uc/study/courses' })
|
||||
}else{
|
||||
next({ path: process.env.VUE_APP_PUBLIC_PATH+'/index' })
|
||||
}
|
||||
NProgress.done();
|
||||
} else {
|
||||
//console.log('store.getters.userInfo:',store.getters.userInfo.role)
|
||||
// 如果是外部用户,把配置的路由跳转到个人中心
|
||||
if (store.getters.userInfo.role === 2) {
|
||||
if (to.path === '/index' || to.path === '/course' || to.path === '/case' || to.path === '/article') location.href = '/pc/uc/study/task'
|
||||
if(store.getters.userInfo.role === 2){
|
||||
if(to.path === '/index' || to.path === '/course' || to.path === '/case' || to.path === '/article' ) location.href = '/pc/uc/study/task'
|
||||
}
|
||||
//后续这里需要增加一定的控制
|
||||
if (!store.getters.init) {
|
||||
sessionStorage.removeItem(xpage.constants.localCaseFiltersKey);
|
||||
sessionStorage.removeItem(xpage.constants.localCourseFiltersKey);
|
||||
// 判断当前控制台是否已拉取完数据
|
||||
store.dispatch('InitData').then(res => {
|
||||
//加载白名单信息
|
||||
//testUser.init();
|
||||
//加载信息资源归属,系统分类信息
|
||||
store.dispatch('resOwner/loadResOwners');
|
||||
store.dispatch('sysType/loadSysTypes');
|
||||
if (!store.getters.init) {
|
||||
sessionStorage.removeItem(xpage.constants.localCaseFiltersKey);
|
||||
sessionStorage.removeItem(xpage.constants.localCourseFiltersKey);
|
||||
// 判断当前控制台是否已拉取完数据
|
||||
store.dispatch('InitData').then(res => {
|
||||
//加载白名单信息
|
||||
//testUser.init();
|
||||
//加载信息资源归属,系统分类信息
|
||||
store.dispatch('resOwner/loadResOwners');
|
||||
store.dispatch('sysType/loadSysTypes');
|
||||
|
||||
store.commit('app/SET_INITDATA', true);
|
||||
//routers数据先使用固定的,以后在初始化接口中返回
|
||||
let myRouters = routers();
|
||||
store.dispatch('GenerateRoutes', { routers: myRouters }).then(accessRoutes => {
|
||||
router.addRoutes(accessRoutes) // 动态添加可访问路由表
|
||||
next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
|
||||
});
|
||||
store.commit('app/SET_INITDATA',true);
|
||||
//routers数据先使用固定的,以后在初始化接口中返回
|
||||
let myRouters=routers();
|
||||
store.dispatch('GenerateRoutes',{routers:myRouters}).then(accessRoutes=>{
|
||||
router.addRoutes(accessRoutes) // 动态添加可访问路由表
|
||||
next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
|
||||
});
|
||||
|
||||
}).catch(err => {
|
||||
console.log(err);
|
||||
store.commit('app/SET_INITDATA', false);
|
||||
//如果初始化错误,就不再执行了,不然会一直循环下去
|
||||
next({ path: '/500' })
|
||||
//NProgress.done();
|
||||
})
|
||||
} else {
|
||||
to.meta.keepAlive = true
|
||||
next();
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err);
|
||||
store.commit('app/SET_INITDATA',false);
|
||||
//如果初始化错误,就不再执行了,不然会一直循环下去
|
||||
next({ path: '/500' })
|
||||
//NProgress.done();
|
||||
})
|
||||
} else {
|
||||
to.meta.keepAlive = true
|
||||
next();
|
||||
}
|
||||
|
||||
}
|
||||
//next();
|
||||
} else {
|
||||
}else{
|
||||
|
||||
//next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
|
||||
//设置之前的路径
|
||||
//store.commit('portal/SetBackUrl',location.href);
|
||||
//console.log(location.href,'location.href');
|
||||
//let urlPre=window.location.protocol+'//'+window.location.host;
|
||||
//let backUrl=location.href.substring(urlPre.length); encodeURIComponent()
|
||||
if (top !== window) { // 判断当前是否在iframe内
|
||||
top.location.href = process.env.VUE_APP_LOGIN_URL + "?returnUrl=" + encodeURIComponent(location.href);
|
||||
} else {
|
||||
window.location.href = process.env.VUE_APP_LOGIN_URL + "?returnUrl=" + encodeURIComponent(location.href);
|
||||
}
|
||||
// location.href=process.env.VUE_APP_LOGIN_URL+"?returnUrl="+encodeURIComponent(location.href);
|
||||
NProgress.done()
|
||||
//next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
|
||||
//设置之前的路径
|
||||
//store.commit('portal/SetBackUrl',location.href);
|
||||
//console.log(location.href,'location.href');
|
||||
//let urlPre=window.location.protocol+'//'+window.location.host;
|
||||
//let backUrl=location.href.substring(urlPre.length); encodeURIComponent()
|
||||
location.href=process.env.VUE_APP_LOGIN_URL+"?returnUrl="+encodeURIComponent(location.href);
|
||||
NProgress.done()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,255 +19,215 @@ import errorCode from '@/utils/errorCode'
|
||||
|
||||
//const ReLoginUrl="/login";
|
||||
|
||||
const ReLoginUrl = process.env.VUE_APP_LOGIN_URL;
|
||||
const ReLoginUrl=process.env.VUE_APP_LOGIN_URL;
|
||||
|
||||
const TokenName = 'XBOE-Access-Token';
|
||||
const TokenName='XBOE-Access-Token';
|
||||
/**axios.defaults.headers['Content-Type'] = 'application/x-www-form-urlencoded'**/
|
||||
//只是用于发送json对象数据时使用post,put,patch
|
||||
const jsonRequest = axios.create({
|
||||
headers: { 'Content-Type': 'application/json;charset=utf-8' },
|
||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||
baseURL: process.env.VUE_APP_BASE_API,
|
||||
//超时
|
||||
timeout: 60000,
|
||||
const jsonRequest=axios.create({
|
||||
headers:{'Content-Type':'application/json;charset=utf-8'},
|
||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||
baseURL: process.env.VUE_APP_BASE_API,
|
||||
//超时
|
||||
timeout: 60000,
|
||||
});
|
||||
//发送json对象的拦截器
|
||||
jsonRequest.interceptors.request.use(config => {
|
||||
//是否需要设置 token
|
||||
const isToken = (config.headers || {}).isToken === false
|
||||
if (getToken() && !isToken) {
|
||||
config.headers[TokenName] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||
}
|
||||
return config
|
||||
//是否需要设置 token
|
||||
const isToken = (config.headers || {}).isToken === false
|
||||
if (getToken() && !isToken) {
|
||||
config.headers[TokenName] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||
}
|
||||
return config
|
||||
}, error => {
|
||||
console.log(error)
|
||||
Promise.reject(error)
|
||||
console.log(error)
|
||||
Promise.reject(error)
|
||||
})
|
||||
|
||||
// 响应拦截器
|
||||
jsonRequest.interceptors.response.use(res => {
|
||||
|
||||
const code = res.data.status || 200;
|
||||
if (code === 200) {
|
||||
return res.data
|
||||
} else {
|
||||
if (code == 6001) { //针对于老系统的处理
|
||||
store.dispatch('LogOut').then(() => {
|
||||
if (top !== window) { // 判断当前是否在iframe内
|
||||
top.location.href = ReLoginUrl;
|
||||
} else {
|
||||
window.location.href = ReLoginUrl;
|
||||
}
|
||||
// location.href = ReLoginUrl;
|
||||
})
|
||||
} else if (code === 401) {
|
||||
store.dispatch('LogOut').then(() => {
|
||||
if (top !== window) { // 判断当前是否在iframe内
|
||||
top.location.href = ReLoginUrl;
|
||||
} else {
|
||||
window.location.href = ReLoginUrl;
|
||||
}
|
||||
// location.href = ReLoginUrl;
|
||||
})
|
||||
} else if (code === 402) {
|
||||
store.dispatch('LogOut').then(() => {
|
||||
if (top !== window) { // 判断当前是否在iframe内
|
||||
top.location.href = ReLoginUrl;
|
||||
} else {
|
||||
window.location.href = ReLoginUrl;
|
||||
}
|
||||
// location.href = ReLoginUrl;
|
||||
})
|
||||
} else if (code === 403) {
|
||||
var msg = '当前操作没有权限';
|
||||
Message({ message: msg, type: 'error' });
|
||||
return Promise.reject(new Error(msg))
|
||||
//return res.data;
|
||||
} else if (code === 302) {
|
||||
if (top !== window) { // 判断当前是否在iframe内
|
||||
top.location.href = ReLoginUrl;
|
||||
} else {
|
||||
window.location.href = ReLoginUrl;
|
||||
const code = res.data.status || 200;
|
||||
if(code===200){
|
||||
return res.data
|
||||
}else{
|
||||
if(code == 6001){ //针对于老系统的处理
|
||||
store.dispatch('LogOut').then(() => {
|
||||
location.href = ReLoginUrl;
|
||||
})
|
||||
}else if(code === 401){
|
||||
store.dispatch('LogOut').then(() => {
|
||||
location.href = ReLoginUrl;
|
||||
})
|
||||
}else if(code === 402){
|
||||
store.dispatch('LogOut').then(() => {
|
||||
location.href = ReLoginUrl;
|
||||
})
|
||||
}else if(code===403){
|
||||
var msg='当前操作没有权限';
|
||||
Message({message: msg, type: 'error'});
|
||||
return Promise.reject(new Error(msg))
|
||||
//return res.data;
|
||||
}else if(code===302){
|
||||
location.href = ReLoginUrl;
|
||||
}else{
|
||||
//Message({message: res.data.message, type: 'error'});
|
||||
//console.log('err:' + res.data.error);
|
||||
//return Promise.reject(new Error(res.data.message))
|
||||
return res.data;
|
||||
}
|
||||
// location.href = ReLoginUrl;
|
||||
} else {
|
||||
//Message({message: res.data.message, type: 'error'});
|
||||
//console.log('err:' + res.data.error);
|
||||
//return Promise.reject(new Error(res.data.message))
|
||||
return res.data;
|
||||
}
|
||||
}
|
||||
},
|
||||
error => {
|
||||
console.log('err' + error)
|
||||
let { message } = error;
|
||||
if (message == "Network Error") {
|
||||
message = "网络异常,请稍后重试";
|
||||
}
|
||||
else if (message.includes("timeout")) {
|
||||
message = "系统接口请求超时";
|
||||
//location.href = this.webBaseUrl + ReLoginUrl;
|
||||
}
|
||||
else if (message.includes("Request failed with status code")) {
|
||||
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
||||
}
|
||||
Message({
|
||||
message: message,
|
||||
type: 'error',
|
||||
duration: 5 * 1000
|
||||
})
|
||||
return Promise.reject(error)
|
||||
}
|
||||
}
|
||||
},
|
||||
error => {
|
||||
console.log('err' + error)
|
||||
let { message } = error;
|
||||
if (message == "Network Error") {
|
||||
message = "网络异常,请稍后重试";
|
||||
}
|
||||
else if (message.includes("timeout")) {
|
||||
message = "系统接口请求超时";
|
||||
//location.href = this.webBaseUrl + ReLoginUrl;
|
||||
}
|
||||
else if (message.includes("Request failed with status code")) {
|
||||
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
||||
}
|
||||
Message({
|
||||
message: message,
|
||||
type: 'error',
|
||||
duration: 5 * 1000
|
||||
})
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
//用于普通的发送请求
|
||||
const formRequest = axios.create({
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||
baseURL: process.env.VUE_APP_BASE_API,
|
||||
//超时
|
||||
timeout: 10000,
|
||||
const formRequest=axios.create({
|
||||
headers:{'Content-Type':'application/x-www-form-urlencoded'},
|
||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||
baseURL: process.env.VUE_APP_BASE_API,
|
||||
//超时
|
||||
timeout: 10000,
|
||||
})
|
||||
//发送json对象的拦截器
|
||||
formRequest.interceptors.request.use(config => {
|
||||
//是否需要设置 token
|
||||
const isToken = (config.headers || {}).isToken === false
|
||||
if (getToken() && !isToken) {
|
||||
config.headers[TokenName] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||
}
|
||||
return config
|
||||
//是否需要设置 token
|
||||
const isToken = (config.headers || {}).isToken === false
|
||||
if (getToken() && !isToken) {
|
||||
config.headers[TokenName] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||
}
|
||||
return config
|
||||
}, error => {
|
||||
console.log(error)
|
||||
Promise.reject(error)
|
||||
console.log(error)
|
||||
Promise.reject(error)
|
||||
});
|
||||
formRequest.interceptors.response.use(res => {
|
||||
const code = res.data.status || 200;
|
||||
if (code === 200) {
|
||||
return res.data
|
||||
} else {
|
||||
if (code == 6001) { //针对于老系统的处理,因为老系统是字符串,所以这里不使用三等于号
|
||||
store.dispatch('LogOut').then(() => {
|
||||
if (top !== window) { // 判断当前是否在iframe内
|
||||
top.location.href = ReLoginUrl;
|
||||
} else {
|
||||
window.location.href = ReLoginUrl;
|
||||
}
|
||||
// location.href = ReLoginUrl;
|
||||
})
|
||||
} else if (code === 401) {
|
||||
store.dispatch('LogOut').then(() => {
|
||||
if (top !== window) { // 判断当前是否在iframe内
|
||||
top.location.href = ReLoginUrl;
|
||||
} else {
|
||||
window.location.href = ReLoginUrl;
|
||||
}
|
||||
// location.href = ReLoginUrl;
|
||||
})
|
||||
} else if (code === 402) {
|
||||
store.dispatch('LogOut').then(() => {
|
||||
if (top !== window) { // 判断当前是否在iframe内
|
||||
top.location.href = ReLoginUrl;
|
||||
} else {
|
||||
window.location.href = ReLoginUrl;
|
||||
}
|
||||
// location.href = ReLoginUrl;
|
||||
})
|
||||
} else if (code === 403) {
|
||||
var msg = '当前操作没有权限';
|
||||
Message({ message: msg, type: 'error' });
|
||||
return Promise.reject(new Error(msg))
|
||||
} else if (code === 302) {
|
||||
if (top !== window) { // 判断当前是否在iframe内
|
||||
top.location.href = ReLoginUrl;
|
||||
} else {
|
||||
window.location.href = ReLoginUrl;
|
||||
const code = res.data.status || 200;
|
||||
if(code===200){
|
||||
return res.data
|
||||
}else{
|
||||
if(code == 6001){ //针对于老系统的处理,因为老系统是字符串,所以这里不使用三等于号
|
||||
store.dispatch('LogOut').then(() => {
|
||||
location.href = ReLoginUrl;
|
||||
})
|
||||
}else if(code === 401){
|
||||
store.dispatch('LogOut').then(() => {
|
||||
location.href = ReLoginUrl;
|
||||
})
|
||||
}else if(code === 402){
|
||||
store.dispatch('LogOut').then(() => {
|
||||
location.href = ReLoginUrl;
|
||||
})
|
||||
}else if(code===403){
|
||||
var msg='当前操作没有权限';
|
||||
Message({message: msg, type: 'error'});
|
||||
return Promise.reject(new Error(msg))
|
||||
}else if(code===302){
|
||||
location.href = ReLoginUrl;
|
||||
}else{
|
||||
//Message({message: res.data.message, type: 'error'});
|
||||
//console.log('err' + res.data.error);
|
||||
//return Promise.reject(new Error(res.data.message))
|
||||
return res.data;//返回给用户做业务处理
|
||||
}
|
||||
// location.href = ReLoginUrl;
|
||||
} else {
|
||||
//Message({message: res.data.message, type: 'error'});
|
||||
//console.log('err' + res.data.error);
|
||||
//return Promise.reject(new Error(res.data.message))
|
||||
return res.data;//返回给用户做业务处理
|
||||
}
|
||||
}
|
||||
},
|
||||
error => {
|
||||
console.log('err' + error)
|
||||
let { message } = error;
|
||||
if (message == "Network Error") {
|
||||
message = "网络异常,请稍后重试";
|
||||
}
|
||||
else if (message.includes("timeout")) {
|
||||
message = "系统接口请求超时";
|
||||
//location.href = this.webBaseUrl + ReLoginUrl;
|
||||
}
|
||||
else if (message.includes("Request failed with status code")) {
|
||||
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
||||
}
|
||||
Message({
|
||||
message: message,
|
||||
type: 'error',
|
||||
duration: 5 * 1000
|
||||
})
|
||||
return Promise.reject(error)
|
||||
}
|
||||
}
|
||||
},
|
||||
error => {
|
||||
console.log('err' + error)
|
||||
let { message } = error;
|
||||
if (message == "Network Error") {
|
||||
message = "网络异常,请稍后重试";
|
||||
}
|
||||
else if (message.includes("timeout")) {
|
||||
message = "系统接口请求超时";
|
||||
//location.href = this.webBaseUrl + ReLoginUrl;
|
||||
}
|
||||
else if (message.includes("Request failed with status code")) {
|
||||
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
||||
}
|
||||
Message({
|
||||
message: message,
|
||||
type: 'error',
|
||||
duration: 5 * 1000
|
||||
})
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
//request请求
|
||||
const request = function (cfg) {
|
||||
if (cfg.data) {
|
||||
cfg.data = qs.stringify(cfg.data);
|
||||
const request=function(cfg){
|
||||
if(cfg.data){
|
||||
cfg.data=qs.stringify(cfg.data);
|
||||
}
|
||||
};
|
||||
//requestJson请求
|
||||
const requestJson = jsonRequest.request;
|
||||
const requestJson=jsonRequest.request;
|
||||
//get请求
|
||||
const get = formRequest.request;
|
||||
const get=formRequest.request;
|
||||
//post请求
|
||||
const post = function (url, data, config) {
|
||||
if (data) {
|
||||
data = qs.stringify(data);
|
||||
const post=function(url,data,config){
|
||||
if(data){
|
||||
data=qs.stringify(data);
|
||||
}
|
||||
return formRequest.post(url, data, config);
|
||||
return formRequest.post(url,data,config);
|
||||
}
|
||||
//post请求
|
||||
const postForm = function (url, data, config) {
|
||||
return formRequest.post(url, data, config);
|
||||
const postForm=function(url,data,config){
|
||||
return formRequest.post(url,data,config);
|
||||
}
|
||||
//postJson请求
|
||||
const postJson = jsonRequest.post;
|
||||
const postJson=jsonRequest.post;
|
||||
//put请求
|
||||
const put = function (url, data, config) {
|
||||
if (data) {
|
||||
data = qs.stringify(data);
|
||||
const put=function(url,data,config){
|
||||
if(data){
|
||||
data=qs.stringify(data);
|
||||
}
|
||||
return formRequest.put(url, data, config);
|
||||
return formRequest.put(url,data,config);
|
||||
}
|
||||
//putJson请求
|
||||
const putJson = jsonRequest.put;
|
||||
const putJson=jsonRequest.put;
|
||||
//patch请求
|
||||
const patch = function (url, data, config) {
|
||||
if (data) {
|
||||
data = qs.stringify(data);
|
||||
const patch=function(url,data,config){
|
||||
if(data){
|
||||
data=qs.stringify(data);
|
||||
}
|
||||
return formRequest.patch(url, data, config);
|
||||
return formRequest.patch(url,data,config);
|
||||
}
|
||||
//patchJson请求
|
||||
const patchJson = jsonRequest.patch;
|
||||
const patchJson=jsonRequest.patch;
|
||||
//delete请求
|
||||
const del = formRequest.delete;
|
||||
const del=formRequest.delete;
|
||||
|
||||
|
||||
export default {
|
||||
request,
|
||||
requestJson,
|
||||
get,
|
||||
post,
|
||||
postJson,
|
||||
put,
|
||||
putJson,
|
||||
patch,
|
||||
patchJson,
|
||||
del,
|
||||
postForm
|
||||
request,
|
||||
requestJson,
|
||||
get,
|
||||
post,
|
||||
postJson,
|
||||
put,
|
||||
putJson,
|
||||
patch,
|
||||
patchJson,
|
||||
del,
|
||||
postForm
|
||||
}
|
||||
|
||||
@@ -5,61 +5,56 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Cookies from "vue-cookies";
|
||||
import apiLogin from "@/api/login.js";
|
||||
import { getToken, setToken } from "@/utils/token";
|
||||
export default {
|
||||
mounted() {
|
||||
this.toUrl = this.$route.query.returnUrl;
|
||||
let token = getToken();
|
||||
let $this = this;
|
||||
if (!token) {
|
||||
//console.log(token,'未获取token');
|
||||
setTimeout(function () {
|
||||
$this.curToken = getToken();
|
||||
if (!$this.curToken) {
|
||||
//console.log(token,'第二次未获取token');
|
||||
if (top !== window) {
|
||||
// 判断当前是否在iframe内
|
||||
top.location.href = process.env.VUE_APP_LOGIN_URL;
|
||||
} else {
|
||||
window.location.href = process.env.VUE_APP_LOGIN_URL;
|
||||
import Cookies from 'vue-cookies'
|
||||
import apiLogin from '@/api/login.js'
|
||||
import { getToken,setToken } from '@/utils/token'
|
||||
export default{
|
||||
mounted(){
|
||||
this.toUrl=this.$route.query.returnUrl;
|
||||
let token=getToken();
|
||||
let $this=this;
|
||||
if(!token){
|
||||
//console.log(token,'未获取token');
|
||||
setTimeout(function(){
|
||||
$this.curToken=getToken();
|
||||
if(!$this.curToken){
|
||||
//console.log(token,'第二次未获取token');
|
||||
location.href = process.env.VUE_APP_LOGIN_URL;
|
||||
}else{
|
||||
$this.boeLogin();
|
||||
}
|
||||
// location.href = process.env.VUE_APP_LOGIN_URL;
|
||||
} else {
|
||||
$this.boeLogin();
|
||||
}
|
||||
}, 500);
|
||||
} else {
|
||||
this.curToken = token;
|
||||
this.boeLogin();
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
curToken: "",
|
||||
toUrl: "",
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
boeLogin() {
|
||||
apiLogin.boeLogin(this.curToken).then((rs) => {
|
||||
if (rs.status == 200) {
|
||||
//setToken(rs.result.access_token);
|
||||
localStorage.setItem(this.$xpage.constants.newLoginKey, 1);
|
||||
if (this.toUrl) {
|
||||
location.href = this.toUrl;
|
||||
} else {
|
||||
this.$router.push({ path: "/index" });
|
||||
}
|
||||
//this.$router.push({ path: "/index" })
|
||||
} else {
|
||||
this.$message.error("登录失败:" + rs.message);
|
||||
}
|
||||
});
|
||||
|
||||
},500);
|
||||
}else{
|
||||
this.curToken=token;
|
||||
this.boeLogin();
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
data(){
|
||||
return {
|
||||
curToken:'',
|
||||
toUrl:''
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
boeLogin(){
|
||||
apiLogin.boeLogin(this.curToken).then(rs=>{
|
||||
if(rs.status==200){
|
||||
//setToken(rs.result.access_token);
|
||||
localStorage.setItem(this.$xpage.constants.newLoginKey,1);
|
||||
if(this.toUrl){
|
||||
location.href=this.toUrl;
|
||||
}else{
|
||||
this.$router.push({ path: "/index" })
|
||||
}
|
||||
//this.$router.push({ path: "/index" })
|
||||
}else{
|
||||
this.$message.error("登录失败:"+rs.message);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
1109
src/views/course/CourseManage.vue
Normal file
1109
src/views/course/CourseManage.vue
Normal file
File diff suppressed because it is too large
Load Diff
1479
src/views/course/ManageListRemote.vue
Normal file
1479
src/views/course/ManageListRemote.vue
Normal file
File diff suppressed because it is too large
Load Diff
@@ -8,30 +8,38 @@
|
||||
</Remark> -->
|
||||
<div style="display: flex;justify-content:space-between;position: relative;">
|
||||
<div style="display: flex;justify-content: flex-start; padding: 12px 32px 10px 12px;">
|
||||
<!-- <div style="padding-left: 10px;">
|
||||
<el-select style="width: 120px;" v-model="params.type" clearable placeholder="课程类型">
|
||||
<el-option label="全部" :value="null"></el-option>
|
||||
<el-option label="微课" :value="10"></el-option>
|
||||
<el-option label="在线课" :value="20"></el-option>
|
||||
</el-select>
|
||||
</div> -->
|
||||
<div style="margin-left:10px"><el-input :maxlength="50" v-model="params.name" placeholder="课程名称" clearable></el-input></div>
|
||||
<div style="padding-left: 10px;">
|
||||
<el-select style="width: 120px;" v-model="params.status" clearable placeholder="状态">
|
||||
<el-option label="全部" :value="null"></el-option>
|
||||
<el-option label="草稿" :value="1"></el-option>
|
||||
<el-option label="待审核" :value="2"></el-option>
|
||||
<el-option label="已审核" :value="5"></el-option>
|
||||
<el-select style="width: 120px;" v-model="params.publish" clearable placeholder="发布状态">
|
||||
<!-- <el-option label="全部" :value="null"></el-option> -->
|
||||
<el-option label="未发布" :value="false"></el-option>
|
||||
<el-option label="已发布" :value="true"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div style="margin-left:10px"><el-input v-model="params.keyword" placeholder="名称关键字" clearable></el-input></div>
|
||||
<div style="padding-left: 10px;"><el-button type="primary" icon="el-icon-search" @click="findList()">搜索</el-button></div>
|
||||
<div style="padding: 0px 5px;"><el-button icon="el-icon-refresh-right" type="primary" @click="reset">重置</el-button></div>
|
||||
<div style="padding-left: 10px;">
|
||||
<el-select style="width: 120px;" v-model="params.enabled" clearable placeholder="启停用状态">
|
||||
<!-- <el-option label="全部" :value="null"></el-option> -->
|
||||
<el-option label="停用" :value="false"></el-option>
|
||||
<el-option label="启用" :value="true"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div style="padding-left: 10px;">
|
||||
<el-select style="width: 120px;" v-model="params.status" clearable placeholder="审核状态">
|
||||
<!-- <el-option label="全部" :value="null"></el-option> -->
|
||||
<!-- <el-option label="无审核状态" :value="1"></el-option> -->
|
||||
<el-option label="审核中" :value="2"></el-option>
|
||||
<el-option label="审核驳回" :value="3"></el-option>
|
||||
<el-option label="审核通过" :value="5"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div style="padding-left: 10px;"><el-button type="primary" icon="el-icon-search" @click="findList">查询</el-button></div>
|
||||
<div style="padding: 0px 5px;"><el-button icon="el-icon-refresh-right" @click="reset">重置</el-button></div>
|
||||
|
||||
<div class="Create-coures"><el-button type="primary" @click="addNewCourse()" icon="el-icon-plus">新建课程</el-button></div>
|
||||
</div>
|
||||
</div>
|
||||
<!--课程列表内容-->
|
||||
<div style="">
|
||||
<div v-infinite-scroll="load" style="overflow:auto;height:1000px" infinite-scroll-distance="50" :infinite-scroll-immediate="false" :infinite-scroll-disabled="disabled">
|
||||
<div class="uc-course" v-for="(item, idx) in couresList" :key="idx" @click="jumpRouter(item)">
|
||||
<div class="uc-course-img" style="width: 212px;height:119px">
|
||||
<course-image :course="item"></course-image>
|
||||
@@ -39,34 +47,27 @@
|
||||
</div>
|
||||
<div class="uc-course-info">
|
||||
<div class="uc-course-name">
|
||||
<!-- <span class="uc-course-type1">{{courseType(item.type)}}</span> -->
|
||||
<span v-if="item.type == 10" class="uc-course-type1">录播</span>
|
||||
<span v-if="item.type == 20" class="uc-course-type1">录播</span>
|
||||
<span class="caogao" v-if="item.status == 1">【草稿】</span>
|
||||
<span class="daishenhe" v-if="item.status == 2">【待审核】</span>
|
||||
<span class="weitongguo" v-if="item.status == 3">【审核未通过】</span>
|
||||
<span class="yishenhe" v-if="item.status == 5">【已审核】</span>
|
||||
<!-- <a :href="`${webBaseUrl}/course/detail?id=${item.id}`" target="_blank"> {{item.name}}</a> -->
|
||||
<span style="font-size:18px;color:#333">{{ item.name }}</span>
|
||||
<el-tooltip class="item" effect="dark" :content="item.name" placement="top-start">
|
||||
<span style="font-size:18px;color:#333">{{ item.name }}</span>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
<div class="summary-item">
|
||||
<div>{{ item.summary }}</div>
|
||||
</div>
|
||||
<div class="uc-course-text">
|
||||
<div class="uc-course-item">
|
||||
上次修改时间:{{ item.sysUpdateTime }}
|
||||
<span type="text" style="margin-left:10px;font-size:14px;cursor: pointer;color:#666" @click.stop="toExamine(item)">查看审核记录</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="uc-course-btns" style="line-height: 30px;">
|
||||
<el-link style="display:block" :underline="false" @click.stop="examine(item)" type="primary" v-if="item.status == 1" icon="el-icon-document-checked">提交审核</el-link>
|
||||
<el-link style="display:block" :underline="false" @click.stop="editCourse(item)" v-if="item.status == 3 || item.status == 4" type="primary" icon="el-icon-edit">编辑</el-link>
|
||||
<el-link style="display:block" :underline="false" @click.stop="editCourse(item)" v-if="item.status == 1" type="primary" icon="el-icon-edit">去开发</el-link>
|
||||
<el-link style="display:block" :underline="false" @click.stop="delItem(item)" v-if="item.status == 1" type="danger" icon="el-icon-delete">删除</el-link>
|
||||
<el-link style="display:block" :underline="false" @click.stop="withdraw(item)" v-if="item.status == 2" type="info" icon="el-icon-delete">撤回</el-link>
|
||||
<div class="uc-course-item">
|
||||
<div class="status-item">发布状态:{{ item.published ? '发布' : '未发布' }}</div>
|
||||
<div class="status-item">启停用状态:{{ item.enabled ? '启用' : '停用' }}</div>
|
||||
<div class="status-item">审核状态:<el-link :type="getStatusLabel(item.status).type" @click.stop="" :underline="false">{{getStatusLabel(item.status).label}}</el-link></div>
|
||||
</div>
|
||||
<div class="btn-container">
|
||||
<el-link class="btn-item" v-for="(it, idx) in availableActions(item)" :key="idx" :underline="false" type="primary" @click.stop="it.handler(item)"><svg-icon style="margin-right: 5px;font-size:19px;padding-top: 4px;" :icon-class="it.icon"></svg-icon>{{it.label}}</el-link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p v-if="loading" class="page-tip">加载中...</p>
|
||||
<p v-if="noMore" class="page-tip">没有更多了</p>
|
||||
</div>
|
||||
<div v-if="couresList.length > 0" style="text-align: center; margin-top:57px;">
|
||||
<!-- <div v-if="couresList.length > 0" style="text-align: center; margin-top:57px;">
|
||||
<el-pagination
|
||||
background
|
||||
@size-change="handleSizeChange"
|
||||
@@ -83,29 +84,62 @@
|
||||
<div v-if="isSearh" class="zan-wu">没有查询到相关内容</div>
|
||||
<div v-else class="zan-wu">暂无数据</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div></div>
|
||||
<el-dialog title="二维码" :visible.sync="qrCodedialogVisible" width="900px" @close="closeCode" custom-class="g-dialog">
|
||||
<div>
|
||||
<el-form size="medium" label-width="100px">
|
||||
<el-form-item label="二维码" >
|
||||
<div id="qrcode" ref="qrcode" class="qrcode-img" @mouseenter="showDownloadButton = true" @mouseleave="showDownloadButton = false">
|
||||
|
||||
<div v-show="showDownloadButton" @click="downloadQrcode" class="downloadn-container">
|
||||
<i class="el-icon-download" style="color: #409EFF;font-size:18px;margin-bottom:5px"></i>
|
||||
<span>下载</span>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="链接">
|
||||
<el-input v-model="copyUrl" readonly class="input-with-select" id="text">
|
||||
<el-button slot="append" @click="handleCopyUrl">复制</el-button>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="">上述内容兼容PC端与移动端,您可按需分享。</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer"><el-button @click="closeCode">关 闭</el-button></span>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
<!-- TODO 修改展示字段 -->
|
||||
<el-dialog title="审核记录" :visible.sync="dialogVisible" width="900px" custom-class="g-dialog">
|
||||
<div>
|
||||
<el-table max-height="500" border :data="inviteTeacher" style="width: 100%;">
|
||||
<el-table-column prop="sysCreateBy" label="姓名" width="180"></el-table-column>
|
||||
<el-table-column prop="type" label="审核状态">
|
||||
<el-table-column prop="type" label="审核类型">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.auditState ? '通过' : '不通过' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="type" label="审核状态">
|
||||
<template slot-scope="scope">
|
||||
{{ auditEnum[scope.row.status] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="auditUser" label="审核人"></el-table-column>
|
||||
<el-table-column prop="auditTime" label="审核结果"></el-table-column>
|
||||
<el-table-column prop="auditTime" label="审核时间"></el-table-column>
|
||||
<el-table-column prop="auditRemark" label="备注"></el-table-column>
|
||||
<el-table-column prop="auditRemark" label="审核意见"></el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer"><el-button @click="dialogVisible = false">取 消</el-button></span>
|
||||
<span slot="footer" class="dialog-footer"><el-button @click="dialogVisible = false">关 闭</el-button></span>
|
||||
</el-dialog>
|
||||
<course-form ref="courseForm" @submitSuccess="getList"></course-form>
|
||||
<course-form ref="courseForm" @submitSuccess="getNewList"></course-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import QRCode from 'qrcodejs2';
|
||||
import courseImage from '@/components/Course/courseImage.vue';
|
||||
import { mapGetters } from 'vuex';
|
||||
import studyItem from '@/components/Course/studyItem.vue';
|
||||
@@ -116,11 +150,53 @@ import apiAudit from '@/api/system/audit.js';
|
||||
import apiHRBP from '@/api/boe/HRBP.js';
|
||||
import apiOrg from '@/api/system/organiza.js';
|
||||
import apiUserBasic from '@/api/boe/userbasic.js';
|
||||
|
||||
// 状态权限映射
|
||||
const STATUS_PERMISSIONS = {
|
||||
// 未发布状态
|
||||
unpublished: {
|
||||
1: ['edit', 'delete'], // 无审核状态
|
||||
2: ['auditRecord'], // 审核中'withdraw'
|
||||
3: ['edit', 'delete', 'auditRecord'] // 审核驳回
|
||||
},
|
||||
// 已发布状态
|
||||
published: {
|
||||
enabled: {
|
||||
1: ['edit', 'manage', 'auditRecord', 'qrcode'], //'offShelfApply', 'viewCurrent'
|
||||
2: ['manage', 'auditRecord', 'qrcode'], // withdraw , 'viewCurrent'
|
||||
3: ['edit', 'manage', 'auditRecord', 'qrcode'], //'offShelfApply', 'viewCurrent'
|
||||
5: ['edit', 'manage', 'auditRecord', 'qrcode'] //'offShelfApply', 'viewCurrent'
|
||||
},
|
||||
disabled: {
|
||||
// 所有状态在停用时操作一致
|
||||
1: ['manage', 'auditRecord'], //, 'viewCurrent'
|
||||
2: ['manage', 'auditRecord'], //, 'viewCurrent'
|
||||
3: ['manage', 'auditRecord'], //, 'viewCurrent'
|
||||
5: ['manage', 'auditRecord'] //, 'viewCurrent'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 操作配置映射表
|
||||
const ACTION_CONFIG = {
|
||||
edit: { label: '编辑', handler: 'editCourse', icon: 'edit' },
|
||||
manage: { label: '管理', handler: 'handleManage', icon: 'manage' },
|
||||
// withdraw: { label: '撤回', handler: 'handleWithdraw' },
|
||||
auditRecord: { label: '审核记录', handler: 'toExamine', icon: 'edit' },
|
||||
qrcode: { label: '二维码', handler: 'handleQrcode', icon: 'ercode' },
|
||||
// offShelfApply: { label: '下架申请', handler: 'handleOffShelfApply' },
|
||||
// viewCurrent: { label: '查看当前版本', handler: 'handleViewCurrent', icon: 'detail' },
|
||||
delete: { label: '删除', handler: 'delItem', icon: 'del' },
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'ucStudyIndex',
|
||||
components: { studyItem, courseForm, courseImage },
|
||||
computed: {
|
||||
...mapGetters(['userInfo'])
|
||||
...mapGetters(['userInfo']),
|
||||
disabled() {
|
||||
return this.loading || this.noMore;
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
@@ -130,17 +206,28 @@ export default {
|
||||
courseType: courseType,
|
||||
fileBaseUrl: process.env.VUE_APP_FILE_BASE_URL,
|
||||
count: 0,
|
||||
params: { keyword: '', type: '', status: '', createUser: '', pageIndex: 1, pageSize: 10, sysCreateAid: '' },
|
||||
params: { name: '', publish: '', status: '', enabled: '', pageIndex: 0, pageSize: 10 },
|
||||
couresList: [],
|
||||
flag: true,
|
||||
isSearh:false,
|
||||
qrCodedialogVisible: false,
|
||||
copyUrl: '',
|
||||
qrcodeImgUrl: '',
|
||||
showDownloadButton: false, // 是否显示下载按钮
|
||||
loading: false,
|
||||
noMore: false,
|
||||
auditEnum: {
|
||||
1: '未审核',
|
||||
2: '审核不通过',
|
||||
9: '审核通过'
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
if(this.$route.query && this.$route.query.open && this.$route.query.open == 'new') {
|
||||
this.addNewCourse();
|
||||
}
|
||||
this.getList();
|
||||
// this.getList();
|
||||
},
|
||||
watch:{
|
||||
// '$route.query.open':function(val){
|
||||
@@ -150,6 +237,126 @@ export default {
|
||||
// }
|
||||
},
|
||||
methods: {
|
||||
load() {
|
||||
this.loading = true
|
||||
this.params.pageIndex++
|
||||
this.getList()
|
||||
},
|
||||
|
||||
getNewList() {
|
||||
this.couresList = [];
|
||||
this.params.pageIndex = 1;
|
||||
this.getList();
|
||||
},
|
||||
getStatusLabel(code) {
|
||||
if (code == '1') {
|
||||
return {type:'info',label:'-'}
|
||||
} else if (code == '2') {
|
||||
return {type:'warning',label:'审核中'}
|
||||
} else if (code == '3') {
|
||||
return {type:'danger',label:'审核驳回'}
|
||||
} else if (code == '5') {
|
||||
return {type:'success',label:'审核通过'}
|
||||
}
|
||||
},
|
||||
// 获取可用的操作配置
|
||||
availableActions(item) {
|
||||
debugger
|
||||
const { status, published, enabled } = item
|
||||
let actionKeys = []
|
||||
|
||||
if (!published) {
|
||||
// 未发布状态
|
||||
actionKeys = STATUS_PERMISSIONS.unpublished[status] || []
|
||||
} else {
|
||||
// 已发布状态
|
||||
const stateKey = enabled ? 'enabled' : 'disabled'
|
||||
actionKeys = STATUS_PERMISSIONS.published[stateKey][status] || []
|
||||
}
|
||||
|
||||
return actionKeys.map(key => ({
|
||||
name: key,
|
||||
label: ACTION_CONFIG[key].label,
|
||||
handler: this[ACTION_CONFIG[key].handler],
|
||||
icon: ACTION_CONFIG[key].icon
|
||||
})).filter(Boolean)
|
||||
},
|
||||
handleManage(item) {
|
||||
sessionStorage.setItem('courseDetail',JSON.stringify(item));
|
||||
this.$router.push({ path: '/course/coursemanage' });
|
||||
},
|
||||
downloadQrcode() {
|
||||
let img = document.getElementById("qrcode").getElementsByTagName("img")[0];
|
||||
let canvas = document.createElement("canvas");
|
||||
canvas.width = img.width;
|
||||
canvas.height = img.height;
|
||||
let ctx = canvas.getContext("2d");
|
||||
ctx.drawImage(img, 0, 0);
|
||||
let tempUrl = canvas.toDataURL("image/png");
|
||||
// 创建a标签下载
|
||||
|
||||
let link = document.createElement('a'); //创建a标签
|
||||
link.style.display = 'none'; //使其隐藏
|
||||
link.download = tempUrl;
|
||||
link.setAttribute('target', '_blank');
|
||||
link.href = tempUrl; //赋予文件下载地址
|
||||
link.setAttribute('download', '二维码.jpg'); //设置下载属性 以及文件名
|
||||
document.body.appendChild(link); //a标签插至页面中
|
||||
link.click(); //强制触发a标签事件
|
||||
document.body.removeChild(link);
|
||||
},
|
||||
handleCopyUrl() {
|
||||
document.getElementById("text").select()
|
||||
document.execCommand("Copy")
|
||||
this.$message.success("复制成功")
|
||||
},
|
||||
|
||||
handleQrcode(row) {
|
||||
this.qrCodedialogVisible = true;
|
||||
let urlPre=window.location.protocol+'//'+window.location.host;
|
||||
|
||||
//动态的地址
|
||||
//urlPre=urlPre+'/m?returnUrl='+urlPre+'/mobile/pages/login/loading?returnUrl=';
|
||||
//固定的地址
|
||||
// let returnUrl=urlPre+'/mobile/pages/login/loading?returnUrl=/pages/study/courseStudy?id='+row.id;
|
||||
// let mobilePre=urlPre+'/m?returnUrl=';
|
||||
// this.qrcodeImgUrl = mobilePre+encodeURIComponent(returnUrl);
|
||||
// this.copyUrl=urlPre+this.webBaseUrl+'/course/studyindex?id='+row.id;
|
||||
// if(row.type==20){
|
||||
// this.copyUrl=urlPre+this.webBaseUrl+'/course/detail?id='+row.id;
|
||||
// }
|
||||
this.copyUrl = this.qrcodeImgUrl = process.env.VUE_APP_BOE_WEB_URL + '/systemapi/xboe/m/course/manage/redirectDetail?courseId=' + row.id
|
||||
console.log('qrcodeImgUrl', this.qrcodeImgUrl)
|
||||
console.log('webBaseUrl', this.webBaseUrl)
|
||||
// 使用$nextTick确保数据渲染
|
||||
this.$nextTick(() => {
|
||||
this.crateQrcode();
|
||||
});
|
||||
|
||||
},
|
||||
// 生成二维码
|
||||
crateQrcode() {
|
||||
let qrcode = new QRCode('qrcode', {
|
||||
width: 150,
|
||||
height: 150, // 高度
|
||||
text: this.qrcodeImgUrl // 二维码内容
|
||||
// render: 'canvas' // 设置渲染方式(有两种方式 table和canvas,默认是canvas)
|
||||
// background: '#f0f'
|
||||
// foreground: '#ff0'
|
||||
});
|
||||
console.log('qrcode', qrcode)
|
||||
},
|
||||
// 关闭弹框,清除已经生成的二维码
|
||||
closeCode() {
|
||||
this.qrCodedialogVisible = false
|
||||
|
||||
// 逐个节点移除防止事件一起移除
|
||||
let images = document.querySelectorAll('.qrcode-img img');
|
||||
images.forEach(img => img.remove());
|
||||
|
||||
let canvas = document.querySelectorAll('.qrcode-img canvas');
|
||||
canvas.forEach(canvas => canvas.remove());
|
||||
},
|
||||
// 撤回接口
|
||||
withdraw(item) {
|
||||
this.$confirm('此操作将撤回审核中的课程, 是否继续?', '提示', {
|
||||
@@ -165,7 +372,7 @@ export default {
|
||||
type: 'success',
|
||||
message: '撤回成功!'
|
||||
});
|
||||
this.getList();
|
||||
this.getNewList();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -178,17 +385,20 @@ export default {
|
||||
});
|
||||
},
|
||||
reset() {
|
||||
this.params.keyword = '';
|
||||
this.params.status = '';
|
||||
this.params.type = '';
|
||||
this.params.name = ''
|
||||
this.params.publish = ''
|
||||
this.params.status = ''
|
||||
this.params.enabled = ''
|
||||
this.params.pageIndex = 1;
|
||||
this.getList();
|
||||
this.isSearh = false;
|
||||
// this.getList();
|
||||
this.isSearh = false;
|
||||
},
|
||||
toExamine(row) {
|
||||
// this.detailType = row.type;
|
||||
this.dialogVisible = true;
|
||||
apiAudit.page(1, row.id).then(res => {
|
||||
apiCourse.auditCourseRecords({
|
||||
courseId: row.id
|
||||
}).then(res => {
|
||||
if (res.status === 200) {
|
||||
this.inviteTeacher = res.result;
|
||||
} else {
|
||||
@@ -271,7 +481,8 @@ export default {
|
||||
})
|
||||
},
|
||||
delItem(row) {
|
||||
this.$confirm('您确定要删除所选课程吗?', '删除提示', {
|
||||
console.log('delItem', row);
|
||||
this.$confirm(`确认删除${row.name}吗?`, '删除提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
@@ -303,7 +514,9 @@ export default {
|
||||
// this.$store.dispatch("userTrigger", event);
|
||||
// }
|
||||
|
||||
this.getList();
|
||||
this.getNewList();
|
||||
} else {
|
||||
this.$message.success('操作失败!');
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
@@ -339,36 +552,30 @@ export default {
|
||||
}
|
||||
},
|
||||
findList() {
|
||||
this.params.pageIndex = 1;
|
||||
this.isSearh = true;
|
||||
this.getList();
|
||||
this.getNewList();
|
||||
},
|
||||
getList() {
|
||||
this.params.aid = this.userInfo.aid;
|
||||
apiCourse.pageList(this.params).then(res => {
|
||||
this.params.teacherId = this.userInfo.aid;
|
||||
apiCourse.courseList(this.params).then(res => {
|
||||
this.loading = false;
|
||||
if (res.status == 200) {
|
||||
this.couresList = res.result.list;
|
||||
this.couresList = [...this.couresList, ...res.result.list];
|
||||
|
||||
this.count = res.result.count;
|
||||
if (this.couresList.length >= this.count){
|
||||
this.noMore = true;
|
||||
}
|
||||
} else {
|
||||
this.$message.error(res.message);
|
||||
}
|
||||
});
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.params.pageSize = val;
|
||||
// this.params.pageIndex = 1;
|
||||
|
||||
|
||||
this.getList();
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.params.pageIndex = val;
|
||||
this.getList();
|
||||
},
|
||||
addNewCourse() {
|
||||
this.$refs.courseForm.initShow();
|
||||
},
|
||||
editCourse(row) {
|
||||
console.log(row, 'editCourse');
|
||||
this.$refs.courseForm.initShow(row);
|
||||
},
|
||||
lastTabChange(tab, event) {
|
||||
@@ -379,6 +586,11 @@ export default {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.page-tip {
|
||||
margin: 20px auto;
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
}
|
||||
.list-wu{
|
||||
text-align: center;
|
||||
margin: 40px;
|
||||
@@ -422,6 +634,35 @@ export default {
|
||||
margin-top: 10px;
|
||||
margin-right: 40px;
|
||||
}
|
||||
.qrcode-img {
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
display: block;
|
||||
position: relative;
|
||||
.downloadn-container {
|
||||
position: absolute;
|
||||
width: 40px;
|
||||
height: 45px;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
z-index: 99;
|
||||
background: white;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
|
||||
cursor: pointer;
|
||||
span {
|
||||
color: #409EFF;
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
line-height: 12px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.uc-course {
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
@@ -466,9 +707,25 @@ export default {
|
||||
word-break:break-all;
|
||||
// font-weight: 700;
|
||||
}
|
||||
.uc-course-text {
|
||||
.uc-course-item {
|
||||
color: #666;
|
||||
margin-top: 28px;
|
||||
// margin-top: 4px;
|
||||
font-size: 14px;
|
||||
display: flex;
|
||||
// flex-wrap: nowrap;
|
||||
.status-item {
|
||||
margin-right: 20px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.btn-container {
|
||||
margin-top: 10px;
|
||||
display: flex;
|
||||
.btn-item {
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
.uc-course-btns {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div id="couser-list-content" class="couser-list-content">
|
||||
<div class="course-banner">
|
||||
<portal-header current="course" textColor="#fff" :keywords="keyword" @emitInput="emitInput"
|
||||
@showClass="showClass"></portal-header>
|
||||
@showClass="showClass"></portal-header>
|
||||
</div>
|
||||
<div style="padding-top:30px">
|
||||
<div class="xcontent2">
|
||||
@@ -11,7 +11,7 @@
|
||||
<span v-if="navTitle.length">></span>
|
||||
<template v-if="navTitle.length">
|
||||
<div class="oneTitle" v-for="(item, index) in navTitle" :key="item.id"
|
||||
@click="handleOptionClick(item, index)">
|
||||
@click="handleOptionClick(item, index)">
|
||||
<span class="titleName"> {{ item.name }} </span>
|
||||
<span v-if="index !== navTitle.length - 1">></span>
|
||||
</div>
|
||||
@@ -39,25 +39,28 @@
|
||||
:class="{ courseTwoActive: twoList.id == twoId || twoList.checked }" @mouseleave.stop="leaveIndex"
|
||||
@mouseenter.stop="changeIndex(twoList.id)">
|
||||
<!-- 三级分类 -->
|
||||
<el-popover class="popover" popper-class='coursePopperClass' placement="right-start" width="536"
|
||||
:disabled="!twoList.children.length" :open-delay="0" :close-delay="0" trigger="hover"
|
||||
:visible-arrow="false" @hide="leaveIndex" @show="changeIndex(twoList.id)" transition="none">
|
||||
<div class="course-two-content" slot="reference">{{
|
||||
twoList.name }}</div>-
|
||||
<!-- 内容 -->
|
||||
<div class="course-three-box">
|
||||
<div class="course-three-box-title">
|
||||
{{ twoList.name }}
|
||||
</div>
|
||||
<div style="padding: 0 40px;display: flex;flex-wrap: wrap;">
|
||||
<div :class="threeList.checked ? 'threeActive' : ''" v-for="threeList in twoList.children"
|
||||
:key="threeList.id" @click.stop="handleOptionClick(threeList, 3, twoList.children)"
|
||||
class="course-three">
|
||||
<span>{{ threeList.name }}</span>
|
||||
<el-menu>
|
||||
<el-submenu :index="String(twoIndex)" v-if="twoList.children && twoList.children.length > 0">
|
||||
<template slot="title">
|
||||
<div class="course-two-content">
|
||||
{{ twoList.name }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-popover>
|
||||
</template>
|
||||
<el-menu-item-group>
|
||||
<div style="padding: 0 40px;display: flex;flex-wrap: wrap;">
|
||||
<div :class="threeList.checked ? 'threeActive' : ''" v-for="threeList in twoList.children"
|
||||
:key="threeList.id" @click.stop="handleOptionClick(threeList, 3, twoList.children)"
|
||||
class="course-three">
|
||||
<span>{{ threeList.name }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</el-menu-item-group>
|
||||
</el-submenu>
|
||||
<el-menu-item :index="String(twoIndex)" v-else>
|
||||
<div slot="title" class="course-two-content"> {{ twoList.name }}</div>
|
||||
</el-menu-item>
|
||||
</el-menu>
|
||||
<!-- </el-popover> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -459,6 +462,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
menuActiveIndex: '-1', //无默认选中
|
||||
hotTagsList: [],
|
||||
newData: false,//线上品牌系列隐藏
|
||||
navTitle: [],
|
||||
@@ -1657,6 +1661,38 @@ export default {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
|
||||
.course-three-box-title{
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
height: 68px;
|
||||
line-height: 80px;
|
||||
background: linear-gradient(180deg, rgba(78,166,255,0.2) 0%,
|
||||
rgba(78,166,255,0) 100%);padding-left: 40px;
|
||||
}
|
||||
.course-three{
|
||||
border-radius: 6px;
|
||||
border: 1px solid #C7CBD2;display: inline-block;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
padding: 0 10px;
|
||||
margin-right: 20px;
|
||||
margin-bottom: 10px;
|
||||
cursor: pointer;
|
||||
color: rgb(48, 49, 51);
|
||||
|
||||
&:hover{
|
||||
color: #387DF7;
|
||||
border: 1px solid #387DF7 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.threeActive{
|
||||
color: #387DF7;
|
||||
border: 1px solid #387DF7 !important;
|
||||
}
|
||||
|
||||
.couser-list-content {
|
||||
min-height: 110%;
|
||||
}
|
||||
@@ -1717,10 +1753,29 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 三级列表
|
||||
.course-list {
|
||||
background-color: #fff;
|
||||
|
||||
::v-deep .el-submenu__title, .el-menu-item {
|
||||
height: 38px;
|
||||
padding: 0 5px!important;
|
||||
}
|
||||
|
||||
|
||||
::v-deep .el-menu-item.is-active {
|
||||
background-color: inherit;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
::v-deep .el-submenu__title {
|
||||
background-color: inherit;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
|
||||
.course-one {
|
||||
position: relative;
|
||||
|
||||
@@ -1734,7 +1789,7 @@ export default {
|
||||
|
||||
// 二级的高亮
|
||||
.courseTwoActive {
|
||||
color: #387DF7;
|
||||
color: #387DF7 !important;
|
||||
border-image: linear-gradient(90deg, rgba(47, 101, 236, 1), rgba(228, 236, 255, 1)) 1 1 !important;
|
||||
}
|
||||
|
||||
|
||||
@@ -123,13 +123,20 @@
|
||||
<div>
|
||||
<div class="course-interact">
|
||||
<div class="score" style="display: flex;">
|
||||
<div v-if="!scoreInfo.has" style="margin-left:10px;cursor: pointer;padding-top:18px">
|
||||
<div v-if="!scoreInfo.has" style="margin-left:10px;cursor: pointer;padding-top:10px;display: flex;align-items: center;">
|
||||
<!-- <el-popover placement="top" width="300" trigger="hover"> -->
|
||||
<!-- <div style="text-align:center;line-height:50px;padding:20px 0px">
|
||||
|
||||
<div style="padding-top:30px"><el-button @click="addScore">提交评分</el-button></div>
|
||||
</div> -->
|
||||
<el-rate v-model="scoreInfo.score" @change="addScore"></el-rate>
|
||||
<p style="margin-right:10px">告诉我们您的喜欢程度</p>
|
||||
<el-rate v-model="scoreInfo.score" @change="showConfirmScore" :allow-half="true"></el-rate>
|
||||
<div v-if="isShowScoreConfirm">
|
||||
<span class="score-text">{{ toScore(scoreInfo.score) }}</span>
|
||||
<span style="font-size: 18px;">分</span>
|
||||
<el-button style="margin-left:10px" type="primary" size="mini" @click="addScore" >确定</el-button>
|
||||
<el-button size="mini" @click="handleCancelScore">取消</el-button>
|
||||
</div>
|
||||
<!-- <el-tag class="ref-score" slot="reference">去评分</el-tag> -->
|
||||
<!-- </el-popover> -->
|
||||
</div>
|
||||
@@ -188,7 +195,7 @@
|
||||
class="el-menu-vertical-demo"
|
||||
@open="handleOpen"
|
||||
@close="handleClose">
|
||||
<el-submenu :index="item.section.id">
|
||||
<el-submenu :index="item.section.id" v-if="catalogTree.length > 1">
|
||||
<template slot="title">
|
||||
<div style="display: flex;justify-content: space-between;">
|
||||
<div style="width: 240px;font-weight: 700;font-size: 16px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;" :title="item.section.name">{{item.section.name}}</div>
|
||||
@@ -215,6 +222,27 @@
|
||||
</div>
|
||||
</el-menu-item-group>
|
||||
</el-submenu>
|
||||
<div v-else>
|
||||
<el-menu-item-group v-for="(ele, i) in item.children" :key="i">
|
||||
<div class="units-info" :class="{'units-active':contentData.id == ele.id}" @click="showRes(ele,i,index,item)">
|
||||
<el-menu-item :index="ele.id" style="padding: 0;padding-left: 10px;">
|
||||
<div style="display: flex;justify-content: space-between;">
|
||||
<div style="width: 200px;font-size: 16px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;" :title="ele.contentName">{{i+1}}. {{ ele.contentName }}</div>
|
||||
<div>
|
||||
<span v-if="contentData.id == ele.id" style="color: #387DF7;font-size: 14px;margin-right: 4px;">学习中</span>
|
||||
<!-- <img v-if="contentData.id == ele.id" :src="`${webBaseUrl}/images/playicon.png`" alt=""> -->
|
||||
<img v-if="contentData.id == ele.id && ele.status == 9" style="width: 16px;height: 16px;" src="@/assets/images/over.png" alt="">
|
||||
<img v-if="contentData.id == ele.id && ele.status == 0" style="width: 16px;height: 16px;" src="@/assets/images/nowNot.png" alt="">
|
||||
<img v-if="contentData.id == ele.id && (ele.status != 9&&ele.status != 0)" style="width: 16px;height: 16px;" src="@/assets/images/ban1.png" alt="">
|
||||
<img v-if="contentData.id != ele.id && ele.status == 9" style="width: 16px;height: 16px;" src="@/assets/images/notNew.png" alt="">
|
||||
<img v-if="contentData.id != ele.id && ele.status == 0" style="width: 16px;height: 16px;" src="@/assets/images/not.png" alt="">
|
||||
<img v-if="contentData.id != ele.id && (ele.status != 9&&ele.status != 0)" style="width: 16px;height: 16px;" src="@/assets/images/newBan.png" alt="">
|
||||
</div>
|
||||
</div>
|
||||
</el-menu-item>
|
||||
</div>
|
||||
</el-menu-item-group>
|
||||
</div>
|
||||
</el-menu>
|
||||
</div>
|
||||
<!-- <div v-for="(item, index) in catalogTree" :key="index" :name="index">
|
||||
@@ -390,6 +418,7 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isShowScoreConfirm: false,
|
||||
protocolDialogVisible: false,
|
||||
tentative: false,
|
||||
isContentTypeTwo: null,
|
||||
@@ -533,6 +562,13 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleCancelScore() {
|
||||
this.isShowScoreConfirm = false;
|
||||
this.scoreInfo.score = 5
|
||||
},
|
||||
showConfirmScore() {
|
||||
this.isShowScoreConfirm = true;
|
||||
},
|
||||
handleOpen(key,path){
|
||||
if(this.isFalse){
|
||||
this.defaultOpeneds = [key]
|
||||
|
||||
Reference in New Issue
Block a user