78 lines
2.0 KiB
JavaScript
78 lines
2.0 KiB
JavaScript
|
"use strict";
|
||
|
const common_vendor = require("../../common/vendor.js");
|
||
|
const common_js_util = require("../../common/js/util.js");
|
||
|
const api_index = require("../../api/index.js");
|
||
|
if (!Math) {
|
||
|
videoMenu();
|
||
|
}
|
||
|
const videoMenu = () => "../index/videoMenu.js";
|
||
|
const _sfc_main = {
|
||
|
__name: "like",
|
||
|
setup(__props, { expose: __expose }) {
|
||
|
const list = common_vendor.reactive({
|
||
|
data: [],
|
||
|
pageSize: 10,
|
||
|
pageNum: 1,
|
||
|
total: 0
|
||
|
});
|
||
|
const store = common_vendor.useStore();
|
||
|
const userinfo = common_vendor.computed(() => {
|
||
|
let result = store.state.userinfo;
|
||
|
return result;
|
||
|
});
|
||
|
common_vendor.onMounted(() => {
|
||
|
getList();
|
||
|
});
|
||
|
function refreshList() {
|
||
|
list.pageNum = 1;
|
||
|
list.total = 0;
|
||
|
getList();
|
||
|
}
|
||
|
function getMoreList() {
|
||
|
if (list.data.length >= list.rows)
|
||
|
return;
|
||
|
list.pageNum++;
|
||
|
getList();
|
||
|
}
|
||
|
function getList() {
|
||
|
api_index.api.video.myLikeVideoList({
|
||
|
query: {
|
||
|
userId: userinfo.value.userId,
|
||
|
pageSize: list.pageSize,
|
||
|
pageNum: list.pageNum
|
||
|
}
|
||
|
}).then((rs) => {
|
||
|
if (rs.code == 200) {
|
||
|
if (list.pageNum == 1)
|
||
|
list.data.length = [];
|
||
|
list.data.push(...rs.rows.map((item) => {
|
||
|
item.format_videoUrl = common_js_util.util.format_url(item.videoUrl, "video");
|
||
|
item.format_imageUrl = common_js_util.util.format_url(item.imageUrl, "img");
|
||
|
return item;
|
||
|
}));
|
||
|
list.total = rs.total;
|
||
|
return;
|
||
|
}
|
||
|
common_js_util.util.alert({
|
||
|
content: rs.msg,
|
||
|
showCancel: false
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
__expose({
|
||
|
getList,
|
||
|
getMoreList,
|
||
|
refreshList
|
||
|
});
|
||
|
return (_ctx, _cache) => {
|
||
|
return {
|
||
|
a: common_vendor.p({
|
||
|
list: list.data
|
||
|
})
|
||
|
};
|
||
|
};
|
||
|
}
|
||
|
};
|
||
|
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-3884542e"]]);
|
||
|
wx.createComponent(Component);
|