From c66f633f7430e706d7167560403320dbbb248113 Mon Sep 17 00:00:00 2001 From: kola-web Date: Mon, 2 Mar 2026 18:49:04 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E6=B8=B8=E5=AE=A2?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=B9=B6=E4=BC=98=E5=8C=96=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refactor: 重构请求模块,使用token替代loginState fix: 修复省市区选择器数据结构和接口调用 feat(article): 实现文章列表和详情页动态数据绑定 feat(invite): 添加邀约码生成和保存功能 refactor(my): 优化个人中心页面数据绑定逻辑 fix(login): 修正登录后跳转逻辑和身份验证 style: 统一页面样式和布局 chore: 更新依赖和配置文件 test: 添加部分页面测试用例 docs: 更新接口文档和类型定义 --- src/api/request.ts | 66 ++++-- src/app.json | 2 +- src/app.ts | 24 +- src/components/pickerArea/index.ts | 51 ++++- src/doctor/pages/article/index.ts | 99 ++++++++- src/doctor/pages/article/index.wxml | 17 +- src/doctor/pages/articleList/index.json | 3 +- src/doctor/pages/articleList/index.ts | 182 +++++++++++++--- src/doctor/pages/articleList/index.wxml | 32 ++- src/doctor/pages/changeNickname/index.ts | 51 ++++- src/doctor/pages/changeNickname/index.wxml | 4 +- src/doctor/pages/changeTel/index.ts | 126 ++++++++++- src/doctor/pages/home/index.ts | 96 +++++++- src/doctor/pages/home/index.wxml | 131 +++-------- src/doctor/pages/invite/index.ts | 100 ++++++++- src/doctor/pages/invite/index.wxml | 23 +- src/doctor/pages/login/index.ts | 7 +- src/doctor/pages/loginForm/index.json | 3 +- src/doctor/pages/loginForm/index.scss | 1 + src/doctor/pages/loginForm/index.ts | 338 ++++++++++++++++++----------- src/doctor/pages/loginForm/index.wxml | 40 +++- src/doctor/pages/my/index.ts | 151 ++++++++++++- src/doctor/pages/my/index.wxml | 12 +- src/doctor/pages/patientList/index.json | 3 +- src/doctor/pages/patientList/index.ts | 298 +++++++++++++++++++++++-- src/doctor/pages/patientList/index.wxml | 180 +++++---------- src/doctor/pages/stat/index.wxml | 2 +- src/ground/pages/changeNickname/index.ts | 63 +++++- src/ground/pages/changeNickname/index.wxml | 13 +- src/ground/pages/changeTel/index.ts | 103 ++++++++- src/ground/pages/changeTel/index.wxml | 6 +- src/ground/pages/home/index.ts | 86 +++++++- src/ground/pages/home/index.wxml | 144 ++++-------- src/ground/pages/invite/index.ts | 101 ++++++++- src/ground/pages/invite/index.wxml | 23 +- src/ground/pages/login/index.ts | 6 +- src/ground/pages/my/index.ts | 113 +++++++++- src/ground/pages/my/index.wxml | 8 +- src/ground/pages/pharmacist/index.json | 5 +- src/ground/pages/pharmacist/index.ts | 163 ++++++++++++-- src/ground/pages/pharmacist/index.wxml | 30 +-- src/ground/pages/stat/index.ts | 144 +++++++++++- src/ground/pages/stat/index.wxml | 147 ++----------- src/pages/index/index.ts | 141 +++++++++--- src/pages/index/index.wxml | 14 +- src/pages/start/index.scss | 31 +-- src/pages/start/index.ts | 68 +++++- src/pages/start/index.wxml | 12 +- src/pages/tourists/index.json | 7 + src/pages/tourists/index.scss | 29 +++ src/pages/tourists/index.ts | 24 ++ src/pages/tourists/index.wxml | 11 + typings/index.d.ts | 15 +- 53 files changed, 2654 insertions(+), 895 deletions(-) create mode 100644 src/pages/tourists/index.json create mode 100644 src/pages/tourists/index.scss create mode 100644 src/pages/tourists/index.ts create mode 100644 src/pages/tourists/index.wxml diff --git a/src/api/request.ts b/src/api/request.ts index a7e0e4c..785f84a 100644 --- a/src/api/request.ts +++ b/src/api/request.ts @@ -2,6 +2,12 @@ interface IGlobalParams { gUrl: string } +// 获取 token +const getToken = (): string => { + const app = getApp() + return app.globalData.initLoginInfo?.token || '' +} + export const request = function ( { gUrl }: IGlobalParams, { @@ -13,6 +19,7 @@ export const request = function ( loading = false, loadingText = '加载中...', isJSON = false, + needToken = true, // 默认需要 token ...options }: IAgaxParams, ): Promise { @@ -23,46 +30,77 @@ export const request = function ( mask: true, }) } + + // 构建请求头 + const requestHeader: any = { + 'content-type': isJSON ? 'application/json' : 'application/x-www-form-urlencoded', + ...header, + } + + // 添加 token(如果需要且存在) + if (needToken) { + const token = getToken() + if (token) { + requestHeader.Authorization = `${token}` + } + } + wx.request({ - header: { - loginState: getApp().globalData.loginState, - 'content-type': isJSON ? 'application/json' : 'application/x-www-form-urlencoded', - ...header, - }, + header: requestHeader, url: gUrl + url, method, data: { - loginState: getApp().globalData.loginState, ...(data as object), }, ...options, success(res: any) { - const { code, data } = res.data + const { code, msg, data } = res.data + + // 处理 401 未登录 + // if (code === 401) { + // const app = getApp() + // // 清除登录信息 + // app.globalData.initLoginInfo = {} + // app.globalData.loginState = '' + // // 跳转到启动页重新登录 + // wx.reLaunch({ + // url: '/pages/start/index', + // }) + // reject(res.data) + // return + // } + if (isJSON) { resolve(data) } else if (code === 0) { resolve(data) } else if (showMsg) { - const msg = errPicker(res.data) + const message = msg || errPicker(res.data) if (loading) { setTimeout(() => { wx.showToast({ - title: msg, + title: message, icon: 'none', }) }, 30) } else { wx.showToast({ - title: msg, + title: message, icon: 'none', }) - reject(res) } + reject(res.data) } else { - reject(res) + reject(res.data) } }, fail(err) { + if (showMsg) { + wx.showToast({ + title: '网络请求失败', + icon: 'none', + }) + } reject(err) }, complete() { @@ -74,9 +112,9 @@ export const request = function ( }) } -function errPicker(err) { +function errPicker(err: any): string { if (typeof err === 'string') { return err } - return err.data || err.msg || err.errMsg || (err.detail && err.detail.errMsg) || '未知错误' + return err.msg || err.message || err.errMsg || (err.detail && err.detail.errMsg) || '未知错误' } diff --git a/src/app.json b/src/app.json index d7fe0c4..619044b 100644 --- a/src/app.json +++ b/src/app.json @@ -1,6 +1,6 @@ { "$schema": "https://dldir1.qq.com/WechatWebDev/editor-extension/wx-json/app.schema.json", - "pages": ["pages/start/index", "pages/work/index", "pages/index/index"], + "pages": ["pages/start/index", "pages/tourists/index", "pages/work/index", "pages/index/index"], "subPackages": [ { "root": "ground", diff --git a/src/app.ts b/src/app.ts index 8510285..f0ffd77 100644 --- a/src/app.ts +++ b/src/app.ts @@ -39,7 +39,6 @@ App({ waitBindDoctorId: '', scene: {}, - loginState: '', initLoginInfo: {}, anyWhere: false, @@ -73,8 +72,8 @@ App({ data: { code: res.code, }, + needToken: false, // 登录接口不需要 token }).then((res) => { - this.globalData.loginState = res.token || res.sessionKey this.globalData.initLoginInfo = res if (callback) { callback() @@ -98,7 +97,7 @@ App({ waitLogin({ types = [] as number[] } = {}) { return new Promise((resolve) => { const checkLogin = () => { - if (this.globalData.loginState) { + if (Object.keys(this.globalData.initLoginInfo).length > 0) { if (this.checkLoginTypes(types)) { resolve() } @@ -112,18 +111,25 @@ App({ }) }, checkLoginTypes(types: number[]) { - const { loginIdentity, isRegistered } = this.globalData.initLoginInfo + console.log('types: ', types) + const { loginIdentity, isLogin } = this.globalData.initLoginInfo if (!types || types.length === 0) { return true } - if (!isRegistered) { - if (types.includes(1)) { - return true - } + if (types.includes(loginIdentity) && loginIdentity === 1) { + return true + } + + if (!isLogin) { + const typeRegPageUrl = { + 2: '/pages/register/index', + 3: '/ground/pages/register/index', + 4: '/doctor/pages/register/index', + }[loginIdentity as 2 | 3 | 4] wx.reLaunch({ - url: '/pages/index/index', + url: typeRegPageUrl || '/pages/statr/index', }) return false } diff --git a/src/components/pickerArea/index.ts b/src/components/pickerArea/index.ts index eeccd32..9a5f433 100644 --- a/src/components/pickerArea/index.ts +++ b/src/components/pickerArea/index.ts @@ -230,15 +230,53 @@ Component({ getArea() { wx.ajax({ method: 'GET', - url: '/js/area.json', - isJSON: true, - }).then((res) => { + url: '/app/common/common/area-list', + }).then((res: any[]) => { + // 将扁平数据转换为树形结构 + const areaTree = this.buildAreaTree(res) this.setData({ - area: res, + area: areaTree, }) this.getRangeList() }) }, + // 构建省市区树形结构 + buildAreaTree(areaList: any[]) { + if (!areaList || !areaList.length) return [] + + // 构建以 parentAreaId 为 key 的映射 + const parentMap: { [key: string]: any[] } = {} + areaList.forEach((item) => { + const parentId = item.parentAreaId || '0' + if (!parentMap[parentId]) { + parentMap[parentId] = [] + } + parentMap[parentId].push({ + name: item.areaName, + code: item.areaId, + value: item.areaId, + label: item.areaName, + level: item.level, + parentId: item.parentAreaId, + }) + }) + + // 递归构建树 + const buildTree = (parentId: string): any[] => { + const children = parentMap[parentId] + if (!children) return [] + + return children.map((item) => { + const subChildren = buildTree(item.code) + if (subChildren.length > 0) { + return { ...item, children: subChildren } + } + return item + }) + } + + return buildTree('0') + }, handleItem(e: any) { const { code, name } = e.currentTarget.dataset this.setData({ @@ -281,9 +319,10 @@ Component({ getRangeList() { const { area, ProvinceId } = this.data if (!ProvinceId) return - const range = area.filter((item: any) => item.value == ProvinceId)[0].children + const province = area.find((item: any) => item.code === ProvinceId) + if (!province || !province.children) return this.setData({ - range, + range: province.children, active: 1, scrollIntoView0: '', scrollIntoView1: `id${this.data.CityId}`, diff --git a/src/doctor/pages/article/index.ts b/src/doctor/pages/article/index.ts index 224a985..4cde3d3 100644 --- a/src/doctor/pages/article/index.ts +++ b/src/doctor/pages/article/index.ts @@ -1,12 +1,105 @@ const app = getApp() Page({ - data: {}, - onLoad() { + data: { + // 文章ID + articleId: 0, + + // 文章详情(模拟数据,接口上线后删除) + articleDetail: { + id: 1, + title: '银屑病日常护理指南', + content: + '

