Commit 7fd936ec by Sixong.Zhu
parents f2aba9bf 23a41a63
<template>
<div class="position-message" @click="openPosition">
<div class="d-flex justify-content-between align-items-center">
<span class="d-flex align-items-center">
<span class="title">{{ title }}</span>
<span class="d-flex align-items-center flex-fill">
<span class="title flex-fill">{{ title }}</span>
<span
v-for="item in tags"
:key="item.title"
......@@ -46,7 +46,43 @@
}
private get salary() {
return this.positionData.salary;
const max = this.positionData.max_salary;
const min = this.positionData.min_salary;
const formatSalary = (v: number, type?: "Y" | "K") => {
if (type === "K") {
return {
v: parseFloat((v / 1000).toFixed(2)),
unit: "K",
};
}
if (+v < 1000) {
return {
v,
unit: "",
};
} else {
return {
v: parseFloat((v / 1000).toFixed(2)),
unit: "K",
};
}
};
if (!max && !min) {
return "面议";
}
if (+min >= +max) {
const v = formatSalary(min);
return `${v.v}${v.unit}`;
}
const formatMin = formatSalary(min);
const formatMax = formatSalary(max);
if (formatMin.unit === formatMax.unit) {
return `${formatMin.v}-${formatMax.v} ${formatMax.unit}`;
} else {
const formatMin = formatSalary(min, "K");
const formatMax = formatSalary(max, "K");
return `${formatMin.v}-${formatMax.v} K`;
}
}
private get positionBody() {
......@@ -64,7 +100,9 @@
private get tail() {
return [
this.positionData.company_name,
this.positionData.business_scope,
this.positionData.business_scope !== '0'
? this.positionData.business_scope
: "",
];
}
......
......@@ -230,6 +230,8 @@ export interface PositionMessage {
company_name: string;
business_scope: string;
post_id: number;
max_salary: number;
min_salary: number;
}
export interface CsUser {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment