-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from chengdujs/develop
update from develop
- Loading branch information
Showing
15 changed files
with
406 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# 0x0、版本描述 | ||
|
||
### 版本发布记录 | ||
|
||
v0.0.1 2017-1-22 13:30 初稿,根据现有代码进行归类,综合 | ||
|
||
### 开发规范贡献者 | ||
|
||
<a href="https://github.com/hstarorg" target="_black"> | ||
<img width="40" src="https://avatars0.githubusercontent.com/u/8816531" alt="hstarorg avator"> | ||
hstarorg | ||
</a> | ||
|
||
# 0x1、基本编码规范 | ||
|
||
1. 统一使用2个空格缩进。(项目已包含editorconfig配置文件,建议安装编辑器/IDE的editorconfig插件) | ||
2. 文件末尾添加新行 | ||
3. 语句需要加分号 | ||
4. 使用ES6编码风格最佳 | ||
5. 使用常规的JS规范(如逗号之后加空格,一般使用VSC格式化即可) | ||
|
||
# 0x2、文件命名规范 | ||
|
||
1. 页面命名统一大驼峰命名,可选加上Page后缀,如 `SearchPage` | ||
2. 其他组件采用全小写命名,使用中横线风格,如 `job-item` | ||
|
||
|
||
# 0x3、Vue编码约定 | ||
|
||
1. 省略 `style, template, script` 的默认值,如使用 `css` 来写 `style`,不需要设定 `lang` | ||
2. Vue组件配置属性,请参考如下顺序: | ||
|
||
大致是基本属性,钩子函数,其他常用配置这样的先后顺序 | ||
|
||
``` | ||
{ | ||
name: '', | ||
props: {}, | ||
components: {}, | ||
filters: {}, | ||
data(){ | ||
}, | ||
created(), | ||
...生命周期钩子, | ||
computed: {}, | ||
watth: {}, | ||
methods: {} | ||
} | ||
``` | ||
3. 私有函数,请使用下划线开头 | ||
|
||
# 0x4、Github PR规范 | ||
|
||
1. 发起PR的时候,请务必注明编写的功能 | ||
2. 请务必提交可运行的代码 | ||
3. 如果有单元测试,请务必保证测试通过之后再提交 | ||
4. PR只允许提交的 `develop` 分支 | ||
|
||
# 0x5、单元测试规范 | ||
|
||
1. 尽可能的编写单元测试代码 | ||
2. 单元测试代码放置于 `test/unit` 目录下,根据页面创建目录,所有测试代码以 `<Page>_test` 结尾,组件同理。 | ||
|
||
# 0x6、vw-ui组件开发规范 | ||
|
||
1. 所有组件放置于 `vw-ui/components` 目录中,以组件名称为目录隔离 | ||
2. 组件不能有其他第三方依赖(不允许除weui之外的三方依赖) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
const conf = { | ||
isDebug: true, | ||
apiHost: 'http://chat.hstar.org:8601/api/v1/HkGhqLCUg' | ||
apiHost: 'http://chat.hstar.org:8601/HkGhqLCUg' | ||
}; | ||
|
||
window.AppConf = conf; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
const conf = { | ||
isDebug: false, | ||
apiHost: 'http://chat.hstar.org:8601/api/v1/HkGhqLCUg' | ||
apiHost: 'http://chat.hstar.org:8601/HkGhqLCUg' | ||
}; | ||
|
||
window.AppConf = conf; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,5 @@ | ||
/* | ||
author:成都-Treasure | ||
email:[email protected] | ||
version:0.0.1 | ||
bug:1.还是没有解决ajax获取的数据无法访问二级对象,把部分内容做成子组件后可以响应 | ||
2.没有设计图的图例,因此找不到部分图标,自己选了,也没有字体大小,padding等设置 | ||
3.预留了路由接口,方便后期整合后台 | ||
4.文字内容没有设置转换器,用了computed,后期可以直接修改 | ||
5.mock数据结构在mock部分 | ||
6.组件padding 12px 16px | ||
*/ | ||
/* author:成都-Treasure email:[email protected] version:0.0.1 bug:1.还是没有解决ajax获取的数据无法访问二级对象,把部分内容做成子组件后可以响应 2.没有设计图的图例,因此找不到部分图标,自己选了,也没有字体大小,padding等设置 | ||
3.预留了路由接口,方便后期整合后台 4.文字内容没有设置转换器,用了computed,后期可以直接修改 5.mock数据结构在mock部分 6.组件padding 12px 16px */ | ||
|
||
|
||
|
||
|
@@ -36,7 +27,7 @@ | |
<li class="item"><i class="ion-android-time"></i><span> {{tag.years}}</span></li> | ||
</ul> | ||
<div class="flag" @click="addMark"> | ||
<i :class="{'ion-ios-star-outline':markflag,'ion-star':!markflag}"></i> | ||
<i :class="{'ion-ios-star-outline':markflag,'ion-star':!markflag}"></i> | ||
<p> {{mark}}</p> | ||
</div> | ||
</div> | ||
|
@@ -47,32 +38,32 @@ | |
</div> | ||
<job-split></job-split> | ||
<div class="company-detail-wrapper"> | ||
<company-detail :companyModel="comDetail.companyName"></company-detail> | ||
<company-detail :companyModel="comDetail.companyName"></company-detail> | ||
</div> | ||
<job-split></job-split> | ||
<div class="company-detail-wrapper"> | ||
<company-detail :companyModel="comDetail.companyDetail"></company-detail> | ||
</div> | ||
<job-split></job-split> | ||
<div class="push-wrapper"> | ||
<vw-button type="primary" @click="pushResume">投简历</vw-button> | ||
<vw-button type="primary" @click="pushResume">投简历</vw-button> | ||
</div> | ||
<job-split></job-split> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
// import '../../vw-ui'; | ||
// import '../../vw-ui'; | ||
import { jobSplit } from 'components'; | ||
import { ajax } from 'common'; | ||
import { ajax, eventBus } from 'common'; | ||
import searchNeeds from './search-needs.vue'; | ||
import companyDetail from './company-detail.vue'; | ||
export default { | ||
name: 'search-detail', | ||
data() { | ||
return { | ||
comDetail: {}, // companyDetail | ||
url: 'http://chat.hstar.org:8601/99ed5748b6c1/companyDetail', | ||
url: `${window.AppConf.apiHost}/comDetailTemplete`, | ||
markflag: false, | ||
money: {}, | ||
tag: {} | ||
|
@@ -89,29 +80,30 @@ | |
companyDetail | ||
}, | ||
created() { | ||
eventBus.emit('set-current-page', 'search'); | ||
this._getData(); | ||
}, | ||
methods: { | ||
_getData() { | ||
ajax.get(this.url) | ||
.then(data => { | ||
if (data.status === 1) { | ||
return data.body; | ||
} else { | ||
throw new Error(); | ||
} | ||
}) | ||
.then(data => { | ||
this.comDetail = data; | ||
this.money = data.money; | ||
this.tag = data.tag; | ||
}) | ||
.catch(() => { | ||
this.$toast.msg('请求的数据未得到', {duration: 3000}, | ||
() => { | ||
window.history.go(-1); | ||
.then(data => { | ||
if (data.status === 1) { | ||
return data.body; | ||
} else { | ||
throw new Error(); | ||
} | ||
}) | ||
.then(data => { | ||
this.comDetail = data; | ||
this.money = data.money; | ||
this.tag = data.tag; | ||
}) | ||
.catch(() => { | ||
this.$toast.msg('请求的数据未得到', { duration: 3000 }, | ||
() => { | ||
window.history.go(-1); | ||
}); | ||
}); | ||
}); | ||
}, | ||
addMark() { | ||
this.markflag = !this.markflag; | ||
|
@@ -120,37 +112,37 @@ | |
console.log('PushResume'); | ||
} | ||
} | ||
/* 使用路由钩子获取数据,后期对接后台接口使用 | ||
beforeRouteEnter(to, from, next) { | ||
ajax.get('http://chat.hstar.org:8601/99ed5748b6c1/companyDetail') | ||
.then(data => { | ||
if (data.status === 1) { | ||
console.log(data); | ||
return data.body; | ||
/* 使用路由钩子获取数据,后期对接后台接口使用 | ||
beforeRouteEnter(to, from, next) { | ||
ajax.get('http://chat.hstar.org:8601/99ed5748b6c1/companyDetail') | ||
.then(data => { | ||
if (data.status === 1) { | ||
console.log(data); | ||
return data.body; | ||
} | ||
}) | ||
.then(data => { | ||
next(vm => { | ||
vm.comDetail = data; | ||
vm.money = data.money; | ||
console.log(data); | ||
}); | ||
}); | ||
}, | ||
watch: { | ||
$route () { | ||
this.comDetail = null; | ||
ajax.get('http://chat.hstar.org:8601/99ed5748b6c1/companyDetail') | ||
.then(data => { | ||
if (data.status === 1) { | ||
return data.body; | ||
} | ||
}) | ||
.then(data => { | ||
this.comDetail = data; | ||
}); | ||
} | ||
}) | ||
.then(data => { | ||
next(vm => { | ||
vm.comDetail = data; | ||
vm.money = data.money; | ||
console.log(data); | ||
}); | ||
}); | ||
}, | ||
watch: { | ||
$route () { | ||
this.comDetail = null; | ||
ajax.get('http://chat.hstar.org:8601/99ed5748b6c1/companyDetail') | ||
.then(data => { | ||
if (data.status === 1) { | ||
return data.body; | ||
} | ||
}) | ||
.then(data => { | ||
this.comDetail = data; | ||
}); | ||
} | ||
} */ | ||
} */ | ||
} | ||
</script> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import SearchPage from './SearchPage'; | ||
import SearchDetail from './SearchDetail'; | ||
|
||
export { | ||
SearchPage | ||
SearchPage, | ||
SearchDetail | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.