暂存工作台的修改
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { alertInfo, alertSuccess } from "../../../../../../utils/index";
|
||||
import { createTenementWxUser } from "../../../../../../service/tenement";
|
||||
import request from "../../../../../../utils/request"
|
||||
const { OK } = request
|
||||
// pages/workBench/components/account/components/editModal/index.js
|
||||
@@ -11,15 +12,16 @@ Component({
|
||||
type: String,
|
||||
title: String,
|
||||
visible: Boolean,
|
||||
onOk: Function,
|
||||
onCancel: Function,
|
||||
park: String,
|
||||
tenement: String,
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
data: { name: "", phone: "" }
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -27,24 +29,32 @@ Component({
|
||||
*/
|
||||
methods: {
|
||||
async onSubmit() {
|
||||
const { phone, name } = this.data;
|
||||
if (!phone) {
|
||||
const { data = {}, tenement, park } = this.data;
|
||||
if (!data.phone) {
|
||||
alertInfo("请输入手机号")
|
||||
return
|
||||
}
|
||||
if (!name) {
|
||||
if (!data.name) {
|
||||
alertInfo("请输入昵称")
|
||||
return
|
||||
}
|
||||
// const { code, message } = await update()
|
||||
// if (code !== OK) {
|
||||
// alertInfo(message)
|
||||
// return;
|
||||
// }
|
||||
// alertSuccess("操作成功")
|
||||
// if (this.onOk) {
|
||||
// this.onOk()
|
||||
// }
|
||||
|
||||
const { code, message } = await createTenementWxUser({ ...data, tenement, park })
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return;
|
||||
}
|
||||
alertSuccess("操作成功")
|
||||
this.triggerEvent("ok")
|
||||
},
|
||||
onChange(e) {
|
||||
console.log('e', e)
|
||||
const { name } = e.currentTarget.dataset;
|
||||
const newData = this.data.data;
|
||||
newData[name] = e.detail;
|
||||
this.setData({
|
||||
data: newData,
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
@@ -8,21 +8,24 @@
|
||||
>
|
||||
<view class="modalContentWrapper">
|
||||
<van-field
|
||||
value=""
|
||||
value="{{data.name}}"
|
||||
label="昵称"
|
||||
readonly
|
||||
placeholder="请输入昵称"
|
||||
type="textarea"
|
||||
autosize="{{true}}"
|
||||
title-width="120rpx"
|
||||
border="{{false}}"
|
||||
data-name="name"
|
||||
bind:change="onChange"
|
||||
/>
|
||||
<van-field
|
||||
value="{{ meterName }}"
|
||||
placeholder="请选择电表"
|
||||
value="{{ data.phone }}"
|
||||
placeholder="请输入手机号"
|
||||
label="手机号"
|
||||
readonly
|
||||
border="{{ false }}"
|
||||
title-width="120rpx"
|
||||
data-name="phone"
|
||||
bind:change="onChange"
|
||||
>
|
||||
</van-field>
|
||||
</view>
|
||||
|
Reference in New Issue
Block a user