Skip to content

Commit

Permalink
campus-bus: add english station name according university's guideline
Browse files Browse the repository at this point in the history
  • Loading branch information
sparkcyf committed Feb 26, 2024
1 parent 4a8828d commit facdcb0
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 33 deletions.
48 changes: 38 additions & 10 deletions docs/.vuepress/components/BusChartVue.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ export default {
stops1: [],
stops2: [],
historyBusData: [],
themeColor: '#212529', // 默认颜色
themeColor_rev: '#DEE2E6',
echartsOption: {
tooltip: {
show: false,
Expand Down Expand Up @@ -112,9 +114,9 @@ export default {
{
type: "scatter",
label: {
fontSize: 10,
fontSize: 8,
show: true,
color: "#999",
color: "#212529",
position: "right",
formatter: "{b}",
},
Expand All @@ -126,19 +128,19 @@ export default {
data: [],
},
{
type: "scatter",
name: "bus",
label: {
fontSize: 11,
show: true,
color: "#000",
textBorderColor: "#fff",
textBorderWidth: 2,
color: "#212529",
textBorderColor: "#DEE2E6",
textBorderWidth: 2.5,
fontWeight: "bold",
position: "right",
distance: -5,
formatter: "{b}",
},
type: "scatter",
name: "bus",
data: [],
},
],
Expand All @@ -153,6 +155,28 @@ export default {
setEchartsOption(appendOption) {
this.echartsOption = appendOption;
},
checkTheme() {
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
// console.log("dark") // 深色主题
this.themeColor = "#DEE2E6"
this.themeColor_rev = "#212529"
} else {
// console.log("bright") // 浅色主题
this.themeColor = "#212529"
this.themeColor_rev = "#DEE2E6"
}
this.updateSeriesColor();
},
updateSeriesColor() {
// 更新 series 中的 color
this.echartsOption.series = this.echartsOption.series.map(series => {
if (series.label) {
series.label.color = this.themeColor;
series.label.textBorderColor = this.themeColor_rev;
}
return series;
});
},
//加载线路与站点信息
load_data() {
axios
Expand Down Expand Up @@ -298,7 +322,7 @@ export default {
if (f.route_dir>0){
dist = length(thisLine) * 1000 - p_nearest_loc * 1000;
}
//如果距离大于100米,则不显示
if ((p_nearest.properties.dist * 1000 > 100)|(dist<100)) {
return {
Expand Down Expand Up @@ -339,7 +363,7 @@ export default {
navigator.geolocation.getCurrentPosition(pos => {
let lat = pos.coords.latitude
let lng = pos.coords.longitude
//标记出最近的站点
const p = point([lng, lat])
const nearest_line1 = nearestPoint(p, this.stops1);
Expand Down Expand Up @@ -416,7 +440,11 @@ export default {
watch: {
lines: "updateBusPos",
},
mounted() {
created() {
this.checkTheme();
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', this.checkTheme);
},
mounted() {
this.load_data();
this.updateBusPos();
this.timer = setInterval(() => {
Expand Down
2 changes: 1 addition & 1 deletion docs/.vuepress/components/RealtimeMap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default {
{
"type": "Feature",
"geometry": {"type": "Point", "coordinates": [113.997811, 22.603325]},
"properties": {"name": "教工餐厅 Faculty Cafteria"}
"properties": {"name": "教工餐厅 Faculty Cafeteria"}
},
{
"type": "Feature",
Expand Down
30 changes: 15 additions & 15 deletions docs/.vuepress/public/bus_echart/stop1.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "name": "工学院", "dist": 0.0 }, "geometry": { "type": "Point", "coordinates": [113.9902, 22.60336] } },
{ "type": "Feature", "properties": { "name": "科研楼", "dist": 542.89970148591362 }, "geometry": { "type": "Point", "coordinates": [113.99153, 22.599643] } },
{ "type": "Feature", "properties": { "name": "7号门", "dist": 907.62735789785825 }, "geometry": { "type": "Point", "coordinates": [113.990399, 22.597132] } },
{ "type": "Feature", "properties": { "name": "行政楼", "dist": 1149.0456938127084 }, "geometry": { "type": "Point", "coordinates": [113.992403, 22.597011] } },
{ "type": "Feature", "properties": { "name": "1号门", "dist": 1513.4263569176362 }, "geometry": { "type": "Point", "coordinates": [113.994898, 22.59569] } },
{ "type": "Feature", "properties": { "name": "2号门", "dist": 1752 }, "geometry": { "type": "Point", "coordinates": [113.99585,22.59788] } },
{ "type": "Feature", "properties": { "name": "3号门", "dist": 2230.3249460522952 }, "geometry": { "type": "Point", "coordinates": [113.99939, 22.599893] } },
{ "type": "Feature", "properties": { "name": "专家公寓", "dist": 2546.2198658400307 }, "geometry": { "type": "Point", "coordinates": [113.998329, 22.601975] } },
{ "type": "Feature", "properties": { "name": "教工餐厅", "dist": 2727.0013627137873 }, "geometry": { "type": "Point", "coordinates": [113.997811, 22.603325] } },
{ "type": "Feature", "properties": { "name": "社康中心", "dist": 2939.8507316668038 }, "geometry": { "type": "Point", "coordinates": [113.995981, 22.60293] } },
{ "type": "Feature", "properties": { "name": "学生宿舍", "dist": 3238.416725109053 }, "geometry": { "type": "Point", "coordinates": [113.993824, 22.604854] } },
{ "type": "Feature", "properties": { "name": "荔园", "dist": 3621.0661168663187 }, "geometry": { "type": "Point", "coordinates": [113.995238, 22.606518] } },
{ "type": "Feature", "properties": { "name": "创园", "dist": 3804.8412646531024 }, "geometry": { "type": "Point", "coordinates": [113.996732, 22.606278] } },
{ "type": "Feature", "properties": { "name": "慧园", "dist": 3991.5552242009744 }, "geometry": { "type": "Point", "coordinates": [113.998372, 22.606102] } },
{ "type": "Feature", "properties": { "name": "欣园", "dist": 4592.7727333861958 }, "geometry": { "type": "Point", "coordinates": [113.997473, 22.610667] } }
{ "type": "Feature", "properties": { "name": "工学院\nCOE", "dist": 0.0 }, "geometry": { "type": "Point", "coordinates": [113.9902, 22.60336] } },
{ "type": "Feature", "properties": { "name": "科研楼\nResearch Bldg.", "dist": 542.89970148591362 }, "geometry": { "type": "Point", "coordinates": [113.99153, 22.599643] } },
{ "type": "Feature", "properties": { "name": "七号门\nGate7", "dist": 907.62735789785825 }, "geometry": { "type": "Point", "coordinates": [113.990399, 22.597132] } },
{ "type": "Feature", "properties": { "name": "行政楼\nAdmin. Bldg.", "dist": 1149.0456938127084 }, "geometry": { "type": "Point", "coordinates": [113.992403, 22.597011] } },
{ "type": "Feature", "properties": { "name": "1号门\nGate 1", "dist": 1513.4263569176362 }, "geometry": { "type": "Point", "coordinates": [113.994898, 22.59569] } },
{ "type": "Feature", "properties": { "name": "2号门\nGate 2", "dist": 1752 }, "geometry": { "type": "Point", "coordinates": [113.99585,22.59788] } },
{ "type": "Feature", "properties": { "name": "3号门\nGate 3", "dist": 2230.3249460522952 }, "geometry": { "type": "Point", "coordinates": [113.99939, 22.599893] } },
{ "type": "Feature", "properties": { "name": "专家公寓\nGuest Houses", "dist": 2546.2198658400307 }, "geometry": { "type": "Point", "coordinates": [113.998329, 22.601975] } },
{ "type": "Feature", "properties": { "name": "教工餐厅\nFaculty Cafeteria", "dist": 2727.0013627137873 }, "geometry": { "type": "Point", "coordinates": [113.997811, 22.603325] } },
{ "type": "Feature", "properties": { "name": "社康中心\nHealth Center", "dist": 2939.8507316668038 }, "geometry": { "type": "Point", "coordinates": [113.995981, 22.60293] } },
{ "type": "Feature", "properties": { "name": "学生宿舍\nStu. Dormitories", "dist": 3238.416725109053 }, "geometry": { "type": "Point", "coordinates": [113.993824, 22.604854] } },
{ "type": "Feature", "properties": { "name": "荔园\nLychee Hill", "dist": 3621.0661168663187 }, "geometry": { "type": "Point", "coordinates": [113.995238, 22.606518] } },
{ "type": "Feature", "properties": { "name": "创园\nChuang Yuan", "dist": 3804.8412646531024 }, "geometry": { "type": "Point", "coordinates": [113.996732, 22.606278] } },
{ "type": "Feature", "properties": { "name": "慧园\nHui Yuan", "dist": 3991.5552242009744 }, "geometry": { "type": "Point", "coordinates": [113.998372, 22.606102] } },
{ "type": "Feature", "properties": { "name": "欣园\nJoy Highland", "dist": 4592.7727333861958 }, "geometry": { "type": "Point", "coordinates": [113.997473, 22.610667] } }
]
}
14 changes: 7 additions & 7 deletions docs/.vuepress/public/bus_echart/stop2.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "name": "科研楼", "dist": 8.96320513008415 }, "geometry": { "type": "Point", "coordinates": [113.99153, 22.599643] } },
{ "type": "Feature", "properties": { "name": "工学院", "dist": 546.92460644903099 }, "geometry": { "type": "Point", "coordinates": [113.9902, 22.60336] } },
{ "type": "Feature", "properties": { "name": "学生宿舍", "dist": 3238.416725109053 }, "geometry": { "type": "Point", "coordinates": [113.993824, 22.604854] } },
{ "type": "Feature", "properties": { "name": "荔园", "dist": 1357.3744467274953 }, "geometry": { "type": "Point", "coordinates": [113.995238, 22.606518] } },
{ "type": "Feature", "properties": { "name": "创园", "dist": 1541.1495945142797 }, "geometry": { "type": "Point", "coordinates": [113.996732, 22.606278] } },
{ "type": "Feature", "properties": { "name": "慧园", "dist": 1727.8635540621517 }, "geometry": { "type": "Point", "coordinates": [113.998372, 22.606102] } },
{ "type": "Feature", "properties": { "name": "欣园", "dist": 2329.0810632473731 }, "geometry": { "type": "Point", "coordinates": [113.997473, 22.610667] } }
{ "type": "Feature", "properties": { "name": "科研楼\nResearch Bldg.", "dist": 8.96320513008415 }, "geometry": { "type": "Point", "coordinates": [113.99153, 22.599643] } },
{ "type": "Feature", "properties": { "name": "工学院\nCOE", "dist": 546.92460644903099 }, "geometry": { "type": "Point", "coordinates": [113.9902, 22.60336] } },
{ "type": "Feature", "properties": { "name": "学生宿舍\nStu. Dormitories", "dist": 3238.416725109053 }, "geometry": { "type": "Point", "coordinates": [113.993824, 22.604854] } },
{ "type": "Feature", "properties": { "name": "荔园\nLychee Hill", "dist": 1357.3744467274953 }, "geometry": { "type": "Point", "coordinates": [113.995238, 22.606518] } },
{ "type": "Feature", "properties": { "name": "创园\nChuang Yuan", "dist": 1541.1495945142797 }, "geometry": { "type": "Point", "coordinates": [113.996732, 22.606278] } },
{ "type": "Feature", "properties": { "name": "慧园\nHui Yuan", "dist": 1727.8635540621517 }, "geometry": { "type": "Point", "coordinates": [113.998372, 22.606102] } },
{ "type": "Feature", "properties": { "name": "欣园\nJoy Highland", "dist": 2329.0810632473731 }, "geometry": { "type": "Point", "coordinates": [113.997473, 22.610667] } }
]
}
4 changes: 4 additions & 0 deletions docs/transport/bustimer-wx.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ navbar: false
<ClientOnly>
<TabView :isMapTabEnabled="true"></TabView>
</ClientOnly>

*如需切换暗色主题,请切换后刷新页面*

*Pls REFRESH after toggle dark mode.*
4 changes: 4 additions & 0 deletions docs/transport/bustimer.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@
<ClientOnly>
<TabView :isMapTabEnabled="true"></TabView>
</ClientOnly>

*如需切换亮/暗主题,请切换后刷新页面*

*Pls REFRESH after toggle dark mode.*

0 comments on commit facdcb0

Please sign in to comment.