233 lines
6.6 KiB
JavaScript
233 lines
6.6 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const common_assets = require("../../common/assets.js");
|
|
const common_js_util = require("../../common/js/util.js");
|
|
const api_index = require("../../api/index.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 + videoMenu + _easycom_uni_popup)();
|
|
}
|
|
const videoMenu = () => "../../components/index/videoMenu.js";
|
|
const _sfc_main = {
|
|
__name: "report",
|
|
setup(__props) {
|
|
const reportList = common_vendor.reactive([
|
|
{
|
|
name: "发布不正当的内容或信息"
|
|
},
|
|
{
|
|
name: "传播涩情资源"
|
|
},
|
|
{
|
|
name: "冒充他人"
|
|
},
|
|
{
|
|
name: "涉嫌诈骗"
|
|
},
|
|
{
|
|
name: "侵犯权益"
|
|
},
|
|
{
|
|
name: "其他"
|
|
}
|
|
]);
|
|
const reportIndex = common_vendor.ref("");
|
|
const form = common_vendor.reactive({
|
|
userId: "",
|
|
videoId: [],
|
|
reason: "",
|
|
context: "",
|
|
pic: []
|
|
});
|
|
const list = common_vendor.reactive({
|
|
data: [],
|
|
pageSize: 10,
|
|
pageNum: 1,
|
|
total: 0
|
|
});
|
|
const videos = common_vendor.computed(() => {
|
|
let result = form.videoId.map((item) => {
|
|
return list.data.find((node) => node.videoId == item) || {};
|
|
});
|
|
return result;
|
|
});
|
|
common_vendor.onLoad((option) => {
|
|
if (option.userId)
|
|
form.userId = option.userId;
|
|
getList();
|
|
});
|
|
function handleReportList(ev) {
|
|
const index = ev.detail.value;
|
|
if (reportIndex.value === index)
|
|
return;
|
|
reportIndex.value = index;
|
|
}
|
|
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 uploadImg() {
|
|
common_js_util.util.upload_image({
|
|
value: form.pic
|
|
});
|
|
}
|
|
function removeMedia(index, key) {
|
|
common_js_util.util.alert({
|
|
content: "确认要删除吗?"
|
|
}).then((rs) => {
|
|
if (rs.confirm)
|
|
form[key].splice(index, 1);
|
|
});
|
|
}
|
|
function handleSubmit() {
|
|
const data = {
|
|
...form
|
|
};
|
|
if (reportIndex == "") {
|
|
common_js_util.util.alert("请选择举报理由");
|
|
return;
|
|
}
|
|
if (!data.context) {
|
|
common_js_util.util.alert("详细描述不能为空");
|
|
return;
|
|
}
|
|
if (data.context.length > 100) {
|
|
common_js_util.util.alert("详细描述自述超过100");
|
|
return;
|
|
}
|
|
if (!data.pic[0]) {
|
|
common_js_util.util.alert("请上传举报图片");
|
|
return;
|
|
}
|
|
if (!data.videoId[0]) {
|
|
common_js_util.util.alert("请选择举报视频");
|
|
return;
|
|
}
|
|
data.reason = reportList[reportIndex.value].name;
|
|
data.pic = data.pic.map((node) => {
|
|
node = common_js_util.util.replace_url("node");
|
|
return node;
|
|
}).join(",");
|
|
data.videoId = data.videoId.join(",");
|
|
api_index.api.video.reportVideo({
|
|
data
|
|
}).then((rs) => {
|
|
if (rs.code == 200) {
|
|
common_js_util.util.alert("举报成功,请等待后台审核");
|
|
setTimeout(() => {
|
|
common_vendor.index.navigateBack();
|
|
}, 500);
|
|
return;
|
|
}
|
|
common_js_util.util.alert({
|
|
content: rs.msg,
|
|
showCancel: false
|
|
});
|
|
});
|
|
}
|
|
return (_ctx, _cache) => {
|
|
return common_vendor.e({
|
|
a: reportList[reportIndex.value]
|
|
}, reportList[reportIndex.value] ? {
|
|
b: common_vendor.t(reportList[reportIndex.value].name)
|
|
} : {}, {
|
|
c: reportList,
|
|
d: common_vendor.o$1(handleReportList),
|
|
e: form.context,
|
|
f: common_vendor.o$1(($event) => form.context = $event.detail.value),
|
|
g: common_vendor.t(form.context.length),
|
|
h: common_assets._imports_0$6,
|
|
i: common_vendor.p({
|
|
type: "plusempty",
|
|
color: "#D8D8D8",
|
|
size: "100rpx"
|
|
}),
|
|
j: common_vendor.o$1(uploadImg),
|
|
k: common_vendor.f(form.pic, (item, index, i0) => {
|
|
return {
|
|
a: item,
|
|
b: common_vendor.o$1(($event) => removeMedia(index, "pic"), index),
|
|
c: "6787f9df-1-" + i0,
|
|
d: index
|
|
};
|
|
}),
|
|
l: common_vendor.p({
|
|
type: "clear",
|
|
size: "30rpx",
|
|
color: "red"
|
|
}),
|
|
m: common_vendor.p({
|
|
type: "plusempty",
|
|
color: "#D8D8D8",
|
|
size: "100rpx"
|
|
}),
|
|
n: common_vendor.o$1(($event) => _ctx.$refs.select.open()),
|
|
o: common_vendor.f(videos.value, (item, index, i0) => {
|
|
return {
|
|
a: item.format_imageUrl,
|
|
b: common_vendor.o$1(($event) => removeMedia(index, "videoId"), index),
|
|
c: "6787f9df-3-" + i0,
|
|
d: index
|
|
};
|
|
}),
|
|
p: common_vendor.p({
|
|
type: "clear",
|
|
size: "30rpx",
|
|
color: "red"
|
|
}),
|
|
q: common_vendor.o$1(handleSubmit),
|
|
r: common_vendor.t(list.total),
|
|
s: common_vendor.p({
|
|
type: "refreshempty",
|
|
color: ""
|
|
}),
|
|
t: common_vendor.o$1(refreshList),
|
|
v: common_vendor.o$1(($event) => form.videoId = $event),
|
|
w: common_vendor.p({
|
|
list: list.data,
|
|
mode: "checkbox",
|
|
ids: form.videoId
|
|
}),
|
|
x: common_vendor.sr("select", "6787f9df-4"),
|
|
y: common_vendor.p({
|
|
type: "bottom"
|
|
})
|
|
});
|
|
};
|
|
}
|
|
};
|
|
wx.createPage(_sfc_main);
|