Skip to content

Commit

Permalink
v1.2.0 code review
Browse files Browse the repository at this point in the history
  • Loading branch information
徐文清-前端开发组 committed Nov 24, 2017
1 parent e1560d6 commit 25274ab
Show file tree
Hide file tree
Showing 63 changed files with 373 additions and 297 deletions.
2 changes: 1 addition & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class AppComponent implements OnInit, OnDestroy {
if (errorMsg.hasOwnProperty('error')) {
errorMsg = errorMsg.error;
}
let name = errorMsg.text ? errorMsg.text + ' : ' : '';
const name = errorMsg.text ? errorMsg.text + ' : ' : '';
let tip = '';
console.log('error', errorMsg);
switch (errorMsg.code) {
Expand Down
3 changes: 2 additions & 1 deletion src/app/components/at-list/at-list.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
line-height: 36px;
width: 150px;
background-color: #fff;
box-shadow: 0 0 2px 0 rgba(0, 0, 0, 0.20);
-webkit-box-shadow: 0 0 2px 0 rgba(0, 0, 0, 0.20);
box-shadow: 0 0 2px 0 rgba(0, 0, 0, 0.20);
font-size: 12px;
color: #2C2C2C;
cursor: pointer;
Expand Down
3 changes: 2 additions & 1 deletion src/app/components/card-modal/card-modal.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
float: left;
position: relative;
border-right: 1px solid #D9DEE4;
box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
.card-modal-search{
margin: 16px auto 0;
width: 260px !important;
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/chat-panel/chat-panel.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ export class ChatPanelComponent implements OnInit, AfterViewInit, OnChanges, OnD
latitude: msgBody.latitude,
scale: msgBody.scale
});
}, 0);
});
})(i);
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/app/components/contact-list/contact-list.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
font-size: 14px;
color: #0B1816;
padding-left: 56px;
box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
background-size: 20px;
cursor: pointer;
.contact-list-unreadNum{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
background-color: #fff;
position: relative;
padding: 15px 0 0 20px;
box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
&.active{
background: #E7EDF1 !important;
}
Expand Down Expand Up @@ -142,7 +143,8 @@
position: fixed;
width: 115px;
background-color: #fff;
box-shadow: 0 0 2px 0 rgba(0, 0, 0, 0.20);
-webkit-box-shadow: 0 0 2px 0 rgba(0, 0, 0, 0.20);
box-shadow: 0 0 2px 0 rgba(0, 0, 0, 0.20);
border-radius: 2px;
z-index: 999;
ul{
Expand All @@ -154,7 +156,8 @@
border-radius: 2px;
li{
padding-left: 22px;
box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
border-radius: 2px;
padding-left: 12px;
font-size: 12px;
box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
margin-right: 8px;
&.error{
border-color: #EB424C;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class CreateGroupNextComponent implements OnInit {
if (groupName.value.length === 0) {
this.nameTip = '群名称不能为空';
} else {
let groupInfo = {
const groupInfo = {
avatar: this.groupAvatarInfo.formData,
avatarUrl: this.groupAvatarInfo.src,
isLimit: groupType,
Expand Down
8 changes: 4 additions & 4 deletions src/app/components/create-group/create-group.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class CreateGroupComponent implements OnInit, OnDestroy {
}
}
// 如果搜索的是已经在群里的,disabled
let filter = this.createGroup.info.filter;
const filter = this.createGroup.info.filter;
if (filter) {
for (let item of filter) {
if (item.username === user.name) {
Expand Down Expand Up @@ -109,7 +109,7 @@ export class CreateGroupComponent implements OnInit, OnDestroy {
member.disabled = false;
member.show = true;
let activeSingle = this.createGroup.info.activeSingle;
let nameFlag = activeSingle && activeSingle.name === member.name;
const nameFlag = activeSingle && activeSingle.name === member.name;
if (nameFlag) {
member.checked = true;
member.disabled = true;
Expand All @@ -126,7 +126,7 @@ export class CreateGroupComponent implements OnInit, OnDestroy {
for (let list of this.createGroup.list) {
for (let data of list.data) {
for (let filter of this.createGroup.info.filter) {
let nameFlag = filter.username === data.name;
const nameFlag = filter.username === data.name;
if (nameFlag) {
data.show = false;
break;
Expand Down Expand Up @@ -234,7 +234,7 @@ export class CreateGroupComponent implements OnInit, OnDestroy {
appkey: authPayload.appKey
});
}
let groupInfo: any = {
const groupInfo = {
memberUsernames,
detailMember: this.selectList
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ export class CreateSingleChatComponent implements OnInit, AfterViewInit {
private emptySingleChatTip: EventEmitter<any> = new EventEmitter();
constructor(
private elementRef: ElementRef
) {

}
) {}
public ngOnInit() {
// pass
}
Expand Down
12 changes: 8 additions & 4 deletions src/app/components/drop-file/drop-file.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@
width: 400px;
height: 360px;
background: #FFFFFF;
box-shadow: 1px 1px 5px 2px rgba(0, 0, 0, 0.2);
-webkit-box-shadow: 1px 1px 5px 2px rgba(0, 0, 0, 0.2);
box-shadow: 1px 1px 5px 2px rgba(0, 0, 0, 0.2);
border-radius: 4px;
position: fixed;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
padding: 0 35px;
box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
h2{
height: 74px;
font-size: 16px;
Expand All @@ -24,7 +26,8 @@
width: 330px;
height: 200px;
padding-top: 28px;
box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
.drop-file-icon{
width: 100px;
height: 100px;
Expand Down Expand Up @@ -74,7 +77,8 @@
.modal-btn{
height: 86px;
padding-top: 31px;
box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
button{
width: 150px;
}
Expand Down
6 changes: 4 additions & 2 deletions src/app/components/emoji/emoji.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
.emoji-normal{
padding: 15px 20px 0 20px;
overflow: hidden;
box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
width: 476px;
height: 217px;
position: relative;
Expand Down Expand Up @@ -78,7 +79,8 @@
height: 30px;
padding-left: 11px;
background-color: #F2F6FB;
box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
>button{
width: 30px;
height: 30px;
Expand Down
12 changes: 8 additions & 4 deletions src/app/components/group-avatar/group-avatar.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@
width: 400px;
height: 360px;
background: #FFFFFF;
box-shadow: 1px 1px 5px 2px rgba(0, 0, 0, 0.2);
-webkit-box-shadow: 1px 1px 5px 2px rgba(0, 0, 0, 0.2);
box-shadow: 1px 1px 5px 2px rgba(0, 0, 0, 0.2);
border-radius: 4px;
position: fixed;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
padding: 0 35px;
box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
h2{
height: 74px;
font-size: 16px;
Expand Down Expand Up @@ -40,13 +42,15 @@
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
}
.modal-btn{
height: 86px;
padding-top: 31px;
box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
button{
width: 150px;
}
Expand Down
13 changes: 7 additions & 6 deletions src/app/components/group-avatar/group-avatar.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { Component, OnInit, Input, Output, EventEmitter, ElementRef } from '@angular/core';
import '../../../assets/static/js/cropper.min.css';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/switchMap';
Expand Down Expand Up @@ -28,14 +28,15 @@ export class GroupAvatarComponent implements OnInit {
private minHeight;
private maxWidth;
private maxHeight;
constructor(private store$: Store<any>) {
// pass
}
constructor(
private store$: Store<any>,
private elementRef: ElementRef
) {}
public ngOnInit() {
// pass
}
private cropperImgLoad() {
let image = document.getElementById('cropper');
const image = this.elementRef.nativeElement.querySelector('#cropper');
this.cropper = new Cropper(image, {
aspectRatio: 1 / 1,
zoomable: false,
Expand All @@ -55,7 +56,7 @@ export class GroupAvatarComponent implements OnInit {
private modalAction(event, type ?) {
event.stopPropagation();
if (type === 'confirm') {
let that = this;
const that = this;
let canvas = this.cropper.getCroppedCanvas({
width: that.width,
height: that.height,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
.description-textarea{
width: 320px;
height: 116px;
box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
margin: 32px auto 29px;
textarea{
width: 100%;
height: 100%;
resize: none;
padding: 12px;
box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
border: 1px solid #D9DEE4;
border-radius: 4px;
outline: none;
Expand Down
3 changes: 2 additions & 1 deletion src/app/components/group-info/group-info.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
.group-info-top{
height: 194px;
padding-top: 52px;
box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
margin-bottom: 12px;
.group-info-avatar{
width: 60px;
Expand Down
3 changes: 2 additions & 1 deletion src/app/components/group-info/group-info.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ export class GroupInfoComponent implements OnInit {
this.applyEnterGroup.emit(this.groupInfo.info);
}
private changeGroupConversationAction() {
let group = {
const group = {
appkey: this.groupInfo.info.appkey,
avatar: this.groupInfo.info.avatar,
avatarUrl: this.groupInfo.info.avatarUrl,
ctime: this.groupInfo.info.ctime,
desc: this.groupInfo.info.desc,
flag: this.groupInfo.info.flag,
gid: this.groupInfo.info.gid,
key: this.groupInfo.info.gid,
max_member_count: this.groupInfo.info.max_member_count,
mtime: this.groupInfo.info.mtime,
name: this.groupInfo.info.name,
Expand Down
6 changes: 4 additions & 2 deletions src/app/components/group-list/group-list.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
left: 0;
right: 0;
bottom: 0;
box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
h2{
font-size: 16px;
color: #2C2C2C;
Expand All @@ -20,7 +21,8 @@
color: #808080;
font-size: 12px;
position: relative;
box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
cursor: default;
&:after{
content: '';
Expand Down
6 changes: 4 additions & 2 deletions src/app/components/group-setting/group-setting.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
position: absolute;
top: 0;
right: 0;
box-shadow: 0 2px 4px 0 rgba(0,0,0,0.50);
-webkit-box-shadow: 0 2px 4px 0 rgba(0,0,0,0.50);
box-shadow: 0 2px 4px 0 rgba(0,0,0,0.50);
border-bottom-right-radius: 3px;
z-index: 4;
-webkit-transform: translateX(101%) translate3d(0, 0, 0);
Expand Down Expand Up @@ -102,7 +103,8 @@
border: 1px solid #E3E6EB;
border-radius: 3px;
padding-left: 5px;
box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
font-size: 14px;
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/app/components/image-viewer/image-viewer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ export class ImageViewerComponent implements OnInit {
}
private initImgviewer() {
const viewerWrap = this.elementRef.nativeElement.querySelector('#viewerWrap');
let activeWidth = this.imageViewer.active.width;
let activeHeight = this.imageViewer.active.height;
let offsetWidth = viewerWrap.offsetWidth;
let offsetHeight = viewerWrap.offsetHeight;
const activeWidth = this.imageViewer.active.width;
const activeHeight = this.imageViewer.active.height;
const offsetWidth = viewerWrap.offsetWidth;
const offsetHeight = viewerWrap.offsetHeight;
if (activeWidth / offsetWidth > activeHeight / offsetHeight &&
activeWidth > offsetWidth * 0.6) {
this.position.width = this.initPosition.width = offsetWidth * 0.6;
Expand Down
6 changes: 4 additions & 2 deletions src/app/components/linkman-list/linkman-list.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
left: 0;
right: 0;
bottom: 0;
box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
h2{
font-size: 16px;
color: #2C2C2C;
Expand All @@ -20,7 +21,8 @@
color: #808080;
font-size: 12px;
position: relative;
box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
cursor: default;
&:after{
content: '';
Expand Down
Loading

0 comments on commit 25274ab

Please sign in to comment.