`審查人:白占寧`
`被審核代碼負責人:歐陽德才`
`代碼地址:https://192.168.1.240:8443/svn/repos/diaisi-quxian`
#### 1、缺少必要的注釋(已修改)
很多JS文件里面一句注釋都沒有,差評!!!
#### 2、mock URL不符合規范(已修改)
文件路徑:`mock/index.js`
```
import Map from './map'
import Time from './time'
```
建議統一添加`fetch`前綴。
#### 3、原生DOM方法與jQuery混用(已修改)
文件路徑:`components/time/index.js`
```
const div = document.createElement('div')
div.setAttribute('class','time')
$(el).append(div)
```
統一使用jQuery的方式,避免原生方法和jQuery混用。
#### 4、不符合基本的JS規范(已修改)
```
import {fetch} from '@/util/request'
import './index.css'
const mapConfig = {
height: 1600,
width: 1700,
scaleTimes: 50
}
class Map{
constructor(el){
this.Jiulongpo = new Jiulongpo(el, mapConfig)
}
render(){
fetch('Map', data => {
this.Jiulongpo.render(data)
})
}
}
```
以上代碼不規范的地方如下:
- `{ }`兩邊沒有留空格;
- `import`、變量定義和類定義之間沒有留空行;
- 縮進不對,建議使用2個空格縮進,添加eslint檢測;
- `render(){`方法定義和`{`之間差個空格。
#### 5、代碼可讀性差(已修改)
```
{startAngle: 0, endAngle: percent * 2 * Math.PI, innerRadius: 69, outerRadius: 75},
{startAngle: percent == 1 ? 0 : (percent + 0.01) * 2 * Math.PI, endAngle: percent == 1 ? 0 : 1.98 * Math.PI, innerRadius: 70, outerRadius: 74}
```
建議每行不超過120個字符。
#### 6、這個什么操作?(已修改)
```
(
function repeat() {
$('.important-into .case-list').css('top',$('.case-info').outerHeight() + 'px')
$('.important-into .case-list').animate({ 'top' : -ulHeight + 'px'}, liCount * 5000, 'linear', repeat)
}()
)
```
#### 7、圖表組件結構不對(已修改)
```
export default class CasePie{
constructor(config){
this.config = config
this.arcPath = d3.svg.arc()
}
```
容器與配置項分離,所有圖表組件提供默認配置項。
#### 8、可優化的代碼(已修改)
```
.attr('transform', 'translate(' + this.config.centroid.x + ', ' + this.config.centroid.y + ')')
.attr('fill', (d, i) => {
return this.config.fill[i]
})
.attr('stroke', this.config.stroke)
```
以上代碼存在的問題:
- 使用字符串模板代替字符串拼接;
- `return`后只有一句時可以簡寫,省略`{}`和`return`;
- 先定義`fill`、`stroke`等變量,不要到處都是`this.config.xxx`。
#### 9、方法定義位置不對(已修改)
```
// 獲取地圖縮放比例
this.getZoomScale = function (features, width, height) {
```
各個實例可以復用的方法定義到原型上,不要定義到構造方法里面。
#### 10、復用性及可擴展性體現在哪里?
如果有另外一個區縣,和現在的樣式很類似,如何用現有的代碼快速開發出來,并且修改的地方很少?
- 1、執法項目
- 1.1 20170523-張紅橋
- 1.2 20170523-李偉
- 2、運維項目
- 2.1 20170527-歐陽德才
- 2.2 20170613-尹幫會&歐陽德才
- 2.3 20170706-歐陽德才
- 2.4 20170706-尹幫會
- 3、指揮大屏項目
- 3.1 20170712-歐陽德才
- 4、PC端項目
- 4.1 20170516-張紅橋
- 5、萬達項目
- 5.1 20170619-李偉&舒曼
- 5.2 20170623-李偉&舒曼
- 5.3 20170803-李偉(未修改)
- 5.4 20170811-李偉(未修改)
- 6、可視化組件
- 6.1 20170718-張紅橋
- 7、UI組件
- 7.1 20170522-舒曼
- 8、新員工練習項目
- 8.1 20170401-歐陽德才
- 8.2 20170401-舒曼
- 8.3 20170503-舒曼
- 8.4 20170609-劉黎
- 8.5 20170620-劉黎
- 8.6 20170703-謝洋
- 8.7 20170706-孫雨珩
- 8.8 20170706-謝洋
- 8.9 20170711-謝洋
- 8.10 20170724-謝洋
- 8.11 20170908-譚俊
- 8.12 20171026-廖爽
- 8.13 20171027-廖爽
- 8.14 20171027-廖爽
- 8.15 20171031-廖爽
- 8.16 20171103-覃英琪
- 8.17 20171103-01-廖爽
- 8.18 20171103-02-廖爽
- 8.19 20171110-趙家紅
- 8.20 20171110-覃英琪
- 8.21 20171110-02-趙家紅
- 8.22 20171115-01-廖爽
- 8.23 20171127-趙家紅
- 8.24 20171122-李祁
- 8.25 20180528-吳泓江
- 9、資源監控大屏
- 9.1 20170705-舒曼
- 9.2 20170711-舒曼
- 9.3 20170724-舒曼
- 10、CQ指揮艙
- 10.1 20170906-張紅橋&李偉&謝洋
- 11、昆明
- 11.1 20171009-李偉&舒曼
- 12、情報墻
- 12.1 20171025-謝洋
- 13、動態管控
- 14、迪愛斯區縣
- 14.1 20171128-歐陽德才
- 15、貴州塊數據指揮調度平臺
- 16、北京東城區可視化項目
- 16.1 20180425-歐陽德才&謝洋
- 16.2 20180510-謝洋