diff --git a/README.md b/README.md index 47d9eb5..9e71dd6 100644 --- a/README.md +++ b/README.md @@ -3,13 +3,16 @@ 3. 图像识别模糊 可以反向确认 通过ocr识别接口 接入ocr同时识别不到 姓名,年龄等字样,及判断该病历已被涂抹 + https://pic1.zhimg.com/50/v2-dcfbab1219ae4f7a7a6db168bb1580a2_720w.jpg?source=2c26e567 images svn 地址 svn://39.106.86.127:28386/projects/takeda/proj_src/shop/frontend/web/wt - +(/images/)(\S\*(?=["|'])) +{{imageUrl}}$2?t={{Timestamp}} ui问题 + 1. 首页绑定医生弹窗需要重新切图 2. 播放语音条图片没切 diff --git a/project.config.json b/project.config.json index a1858e5..7b68bcd 100644 --- a/project.config.json +++ b/project.config.json @@ -39,7 +39,20 @@ }, "libVersion": "2.32.3", "packOptions": { - "ignore": [], + "ignore": [ + { + "value": "images/*.*", + "type": "glob" + }, + { + "value": "images/**/*.*", + "type": "glob" + }, + { + "value": "images/**/**/*.*", + "type": "glob" + } + ], "include": [ { "value": "/echart/components/ec-canvas/echarts.js", diff --git a/project.private.config.json b/project.private.config.json index 55d16ea..cda8bde 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -9,6 +9,13 @@ "miniprogram": { "list": [ { + "name": "邀约码", + "pathName": "pages/start/index", + "query": "scene=doctorId%3D2%26inviteChan%3D1", + "launchMode": "default", + "scene": 1047 + }, + { "name": "指派医生", "pathName": "module1/pages/setDoctor/index", "query": "id=5", diff --git a/src/app.ts b/src/app.ts index c596b4c..b2d12b2 100644 --- a/src/app.ts +++ b/src/app.ts @@ -1,11 +1,13 @@ +/* eslint-disable perfectionist/sort-imports */ 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"; const dayjs = require("dayjs"); const licia = require("miniprogram-licia"); + require("/utils/dayjs/day-zh-cn.js"); dayjs.locale("zh-cn"); // 全局使用 @@ -28,6 +30,8 @@ App({ loginState: "", isLogin: 0, doctorId: null, + + scene: null, }, onLaunch() { Page = page as WechatMiniprogram.Page.Constructor; @@ -47,11 +51,16 @@ App({ this.globalData.loginState = res.loginState; this.globalData.isLogin = res.isLogin; this.globalData.doctorId = res.doctorId; - this.globalData.doctorAuditId = res.doctorAuditId; }); }, }); }, + onShow(options) { + if (options.query.scene) { + this.globalData.scene = parseScene(options.query.scene); + } + // this.startLogin(); + }, waitLogin(waitLoginState = false) { let time: number; return new Promise((resolve, reject) => { diff --git a/src/echart/components/homeLevel2/index.wxml b/src/echart/components/homeLevel2/index.wxml index c206c6f..46d73b9 100644 --- a/src/echart/components/homeLevel2/index.wxml +++ b/src/echart/components/homeLevel2/index.wxml @@ -213,9 +213,7 @@ - - 还没有邀约医生哦 - + 还没有邀约医生哦 diff --git a/src/pages/home/index.ts b/src/pages/home/index.ts index 6b0f0e3..43a49d2 100644 --- a/src/pages/home/index.ts +++ b/src/pages/home/index.ts @@ -4,12 +4,36 @@ export {}; Page({ data: { level: 2, + show1: false, + bindDoctorName: "", }, onLoad() { this.getTabBar().setData({ active: 1, }); - app.waitLogin().then(() => {}); + app.waitLogin().then(() => { + this.handleBindDoctor() + }); + }, + handleBindDoctor() { + const scene = app.globalData.scene; + if (scene?.doctorId) { + wx.ajax({ + method: "POST", + url: "?r=takeda/account/bind-doctor", + data: { + inviteDoctorId: scene.doctorId, + }, + }).then((res) => { + if (res.Name) { + this.setData({ + show1: true, + bindDoctorName: res.Name, + }); + } + app.globalData.scene = null; + }); + } }, }); diff --git a/src/pages/home/index.wxml b/src/pages/home/index.wxml index 05e5c04..d035e6d 100644 --- a/src/pages/home/index.wxml +++ b/src/pages/home/index.wxml @@ -17,7 +17,7 @@ 您已绑定 - 陈艺莉医生 + {{bindDoctorName}}医生 作为您的合作医生 diff --git a/src/pages/start/index.ts b/src/pages/start/index.ts index 4fe61c9..9546d2c 100644 --- a/src/pages/start/index.ts +++ b/src/pages/start/index.ts @@ -3,6 +3,12 @@ const app = getApp(); Page({ data: {}, onLoad() { - app.waitLogin(); + app.waitLogin().then(() => { + wx.reLaunch({ + url: "/pages/home/index", + }); + }); }, }); + +export {}; diff --git a/src/utils/util.ts b/src/utils/util.ts index 69a2e19..93911a1 100644 --- a/src/utils/util.ts +++ b/src/utils/util.ts @@ -1,19 +1,64 @@ export const formatTime = (date: Date) => { - const year = date.getFullYear() - const month = date.getMonth() + 1 - const day = date.getDate() - const hour = date.getHours() - const minute = date.getMinutes() - const second = date.getSeconds() + const year = date.getFullYear(); + const month = date.getMonth() + 1; + const day = date.getDate(); + const hour = date.getHours(); + const minute = date.getMinutes(); + const second = date.getSeconds(); - return ( - [year, month, day].map(formatNumber).join('/') + - ' ' + - [hour, minute, second].map(formatNumber).join(':') - ) -} + return `${[year, month, day].map(formatNumber).join("/")} ${[hour, minute, second].map(formatNumber).join(":")}`; +}; -const formatNumber = (n: number) => { - const s = n.toString() - return s[1] ? s : '0' + s -} +export const formatNumber = (n: number) => { + const s = n.toString(); + return s[1] ? s : `0${s}`; +}; + +/** + * 获取当前页面路径 + * @returns string + */ +export const getCurrentPageUrl = function () { + const pages = getCurrentPages(); + const currentPage = pages[pages.length - 1]; + const url = `/${currentPage.route}`; + return url; +}; + +/** + * 获取当前页面路径 & 参数 + * @returns string + */ +export const getCurrentPageUrlWithArgs = function () { + const pages = getCurrentPages(); + const currentPage = pages[pages.length - 1]; + const url = currentPage.route; + const options = currentPage.options; + let urlWithArgs = `/${url}?`; + for (const key in options) { + const value = options[key]; + urlWithArgs += `${key}=${value}&`; + } + urlWithArgs = urlWithArgs.substring(0, urlWithArgs.length - 1); + return urlWithArgs; +}; + +const parseUrlArgsToArray = (urlArgs) => { + urlArgs = urlArgs.split("&"); + const results = {}; + urlArgs.forEach((arg) => { + arg = arg.split("="); + if (arg[0] && arg[1]) { + results[arg[0]] = arg[1]; + } + }); + return results; +}; + +export const parseScene = (scene) => { + if (scene) { + return parseUrlArgsToArray(decodeURIComponent(scene)); + } else { + return null; + } +}; diff --git a/typings/index.d.ts b/typings/index.d.ts index 0b61ca7..08f5883 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -7,7 +7,7 @@ interface IAppOption { loginState: string; isLogin: number; doctorId: null | number; - doctorAuditId: number; + scene: null | { [key: string]: any }; }; userInfoReadyCallback?: WechatMiniprogram.GetUserInfoSuccessCallback; waitLogin: (waitLoginState?: boolean) => Promise;