diff --git a/config/index.js b/config/index.js
index 969aa8292916c40b5467a0dc7f3941b20e3645a0..0a216bae156ba10e11bfe9e707677f012879f616 100644
--- a/config/index.js
+++ b/config/index.js
@@ -11,7 +11,7 @@ module.exports = {
assetsPublicPath: "/",
proxyTable: {
"/api/": {
- target: "http://114.116.52.53/", //后端接口地址
+ target: "http://yongma16.xyz/", //后端接口地址
ws: true, //接受websocket请求
changeOrigin: true, //是否允许跨越
chunkOrigins: true,
diff --git a/src/comment/ArticleComment.vue b/src/comment/ArticleComment.vue
index 4a40a95b86ac48485ceb76288b9242619a91cf5b..9f5e5d18b449fa7f7d7c87af343a01babc945235 100644
--- a/src/comment/ArticleComment.vue
+++ b/src/comment/ArticleComment.vue
@@ -55,7 +55,7 @@ export default {
};
},
mounted() {
- this.getComments();
+ articleId && this.getComments();
},
methods: {
dateToString(dateValue) {
@@ -95,7 +95,6 @@ export default {
let params = {
articleId: articleId ? articleId : that.articleId,
};
- console.log("获取评论id", params.articleId);
axios
.post(that.baseurl + "comment/get/", params)
.then((res) => {
@@ -106,35 +105,34 @@ export default {
item.date = that.dateToString(item.date);
});
} catch (e) {
- console.log(e);
+ throw Error(e)
}
- console.log("评论获取成功", res);
})
.catch((r) => {
- console.log("评论获取失败", r);
+ throw Error(r)
});
},
increment(userId, articleId, content) {
- if (content === "" || !content) {
- this.$notify({
- title: "评论失败!",
- message: "评论内容不能为空",
- position: "top-left",
- });
- return false;
- }
let that = this;
- if (!localStorage.getItem("yma16siteUserInfoName")) {
+ if (!localStorage.getItem("yma16siteUserInfo")) {
that.$router
.push({
path: "/login",
})
.catch((error) => {
- console.log(error);
+ throw Error(error);
});
} else {
- that.userId = localStorage.getItem("yma16siteUserInfoName");
- console.log("提交评论", articleId, that.userId, content);
+ if (content === "" || !content) {
+ that.$notify({
+ title: "评论失败!",
+ message: "评论内容不能为空",
+ position: "top-left",
+ });
+ return false;
+ }
+ const userInfo = JSON.parse(localStorage.getItem("yma16siteUserInfo"));
+ that.userId = userInfo.username;
let params = {
username: that.userId,
articleId: articleId,
@@ -151,11 +149,18 @@ export default {
item.date = that.dateToString(item.date);
});
} catch (e) {
- console.log(e);
+ throw Error(e)
}
})
.catch((r) => {
- console.log("评论提交失败", r);
+ that.$router
+ .push({
+ path: "/login",
+ })
+ .catch((error) => {
+ throw Error(error)
+ });
+ throw Error(r);
});
}
},
diff --git a/src/components/Article.vue b/src/components/Article.vue
index 8f39f609ca3133d9f2b796461d1cedf1ceac19d2..a441c2d2e47ac25dd3a9fd081a3146de94150a22 100644
--- a/src/components/Article.vue
+++ b/src/components/Article.vue
@@ -262,7 +262,7 @@ export default {
pageSize: 4,
pageArray: [6, 8, 10],
postcomment: {
- articleId: 1,
+ articleId: undefined,
articleCommit: null,
},
articleId: [], //文章的id
@@ -270,8 +270,6 @@ export default {
},
watch: {
topshow: function (newvalue, oldvalue) {
- console.log("侦听");
- console.log("new", newvalue, "old", oldvalue);
if (newvalue === true) {
document.getElementById("topiconid").style.display = "none";
} else {
@@ -293,16 +291,13 @@ export default {
handleSizeChange(val) {
// 转到第一页md_title
let that = this;
- console.log(`每页 ${val} 条`);
that.pageAnalysFun(that.pageAnalys.allTitle, val); //触发修改
},
handleCurrentChange(val) {
let that = this;
- console.log(that.currentPage, "currentPage", that.pageAnalys.allTitle);
//触发md_title的修改
that.currentPage = val;
that.pageAnalysFun(that.pageAnalys.allTitle); //触发修改
- console.log(`当前页: ${val}`);
},
pageAnalysFun(allTitleArray, selectListLength) {
let that = this;
@@ -315,7 +310,6 @@ export default {
that.splitLength = selectListLength; //划分长度
}
splitLength = that.splitLength;
- console.log("一页几条", splitLength);
let splitNum = Math.ceil(that.total / splitLength); //向上取整
that.pageAnalys.childNum = splitNum; //子数组个数
that.pageAnalys.allTitle = allTitleArray; //所有标题
@@ -348,20 +342,15 @@ export default {
try {
that.md_title = that.pageAnalys.titleArray[this.currentPage - 1];
} catch (e) {
- console.log(e);
+ throw Error(e)
}
- console.log("总数", that.pageAnalys.titleArray);
- console.log("分页数据", that.pageAnalys.titleArray[this.currentPage - 1]);
- console.log("当前页", that.md_title);
},
increment: function () {
this.$store.commit("increment");
- console.log(this.$store.state.count);
},
topvisible: function () {
let dom = document.getElementById("hometitle");
this.topshow = this.elementIsVisibleInViewport(dom);
- // console.log('this.topshow', this.topshow)
setTimeout(this.topvisible);
},
elementIsVisibleInViewport: function (el, partiallyVisible = false) {
@@ -375,7 +364,7 @@ export default {
: top >= 0 && left >= 0 && bottom <= innerHeight && right <= innerWidth;
},
li_errorClass: function () {
- console.log("选择文章");
+
},
cssPage: function (index) {
this.challenge_loc = index;
@@ -387,7 +376,7 @@ export default {
path: "/css",
})
.catch((error) => {
- console.log(error);
+ throw Error(error)
});
break;
case "echarts地图配置":
@@ -396,7 +385,7 @@ export default {
path: "/home",
})
.catch((error) => {
- console.log(error);
+ throw Error(error)
});
break;
case "websocket聊天":
@@ -405,14 +394,13 @@ export default {
path: "/onlinewebsocket",
})
.catch((error) => {
- console.log(error);
+ throw Error(error)
});
break;
case "vue3测试平台":
- window.open(this.baseurl + "emoji/index/");
+ window.open(this.baseurl + "/emoji_api/index/");
break;
default:
- console.log("case name没找到");
break;
}
},
@@ -445,72 +433,37 @@ export default {
// 传入索引
})
.then((res) => {
- // alter('提交中');
- // console.log(res.data)
if (res.data.code === 1) {
- console.log("success return home!");
- // that.$router.push({path:'/home'})
- // 无需跳转
- // document.cookie= `user=${that.ruleForm.name}`
- // 添加cookie
- console.log("获取Article");
let respdata = res.data;
let content = respdata.article;
that.md_data = []; // 清空
- // console.log(that.md_data)
content.map((o) => {
that.md_data.push(o); // 传入一个文章
});
that.the_title = respdata.the_title;
} else if (res.data.code === 0) {
// alter("失败!")
- console.log("post 失败");
+ that.$message.error('失败')
}
})
- .catch((res) => {
- console.log(res);
+ .catch((error) => {
+ throw Error(error)
});
- console.log("that.postcomment.articleId", that.postcomment.articleId);
that.getCommentsFromArticle(that.postcomment.articleId);
},
},
- // mounted() {
- // console.log('document滚动',document.documentElement.scrollTop);
-
- // window.addEventListener("scroll", this.handleScroll);
- // window.addEventListener("echarts", this.datasetfunc);
- // },
- // watch(){
- // console.log('watch事件!');
- // console.log('document滚动',document.documentElement.scrollTop);
- // },
- // destroyed() {
- // console.log('document滚动',document.documentElement.scrollTop);
- // // window.removeEventListener("echarts", this.datasetfunc);
- // },
created: function () {
// 初始化
- console.log("初始化");
let that = this;
- // window.οnscrοll = function () {
- // //鼠标滚轮滚动距离超过10像素时,回到顶部按钮才显示
- // if (document.documentElement.scrollTop > 10) {
- // that.toTopIsShow = true;
- // } else {
- // that.toTopIsShow = false;
- // }
- // };
- console.log("测试created!");
axios
.get(that.baseurl + "article/index/")
.then((res) => {
- console.log("获取Article", res);
let resdata = res.data;
let content = resdata.article; // 传递过来的文章 进行处理
let title = resdata.title;
that.articleId = resdata.articleObjectId;
- console.log("获取ArticleId", that.articleId);
- // console.log('content', content, 'title', title)
+ that.postcomment.articleId = resdata.articleId;
+ this.$refs.commentRef.getComments(that.postcomment.articleId); //触发子组件的方法
content.map((o) => {
that.md_data.push(o);
});
@@ -518,31 +471,10 @@ export default {
return o;
});
that.the_title = resdata.the_title;
- console.log("分页实现");
this.pageAnalysFun(titleAllArray); //分页
- // that.md_data.push(res.data.article); //markdown值传递
- // let weather = resdata.weather
- // let high = weather.high
- // let low = weather.low
- // console.log('weather', weather)
- // weather.title.map((o) => {
- // that.weather_title.push(o)
- // })
- // high.map((o) => {
- // that.weather_high.push(o)
- // })
- // low.map((o) => {
- // that.weather_low.push(o)
- // })
- // try {
- // this.datasetfunc() // 等待dom和文件加载完之后执行dataserfunc,加载天气
- // } catch (e) {
- // console.log(e)
- // window.onload = this.datasetfunc // 等待dom
- // }
})
- .catch((res) => {
- console.log(res);
+ .catch((r) => {
+ throw Error(r);
}); // get log
},
};
diff --git a/src/components/Csslearn.vue b/src/components/Csslearn.vue
index cdb332a24e7661644d017a329cc2de806f57807c..c4597aca62aaa07286f6d5c405347dc3190ee7f9 100644
--- a/src/components/Csslearn.vue
+++ b/src/components/Csslearn.vue
@@ -67,7 +67,6 @@ export default {
window.parent.location.href = this.ifreame_content;
},
li_errorClass: function () {
- console.log(0);
},
get_ifreame: function (index) {
let that = this; // that
@@ -77,15 +76,10 @@ export default {
},
getCss: function () {
try {
- console.log(
- "domMain",
- document.getElementById("mainappid"),
- document.getElementById("mainappid").style
- );
document.getElementById("mainappid").style.padding = "0";
document.getElementById("mainappid").style.margin = "0";
} catch (e) {
- console.log("e", e);
+ throw Error(e)
}
let that = this;
@@ -101,7 +95,6 @@ export default {
// 标题传递
// eslint-disable-next-line camelcase
that.css_title = csstitle;
- console.log(that.css_path, that.css_title);
// 传递第一个路html路径
that.ifreame_content = that.css_path[0];
// 传递长度
diff --git a/src/components/Login.vue b/src/components/Login.vue
index e2595ee1453c3471de3b81a6a86c88c767a3f59f..84e74a0c8047aedc556cc1eb3d03c677c028fcee 100644
--- a/src/components/Login.vue
+++ b/src/components/Login.vue
@@ -21,6 +21,7 @@
type="password"
v-model="ruleForm.pass"
autocomplete="off"
+ show-password
>
@@ -31,7 +32,7 @@
没有账号?没有账号?
去注册