From 7f25b7b4940a30ee7bed38d6d0f2ea4fa67dfac6 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Sun, 09 May 2021 08:34:10 +0800
Subject: [PATCH] 细节面包屑和天气
---
src/page/crumbsL/crumbsL.vue | 166 ----------------------------------------
public/weather/index.html | 36 --------
2 files changed, 6 insertions(+), 196 deletions(-)
diff --git a/public/weather/index.html b/public/weather/index.html
index 3c9e458..5da9d84 100644
--- a/public/weather/index.html
+++ b/public/weather/index.html
@@ -18,9 +18,8 @@
align-items: center;
justify-content: center;
position: relative;
-right: -20px;
+ right: -20px;
}
-
.time {
position: relative;
top: -6px;
@@ -43,12 +42,6 @@
var me = new Vue({
el: '#weather',
data: {
- begin: false,
- weathers: {
- nowWeather: '',
- highTemperature: '',
- lowTemperature: '',
- },
nowTime: {
year: '',
month: '',
@@ -56,8 +49,7 @@
hour: '',
minute: '',
second: '',
- },
- city: "南昌",
+ }
},
methods: {
getNewTime() {
@@ -68,38 +60,16 @@
this.nowTime.minute = (new Date()).getMinutes() < 10 ? '0' + (new Date()).getMinutes() : (new Date()).getMinutes();
this.nowTime.second = (new Date()).getSeconds() < 10 ? '0' + (new Date()).getSeconds() : (new Date()).getSeconds();
},
- // getWeather() {
- // var that = this;
- // // var url = `http://wthrcdn.etouch.cn/weather_mini?city=${this.city}`
- // var url = `https://web.byisf.com/weatherGet/weather_mini?city=${this.city}`
- // axios.get(url).then((res) => {
- // var data = res.data.data,
- // nowDay = data.forecast[0];
- // that.weathers.nowWeather = nowDay.type;
- // that.weathers.highTemperature = nowDay.high.slice(3);
- // that.weathers.lowTemperature = nowDay.low.slice(3);
- // that.begin = true;
- // })
- // },
- // getCity() {
- // var ctiyName = returnCitySN["cname"];
- // console.log(ctiyName, 4343543);
- // this.city = '南昌'
- // this.getWeather();
- // }
},
mounted() {
this.getNewTime();
setInterval(() => {
this.getNewTime();
}, 1000);
- // this.begin = true;
- // this.getWeather();
- // this.getCity();
}
})
</script>
</body>
-</html>
+</html>
\ No newline at end of file
diff --git a/src/page/crumbsL/crumbsL.vue b/src/page/crumbsL/crumbsL.vue
index ebd68ad..e4ed5bb 100644
--- a/src/page/crumbsL/crumbsL.vue
+++ b/src/page/crumbsL/crumbsL.vue
@@ -83,13 +83,12 @@
this.urlData = "/weather/index.html";
},
methods: {
- loadChange(states) {
+ loadChange() {
//导航栏进就是一级路由,其他页面push
if (this.isrf) {
//刷新读取localStorage
this.breadListLast = JSON.parse(localStorage.getItem("crumbsl"));
var b = localStorage.getItem("crumbslname") == "false" ? false : true;
- console.log(b, typeof b, Boolean(b), 65343);
this.$store.commit("SET_SHOWDATAL", b);
} else {
//关闭重写
@@ -162,170 +161,11 @@
localStorage.setItem("crumbsl", JSON.stringify(this.breadListLast));
}
},
- loadChange2(states) {
- //逐级添加 暂时不用
- var path = this.$route.path.split("/"),
- up = {};
- path.shift();
- for (var key in path) {
- //处理基础数据
- if (path[key] == "index") {
- path.splice(key, 1);
- }
- }
- if (states == "moun") {
- //第一次进入页面
- // for (var uk in path) {
- // if (uk < path.length - 1) {
- // continue;
- // }
-
- if (this.$route.name != "首页") {
- up = {
- // name: path[uk] + (+uk + 1),
- // name: path[uk],
- name: "首页",
- path: "/wel",
- };
- }
- //首页:
-
- this.breadListLast.push(up);
- up = {
- // name: path[uk] + (+uk + 1),
- // name: path[uk],
- name: this.$route.name,
- path: this.$route.path,
- };
- this.breadListLast.push(up);
- // }
- } else if (states == "rout") {
- //向后添加面包屑
-
- var nowPath;
- up = {
- // name: path[path.length - 1] + path.length,
- // name: path[path.length - 1],
- name: this.$route.name,
- path: this.$route.path,
- };
- this.breadListLast.push(up);
- //判断是否有重复项,有则删除其后路由↓
-
- var ourP = this.breadListLast;
- // var newP = path.pop();
- var newP = this.$route.name;
- for (var os in ourP) {
- var inos = ourP[os];
- if (inos.name == newP && os != ourP.length - 1) {
- // console.log(ourP[os],'+++++++++',os);
- this.breadListLast.splice(
- +os + 1,
- this.breadListLast.length - os - 1
- );
- }
- // console.log(inos.name,'--',newP)
- }
- // console.log(ourP, 1111111111111111111);
- // console.log(newP, 2222222222222222222);
- //↑
- }
- //汉化↓
- // var da = this.breadListLast,
- // na = this.upName;
- // for(var h in da){
- // for(var n in na){
- // if(da[h].name == na[n]){
- // da[h].name = n;
- // }
- // }
- // }
- // console.log("path::", path);
- // console.log("data::", this.breadListLast);
- },
- loadChanges() {
- //单个路由 暂时不用
- this.breadListLast = [
- // {
- // name: '首页',
- // path: '/wel/index'
- // },
- // {
- // name: this.$route.name,
- // path: this.$route.path
- // },
- // {// 主要数据
- // name: this.$route.name,
- // path: this.$route.path
- // }
- ];
- if (this.$route.path) {
- var uN = this.upName;
- var pa = this.$route.path,
- na = this.$route.name;
- var uspa = pa.split("/");
- uspa.shift();
- // console.log(uspa, pa);
- for (var upk in uspa) {
- if (uspa[upk] == "wel") {
- continue;
- }
-
- var nameD;
-
- for (var key in uN) {
- if (uN[key] == uspa[upk]) {
- nameD = key;
- break;
- } else {
- nameD = na;
- }
- }
- this.breadListLast.push({
- name: nameD,
- path: pa,
- });
-
- if (uspa[upk] == "index") {
- this.onceRouter = true;
- } else {
- this.onceRouter = false;
- }
- if (uspa[upk] == "dataL") {
- this.breadListLast = [
- {
- name: "卡片模式",
- path: "/welcomeData/card",
- },
- {
- name: nameD,
- path: pa,
- },
- ];
- }
- if (uspa[upk] == "track") {
- this.breadListLast = [
- {
- name: "警情纪录",
- path: "/realTimePolice/real",
- },
- {
- name: nameD,
- path: pa,
- },
- ];
- }
- }
- // console.log(this.breadListLast);
- } else {
- console.log("未识别到路由");
- }
- },
},
watch: {
$route(to, from) {
this.isrf = false;
- this.loadChange("rout");
+ this.loadChange();
// console.log(to.path);
},
},
@@ -348,7 +188,7 @@
console.log("页面被刷新,但后台没有数据");
}
}
- this.loadChange("moun");
+ this.loadChange();
},
};
</script>
--
Gitblit v1.9.3