2020-08-21 1.2 发布总结
- 员工端更新跳转的是用户端
code review
E:\dajx\dajx_client\src\components\pages\category\Category.js 把所有错误都归结为 没有选择城市?
_getCategory() {
postApi(CATEGORY_LIST, { adCode: this.props.adcode,}, this.props.token ).then(res => {
if(this.props.categoryId && res.info.length > 0){
res.info.map((item, index) => {
if(item.id == this.props.categoryId){
this.setState({
curretCategory:index
})
}
})
}
this.setState({
leftCategory:res.info
},()=>this._getCategoryList());
}).catch(err => {
this.refs.toast.show('请到首页选择城市');
}).finally(() => {
})
大段代码独立出来,不要写在 view 中:
<TouchableOpacity
onPress={()=>{
var selectArr = [];
var newData = [];
const arr = this.state.data;
for(let i = 0; i < arr.length; i++){
var people = arr[i];
if(item.id === people.id){
if(people.isSlected === false){
people.isSlected = true;
}else{
people.isSlected = false;
}
}
newData.push(people);
if(people.isSlected === true){
selectArr.push(people);
}
}
this.setState({
data:newData,
有什么特殊交代留给我':this.state.remarks.substr(0,15)+'...'
severTittle = (tittle)=> {
if(tittle.length > 4){
return tittle.substring(0,4)+'...';
}else{
return tittle;
}
}
xxx = (str, n)=> {
return str.substring(0, n) + str.length > n ? "..." : "";
}
tittle -> title
severName = (item) => {
if(item.nick.length<=4){
return item.nick+' '+ item.hometown_name +' '+ item.age+'岁'
}else{
return item.nick.substring(0,4)+ '...' + ' ' + item.hometown_name + ' ' + item.age+'岁'
}
- frome ? TimerTuo ?
frome:'order_center',
time:this.orderTimerTuo(this.state.data.update_time),
- dajx-staff-client\src\components\dialog\AgreementDialog.js
finally:
.then(res => {
this.setState({loading: false});
}).catch(err => {
this.setState({loading: false});
});
}).catch(err => {
this.setState({loading: false}); -- no need
}).finally(() => {
this.setState({loading: false});
});
-
没必要啊?
-
loading 状态要封装