feat:发布主题按钮新增未登录提示登录
This commit is contained in:
@@ -129,7 +129,7 @@ export default function useAuths(opt) {
|
|||||||
// 如果有记录当前跳转页面
|
// 如果有记录当前跳转页面
|
||||||
const currentPath = Session.get("currentPath");
|
const currentPath = Session.get("currentPath");
|
||||||
if (currentPath) {
|
if (currentPath) {
|
||||||
router.push(currentPath);
|
router.replace(currentPath);
|
||||||
} else {
|
} else {
|
||||||
router.replace({
|
router.replace({
|
||||||
path: option.loginReUrl ? option.loginReUrl : option.homeUrl,
|
path: option.loginReUrl ? option.loginReUrl : option.homeUrl,
|
||||||
|
|||||||
@@ -105,9 +105,11 @@ import { getList, getTopList } from "@/apis/discussApi.js";
|
|||||||
import { ref, reactive, watch, computed } from "vue";
|
import { ref, reactive, watch, computed } from "vue";
|
||||||
import { useRoute, useRouter } from "vue-router";
|
import { useRoute, useRouter } from "vue-router";
|
||||||
import BottomInfo from "@/components/BottomInfo.vue";
|
import BottomInfo from "@/components/BottomInfo.vue";
|
||||||
import useUserStore from "@/stores/user";
|
|
||||||
import { getPermission } from "@/utils/auth";
|
import { getPermission } from "@/utils/auth";
|
||||||
|
import useAuths from "@/hooks/useAuths";
|
||||||
|
import { Session } from "@/utils/storage";
|
||||||
|
|
||||||
|
const { getToken, clearStorage } = useAuths();
|
||||||
//数据定义
|
//数据定义
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -166,7 +168,8 @@ const { isHasPermission: isEditArticle } = getPermission(
|
|||||||
);
|
);
|
||||||
|
|
||||||
const enterEditArticle = () => {
|
const enterEditArticle = () => {
|
||||||
if (isEditArticle.value) {
|
const hasToken = getToken();
|
||||||
|
if (isEditArticle) {
|
||||||
//跳转路由
|
//跳转路由
|
||||||
var routerPer = {
|
var routerPer = {
|
||||||
path: "/editArt",
|
path: "/editArt",
|
||||||
@@ -177,6 +180,16 @@ const enterEditArticle = () => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
router.push(routerPer);
|
router.push(routerPer);
|
||||||
|
} else if (!hasToken) {
|
||||||
|
ElMessageBox.confirm("登录后即可发布主题是否登录?", "提示", {
|
||||||
|
confirmButtonText: "确认",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
}).then(() => {
|
||||||
|
clearStorage();
|
||||||
|
Session.set("currentPath", route.path);
|
||||||
|
router.push("/login");
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
ElMessage.warning("暂无发布权限!");
|
ElMessage.warning("暂无发布权限!");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user