| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434 |
- <template>
- <div>
- <div class="wrapper pc" v-if="screenWidth > 960">
- <div class="header">
- <div class="title">查岗位薪资 就上程序员客栈</div>
- <div class="search-wrapper">
- <div class="search-content">
- <input type="text" @keyup.enter="search" v-model="searchJob" placeholder="请输入您需要查询的岗位名称,如c++软件工程师" class="search-input">
- <el-dropdown @command="handleCommand">
- <div class="search-city">
- <span>{{searchCity}}</span>
- <img src="@/assets/img/salary/icon_arrow_down.png" alt="">
- </div>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item v-for="citys in cityList" :command="citys.city">{{citys.city}}</el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- </div>
- <div @click="search" class="search-btn">查询</div>
- </div>
- <div class="hot-search">热门搜索:<span style="display: inline-block;cursor: pointer;" v-for="jobType in jobList"><div @click="inVal(jobType.job)" >{{jobType.job}}</div></span></div>
- </div>
- <div class="content">
- <div class="info">截至2019年9月6日,调查了全国的开发者的工资数据后发现,{{city}}开发者平均工资最高达¥{{citySalary}}元/月,{{job}}开发者的平均工资最高达{{jobSalary}}元/月,本数据仅供参考。</div>
- <div class="module-wrapper">
- <div class="module-title">开发者薪资排行城市TOP10</div>
- <div id="city-chart" class="city-chart"></div>
- </div>
- <div class="module-wrapper">
- <div class="module-title">开发者薪资岗位TOP10</div>
- <div id="job-chart" class="job-chart"></div>
- </div>
- </div>
- </div>
- <div class="wrapper mobile" v-else-if="screenWidth > 0">
- <div class="header">
- <div class="title">查岗位薪资<br/>就上程序员客栈</div>
- <div class="search-wrapper">
- <div class="search-content">
- <input type="text" @keyup.enter="search" v-model="searchJob" placeholder="岗位名称,如c++软件工程师" class="search-input">
- <el-dropdown>
- <div class="search-city">
- <span>{{searchCity}}</span>
- <img src="@/assets/img/salary/icon_arrow_down.png" alt="">
- </div>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item v-for="citys in cityList" :command="citys.city">{{citys.city}}</el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- </div>
- <div @click="search" class="search-btn">查询</div>
- </div>
- <div class="hot-search">热门搜索:<span style="display: inline-block;cursor: pointer;" v-for="jobType in jobList"><div @click="inVal(jobType.job)" >{{jobType.job}}</div></span></div>
- </div>
- <div class="content">
- <div class="info">截至2019年9月6日,调查了全国38749756名开发者的工资数据后发现,上海开发者平均工资最高达¥97974元/月,Python开发者的平均工资最高达66666元/月,本数据仅供参考。</div>
- <div class="module-wrapper">
- <div class="module-title">开发者薪资排行城市TOP10</div>
- <div id="city-chart" class="city-chart"></div>
- </div>
- <div class="module-wrapper">
- <div class="module-title">开发者薪资岗位TOP10</div>
- <div id="job-chart" class="job-chart"></div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- export default {
- data() {
- return {
- screenWidth: 0,
- cityChart : [],
- jobChart : [],
- jobList :[],
- city:'',
- citySalary:0,
- cityList:[],
- job:'',
- jobSalary:0,
- cityTick:0,
- jobTick:0,
- searchJob:'',
- searchCity:'杭州',
- }
- },
- mounted() {
- this.screenWidth = window.screen.width
- this.$nextTick(()=>{
- this.getData()
- })
- },
- methods: {
- async getData(){
- let res = await this.$axios.$post('/api/salary/index_info');
- this.cityChart = res.data.sortOfCity;
- this.jobChart = res.data.sortOfJob;
- this.jobList = res.data.allJobType;
- this.city = res.data.sortOfCity[0].city;
- this.citySalary = res.data.sortOfCity[0].salary;
- this.job = res.data.sortOfJob[0].job;
- this.jobSalary = res.data.sortOfJob[0].salary;
- this.cityTick = res.data.cityTick;
- this.jobTick = res.data.jobTick;
- this.cityList = res.data.cityList;
- console.log(this.cityList);
- for (let i=0 ;i < this.cityChart.length ;i++){
- this.cityChart[i].salary = parseInt(this.cityChart[i].salary);
- }
- for (let i=0 ;i < this.jobChart.length ;i++){
- this.jobChart[i].salary = parseInt(this.jobChart[i].salary);
- }
- //开发者薪资排行城市TOP10
- const chart1 = new G2.Chart({
- container: 'city-chart',
- forceFit: true,
- height: 400,
- });
- chart1.source(this.cityChart);
- chart1.scale('salary', {
- tickInterval: this.cityTick
- });
- chart1.interval().position('city*salary');
- chart1.render()
- //开发者薪资岗位TOP10
- const chart2 = new G2.Chart({
- container: 'job-chart',
- forceFit: true,
- height: 400,
- });
- chart2.source(this.jobChart);
- chart2.scale('salary', {
- tickInterval: this.jobTick
- });
- chart2.interval().position('job*salary');
- chart2.render()
- },
- handleCommand(command) {
- this.searchCity = command;
- },
- search(){
- if(this.searchJob.length === 0){
- this.$message('请输入查询岗位名称');
- return false;
- }
- this.searchJob = this.searchJob.replace(/c#/, "c%23");
- this.searchJob = this.searchJob.replace(/c\+\+*/, "c%24");
- this.$router.push('/salary/detail?job='+encodeURI(this.searchJob)+'&city='+encodeURI(this.searchCity));
- },
- inVal(val){
- this.searchJob = val;
- }
- }
- }
- </script>
- <style lang="scss" scope>
- .wrapper {
- overflow: hidden;
- }
- .main {
- margin: 0;
- width: 100%;
- }
- .pc {
- .header {
- overflow: hidden;
- width: 100%;
- height: 450px;
- background-image: url('~@/assets/img/salary/background.png');
- background-size: 1920px 533px;
- background-repeat: no-repeat;
- background-position: top center;
- }
- .title {
- margin-top: 104px;
- line-height: 53px;
- text-align: center;
- font-weight: 600;
- font-size: 38px;
- color: #FFFFFF;
- }
- .search-wrapper {
- margin-top: 50px;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .search-content {
- width: 578px;
- height: 53px;
- border-radius: 4px 0px 0px 4px;
- background-color: #FFFFFF;
- display: flex;
- align-items: center;
- }
- .search-input {
- flex: 1;
- padding-left: 14px;
- padding-right: 14px;
- font-size: 16px;
- color: #999999;
- }
- .search-city {
- margin-right: 18px;
- display: flex;
- align-items: center;
- }
- .search-city span {
- line-height: 14px;
- font-weight: 600;
- font-size: 16px;
- color: #919AA7;
- }
- .search-city img {
- margin-left: 4px;
- width: 11px;
- height: 7px;
- }
- .search-btn {
- width: 104px;
- height: 53px;
- border-radius: 0px 4px 4px 0px;
- background-color: #147EFF;
- line-height: 53px;
- text-align: center;
- font-weight:600;
- font-size: 20px;
- color: #FFFFFF;
- cursor: pointer;
- }
- .hot-search {
- margin: 15px auto 0;
- width: 700px;
- line-height: 20px;
- font-weight: 500;
- font-size: 14px;
- color: #FFFFFF;
- }
- .hot-search span {
- margin-right: 20px;
- }
- .content {
- overflow: hidden;
- margin-top: 20px;
- margin-bottom: 20px;
- background-color: #FFFFFF;
- }
- .info {
- margin: 40px auto 0;
- width: 807px;
- line-height: 26px;
- font-size: 15px;
- color: #666666;
- }
- .module-wrapper {
- margin: 50px auto 0;
- width: 1000px;
- }
- .module-title {
- margin-left: 47px;
- line-height: 25px;
- font-weight:600;
- font-size: 18px;
- color: #000000;
- }
- .city-chart, .job-chart {
- margin: 50px auto 0;
- width: 950px;
- }
- }
- .mobile {
- .header {
- overflow: hidden;
- width: 100%;
- height: 6.5rem;
- background-image: url('~@/assets/img/salary/background.png');
- background-size: auto 6.5rem;
- background-repeat: no-repeat;
- background-position: top center;
- }
- .title {
- margin-top: 1.16rem;
- line-height: .92rem;
- text-align: center;
- font-weight: 600;
- font-size: .66rem;
- color: #FFFFFF;
- }
- .search-wrapper {
- margin-top: .66rem;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .search-content {
- width: 5.3rem;
- height: .85rem;
- border-radius: .06rem 0 0 .06rem;
- background-color: #FFFFFF;
- display: flex;
- align-items: center;
- }
- .search-input {
- flex: 1;
- padding-left: .22rem;
- padding-right: .22rem;
- font-size: .26rem;
- color: #999999;
- }
- .search-city {
- margin-right: .32rem;
- display: flex;
- align-items: center;
- }
- .search-city span {
- font-weight: 600;
- font-size: .26rem;
- color: #919AA7;
- }
- .search-city img {
- margin-left: .06rem;
- width: .2rem;
- height: .12rem;
- }
- .search-btn {
- width: 1.66rem;
- height: .85rem;
- border-radius: .06rem 0 0 .06rem;
- background-color: #147EFF;
- line-height: .85rem;
- text-align: center;
- font-weight:600;
- font-size: .32rem;
- color: #FFFFFF;
- }
- .hot-search {
- margin-top: .22rem;
- margin-left: .26rem;
- line-height: .34rem;
- font-weight: 500;
- font-size: .24rem;
- color: #FFFFFF;
- }
- .hot-search span {
- margin-right: .2rem;
- }
- .content {
- overflow: hidden;
- }
- .info {
- margin-bottom: .12rem;
- padding: .5rem .28rem .48rem;
- background-color: #ffffff;
- line-height: .44rem;
- font-size: .26rem;
- color: #666666;
- }
- .module-wrapper {
- overflow: hidden;
- background-color: #ffffff;
- }
- .module-title {
- margin-top: .44rem;
- margin-left: .36rem;
- line-height: .44rem;
- font-weight: 600;
- font-size: .32rem;
- color: #000000;
- }
- .city-chart, .job-chart {
- margin: .48rem auto 0;
- width: 100%;
- }
- .dropdown{
- //设置高度才能显示出滚动条 !important
- height:300px;
- overflow: auto;
- }
- .dropdown::-webkit-scrollbar
- {
- width: 5px;
- height: 5px;
- background-color: #F5F5F5;
- }
- .dropdown::-webkit-scrollbar-track
- {
- //-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
- border-radius: 10px;
- background-color: #F5F5F5;
- }
- }
- </style>
|