diff --git a/src/app.json b/src/app.json index 619044b..343c7b7 100644 --- a/src/app.json +++ b/src/app.json @@ -32,8 +32,8 @@ ] }, { - "root": "doc", - "pages": ["pages/doc1/index"] + "root": "privacy", + "pages": ["pages/policy/index"] } ], "window": { diff --git a/src/app.ts b/src/app.ts index f0ffd77..23efcb8 100644 --- a/src/app.ts +++ b/src/app.ts @@ -82,18 +82,6 @@ App({ }, }) }, - updateLoginInfo(callback?: () => void) { - wx.ajax({ - method: 'GET', - url: '/app/common/common/user-info', - data: {}, - }).then((res) => { - this.globalData.initLoginInfo = res - if (callback) { - callback() - } - }) - }, waitLogin({ types = [] as number[] } = {}) { return new Promise((resolve) => { const checkLogin = () => { @@ -111,14 +99,13 @@ App({ }) }, checkLoginTypes(types: number[]) { - console.log('types: ', types) const { loginIdentity, isLogin } = this.globalData.initLoginInfo if (!types || types.length === 0) { return true } - if (types.includes(loginIdentity) && loginIdentity === 1) { + if (loginIdentity && types.includes(loginIdentity) && loginIdentity === 1) { return true } @@ -167,12 +154,6 @@ App({ }) }, - getUserInfo() { - return wx.ajax({ - method: 'GET', - url: '/app/common/common/user-info', - }) - }, autoUpdate: function () { var self = this if (wx.canIUse('getUpdateManager')) { diff --git a/src/doc/pages/doc1/index.json b/src/doc/pages/doc1/index.json deleted file mode 100644 index 2be56ec..0000000 --- a/src/doc/pages/doc1/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "navigationBarTitleText": "个人信息及隐私政策", - "usingComponents": { - "mp-html": "mp-html" - } -} diff --git a/src/doc/pages/doc1/index.scss b/src/doc/pages/doc1/index.scss deleted file mode 100644 index 0b69ddc..0000000 --- a/src/doc/pages/doc1/index.scss +++ /dev/null @@ -1,3 +0,0 @@ -.page{ - padding: 0 40rpx; -} diff --git a/src/doc/pages/doc1/index.ts b/src/doc/pages/doc1/index.ts deleted file mode 100644 index cb0f633..0000000 --- a/src/doc/pages/doc1/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -const _app = getApp(); - -Page({ - data: { - doc:`当前为体验版本` - }, - onLoad() {}, -}); - -export {} diff --git a/src/doc/pages/doc1/index.wxml b/src/doc/pages/doc1/index.wxml deleted file mode 100644 index 68e15cb..0000000 --- a/src/doc/pages/doc1/index.wxml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/doctor/pages/changeTel/index.ts b/src/doctor/pages/changeTel/index.ts index fec9437..647a31c 100644 --- a/src/doctor/pages/changeTel/index.ts +++ b/src/doctor/pages/changeTel/index.ts @@ -43,10 +43,10 @@ Page({ wx.ajax({ method: 'POST', - url: '/app/common/common/send-sms', + url: '/app/common/common/send-code', data: { phone: mobile, - type: 3, // 3-修改手机号 + type: 2, // 2-绑定手机号 }, }).then(() => { wx.showToast({ diff --git a/src/doctor/pages/invite/index.ts b/src/doctor/pages/invite/index.ts index 49cf0b2..4438a6e 100644 --- a/src/doctor/pages/invite/index.ts +++ b/src/doctor/pages/invite/index.ts @@ -37,10 +37,10 @@ Page({ }, // 生成药店邀约小程序码 generateQrCode() { - const { pharmacistId } = this.data - if (!pharmacistId) { + const { projectId } = this.data + if (!projectId) { wx.showToast({ - title: '获取药店人员信息失败', + title: '获取项目信息失败', icon: 'none', }) return @@ -48,16 +48,16 @@ Page({ wx.ajax({ method: 'POST', - url: '/app/common/common/wxacode', + url: '/app/pharmacist/pharmacist/generate-code', data: { - scene: `pharmacistId=${pharmacistId}`, - page: 'pages/invite/patient', - width: 430, - type: 2, // 2-药店人员邀约码 + projectId: parseInt(projectId), }, }).then((res: any) => { this.setData({ qrCodeUrl: res.imageUrl || '', + projectName: res.projectName || '', + pharmacistName: res.pharmacistName || '', + pharmacistAvatar: res.pharmacistAvatar || '', }) }).catch(() => { wx.showToast({ diff --git a/src/doctor/pages/login/index.ts b/src/doctor/pages/login/index.ts index f36274c..9e95690 100644 --- a/src/doctor/pages/login/index.ts +++ b/src/doctor/pages/login/index.ts @@ -92,13 +92,12 @@ Page({ phone: this.data.mobile, code: this.data.code, }, - }).then((res) => { - const app = getApp() + }).then((res: any) => { app.globalData.initLoginInfo = { - loginType: 4, + ...app.globalData.initLoginInfo, isLogin: 1, - isReg: 1, - ...res, + loginIdentity: 4, + userId: res.userId, } this.submitCallback() }) @@ -113,14 +112,24 @@ Page({ } const { iv, encryptedData } = e.detail if (iv && encryptedData) { + const sessionKey = app.globalData.initLoginInfo?.sessionKey || '' + wx.ajax({ method: 'POST', - url: '?r=zd/doctor/login/wx-reg-login', + url: '/app/pharmacist/pharmacist/wx-login', data: { - iv: encodeURIComponent(iv), - encryptedData: encodeURIComponent(encryptedData), + sessionKey, + encryptedData, + iv, }, - }).then((_res) => { + }).then((res: any) => { + // 更新登录信息 + app.globalData.initLoginInfo = { + ...app.globalData.initLoginInfo, + isLogin: 1, + loginIdentity: 4, + userId: res.userId, + } this.submitCallback() }) } @@ -141,9 +150,9 @@ Page({ }) }, handleLink() { - // wx.navigateTo({ - // url: '/doc/pages/doc1/index', - // }) + wx.navigateTo({ + url: '/privacy/pages/policy/index', + }) }, handleCheck() { this.setData({ diff --git a/src/doctor/pages/loginForm/index.ts b/src/doctor/pages/loginForm/index.ts index 0e4e057..491108f 100644 --- a/src/doctor/pages/loginForm/index.ts +++ b/src/doctor/pages/loginForm/index.ts @@ -39,26 +39,10 @@ Page({ pages: 0, }, }, - onLoad(option: { promoterId?: string; projectId?: string; scene?: string }) { + onLoad(options) { // 解析扫码参数 - let promoterId = option.promoterId || '' - let projectId = option.projectId || '' - - // 如果是扫码进入,解析 scene 参数 - if (option.scene) { - const scene = decodeURIComponent(option.scene) - const params = this.parseScene(scene) - promoterId = params.promoterId || '' - projectId = params.projectId || '' - } - - if (!promoterId || !projectId) { - wx.showToast({ - title: '缺少必要参数', - icon: 'none', - }) - return - } + const promoterId = app.globalData.promoterId || '' + const projectId = app.globalData.projectId || '' this.setData({ promoterId, @@ -123,26 +107,28 @@ Page({ page: this.data.page, pageSize: this.data.pageSize, }, - }).then((res: any) => { - const list = res.list || [] - const currentPage = this.data.page - const total = res.total || 0 - const pages = Math.ceil(total / this.data.pageSize) - this.setData({ - pharmacyList: [...this.data.pharmacyList, ...list], - total, - page: currentPage + 1, - hasMore: currentPage < pages, - loading: false, - pagination: { - count: total, - page: currentPage, - pages, - }, - }) - }).catch(() => { - this.setData({ loading: false }) }) + .then((res: any) => { + const list = res.list || [] + const currentPage = this.data.page + const total = res.total || 0 + const pages = Math.ceil(total / this.data.pageSize) + this.setData({ + pharmacyList: [...this.data.pharmacyList, ...list], + total, + page: currentPage + 1, + hasMore: currentPage < pages, + loading: false, + pagination: { + count: total, + page: currentPage, + pages, + }, + }) + }) + .catch(() => { + this.setData({ loading: false }) + }) }, // 省市区选择变化 handleChange(e: WechatMiniprogram.CustomEvent) { @@ -224,32 +210,34 @@ Page({ name: name.trim(), pharmacyId, }, - }).then((res: any) => { - wx.hideLoading() - // 保存登录信息 - app.globalData.initLoginInfo = { - loginType: 4, - isLogin: 1, - isReg: 1, - ...res, - } - wx.showToast({ - title: '绑定成功', - icon: 'success', + }) + .then((res: any) => { + wx.hideLoading() + // 保存登录信息 + app.globalData.initLoginInfo = { + loginType: 4, + isLogin: 1, + isReg: 1, + ...res, + } + wx.showToast({ + title: '绑定成功', + icon: 'success', + }) + // 跳转到药店端首页 + setTimeout(() => { + wx.reLaunch({ + url: '/doctor/pages/home/index', + }) + }, 1500) }) - // 跳转到药店端首页 - setTimeout(() => { - wx.reLaunch({ - url: '/doctor/pages/home/index', + .catch(() => { + wx.hideLoading() + wx.showToast({ + title: '绑定失败', + icon: 'none', }) - }, 1500) - }).catch(() => { - wx.hideLoading() - wx.showToast({ - title: '绑定失败', - icon: 'none', }) - }) }, }) diff --git a/src/doctor/pages/my/index.ts b/src/doctor/pages/my/index.ts index 4049b4c..7bef2fe 100644 --- a/src/doctor/pages/my/index.ts +++ b/src/doctor/pages/my/index.ts @@ -161,11 +161,16 @@ Page({ content: '确定要退出登录吗?', success: (res) => { if (res.confirm) { - // 清除登录信息 - app.globalData.initLoginInfo = null - app.globalData.loginState = '' - wx.redirectTo({ - url: '/pages/work/index', + // 调用退出登录接口 + wx.ajax({ + method: 'POST', + url: '/app/pharmacist/pharmacist/logout', + }).finally(() => { + // 清除登录信息 + app.globalData.initLoginInfo = {} + wx.reLaunch({ + url: '/pages/work/index', + }) }) } }, diff --git a/src/doctor/pages/my/index.wxml b/src/doctor/pages/my/index.wxml index 148e7ab..657fc60 100644 --- a/src/doctor/pages/my/index.wxml +++ b/src/doctor/pages/my/index.wxml @@ -38,4 +38,4 @@ 退出登录 - + diff --git a/src/ground/pages/changeNickname/index.ts b/src/ground/pages/changeNickname/index.ts index f40bc90..36ba9dc 100644 --- a/src/ground/pages/changeNickname/index.ts +++ b/src/ground/pages/changeNickname/index.ts @@ -16,11 +16,10 @@ Page({ getCurrentName() { wx.ajax({ method: 'GET', - url: '/app/common/common/user-info', + url: '/app/promoter/promoter/profile', }).then((res: any) => { - const promoterInfo = res.promoterInfo || {} this.setData({ - name: promoterInfo.name || '', + name: res.name || '', }) }) }, diff --git a/src/ground/pages/home/index.scss b/src/ground/pages/home/index.scss index 2ae5895..7c0bb75 100644 --- a/src/ground/pages/home/index.scss +++ b/src/ground/pages/home/index.scss @@ -367,6 +367,10 @@ page { width: 100%; height: 546rpx; box-sizing: border-box; + position: relative; + .hide { + display: none; + } } .more { padding: 20rpx 0 0; diff --git a/src/ground/pages/home/index.ts b/src/ground/pages/home/index.ts index 0a6f805..a2488ec 100644 --- a/src/ground/pages/home/index.ts +++ b/src/ground/pages/home/index.ts @@ -26,13 +26,22 @@ Page({ // 图表数据 chartData: [] as Array<{ date: string, count: number }>, + pharmacistChartData: [] as Array<{ date: string, count: number }>, + pharmacyChartData: [] as Array<{ date: string, count: number }>, // 日期范围 startDate: '', endDate: '', + today: '', // 统计类型: day-日统计, month-月统计 statType: 'day', + + // 项目列表 + projectList: [] as Array<{ projectId: number; projectName: string; projectDescription: string }>, + currentProjectId: 0, + currentProjectName: '特诺雅', + projectIndex: 0, }, ecDataTrendComponent1_1: null as any, @@ -44,16 +53,15 @@ Page({ // 地推端页面,仅允许地推人员(3)访问 app.waitLogin({ types: [3] }).then(() => { this.getUserInfo() - this.getStatistics() - this.getPatientChart() - this.getPharmacistChart() - this.getPharmacyChart() + this.getProjectList() }) // 初始化日期范围为最近30天 - const endDate = this.formatDate(new Date()) + const today = this.formatDate(new Date()) + const endDate = today const startDate = this.formatDate(new Date(Date.now() - 30 * 24 * 60 * 60 * 1000)) this.setData({ + today, startDate, endDate, }) @@ -67,11 +75,11 @@ Page({ return `${year}-${month}-${day}` }, - // 获取用户信息 + // 获取个人信息 getUserInfo() { wx.ajax({ method: 'GET', - url: '/app/promoter/promoter/info', + url: '/app/promoter/promoter/profile', }).then((res: any) => { this.setData({ promoterName: res.name, @@ -80,11 +88,60 @@ Page({ }) }, + // 获取项目列表 + getProjectList() { + wx.ajax({ + method: 'GET', + url: '/app/promoter/promoter/project-list', + }).then((res: any) => { + const projectList = res.list || [] + const currentProjectId = res.currentProjectId || (projectList[0]?.projectId || 0) + const currentProject = projectList.find((item: any) => item.projectId === currentProjectId) || projectList[0] + const projectIndex = projectList.findIndex((item: any) => item.projectId === currentProjectId) + + this.setData({ + projectList, + currentProjectId, + currentProjectName: currentProject?.projectName || '特诺雅', + projectIndex: projectIndex >= 0 ? projectIndex : 0, + }) + + // 获取统计数据 + this.getStatistics() + this.getPatientChart() + this.getPharmacistChart() + this.getPharmacyChart() + }) + }, + + // 切换项目 + onProjectChange(e: WechatMiniprogram.CustomEvent) { + const index = e.detail.value + const project = this.data.projectList[index] + if (project && project.projectId !== this.data.currentProjectId) { + this.setData({ + currentProjectId: project.projectId, + currentProjectName: project.projectName, + projectIndex: index, + }) + // 重新加载数据 + this.getStatistics() + this.getPatientChart() + this.getPharmacistChart() + this.getPharmacyChart() + } + }, + // 获取统计数据看板 getStatistics() { + const data: any = {} + if (this.data.currentProjectId) { + data.projectId = this.data.currentProjectId + } wx.ajax({ method: 'GET', url: '/app/promoter/promoter/statistics', + data, }).then((res: any) => { this.setData({ invitePharmacyCount: res.invitePharmacyCount || 0, @@ -94,108 +151,74 @@ Page({ enrollPatientCount: res.enrollPatientCount || 0, indicationStats: res.indicationStats || [], }) - }).catch(() => { - // 接口失败时使用模拟数据 - this.setData({ - invitePharmacyCount: 45, - invitePharmacistCount: 128, - invitePatientCount: 356, - jumpPatientCount: 289, - enrollPatientCount: 156, - indicationStats: [ - { indicationId: 1, indicationName: '斑块状银屑病', invitePatientCount: 150, jumpPatientCount: 120, enrollPatientCount: 65 }, - { indicationId: 2, indicationName: '溃疡性结肠炎', invitePatientCount: 120, jumpPatientCount: 98, enrollPatientCount: 52 }, - { indicationId: 3, indicationName: '克罗恩病', invitePatientCount: 86, jumpPatientCount: 71, enrollPatientCount: 39 }, - ], - }) }) }, // 获取邀约患者统计图表 getPatientChart() { + const data: any = { + type: this.data.statType, + startDate: this.data.startDate, + endDate: this.data.endDate, + } + if (this.data.currentProjectId) { + data.projectId = this.data.currentProjectId + } wx.ajax({ method: 'GET', url: '/app/promoter/promoter/patient-chart', - data: { - type: this.data.statType, - startDate: this.data.startDate, - endDate: this.data.endDate, - }, - }).then((res: any) => { - const list = res.list || [] - this.setData({ - chartData: list, - }) - this.initChartBar(list) - }).catch(() => { - // 接口失败时使用模拟数据 - const mockData = this.generateMockChartData() + data, + }).then((list: any) => { this.setData({ - chartData: mockData, + chartData: list || [], }) - this.initChartBar(mockData) + this.initChartBar(list || []) }) }, // 获取邀约药师统计图表 getPharmacistChart() { + const data: any = { + type: this.data.statType, + startDate: this.data.startDate, + endDate: this.data.endDate, + } + if (this.data.currentProjectId) { + data.projectId = this.data.currentProjectId + } wx.ajax({ method: 'GET', url: '/app/promoter/promoter/pharmacist-chart', - data: { - type: this.data.statType, - startDate: this.data.startDate, - endDate: this.data.endDate, - }, - }).then((res: any) => { - this.initChartLine(res.list || [], '#chart2_1', 'ecDataTrendComponent2_1') - }).catch(() => { - // 接口失败时使用模拟数据 - const mockData = this.generateMockChartData() - this.initChartLine(mockData, '#chart2_1', 'ecDataTrendComponent2_1') + data, + }).then((list: any) => { + this.setData({ + pharmacistChartData: list || [], + }) + this.initChartLine(list || [], '#chart2_1', 'ecDataTrendComponent2_1') }) }, // 获取邀约药店统计图表 getPharmacyChart() { + const data: any = { + type: this.data.statType, + startDate: this.data.startDate, + endDate: this.data.endDate, + } + if (this.data.currentProjectId) { + data.projectId = this.data.currentProjectId + } wx.ajax({ method: 'GET', url: '/app/promoter/promoter/pharmacy-chart', - data: { - type: this.data.statType, - startDate: this.data.startDate, - endDate: this.data.endDate, - }, - }).then((res: any) => { - this.initChartLine(res.list || [], '#chart3_1', 'ecDataTrendComponent3_1') - }).catch(() => { - // 接口失败时使用模拟数据 - const mockData = this.generateMockChartData() - this.initChartLine(mockData, '#chart3_1', 'ecDataTrendComponent3_1') + data, + }).then((list: any) => { + this.setData({ + pharmacyChartData: list || [], + }) + this.initChartLine(list || [], '#chart3_1', 'ecDataTrendComponent3_1') }) }, - // 生成模拟图表数据 - generateMockChartData() { - const list: any[] = [] - const days = this.data.statType === 'day' ? 30 : 12 - for (let i = 0; i < days; i++) { - const date = new Date() - if (this.data.statType === 'day') { - date.setDate(date.getDate() - (days - 1 - i)) - list.push({ - date: this.formatDate(date), - count: Math.floor(Math.random() * 50) + 10, - }) - } else { - date.setMonth(date.getMonth() - (days - 1 - i)) - list.push({ - date: `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}`, - count: Math.floor(Math.random() * 500) + 100, - }) - } - } - return list - }, // 切换统计类型 switchStatType(e: WechatMiniprogram.CustomEvent) { @@ -238,6 +261,42 @@ Page({ this.getPharmacyChart() }, + // 切换到上一天 + prevDate() { + const currentDate = new Date(this.data.startDate) + const newDate = new Date(currentDate.getTime() - 24 * 60 * 60 * 1000) + const startDate = this.formatDate(newDate) + + this.setData({ startDate }) + // 重新加载图表数据 + this.getPatientChart() + this.getPharmacistChart() + this.getPharmacyChart() + }, + + // 切换到下一天 + nextDate() { + const currentDate = new Date(this.data.startDate) + const newDate = new Date(currentDate.getTime() + 24 * 60 * 60 * 1000) + const today = new Date() + + // 最大日期不能大于当前日期 + if (newDate > today) { + wx.showToast({ + title: '不能选择未来日期', + icon: 'none', + }) + return + } + + const startDate = this.formatDate(newDate) + this.setData({ startDate }) + // 重新加载图表数据 + this.getPatientChart() + this.getPharmacistChart() + this.getPharmacyChart() + }, + initChartBar(list: any[]) { return new Promise((reslove) => { this.ecDataTrendComponent1_1 = this.selectComponent('#chart1_1') diff --git a/src/ground/pages/home/index.wxml b/src/ground/pages/home/index.wxml index 6b533a9..91a918c 100644 --- a/src/ground/pages/home/index.wxml +++ b/src/ground/pages/home/index.wxml @@ -1,9 +1,9 @@ - - 特诺雅 + + {{currentProjectName}} ® - + - + - + {{startDate}} - + @@ -155,7 +155,8 @@ - + + 查看明细 @@ -182,7 +183,8 @@ - + + @@ -205,7 +207,8 @@ - + + diff --git a/src/ground/pages/invite/index.ts b/src/ground/pages/invite/index.ts index 6216415..d6618c4 100644 --- a/src/ground/pages/invite/index.ts +++ b/src/ground/pages/invite/index.ts @@ -24,13 +24,12 @@ Page({ getUserInfo() { wx.ajax({ method: 'GET', - url: '/app/common/common/user-info', - }).then((res: any) => { - const promoterInfo = res.promoterInfo || {} + url: '/app/promoter/promoter/profile', + }).then((data: any) => { this.setData({ - promoterName: promoterInfo.name || '', - promoterAvatar: promoterInfo.avatar || '', - promoterId: promoterInfo.id || '', + promoterName: data.name || '', + promoterAvatar: data.avatar || '', + promoterId: data.id || '', }) // 获取小程序码 this.generateQrCode() @@ -38,27 +37,17 @@ Page({ }, // 生成地推邀约小程序码 generateQrCode() { - const { promoterId } = this.data - if (!promoterId) { - wx.showToast({ - title: '获取地推人员信息失败', - icon: 'none', - }) - return - } - wx.ajax({ method: 'POST', - url: '/app/common/common/wxacode', + url: '/app/promoter/promoter/generate-code', data: { - scene: `promoterId=${promoterId}`, - page: 'pages/invite/pharmacist', - width: 430, - type: 1, // 1-地推邀约码 }, - }).then((res: any) => { + }).then((data: any) => { this.setData({ - qrCodeUrl: res.imageUrl || '', + qrCodeUrl: data.imageUrl || '', + projectName: data.projectName || '', + promoterName: data.promoterName || '', + promoterAvatar: data.promoterAvatar || '', }) }).catch(() => { wx.showToast({ diff --git a/src/ground/pages/login/index.ts b/src/ground/pages/login/index.ts index c93ac06..1921b74 100644 --- a/src/ground/pages/login/index.ts +++ b/src/ground/pages/login/index.ts @@ -90,15 +90,14 @@ Page({ data: { phone: this.data.mobile, code: this.data.code, - identity: 3, }, - }).then((res) => { + }).then((res: any) => { const app = getApp() app.globalData.initLoginInfo = { - loginType: 3, + ...app.globalData.initLoginInfo, isLogin: 1, - isReg: 1, - ...res, + loginIdentity: 3, + userId: res.userId, } this.submitCallback() }) @@ -113,14 +112,25 @@ Page({ } const { iv, encryptedData } = e.detail if (iv && encryptedData) { + const app = getApp() + const sessionKey = app.globalData.initLoginInfo?.sessionKey || '' + wx.ajax({ method: 'POST', - url: '?r=zd/doctor/login/wx-reg-login', + url: '/app/promoter/promoter/wx-login', data: { - iv: encodeURIComponent(iv), - encryptedData: encodeURIComponent(encryptedData), + sessionKey, + encryptedData, + iv, }, - }).then((_res) => { + }).then((res: any) => { + // 更新登录信息 + app.globalData.initLoginInfo = { + ...app.globalData.initLoginInfo, + isLogin: 1, + loginIdentity: 3, + userId: res.userId, + } this.submitCallback() }) } @@ -141,9 +151,9 @@ Page({ }) }, handleLink() { - // wx.navigateTo({ - // url: '/doc/pages/doc1/index', - // }) + wx.navigateTo({ + url: '/privacy/pages/policy/index', + }) }, handleCheck() { this.setData({ diff --git a/src/ground/pages/my/index.ts b/src/ground/pages/my/index.ts index 30f12ee..12c8992 100644 --- a/src/ground/pages/my/index.ts +++ b/src/ground/pages/my/index.ts @@ -17,17 +17,16 @@ Page({ // 页面显示时刷新用户信息 this.getUserInfo() }, - // 获取用户信息 + // 获取个人信息 getUserInfo() { wx.ajax({ method: 'GET', - url: '/app/common/common/user-info', + url: '/app/promoter/promoter/profile', }).then((res: any) => { - const promoterInfo = res.promoterInfo || {} this.setData({ - promoterName: promoterInfo.name || '', - promoterAvatar: promoterInfo.avatar || '', - promoterPhone: promoterInfo.phone || '', + promoterName: res.name || '', + promoterAvatar: res.avatar || '', + promoterPhone: res.phone || '', }) }) }, @@ -126,8 +125,16 @@ Page({ content: '确定要退出登录吗?', success: (res) => { if (res.confirm) { - wx.reLaunch({ - url: '/pages/work/index', + // 调用退出登录接口 + wx.ajax({ + method: 'POST', + url: '/app/promoter/promoter/logout', + }).finally(() => { + // 清除登录信息 + app.globalData.initLoginInfo = {} + wx.reLaunch({ + url: '/pages/work/index', + }) }) } }, diff --git a/src/ground/pages/pharmacist/index.wxml b/src/ground/pages/pharmacist/index.wxml index 1639414..6025ea6 100644 --- a/src/ground/pages/pharmacist/index.wxml +++ b/src/ground/pages/pharmacist/index.wxml @@ -85,7 +85,6 @@ - 暂无数据 diff --git a/src/ground/pages/stat/index.json b/src/ground/pages/stat/index.json index e3ceeb9..5120472 100644 --- a/src/ground/pages/stat/index.json +++ b/src/ground/pages/stat/index.json @@ -2,6 +2,7 @@ "navigationStyle": "custom", "usingComponents": { "popup": "/components/popup/index", - "navbar": "/components/navbar/index" + "navbar": "/components/navbar/index", + "pagination": "/components/pagination/index" } } diff --git a/src/ground/pages/stat/index.ts b/src/ground/pages/stat/index.ts index 3aab862..810ac1b 100644 --- a/src/ground/pages/stat/index.ts +++ b/src/ground/pages/stat/index.ts @@ -21,6 +21,13 @@ Page({ // 加载状态 loading: false, + + // 分页信息 + pagination: { + count: 0, + page: 1, + pages: 1, + }, }, onLoad(option: { id?: string }) { // 地推端统计页面,仅允许地推人员访问 @@ -97,10 +104,16 @@ Page({ endDate, type, }, - }).then((res: any) => { + }).then((data: any) => { + const chartList = data || [] this.setData({ - chartList: res.list || res || [], + chartList, loading: false, + pagination: { + count: chartList.length, + page: 1, + pages: 1, + }, }) }).catch(() => { this.setData({ loading: false }) diff --git a/src/pages/index/index.ts b/src/pages/index/index.ts index b41e302..1d148f7 100644 --- a/src/pages/index/index.ts +++ b/src/pages/index/index.ts @@ -161,15 +161,24 @@ Page({ const app = getApp() const sessionKey = app.globalData.initLoginInfo?.sessionKey || '' - // 解密手机号 + // 患者微信登录/注册 + const params: any = { + sessionKey, + encryptedData, + iv, + } + // 如果有扫码参数,传入 + if (this.data.pharmacistId) { + params.pharmacistId = Number.parseInt(this.data.pharmacistId) + } + if (this.data.projectId) { + params.projectId = this.data.projectId + } + wx.ajax({ method: 'POST', url: '/app/patient/patient/wx-login', - data: { - sessionKey, - encryptedData, - iv, - }, + data: params, }) .then(() => { // 选择适应症 diff --git a/src/pages/start/index.ts b/src/pages/start/index.ts index 3e7a646..71dca82 100644 --- a/src/pages/start/index.ts +++ b/src/pages/start/index.ts @@ -10,7 +10,6 @@ Page({ if (options.scene) { const sceneData = parseScene(options.scene) as { pharmacistId?: string; projectId?: string } - console.log('sceneData: ', sceneData); pharmacistId = sceneData.pharmacistId || '' projectId = sceneData.projectId || '' } @@ -27,7 +26,7 @@ Page({ const { isLogin, loginIdentity } = app.globalData.initLoginInfo // 游客(1)或患者端(2)且有扫码参数,进入患者首页 - if ((loginIdentity === 1 || loginIdentity === 2) && (pharmacistId && projectId)) { + if ((loginIdentity === 1 || loginIdentity === 2) && pharmacistId && projectId) { wx.reLaunch({ url: '/pages/index/index', }) @@ -44,13 +43,8 @@ Page({ // 未注册,根据身份跳转到对应注册页面 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', + url: '/pages/tourists/index', }) return } diff --git a/src/pages/tourists/index.ts b/src/pages/tourists/index.ts index 9b693b4..cae7106 100644 --- a/src/pages/tourists/index.ts +++ b/src/pages/tourists/index.ts @@ -1,23 +1,23 @@ -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', - // }) + onLoad() { + app.waitLogin().then(() => { + // 页面加载完成 + }) + }, + // 跳转到药店工作人员登录页 + goToPharmacist() { + wx.navigateTo({ + url: '/doctor/pages/login/index', + }) + }, + // 跳转到地推人员登录页 + goToPromoter() { + wx.navigateTo({ + url: '/ground/pages/login/index', + }) }, }) diff --git a/src/pages/tourists/index.wxml b/src/pages/tourists/index.wxml index a01a2c8..add026a 100644 --- a/src/pages/tourists/index.wxml +++ b/src/pages/tourists/index.wxml @@ -5,7 +5,7 @@ - 我是药店工作人员 - 我是地推人员 + 我是药店工作人员 + 我是地推人员 diff --git a/src/pages/work/index.ts b/src/pages/work/index.ts index 56b4b75..c85641e 100644 --- a/src/pages/work/index.ts +++ b/src/pages/work/index.ts @@ -20,7 +20,7 @@ Page({ }, hadlePatient() { wx.navigateTo({ - url: '/pages/index/index', + url: '/pages/start/index', }) }, }) diff --git a/src/privacy/pages/policy/index.json b/src/privacy/pages/policy/index.json new file mode 100644 index 0000000..3ea5122 --- /dev/null +++ b/src/privacy/pages/policy/index.json @@ -0,0 +1,7 @@ +{ + "navigationBarTitleText": "个人信息及隐私保护政策", + "usingComponents": { + "navbar": "/components/navbar/index", + "mp-html": "mp-html" + } +} diff --git a/src/privacy/pages/policy/index.scss b/src/privacy/pages/policy/index.scss new file mode 100644 index 0000000..d3ae129 --- /dev/null +++ b/src/privacy/pages/policy/index.scss @@ -0,0 +1,64 @@ +.privacy-page { + min-height: 100vh; + background: #f8fafa; + padding: 32rpx; + box-sizing: border-box; + + .content { + background: #fff; + border-radius: 16rpx; + padding: 40rpx 32rpx; + font-size: 28rpx; + line-height: 1.8; + color: #333; + + rich-text { + display: block; + + h2 { + font-size: 36rpx; + font-weight: 600; + color: #333; + margin: 48rpx 0 24rpx; + line-height: 1.4; + + &:first-child { + margin-top: 0; + } + } + + h3 { + font-size: 32rpx; + font-weight: 600; + color: #333; + margin: 32rpx 0 16rpx; + line-height: 1.4; + } + + p { + margin: 16rpx 0; + text-align: justify; + } + + ul, ol { + margin: 16rpx 0; + padding-left: 40rpx; + } + + li { + margin: 8rpx 0; + } + + strong { + font-weight: 600; + color: #333; + } + + hr { + border: none; + border-top: 1rpx solid #e5e5e5; + margin: 32rpx 0; + } + } + } +} diff --git a/src/privacy/pages/policy/index.ts b/src/privacy/pages/policy/index.ts new file mode 100644 index 0000000..8b18adc --- /dev/null +++ b/src/privacy/pages/policy/index.ts @@ -0,0 +1,109 @@ +Page({ + data: { + content: ` +## 个人信息及隐私保护政策 + +### 一、引言 + +本《个人信息及隐私保护政策》(以下简称"本政策")旨在向您说明我们如何收集、使用、存储和保护您的个人信息。请您在使用我们的服务前,仔细阅读并理解本政策的全部内容。 + +### 二、信息收集 + +#### 2.1 我们收集的信息 + +我们可能会收集以下类型的个人信息: + +- **基本信息**:姓名、手机号码、头像等 +- **身份认证信息**:身份证信息、执业药师资格证等(仅用于身份验证) +- **设备信息**:设备型号、操作系统版本、设备标识符等 +- **位置信息**:经您授权后获取的地理位置信息 +- **使用记录**:您使用我们服务时的操作记录、访问时间等 + +#### 2.2 信息收集方式 + +我们通过以下方式收集信息: + +- 您主动提供的信息(如注册、填写表单等) +- 您使用服务时自动收集的信息 +- 经您授权后从第三方获取的信息 + +### 三、信息使用 + +我们使用您的个人信息用于: + +- 提供、维护和改进我们的服务 +- 验证您的身份和资质 +- 与您沟通,包括发送服务通知和更新 +- 进行数据分析和研究,以改善用户体验 +- 遵守法律法规要求 + +### 四、信息共享 + +我们不会将您的个人信息出售给第三方。但在以下情况下,我们可能会共享您的信息: + +- 经您明确同意 +- 与我们的关联公司共享(仅在必要范围内) +- 与为我们提供服务的第三方合作伙伴共享(如云服务提供商) +- 根据法律法规要求或政府部门的要求 + +### 五、信息保护 + +我们采取以下措施保护您的个人信息: + +- 使用加密技术保护数据传输安全 +- 建立严格的访问控制机制 +- 定期进行安全审计和风险评估 +- 对员工进行隐私保护培训 + +### 六、您的权利 + +您对自己的个人信息享有以下权利: + +- **访问权**:查询您的个人信息 +- **更正权**:更正不准确的个人信息 +- **删除权**:在符合法律规定的情况下删除您的个人信息 +- **撤回同意权**:撤回之前给予的授权 + +### 七、信息存储 + +您的个人信息将存储在中华人民共和国境内。我们只会在实现本政策所述目的所必需的期限内保留您的个人信息。 + +### 八、Cookie和类似技术 + +我们可能使用Cookie和类似技术来收集和存储信息,以改善您的使用体验。您可以通过浏览器设置管理Cookie偏好。 + +### 九、未成年人保护 + +我们的服务主要面向成年人。如果您是未成年人,请在监护人指导下使用我们的服务。 + +### 十、政策更新 + +我们可能会不时更新本政策。更新后的政策将在应用程序中公布,重大变更我们会通过适当方式通知您。 + +### 十一、联系我们 + +如果您对本政策有任何疑问或建议,请通过以下方式联系我们: + +- 客服电话:400-XXX-XXXX +- 电子邮箱:privacy@example.com +- 邮寄地址:XX省XX市XX区XX路XX号 + +### 十二、其他 + +本政策的解释和适用均适用中华人民共和国法律。如本政策的任何条款被认定为无效或不可执行,该条款应被视为可分割的,不影响其他条款的有效性和可执行性。 + +--- + +**最后更新日期:2026年3月3日** + `, + }, + + onLoad() { + // 隐私协议页面不需要身份验证 + }, + + // 返回上一页 + goBack() { + wx.navigateBack() + }, +}) diff --git a/src/privacy/pages/policy/index.wxml b/src/privacy/pages/policy/index.wxml new file mode 100644 index 0000000..4bc7735 --- /dev/null +++ b/src/privacy/pages/policy/index.wxml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/typings/index.d.ts b/typings/index.d.ts index f2e3c06..2943a9a 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -57,7 +57,6 @@ interface IAppOption { [propName: string]: any } - getUserInfo: () => Promise startLogin: (callback?: () => void) => void // types: 身份类型数组,如 [2, 3] 表示患者端和地推人员端都可以访问 waitLogin: (params?: { types?: number[] }) => Promise