no message

This commit is contained in:
A1300399510
2023-12-21 14:33:06 +08:00
parent 1f5be1a6ed
commit f76a33984e
13 changed files with 144 additions and 99 deletions

102
app.vue
View File

@@ -769,6 +769,17 @@
</template>
<script>
// let userInfoWin = {
// "username": "",
// "uid": 256624,
// "uin": 4171117,
// "avatar": "https://oss.gter.net/avatar/97KwEWQHYuMQGDnFqkimXF9SHKuGwVV5zW-tYWFjYQ~~?istype=1&random=nDW5aKmb89WC",
// "messagenum": 0,
// "newprompt": 0,
// "todaysigned": 0
// }
import { onMounted, onUnmounted, ref, nextTick, watchEffect, watch } from "vue";
import axios from "axios";
@@ -786,21 +797,27 @@ export default {
headers: {
authorization:
process.env.NODE_ENV !== "production" &&
"7a89997c2ccd8cb5ed8cb20d843dafdd", // 头部标记 ada
"pa5o1v493ed5mahrcio66267e2", // 头部标记 ada
// "7a89997c2ccd8cb5ed8cb20d843dafdd", // 头部标记 ada
},
})
.then(function (res) {
}).then(function (res) {
var data = null;
try {
data = typeof res.data == "string" ? JSON.parse(res.data) : res.data;
if (data["code"] == 401) isNeedLogin.value = true;
if (data["code"] == 401) {
goLogin()
// isNeedLogin.value = true;
}
if (data["code"] != 200) handleMsg("error", data["message"] || "报错了,请重试!!!");
} catch (error) { }
resolve(data);
})
.catch((err) => {
if (err.response.status == 401) isNeedLogin.value = true;
if (err.response.status == 401) {
goLogin()
// isNeedLogin.value = true;
}
resolve(err.response.data);
});
});
@@ -809,31 +826,35 @@ export default {
const $ajaxGET = (url, data) => {
url = url.indexOf("//") > -1 ? url : baseURL + url;
return new Promise(function (resolve, reject) {
axios
.get(url, data, {
emulateJSON: true,
withCredentials: true,
headers: {
authorization:
process.env.NODE_ENV !== "production" &&
"7a89997c2ccd8cb5ed8cb20d843dafdd", // 头部标记
},
})
.then(function (res) {
var data = null;
try {
data = typeof res.data == "string" ? JSON.parse(res.data) : res.data;
if (data["code"] == 401) isNeedLogin.value = true;
axios.get(url, data, {
emulateJSON: true,
withCredentials: true,
headers: {
authorization:
process.env.NODE_ENV !== "production" &&
"pa5o1v493ed5mahrcio66267e2", // 头部标记
// "7a89997c2ccd8cb5ed8cb20d843dafdd", // 头部标记
},
}).then(function (res) {
var data = null;
try {
data = typeof res.data == "string" ? JSON.parse(res.data) : res.data;
if (data["code"] == 401) {
goLogin()
// isNeedLogin.value = true;
}
if (data["code"] != 200)
handleMsg("error", data["message"] || "报错了,请重试!!!");
} catch (error) { }
resolve(data);
})
.catch((err) => {
if (err.response.status == 401) isNeedLogin.value = true;
resolve(err.response.data);
});
if (data["code"] != 200)
handleMsg("error", data["message"] || "报错了,请重试!!!");
} catch (error) { }
resolve(data);
}).catch((err) => {
if (err.response.status == 401) {
goLogin()
// isNeedLogin.value = true;
}
resolve(err.response.data);
});
});
};
@@ -856,11 +877,25 @@ export default {
let type = ref("list"); // list details
onMounted(() => {
// setTimeout(() => {
// window["userInfoWin"] = {
// "username": "",
// "uid": 256624,
// "uin": 4171117,
// "avatar": "https://oss.gter.net/avatar/97KwEWQHYuMQGDnFqkimXF9SHKuGwVV5zW-tYWFjYQ~~?istype=1&random=nDW5aKmb89WC",
// "messagenum": 0,
// "newprompt": 0,
// "todaysigned": 0
// }
// }, 400);
// 判断一下是否登录
// if (process.env.NODE_ENV !== "production") isNeedLogin.value = false;
// else
// 判断一下是否登录
determineIsLogin();
getListClass();
window.addEventListener("scroll", handleScroll);
getHistoricalSearchList();
@@ -878,7 +913,7 @@ export default {
const params = route.query;
// 是否直接打开提问
if (params['ispublish']) questionsInit()
setTimeout(() => { if (params['ispublish']) questionsInit() }, 500);
});
@@ -937,12 +972,13 @@ export default {
const determineIsLogin = () => {
let count = 0;
let timer = setInterval(() => {
console.log(Object.keys(window["userInfoWin"]).length);
if (Object.keys(window["userInfoWin"]).length !== 0) {
clearInterval(timer);
if (window["userInfoWin"]["uid"]) isNeedLogin.value = false;
}
count++;
if (count >= 20) clearInterval(timer);
if (count >= 10) clearInterval(timer);
}, 100);
};
@@ -1920,6 +1956,8 @@ export default {
return;
}
deleteState(['ispublish'])
$ajax("/api/publish/questions").then((res) => {
if (res.code != 200) return;
let data = res.data;