Commit f4fd51e5 authored by wangzhujun's avatar wangzhujun

shuru

parent 0a5da262
......@@ -43,23 +43,23 @@ class Inputinfomodal extends React.Component<InputInfoModalProps, InputInfoModal
// 指定 field 的类型为 InputInfoModalState 的键名
handleChange = (field: keyof InputInfoModalState, value: string) => {
// 这里使用类型断言确保类型匹配
this.setState({ [field]: value } as Pick<InputInfoModalState, typeof field>);
// this.setState({ [field]: value } as Pick<InputInfoModalState, typeof field>);
store[field] = value
}
confirm = async () => {
/**判空 */
if (!this.state.name || !this.state.phone || !this.state.detail || !store.province || !store.city) {
if (!store.name || !store.phone || !store.detail || !store.province || !store.city) {
Toast.show("请输入完整信息")
return
}
/**只判断11位手机号 */
if (!/^1[3456789]\d{9}$/.test(this.state.phone)) {
if (!/^1[3456789]\d{9}$/.test(store.phone)) {
Toast.show("请输入正确的手机号")
return
}
let { name, phone, detail } = this.state
let { province, city, area } = store
let { name, phone, detail,province, city, area } = store
if (province == '北京市' || province == '上海市' || province == '天津市' || province == '重庆市') {
city = province
......@@ -77,12 +77,13 @@ class Inputinfomodal extends React.Component<InputInfoModalProps, InputInfoModal
if (resp.success && resp.data) {
Toast.show("领取成功")
ModalCtrl.closeModal()
this.props?.receiveSuc && this.props?.receiveSuc()
// this.props?.receiveSuc && this.props?.receiveSuc()
store.getPrizeList()
} else {
Toast.show("领取失败,请联系客服")
ModalCtrl.closeModal()
}
console.warn(this.state)
// console.warn(this.state)
}
doSelect = ({ province, city, area }) => {
......@@ -97,6 +98,7 @@ class Inputinfomodal extends React.Component<InputInfoModalProps, InputInfoModal
store.province = province
store.city = city
store.area = area
// console.info(this.state)
}
......@@ -123,7 +125,7 @@ class Inputinfomodal extends React.Component<InputInfoModalProps, InputInfoModal
type="text"
className="inputinfomodaldetailconplaceholder"
placeholder="请输入详细地址"
value={this.state.detail}
value={store.detail}
onChange={(e) => this.handleChange('detail', e.target.value)}
/>
</div>
......@@ -133,7 +135,7 @@ class Inputinfomodal extends React.Component<InputInfoModalProps, InputInfoModal
type="tel"
className="inputinfomodalphoneconplaceholder"
placeholder="请输入手机号"
value={this.state.phone}
value={store.phone}
onChange={(e) => this.handleChange('phone', e.target.value)}
/>
</div>
......@@ -143,7 +145,7 @@ class Inputinfomodal extends React.Component<InputInfoModalProps, InputInfoModal
type="text"
className="inputinfomodalnameconplaceholder"
placeholder="请输入姓名"
value={this.state.name}
value={store.name}
onChange={(e) => this.handleChange('name', e.target.value)}
/>
</div>
......@@ -154,14 +156,14 @@ class Inputinfomodal extends React.Component<InputInfoModalProps, InputInfoModal
className="inputinfomodalareaprovinceconplaceholder"
placeholder="请输入"
value={store.province}
onChange={(e) => this.handleChange('province', e.target.value)}
// onChange={(e) => this.handleChange('province', e.target.value)}
/>
<input
type="text"
className="inputinfomodalareacityconplaceholder"
placeholder="请输入"
value={store.city}
onChange={(e) => this.handleChange('city', e.target.value)}
// onChange={(e) => this.handleChange('city', e.target.value)}
/>
<input
type="text"
......@@ -170,7 +172,7 @@ class Inputinfomodal extends React.Component<InputInfoModalProps, InputInfoModal
value={store.area}
onChange={(e) => {
console.log(e.target.value)
this.handleChange('area', e.target.value)
// this.handleChange('area', e.target.value)
}
}
/>
......
......@@ -122,13 +122,16 @@ class Store {
province: string = '';
city: string = '';
area: string = '';
name: string = '';
phone: string = '';
detail: string = '';
goMiniApp() {
if (isWechatMiniProgram()) {
// 小程序内跳转
} else if (isWeiXin()) {
// 微信内跳转
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment