mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-mobile.git
synced 2025-12-07 01:46:44 +08:00
提交移动端的修改
This commit is contained in:
@@ -55,6 +55,11 @@ const modifyPassword = function(data) {
|
|||||||
return ajax.postJson('/user/resetPassword',data);
|
return ajax.postJson('/user/resetPassword',data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**获取加入的受众的id集合*/
|
||||||
|
const getInAudienceIds = function() {
|
||||||
|
return ajax.post(baseURL,'/audience/audienceByUser',{});
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
userParentOrg,
|
userParentOrg,
|
||||||
findOrgsByKeyword,
|
findOrgsByKeyword,
|
||||||
@@ -63,5 +68,6 @@ export default {
|
|||||||
getUserInfoById,
|
getUserInfoById,
|
||||||
getUserCrowds,
|
getUserCrowds,
|
||||||
getOrgHrbpInfo,
|
getOrgHrbpInfo,
|
||||||
modifyPassword
|
modifyPassword,
|
||||||
|
getInAudienceIds
|
||||||
}
|
}
|
||||||
|
|||||||
27
api/manage/manage.js
Normal file
27
api/manage/manage.js
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
/** 管理端接口 **/
|
||||||
|
import ajax from '../unionAjax.js';
|
||||||
|
const baseURL ="/manageApi";
|
||||||
|
|
||||||
|
/**用户的待办任务数量*/
|
||||||
|
const getTaskNum = function(){
|
||||||
|
return ajax.get(baseURL+'/todoTask/queryTodoTaskCounts');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**用户的待办任务数量
|
||||||
|
{
|
||||||
|
"pageNo":1,
|
||||||
|
"pageSize":10,
|
||||||
|
"cmtask_name":"",任务名称
|
||||||
|
"cmtask_code":"",任务Id
|
||||||
|
"cmtask_status":"",状态
|
||||||
|
"cmtask_id":"965341999643234304" 学员id,当前人的
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
const userTaskList = function(data){
|
||||||
|
return ajax.postJson(baseURL+'/todoTask/queryTodoTaskDetail',data);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
getTaskNum,
|
||||||
|
userTaskList
|
||||||
|
}
|
||||||
170
api/unionAjax.js
Normal file
170
api/unionAjax.js
Normal file
@@ -0,0 +1,170 @@
|
|||||||
|
import config from '@/config/index.js'
|
||||||
|
import {getToken,removeToken} from '@/utils/token.js'
|
||||||
|
import qs from 'qs'
|
||||||
|
|
||||||
|
const ReLoginUrl="/login";
|
||||||
|
|
||||||
|
const formatUrl=function(url){
|
||||||
|
return url;
|
||||||
|
// if(url.startsWith('http') || url.startsWith('https')){
|
||||||
|
// //console.log(url,"我拿到的url值,我想知道下面有啥方法")
|
||||||
|
// return url;
|
||||||
|
// }else{
|
||||||
|
// return config.oldApiBaseUrl+url
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
const formRequest=function(method,url,data){
|
||||||
|
let token=getToken();
|
||||||
|
if(!token){
|
||||||
|
token='';
|
||||||
|
}
|
||||||
|
let headers={
|
||||||
|
'content-type':'application/x-www-form-urlencoded',
|
||||||
|
'token':token
|
||||||
|
}
|
||||||
|
let reUrl=formatUrl(url);
|
||||||
|
return new Promise(function(resolve, reject){
|
||||||
|
uni.request({
|
||||||
|
url: reUrl,
|
||||||
|
method,
|
||||||
|
data: data,
|
||||||
|
xhrFields: {withCredentials: true},
|
||||||
|
dataType: 'json',
|
||||||
|
header: headers,
|
||||||
|
success:function(rs,statusCode){
|
||||||
|
if(rs.statusCode==200){
|
||||||
|
if(rs.data.status==6001){
|
||||||
|
//uni.removeStorageSync('userInfo');
|
||||||
|
removeToken();
|
||||||
|
let loginPath=config.loginPath;
|
||||||
|
if(loginPath.startsWith('http')){
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
plus.runtime.openURL(loginPath) //这里默认使用外部浏览器打开而不是内部web-view组件打开
|
||||||
|
// #endif
|
||||||
|
// #ifdef H5
|
||||||
|
//window.open(loginPath)
|
||||||
|
let returnUrl=window.location.protocol+'//'+window.location.host+config.context;
|
||||||
|
location.href=config.loginPath+"?returnUrl="+encodeURIComponent(returnUrl+'/pages/login/loading');
|
||||||
|
// #endif
|
||||||
|
}else{
|
||||||
|
uni.redirectTo({
|
||||||
|
url:loginPath
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
resolve(rs.data);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
reject("API请求错误");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail:function(err){
|
||||||
|
reject(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
const jsonRequest=function(method,url,data){
|
||||||
|
let token=getToken();
|
||||||
|
if(!token){
|
||||||
|
token='';
|
||||||
|
}
|
||||||
|
let headers={
|
||||||
|
'token':token
|
||||||
|
}
|
||||||
|
let reUrl=formatUrl(url);
|
||||||
|
return new Promise(function(resolve, reject){
|
||||||
|
uni.request({
|
||||||
|
url: reUrl,
|
||||||
|
method,
|
||||||
|
data: data,
|
||||||
|
xhrFields: {withCredentials: true},
|
||||||
|
dataType: 'json',
|
||||||
|
header: headers,
|
||||||
|
success:function(rs,statusCode){
|
||||||
|
if(rs.statusCode==200){
|
||||||
|
if(rs.data.status==6001){
|
||||||
|
removeToken();
|
||||||
|
let loginPath=config.loginPath;
|
||||||
|
if(loginPath.startsWith('http')){
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
plus.runtime.openURL(loginPath) //这里默认使用外部浏览器打开而不是内部web-view组件打开
|
||||||
|
// #endif
|
||||||
|
// #ifdef H5
|
||||||
|
//window.open(loginPath)
|
||||||
|
let returnUrl=window.location.protocol+'//'+window.location.host+config.context;
|
||||||
|
location.href=config.loginPath+"?returnUrl="+encodeURIComponent(returnUrl+'/pages/login/loading');
|
||||||
|
// #endif
|
||||||
|
}else{
|
||||||
|
uni.redirectTo({
|
||||||
|
url:loginPath
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
resolve(rs.data);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
reject("API请求错误");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail:function(err){
|
||||||
|
reject(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//get请求
|
||||||
|
const get=function(url){
|
||||||
|
return formRequest('GET',url,'');
|
||||||
|
}
|
||||||
|
//post请求
|
||||||
|
const post=function(url,data){
|
||||||
|
if(data){
|
||||||
|
data=qs.stringify(data);
|
||||||
|
}
|
||||||
|
return formRequest('POST',url,data);
|
||||||
|
}
|
||||||
|
//postJson请求
|
||||||
|
const postJson=function(url,json){
|
||||||
|
return jsonRequest('POST',url,json);
|
||||||
|
}
|
||||||
|
//put请求
|
||||||
|
const put=function(url,data){
|
||||||
|
if(data){
|
||||||
|
data=qs.stringify(data);
|
||||||
|
}
|
||||||
|
return formRequest('PUT',url,data);
|
||||||
|
}
|
||||||
|
//putJson请求
|
||||||
|
const putJson=function(url,json){
|
||||||
|
return jsonRequest('PUT',url,json);
|
||||||
|
}
|
||||||
|
//patch请求
|
||||||
|
const patch=function(url,data){
|
||||||
|
if(data){
|
||||||
|
data=qs.stringify(data);
|
||||||
|
}
|
||||||
|
return formRequest('PATCH',url,data);
|
||||||
|
}
|
||||||
|
//patchJson请求
|
||||||
|
const patchJson=function(url,json){
|
||||||
|
return jsonRequest('PATCH',url,json);
|
||||||
|
}
|
||||||
|
//delete请求
|
||||||
|
const del=function(url,data){
|
||||||
|
if(data){
|
||||||
|
data=qs.stringify(data);
|
||||||
|
}
|
||||||
|
return formRequest('DELETE',url,data);
|
||||||
|
}
|
||||||
|
export default {
|
||||||
|
get,
|
||||||
|
post,
|
||||||
|
postJson,
|
||||||
|
put,
|
||||||
|
putJson,
|
||||||
|
patch,
|
||||||
|
patchJson,
|
||||||
|
del
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
/**系统的一些全局配置变量*/
|
/**系统的一些全局配置变量*/
|
||||||
let apiBaseUrl = '';
|
let apiBaseUrl = '';
|
||||||
let oldApiBaseUrl ='/uboeApi';
|
let oldApiBaseUrl ='/uboeApi';
|
||||||
|
let manageApiBaseUrl ='/manageApi';
|
||||||
let statApiBaseUrl='/statApi';
|
let statApiBaseUrl='/statApi';
|
||||||
let socialApiBaseUrl='/socialApi';
|
let socialApiBaseUrl='/socialApi';
|
||||||
let loginPath='/pages/login/login';
|
let loginPath='/pages/login/login';
|
||||||
@@ -53,6 +54,7 @@ if(process.env.NODE_ENV === 'development'){
|
|||||||
export default {
|
export default {
|
||||||
apiBaseUrl:apiBaseUrl,
|
apiBaseUrl:apiBaseUrl,
|
||||||
oldApiBaseUrl:oldApiBaseUrl,
|
oldApiBaseUrl:oldApiBaseUrl,
|
||||||
|
manageApiBaseUrl:manageApiBaseUrl,
|
||||||
statApiBaseUrl:statApiBaseUrl,
|
statApiBaseUrl:statApiBaseUrl,
|
||||||
socialApiBaseUrl:socialApiBaseUrl,
|
socialApiBaseUrl:socialApiBaseUrl,
|
||||||
context:context,
|
context:context,
|
||||||
|
|||||||
@@ -74,7 +74,7 @@
|
|||||||
"https" : false,
|
"https" : false,
|
||||||
"proxy" : {
|
"proxy" : {
|
||||||
"/systemapi" : {
|
"/systemapi" : {
|
||||||
"target" : "http://192.168.0.11:9090",
|
"target" : "http://127.0.0.1:9090",
|
||||||
"changeOrigin" : true,
|
"changeOrigin" : true,
|
||||||
"secure" : false,
|
"secure" : false,
|
||||||
"pathRewrite" : {
|
"pathRewrite" : {
|
||||||
@@ -91,7 +91,7 @@
|
|||||||
},
|
},
|
||||||
"/statApi" : {
|
"/statApi" : {
|
||||||
// 目标代理服务器地址
|
// 目标代理服务器地址
|
||||||
"target" : "http://192.168.0.11:9080",
|
"target" : "http://127.0.0.1:9080",
|
||||||
"changeOrigin" : true,
|
"changeOrigin" : true,
|
||||||
"logLevel" : "debug",
|
"logLevel" : "debug",
|
||||||
"secure" : false,
|
"secure" : false,
|
||||||
@@ -101,7 +101,7 @@
|
|||||||
},
|
},
|
||||||
"/socialApi" : {
|
"/socialApi" : {
|
||||||
// 目标代理服务器地址
|
// 目标代理服务器地址
|
||||||
"target" : "http://192.168.0.11:9081",
|
"target" : "http://127.0.0.1:9081",
|
||||||
"changeOrigin" : true,
|
"changeOrigin" : true,
|
||||||
"logLevel" : "debug",
|
"logLevel" : "debug",
|
||||||
"secure" : false,
|
"secure" : false,
|
||||||
|
|||||||
@@ -84,7 +84,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<div v-if="curContent.contentType == 50" style="min-height: 500px;">
|
<div v-if="curContent.contentType == 50" style="min-height: 500px;">
|
||||||
<!--因为web-view 动态切换地址不好用,所以这里先使用iframe-->
|
<!--因为web-view 动态切换地址不好用,所以这里先使用iframe-->
|
||||||
<iframe v-if="scormUrl" :src="scormUrl" frameborder="0" scrolling="no" border="0px" style="width:100%;height:500px;border:0px;"></iframe>
|
<iframe id="iframe-scorm" v-if="scormUrl" :src="scormUrl" onload="iframeScormLoad()" frameborder="0" scrolling="no" border="0px" style="width:100%;min-height:500px;border:0px;"></iframe>
|
||||||
</div>
|
</div>
|
||||||
<view v-if="curContent.contentType==52">
|
<view v-if="curContent.contentType==52">
|
||||||
<!--外连接-->
|
<!--外连接-->
|
||||||
@@ -577,6 +577,18 @@
|
|||||||
window.clearTimeout(this.handleTimeout);
|
window.clearTimeout(this.handleTimeout);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
iframeScormLoad(){
|
||||||
|
setTimeout(function(){
|
||||||
|
var scormIframe=document.getElementById('iframe-scorm');
|
||||||
|
if (scormIframe) {
|
||||||
|
var iframeWin = scormIframe.contentWindow || scormIframe.contentDocument.parentWindow;
|
||||||
|
if (iframeWin.document.body) {
|
||||||
|
scormIframe.height = iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},500);
|
||||||
|
|
||||||
|
},
|
||||||
loadMyScore(){
|
loadMyScore(){
|
||||||
apiCourseGrade.score({courseId:this.courseId}).then(rs=>{
|
apiCourseGrade.score({courseId:this.courseId}).then(rs=>{
|
||||||
if(rs.status==200){
|
if(rs.status==200){
|
||||||
|
|||||||
Reference in New Issue
Block a user