You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

143 lines
4.5 KiB

2 years ago
"use strict";
const common_vendor = require("../../common/vendor.js");
2 years ago
const api_user = require("../../api/user.js");
require("../../utils/request.js");
require("../../utils/functions.js");
require("../../utils/log.js");
require("../../utils/qqmap-wx-jssdk.min.js");
require("../../config/host.js");
2 years ago
const FooterNav = () => "../../components/FooterNav/Index.js";
const RightNav = () => "../../components/RightNav/Index.js";
const HeaderNav = () => "../../components/HeaderNav/Index.js";
const HomePage = () => "./components/HomePage/Index.js";
const OrderPage = () => "./components/OrderPage/Index.js";
const ChatPage = () => "./components/ChatPage/Index.js";
const UserPage = () => "./components/UserPage/Index.js";
const _sfc_main = {
components: {
FooterNav,
RightNav,
HeaderNav,
HomePage,
OrderPage,
ChatPage,
UserPage
},
data() {
return {
2 years ago
footCheck: "home",
show: false,
title: "标题",
content: "uview-plus的目标是成为uni-app生态最优秀的UI框架"
2 years ago
};
},
onLoad() {
},
methods: {
2 years ago
userLogin() {
api_user.testLogin({
user_id: 1
}).then((res) => {
console.log(res.data);
common_vendor.index.setStorageSync("token", res.data);
this.show = false;
this.getUserDetail();
});
},
getUserDetail() {
api_user.userDetail().then((res) => {
common_vendor.index.setStorageSync("user", res.data);
this.$store.commit("userInfo", res.data);
});
},
getUserExtend() {
api_user.userExtends().then((res) => {
common_vendor.index.setStorageSync("user-extends", res.data);
this.$store.commit("userExtends", res.data);
});
}
2 years ago
// store.
},
onPageScroll(res) {
if (res.scrollTop <= 20) {
common_vendor.index.$emit("isTop", true);
} else {
common_vendor.index.$emit("isTop", false);
}
},
created() {
},
mounted() {
this.title = this.$store.state.title;
2 years ago
let token = common_vendor.index.getStorageSync("token");
let user = common_vendor.index.getStorageSync("user");
let userExtends = common_vendor.index.getStorageSync("user-extends");
if (!token) {
this.show = true;
} else if (!user) {
this.getUserDetail();
} else if (!userExtends) {
this.getUserExtend();
} else {
this.$store.commit("userInfo", user);
this.$store.commit("userExtends", userExtends);
}
2 years ago
},
watch: {
"$store.state.footCheck": {
handler(newVal, oldVal) {
this.footCheck = newVal;
}
},
"$store.state.title": {
handler(newVal, oldVal) {
this.title = newVal;
}
}
}
};
if (!Array) {
const _component_HeaderNav = common_vendor.resolveComponent("HeaderNav");
const _component_HomePage = common_vendor.resolveComponent("HomePage");
const _component_OrderPage = common_vendor.resolveComponent("OrderPage");
const _component_ChatPage = common_vendor.resolveComponent("ChatPage");
const _component_UserPage = common_vendor.resolveComponent("UserPage");
const _component_RightNav = common_vendor.resolveComponent("RightNav");
const _component_FooterNav = common_vendor.resolveComponent("FooterNav");
2 years ago
const _easycom_u_modal2 = common_vendor.resolveComponent("u-modal");
(_component_HeaderNav + _component_HomePage + _component_OrderPage + _component_ChatPage + _component_UserPage + _component_RightNav + _component_FooterNav + _easycom_u_modal2)();
}
const _easycom_u_modal = () => "../../uni_modules/uview-plus/components/u-modal/u-modal.js";
if (!Math) {
_easycom_u_modal();
2 years ago
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: common_vendor.p({
title: $data.title
}),
b: $data.footCheck === "home",
c: $data.footCheck === "home" ? 1 : "",
d: $data.footCheck === "order",
e: $data.footCheck === "order" ? 1 : "",
f: $data.footCheck === "chat",
g: $data.footCheck === "chat" ? 1 : "",
h: $data.footCheck === "user",
2 years ago
i: $data.footCheck === "user" ? 1 : "",
j: common_vendor.o($options.userLogin),
k: common_vendor.o(($event) => {
this.show = false;
}),
l: common_vendor.p({
show: $data.show,
title: "登录",
content: "当前未登录是否前往登录",
closeOnClickOverlay: true,
showCancelButton: true
})
2 years ago
};
}
2 years ago
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "D:/phpstudy_pro/WEB/pet_uni/pages/Index/index.vue"]]);
2 years ago
_sfc_main.__runtimeHooks = 1;
wx.createPage(MiniProgramPage);