Переглянути джерело

Merge branch 'development' of http://8.152.195.41:3000/alien/group_web_merchant into development

zhuli 3 тижнів тому
батько
коміт
33781aa0f3

+ 1 - 1
src/utils/permission.ts

@@ -105,7 +105,7 @@ export async function checkMenuAccessPermission(): Promise<{
  * @param {string} path 菜单路径
  * @returns {Promise<Object>} 返回包含canClick、contractManagement、foodBusinessLicense的对象
  */
-export async function checkMenuClickPermission(path: string): Promise<{
+export async function checkMenuClickPermission(path?: string): Promise<{
   canClick: boolean;
   contractManagement: boolean;
   foodBusinessLicense: boolean;

+ 14 - 4
src/views/login/index.vue

@@ -601,6 +601,8 @@ import {
   registerCheck
 } from "@/api/modules/newLoginApi";
 import { localGet, localRemove, localSet } from "@/utils";
+import * as path from "node:path";
+import { checkMenuClickPermission } from "@/utils/permission";
 
 const router = useRouter();
 const route = useRoute();
@@ -904,10 +906,18 @@ const handleLogin = async () => {
         // 4.等待路由完全初始化后再跳转
         // 使用 nextTick 确保路由已完全添加
         await nextTick();
-
-        // 5.跳转到首页,使用 replace 避免历史记录问题
-        await router.replace(HOME_URL);
-
+        const { contractManagement, foodBusinessLicense } = await checkMenuClickPermission();
+        // 可以使用所有三个值
+        if ((contractManagement && foodBusinessLicense) || contractManagement) {
+          // 合同管理权限
+          router.replace("/licenseManagement/contractManagement");
+        } else if (foodBusinessLicense) {
+          // 食品经营许可证权限
+          router.replace("/licenseManagement/foodBusinessLicense");
+        } else {
+          // 5.跳转到首页,使用 replace 避免历史记录问题
+          await router.replace(HOME_URL);
+        }
         ElNotification({
           title: "登录成功",
           type: "success",

+ 7 - 4
src/views/storeDecoration/menuManagement/index.vue

@@ -131,7 +131,7 @@
 </template>
 
 <script setup lang="ts">
-import { ref, reactive, computed, onMounted } from "vue";
+import { ref, reactive, computed, onMounted, nextTick } from "vue";
 import { ElMessage, ElMessageBox } from "element-plus";
 import type { FormInstance, FormRules } from "element-plus";
 import { Picture } from "@element-plus/icons-vue";
@@ -254,10 +254,12 @@ const rules = reactive<FormRules>({
 });
 
 // Tab切换
-const handleTabClick = async () => {
+const handleTabClick = async val => {
   pageable.pageNum = 1;
-  await loadDishList();
-  updatePagination();
+  nextTick(async () => {
+    await loadDishList();
+    updatePagination();
+  });
 };
 
 // 更新分页总数
@@ -540,6 +542,7 @@ const loadDishList = async () => {
 
     // 根据tab切换调用不同的dishType参数
     // dishType: 0表示菜单, 1表示推荐
+    console.log(activeTab.value, activeTab.value === "recommended" ? 1 : 0, "zz---xx");
     const dishType = activeTab.value === "recommended" ? 1 : 0;
     const res: any = await getDishList({ storeId: Number(storeId), dishType });