diff --git a/docs/.vuepress/components/BusChartVue.vue b/docs/.vuepress/components/BusChartVue.vue index 9d5463e08..d6b9653a8 100644 --- a/docs/.vuepress/components/BusChartVue.vue +++ b/docs/.vuepress/components/BusChartVue.vue @@ -50,6 +50,8 @@ export default { stops1: [], stops2: [], historyBusData: [], + themeColor: '#212529', // 默认颜色 + themeColor_rev: '#DEE2E6', echartsOption: { tooltip: { show: false, @@ -112,9 +114,9 @@ export default { { type: "scatter", label: { - fontSize: 10, + fontSize: 8, show: true, - color: "#999", + color: "#212529", position: "right", formatter: "{b}", }, @@ -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: [], }, ], @@ -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 @@ -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 { @@ -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); @@ -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(() => { diff --git a/docs/.vuepress/components/RealtimeMap.vue b/docs/.vuepress/components/RealtimeMap.vue index 8a66e7a8c..60b59ae17 100644 --- a/docs/.vuepress/components/RealtimeMap.vue +++ b/docs/.vuepress/components/RealtimeMap.vue @@ -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", diff --git a/docs/.vuepress/public/bus_echart/stop1.json b/docs/.vuepress/public/bus_echart/stop1.json index ce550de51..1b30270e8 100644 --- a/docs/.vuepress/public/bus_echart/stop1.json +++ b/docs/.vuepress/public/bus_echart/stop1.json @@ -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] } } ] } \ No newline at end of file diff --git a/docs/.vuepress/public/bus_echart/stop2.json b/docs/.vuepress/public/bus_echart/stop2.json index 69dc0991a..a2119fff1 100644 --- a/docs/.vuepress/public/bus_echart/stop2.json +++ b/docs/.vuepress/public/bus_echart/stop2.json @@ -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] } } ] } \ No newline at end of file diff --git a/docs/transport/bustimer-wx.md b/docs/transport/bustimer-wx.md index 91c3af53d..75d09a42b 100644 --- a/docs/transport/bustimer-wx.md +++ b/docs/transport/bustimer-wx.md @@ -11,3 +11,7 @@ navbar: false + +*如需切换暗色主题,请切换后刷新页面* + +*Pls REFRESH after toggle dark mode.* \ No newline at end of file diff --git a/docs/transport/bustimer.md b/docs/transport/bustimer.md index 522c5997f..fcce1b059 100644 --- a/docs/transport/bustimer.md +++ b/docs/transport/bustimer.md @@ -6,3 +6,7 @@ + +*如需切换亮/暗主题,请切换后刷新页面* + +*Pls REFRESH after toggle dark mode.* \ No newline at end of file