26 changed files with 698 additions and 368 deletions
@ -1,9 +1,10 @@
@@ -1,9 +1,10 @@
|
||||
1. 本项目是一个基于微信小程序的药品查询应用 |
||||
2. 使用原生微信小程序+typescript+scss |
||||
3. figma设计稿的宽度是375px,1px=2rpx |
||||
4. 小程序的scss单位是rpx |
||||
5. 导航栏使用自定义导航栏,使用自定义组件 /components/navbar |
||||
6. 除了onLoad比寻存在外,其他生命周期函数,无须额外定义 |
||||
7. onLoad函数中需要隐去getApp().waitLogin(),页面使用的接口需要在登录后调用 |
||||
8. 生命周期函数和事件处理函数不应使用箭头函数 |
||||
9. getApp()应提取到全局变量中,避免重复调用 |
||||
1. 接口文档在"C:\Users\kola\project\drugs\prompt\backend\portal_api.md" |
||||
2. 本项目是一个基于微信小程序的药品查询应用 |
||||
3. 使用原生微信小程序+typescript+scss |
||||
4. figma设计稿的宽度是375px,1px=2rpx |
||||
5. 小程序的scss单位是rpx |
||||
6. 导航栏使用自定义导航栏,使用自定义组件 /components/navbar |
||||
7. 除了onLoad比寻存在外,其他生命周期函数,无须额外定义 |
||||
8. onLoad函数中需要隐去getApp().waitLogin(),页面使用的接口需要在登录后调用 |
||||
9. 生命周期函数和事件处理函数不应使用箭头函数 |
||||
10. getApp()应提取到全局变量中,避免重复调用 |
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1,78 +1,26 @@
@@ -1,78 +1,26 @@
|
||||
const app = getApp<IAppOption>(); |
||||
let timer = null as null | number; |
||||
const app = getApp<IAppOption>() |
||||
|
||||
Page({ |
||||
data: { |
||||
mobile: "", |
||||
code: "", |
||||
|
||||
codeText: "发送验证码", |
||||
mobile: '', |
||||
code: '', |
||||
codeText: '发送验证码', |
||||
}, |
||||
onLoad() {}, |
||||
getCode() { |
||||
if (timer) return; |
||||
const mobile = this.data.mobile; |
||||
if (!mobile) { |
||||
wx.showToast({ |
||||
title: "手机号不能为空", |
||||
icon: "none", |
||||
}); |
||||
return; |
||||
} |
||||
// 验证手机号
|
||||
if (!/^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/.test(mobile)) { |
||||
wx.showToast({ |
||||
title: "手机号格式不正确", |
||||
icon: "none", |
||||
}); |
||||
return; |
||||
} |
||||
wx.ajax({ |
||||
method: "POST", |
||||
url: "?r=zd/login/send-verify-code", |
||||
data: { |
||||
mobile, |
||||
onLoad() { |
||||
// 药店端修改手机号页面,仅允许药店人员访问
|
||||
app.waitLogin({ types: [4] }).then(() => { |
||||
// 页面加载完成
|
||||
}) |
||||
}, |
||||
}).then((res) => { |
||||
console.log(res); |
||||
wx.showToast({ |
||||
icon: "none", |
||||
title: "验证码已发送~", |
||||
}); |
||||
let time = 60; |
||||
timer = setInterval(() => { |
||||
time--; |
||||
this.setData({ |
||||
codeText: time + "s后重新发送", |
||||
}); |
||||
if (time <= 0) { |
||||
clearInterval(timer as number); |
||||
timer = null; |
||||
this.setData({ |
||||
codeText: "发送验证码", |
||||
}); |
||||
} |
||||
}, 1000); |
||||
}); |
||||
getCode() { |
||||
// TODO: 需要更新为新的接口
|
||||
}, |
||||
handleSubmit() { |
||||
const { mobile, code } = this.data; |
||||
const { registrationSource, registChannel, regBusinessId } = app.globalData; |
||||
wx.ajax({ |
||||
method: "POST", |
||||
url: "?r=zd/account/update-telephone", |
||||
data: { |
||||
mobile, |
||||
code, |
||||
registrationSource, |
||||
registChannel, |
||||
regBusinessId, |
||||
}, |
||||
}).then((_res) => { |
||||
wx.navigateBack(); |
||||
}); |
||||
// TODO: 需要更新为新的接口
|
||||
}, |
||||
handleBack() { |
||||
wx.navigateBack(); |
||||
wx.navigateBack() |
||||
}, |
||||
}); |
||||
}) |
||||
|
||||
export {} |
||||
|
||||
@ -1,78 +1,26 @@
@@ -1,78 +1,26 @@
|
||||
const app = getApp<IAppOption>(); |
||||
let timer = null as null | number; |
||||
const app = getApp<IAppOption>() |
||||
|
||||
Page({ |
||||
data: { |
||||
mobile: "", |
||||
code: "", |
||||
|
||||
codeText: "发送验证码", |
||||
mobile: '', |
||||
code: '', |
||||
codeText: '发送验证码', |
||||
}, |
||||
onLoad() {}, |
||||
getCode() { |
||||
if (timer) return; |
||||
const mobile = this.data.mobile; |
||||
if (!mobile) { |
||||
wx.showToast({ |
||||
title: "手机号不能为空", |
||||
icon: "none", |
||||
}); |
||||
return; |
||||
} |
||||
// 验证手机号
|
||||
if (!/^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/.test(mobile)) { |
||||
wx.showToast({ |
||||
title: "手机号格式不正确", |
||||
icon: "none", |
||||
}); |
||||
return; |
||||
} |
||||
wx.ajax({ |
||||
method: "POST", |
||||
url: "?r=zd/login/send-verify-code", |
||||
data: { |
||||
mobile, |
||||
onLoad() { |
||||
// 地推端修改手机号页面,仅允许地推人员访问
|
||||
app.waitLogin({ types: [3] }).then(() => { |
||||
// 页面加载完成
|
||||
}) |
||||
}, |
||||
}).then((res) => { |
||||
console.log(res); |
||||
wx.showToast({ |
||||
icon: "none", |
||||
title: "验证码已发送~", |
||||
}); |
||||
let time = 60; |
||||
timer = setInterval(() => { |
||||
time--; |
||||
this.setData({ |
||||
codeText: time + "s后重新发送", |
||||
}); |
||||
if (time <= 0) { |
||||
clearInterval(timer as number); |
||||
timer = null; |
||||
this.setData({ |
||||
codeText: "发送验证码", |
||||
}); |
||||
} |
||||
}, 1000); |
||||
}); |
||||
getCode() { |
||||
// TODO: 需要更新为新的接口
|
||||
}, |
||||
handleSubmit() { |
||||
const { mobile, code } = this.data; |
||||
const { registrationSource, registChannel, regBusinessId } = app.globalData; |
||||
wx.ajax({ |
||||
method: "POST", |
||||
url: "?r=zd/account/update-telephone", |
||||
data: { |
||||
mobile, |
||||
code, |
||||
registrationSource, |
||||
registChannel, |
||||
regBusinessId, |
||||
}, |
||||
}).then((_res) => { |
||||
wx.navigateBack(); |
||||
}); |
||||
// TODO: 需要更新为新的接口
|
||||
}, |
||||
handleBack() { |
||||
wx.navigateBack(); |
||||
wx.navigateBack() |
||||
}, |
||||
}); |
||||
}) |
||||
|
||||
export {} |
||||
|
||||
Loading…
Reference in new issue