My brilliant front-end life

"The time is not lost, the creation does not stop, this article is participating in the 2022 mid-summary essay competition "

I am a rookie at the front end of 95, currently working and eating in Guangzhou. I just changed jobs, and I feel that the pace of life has slowed down. After working for so many years, I always feel like I want to record something, for fear that I will forget that I have such a romantic past when I get old. Book pick up.

company prince

At 18:50 Beijing time, ten minutes before the end of get off work, it was supposed to be a pleasant moment, and the smog in my heart was a little thicker. Because I have been in the 太子company for more than half a year.

Outstanding ability

Thinking back to the beginning of this year, I took a big gift package from my previous company and ran into a wall for job hunting. I stepped through the iron shoes and searched for it. Relying on opportunistic recitation of eight-part essays, I finally got a 小企业job in a high-level company in Guangzhou. I joined the new project team in less than a week after I joined the company, and made a small lottery program. The technology stack is typescript+tarothat I have not developed it in depth before. I am very happy, and I can learn while working. It took me more than three months to keep fighting with the team, and this project was barely completed. After the development was completed, I also joined the testing army when I had time, for fear that my first project would be destroyed due to my bugs. influence 毕竟以前经常发生. Unexpectedly, this project did not land in the end. The boss concluded that what we did was not able to beat other competing products, and there was no innovation. Let the team go to the mall applet. I am verylost惊喜, I was thinking of 这样岂不是等于我做了三个月的项目稳定在线上运行,没有bug,不会被用户投诉,也不会被影响绩效,安稳白嫖三个月薪资?beauty! .

After a three-month trial period, because there are no bugs on the project line and the ability is outstanding, I also got my wish and won the regularization.

Void Demand

After completing the previous task, the leader assigned me a large project to reconstruct the previous permissions to manage the background. This wave of refactoring tasks is the leader's direct text request to issue an order. My scalp is a little numb. I haven't encountered this kind of demand for several years. It's really a dream to return to the S1 season. A prototype came out. As a result, I was responsible for managing the front end of the backend because of the assignment of tasks, and he was responsible for managing the code of nodejs in the backend 一把梭. I also wanted a shuttle, but I found that the demand for leaders is very high 灵性, and I am not familiar with the previous business, so I thought I would spend some time working overtime to make a prototype.

I nervously sent the prototype image to the group, and the leader has read it and returned it, no problem, and we can start work. I let go of my dangling heart and rolled up my sleeves. To be honest, I am actually very panicked. First of all, I am React+Typescriptnot familiar with it, and this management background is very profound. It uses a self-developed core framework, various typescript abstractabstract classes, and complex type generics. strenuous. But fortunately, I am a copy ninja. When writing business code, first find out how the code was written before. CCCV, change the English word, it is mine 杰作.

TX leader is really strict

My leader came from a big company in Tencent, and I also have a bit of awe for him from the bottom of my heart. After all, the big company is so terrifying, and the technical level is definitely not comparable to a cutie like me.

The task took a little more than three weeks, including the joint debugging and self-test. After the self-test, I put it MQup with confidence. Unexpectedly, the leader has about 20 revision suggestions for Code Reviewmy 杰作output. I have looked carefully and found that many of them are code specifications, code optimization, and the leader has given certain suggestions. To be honest, I was a little bit grumpy at first, but who let someone else be the leader? 开个玩笑. However, the problems pointed out by the leader cannot be ignored. Programmers should have better pursuits. In fact, it is the greatest help for me when someone points out the problems. I also spent a lot of time to correct these problems. Here are some to show bad codeoff.

  • !与!!!

01gt.png

因为当时习惯取真值使用!!,取真值的反值便不假思索地使用了!!!,百度了一下,好像!!!!作用的确是一样的,有点画蛇添足味道。

  • 起名问题

02goon.png

leader真的很注重起名,起名一定要优雅,这里我原逻辑是判断树是否有子节点继续递归,后面我将goon改为hasChildren了。

  • 复制代码导致问题

03async.png

这个的确是CCCV导致的错误,本来是同步的setState改变弹窗状态控制显示隐藏的函数,用async变成异步函数了。CCCV一不留神真的很容易造成代码的不规范或者bug但是我下次还敢

  • 函数分组问题

04together.png

因为我经常将控制弹窗的两个函数隔开了好几个函数,leader觉得这样实在不优雅,提了这点建议,我觉得确实如此,改完后代码阅读舒服很多,且关联函数在附近的确能够在排查问题时候更快定位问题。

  • 魔法数字

05magic.png

魔法数字。说实话有点难受,在三年前写代码的我使用特殊数字时,还会认认真真在头部定义变量写好注释,但是经过了两年多无拘无束的放任和马不停蹄的迭代,就算这次项目给的时间十分充足,这种良好的代码规范早已在心中抹去,认为代码和人只有一个能跑就行。没有那种强力的自我约束,对优秀代码的追求,这也恰恰证明我的确上不去更好的舞台。

  • 编码习惯

06undefined.png

太习惯与三元运算符了,发现自己编程习惯只在传参中使用||运算多一点。

设计权限组件

leader要求: 前端定义一个组件,如<PageAction action='OrderList/Delete' type={Show}>{<MyButton />}</PageAction > 这里<MyButton />是正常业务组件,这里理想状态是如果用户没有'OrderList/Delete'的权限<MyButton />最不会显示,还可以再加一个Click,没权限也会显示,但无法点击或点击后提示无权限

