From ed553c5175566890b35781099e7a7fe115d2c65f Mon Sep 17 00:00:00 2001 From: zhaofang <752743406@qq.com> Date: Wed, 2 Nov 2022 12:01:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/phase2/guestbook.js | 70 +++++++++++++ api/phase2/guide.js | 31 ++++++ api/phase2/index.js | 49 ++++++++++ api/phase2/note.js | 205 +++++++++++++++++++++++++++++++++++++++ api/phase2/place.js | 28 ++++++ api/phase2/stat.js | 177 +++++++++++++++++++++++++++++++++ api/phase2/userfollow.js | 102 +++++++++++++++++++ api/phase2/userhobby.js | 60 ++++++++++++ manifest.json | 26 ++++- 9 files changed, 745 insertions(+), 3 deletions(-) create mode 100644 api/phase2/guestbook.js create mode 100644 api/phase2/guide.js create mode 100644 api/phase2/index.js create mode 100644 api/phase2/note.js create mode 100644 api/phase2/place.js create mode 100644 api/phase2/stat.js create mode 100644 api/phase2/userfollow.js create mode 100644 api/phase2/userhobby.js diff --git a/api/phase2/guestbook.js b/api/phase2/guestbook.js new file mode 100644 index 0000000..6b256a9 --- /dev/null +++ b/api/phase2/guestbook.js @@ -0,0 +1,70 @@ +// import ajax from '@/utils/xajax.js' +import ajax from '../ajax'; +const baseURL = process.env.VUE_APP_CESOURCE_BASE_API; + + +/** + * 保存或者编辑留言 + * @param{ + * content,留言内容 + * aid 要留言的人的id + * + * } + * */ +const save=function (data){ + return ajax.postJson(baseURL,'/xboe/subgroup/m/guest/save',data); +} + +/** + * 删除留言 + * */ +const del=function (id){ + return ajax.get(baseURL,'/xboe/subgroup/m/guest/delete?id='+id); +} + +/** + * 回复或者删除留言 + * @param{ + * id + * reply 回复内容 + * } + * */ +const answer=function (data){ + return ajax.post(baseURL,'/xboe/subgroup/m/guest/answer',data); +} + +/** + * 给我的留言 + * @param{ + * pageIndex + * pageSize + * aid + * } + * */ +const givelist=function (query){ + return ajax.post(baseURL,'/xboe/subgroup/m/guest/givelist',query); +} + +/** + * 我的留言 + * @param{ + * pageIndex + * pageSize + * aid + * } + * */ +const mylist=function (query){ + return ajax.post(baseURL,'/xboe/subgroup/m/guest/mylist',query); +} + +export default { + save, + answer, + del, + givelist, + mylist +} + + + + diff --git a/api/phase2/guide.js b/api/phase2/guide.js new file mode 100644 index 0000000..3950510 --- /dev/null +++ b/api/phase2/guide.js @@ -0,0 +1,31 @@ +// import ajax from '@/utils/xajax.js' +import ajax from '../ajax'; +const baseURL = process.env.VUE_APP_CESOURCE_BASE_API; + + +/** + * 显示提取,一次性 + * */ +const list=function (){ + return ajax.get(baseURL,'/xboe/subgroup/m/guide/list'); +} + +/** + * 保存或编辑 + * */ +const save=function (data){ + return ajax.postJson(baseURL,'/xboe/subgroup/m/guide/save',data); +} + +/** + * 判断当前用户是否登录过 + * */ +const hasUser=function (){ + return ajax.get(baseURL,'/xboe/subgroup/m/guide/hasUser'); +} + +export default { + list, + save, + hasUser +} diff --git a/api/phase2/index.js b/api/phase2/index.js new file mode 100644 index 0000000..c22ebb3 --- /dev/null +++ b/api/phase2/index.js @@ -0,0 +1,49 @@ +import ajax from '@/utils/xajax.js' + + +/** + * 首页推荐案例 + * @param type 2最热 1最新 + * */ +const cases=function (type){ + return ajax.get('/xboe/portal/index/cases?type='+type); +} + +/** + * 首页文章排行榜 + * @param num 条数 不传默认5条 + * */ +const articleViews=function (num){ + return ajax.get('/xboe/portal/index/article-views?num='+num); +} + +/** + * 首页问答排行榜 + * @param num 条数 不传默认5条 + * */ +const qaAnswers=function (num){ + return ajax.get('/xboe/portal/index/qa-answers?num='+num); +} + +/** + * 1最新 2最热 + * */ +const articlelist=function (type){ + return ajax.get('/xboe/portal/index/articlelist?type='+type); +} + +/** + * 首页课程排行榜 + * 参数和原接口一样,只需要换接口名称就可以 + * */ +const courselist=function (data){ + return ajax.post('/xboe/portal/index/courselist',data); +} + +export default { + cases, + articleViews, + qaAnswers, + articlelist, + courselist +} diff --git a/api/phase2/note.js b/api/phase2/note.js new file mode 100644 index 0000000..c561256 --- /dev/null +++ b/api/phase2/note.js @@ -0,0 +1,205 @@ +// import ajax from '@/utils/xajax.js' +// import ajax from '../cesource/index.js'; +import axios from 'axios' +import { getToken } from '@/utils/token' +import ajax from '../ajax'; +const baseURL = process.env.VUE_APP_CESOURCE_BASE_API; + + +/** + * 添加或者编辑 + * @param 参数见设计文档 + * */ +const save=function (data){ + return ajax.postJson(baseURL,'/xboe/subgroup/m/noteinfo/save',data); +} + +/** + * 添加或者编辑 + * @param 参数见设计文档 + * */ +const update=function (data){ + return ajax.postJson(baseURL,'/xboe/subgroup/m/noteinfo/update',data); +} + +/** + * 详情 + * */ +const detail=function (id){ + return ajax.get(baseURL,'/xboe/subgroup/m/noteinfo/detail?id='+id); +} + +/** + * 删除笔记 + * */ +const del=function (id){ + return ajax.get(baseURL,'/xboe/subgroup/m/noteinfo/delete?id='+id); +} + +/** + * 查询课程笔记 + * @param{ + * pageIndex + * pageSize + * courseId 课程id + * openType 公开类型 + * } + * */ +const coursePage=function (query){ + return ajax.post(baseURL,'/xboe/subgroup/m/noteinfo/course-page',query); +} + +/** + * 查询我的指定课程笔记 + * */ +const myCourse=function (courseId){ + return ajax.get(baseURL,'/xboe/subgroup/m/noteinfo/mycourse?courseId='+courseId); +} + +/** + * 查询笔记的修改历史 + * */ +const history=function (noteId){ + return ajax.get(baseURL,'/xboe/subgroup/m/noteinfo/modify/history?noteId='+noteId); +} + + +/** + * 我的笔记 + * type 我发布的是1 我导入的是2 + * orderType 升序降序 + * orderField排序字段 + * courseId 课程id + * */ +const query=function (data){ + return ajax.post(baseURL,'/xboe/subgroup/m/noteinfo/query',data); +} + +/** + * 课程列表 应该是当前用户记过笔记的课程 + * */ +const course=function (){ + return ajax.get(baseURL,'/xboe/subgroup/m/noteinfo/course'); +} +/** + * 还原 + * 笔记id + * */ +const restore=function (id){ + return ajax.get(baseURL,'/xboe/subgroup/m/noteinfo/restore?id='+id); +} + +/** + * 二次查询 + * @param{ + * ids + * } + * */ +const ids=function (data){ + return ajax.postJson(baseURL,'/xboe/subgroup/m/noteinfo/ids',data); +} + +/** + * 导出excel + * @param { + * ids ["",""] + * } + * */ +const exportExcel=function (data){ + return ajax.postJsonToFile(baseURL,'/xboe/subgroup/m/noteinfo/exportExcel',data); + // return ajax.post(baseURL,'/xboe/subgroup/m/noteinfo/exportExcel',data); +} + +/** + * 导出excel预览 + * @param { + * ids ["",""] + * } + * */ +const exportExcelPre=function (data){ + return ajax.post(baseURL,'/xboe/subgroup/m/noteinfo/excel-detail',data); +} + +/** + * 导出pdf预览 + * @param { + * ids ["",""] + * } + * */ +const exportPdfPre=function (data){ + return ajax.post(baseURL,'/xboe/subgroup/m/noteinfo/pdf-detail',data); +} + + + + + +/** + * 导出pdf + * @param{ + * + * } + * */ +const exportPdf=function (udata){ + // return ajax.postJson(baseURL,'/xboe/subgroup/m/noteinfo/exportPdf',data); + //return ajax.post(baseURL,'/xboe/subgroup/m/noteinfo/exportPdf',data); + var url = baseURL + '/xboe/subgroup/m/noteinfo/exportPdf'; + axios({ + method: 'POST', + url: url, + data:udata, + responseType: 'blob', + headers: { 'XBOE-Access-Token':getToken(),'Content-Type':'application/pdf;charset=utf-8'} + }).then(res => { + //resolveBlob(res, mimeMap.zip); + console.log(res); + const aLink = document.createElement('a') + var blob = new Blob([res.request.response], { type: 'application/pdf' }) + // //从response的headers中获取filename, 后端response.setHeader("Content-disposition", "attachment; filename=xxxx.docx") 设置的文件名; + //var patt = new RegExp('filename=([^;]+\\.[^\\.;]+);*') + //var contentDisposition = decodeURI(res.headers['content-disposition']) + //var result = patt.exec(contentDisposition) + //var fileName = result[1] + //fileName = fileName.replace(/\"/g, '') + aLink.href = URL.createObjectURL(blob) + aLink.setAttribute('download','我的笔记.pdf') // 设置下载文件名称 + document.body.appendChild(aLink) + aLink.click() + document.body.removeChild(aLink) + + }) +} + +/** + * 我的笔记收藏和分享都是这一个,目前只有收藏 + * @param{ + * paegIndex + * pageSize + * dataType 1收藏 2分享 + * orderType 排序顺序 顺序倒叙 + * orderField 排序字段 + * keyword 关键字查询 + * } + * */ +const pagelist=function (query){ + return ajax.post(baseURL,'/xboe/subgroup/m/noteinfo/pagelist',query); +} + +export default { + save, + detail, + del, + coursePage, + myCourse, + history, + pagelist, + query, + course, + update, + restore, + ids, + exportExcel, + exportPdf, + exportExcelPre, + exportPdfPre +} diff --git a/api/phase2/place.js b/api/phase2/place.js new file mode 100644 index 0000000..8e3314d --- /dev/null +++ b/api/phase2/place.js @@ -0,0 +1,28 @@ +// import ajax from '@/utils/xajax.js' +// import ajax from '../cesource/index.js'; +import ajax from '../ajax' +const baseURL = process.env.VUE_APP_CESOURCE_BASE_API; + + +/** + * 添加或编辑 + * @param 参数见设计文档 + * */ +const saveOrUpdate=function (data){ + return ajax.postJson(baseURL,'/xboe/subgroup/m/pageplace/saveOrUpdate',data); +} + +/** + * 根据key获取资源信息 + * */ + +const detail=function (key){ + return ajax.get(baseURL,'/xboe/subgroup/m/pageplace/detail-key?key='+key); +} + + + +export default { + saveOrUpdate, + detail +} diff --git a/api/phase2/stat.js b/api/phase2/stat.js new file mode 100644 index 0000000..69e7f37 --- /dev/null +++ b/api/phase2/stat.js @@ -0,0 +1,177 @@ +/**文章模块的相关处理*/ +// import ajax from '@/utils/xajax.js' +import ajax from '../ajax' +const baseURL = process.env.VUE_APP_STAT_BASE_API; +/** + * 发送事件,具体事件参考后台管理的事件查看 + *参数如下: + { + "key": "ReadCase",//后台的事件key + "title": "浏览案例【案例名称】",//事件的标题 + "parameters":"",//用户自定义参数 name:value,name:value + "content": "案例名称",//事件的内容 + "source":"页面事件", + "objId": "案例id",//关联的id + "objType": "3",//关联的类型 + "objInfo": "记录一般折内容部分", + "aid": "用户的id", //当前登录人的id + "aname": "用户的名称,用于显示",//当前人的姓名 + "status": 1 //状态,直接写1 + } + * + */ +const sendEvent = function(data) { + return ajax.postJson(baseURL,'/xboe/m/stat/event/send',data); +} + +/** + * 用户的统计信息 + * @param {Object} aid 主页人的id + * @param {Object} data 参数 []数组,10学习时长 11 学习天数 20表经验值 30表u币 40表获取天数,空数组 返回用户的全部类型统计。 + */ +const userTotal = function(aid,data) { + return ajax.postJson(baseURL,'/xboe/m/stat/user/total/'+aid,data); +} + +/** + * 用户动态,分页查询 + * + * @param { + pageIndex, + pageSize, + contentType:'',内容类型 + aid:'', //指定用户的动态, + hidden:true/false,//是否隐藏,不指定,查询全部 + } data + */ +const userDynamicList = function(data) { + return ajax.post(baseURL,'/xboe/m/stat/userdynamic/list',data); +} + +/** + * 用户动态,分页查询 + * + * @param { + pageIndex, + pageSize, + contentType:'',内容类型 + aid 数组 + } data + */ +const userDynamicfollows = function(data) { + return ajax.postJson(baseURL,'/xboe/m/stat/userdynamic/follow',data); +} + +/** + * 获取用户全部勋章 + * @param {String} aid 用户的id + * + */ + const userMedal = function(aid) { + return ajax.get(baseURL,'/xboe/m/stat/medal/user-medal?aid='+aid); +} + + +/** + * 勋章信息 + * 页面上不能修改,删除 + */ +// const userMedalConfig = function() { +// return ajax.get(baseURL,'/xboe/m/stat/medalinfo/config'); +// } +// get 获取勋章配置,返回的是列表 +const userMedalConfig = function() { + return ajax.get(baseURL,'/xboe/m/stat/medal/config'); +} + +/** + * 查询勋章下等级所对应的用户数量 + * @author wn + * @param {String} medalId 勋章id(必填) + */ +const userMedalLevelInfo = function(medalId) { + return ajax.get(baseURL,'/xboe/m/stat/medal/getUserMedalLevelInfo?medalId='+medalId); +} + +/** + * 隐藏动态 + * @author wn + * @param {String} id 动态id(必填) + */ +const dynamicHide = function(id) { + return ajax.post(baseURL,'/xboe/m/stat/userdynamic/hide?id='+id); +} + +/** + * 导出用户近7天的U币记录 + * @author wn + * @param {String} aid 用户aid + */ +const exportUserCoinRecord = function(aid) { + return ajax.get(baseURL,'/xboe/m/stat/usercoinrecord/export?aid='+aid); +} + +/** + * 获取用户最近 x 天的U币记录 + * @param {String} aid 用户的id + * @param {Integer} days x天的记录,默认为7天 + */ + const userCoinList = function(aid,days) { + return ajax.get(baseURL,'/xboe/m/stat/usercoinrecord/list?aid='+aid+'&days='+days); +} + +/** + * 查询排名数据 + * @author wn + * @params { + "aid":"952948626497724414", #用户id + "statType":20, #统计类型 10学习时长 11 学习天数 20表经验值 30表u币 40表获取天数 + "field":"total", #统计周期 todays-当天,weeks-周,months-月,years-年 total-总计 + "num":8 #显示的条数 + } + */ +const getRanking = function(queryData) { + return ajax.postJson(baseURL,'/xboe/m/stat/user/ranking',queryData); +} + + +/** + * 查询统计用户经验值等级、累计学习时长、累计U币数量、累计经验值 + * @author wn + * @param {String} aid 用户的id + */ + const getUserStatTotalInfo = function(aid) { + return ajax.get(baseURL,'/xboe/m/stat/user/statinfo?aid='+aid); +} + +/** + * 用户的登录勋章,新版上线,15天内登录过一次 + * @author wn + */ + const getUserLoginMedal = function() { + return ajax.get(baseURL,'/xboe/m/stat/medal/login-medal'); +} + +/** + * 提取需要提示的勋章 + */ +const getUserMedalTips = function() { + return ajax.get(baseURL,'/xboe/m/stat/medal/tips'); +} + +export default { + sendEvent, + userTotal, + userDynamicList, + userCoinList, + userMedal, + userMedalConfig, + userMedalLevelInfo, + dynamicHide, + exportUserCoinRecord, + getRanking, + getUserStatTotalInfo, + userDynamicfollows, + getUserLoginMedal, + getUserMedalTips +} diff --git a/api/phase2/userfollow.js b/api/phase2/userfollow.js new file mode 100644 index 0000000..91b4aaf --- /dev/null +++ b/api/phase2/userfollow.js @@ -0,0 +1,102 @@ +import ajax from '../ajax'; +const baseURL = process.env.VUE_APP_CESOURCE_BASE_API; + + +/** + * 添加关注 + * @param{ + * followId + * } + * */ +const save=function (followId){ + return ajax.get(baseURL,'/xboe/subgroup/m/userfollow/save?followId='+followId); +} + +/** + * 检查是否已关注 + * @param{ + * followId + * } + * */ +const checkFllow=function (followId){ + return ajax.get(baseURL,'/xboe/subgroup/m/userfollow/checkFllow?followId='+followId); +} + +/** + * 取消关注 + * + * */ +const remove=function (followId){ + return ajax.get(baseURL,'/xboe/subgroup/m/userfollow/remove?followId='+followId); +} + +/** + * 我关注的人列表 + * @param{ + * pageIndex + * pageSize, + * aid + * } + * */ +const page=function (query){ + return ajax.post(baseURL,'/xboe/subgroup/m/userfollow/page',query); +} + +/** + * 我关注的人列表 + * @param{ + * pageIndex + * pageSize, + * aid + * } + * */ +const mypage=function (query){ + return ajax.post(baseURL,'/xboe/subgroup/m/userfollow/mypage',query); +} + +/** + * 二次查询 + * */ +const ids=function (data){ + return ajax.postJson(baseURL,'/xboe/subgroup/m/userfollow/ids',data); +} + +/** + * 被关注数 + * 关注数 + * @pram{ + * aid + * } + * */ +const counts=function (aid){ + return ajax.get(baseURL,'/xboe/subgroup/m/userfollow/counts?aid='+aid); +} + +/** + * 查询是否已关注 + * @param{ + * followId 关注人的id + * } + * */ +const has=function (followId){ + return ajax.get(baseURL,'/xboe/subgroup/m/userfollow/has?followId='+followId); +} + +/** + * 我的关注二次查询 + * */ +const list=function (){ + return ajax.get(baseURL,'/xboe/subgroup/m/userfollow/list'); +} + +export default { + save, + remove, + page, + mypage, + ids, + counts, + has, + checkFllow, + list +} diff --git a/api/phase2/userhobby.js b/api/phase2/userhobby.js new file mode 100644 index 0000000..375c678 --- /dev/null +++ b/api/phase2/userhobby.js @@ -0,0 +1,60 @@ +// import ajax from '@/utils/xajax.js' +// import ajax from '../cesource/index.js' +import ajax from '../ajax'; +const baseURL = process.env.VUE_APP_CESOURCE_BASE_API; + + +/** + * 用户采集的添加 + * @param{ + * type 类型 1表课程分类 + * refId 关联的id + * refCode 关联的code + * } + * */ +const save=function (data){ + return ajax.postJson(baseURL,'/xboe/subgroup/m/userhobby/save',data); +} + +/** + * 同兴趣人匹配查询 + * 参数:下面那个接口的返回值直接传 + * */ +const list=function (aid){ + return ajax.get(baseURL,'/xboe/subgroup/m/userhobby/list?aid='+aid); +} + +/** + * 获取用户兴趣关联的id + * */ +const info=function (aid){ + return ajax.get(baseURL,'/xboe/subgroup/m/userhobby/info?aid='+aid); +} + +/** + * 修改用户兴趣爱好兴趣爱好, + * 参数是上一个接口 info查出来的返回值 + * */ +const update=function (data){ + return ajax.postJson(baseURL,'/xboe/subgroup/m/userhobby/update',data); +} + +/** + * 删除 + * */ +const del=function (id){ + return ajax.get(baseURL,'/xboe/subgroup/m/userhobby/delete?id='+id); +} +const has=function(){ + return ajax.get(baseURL,'/xboe/subgroup/m/userhobby/has'); +} + +export default { + save, + list, + info, + update, + del, + has +} + diff --git a/manifest.json b/manifest.json index 93cee26..40e204e 100644 --- a/manifest.json +++ b/manifest.json @@ -73,8 +73,8 @@ "devServer" : { "https" : false, "proxy" : { - "/systemapi" : { - "target" : "http://127.0.0.1:9090", + "/systemapi" : { + "target" : "http://192.168.0.11:9090", "changeOrigin" : true, "secure" : false, "pathRewrite" : { @@ -88,7 +88,27 @@ "pathRewrite" : { "^/uboeApi" : "/api" } - } + }, + "/statApi": { + // 目标代理服务器地址 + "target" : "http://192.168.0.11:9080", + "changeOrigin" : true, + "logLevel" :"debug", + "secure" : false, + "pathRewrite" : { + "^/statApi": "" + } + }, + "/socialApi": { + // 目标代理服务器地址 + "target": "http://192.168.0.11:9081", + "changeOrigin": true, + "logLevel":"debug", + "secure": false, + "pathRewrite": { + "^/socialApi": "" + } + } } }, "optimization" : {