jiuyiUniapp/jiuyi2/unpackage/dist/dev/mp-weixin/pages/news/news.js

135 lines
4.2 KiB
JavaScript
Raw Normal View History

2024-12-18 15:46:27 +08:00
"use strict";
const common_vendor = require("../../common/vendor.js");
const common_assets = require("../../common/assets.js");
const api_video = require("../../api/video.js");
if (!Array) {
const _easycom_footerMenu2 = common_vendor.resolveComponent("footerMenu");
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
(_easycom_footerMenu2 + _easycom_uni_icons2)();
}
const _easycom_footerMenu = () => "../../components/footerMenu/footerMenu.js";
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
if (!Math) {
(noLogin + _easycom_footerMenu + _easycom_uni_icons + common_vendor.unref(apex) + common_vendor.unref(book) + common_vendor.unref(msgList))();
}
const apex = () => "../../components/header/apex.js";
const noLogin = () => "../../components/login/noLogin.js";
const book = () => "../../components/news/book.js";
const msgList = () => "../../components/news/msgList.js";
const _sfc_main = {
__name: "news",
setup(__props) {
const store = common_vendor.useStore();
const menuList = common_vendor.reactive([
{
key: "friend",
name: "朋友列表"
},
{
key: "video",
name: "视讯消息"
}
]);
const menuIndex = common_vendor.ref(0);
const showSearch = common_vendor.ref(false);
const userinfo = common_vendor.computed(() => {
let result = store.state.userinfo;
return result;
});
function handleMenuIndex(index) {
if (menuIndex.value === index)
return;
menuIndex.value = index;
}
function showActionSheet() {
common_vendor.index.showActionSheet({
itemList: ["扫一扫", "添加好友", "发起群聊"],
success: (rs) => {
switch (rs.tapIndex) {
case 0:
common_vendor.index.scanCode({
success: (res) => {
console.log("扫描结果:" + res.result);
getUserInfos(res.result);
},
fail: (err) => {
console.error("扫描失败:" + err);
common_vendor.index.showToast({
title: "扫描失败",
icon: "none"
});
}
});
break;
case 1:
common_vendor.index.navigateTo({
url: "/pages/news/newFriend"
});
break;
case 2:
common_vendor.index.navigateTo({
url: "/pages/news/group-chat/index"
});
break;
}
}
});
}
function getUserInfos(userRecommend) {
api_video.video.getUserInfo({
query: {
userRecommend
}
}).then((rs) => {
console.log(rs);
if (rs.data !== null) {
common_vendor.index.navigateTo({
url: "/pages/index/beInvited?header=" + rs.data.userPortrait + "&userId=" + rs.data.userId + "&userNickname=" + rs.data.userNickname
});
}
});
}
return (_ctx, _cache) => {
return common_vendor.e({
a: !userinfo.value.userId
}, !userinfo.value.userId ? {
b: common_vendor.sr("footerMneuRef", "528cfe9e-1"),
c: common_vendor.p({
page: "news"
})
} : {
d: common_vendor.o$1(showActionSheet),
e: common_vendor.p({
type: "bars",
size: "40rpx"
}),
f: common_vendor.p({
type: "search"
}),
g: showSearch.value ? 1 : "",
h: common_vendor.f(menuList, (item, index, i0) => {
return common_vendor.e({
a: common_vendor.t(item.name),
b: index == 0
}, index == 0 ? {
c: common_assets._imports_0$1
} : {}, {
d: item.key,
e: common_vendor.n(item.key),
f: common_vendor.n({
"active": index === menuIndex.value
}),
g: common_vendor.o$1(($event) => handleMenuIndex(index), item.key)
});
}),
i: menuIndex.value,
j: common_vendor.sr("footerMneuRef", "528cfe9e-8"),
k: common_vendor.p({
page: "news"
})
});
};
}
};
wx.createPage(_sfc_main);