1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- import { getInstance } from './httpRequest';
- import { apiUrl } from './const.js';
- //console.log(getInstance().url)
- const httpApiUrl = (str) => {
- return apiUrl + str;
- }
- class httpRequestApi {
- //课程表首页
- static getCourse(data) {
- const url = httpApiUrl('wx/course');
- return getInstance().header({
- uid: 1,
- }).url(url).data(data).send();
- }
- //获取课程详情
- static getCourseDetails(id) {
- const url = httpApiUrl(`wx/course/${id}`);
- return getInstance().header({
- uid: 1,
- }).url(url).data().send();
- }
- //收藏或者取消
- static getDetailsFavorites(data) {
- const url = httpApiUrl('wx/favorites');
- return getInstance().header({
- uid: 1,
- }).url(url).data(data).method('POST').send();
- }
- //获取收藏列表
- static getFavoritesList(data) {
- const url = httpApiUrl('wx/favorites');
- return getInstance().header({
- uid: 1,
- }).url(url).data(data).send();
- }
- //添加评论
- static getDetailsPosts(data) {
- const url = httpApiUrl('wx/posts');
- return getInstance().header({
- uid: 1,
- }).url(url).data(data).method('POST').send();
- }
- //获取评论列表
- static getPostsList(data) {
- const url = httpApiUrl('wx/posts');
- return getInstance().header({
- uid: 1,
- }).url(url).data(data).send();
- }
- //获取播放记录
- static getPlayLogList(data) {
- const url = httpApiUrl('wx/playLog');
- return getInstance().header({
- uid: 1,
- }).url(url).data(data).send();
- }
- }
- export default httpRequestApi;
|