diff --git a/src/app.ts b/src/app.ts index 692cd1f..653c521 100644 --- a/src/app.ts +++ b/src/app.ts @@ -1,41 +1,41 @@ -import component from "@/utils/component"; -import relativeTime from "@/utils/dayjs/relativeTime.js"; -import page from "@/utils/page"; -import { request } from "@/utils/request"; -import { parseScene } from "./utils/util"; +import component from '@/utils/component'; +import relativeTime from '@/utils/dayjs/relativeTime.js'; +import page from '@/utils/page'; +import { request } from '@/utils/request'; +import { parseScene } from './utils/util'; -wx.WebIM = require("@/utils/webIM/WebIM.js").default; +wx.WebIM = require('@/utils/webIM/WebIM.js').default; -const dayjs = require("dayjs"); -const licia = require("miniprogram-licia"); +const dayjs = require('dayjs'); +const licia = require('miniprogram-licia'); -require("/utils/dayjs/day-zh-cn.js"); +require('/utils/dayjs/day-zh-cn.js'); -dayjs.locale("zh-cn"); // 全局使用 +dayjs.locale('zh-cn'); // 全局使用 dayjs.extend(relativeTime); App({ globalData: { // 测试号 wx2b0bb13edf717c1d // dev - // appid:wxaae50c206446a964 - url: "https://m.takeda.hbraas.com", - upFileUrl: "https://m.takeda.hbraas.com/", - imageUrl: "https://m.takeda.hbraas.com/wt/", + // appid:wx2b0bb13edf717c1d + url: 'https://m.shizhong.hbraas.com', + upFileUrl: 'https://m.shizhong.hbraas.com/', + imageUrl: 'https://m.shizhong.hbraas.com/shizhong/', // pro // appid:wx1e025040096c7e1d - // url: 'https://m.raredheart.hbsaas.com', - // upFileUrl: 'https://m.raredheart.hbsaas.com/', - // imageUrl: 'https://m.raredheart.hbsaas.com/wt/', + // url: 'https://m.shizhong.hbsaas.com', + // upFileUrl: 'https://m.shizhong.hbsaas.com/', + // imageUrl: 'https://m.shizhong.hbsaas.com/wt/', - loginState: "", + loginState: '', isLogin: 0, doctorId: null, scene: null, - needDeal: "", - caseNav: "0", + needDeal: '', + caseNav: '0', }, onLaunch() { Page = page as WechatMiniprogram.Page.Constructor; @@ -43,21 +43,20 @@ App({ wx.ajax = licia.curry(request)({ gUrl: this.globalData.url }); - // wx.login({ - // success: (res) => { - // wx.ajax({ - // method: "GET", - // url: "?r=takeda/user/init-login", - // data: { - // code: res.code, - // }, - // }).then((res) => { - // this.globalData.loginState = res.loginState; - // this.globalData.isLogin = res.isLogin; - // this.globalData.doctorId = res.doctorId; - // }); - // }, - // }); + wx.login({ + success: (res) => { + wx.ajax({ + method: 'GET', + url: '?r=shizhong/user/init-login', + data: { + code: res.code, + }, + }).then((res) => { + this.globalData.loginState = res.loginState; + this.globalData.isLogin = res.isLogin; + }); + }, + }); wx.setInnerAudioOption({ obeyMuteSwitch: false, @@ -68,7 +67,6 @@ App({ if (options.query.scene) { this.globalData.scene = parseScene(options.query.scene); } - // this.startLogin(); }, waitLogin(waitLoginState = false) { let time: number; @@ -79,16 +77,15 @@ App({ if (waitLoginState) { resolve(true); } else if (this.globalData.isLogin === 0) { - reject(new Error("未登录")); - wx.reLaunch({ url: "/module1/pages/login/index" }); + wx.reLaunch({ url: '/module1/pages/login/index' }); } else if (this.globalData.doctorId === null) { this.getApplyDoctor().then((applyDoctorInfo) => { if (applyDoctorInfo.AuditStatus === 0) { - wx.reLaunch({ url: "/module1/pages/setInfoResult/index" }); - reject(new Error("还在审核中")); + wx.reLaunch({ url: '/module1/pages/setInfoResult/index' }); + reject(new Error('还在审核中')); } else { - wx.reLaunch({ url: "/module1/pages/setInfo/index" }); - reject(new Error("还不是医生")); + wx.reLaunch({ url: '/module1/pages/setInfo/index' }); + reject(new Error('还不是医生')); } }); } else { @@ -100,14 +97,14 @@ App({ }, getApplyDoctor() { return wx.ajax({ - method: "GET", - url: "?r=takeda/reg/get-apply-doctor", + method: 'GET', + url: '?r=takeda/reg/get-apply-doctor', }); }, getUserInfo(self: WechatMiniprogram.Page.Instance, callback?: (res: any) => void) { wx.ajax({ - method: "GET", - url: "?r=takeda/account/info", + method: 'GET', + url: '?r=shizhong/account/info', data: {}, }).then((res) => { self.setData({ diff --git a/src/pages/login/index.ts b/src/pages/login/index.ts index 278a5dd..49394a1 100644 --- a/src/pages/login/index.ts +++ b/src/pages/login/index.ts @@ -3,7 +3,7 @@ let timer: number | null = 0; Page({ data: { - show: true, + show: false, menuButtonInfo: {}, mobile: '', @@ -32,7 +32,7 @@ Page({ } wx.ajax({ method: 'POST', - url: '?r=takeda/login/send-verify-code', + url: '?r=shizhong/login/send-verify-code', data: { mobile, }, @@ -82,7 +82,7 @@ Page({ } wx.ajax({ method: 'POST', - url: '?r=takeda/login/reg-login', + url: '?r=shizhong/login/reg-login', data: { mobile, code, @@ -104,7 +104,7 @@ Page({ if (iv && encryptedData) { wx.ajax({ method: 'POST', - url: '?r=takeda/login/wx-reg-login', + url: '?r=shizhong/login/wx-reg-login', data: { iv: encodeURIComponent(iv), encryptedData: encodeURIComponent(encryptedData),