add blank judgement; fixed setstate in render bug
parent
6b554196b3
commit
b41498976e
|
|
@ -57,6 +57,11 @@ export default class DetailFramework extends Component<
|
||||||
title: navBar.ticketDetail,
|
title: navBar.ticketDetail,
|
||||||
});
|
});
|
||||||
getTicketInfo(this, this.props.id);
|
getTicketInfo(this, this.props.id);
|
||||||
|
const status = this.state.ticketInfo.status;
|
||||||
|
this.setState({
|
||||||
|
current: mapStatusStep.get(status) || 0,
|
||||||
|
items: pt.get().ticketDetail.stepItems,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
props: Readonly<DetailFrameworkProps> = {
|
props: Readonly<DetailFrameworkProps> = {
|
||||||
|
|
@ -79,12 +84,6 @@ export default class DetailFramework extends Component<
|
||||||
return <View>Request failed</View>;
|
return <View>Request failed</View>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const status = this.state.ticketInfo.status;
|
|
||||||
// this.setState({
|
|
||||||
// current: mapStatusStep.get(status) || 0,
|
|
||||||
// items: pt.get().ticketDetail.stepItems,
|
|
||||||
// });
|
|
||||||
|
|
||||||
const elements: ShowElements = {
|
const elements: ShowElements = {
|
||||||
device: this.props.isInfoShow['device'] ? (
|
device: this.props.isInfoShow['device'] ? (
|
||||||
<View className='at-article__h1'>
|
<View className='at-article__h1'>
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,34 @@ export default class RepairPage extends Component<{}, RepairPageState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
|
this.setState({
|
||||||
|
isDisable: true,
|
||||||
|
});
|
||||||
|
if (
|
||||||
|
this.state.description == '' ||
|
||||||
|
this.state.device == '' ||
|
||||||
|
this.state.deviceModel == '' ||
|
||||||
|
this.state.owner == '' ||
|
||||||
|
this.state.phone == '' ||
|
||||||
|
this.state.checkedList.length === 0
|
||||||
|
) {
|
||||||
|
Taro.atMessage({
|
||||||
|
message: pt.get().button.submitText.blank,
|
||||||
|
type: 'error',
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
this.setState({
|
||||||
|
isDisable: false,
|
||||||
|
});
|
||||||
|
}, submitInterval);
|
||||||
|
return;
|
||||||
|
}
|
||||||
submitTicket(this);
|
submitTicket(this);
|
||||||
|
setTimeout(() => {
|
||||||
|
this.setState({
|
||||||
|
isDisable: false,
|
||||||
|
});
|
||||||
|
}, submitInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
render(): ReactNode {
|
render(): ReactNode {
|
||||||
|
|
|
||||||
|
|
@ -36,10 +36,16 @@ export default class InformPage extends Component {
|
||||||
}
|
}
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
this.setState({
|
this.setState({
|
||||||
isLoading: true,
|
|
||||||
isDisable: true,
|
isDisable: true,
|
||||||
});
|
});
|
||||||
console.log(this.state.name, this.state.phone);
|
console.log(this.state.name, this.state.phone);
|
||||||
|
if (this.state.name == '' || this.state.phone == '') {
|
||||||
|
Taro.atMessage({
|
||||||
|
message: pt.get().button.submitText.blank,
|
||||||
|
type: 'error',
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
updateUserInfo(this);
|
updateUserInfo(this);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ import { memberLogin, memberLogout } from '@/service/memberLogin';
|
||||||
import wechatUser from '@/wechat';
|
import wechatUser from '@/wechat';
|
||||||
import './member.scss';
|
import './member.scss';
|
||||||
|
|
||||||
|
const logInterval = 5000;
|
||||||
|
|
||||||
export default class UserMemberPage extends Component {
|
export default class UserMemberPage extends Component {
|
||||||
state = {
|
state = {
|
||||||
stuid: '',
|
stuid: '',
|
||||||
|
|
@ -31,11 +33,39 @@ export default class UserMemberPage extends Component {
|
||||||
return passwd;
|
return passwd;
|
||||||
}
|
}
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
|
this.setState({
|
||||||
|
isDisable: true,
|
||||||
|
});
|
||||||
|
if (this.state.stuid == '' || this.state.passwd == '') {
|
||||||
|
Taro.atMessage({
|
||||||
|
message: pt.get().button.submitText.blank,
|
||||||
|
type: 'error',
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
this.setState({
|
||||||
|
isDisable: false,
|
||||||
|
});
|
||||||
|
}, logInterval);
|
||||||
|
return;
|
||||||
|
}
|
||||||
memberLogin(this);
|
memberLogin(this);
|
||||||
|
setTimeout(() => {
|
||||||
|
this.setState({
|
||||||
|
isDisable: false,
|
||||||
|
});
|
||||||
|
}, logInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
onLogout() {
|
onLogout() {
|
||||||
|
this.setState({
|
||||||
|
isDisable: true,
|
||||||
|
});
|
||||||
memberLogout(this);
|
memberLogout(this);
|
||||||
|
setTimeout(() => {
|
||||||
|
this.setState({
|
||||||
|
isDisable: false,
|
||||||
|
});
|
||||||
|
}, logInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
render(): ReactNode {
|
render(): ReactNode {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import { AtTextarea, AtButton, AtForm, AtMessage } from 'taro-ui';
|
import { AtTextarea, AtButton, AtForm, AtMessage } from 'taro-ui';
|
||||||
import { Component, ReactNode } from 'react';
|
import { Component, ReactNode } from 'react';
|
||||||
import { getUrl } from '@/service';
|
|
||||||
import Taro from '@tarojs/taro';
|
import Taro from '@tarojs/taro';
|
||||||
import pt from '@/plain-text';
|
import pt from '@/plain-text';
|
||||||
|
import { reportMessage } from '@/service/report';
|
||||||
import './report.scss';
|
import './report.scss';
|
||||||
|
|
||||||
const submitInterval = 5000;
|
const submitInterval = 5000;
|
||||||
|
|
@ -27,35 +27,21 @@ export default class ReportPage extends Component {
|
||||||
}
|
}
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
this.setState({
|
this.setState({
|
||||||
isLoading: true,
|
|
||||||
isDisable: true,
|
isDisable: true,
|
||||||
});
|
});
|
||||||
console.log(this.state.report);
|
if (this.state.report == '') {
|
||||||
Taro.request({
|
Taro.atMessage({
|
||||||
url: getUrl('/report'),
|
message: pt.get().button.submitText.blank,
|
||||||
method: 'POST',
|
type: 'error',
|
||||||
data: {
|
|
||||||
token: 'token_test',
|
|
||||||
report: this.state.report,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
.then((res) => {
|
|
||||||
console.log(res.data);
|
|
||||||
Taro.atMessage({
|
|
||||||
message: pt.get().button.submitText.success,
|
|
||||||
type: 'success',
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
console.log(err);
|
|
||||||
Taro.atMessage({
|
|
||||||
message: pt.get().button.submitText.error + err.toString(),
|
|
||||||
type: 'error',
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
this.setState({
|
setTimeout(() => {
|
||||||
isLoading: false,
|
this.setState({
|
||||||
});
|
isDisable: false,
|
||||||
|
});
|
||||||
|
}, submitInterval);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
reportMessage(this);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
isDisable: false,
|
isDisable: false,
|
||||||
|
|
|
||||||
|
|
@ -4,26 +4,10 @@ import pt from '@/plain-text';
|
||||||
import wechatUser from '@/wechat';
|
import wechatUser from '@/wechat';
|
||||||
import { getUrl } from '.';
|
import { getUrl } from '.';
|
||||||
|
|
||||||
const logInterval = 5000;
|
|
||||||
|
|
||||||
export function memberLogin(that: UserMemberPage) {
|
export function memberLogin(that: UserMemberPage) {
|
||||||
that.setState({
|
that.setState({
|
||||||
isDisable: true,
|
|
||||||
isLoading: true,
|
isLoading: true,
|
||||||
});
|
});
|
||||||
if (that.state.stuid == '' || that.state.passwd == '') {
|
|
||||||
Taro.atMessage({
|
|
||||||
message: pt.get().button.submitText.blank,
|
|
||||||
type: 'error',
|
|
||||||
});
|
|
||||||
setTimeout(() => {
|
|
||||||
that.setState({
|
|
||||||
isDisable: false,
|
|
||||||
isLoading: false,
|
|
||||||
});
|
|
||||||
}, logInterval);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Taro.request({
|
Taro.request({
|
||||||
url: getUrl('/member/login'),
|
url: getUrl('/member/login'),
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|
@ -56,11 +40,6 @@ export function memberLogin(that: UserMemberPage) {
|
||||||
message: pt.get().button.loginText.error + err.toString(),
|
message: pt.get().button.loginText.error + err.toString(),
|
||||||
type: 'error',
|
type: 'error',
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
|
||||||
that.setState({
|
|
||||||
isDisable: false,
|
|
||||||
});
|
|
||||||
}, logInterval);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -98,10 +77,5 @@ export function memberLogout(that: UserMemberPage) {
|
||||||
message: pt.get().button.logoutText.error + err.toString(),
|
message: pt.get().button.logoutText.error + err.toString(),
|
||||||
type: 'error',
|
type: 'error',
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
|
||||||
that.setState({
|
|
||||||
isDisable: false,
|
|
||||||
});
|
|
||||||
}, logInterval);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
import ReportPage from '@/pages/user/report/report';
|
||||||
|
import Taro from '@tarojs/taro';
|
||||||
|
import pt from '@/plain-text';
|
||||||
|
import { getUrl } from '.';
|
||||||
|
|
||||||
|
export function reportMessage(that: ReportPage) {
|
||||||
|
that.setState({
|
||||||
|
isLoading: true,
|
||||||
|
});
|
||||||
|
Taro.request({
|
||||||
|
url: getUrl('/report'),
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
token: 'token_test',
|
||||||
|
report: that.state.report,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
console.log(res.data);
|
||||||
|
that.setState({
|
||||||
|
isLoading: false,
|
||||||
|
});
|
||||||
|
Taro.atMessage({
|
||||||
|
message: pt.get().button.submitText.success,
|
||||||
|
type: 'success',
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(err);
|
||||||
|
that.setState({
|
||||||
|
isLoading: false,
|
||||||
|
});
|
||||||
|
Taro.atMessage({
|
||||||
|
message: pt.get().button.submitText.error + err.toString(),
|
||||||
|
type: 'error',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
@ -3,35 +3,10 @@ import Taro from '@tarojs/taro';
|
||||||
import pt from '@/plain-text';
|
import pt from '@/plain-text';
|
||||||
import { getUrl } from '.';
|
import { getUrl } from '.';
|
||||||
|
|
||||||
const submitInterval = 5000;
|
|
||||||
|
|
||||||
export function submitTicket(that: RepairPage) {
|
export function submitTicket(that: RepairPage) {
|
||||||
if (that.state.isDisable != true || that.state.isLoading != true) {
|
that.setState({
|
||||||
that.setState({
|
isLoading: true,
|
||||||
isDisable: true,
|
});
|
||||||
isLoading: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
that.state.description == '' ||
|
|
||||||
that.state.device == '' ||
|
|
||||||
that.state.deviceModel == '' ||
|
|
||||||
that.state.owner == '' ||
|
|
||||||
that.state.phone == '' ||
|
|
||||||
that.state.checkedList.length === 0
|
|
||||||
) {
|
|
||||||
Taro.atMessage({
|
|
||||||
message: pt.get().button.submitText.blank,
|
|
||||||
type: 'error',
|
|
||||||
});
|
|
||||||
setTimeout(() => {
|
|
||||||
that.setState({
|
|
||||||
isDisable: false,
|
|
||||||
isLoading: false,
|
|
||||||
});
|
|
||||||
}, submitInterval);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Taro.request({
|
Taro.request({
|
||||||
url: getUrl('/tickets/create'),
|
url: getUrl('/tickets/create'),
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|
@ -69,10 +44,4 @@ export function submitTicket(that: RepairPage) {
|
||||||
type: 'error',
|
type: 'error',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
|
||||||
that.setState({
|
|
||||||
isDisable: false,
|
|
||||||
isLoading: false,
|
|
||||||
});
|
|
||||||
}, submitInterval);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue