前人砍树型代码写法vue屎山代码
最近公司接到一个之前的项目要做融合,其中一个子系统的写法我实在忍无可忍,别人都是前人栽树后人乘凉,我遇到的这个项目写法真的是砍树型写法,
这几个接口封装把我看得一愣一愣的,除此之外的还有很多这样的屎山代码
// 个人中心 - 企业认证状态 --机构const enterpriseAuthenticationStateUrl = '/personalCenter/organization/enterpriseAuthenticationState';
export function enterpriseAuthenticationState(data) {return request({url: enterpriseAuthenticationStateUrl,method: 'post',data: data //???不嫌多打两个data累得慌吗?你们是按代码量算钱吗?})
}
// 个人中心 - 机构认证状态 --机构
const AbuthenticationStateUrl = '/personalCenter/organization/AuthenticationState';
//authentication是一个单词,为什么要加b?而且驼峰命名不是首字母小写吗???
export function AbuthenticationState(data) {return request({url: AbuthenticationStateUrl,method: 'post',data: data})
}
// 个人中心 - 机构认证状态 --机构
const jorganizationAuthenticationUrl = '/personalCenter/organization/organizationAuthentication';
//organization前面为什么要加一个j啊,是机构吗?自己为什么要自己创词???!!
export function jorganizationAuthentication(data) {return request({url: jorganizationAuthenticationUrl,method: 'post',data: data})
}
// 个人中心 - 机构认证状态 --机构
const jindexUrl = '/personalCenter/enterprise/index';
//jindex是什么???谁看得懂你这个函数是干啥的????
export function jindex(data) {return request({url: jindexUrl,method: 'post',data: data})
}
// 个人中心 - 企业认证 --企业
//qenterprise又来了,不要自己创词好吗大哥我求求你了
const qenterpriseAuthenticationUrl = '/personalCenter/enterprise/enterpriseAuthentication';
export function qenterpriseAuthentication(data) {return request({url: qenterpriseAuthenticationUrl,method: 'post',data: data})
}
其他页面代码
//startstu啥意思????驼峰呢???startstu() {let that = this;//下面这种写法又不会改变this指向 你let 啥啊enterpriseAuthenticationState().then((res) => {if (res.code == "000") {that.statr = res.data;}}).catch((e) => {console.log(e);});},//两个函数名差别就差一个a是吧,注释也不写,合着就让人猜这啥意思是吧???astartstu() {let that = this;AbuthenticationState().then((res) => {if (res.code == "000") {that.astatr = res.data;}}).catch((e) => {console.log(e);});},
还有watch
// 观察watch: {region(newregion, oldregion) {console.log(newregion);//本来region就是会变的为什么还要监听完了自己赋值一遍????this.ruleForm.region = newregion;if (newregion == 1) {//disablef 是什么????新创的词吗???this.disablef = true;console.log(this.ruleForm);} else {this.disablef = false;}//this.disablef = newregion ===1 三元写法不会?????},},
还有一些Css
//jgrzg?是什么?
.jgrzg {
//xgpass是什么?.xgpass {color: rgba(50, 149, 252, 1);font-size: 18px;padding-left: 10px; //两个不能缩写成padding:0 0 10px 10px;不行吗????padding-bottom: 10px;text-align: left;font-family: SourceHanSansSC-bold;border-bottom: 1px solid rgba(233, 233, 233, 1);}
//divlx又是什么?????.divlx {display: flex;}
//fkinfo 又是什么?????.fkinfo {margin: 20px 0px 8px 20px;padding: 10px 0px;line-height: 20px;width: 1030px;min-height: 700px;box-sizing: border-box;border: 1px solid rgba(233, 233, 233, 1);text-align: center;border: 1px solid rgba(233, 233, 233, 1);}
啊真的看到这种屎山代码我真的要疯了,变量命名要驼峰不完全驼峰,中英文结合,对象名和对象值重复该缩写不缩写,真的要疯了,看到这种代码真的很想骂上一个写代码的人。
呵呵,前人砍树型写法,现在我在给他一个个重构,真的要老命了