import { httpUrls } from './consts' import { RequestService } from './httpRequest' import wepy from 'wepy' const HOST = httpUrls.baseApi function genAPIUrl(action) { return HOST + action } export class httpRequestApi { // 请求任务列表 static getTaskList (pageNo, pageSize) { const url = genAPIUrl('wx/joinUser') return RequestService.sendRequest().url(url).header({ uid: wepy.getStorageSync('uid') }).data({ pageNo, pageSize, uid: wepy.getStorageSync('uid') }).send() } // 列表详情 static getTaskFile (taskId) { const url = genAPIUrl('wx/taskFile') return RequestService.sendRequest().url(url).data({ taskId }).send() } // 删除 static delFile (id, fileStatus) { const url = genAPIUrl('wx/joinUser') return RequestService.sendRequest().header({ uid: wepy.getStorageSync('uid') }).url(url).method('PUT').data({ id, fileStatus }).send() } // 添加观看记录 static addViewLog (fileId, taskId) { const url = genAPIUrl('wx/viewLog') return RequestService.sendRequest().header({ uid: wepy.getStorageSync('uid') }).url(url).method('POST').data({ fileId, taskId }).send() } // 观看记录列表 static getLogList (pageNo, pageSize) { const url = genAPIUrl('wx/viewLog') return RequestService.sendRequest().header({ uid: wepy.getStorageSync('uid') }).data({ pageNo, pageSize }).url(url).send() } }