Browse Source

b端国际化 首页

master
hx 2 months ago
parent
commit
9e99a5df5a
  1. 5
      src/lang/dashboard-messages.js
  2. 5
      src/lang/device-messages.js
  3. 9
      src/permission.js
  4. 12
      src/views/dashboard/index.vue
  5. 20
      src/views/device/device/index.vue
  6. 8
      src/views/device/device/trajectory/index.vue

5
src/lang/dashboard-messages.js

@ -21,6 +21,7 @@ const dashboardMessages = {
},
popup: {
device: "设备",
alias: "名称",
time: "时间",
remark: "备注",
coordinates: "坐标"
@ -59,6 +60,7 @@ const dashboardMessages = {
},
popup: {
device: "Device",
alias: "Alias",
time: "Time",
remark: "Remark",
coordinates: "Coordinates"
@ -97,6 +99,7 @@ const dashboardMessages = {
},
popup: {
device: "Appareil",
alias: "Alias",
time: "Heure",
remark: "Remarque",
coordinates: "Coordonnees"
@ -135,6 +138,7 @@ const dashboardMessages = {
},
popup: {
device: "Dispositivo",
alias: "Alias",
time: "Hora",
remark: "Observacion",
coordinates: "Coordenadas"
@ -173,6 +177,7 @@ const dashboardMessages = {
},
popup: {
device: "Dispositivo",
alias: "Alias",
time: "Hora",
remark: "Observacao",
coordinates: "Coordenadas"

5
src/lang/device-messages.js

@ -49,6 +49,7 @@ const deviceZh = {
table: {
orderCode: "订单号",
deviceStatus: "设备状态",
activationStatusTime: "启用/禁用时间",
model: "型号",
sn: "序列号",
alias: "名称",
@ -226,6 +227,7 @@ const deviceEn = {
table: {
orderCode: "Order No.",
deviceStatus: "Device Status",
activationStatusTime: "Enable/Disable Time",
model: "Model",
sn: "Serial No.",
alias: "Name",
@ -396,6 +398,7 @@ const deviceFr = {
table: {
orderCode: "Numero de commande",
deviceStatus: "Etat appareil",
activationStatusTime: "Heure activation/desactivation",
model: "Modele",
sn: "Numero de serie",
alias: "Nom",
@ -566,6 +569,7 @@ const deviceEs = {
table: {
orderCode: "Numero de pedido",
deviceStatus: "Estado del dispositivo",
activationStatusTime: "Hora de activacion/desactivacion",
model: "Modelo",
sn: "Numero de serie",
alias: "Nombre",
@ -736,6 +740,7 @@ const devicePt = {
table: {
orderCode: "Numero do pedido",
deviceStatus: "Status do dispositivo",
activationStatusTime: "Hora de ativacao/desativacao",
model: "Modelo",
sn: "Numero de serie",
alias: "Nome",

9
src/permission.js

@ -10,13 +10,14 @@ import { isRelogin } from "@/utils/request";
NProgress.configure({ showSpinner: false });
const whiteList = ["/login", "/register"];
const HOME_PATH = "/index";
const isWhiteList = (path) => {
return whiteList.some((pattern) => isPathMatch(pattern, path));
};
const hasHomeRoute = (routes) => {
return Array.isArray(routes) && routes.some((route) => route && route.path === "/" && route.redirect === "/index");
return Array.isArray(routes) && routes.some((route) => route && route.path === "/" && route.redirect === HOME_PATH);
};
router.beforeEach((to, from, next) => {
@ -26,7 +27,7 @@ router.beforeEach((to, from, next) => {
store.dispatch("settings/setTitle", to.meta.title);
}
if (to.path === "/login") {
next({ path: "/" });
next({ path: HOME_PATH, replace: true });
NProgress.done();
return;
}
@ -44,6 +45,10 @@ router.beforeEach((to, from, next) => {
next({ path: "/no-permission", replace: true });
return;
}
if (to.path === "/") {
next({ path: HOME_PATH, replace: true });
return;
}
next({ ...to, replace: true });
});
}).catch((err) => {

12
src/views/dashboard/index.vue

@ -558,7 +558,10 @@ export default {
return (
'<div class="dashboard-map-popup">' +
`<div><strong>${this.escapeHtml(this.$t("dashboard.overview.popup.device"))}</strong>${separator}${this.escapeHtml(
point.alias || point.sn || point.id || "-"
point.sn || point.id || "-"
)}</div>` +
`<div><strong>${this.escapeHtml(this.$t("dashboard.overview.popup.alias"))}</strong>${separator}${this.escapeHtml(
point.alias || "-"
)}</div>` +
`<div><strong>${this.escapeHtml(this.$t("dashboard.overview.popup.time"))}</strong>${separator}${this.escapeHtml(
this.formatDateTime(point.lastLocationTime)
@ -566,6 +569,9 @@ export default {
`<div><strong>${this.escapeHtml(this.$t("dashboard.overview.popup.remark"))}</strong>${separator}${this.escapeHtml(
point.remark || "-"
)}</div>` +
`<div><strong>${this.escapeHtml(
this.$t("dashboard.overview.popup.coordinates")
)}</strong>${separator}${this.escapeHtml(point.latNum)} / ${this.escapeHtml(point.lngNum)}</div>` +
"</div>"
);
@ -749,7 +755,7 @@ export default {
.dashboard-map-shell {
position: relative;
width: 100%;
height: 560px;
height: 640px;
max-width: 100%;
box-sizing: border-box;
border-radius: 8px;
@ -794,7 +800,7 @@ export default {
}
.dashboard-map-shell {
height: 420px;
height: 500px;
}
}
</style>

20
src/views/device/device/index.vue

@ -124,6 +124,11 @@
</el-tag>
</template>
</el-table-column>
<el-table-column :label="$t('device.table.activationStatusTime')" align="center" min-width="170">
<template slot-scope="scope">
<span>{{ formatActivationStatusTime(scope.row) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('device.table.model')" align="center" prop="model" />
<el-table-column :label="$t('device.table.sn')" align="center" prop="sn" />
<el-table-column :label="$t('device.table.alias')" align="center" prop="alias" />
@ -757,10 +762,21 @@ export default {
this.multiple = !selection.length;
},
getActivationStatusLabel(value) {
return value === true || value === 1 || value === "1" ? this.$t("device.status.enabled") : this.$t("device.status.disabled");
return this.isActivationEnabled(value) ? this.$t("device.status.enabled") : this.$t("device.status.disabled");
},
getActivationTagType(value) {
return value === true || value === 1 || value === "1" ? "success" : "info";
return this.isActivationEnabled(value) ? "success" : "info";
},
isActivationEnabled(value) {
return value === true || value === 1 || value === "1" || value === "true";
},
formatActivationStatusTime(row) {
if (!row) {
return "-";
}
const isActivated = this.isActivationEnabled(row.activationStatus);
const timeValue = isActivated ? row.activationTime : row.disableTime;
return timeValue ? this.parseTime(timeValue, "{y}-{m}-{d} {h}:{i}:{s}") : "-";
},
formatCoordinateValue(value) {
if (value === null || value === undefined) {

8
src/views/device/device/trajectory/index.vue

@ -119,15 +119,15 @@
</el-descriptions>
<div class="summary">轨迹点数{{ points.length }} | 开始{{ startTime }} | 结束{{ endTime }}</div>
<el-table :data="points" border size="mini" height="460">
<el-table-column type="index" width="52" />
<el-table-column type="index" width="35" />
<el-table-column label="位置时间" min-width="130">
<template slot-scope="scope">{{ pointTime(scope.row) }}</template>
</el-table-column>
<el-table-column label="经纬度" min-width="160">
<el-table-column prop="address" label="地址" min-width="250" show-overflow-tooltip />
<el-table-column label="经纬度" min-width="100">
<template slot-scope="scope">{{ pointCoord(scope.row) }}</template>
</el-table-column>
<el-table-column prop="address" label="地址" min-width="200" show-overflow-tooltip />
<el-table-column prop="battery" label="电量" width="70" />
</el-table>
</template>
</section>

Loading…
Cancel
Save