import { post, upload } from '../utils/http.js'; const resolver = function(cb) { return { done(r) { console.log(r) if (r.state != 100) { return wx.showToast({ icon: 'none', title: r.msg }) } cb && cb(r) }, fail(e) { console.error('api fail:', e) wx.showToast({ icon: 'loading', title: '系统繁忙!' }) } } } module.exports = { ilogin: { loadAT(d, cb) { post('/mWx/getUserInfo', d).then(resolver(cb).done).catch(resolver(cb).fail) }, loadUserinfo(d, cb) { post('small/save_wx_userinfo', d).then(resolver(cb).done).catch(resolver(cb).fail) }, loadConfig(d ,cb) { post('small/siteinfo', d).then(resolver(cb).done).catch(resolver(cb).fail) } }, ihome: { loadSponsors(d,cb) { post('small/zanzhushang_list',d).then(resolver(cb).done).catch(resolver(cb).fail) }, loadBanners(d,cb) { post('/home/queryMobileBannerList',d).then(resolver(cb).done).catch(resolver(cb).fail) }, loadPartners(d,cb) { post('/home/queryMobilePartnerList',d).then(resolver(cb).done).catch(resolver(cb).fail) }, loadHotnews(d,cb) { post('/home/queryMobileHeadlineList',d).then(resolver(cb).done).catch(resolver(cb).fail) }, }, ihotnews: { loadNews(d, cb) { post('small/news_list', d).then(resolver(cb).done).catch(resolver(cb).fail) }, loadNewsdetails(d, cb) { post('small/news_detail', d).then(resolver(cb).done).catch(resolver(cb).fail) }, }, iactivity: { loadActivities(d, cb) { post('/mActivity/searchActivityList', d).then(resolver(cb).done).catch(resolver(cb).fail) }, loadActivitydetails(d, cb) { post('/mActivity/searchActivityById', d).then(resolver(cb).done).catch(resolver(cb).fail) }, loadJoinin(d, cb) { post('small/event_attend', d).then(resolver(cb).done).catch(resolver(cb).fail) }, }, icommunity: { uploadPics(f, cb) { upload('/mUpload/uploadImg', { }, f).then(resolver(cb).done).catch(resolver(cb).fail) }, uploadVideos(f, cb) { upload('/mUpload/uploadVideo', { }, f).then(resolver(cb).done).catch(resolver(cb).fail) }, loadPubArticle(d, cb) { post('/mArticle/saveArticle', d).then(resolver(cb).done).catch(resolver(cb).fail) }, loadDeleteArticle(d, cb) { post('/mArticle/deleteMyArticle', d).then(resolver(cb).done).catch(resolver(cb).fail) }, loadDeleteCollect(d, cb) { post('/collect/deleteMyCollect', d).then(resolver(cb).done).catch(resolver(cb).fail) }, loadArticles(d, cb) { post('/mArticle/searchArticleList', d).then(resolver(cb).done).catch(resolver(cb).fail) }, loadAddArticle(d, cb) { post('/collect/addCollect', d).then(resolver(cb).done).catch(resolver(cb).fail) }, loadAddArticlefavor(d, cb) { post('small/space_zan_add', d).then(resolver(cb).done).catch(resolver(cb).fail) }, loadRemoveArticlefavor(d, cb) { post('small/space_zan_del', d).then(resolver(cb).done).catch(resolver(cb).fail) }, loadArticledetails(d, cb) { post('/mArticle/searchArticleById', d).then(resolver(cb).done).catch(resolver(cb).fail) }, loadArticlecomments(d, cb, hideLoading) { post('small/space_comment_list', d, hideLoading).then(resolver(cb).done).catch(resolver(cb).fail) }, loadAddArticlecomment(d, cb) { post('small/space_comment_add', d).then(resolver(cb).done).catch(resolver(cb).fail) }, loadArticleCollectionToggle(d, cb) { post('small/space_follow_opert', d).then(resolver(cb).done).catch(resolver(cb).fail) }, }, imine: { loadMyPubarticles(d, cb) { post('/mArticle/searchMyArticle', d).then(resolver(cb).done).catch(resolver(cb).fail) }, loadMyCollectedarticles(d, cb) { post('/collect/searchCollectList', d).then(resolver(cb).done).catch(resolver(cb).fail) }, loadMyComments(d, cb) { post('/mComment/queryMyComment', d).then(resolver(cb).done).catch(resolver(cb).fail) }, loadMyActivities(d, cb) { post('/mActivity/myApplyActivities', d).then(resolver(cb).done).catch(resolver(cb).fail) }, loadMyinformation(d,cb) { post('/user/queryUserById',d).then(resolver(cb).done).catch(resolver(cb).fail) }, updateUser(d,cb) { post('/user/updateUser',d).then(resolver(cb).done).catch(resolver(cb).fail) }, queryAllArea(d,cb) { post('/user/queryAllArea',d).then(resolver(cb).done).catch(resolver(cb).fail) }, querySchoolByAreaId(d,cb) { post('/user/querySchoolByAreaId',d).then(resolver(cb).done).catch(resolver(cb).fail) }, }, answer: { attendContest(d, cb) { post('/mCompetition/attendContest', d).then(resolver(cb).done).catch(resolver(cb).fail) }, getLeaderBoard(d, cb) { post('/mCompetition/getLeaderBoard', d).then(resolver(cb).done).catch(resolver(cb).fail) }, submitUserAnswer(d, cb) { post('/mCompetition/submitUserAnswer', d).then(resolver(cb).done).catch(resolver(cb).fail) } } }