123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- "use strict";
- const common_vendor = require("../../common/vendor.js");
- const api_login = require("../../api/login.js");
- const common_assets = require("../../common/assets.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: "请输入帐号",
- icon: "none"
- });
- return;
- }
- if (this.$isEmpty(this.password)) {
- common_vendor.index.showToast({
- title: "请输入密码",
- icon: "none"
- });
- return;
- }
- if (this.password != this.password1) {
- common_vendor.index.showToast({
- title: "两次密码输入不一致",
- icon: "none"
- });
- }
- if (!this.agree) {
- common_vendor.index.showToast({
- title: "请同意相关协议",
- icon: "none"
- });
- return;
- }
- var data = {
- phone: this.userName,
- password: this.password
- // jpushId: this.registrationID || uni.getStorageSync("registrationID"),
- // loginType: 1
- };
- common_vendor.index.showLoading({
- title: "注册中..."
- });
- api_login.register(data).then(
- (res) => {
- if (res.code == 200) {
- console.log("注册好了");
- 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,
- // jpushId: this.registrationID || uni.getStorageSync("registrationID"),
- 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: common_assets._imports_0$4,
- i: !$data.agree,
- j: common_assets._imports_1$2,
- k: $data.agree,
- l: common_vendor.o((...args) => $options.handleAgree && $options.handleAgree(...args)),
- m: common_vendor.o(($event) => $options.goToWeb(0)),
- n: common_vendor.o(($event) => $options.goToWeb(1))
- };
- }
- const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
- wx.createPage(MiniProgramPage);
|