88 lines
2.3 KiB
JavaScript
88 lines
2.3 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 = () => "../../components/index/videoMenu.js";
|
|
const _sfc_main = {
|
|
__name: "promotion",
|
|
setup(__props) {
|
|
const userId = common_vendor.ref("");
|
|
const videoIds = common_vendor.reactive([]);
|
|
const list = common_vendor.reactive({
|
|
data: [],
|
|
pageSize: 10,
|
|
pageNum: 1,
|
|
total: 0
|
|
});
|
|
common_vendor.onLoad((option) => {
|
|
if (option.userId)
|
|
userId.value = option.userId;
|
|
if (option.videoIds)
|
|
videoIds.value = option.videoIds.split(",");
|
|
getList();
|
|
});
|
|
common_vendor.onPullDownRefresh(() => {
|
|
refreshList();
|
|
});
|
|
common_vendor.onReachBottom(() => {
|
|
getMoreList();
|
|
});
|
|
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.myVideoList({
|
|
query: {
|
|
isDraft: 0,
|
|
userId: 16,
|
|
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
|
|
});
|
|
});
|
|
}
|
|
function callBack() {
|
|
console.log(videoIds);
|
|
}
|
|
return (_ctx, _cache) => {
|
|
return {
|
|
a: common_vendor.t(list.total),
|
|
b: common_vendor.o$1(callBack),
|
|
c: common_vendor.o$1(($event) => videoIds = $event),
|
|
d: common_vendor.p({
|
|
list: list.data,
|
|
mode: "checkbox",
|
|
ids: videoIds
|
|
})
|
|
};
|
|
};
|
|
}
|
|
};
|
|
wx.createPage(_sfc_main);
|