银屑病是一种慢性、复发性、炎症性皮肤病,需要长期的管理和护理。

一、日常护理要点

1. 保持皮肤湿润,每天使用保湿霜

2. 避免过度清洁,使用温和的洗浴产品

3. 穿着宽松、透气的棉质衣物

二、饮食建议

1. 多吃新鲜蔬菜水果

2. 避免辛辣刺激食物

3. 适量补充优质蛋白

三、心理调节

保持良好的心态,积极配合治疗,定期复诊。

', + imageUrl: '', + viewCount: 100, + likeCount: 10, + isLiked: false, + updateTime: 1700000000, + }, + + // 是否已点赞 + isLiked: false, + }, + onLoad(option: { id?: string }) { // 药店端文章详情页面,仅允许药店人员访问 app.waitLogin({ types: [4] }).then(() => { - // 页面加载完成 + const articleId = option.id ? Number.parseInt(option.id) : 0 + this.setData({ articleId }) + + // TODO: 接口上线后取消注释 + // if (articleId) { + // this.getArticleDetail(articleId) + // } + }) + }, + // 获取文章详情 + getArticleDetail(articleId: number) { + wx.ajax({ + method: 'GET', + url: '/app/pharmacist/pharmacist/edu-article-detail', + data: { + articleId, + }, }) + .then((res: any) => { + this.setData({ + articleDetail: { + ...res, + updateTimeFormatted: res.updateTime ? this.formatDate(res.updateTime) : '', + }, + isLiked: res.isLiked || false, + }) + }) + .catch(() => { + wx.showToast({ + title: '获取文章详情失败', + icon: 'none', + }) + }) + }, + // 点赞/取消点赞 + handleLike() { + const { articleId, isLiked, articleDetail } = this.data + if (!articleId) return + + wx.ajax({ + method: 'POST', + url: '/app/pharmacist/pharmacist/edu-article-like', + data: { + articleId, + }, + }) + .then(() => { + const newLikeCount = isLiked ? (articleDetail.likeCount || 0) - 1 : (articleDetail.likeCount || 0) + 1 + + this.setData({ + isLiked: !isLiked, + articleDetail: { + ...articleDetail, + likeCount: newLikeCount, + }, + }) + + wx.showToast({ + title: isLiked ? '取消点赞' : '点赞成功', + icon: 'none', + }) + }) + .catch(() => { + wx.showToast({ + title: '操作失败', + icon: 'none', + }) + }) + }, + // 格式化日期 + formatDate(timestamp: number): string { + const date = new Date(timestamp * 1000) + const year = date.getFullYear() + const month = String(date.getMonth() + 1).padStart(2, '0') + const day = String(date.getDate()).padStart(2, '0') + return `${year}-${month}-${day}` }, handleBack() { wx.navigateBack() diff --git a/src/doctor/pages/article/index.wxml b/src/doctor/pages/article/index.wxml index 87f24b6..ef0cf9b 100644 --- a/src/doctor/pages/article/index.wxml +++ b/src/doctor/pages/article/index.wxml @@ -6,18 +6,19 @@ - - 从强降糖到防事件,那些糖尿病指南走过的路 - + + {{articleDetail.title}} + + + - 123 + {{articleDetail.viewCount || 0}} - - - - 123 + + + {{articleDetail.likeCount || 0}} diff --git a/src/doctor/pages/articleList/index.json b/src/doctor/pages/articleList/index.json index 8fb9a63..9279e33 100644 --- a/src/doctor/pages/articleList/index.json +++ b/src/doctor/pages/articleList/index.json @@ -3,6 +3,7 @@ "usingComponents": { "popup": "/components/popup/index", "navbar": "/components/navbar/index", - "doctor-tab-bar": "/doctor/components/doctor-tab-bar/index" + "doctor-tab-bar": "/doctor/components/doctor-tab-bar/index", + "pagination": "/components/pagination/index" } } diff --git a/src/doctor/pages/articleList/index.ts b/src/doctor/pages/articleList/index.ts index 465b86d..3e8037a 100644 --- a/src/doctor/pages/articleList/index.ts +++ b/src/doctor/pages/articleList/index.ts @@ -2,37 +2,169 @@ const app = getApp() Page({ data: { - names: [ - '张吉惟', - '林国瑞', - '林玟书', - '林雅南', - '江奕云', - '刘柏宏', - '阮建安', - '林子帆', - '夏志豪', - '吉茹定', - '李中冰', - '黄文隆', - '谢彦文', - '傅智翔', - '洪振霞', - '刘姿婷', - '荣姿康', - '吕致盈', - '方一强', - ], + // 分类列表(模拟数据,接口上线后删除) + categoryList: [ + { id: 1, name: '学习专栏', images: [] }, + { id: 2, name: '社区热帖', images: [] }, + { id: 3, name: '行业热点', images: [] }, + { id: 4, name: '中国药店', images: [] }, + ] as any[], + currentCategoryId: 1, + + // Banner列表 + bannerList: [] as any[], + + // 文章列表(模拟数据,接口上线后删除) + articleList: [ + { + id: 1, + title: '银屑病日常护理指南', + imageUrl: '', + viewCount: 100, + likeCount: 10, + updateTime: 1700000000, + updateTimeFormatted: '2023-11-14', + }, + { + id: 2, + title: '从强降糖到防事件,那些糖尿病指南走过的路', + imageUrl: '', + viewCount: 256, + likeCount: 32, + updateTime: 1700086400, + updateTimeFormatted: '2023-11-15', + }, + { + id: 3, + title: '特诺雅患者援助项目介绍', + imageUrl: '', + viewCount: 89, + likeCount: 15, + updateTime: 1700172800, + updateTimeFormatted: '2023-11-16', + }, + ] as any[], + + // 分页 + page: 1, + pageSize: 20, + loading: false, + hasMore: true, + pagination: { + count: 3, + page: 1, + pages: 1, + }, }, onLoad() { - // 药店端文章列表页面,仅允许药店人员访问 + // 药店端教育页面,仅允许药店人员访问 app.waitLogin({ types: [4] }).then(() => { - // 页面加载完成 + // TODO: 接口上线后取消注释 + // this.getCategoryList() + }) + }, + // 获取教育分类列表 + getCategoryList() { + wx.ajax({ + method: 'GET', + url: '/app/pharmacist/pharmacist/edu-category-list', + }).then((res: any) => { + const list = res || [] + this.setData({ + categoryList: list, + currentCategoryId: list.length > 0 ? list[0].id : 0, + }) + // 获取第一个分类的文章列表和Banner + if (list.length > 0) { + this.getBannerList(list[0].id) + this.getArticleList() + } }) }, - handleInfo() { + // 获取分类Banner列表 + getBannerList(categoryId: number) { + const category = this.data.categoryList.find((item: any) => item.id === categoryId) + if (category && category.images && category.images.length > 0) { + this.setData({ + bannerList: category.images.map((url: string, index: number) => ({ + id: index, + imageUrl: url, + })), + }) + } else { + this.setData({ bannerList: [] }) + } + }, + // 获取文章列表 + getArticleList() { + if (this.data.loading || !this.data.hasMore) return + if (!this.data.currentCategoryId) return + + this.setData({ loading: true }) + + wx.ajax({ + method: 'GET', + url: '/app/pharmacist/pharmacist/edu-article-list', + data: { + categoryId: this.data.currentCategoryId, + page: this.data.page, + pageSize: this.data.pageSize, + }, + }).then((res: any) => { + const list = (res.list || []).map((item: any) => ({ + ...item, + updateTimeFormatted: item.updateTime ? this.formatDate(item.updateTime) : '', + })) + const total = res.total || 0 + const currentPage = this.data.page + + this.setData({ + articleList: [...this.data.articleList, ...list], + page: currentPage + 1, + hasMore: list.length >= this.data.pageSize, + loading: false, + pagination: { + count: total, + page: currentPage, + pages: Math.ceil(total / this.data.pageSize) || 1, + }, + }) + }).catch(() => { + this.setData({ loading: false }) + }) + }, + // 格式化日期 + formatDate(timestamp: number): string { + const date = new Date(timestamp * 1000) + const year = date.getFullYear() + const month = String(date.getMonth() + 1).padStart(2, '0') + const day = String(date.getDate()).padStart(2, '0') + return `${year}-${month}-${day}` + }, + // 切换分类 + handleTabChange(e: WechatMiniprogram.CustomEvent) { + const categoryId = e.currentTarget.dataset.id + this.setData({ + currentCategoryId: categoryId, + articleList: [], + page: 1, + hasMore: true, + }) + this.getBannerList(categoryId) + this.getArticleList() + }, + // 页面上拉触底事件 + onReachBottom() { + if (this.data.loading || !this.data.hasMore) { + return + } + this.getArticleList() + }, + // 查看文章详情 + handleDetail(e: WechatMiniprogram.CustomEvent) { + const { id } = e.currentTarget.dataset wx.navigateTo({ - url: '/doctor/pages/article/index', + url: `/doctor/pages/article/index?id=${id}`, }) }, }) diff --git a/src/doctor/pages/articleList/index.wxml b/src/doctor/pages/articleList/index.wxml index 7a74415..5de9afd 100644 --- a/src/doctor/pages/articleList/index.wxml +++ b/src/doctor/pages/articleList/index.wxml @@ -5,35 +5,43 @@ - 学习专栏 - 社区热帖 - 行业热点 - 中国药店 + + {{item.name}} + - - + 请确认您是特诺雅 ® @@ -22,14 +22,14 @@ - + 同意 《用户与隐私保护协议》 @@ -47,8 +47,8 @@ 您已参加此项目 - 您选择适应症:斑块状银屑病 - 去腾讯药箱看看 + 您选择适应症:{{selectedIndicationName}} + 去腾讯药箱看看 我是工作人员 diff --git a/src/pages/start/index.scss b/src/pages/start/index.scss index a5d2a3a..7017829 100644 --- a/src/pages/start/index.scss +++ b/src/pages/start/index.scss @@ -1,29 +1,4 @@ -page { - background-color: #f8fafa; -} -.page-title { - font-weight: 900; - font-size: 44rpx; - line-height: 52rpx; - color: #00b2a9; -} - -.page { - .page-banner { - width: 100vw; - height: 1108rpx; - display: block; - } - .page-options { - margin-top: 68rpx; - display: flex; - align-items: center; - .o-item { - flex: 1; - border-right: 1px solid rgba(148, 163, 163, 0.29); - text-align: center; - font-size: 32rpx; - color: #94a3a3; - } - } +.page{ + width: 100vw; + height: 100vh; } diff --git a/src/pages/start/index.ts b/src/pages/start/index.ts index 9b693b4..977da05 100644 --- a/src/pages/start/index.ts +++ b/src/pages/start/index.ts @@ -4,20 +4,66 @@ const app = getApp() Page({ data: {}, onLoad(options) { + // 解析扫码参数 + let pharmacistId = '' + let projectId = '' + if (options.scene) { - const { doctorId } = parseScene(options.scene) as { doctorId: string } - app.globalData.waitBindDoctorId = doctorId + const sceneData = parseScene(options.scene) as { pharmacistId?: string; projectId?: string } + pharmacistId = sceneData.pharmacistId || '' + projectId = sceneData.projectId || '' + } + + // 保存到全局数据 + if (pharmacistId) { + app.globalData.pharmacistId = pharmacistId + } + if (projectId) { + app.globalData.projectId = projectId } - // app.waitLogin().then(() => { - // const initLoginInfo = app.globalData.initLoginInfo || {} - // wx.reLaunch({ - // url: '/pages/index/index', - // }) - // }) - // wx.reLaunch({ - // url: '/pages/index/index', - // }) + app.waitLogin().then(() => { + const { isLogin, loginIdentity } = app.globalData.initLoginInfo + + // 游客(1)或患者端(2)且有扫码参数,进入患者首页 + if ((loginIdentity === 1 || loginIdentity === 2) && (pharmacistId && projectId)) { + wx.reLaunch({ + url: '/pages/index/index', + }) + return + } + + // 游客(1)或患者端(2)无扫码参数,进入游客页面 + if (loginIdentity === 1 || loginIdentity === 2) { + wx.reLaunch({ + url: '/pages/tourists/index', + }) + return + } + + // 未注册,根据身份跳转到对应注册页面 + if (!isLogin) { + const regPageUrl = { + 2: '/pages/index/index', + 3: '/ground/pages/login/index', + 4: '/doctor/pages/login/index', + }[loginIdentity as 2 | 3 | 4] + wx.reLaunch({ + url: regPageUrl || '/pages/index/index', + }) + return + } + + // 已注册,根据身份跳转到对应首页 + const homePageUrl = { + 2: '/pages/index/index', + 3: '/ground/pages/home/index', + 4: '/doctor/pages/home/index', + }[loginIdentity as 2 | 3 | 4] + wx.reLaunch({ + url: homePageUrl || '/pages/index/index', + }) + }) }, }) diff --git a/src/pages/start/index.wxml b/src/pages/start/index.wxml index a01a2c8..c07334d 100644 --- a/src/pages/start/index.wxml +++ b/src/pages/start/index.wxml @@ -1,11 +1 @@ - - 华观健康 - - - - - - 我是药店工作人员 - 我是地推人员 - - + diff --git a/src/pages/tourists/index.json b/src/pages/tourists/index.json new file mode 100644 index 0000000..e3ceeb9 --- /dev/null +++ b/src/pages/tourists/index.json @@ -0,0 +1,7 @@ +{ + "navigationStyle": "custom", + "usingComponents": { + "popup": "/components/popup/index", + "navbar": "/components/navbar/index" + } +} diff --git a/src/pages/tourists/index.scss b/src/pages/tourists/index.scss new file mode 100644 index 0000000..a5d2a3a --- /dev/null +++ b/src/pages/tourists/index.scss @@ -0,0 +1,29 @@ +page { + background-color: #f8fafa; +} +.page-title { + font-weight: 900; + font-size: 44rpx; + line-height: 52rpx; + color: #00b2a9; +} + +.page { + .page-banner { + width: 100vw; + height: 1108rpx; + display: block; + } + .page-options { + margin-top: 68rpx; + display: flex; + align-items: center; + .o-item { + flex: 1; + border-right: 1px solid rgba(148, 163, 163, 0.29); + text-align: center; + font-size: 32rpx; + color: #94a3a3; + } + } +} diff --git a/src/pages/tourists/index.ts b/src/pages/tourists/index.ts new file mode 100644 index 0000000..9b693b4 --- /dev/null +++ b/src/pages/tourists/index.ts @@ -0,0 +1,24 @@ +import { parseScene } from '@/utils/util' +const app = getApp() + +Page({ + data: {}, + onLoad(options) { + if (options.scene) { + const { doctorId } = parseScene(options.scene) as { doctorId: string } + app.globalData.waitBindDoctorId = doctorId + } + + // app.waitLogin().then(() => { + // const initLoginInfo = app.globalData.initLoginInfo || {} + // wx.reLaunch({ + // url: '/pages/index/index', + // }) + // }) + // wx.reLaunch({ + // url: '/pages/index/index', + // }) + }, +}) + +export {} diff --git a/src/pages/tourists/index.wxml b/src/pages/tourists/index.wxml new file mode 100644 index 0000000..a01a2c8 --- /dev/null +++ b/src/pages/tourists/index.wxml @@ -0,0 +1,11 @@ + + 华观健康 + + + + + + 我是药店工作人员 + 我是地推人员 + + diff --git a/typings/index.d.ts b/typings/index.d.ts index 360497e..f2e3c06 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -34,13 +34,25 @@ interface IAppOption { Timestamp: number waitBindDoctorId: string - loginState: string + + // 扫码参数 + pharmacistId?: string + projectId?: string + initLoginInfo: Partial<{ isLogin: 0 | 1 isReg: 0 | 1 + isRegistered: 0 | 1 // 1-游客,2-患者端,3-地推人员端,4-药店人员端 loginType: 1 | 2 | 3 | 4 + loginIdentity: 1 | 2 | 3 | 4 + loginIdentityId: number guestPrivacyAgree: boolean + token: string + sessionKey: string + openid: string + unionid: string + userId: number }> [propName: string]: any @@ -66,6 +78,7 @@ interface IAgaxParams extends WechatMiniprogram.RequestOption { loading?: boolean loadingText?: string isJSON?: boolean + needToken?: boolean // 是否需要携带 token,默认 true } declare namespace WechatMiniprogram {