253 lines
7.8 KiB
JavaScript
253 lines
7.8 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");
|
|
const utils_msgtype = require("../../utils/msgtype.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 + apex + videoMenu + _easycom_uni_popup)();
|
|
}
|
|
const apex = () => "../../components/header/apex.js";
|
|
const videoMenu = () => "../../components/index/videoMenu.js";
|
|
const _sfc_main = {
|
|
__name: "videoHome",
|
|
setup(__props) {
|
|
const {
|
|
proxy
|
|
} = common_vendor.getCurrentInstance();
|
|
const store = common_vendor.useStore();
|
|
const scrollTop = common_vendor.ref(false);
|
|
const userId = common_vendor.ref("");
|
|
const detail = common_vendor.reactive({});
|
|
const listProperty = common_vendor.reactive({
|
|
data: [],
|
|
pageSize: 9,
|
|
pageNum: 1,
|
|
total: 0
|
|
});
|
|
let userinfo = common_vendor.computed(() => {
|
|
let result = store.state.userinfo;
|
|
return result;
|
|
});
|
|
common_vendor.onLoad((option) => {
|
|
if (option.userId)
|
|
userId.value = option.userId;
|
|
getUserinfo();
|
|
getList();
|
|
});
|
|
common_vendor.onHide(() => {
|
|
proxy.$refs.videoMenuRef.pause();
|
|
});
|
|
common_vendor.onPageScroll((ev) => {
|
|
scrollTop.value = ev.scrollTop > 44 ? true : false;
|
|
});
|
|
common_vendor.onReachBottom(() => {
|
|
getMoreList();
|
|
});
|
|
function getUserinfo() {
|
|
api_index.api.video.getUserInfo({
|
|
query: {
|
|
userId: userId.value
|
|
}
|
|
}).then((rs) => {
|
|
if (rs.code == 200) {
|
|
console.log("userinfo", rs);
|
|
const result = rs.data;
|
|
result.userPortrait = common_js_util.util.format_url(result.userPortrait, "img");
|
|
result.background = common_js_util.util.format_url(result.background, "img");
|
|
Object.assign(detail, result);
|
|
return;
|
|
}
|
|
common_js_util.util.alert({
|
|
content: rs.msg,
|
|
showCancel: false
|
|
});
|
|
});
|
|
}
|
|
function getMoreList() {
|
|
if (listProperty.total <= listProperty.data.length)
|
|
return;
|
|
listProperty.pageNum++;
|
|
getList();
|
|
}
|
|
function getList() {
|
|
api_index.api.video.myVideoList({
|
|
query: {
|
|
// 0正常1草稿 不传查全部
|
|
isDraft: 0,
|
|
// 人员id
|
|
userId: userId.value,
|
|
pageSize: listProperty.pageSize,
|
|
pageNum: listProperty.pageNum
|
|
}
|
|
}).then((rs) => {
|
|
if (rs.code == 200) {
|
|
if (listProperty.pageNum == 1)
|
|
listProperty.data.length = 0;
|
|
listProperty.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;
|
|
}));
|
|
listProperty.total = rs.total;
|
|
return;
|
|
}
|
|
common_js_util.util.alert({
|
|
content: rs.msg,
|
|
showCancel: false
|
|
});
|
|
});
|
|
}
|
|
function handleReport() {
|
|
proxy.$refs.menuRef.close();
|
|
common_vendor.index.showActionSheet({
|
|
itemList: ["举报"]
|
|
}).then((rs) => {
|
|
const index = rs.tapIndex;
|
|
if (index == 0) {
|
|
common_vendor.index.navigateTo({
|
|
url: "/pages/index/report"
|
|
});
|
|
}
|
|
});
|
|
}
|
|
function handleCopyAccount() {
|
|
common_vendor.index.setClipboardData({
|
|
data: detail.userAccount,
|
|
showToast: false,
|
|
success: (rs) => {
|
|
common_js_util.util.alert("复制成功");
|
|
}
|
|
});
|
|
}
|
|
function handleAttention() {
|
|
api_index.api.video.attention({
|
|
path: [detail.isAttention ? 0 : 1],
|
|
data: {
|
|
// 当前用户id
|
|
userId: userinfo.value.userId,
|
|
// 被关注id
|
|
attentionId: detail.userId,
|
|
// 来源
|
|
attentionSource: 1
|
|
}
|
|
}).then((rs) => {
|
|
if (rs.code == 200) {
|
|
detail.isAttention = !detail.isAttention;
|
|
getUserinfo();
|
|
common_vendor.index.$emit("focusUser", {
|
|
userId: detail.userId,
|
|
result: detail.isAttention
|
|
});
|
|
return;
|
|
}
|
|
common_js_util.util.alert({
|
|
content: rs.msg,
|
|
showCancel: false
|
|
});
|
|
});
|
|
}
|
|
function handleBlock() {
|
|
detail.isBlock = !detail.isBlock;
|
|
api_index.api.video.videoBlock({
|
|
query: {
|
|
type: detail.isBlock ? 0 : 1,
|
|
userId: detail.userId
|
|
}
|
|
}).then((rs) => {
|
|
if (rs.code == 200) {
|
|
return;
|
|
}
|
|
detail.isBlock = !detail.isBlock;
|
|
common_js_util.util.alert({
|
|
content: rs.msg,
|
|
showCancel: false
|
|
});
|
|
});
|
|
}
|
|
function handleMessage() {
|
|
common_vendor.index.setStorageSync("toUser", {
|
|
...detail,
|
|
msgType: utils_msgtype.msgType.chatType.SINGLE_CHAT
|
|
});
|
|
common_vendor.index.navigateTo({
|
|
url: common_js_util.util.setUrl("/pages/news/question-answer/index", {
|
|
userNickname: detail.userNickname
|
|
})
|
|
});
|
|
}
|
|
return (_ctx, _cache) => {
|
|
return common_vendor.e({
|
|
a: detail.background,
|
|
b: scrollTop.value
|
|
}, scrollTop.value ? {
|
|
c: common_vendor.t(detail.userNickname)
|
|
} : {}, {
|
|
d: common_vendor.p({
|
|
type: "bars",
|
|
size: "50rpx",
|
|
color: scrollTop.value ? "#333" : "#fff"
|
|
}),
|
|
e: common_vendor.o$1(($event) => _ctx.$refs.menuRef.open()),
|
|
f: common_vendor.p({
|
|
bgColor: scrollTop.value ? "#fff" : "#fff0",
|
|
color: scrollTop.value ? "#333" : "#fff"
|
|
}),
|
|
g: detail.userPortrait,
|
|
h: common_vendor.t(detail.userNickname),
|
|
i: common_vendor.t(detail.userAccount)
|
|
}, {}, {
|
|
k: common_vendor.t(detail.userFans),
|
|
l: common_vendor.t(detail.userAttention),
|
|
m: common_vendor.t(detail.userBrief),
|
|
n: detail.isShop == 1 && 0
|
|
}, detail.isShop == 1 && 0 ? {
|
|
o: common_assets._imports_0$5
|
|
} : {}, {
|
|
p: detail.isAttention
|
|
}, detail.isAttention ? {
|
|
q: common_vendor.o$1(handleAttention),
|
|
r: common_vendor.o$1(handleMessage)
|
|
} : {
|
|
s: common_vendor.o$1(handleAttention)
|
|
}, {
|
|
t: common_vendor.t(listProperty.total),
|
|
v: common_vendor.sr("videoMenuRef", "228a649f-2"),
|
|
w: common_vendor.p({
|
|
list: listProperty.data
|
|
}),
|
|
x: common_vendor.t(detail.userNickname),
|
|
y: common_vendor.t(detail.userAccount),
|
|
z: common_assets._imports_1$2,
|
|
A: common_vendor.o$1(handleCopyAccount),
|
|
B: common_vendor.p({
|
|
type: "close",
|
|
size: "40rpx"
|
|
}),
|
|
C: common_vendor.o$1(($event) => _ctx.$refs.menuRef.close()),
|
|
D: common_assets._imports_2$3,
|
|
E: common_assets._imports_3$1,
|
|
F: common_vendor.o$1(handleReport),
|
|
G: common_assets._imports_4,
|
|
H: common_vendor.o$1((...args) => _ctx.handleBlack && _ctx.handleBlack(...args))
|
|
}, {}, {
|
|
I: detail.isBlock,
|
|
J: common_vendor.o$1(handleBlock),
|
|
K: common_vendor.sr("menuRef", "228a649f-3"),
|
|
L: common_vendor.p({
|
|
type: "bottom"
|
|
})
|
|
});
|
|
};
|
|
}
|
|
};
|
|
_sfc_main.__runtimeHooks = 1;
|
|
wx.createPage(_sfc_main);
|