7
This commit is contained in:
+40
-32
@@ -1,4 +1,7 @@
|
||||
import { reject } from "lodash";
|
||||
import config from "@/common/config";
|
||||
// 登录
|
||||
|
||||
export const businessConfig = (params) =>
|
||||
uni.$u?.http.post("/common/init", JSON.stringify(params));
|
||||
// 验证是否升级
|
||||
@@ -78,40 +81,45 @@ export const businessSearchUser = (keyword,searchtype) =>
|
||||
},
|
||||
}
|
||||
);
|
||||
export const getArticle = (id,type) =>
|
||||
uni.$u?.http.post(
|
||||
"/article/detail",
|
||||
JSON.stringify({
|
||||
id,
|
||||
type:(type? type : 'id')
|
||||
}), {
|
||||
header: {
|
||||
token: uni.getStorageSync("BusinessToken"),
|
||||
},
|
||||
}
|
||||
);
|
||||
export const getArticle = (id,type) => uni.$u?.http.post("/article/detail",JSON.stringify({id,type:(type? type : 'id')}));
|
||||
export const getFriendCircle = (page=1,limit=10) =>{
|
||||
uni.$u?.http.get(
|
||||
"/friend_circle/list",
|
||||
JSON.stringify({
|
||||
limit:limit,
|
||||
page:page
|
||||
}),
|
||||
{
|
||||
header: {
|
||||
token: uni.getStorageSync("BusinessToken"),
|
||||
},
|
||||
}
|
||||
);
|
||||
return uni.$u?.http.get("/friendcircle/list",JSON.stringify({limit:limit,page:page}));
|
||||
}
|
||||
export const getFriendCircleNewcount = () =>{
|
||||
uni.$u?.http.get(
|
||||
"/friend_circle/newcount",
|
||||
JSON.stringify({}),
|
||||
{
|
||||
header: {
|
||||
token: uni.getStorageSync("BusinessToken"),
|
||||
return uni.$u?.http.get("/friendcircle/newcount");
|
||||
}
|
||||
export const getFriendCircleInfo = () =>{
|
||||
return uni.$u?.http.get("/friendcircle/info");
|
||||
}
|
||||
export const upload = (url,onProgress) =>{
|
||||
return new Promise((resolve,reject)=>{
|
||||
var u = uni.uploadFile({
|
||||
url: config.getRegisterUrl()+"/user/upload", // 仅为示例,非真实的接口地址
|
||||
filePath: url,
|
||||
name: "file",
|
||||
header:{
|
||||
token:uni.getStorageSync("BusinessToken"),
|
||||
},
|
||||
}
|
||||
);
|
||||
success({data,errMsg}){
|
||||
console.log(data);
|
||||
data = JSON.parse(data);
|
||||
if(data.code == 0){
|
||||
resolve(data);
|
||||
}else{
|
||||
reject(data.msg);
|
||||
}
|
||||
},
|
||||
fail(res) {
|
||||
console.log(e);
|
||||
reject(e);
|
||||
}
|
||||
});
|
||||
u.onProgressUpdate((e)=>{
|
||||
var res = {
|
||||
'code' : 99999,
|
||||
'progress' : e.progress
|
||||
}
|
||||
onProgress && onProgress.call(this,res);
|
||||
})
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user