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.
37 lines
934 B
37 lines
934 B
"use strict";
|
|
const common_vendor = require("../common/vendor.js");
|
|
const apis_api = require("../apis/api.js");
|
|
function wxLogin() {
|
|
common_vendor.index.login({
|
|
success(res) {
|
|
if (res.code) {
|
|
apis_api.getWxId({
|
|
code: res.code
|
|
}).then((wxInfo) => {
|
|
if (wxInfo.success) {
|
|
common_vendor.index.setStorageSync("token", wxInfo.token);
|
|
common_vendor.index.setStorageSync("id", wxInfo.id);
|
|
} else {
|
|
common_vendor.index.showToast({
|
|
icon: "fail",
|
|
title: "用户信息获取失败!"
|
|
});
|
|
}
|
|
});
|
|
} else {
|
|
common_vendor.index.showToast({
|
|
icon: "fail",
|
|
title: "登录失败!"
|
|
});
|
|
}
|
|
},
|
|
fail() {
|
|
common_vendor.index.showToast({
|
|
icon: "fail",
|
|
title: "登录失败!"
|
|
});
|
|
}
|
|
});
|
|
}
|
|
exports.wxLogin = wxLogin;
|