// 例子主要针对点击处理,有点击权限则可以点击,无点击权限则点击弹出无权限提示

// before
return permission ? children : <div class='mask' onClick={() => message.error('无权限'); }>{children}</div>;

之前一直想不明白,传进来的组件是在children里面,我如何去改变组件的点击函数,想来想去想不懂,脑门一热直接在组件上加一层蒙层,通过蒙层阻碍组件点击,当时设计完出来我还挺高兴,leader也直呼天才,送了我两个字————重做

因为我技术能力确实平庸,只能请教我的良师百度,不断去寻找children是否有什么方法或钩子处理事件,功夫不负有心人,果真被我找到了。下面就是修改后的方法

// after
return permission ? children : React.Children.map(children, child => React.cloneElement(child as React.ReactElement, { onClick: () => { message.error('无权限'); } }));

ps:leader也勉为其难的接受这个方法,可能他不知道有什么更好的方法。如果观众大佬们知道,可以提下意见,不胜感激。

设计组织架构图

07rebuild.png

先让大伙看看原来的功能图吧,之后我们开了一个会议,这里要重做。

08oldtree.png

我心想我发原型图出来的时候,大佬您可是没有半个不字,怎么codereview直接改了一个方向了啊?

不过,毕竟他是我的leader,我的生死全由他掌控,我也不敢多言,上网找了一个npm库react-organizational-chart。react的社区就是强~下面是更改后的视图

09new.png

不得不说,的确是更饱满更清晰直观了一些,leader还是很有远见的怕他也上掘金,吹了再说

这个项目陆陆续续做了三个月了,因为leader平时也很忙,两个城市飞,导致这个项目的进度也进展缓慢,而我就在空闲时间上上掘金学习技术,刷刷leetcode。

来了大半年,我深刻明白我对公司的建设为0,所做项目为公司带来0收入,就是我的价值完全没有体现,公司把我当太子养了大半年,我非常感谢公司。然后每天都会浏览boss直聘,深怕下午就被拉进小黑屋,在这个大环境下,我也时刻准备着,毕竟也有前车之鉴,我明白我只是个平庸的程序员,只能尽力做好自己的本分,随时做好最坏的打算,当真正的打击来临之时,我也不会手忙脚乱。

灿烂?摆烂!

最近IT的HRBP要我一个新入职的去做一场技术分享,我在这里呆了大半年,没有等来其他前端大佬的分享,竟然是要我亲自上阵,小丑竟是我自己

空虚寂寞冷

回想了一下这六个月,其实自己的水平真的没有半点进步,我想不到有什么可以拿来分享的。而且从入职以来,我在这个公司说的话可能没有超过100句,其实有时我也纳闷,我印象中自己不是一个这么闷的一个人,在上家公司我吹*技术游走于天地之间,能很好的融入团队,并能展开身心为其奋斗前期战神,后期老油条。但是来了新公司之后,我只会干完手头上的活,也没有跟其他同事聊聊天,不过我附近的同事也极少聊天,感觉稍微有点死气沉沉。

以前年轻的时候,看到一些新入职的同事,闷葫芦一个,找他搭话或者说骚话,他都没啥兴趣,现在的我,好像成为了自己以前眼中的怪人。我苦思久已,只能得出几个结论,第一点可能是我以前投入太多,经历过分离,不想再投入更多的感情,投入的越深,离开时就越痛1000-7=? 痛,太痛了。第二点是因为现在的大环境,让我精神焦虑,我深怕我和某位同事今天刚去饭堂吃个饭,明天人就没了。想看我之前为啥被裁,可以看我往期文章

不过,我觉得出来工作,重点是挣钱,以这个为核心,其他一切都是空谈。而且,解决我的聊天需求还有一大神器,不是陌陌,而是网易狼人杀APP。自从入职新公司以来,每天下班回到家根本不想学习,不想运动,只想躺着,然后冲进大师场厮杀,里面个个都是人才,说话又好听,我喜欢这个游戏,因为它能锻炼提高我的骗人能力当然是表达能力啦!而且它还夹杂着些许人性的味道,人性的魅力也让我欲罢不能。网易打钱。所以要我分享,我真不知道分享什么,难道分享如何悍跳吃警徽,狼查杀狼打板子做高狼同伴身份?

保持平常心

In the end, the leader asked me to share this refactoring project. I thought about it and it was fine. In fact, it is not a sharing. It can be regarded as a project review and throw my own problems to everyone 欣赏. Although it is a bit embarrassing, it is 赚钱嘛,不寒碜. Moreover, my own technology also pulls my hips, which can deepen my impression of these problems, which is also of great help to my own growth.

Not only the general environment, but there have also been a lot of bizarre things in society recently, and my mentality has also changed a little. I no longer rack my brains to think about how to change jobs and get a high salary, I just want to please myself and do what I think makes me happy and right. , go out for a walk when you are tired, eat some delicious food when you are greedy, 小厂做题家turn into leetcode when you feel that you are lacking in knowledge, and look at other people's source code insights 虽然多数都看不懂. Occasionally I want to learn everything, but when I can't learn anything, I will be anxious. The solution to my anxiety is often... 奖励自己.

The difficulties and anxieties I face at the moment will be healed by time. As a mediocre programmer, facing the new beginning of life every day, I can only say to myself, 啊,又是新的一天.

pinmin.png

Guess you like

Origin juejin.im/post/7122401595966357518