123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- "use strict";
- const common_vendor = require("../../common/vendor.js");
- const common_assets = require("../../common/assets.js");
- const _sfc_main = {
- data() {
- return {
- isAgreed: false
- };
- },
- methods: {
- // 处理协议勾选
- handleAgreementChange(e) {
- this.isAgreed = e.detail.value.length > 0;
- },
- // 微信登录
- async handleWechatLogin() {
- if (!this.isAgreed) {
- common_vendor.index.showToast({
- title: "请先同意服务协议和隐私政策",
- icon: "none"
- });
- return;
- }
- common_vendor.wx$1.login({
- success: function(res) {
- if (res.code) {
- common_vendor.index.__f__("log", "at pages/login/index.vue:79", res.code);
- common_vendor.wx$1.request({
- url: "http://localhost:9527/api/wx-login",
- method: "POST",
- // 设置请求头,指定请求体为 JSON 格式
- header: {
- "content-type": "application/json"
- },
- data: {
- code: res.code
- },
- success: function(response) {
- common_vendor.index.__f__("log", "at pages/login/index.vue:92", response.data);
- },
- fail: function(err) {
- common_vendor.index.__f__("error", "at pages/login/index.vue:95", err);
- }
- });
- } else {
- common_vendor.index.__f__("log", "at pages/login/index.vue:99", "获取 code 失败!" + res.errMsg);
- }
- }
- });
- },
- // // 跳转到密码登录页面
- // navigateToPasswordLogin() {
- // uni.navigateTo({
- // url: '/pages/login/password'
- // })
- // },
- // 跳转到验证码登录页面
- navigateToVerifyCodeLogin() {
- common_vendor.index.navigateTo({
- url: "/pages/login/verify-code"
- });
- },
- // 打开服务协议
- openServiceAgreement() {
- common_vendor.index.navigateTo({
- url: "/pages/agreement/service"
- });
- },
- // 打开隐私政策
- openPrivacyPolicy() {
- common_vendor.index.navigateTo({
- url: "/pages/agreement/privacy"
- });
- }
- }
- };
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
- return {
- a: common_assets._imports_0,
- b: common_vendor.o((...args) => $options.handleWechatLogin && $options.handleWechatLogin(...args)),
- c: common_vendor.o((...args) => $options.navigateToVerifyCodeLogin && $options.navigateToVerifyCodeLogin(...args)),
- d: $data.isAgreed,
- e: common_vendor.o((...args) => $options.openServiceAgreement && $options.openServiceAgreement(...args)),
- f: common_vendor.o((...args) => $options.openPrivacyPolicy && $options.openPrivacyPolicy(...args)),
- g: common_vendor.o((...args) => $options.handleAgreementChange && $options.handleAgreementChange(...args))
- };
- }
- const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
- wx.createPage(MiniProgramPage);
- //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/login/index.js.map
|