123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- 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: wx.getStorageSync('uid'),
- }).url(url).data(data).send();
- }
- //获取看nav切换
- static getCategory() {
- const url = httpApiUrl('wx/category');
- return getInstance().header({
- uid: wx.getStorageSync('uid'),
- }).url(url).send();
- }
- //获取推荐课程
- static getCategoryRecommend() {
- const url = httpApiUrl('wx/course/recommend/top');
- return getInstance().header({
- uid: wx.getStorageSync('uid'),
- }).url(url).send();
- }
- //获取课程详情
- static getCourseDetails(id) {
- const url = httpApiUrl(`wx/course/${id}`);
- return getInstance().header({
- uid: wx.getStorageSync('uid'),
- }).url(url).data().send();
- }
- //添加播放记录
- static addPlayLogList(data) {
- const url = httpApiUrl('wx/playLog');
- return getInstance().header({
- uid: wx.getStorageSync('uid'),
- }).url(url).data(data).method('POST').send();
- }
- //收藏或者取消
- static getDetailsFavorites(data) {
- const url = httpApiUrl('wx/favorites');
- return getInstance().header({
- uid: wx.getStorageSync('uid'),
- }).url(url).data(data).method('POST').send();
- }
- //获取收藏列表
- static getFavoritesList(data) {
- const url = httpApiUrl('wx/favorites');
- return getInstance().header({
- uid: wx.getStorageSync('uid'),
- }).url(url).data(data).send();
- }
- //添加评论
- static getDetailsPosts(data) {
- const url = httpApiUrl('wx/posts');
- return getInstance().header({
- uid: wx.getStorageSync('uid'),
- }).url(url).data(data).method('POST').send();
- }
- //获取评论列表
- static getPostsList(data) {
- const url = httpApiUrl('wx/posts');
- return getInstance().header({
- uid: wx.getStorageSync('uid'),
- }).url(url).data(data).send();
- }
- //获取播放记录
- static getPlayLogList(data) {
- const url = httpApiUrl('wx/playLog');
- return getInstance().header({
- uid: wx.getStorageSync('uid'),
- }).url(url).data(data).send();
- }
- //上传图片到相册
- static addPhotoList(data) {
- const url = httpApiUrl('wx/photoBox');
- return getInstance().header({
- uid: wx.getStorageSync('uid'),
- }).url(url).data(data).method('POST').send();
- }
- //获取相册列表
- static getPhotoList(data) {
- const url = httpApiUrl('wx/photoBox');
- return getInstance().header({
- uid: wx.getStorageSync('uid'),
- }).url(url).data(data).send();
- }
- //删除相册
- static removePhotoList(id) {
- const url = httpApiUrl(`wx/photoBox/${ id }`);
- return getInstance().header({
- uid: wx.getStorageSync('uid'),
- }).url(url).method('DELETE').send();
- }
- //相册设置
- static setPhoto(photoBox) {
- const url = httpApiUrl(`wx/user/photoBox`);
- return getInstance().header({
- uid: wx.getStorageSync('uid'),
- }).url(url).data({
- photoBox,
- }).method('PUT').send();
- }
- //萌娃相册列表
- static getPhotoBoxList(data) {
- const url = httpApiUrl('wx/photoBox/cuteBaby/list');
- return getInstance().header({
- uid: wx.getStorageSync('uid'),
- }).url(url).data(data).send();
- }
- //根据用户id获取用户相册信息
- static getPhotoBoxInfoById(data) {
- const url = httpApiUrl('wx/photoBox/cuteBaby/info');
- return getInstance().header({
- uid: wx.getStorageSync('uid'),
- }).url(url).data(data).send();
- }
- //点赞
- static setPhotoBoxLike(data) {
- const url = httpApiUrl(`wx/user/like/${data.target}`);
- return getInstance().header({
- uid: wx.getStorageSync('uid'),
- }).url(url).method('POST').send();
- }
- //获取用户信息
- static getUserInfo() {
- const url = httpApiUrl(`wx/user`);
- console.log('===============================', wx.getStorageSync('uid'));
- return getInstance().header({
- uid: wx.getStorageSync('uid'),
- }).url(url).send();
- }
- //修改用户信息
- static setUserInfo(data) {
- const url = httpApiUrl(`wx/user`);
- return getInstance().header({
- uid: wx.getStorageSync('uid'),
- }).url(url).data(data).method('PUT').send();
- }
- }
- export default httpRequestApi;
|