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

148 lines
4.9 KiB
JavaScript
Raw Normal View History

2024-06-14 01:11:29 +00:00
"use strict";
const common_vendor = require("../../common/vendor.js");
2024-06-16 01:04:56 +00:00
const utils_Auth = require("../../utils/Auth.js");
const comm_api = require("../../comm/api.js");
2024-06-16 23:47:03 +00:00
require("../../utils/http.js");
2024-06-14 01:11:29 +00:00
if (!Array) {
2024-06-22 07:20:39 +00:00
const _easycom_UpdateUserBox2 = common_vendor.resolveComponent("UpdateUserBox");
const _easycom_up_popup2 = common_vendor.resolveComponent("up-popup");
2024-06-14 01:11:29 +00:00
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");
2024-06-22 07:20:39 +00:00
(_easycom_UpdateUserBox2 + _easycom_up_popup2 + _easycom_up_avatar2 + _easycom_up_cell2 + _easycom_up_list_item2 + _easycom_up_list2)();
2024-06-14 01:11:29 +00:00
}
2024-06-22 07:20:39 +00:00
const _easycom_UpdateUserBox = () => "../../components/UpdateUserBox/UpdateUserBox.js";
const _easycom_up_popup = () => "../../node-modules/uview-plus/components/u-popup/u-popup.js";
2024-06-14 01:11:29 +00:00
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) {
2024-06-22 07:20:39 +00:00
(_easycom_UpdateUserBox + _easycom_up_popup + _easycom_up_avatar + _easycom_up_cell + _easycom_up_list_item + _easycom_up_list)();
2024-06-14 01:11:29 +00:00
}
const _sfc_main = {
__name: "user",
setup(__props) {
2024-06-20 15:36:19 +00:00
const app = getApp();
const userUtils = common_vendor.ref(app.globalData.utils);
2024-06-14 01:11:29 +00:00
const serviceList = common_vendor.reactive([
{
2024-06-22 07:20:39 +00:00
title: "修改信息",
thumb: "/static/icon_1/renyuan.png",
page: "000"
2024-06-14 01:11:29 +00:00
},
{
2024-06-22 07:20:39 +00:00
title: "我的喜欢",
thumb: "/static/icon_1/aixin.png",
page: "/pages/userLik/userLik"
},
{
title: "我的收藏",
thumb: "/static/icon_1/biaoqian.png",
page: "/pages/ymCollection/ymCollection"
2024-06-14 01:11:29 +00:00
}
2024-06-22 07:20:39 +00:00
// {
// title: "设置中心",
// thumb: '/static/icon/icon_wdszzx.png',
// page: "/pages/user/setting"
// },
2024-06-14 01:11:29 +00:00
]);
2024-06-22 07:20:39 +00:00
const show = common_vendor.ref(false);
2024-06-14 01:11:29 +00:00
const user = common_vendor.ref({
avatar: "/static/icon/tx.png",
nickName: "点击登录"
});
2024-06-22 07:20:39 +00:00
const close = () => {
show.value = false;
};
const open = () => {
show.value = true;
};
2024-06-20 15:36:19 +00:00
async function gologin() {
2024-06-16 01:04:56 +00:00
if (utils_Auth.isLogin()) {
return;
}
2024-06-22 07:20:39 +00:00
let res = await userUtils.value.login();
if (res.code == 200) {
getUserInfo();
} else {
common_vendor.index.showToast({
icon: "none",
title: "登录失败,请检查网络"
});
}
2024-06-16 01:04:56 +00:00
}
async function getUserInfo() {
const resp = await comm_api.userInfo();
user.value = resp.data;
}
2024-06-22 07:20:39 +00:00
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);
}
});
}
});
};
2024-06-16 01:04:56 +00:00
common_vendor.onShow(() => {
getUserInfo();
});
2024-06-14 01:11:29 +00:00
common_vendor.onLoad(() => {
});
return (_ctx, _cache) => {
return {
2024-06-22 07:20:39 +00:00
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) => {
2024-06-14 01:11:29 +00:00
return {
2024-06-22 07:20:39 +00:00
a: "0f7520f0-5-" + i0 + "," + ("0f7520f0-4-" + i0),
2024-06-14 01:11:29 +00:00
b: common_vendor.p({
shape: "square",
size: "35",
src: item.thumb,
customStyle: "margin: -3px 5px -3px 0"
}),
2024-06-22 07:20:39 +00:00
c: common_vendor.o(($event) => goToYm(item), index),
d: "0f7520f0-4-" + i0 + "," + ("0f7520f0-3-" + i0),
e: common_vendor.p({
2024-06-14 01:11:29 +00:00
title: item.title
}),
2024-06-22 07:20:39 +00:00
f: index,
g: "0f7520f0-3-" + i0 + ",0f7520f0-2"
2024-06-14 01:11:29 +00:00
};
}),
2024-06-22 07:20:39 +00:00
j: common_vendor.p({
2024-06-14 01:11:29 +00:00
scrollable: false
})
};
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-0f7520f0"], ["__file", "D:/uniapp1/gree_leran/pages/user/user.vue"]]);
2024-06-14 01:11:29 +00:00
wx.createPage(MiniProgramPage);