_id.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. <template>
  2. <div>
  3. <div class="wrapper pc" v-if="screenWidth > 960">
  4. <h1 class="title">{{city}}-{{job}}收入水平</h1>
  5. <div class="subtitle">{{city}}{{job}}平均工资:¥{{avg_salary}}/月,统计来自程序员客栈(proginn.com)</div>
  6. <div class="content">
  7. <div class="module-wrapper">
  8. <div class="module-title">开发者薪资范围分布</div>
  9. <div id="range-chart" class="range-chart"></div>
  10. </div>
  11. <div class="module-wrapper">
  12. <div class="average-title">平均工资:¥{{avg_salary}}元/月</div>
  13. <div
  14. class="average-subtitle"
  15. >最高为{{max_salary}}元/月,最低为{{min_salary}}元/月,其中,平均工资为{{avg_salary}}元/月</div>
  16. <img class="average-img" src="@/assets/img/salary/average_salary.png" alt />
  17. </div>
  18. <!-- <div class="module-wrapper">-->
  19. <!-- <div class="module-title">杭州其他岗位平均工资</div>-->
  20. <!-- <div id="industry-chart" class="industry-chart"></div>-->
  21. <!-- </div>-->
  22. <!-- <div class="module-wrapper">-->
  23. <!-- <div class="module-title">按工作经验统计</div>-->
  24. <!-- <div id="experience-chart" class="experience-chart"></div>-->
  25. <!-- </div>-->
  26. <!-- <div class="module-wrapper">-->
  27. <!-- <div class="module-title">按学历统计</div>-->
  28. <!-- <div id="education-chart" class="education-chart"></div>-->
  29. <!-- </div>-->
  30. <!-- <div class="module-wrapper">-->
  31. <!-- <div class="module-title">按各城市岗位需求统计</div>-->
  32. <!-- <div id="city-chart" class="city-chart"></div>-->
  33. <!-- </div>-->
  34. <div class="module-wrapper">
  35. <div class="module-title">全国城市{{job}}平均工资</div>
  36. <div class="module-list">
  37. <div class="module-item" v-for="citys in allCitySalary">
  38. <div class="module-label">{{citys.city}}</div>
  39. <div class="module-line"></div>
  40. <div class="module-salary">¥{{citys.salary}}元/月</div>
  41. </div>
  42. </div>
  43. </div>
  44. <div class="module-wrapper">
  45. <div class="module-title">{{city}}其他岗位平均工资</div>
  46. <div class="module-list">
  47. <div class="module-item" v-for="jobs in jobList">
  48. <div class="module-label">{{jobs.job}}</div>
  49. <div class="module-line"></div>
  50. <div class="module-salary">¥{{jobs.salary}}元/月</div>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. <div class="wrapper mobile" v-else-if="screenWidth > 0">
  57. <div class="title-wrapper">
  58. <div class="title">{{city}}-{{job}}收入水平</div>
  59. <div class="subtitle">杭州产品经理平均工资:¥66666/月,统计来自程序员客栈(proginn.com)</div>
  60. </div>
  61. <div class="module-wrapper">
  62. <div class="module-title">开发者薪资排行城市TOP10</div>
  63. <div id="range-chart" class="range-chart"></div>
  64. </div>
  65. <div class="module-wrapper">
  66. <div class="average-title">平均工资:¥13000元/月</div>
  67. <div class="average-subtitle">最高为16000元/月,最低为10000元/月,其中,人工智能行业的产品经理平均工资最高达54363元/月</div>
  68. <img class="average-img" src="@/assets/img/salary/average_salary.png" alt />
  69. </div>
  70. <!-- <div class="module-wrapper">-->
  71. <!-- <div class="module-title">杭州其他岗位平均工资</div>-->
  72. <!-- <div id="industry-chart" class="industry-chart"></div>-->
  73. <!-- </div>-->
  74. <!-- <div class="module-wrapper">-->
  75. <!-- <div class="module-title">按工作经验统计</div>-->
  76. <!-- <div id="experience-chart" class="experience-chart"></div>-->
  77. <!-- </div>-->
  78. <!-- <div class="module-wrapper">-->
  79. <!-- <div class="module-title">按学历统计</div>-->
  80. <!-- <div id="education-chart" class="education-chart"></div>-->
  81. <!-- </div>-->
  82. <!-- <div class="module-wrapper">-->
  83. <!-- <div class="module-title">按各城市岗位需求统计</div>-->
  84. <!-- <div id="city-chart" class="city-chart"></div>-->
  85. <!-- </div>-->
  86. <div class="module-wrapper">
  87. <div class="module-title">全国城市{{job}}平均工资</div>
  88. <div class="module-list">
  89. <div class="module-item" v-for="citys in allCitySalary">
  90. <div class="module-label">{{citys.city}}</div>
  91. <div class="module-line"></div>
  92. <div class="module-salary">¥{{citys.salary}}元/月</div>
  93. </div>
  94. </div>
  95. </div>
  96. <div class="module-wrapper">
  97. <div class="module-title">{{city}}其他岗位平均工资</div>
  98. <div class="module-list">
  99. <div class="module-item" v-for="jobs in jobList">
  100. <div class="module-label">{{jobs.job}}</div>
  101. <div class="module-line"></div>
  102. <div class="module-salary">¥{{jobs.salary}}元/月</div>
  103. </div>
  104. </div>
  105. </div>
  106. </div>
  107. </div>
  108. </template>
  109. <script>
  110. import axios from 'axios'
  111. import qs from 'qs'
  112. export default {
  113. head() {
  114. return {
  115. title: `${this.city}${this.job}月薪工资待遇查询,${this.city}企业招聘${this.city}费用查询-程序员客栈`,
  116. meta: [
  117. {
  118. name: "keywords",
  119. content: `${this.city}${this.job}工资,${this.city}${this.job}兼职工资,${this.city}企业${this.job}招聘费用`
  120. },
  121. {
  122. name: "descrption",
  123. content: `程序员客栈提供${this.city}${this.job}工资查询,让${this.city}${this.job}程序员能了解自身兼职价值,帮助${this.city}有${this.job}招聘需求的企业利用合理的费用找到合适的人才!`
  124. }
  125. ]
  126. };
  127. },
  128. async asyncData ({ $axios, req, res }) {
  129. // 请检查您是否在服务器端
  130. // 使用 req 和 res
  131. console.log(req)
  132. if (process.server) {
  133. const path = req.url
  134. const cityJob = path.split('/')[2]
  135. const city = cityJob.split('-')[0]
  136. const job = cityJob.split('-')[1]
  137. let params = {
  138. job: job,
  139. city: city
  140. };
  141. let res = await $axios.$post("/api/salary/search_info", params);
  142. const jobList = res.data.jobSort || [];
  143. const experience = res.data.experience || [];
  144. for (let i = 0; i < jobList.length; i++) {
  145. jobList[i].salary = parseInt(jobList[i].salary);
  146. }
  147. for (let i = 0; i < experience.length; i++) {
  148. experience[i].salary = parseInt(experience[i].salary);
  149. }
  150. return {
  151. host: req.headers.host,
  152. job: res.data.info.job,
  153. city: res.data.info.city,
  154. avg_salary: res.data.info.avg_salary,
  155. max_salary: res.data.info.max_salary,
  156. min_salary: res.data.info.min_salary,
  157. jobList: jobList,
  158. experience: experience,
  159. allCitySalary: res.data.allCitySalary || [],
  160. salaryRange: res.data.salaryRange || [],
  161. screenWidth: 1366,
  162. }
  163. }
  164. return {}
  165. },
  166. data() {
  167. return {
  168. screenWidth: 0,
  169. job: "",
  170. city: "",
  171. avg_salary: 0,
  172. max_salary: 0,
  173. min_salary: 0,
  174. jobList: [],
  175. experience: [],
  176. allCitySalary: [],
  177. salaryRange: []
  178. };
  179. },
  180. mounted() {
  181. this.screenWidth = window.screen.width;
  182. this.$nextTick(() => {
  183. this.getData();
  184. // this.getRangeChart();
  185. // this.getIndustryChart();
  186. // this.getExperienceChart();
  187. // this.getEducationChart()
  188. // this.getCityChart()
  189. });
  190. },
  191. methods: {
  192. async getData() {
  193. const path = window.location.pathname
  194. const cityJob = path.split('/')[2]
  195. this.city = cityJob.split('-')[0]
  196. this.job = cityJob.split('-')[1]
  197. let params = {
  198. job: this.job,
  199. city: this.city
  200. };
  201. let res = await this.$axios.$post("/api/salary/search_info", params);
  202. this.job = res.data.info.job;
  203. this.city = res.data.info.city;
  204. this.avg_salary = res.data.info.avg_salary;
  205. this.max_salary = res.data.info.max_salary;
  206. this.min_salary = res.data.info.min_salary;
  207. this.jobList = res.data.jobSort || [];
  208. this.experience = res.data.experience || [];
  209. this.allCitySalary = res.data.allCitySalary || [];
  210. this.salaryRange = res.data.salaryRange || [];
  211. for (let i = 0; i < this.jobList.length; i++) {
  212. this.jobList[i].salary = parseInt(this.jobList[i].salary);
  213. }
  214. for (let i = 0; i < this.experience.length; i++) {
  215. this.experience[i].salary = parseInt(this.experience[i].salary);
  216. }
  217. const sortJob = this.jobList;
  218. const sortExperience = this.experience;
  219. const allSalaryRange = this.salaryRange;
  220. const chart = new G2.Chart({
  221. container: "range-chart",
  222. forceFit: true,
  223. height: 300
  224. });
  225. chart.source(allSalaryRange, {
  226. percent: {
  227. formatter: function formatter(val) {
  228. val = val * 100 + "%";
  229. return val;
  230. }
  231. }
  232. });
  233. chart.coord("theta", {
  234. radius: 0.75
  235. });
  236. chart.tooltip({
  237. showTitle: false,
  238. itemTpl:
  239. '<li><span style="background-color:{color};" class="g2-tooltip-marker"></span>{name}: {value}</li>'
  240. });
  241. chart
  242. .intervalStack()
  243. .position("percent")
  244. .color("item")
  245. .label("percent", {
  246. formatter: function formatter(val, item) {
  247. return item.point.item + ": " + val;
  248. }
  249. })
  250. .tooltip("item*percent", function(item, percent) {
  251. percent = percent * 100 + "%";
  252. return {
  253. name: item,
  254. value: percent
  255. };
  256. })
  257. .style({
  258. lineWidth: 1,
  259. stroke: "#fff"
  260. });
  261. chart.render();
  262. // const chart1 = new G2.Chart({
  263. // container: "industry-chart",
  264. // forceFit: true,
  265. // height: 300
  266. // });
  267. // chart1.source(sortJob);
  268. // chart1.scale("salary", {
  269. // min: 0
  270. // });
  271. // chart1.scale("job", {
  272. // range: [0, 1]
  273. // });
  274. // chart1.tooltip({
  275. // crosshairs: {
  276. // type: "line"
  277. // }
  278. // });
  279. // chart1.line().position("job*salary");
  280. // chart1
  281. // .point()
  282. // .position("job*salary")
  283. // .size(4)
  284. // .shape("circle")
  285. // .style({
  286. // stroke: "#fff",
  287. // lineWidth: 1
  288. // });
  289. // chart1.render();
  290. // const chart2 = new G2.Chart({
  291. // container: "experience-chart",
  292. // forceFit: true,
  293. // height: 300
  294. // });
  295. // chart2.source(sortExperience);
  296. // chart2.scale("salary", {
  297. // min: 0
  298. // });
  299. // chart2.scale("experience", {
  300. // range: [0, 1]
  301. // });
  302. // chart2.tooltip({
  303. // crosshairs: {
  304. // type: "line"
  305. // }
  306. // });
  307. // chart2.line().position("experience*salary");
  308. // chart2
  309. // .point()
  310. // .position("experience*salary")
  311. // .size(4)
  312. // .shape("circle")
  313. // .style({
  314. // stroke: "#fff",
  315. // lineWidth: 1
  316. // });
  317. // chart2.render();
  318. }
  319. }
  320. };
  321. </script>
  322. <style lang="scss" scoped>
  323. .wrapper {
  324. overflow: hidden;
  325. }
  326. .main {
  327. margin: 0;
  328. width: 100%;
  329. }
  330. .pc {
  331. margin: 10px auto;
  332. padding-bottom: 36px;
  333. width: 1000px;
  334. background-color: #ffffff;
  335. .title {
  336. margin-top: 30px;
  337. margin-left: 18px;
  338. line-height: 28px;
  339. font-weight: 600;
  340. font-size: 20px;
  341. color: #333333;
  342. }
  343. .subtitle {
  344. margin-top: 7px;
  345. margin-left: 18px;
  346. line-height: 17px;
  347. font-size: 12px;
  348. color: #999999;
  349. }
  350. .content {
  351. margin-top: 51px;
  352. display: flex;
  353. justify-content: center;
  354. flex-wrap: wrap;
  355. }
  356. .module-wrapper {
  357. overflow: hidden;
  358. width: 480px;
  359. min-height: 366px;
  360. border: 1px solid #ebebeb;
  361. }
  362. .module-title {
  363. margin-top: 22px;
  364. margin-left: 31px;
  365. line-height: 25px;
  366. font-weight: 600;
  367. font-size: 18px;
  368. color: #000000;
  369. }
  370. .range-chart,
  371. .industry-chart,
  372. .experience-chart,
  373. .education-chart,
  374. .city-chart {
  375. margin-top: 38px;
  376. margin-left: -20px;
  377. }
  378. .average-title {
  379. margin-top: 51px;
  380. line-height: 28px;
  381. text-align: center;
  382. font-weight: 600;
  383. font-size: 20px;
  384. color: #000000;
  385. }
  386. .average-subtitle {
  387. margin: 9px auto 0;
  388. width: 422px;
  389. line-height: 18px;
  390. font-size: 13px;
  391. color: #666666;
  392. }
  393. .average-img {
  394. margin: 50px auto 0;
  395. display: block;
  396. width: 235px;
  397. height: 135px;
  398. }
  399. .module-list {
  400. margin-top: 24px;
  401. margin-bottom: 10px;
  402. }
  403. .module-item {
  404. display: flex;
  405. align-items: center;
  406. }
  407. .module-label {
  408. margin-left: 25px;
  409. line-height: 32px;
  410. font-weight: 500;
  411. font-size: 13px;
  412. color: #000000;
  413. }
  414. .module-line {
  415. flex: 1;
  416. margin-left: 13px;
  417. margin-right: 5px;
  418. border-bottom: 1px dashed #bcbcbc;
  419. }
  420. .module-salary {
  421. margin-right: 23px;
  422. line-height: 32px;
  423. font-size: 12px;
  424. color: #666666;
  425. }
  426. }
  427. .mobile {
  428. .title-wrapper {
  429. overflow: hidden;
  430. width: 100%;
  431. height: 2.38rem;
  432. background-color: #ffffff;
  433. }
  434. .title {
  435. margin-top: 0.54rem;
  436. margin-left: 0.3rem;
  437. line-height: 0.56rem;
  438. font-weight: 600;
  439. font-size: 0.4rem;
  440. color: #333333;
  441. }
  442. .subtitle {
  443. margin-top: 0.1rem;
  444. margin-left: 0.3rem;
  445. width: 7.04rem;
  446. line-height: 0.34rem;
  447. font-size: 0.24rem;
  448. color: #999999;
  449. }
  450. .module-wrapper {
  451. overflow: hidden;
  452. margin-top: 0.12rem;
  453. width: 100%;
  454. background-color: #ffffff;
  455. }
  456. .module-title {
  457. margin-top: 0.38rem;
  458. margin-left: 0.36rem;
  459. line-height: 0.44rem;
  460. font-weight: 600;
  461. font-size: 0.32rem;
  462. color: #000000;
  463. }
  464. .range-chart,
  465. .industry-chart,
  466. .experience-chart,
  467. .education-chart,
  468. .city-chart {
  469. margin-top: 0.38rem;
  470. margin-left: -0.4rem;
  471. }
  472. .average-title {
  473. margin-top: 0.38rem;
  474. margin-left: 0.36rem;
  475. line-height: 0.44rem;
  476. font-weight: 600;
  477. font-size: 0.32rem;
  478. color: #000000;
  479. }
  480. .average-subtitle {
  481. margin: 0.28rem auto 0;
  482. width: 6.76rem;
  483. line-height: 0.36rem;
  484. font-size: 0.24rem;
  485. color: #666666;
  486. }
  487. .average-img {
  488. margin: 0.94rem auto 0;
  489. display: block;
  490. width: 4.7rem;
  491. height: 2.7rem;
  492. }
  493. .module-list {
  494. margin-top: 0.34rem;
  495. margin-bottom: 0.4rem;
  496. }
  497. .module-item {
  498. display: flex;
  499. align-items: center;
  500. }
  501. .module-label {
  502. margin-left: 0.36rem;
  503. line-height: 0.64rem;
  504. font-weight: 500;
  505. font-size: 0.26rem;
  506. color: #000000;
  507. }
  508. .module-line {
  509. flex: 1;
  510. margin-left: 0.2rem;
  511. margin-right: 0.1rem;
  512. width: 4.44rem;
  513. border-bottom: 0.02rem dashed #bcbcbc;
  514. }
  515. .module-salary {
  516. margin-right: 0.3rem;
  517. line-height: 0.64rem;
  518. font-size: 0.24rem;
  519. color: #666666;
  520. }
  521. }
  522. </style>