165 lines
2.9 KiB
JavaScript
165 lines
2.9 KiB
JavaScript
/**
|
|
* 短视频相关API
|
|
*/
|
|
|
|
import { http, Method } from "@/utils/request.js";
|
|
|
|
import api from "@/config/api.js";
|
|
|
|
|
|
|
|
/**
|
|
* 短视频列表
|
|
*/
|
|
export function vlogList(page, pageSize) {
|
|
return http.request({
|
|
url: api.vlog + "/vlog/indexList",
|
|
method: Method.GET,
|
|
needToken: false,
|
|
params: { page, pageSize },
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 短视频喜欢
|
|
*/
|
|
export function vlogLike({userId,vlogId,vlogerId}) {
|
|
return http.request({
|
|
url: api.vlog + "/vlog/like",
|
|
method: Method.POST,
|
|
needToken: true,
|
|
params: {userId,vlogId,vlogerId}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 短视频不喜欢
|
|
*/
|
|
export function vlogUnLike({userId,vlogId,vlogerId}) {
|
|
return http.request({
|
|
url: api.vlog + "/vlog/unlike",
|
|
method: Method.POST,
|
|
needToken: true,
|
|
params: {userId,vlogId,vlogerId}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 短视频评论
|
|
*/
|
|
export function vlogComment(vlogId) {
|
|
return http.request({
|
|
url: api.vlog + "/comment/counts",
|
|
method: Method.GET,
|
|
needToken: true,
|
|
params: { vlogId },
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 短视频关注博主
|
|
*/
|
|
export function vlogFollow({myId,vlogerId}) {
|
|
return http.request({
|
|
url: api.vlog + "/fans/follow",
|
|
method: Method.POST,
|
|
needToken: true,
|
|
params: {myId,vlogerId}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 短视频查询当前点赞数
|
|
*/
|
|
export function vlogTotalLikedCounts(vlogId) {
|
|
return http.request({
|
|
url: api.vlog + "/vlog/totalLikedCounts",
|
|
method: Method.POST,
|
|
needToken: true,
|
|
params: {vlogId}
|
|
});
|
|
}
|
|
|
|
|
|
/**
|
|
* 通过cityCode获取地区代码
|
|
*/
|
|
export function getAddressCode(cityCode, townName) {
|
|
return http.request({
|
|
url: api.common + "/common/region/region",
|
|
method: Method.GET,
|
|
needToken: true,
|
|
params: { cityCode, townName },
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 添加收货地址
|
|
* @param params 地址参数
|
|
* @returns {AxiosPromise}
|
|
*/
|
|
export function addAddress(data) {
|
|
return http.request({
|
|
url: "/member/address",
|
|
method: Method.POST,
|
|
needToken: true,
|
|
header: { "content-type": "application/x-www-form-urlencoded" },
|
|
data: data,
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 编辑地址
|
|
* @param id 地址ID
|
|
* @param params 地址参数
|
|
* @returns {AxiosPromise}
|
|
*/
|
|
export function editAddress(params) {
|
|
return http.request({
|
|
url: `/member/address`,
|
|
method: Method.PUT,
|
|
needToken: true,
|
|
header: { "content-type": "application/x-www-form-urlencoded" },
|
|
data: params,
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 删除收货地址
|
|
* @param id
|
|
*/
|
|
export function deleteAddress(id) {
|
|
return http.request({
|
|
url: `/member/address/delById/${id}`,
|
|
method: Method.DELETE,
|
|
needToken: true,
|
|
});
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
* 根据ID获取会员收件地址
|
|
* @param id
|
|
*/
|
|
export function getAddressDetail(id) {
|
|
return http.request({
|
|
url: `/member/address/get/${id}`,
|
|
method: Method.GET,
|
|
loading: false,
|
|
needToken: true,
|
|
});
|
|
}
|
|
|
|
/**
|
|
*
|
|
*/
|
|
export function getAddressDefault() {
|
|
return http.request({
|
|
url: `/member/address/get/default`,
|
|
method: Method.GET,
|
|
loading: false,
|
|
needToken: true,
|
|
});
|
|
}
|