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

49 lines
1.4 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
const store_index = require("../../store/index.js");
const api_index = require("../../api/index.js");
require("../../api/request.js");
require("../../config/index.js");
const _sfc_main = {
__name: "index",
setup(__props) {
store_index.useStore();
function getPhoneNumber(e) {
console.log(e);
getAccess_token({ code: e.detail.code });
}
async function getAccess_token(params = {}) {
const data = {
username: params.code,
//手机号按钮获取的code
type: "wechat_mini_app",
identity: "user",
password: "111"
};
await api_index.API.getToken(data);
wx_login();
}
async function wx_login(token_res) {
let res = await new Promise((resolve) => {
common_vendor.index.login({
provider: "weixin",
//使用微信登录
success: function(loginRes) {
resolve(loginRes);
console.log(loginRes, "微信登录返回信息");
}
});
});
let userId = "";
await api_index.API.wx_login({ code: res.code }, userId);
}
return (_ctx, _cache) => {
return {
a: common_vendor.o(getPhoneNumber)
};
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "F:/项目2023/视力表/vision-record/pages/user/index.vue"]]);
wx.createPage(MiniProgramPage);