223 lines
7.2 KiB
JavaScript
223 lines
7.2 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");
|
||
|
if (!Array) {
|
||
|
const _easycom_footerMenu2 = common_vendor.resolveComponent("footerMenu");
|
||
|
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
|
||
|
const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
|
||
|
(_easycom_footerMenu2 + _easycom_uni_icons2 + _easycom_uni_popup2)();
|
||
|
}
|
||
|
const _easycom_footerMenu = () => "../../components/footerMenu/footerMenu.js";
|
||
|
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) {
|
||
|
(common_vendor.unref(noLogin) + _easycom_footerMenu + statusBar + _easycom_uni_icons + product + like + collectList + collectAdd + _easycom_uni_popup)();
|
||
|
}
|
||
|
const statusBar = () => "../../components/header/statusBar.js";
|
||
|
const noLogin = () => "../../components/login/noLogin.js";
|
||
|
const collectList = () => "../../components/index/collectList.js";
|
||
|
const collectAdd = () => "../../components/index/collectAdd.js";
|
||
|
const product = () => "../../components/mine/product.js";
|
||
|
const like = () => "../../components/mine/like.js";
|
||
|
const _sfc_main = {
|
||
|
__name: "homepage",
|
||
|
setup(__props) {
|
||
|
const {
|
||
|
proxy
|
||
|
} = common_vendor.getCurrentInstance();
|
||
|
const store = common_vendor.useStore();
|
||
|
const headerShow = common_vendor.ref(false);
|
||
|
const tabList = common_vendor.reactive([
|
||
|
{
|
||
|
name: "作品",
|
||
|
ref: "productRef"
|
||
|
},
|
||
|
{
|
||
|
name: "喜欢",
|
||
|
ref: "likeRef"
|
||
|
},
|
||
|
{
|
||
|
name: "收藏",
|
||
|
ref: "collectRef"
|
||
|
}
|
||
|
// {
|
||
|
// name: '历史',
|
||
|
// }
|
||
|
]);
|
||
|
const tabIndex = common_vendor.ref(0);
|
||
|
common_vendor.computed(() => {
|
||
|
let result = tabList[tabIndex.value];
|
||
|
return result;
|
||
|
});
|
||
|
const userinfo = common_vendor.computed(() => {
|
||
|
let result = store.state.userinfo || {};
|
||
|
return result;
|
||
|
});
|
||
|
common_vendor.onLoad(() => {
|
||
|
common_vendor.index.$on("focusUser", () => {
|
||
|
common_js_util.util.getUserinfo();
|
||
|
});
|
||
|
});
|
||
|
common_vendor.onReady(() => {
|
||
|
});
|
||
|
common_vendor.onUnload(() => {
|
||
|
common_vendor.index.$off("focusUser");
|
||
|
});
|
||
|
common_vendor.onPageScroll((ev) => {
|
||
|
headerShow.value = ev.scrollTop > 44 ? true : false;
|
||
|
});
|
||
|
common_vendor.onReachBottom(() => {
|
||
|
if (tabIndex.value === 2)
|
||
|
proxy.$refs.collectRef.getMoreList();
|
||
|
});
|
||
|
function handleTabIndex(index) {
|
||
|
if (tabIndex.value === index)
|
||
|
return;
|
||
|
tabIndex.value = index;
|
||
|
}
|
||
|
function handleCollectsItem(item) {
|
||
|
common_vendor.index.navigateTo({
|
||
|
url: common_js_util.util.setUrl("/pages/mine/collectsVideo", {
|
||
|
collectId: item.id,
|
||
|
collectName: item.collectName
|
||
|
})
|
||
|
});
|
||
|
}
|
||
|
function getUserInfos(userRecommend) {
|
||
|
videoApi.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
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
function scanQRCode() {
|
||
|
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"
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
function navigateToPage(path) {
|
||
|
common_vendor.index.navigateTo({
|
||
|
url: path
|
||
|
});
|
||
|
}
|
||
|
function handleLogout() {
|
||
|
common_js_util.util.alert({
|
||
|
content: "确认退出登录吗?"
|
||
|
}).then((rs) => {
|
||
|
if (!rs.confirm)
|
||
|
return;
|
||
|
proxy.$refs.menuRef.close();
|
||
|
common_js_util.util.logout();
|
||
|
});
|
||
|
}
|
||
|
return (_ctx, _cache) => {
|
||
|
return common_vendor.e({
|
||
|
a: !userinfo.value.userId
|
||
|
}, !userinfo.value.userId ? {
|
||
|
b: common_vendor.sr("footerMneuRef", "1ff87868-1"),
|
||
|
c: common_vendor.p({
|
||
|
page: "mine"
|
||
|
})
|
||
|
} : common_vendor.e({
|
||
|
d: userinfo.value.background,
|
||
|
e: common_vendor.p({
|
||
|
type: "scan",
|
||
|
size: "50rpx",
|
||
|
color: "#fff"
|
||
|
}),
|
||
|
f: common_vendor.o$1(scanQRCode),
|
||
|
g: common_vendor.t(userinfo.value.userNickname),
|
||
|
h: common_vendor.p({
|
||
|
type: "bars",
|
||
|
size: "50rpx",
|
||
|
color: "#fff"
|
||
|
}),
|
||
|
i: common_vendor.o$1(($event) => _ctx.$refs.menuRef.open()),
|
||
|
j: userinfo.value.userPortrait,
|
||
|
k: userinfo.value.isShop == 1
|
||
|
}, userinfo.value.isShop == 1 ? {
|
||
|
l: common_assets._imports_0$3
|
||
|
} : {}, {
|
||
|
m: common_vendor.t(userinfo.value.userNickname),
|
||
|
n: common_vendor.t(userinfo.value.userAccount),
|
||
|
o: userinfo.value.isShop == 1
|
||
|
}, userinfo.value.isShop == 1 ? {
|
||
|
p: common_vendor.p({
|
||
|
type: "shop",
|
||
|
color: "",
|
||
|
size: "60rpx"
|
||
|
})
|
||
|
} : {}, {
|
||
|
q: headerShow.value ? 1 : "",
|
||
|
r: common_vendor.t(userinfo.value.userPraised),
|
||
|
s: common_vendor.t(userinfo.value.userAttention),
|
||
|
t: common_vendor.o$1(($event) => navigateToPage("/pages/news/newAttention")),
|
||
|
v: common_vendor.t(userinfo.value.userFans),
|
||
|
w: common_vendor.o$1(($event) => navigateToPage("/pages/news/newFans"))
|
||
|
}, {}, {
|
||
|
x: common_vendor.t(userinfo.value.userBrief || "暂无个签~"),
|
||
|
y: common_vendor.f(tabList, (item, index, i0) => {
|
||
|
return {
|
||
|
a: common_vendor.t(item.name),
|
||
|
b: tabIndex.value == index ? 1 : "",
|
||
|
c: index,
|
||
|
d: common_vendor.o$1(($event) => handleTabIndex(index), index)
|
||
|
};
|
||
|
}),
|
||
|
z: common_vendor.sr("productRef", "1ff87868-7"),
|
||
|
A: tabIndex.value === 0,
|
||
|
B: common_vendor.sr("likeRef", "1ff87868-8"),
|
||
|
C: tabIndex.value === 1,
|
||
|
D: common_vendor.p({
|
||
|
type: "plus",
|
||
|
size: "30rpx"
|
||
|
}),
|
||
|
E: common_vendor.o$1(($event) => _ctx.$refs.collectAddRef.open()),
|
||
|
F: common_vendor.sr("collectRef", "1ff87868-10"),
|
||
|
G: common_vendor.o$1(handleCollectsItem),
|
||
|
H: tabIndex.value === 2
|
||
|
}, {}, {
|
||
|
L: common_vendor.sr("footerMneuRef", "1ff87868-11"),
|
||
|
M: common_vendor.p({
|
||
|
page: "mine"
|
||
|
})
|
||
|
}), {
|
||
|
N: common_vendor.sr("collectAddRef", "1ff87868-12"),
|
||
|
O: common_vendor.o$1(($event) => _ctx.$refs.menuRef.close()),
|
||
|
P: common_vendor.p({
|
||
|
type: "left",
|
||
|
size: "40rpx"
|
||
|
}),
|
||
|
Q: common_assets._imports_2,
|
||
|
R: common_assets._imports_2,
|
||
|
S: common_assets._imports_2,
|
||
|
T: common_vendor.o$1(handleLogout),
|
||
|
U: common_vendor.sr("menuRef", "1ff87868-13"),
|
||
|
V: common_vendor.p({
|
||
|
type: "right"
|
||
|
})
|
||
|
});
|
||
|
};
|
||
|
}
|
||
|
};
|
||
|
_sfc_main.__runtimeHooks = 1;
|
||
|
wx.createPage(_sfc_main);
|