109 lines
3.2 KiB
JavaScript
109 lines
3.2 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 (!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)();
|
|
}
|
|
const _sfc_main = {
|
|
__name: "shareFirend",
|
|
setup(__props, { expose: __expose }) {
|
|
const {
|
|
proxy
|
|
} = common_vendor.getCurrentInstance();
|
|
const userList = common_vendor.reactive([]);
|
|
const videoItem = common_vendor.reactive({});
|
|
const userinfo = common_vendor.computed(() => {
|
|
let result = common_vendor.index.$store.state.userinfo;
|
|
return result;
|
|
});
|
|
common_vendor.onMounted(() => {
|
|
common_vendor.index.$on("login", () => {
|
|
getFriendList();
|
|
});
|
|
common_vendor.index.$on("logout", () => {
|
|
userList.length = 0;
|
|
});
|
|
});
|
|
function getFriendList() {
|
|
api_index.api.video.getFriendList({
|
|
path: [userinfo.value.userId]
|
|
}).then((rs) => {
|
|
if (rs.code == 200) {
|
|
userList.push(...rs.data.map((item) => {
|
|
item.format_userPortrait = common_js_util.util.format_url(item.userPortrait, "img");
|
|
return item;
|
|
}));
|
|
return;
|
|
}
|
|
common_js_util.util.alert({
|
|
content: rs.msg,
|
|
showCancel: false
|
|
});
|
|
});
|
|
}
|
|
function open(item) {
|
|
Object.assign(videoItem, item);
|
|
proxy.$refs.firend.open();
|
|
}
|
|
function close() {
|
|
proxy.$refs.firend.close();
|
|
}
|
|
function handleShare(item) {
|
|
api_index.api.video.videoShare({
|
|
query: {
|
|
// 视频id
|
|
videoId: videoItem.videoId,
|
|
// 分享人id
|
|
sharedUserIds: item.userId
|
|
}
|
|
}).then((rs) => {
|
|
if (rs.code == 200) {
|
|
common_js_util.util.alert("分享成功");
|
|
close();
|
|
return;
|
|
}
|
|
common_js_util.util.alert({
|
|
content: rs.msg,
|
|
showCancel: false
|
|
});
|
|
});
|
|
}
|
|
__expose({
|
|
open,
|
|
close
|
|
});
|
|
return (_ctx, _cache) => {
|
|
return {
|
|
a: common_vendor.p({
|
|
type: "close",
|
|
size: "36rpx",
|
|
color: "#333"
|
|
}),
|
|
b: common_vendor.o$1(($event) => _ctx.$refs.firend.close()),
|
|
c: common_vendor.f(userList, (item, index, i0) => {
|
|
return {
|
|
a: item.format_userPortrait,
|
|
b: common_vendor.t(item.userNickname),
|
|
c: index,
|
|
d: common_vendor.o$1(($event) => handleShare(item), index)
|
|
};
|
|
}),
|
|
d: common_vendor.sr("firend", "ce054705-0"),
|
|
e: common_vendor.p({
|
|
type: "bottom"
|
|
})
|
|
};
|
|
};
|
|
}
|
|
};
|
|
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-ce054705"]]);
|
|
wx.createComponent(Component);
|