40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
|
|
"use strict";
|
||
|
|
const common_vendor = require("../vendor.js");
|
||
|
|
require("./request.js");
|
||
|
|
const common_store_useWeAppAuthStore = require("../store/useWeAppAuthStore.js");
|
||
|
|
const auth = common_store_useWeAppAuthStore.useWeAppAuthStore();
|
||
|
|
const useUser = {
|
||
|
|
onBindPhone() {
|
||
|
|
var _a;
|
||
|
|
console.log("auth?.userInfo:", auth == null ? void 0 : auth.data);
|
||
|
|
if (!((_a = auth == null ? void 0 : auth.data) == null ? void 0 : _a.user)) {
|
||
|
|
common_vendor.index.showModal({
|
||
|
|
title: "登录",
|
||
|
|
content: "请先登录体验更多功能!",
|
||
|
|
success: function(res) {
|
||
|
|
if (res.confirm) {
|
||
|
|
common_vendor.index.navigateTo({
|
||
|
|
url: "/pages/login"
|
||
|
|
});
|
||
|
|
console.log("用户点击确定");
|
||
|
|
} else if (res.cancel) {
|
||
|
|
console.log("用户点击取消");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
});
|
||
|
|
return false;
|
||
|
|
} else {
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
},
|
||
|
|
getLoginStatus() {
|
||
|
|
var _a;
|
||
|
|
if (!((_a = auth == null ? void 0 : auth.data) == null ? void 0 : _a.user)) {
|
||
|
|
return false;
|
||
|
|
} else {
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
};
|
||
|
|
exports.useUser = useUser;
|