"use strict"; var common_vendor = require("../../common/vendor.js"); var api_login = require("../../api/login.js"); require("../../common/request.js"); const _sfc_main = { components: {}, data() { return { userName: "", password: "", password1: "", registrationID: "", yzcode: "", aback: true, agree: false }; }, onLoad(option) { let that = this; common_vendor.index.$on("getRegistrationID", function(data) { that.registrationID = data; }); }, onShow() { this.$getRegistrationID(); }, onUnload() { common_vendor.index.$off("getRegistrationID"); }, mounted() { }, methods: { doRegister() { if (this.$isEmpty(this.userName)) { common_vendor.index.showToast({ title: "\u8BF7\u8F93\u5165\u5E10\u53F7", icon: "none" }); return; } if (this.$isEmpty(this.password)) { common_vendor.index.showToast({ title: "\u8BF7\u8F93\u5165\u5BC6\u7801", icon: "none" }); return; } if (this.password != this.password1) { common_vendor.index.showToast({ title: "\u4E24\u6B21\u5BC6\u7801\u8F93\u5165\u4E0D\u4E00\u81F4", icon: "none" }); } if (!this.agree) { common_vendor.index.showToast({ title: "\u8BF7\u540C\u610F\u76F8\u5173\u534F\u8BAE", icon: "none" }); return; } var data = { phone: this.userName, password: this.password }; common_vendor.index.showLoading({ title: "\u6CE8\u518C\u4E2D..." }); api_login.register(data).then((res) => { if (res.code == 200) { console.log("\u6CE8\u518C\u597D\u4E86"); this.doLogin(); } else { common_vendor.index.hideLoading(); common_vendor.index.showToast({ title: res.msg, icon: "none" }); } }, (rej) => { }); }, doLogin() { var data = { phone: this.userName, password: this.password, loginType: 1 }; api_login.loginByApp(data).then((res) => { common_vendor.index.hideLoading(); if (res.code == 200) { common_vendor.index.setStorageSync("AppToken", res.token); common_vendor.index.setStorageSync("userInfo", JSON.stringify(res.user)); common_vendor.index.$emit("refreshIM"); common_vendor.index.$emit("showHealthButler"); common_vendor.index.reLaunch({ url: "/pages/list/index", animationType: "pop-in", animationDuration: 100 }); } else { common_vendor.index.showToast({ title: res.msg, icon: "none" }); } }, (rej) => { }); }, getRegistrationID() { }, handleAgree() { this.agree = !this.agree; }, goToWeb(index) { common_vendor.index.setStorageSync("url", index == 0 ? "https://userapp.his.cdwjyyh.com/web/userAgreement" : "https://userapp.his.cdwjyyh.com/web/privacyPolicy"); common_vendor.index.navigateTo({ url: "/pages/index/h5" }); } } }; function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return { a: $data.userName, b: common_vendor.o(($event) => $data.userName = $event.detail.value), c: $data.password, d: common_vendor.o(($event) => $data.password = $event.detail.value), e: $data.password1, f: common_vendor.o(($event) => $data.password1 = $event.detail.value), g: common_vendor.o((...args) => $options.doRegister && $options.doRegister(...args)), h: !$data.agree, i: $data.agree, j: common_vendor.o((...args) => $options.handleAgree && $options.handleAgree(...args)), k: common_vendor.o(($event) => $options.goToWeb(0)), l: common_vendor.o(($event) => $options.goToWeb(1)) }; } var MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "C:/Users/Administrator/Desktop/\u9879\u76EE/\u76F4\u64AD/liveH5-v3/pages/auth/register.vue"]]); wx.createPage(MiniProgramPage);