210 lines
6.0 KiB
JavaScript
210 lines
6.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");
|
|
const api_video = require("../../api/video.js");
|
|
if (!Array) {
|
|
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
|
|
const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
|
|
(_easycom_uni_icons2 + _easycom_uni_popup2)();
|
|
}
|
|
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
|
|
const _easycom_uni_popup = () => "../../uni_modules/uni-popup/components/uni-popup/uni-popup.js";
|
|
if (!Math) {
|
|
(_easycom_uni_icons + _easycom_uni_popup + videoMenu)();
|
|
}
|
|
const videoMenu = () => "../../components/index/videoMenu.js";
|
|
const _sfc_main = {
|
|
__name: "extend",
|
|
setup(__props) {
|
|
const store = common_vendor.useStore();
|
|
const userinfo = common_vendor.computed(() => {
|
|
let result = store.state.userinfo;
|
|
return result;
|
|
});
|
|
const list = common_vendor.reactive({
|
|
data: [],
|
|
pageSize: 10,
|
|
pageNum: 1,
|
|
total: 0
|
|
});
|
|
const form = common_vendor.reactive({
|
|
userId: userinfo.value.userId,
|
|
videoId: [],
|
|
reason: "",
|
|
context: "",
|
|
pic: []
|
|
});
|
|
const apply = common_vendor.reactive({
|
|
author: "",
|
|
mobile: "",
|
|
mail: "",
|
|
address: ""
|
|
});
|
|
const videos = common_vendor.computed(() => {
|
|
let result = form.videoId.map((item) => {
|
|
return list.data.find((node) => node.videoId == item) || {};
|
|
});
|
|
return result;
|
|
});
|
|
common_vendor.onReady(() => {
|
|
getList();
|
|
});
|
|
function refreshList() {
|
|
list.pageNum = 1;
|
|
list.total = 0;
|
|
getList();
|
|
}
|
|
function getList() {
|
|
api_index.api.video.myVideoList({
|
|
query: {
|
|
isDraft: 0,
|
|
userId: form.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
|
|
});
|
|
});
|
|
}
|
|
function pushVideo() {
|
|
if (videos.value.length < 1) {
|
|
common_js_util.util.alert({
|
|
content: "请选择投流视频",
|
|
showCancel: false
|
|
});
|
|
return;
|
|
}
|
|
if (userinfo.value.fruit <= videos.value.length * 10) {
|
|
common_js_util.util.alert({
|
|
content: "榴莲果不足",
|
|
showCancel: false
|
|
});
|
|
return;
|
|
}
|
|
api_video.video.pushVideo({
|
|
query: {
|
|
ids: form.videoId
|
|
}
|
|
}).then((rs) => {
|
|
if (rs.code === 200) {
|
|
common_vendor.index.showToast({
|
|
title: "兑换成功",
|
|
icon: "success",
|
|
duration: 1500
|
|
});
|
|
} else {
|
|
common_vendor.index.showToast({
|
|
title: rs.msg,
|
|
icon: "error",
|
|
duration: 1500
|
|
});
|
|
}
|
|
});
|
|
}
|
|
function applyVideo() {
|
|
if (videos.value.length < 1) {
|
|
common_js_util.util.alert({
|
|
content: "请选择投流视频",
|
|
showCancel: false
|
|
});
|
|
return;
|
|
}
|
|
if (userinfo.value.fruit <= 10) {
|
|
common_js_util.util.alert({
|
|
content: "榴莲果不足",
|
|
showCancel: false
|
|
});
|
|
return;
|
|
}
|
|
api_video.video.applyVideo({
|
|
data: {
|
|
videoIds: form.videoId.join(","),
|
|
author: apply.author,
|
|
mobile: apply.mobile,
|
|
address: apply.address,
|
|
mail: apply.mail
|
|
}
|
|
}).then((rs) => {
|
|
if (rs.code === 200) {
|
|
common_vendor.index.showToast({
|
|
title: "兑换成功",
|
|
icon: "success",
|
|
duration: 1500
|
|
});
|
|
} else {
|
|
common_vendor.index.showToast({
|
|
title: rs.msg,
|
|
icon: "error",
|
|
duration: 1500
|
|
});
|
|
}
|
|
});
|
|
}
|
|
return (_ctx, _cache) => {
|
|
return {
|
|
a: common_vendor.p({
|
|
type: "bottom"
|
|
}),
|
|
b: common_vendor.t(videos.value.length),
|
|
c: common_vendor.o$1(($event) => _ctx.$refs.select.open()),
|
|
d: common_vendor.f(videos.value, (item, index, i0) => {
|
|
return {
|
|
a: item.format_imageUrl,
|
|
b: index
|
|
};
|
|
}),
|
|
e: common_vendor.o$1(pushVideo),
|
|
f: common_vendor.o$1(($event) => _ctx.$refs.applyRef.open()),
|
|
g: common_vendor.t(videos.value.length),
|
|
h: common_vendor.t(videos.value.length),
|
|
i: common_vendor.t(userinfo.value.fruit),
|
|
j: apply.author,
|
|
k: common_vendor.o$1(($event) => apply.author = $event.detail.value),
|
|
l: apply.mobile,
|
|
m: common_vendor.o$1(($event) => apply.mobile = $event.detail.value),
|
|
n: apply.mail,
|
|
o: common_vendor.o$1(($event) => apply.mail = $event.detail.value),
|
|
p: apply.address,
|
|
q: common_vendor.o$1(($event) => apply.address = $event.detail.value),
|
|
r: common_vendor.o$1(applyVideo),
|
|
s: common_vendor.sr("applyRef", "f099fe76-1"),
|
|
t: common_vendor.p({
|
|
type: "center"
|
|
}),
|
|
v: common_vendor.t(list.total),
|
|
w: common_vendor.p({
|
|
type: "refreshempty",
|
|
color: ""
|
|
}),
|
|
x: common_vendor.o$1(refreshList),
|
|
y: common_vendor.o$1(($event) => form.videoId = $event),
|
|
z: common_vendor.p({
|
|
list: list.data,
|
|
mode: "checkbox",
|
|
ids: form.videoId
|
|
}),
|
|
A: common_vendor.sr("select", "f099fe76-2"),
|
|
B: common_vendor.p({
|
|
type: "bottom"
|
|
})
|
|
};
|
|
};
|
|
}
|
|
};
|
|
wx.createPage(_sfc_main);
|