gree_leran/unpackage/dist/dev/mp-weixin/pages/user/user.js

148 lines
4.9 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
const utils_Auth = require("../../utils/Auth.js");
const comm_api = require("../../comm/api.js");
require("../../utils/http.js");
if (!Array) {
const _easycom_UpdateUserBox2 = common_vendor.resolveComponent("UpdateUserBox");
const _easycom_up_popup2 = common_vendor.resolveComponent("up-popup");
const _easycom_up_avatar2 = common_vendor.resolveComponent("up-avatar");
const _easycom_up_cell2 = common_vendor.resolveComponent("up-cell");
const _easycom_up_list_item2 = common_vendor.resolveComponent("up-list-item");
const _easycom_up_list2 = common_vendor.resolveComponent("up-list");
(_easycom_UpdateUserBox2 + _easycom_up_popup2 + _easycom_up_avatar2 + _easycom_up_cell2 + _easycom_up_list_item2 + _easycom_up_list2)();
}
const _easycom_UpdateUserBox = () => "../../components/UpdateUserBox/UpdateUserBox.js";
const _easycom_up_popup = () => "../../node-modules/uview-plus/components/u-popup/u-popup.js";
const _easycom_up_avatar = () => "../../node-modules/uview-plus/components/u-avatar/u-avatar.js";
const _easycom_up_cell = () => "../../node-modules/uview-plus/components/u-cell/u-cell.js";
const _easycom_up_list_item = () => "../../node-modules/uview-plus/components/u-list-item/u-list-item.js";
const _easycom_up_list = () => "../../node-modules/uview-plus/components/u-list/u-list.js";
if (!Math) {
(_easycom_UpdateUserBox + _easycom_up_popup + _easycom_up_avatar + _easycom_up_cell + _easycom_up_list_item + _easycom_up_list)();
}
const _sfc_main = {
__name: "user",
setup(__props) {
const app = getApp();
const userUtils = common_vendor.ref(app.globalData.utils);
const serviceList = common_vendor.reactive([
{
title: "修改信息",
thumb: "/static/icon_1/renyuan.png",
page: "000"
},
{
title: "我的喜欢",
thumb: "/static/icon_1/aixin.png",
page: "/pages/userLik/userLik"
},
{
title: "我的收藏",
thumb: "/static/icon_1/biaoqian.png",
page: "/pages/ymCollection/ymCollection"
}
// {
// title: "设置中心",
// thumb: '/static/icon/icon_wdszzx.png',
// page: "/pages/user/setting"
// },
]);
const show = common_vendor.ref(false);
const user = common_vendor.ref({
avatar: "/static/icon/tx.png",
nickName: "点击登录"
});
const close = () => {
show.value = false;
};
const open = () => {
show.value = true;
};
async function gologin() {
if (utils_Auth.isLogin()) {
return;
}
let res = await userUtils.value.login();
if (res.code == 200) {
getUserInfo();
} else {
common_vendor.index.showToast({
icon: "none",
title: "登录失败,请检查网络"
});
}
}
async function getUserInfo() {
const resp = await comm_api.userInfo();
user.value = resp.data;
}
const updata = () => {
getUserInfo();
close();
};
const goToYm = (e) => {
if (e.page == "000") {
open();
return;
}
common_vendor.index.navigateTo({
url: e.page,
fail: () => {
common_vendor.index.switchTab({
url: e.page,
fail: (err) => {
console.error("导航失败:", err);
}
});
}
});
};
common_vendor.onShow(() => {
getUserInfo();
});
common_vendor.onLoad(() => {
});
return (_ctx, _cache) => {
return {
a: common_vendor.o(updata),
b: common_vendor.o(close),
c: common_vendor.o(open),
d: common_vendor.p({
show: show.value,
mode: "bottom",
round: 10,
bgColor: "#A8E6CF"
}),
e: user.value.profilePicture || "/static/icon/tx.png",
f: common_vendor.t(user.value.username),
g: common_vendor.t(user.value.phoneNumber),
h: common_vendor.o(gologin),
i: common_vendor.f(serviceList, (item, index, i0) => {
return {
a: "0f7520f0-5-" + i0 + "," + ("0f7520f0-4-" + i0),
b: common_vendor.p({
shape: "square",
size: "35",
src: item.thumb,
customStyle: "margin: -3px 5px -3px 0"
}),
c: common_vendor.o(($event) => goToYm(item), index),
d: "0f7520f0-4-" + i0 + "," + ("0f7520f0-3-" + i0),
e: common_vendor.p({
title: item.title
}),
f: index,
g: "0f7520f0-3-" + i0 + ",0f7520f0-2"
};
}),
j: common_vendor.p({
scrollable: false
})
};
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-0f7520f0"], ["__file", "D:/uniapp1/gree_leran/pages/user/user.vue"]]);
wx.createPage(MiniProgramPage);