Commit ef7863ea authored by MrShi's avatar MrShi

dev分支,业主修改

parent a6cadda8
import {updateOwner,saveOwner,getOwnerDetail,getOwner, getTosUser,delAdvertisement,saveAdvertisement,quitAndUserAd,uploadApk,checkVideo } from '@/services/tosUser'; import {deleteUnit,getOwnerQr,updateOwner,saveOwner,getOwnerDetail,getOwner, getTosUser,delAdvertisement,saveAdvertisement,quitAndUserAd,uploadApk,checkVideo } from '@/services/tosUser';
export default{ export default{
namespace: 'tUModel', namespace: 'tUModel',
...@@ -42,6 +42,21 @@ export default{ ...@@ -42,6 +42,21 @@ export default{
}); });
if(callback) callback(response); if(callback) callback(response);
}, },
*getOwnerQr({callback,payload},{ call, put }) {
const response = yield call(getOwnerQr,payload);
yield put({
type: "save",
});
if(callback) callback(response);
},
*deleteUnit({callback,payload},{ call, put }) {
const response = yield call(deleteUnit,payload);
yield put({
type: "del",
});
if(callback) callback(response);
},
*delAdvertisement({callback,payload},{ call, put }) { *delAdvertisement({callback,payload},{ call, put }) {
const response = yield call(delAdvertisement,payload); const response = yield call(delAdvertisement,payload);
yield put({ yield put({
......
...@@ -136,6 +136,85 @@ class TosUserDetails extends React.Component { ...@@ -136,6 +136,85 @@ class TosUserDetails extends React.Component {
visible: false, visible: false,
}); });
}; };
//获取二维码
getQrCode = () => {
const nowUser = this.props.currentUser.userid;
const params = {
type: this.state.type,
userID: nowUser,
// userPhone:"18813787835",
ownerId:this.props.location.query.id,
owerName:this.props.location.query.owerName,
communityName:this.props.location.query.communityName,
unit:this.props.location.query.buildingNumber+"#"+
this.props.location.query.floorNumber+"-"+
this.props.location.query.roomNumber
};
this.props.dispatch({
type: 'tUModel/getOwnerQr',
payload: params,
callback: (res) => {
if (res) {
console.log(res);
if(res.error_code == "0000"){
this.setState({
qrUrl: res.data.qrUrl,
})
} else if(res.error_code == "0002") {
alert(res.error_msg);
} else if(res.error_code == "0008"){
alert(res.error_msg);
window.location.href = '/';
router.replace('/');
} else {
alert("获取失败!未知错误!");
}
}
}
});
};
//删除Unit
DeleteUnit = () => {
alert("确定要删除该条记录吗?");
const nowUser = this.props.currentUser.userid;
const params = {
type: this.state.type,
userID: nowUser,
// userPhone:"18813787835",
ownerId:this.props.location.query.id,
owerName:this.props.location.query.owerName,
communityName:this.props.location.query.communityName,
unit:this.props.location.query.buildingNumber+"#"+
this.props.location.query.floorNumber+"-"+
this.props.location.query.roomNumber
};
this.props.dispatch({
type: 'tUModel/deleteUnit',
payload: params,
callback: (res) => {
if (res) {
console.log(res);
if(res.error_code == "0000"){
this.setState({
qrUrl: res.data.qrUrl,
})
} else if(res.error_code == "0002") {
alert(res.error_msg);
} else if(res.error_code == "0008"){
alert(res.error_msg);
window.location.href = '/';
router.replace('/');
} else {
alert("删除失败!请联系工作人员!");
}
}
}
});
};
//获取警报数据 //获取警报数据
getData = () => { getData = () => {
const nowUser = this.props.currentUser.userid; const nowUser = this.props.currentUser.userid;
...@@ -380,8 +459,10 @@ class TosUserDetails extends React.Component { ...@@ -380,8 +459,10 @@ class TosUserDetails extends React.Component {
if(this.state.current == "record"){ if(this.state.current == "record"){
// this.getRecord(); // this.getRecord();
this.getData(); this.getData();
this.getQrCode();
}else{ }else{
this.getData(); this.getData();
this.getQrCode();
} }
}); });
} }
...@@ -574,7 +655,7 @@ class TosUserDetails extends React.Component { ...@@ -574,7 +655,7 @@ class TosUserDetails extends React.Component {
//渲染 //渲染
render() { render() {
const { data, total, typeList, current, record, visible,tosUser } = this.state; const { data, total, typeList, current, record, visible,tosUser,qrUrl } = this.state;
const typeSelect = typeList.map((item, index) => ( const typeSelect = typeList.map((item, index) => (
<Select.Option value={index}>{item}</Select.Option> <Select.Option value={index}>{item}</Select.Option>
...@@ -656,8 +737,8 @@ class TosUserDetails extends React.Component { ...@@ -656,8 +737,8 @@ class TosUserDetails extends React.Component {
<div> <div>
{current == 'record'? {current == 'record'?
<div> <div>
<img style ={{width:100,height:100,float:"right"}}src= {"http://www.srthinker.com:5205/file/d575594254a141f29d23d711d9158ba5.png"} /> <img style ={{width:100,height:100,float:"right"}}src= {this.state.qrUrl} />
<Button className={styles.button1} onClick={() => this.getRecord()}>Delete Unit</Button> <Button className={styles.button1} onClick={() => this.DeleteUnit()}>Delete Unit</Button>
</div> </div>
:''} :''}
......
...@@ -136,6 +136,44 @@ class TosUserEdit extends React.Component { ...@@ -136,6 +136,44 @@ class TosUserEdit extends React.Component {
visible: false, visible: false,
}); });
}; };
//获取二维码
getQrCode = () => {
const nowUser = this.props.currentUser.userid;
const params = {
type: this.state.type,
userID: nowUser,
// userPhone:"18813787835",
ownerId:this.props.location.query.id,
owerName:this.props.location.query.owerName,
communityName:this.props.location.query.communityName,
unit:this.props.location.query.buildingNumber+"#"+
this.props.location.query.floorNumber+"-"+
this.props.location.query.roomNumber
};
this.props.dispatch({
type: 'tUModel/getOwnerQr',
payload: params,
callback: (res) => {
if (res) {
console.log(res);
if(res.error_code == "0000"){
this.setState({
qrUrl: res.data.qrUrl,
})
} else if(res.error_code == "0002") {
alert(res.error_msg);
} else if(res.error_code == "0008"){
alert(res.error_msg);
window.location.href = '/';
router.replace('/');
} else {
alert("获取失败!未知错误!");
}
}
}
});
};
//获取警报数据 //获取警报数据
getData = () => { getData = () => {
const nowUser = this.props.currentUser.userid; const nowUser = this.props.currentUser.userid;
...@@ -353,7 +391,7 @@ class TosUserEdit extends React.Component { ...@@ -353,7 +391,7 @@ class TosUserEdit extends React.Component {
}; };
console.log("params",params); console.log("params",params);
this.props.dispatch({ this.props.dispatch({
type: 'tUModel/saveOwner', type: 'tUModel/updateOwner',
payload: params, payload: params,
callback: (res) => { callback: (res) => {
if (res.error_code == "0000") { if (res.error_code == "0000") {
...@@ -388,8 +426,10 @@ class TosUserEdit extends React.Component { ...@@ -388,8 +426,10 @@ class TosUserEdit extends React.Component {
if(this.state.current == "record"){ if(this.state.current == "record"){
// this.getRecord(); // this.getRecord();
this.getData(); this.getData();
this.getQrCode();
}else{ }else{
this.getData(); this.getData();
this.getQrCode();
// this.getData(); // this.getData();
} }
}); });
...@@ -583,7 +623,7 @@ class TosUserEdit extends React.Component { ...@@ -583,7 +623,7 @@ class TosUserEdit extends React.Component {
//渲染 //渲染
render() { render() {
const { data, total, typeList, current, record, visible,tosUser,sn,sn1,sn2 } = this.state; const { data, total, typeList, current, record, visible,tosUser,sn,sn1,sn2,qrUrl } = this.state;
const typeSelect = typeList.map((item, index) => ( const typeSelect = typeList.map((item, index) => (
<Select.Option value={index}>{item}</Select.Option> <Select.Option value={index}>{item}</Select.Option>
...@@ -674,7 +714,7 @@ class TosUserEdit extends React.Component { ...@@ -674,7 +714,7 @@ class TosUserEdit extends React.Component {
<div> <div>
{current == 'record'? {current == 'record'?
<div> <div>
<img style ={{width:100,height:100,float:"right"}}src= {"http://www.srthinker.com:5205/file/d575594254a141f29d23d711d9158ba5.png"} /> <img style ={{width:100,height:100,float:"right"}}src= {this.state.qrUrl} />
{/*<Button className={styles.button1} onClick={() => this.getRecord()}>删除单位</Button>*/} {/*<Button className={styles.button1} onClick={() => this.getRecord()}>删除单位</Button>*/}
</div> </div>
......
...@@ -33,6 +33,21 @@ export async function updateOwner(params) { ...@@ -33,6 +33,21 @@ export async function updateOwner(params) {
data: params, data: params,
}); });
} }
export async function getOwnerQr(params) {
return request('/tos/life/community/qr/get', {
method: 'POST',
data: params,
});
}
export async function deleteUnit(params) {
return request('/tos/life/community/account/unit/del', {
method: 'POST',
data: params,
});
}
export async function delAdvertisement(params) { export async function delAdvertisement(params) {
return request('/api/ad/del', { return request('/api/ad/del', {
method: 'POST', method: 'POST',
......
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