Browse Source

api stash

master
kola-web 1 week ago
parent
commit
84a17b414a
  1. 31
      src/pages/index/index.ts
  2. 1
      src/pages/start/index.ts

31
src/pages/index/index.ts

@ -92,9 +92,16 @@ Page({
}, },
getProjectInfo() { getProjectInfo() {
const params: any = {}
// 如果有 projectId,传入获取指定项目信息
if (this.data.projectId) {
params.projectId = this.data.projectId
}
wx.ajax({ wx.ajax({
method: 'GET', method: 'GET',
url: '/app/patient/patient/project-info', url: '/app/patient/patient/project-info',
data: params,
}).then((res: any) => { }).then((res: any) => {
this.setData({ this.setData({
projectId: res.projectId, projectId: res.projectId,
@ -151,27 +158,19 @@ Page({
const { iv, encryptedData } = e.detail const { iv, encryptedData } = e.detail
if (iv && encryptedData) { if (iv && encryptedData) {
wx.login({ const app = getApp<IAppOption>()
success: (loginRes) => { const sessionKey = app.globalData.initLoginInfo?.sessionKey || ''
wx.ajax({
method: 'POST',
url: '/app/common/common/wx-login',
data: {
code: loginRes.code,
},
})
.then((loginRes: any) => {
// 解密手机号 // 解密手机号
return wx.ajax({ wx.ajax({
method: 'POST', method: 'POST',
url: '/app/common/common/wx-phone', url: '/app/patient/patient/wx-login',
data: { data: {
sessionKey: loginRes.sessionKey, sessionKey,
encryptedData, encryptedData,
iv, iv,
}, },
}) })
})
.then(() => { .then(() => {
// 选择适应症 // 选择适应症
return wx.ajax({ return wx.ajax({
@ -192,7 +191,7 @@ Page({
method: 'POST', method: 'POST',
url: '/app/patient/patient/bind-pharmacist', url: '/app/patient/patient/bind-pharmacist',
data: { data: {
pharmacistId: this.data.pharmacistId, pharmacistId: Number.parseInt(this.data.pharmacistId),
projectId: this.data.projectId, projectId: this.data.projectId,
indicationId: selectedOption.indicationId, indicationId: selectedOption.indicationId,
}, },
@ -219,8 +218,6 @@ Page({
}) })
} }
}) })
},
})
} }
}, },

1
src/pages/start/index.ts

@ -10,6 +10,7 @@ Page({
if (options.scene) { if (options.scene) {
const sceneData = parseScene(options.scene) as { pharmacistId?: string; projectId?: string } const sceneData = parseScene(options.scene) as { pharmacistId?: string; projectId?: string }
console.log('sceneData: ', sceneData);
pharmacistId = sceneData.pharmacistId || '' pharmacistId = sceneData.pharmacistId || ''
projectId = sceneData.projectId || '' projectId = sceneData.projectId || ''
} }

Loading…
Cancel
Save