xiaodai2017 2 years ago
parent
commit
986635af2a

+ 1 - 0
index.html

@@ -6,6 +6,7 @@
     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
     <title>采销结算平台</title>
     <script src="/sortable.min.js"></script>
+     <!-- <script src="/dingtalk.open.2.10.3.js" rel="preload" as="script"></script> -->
     <script>
       window.process = {};
     </script>

+ 0 - 0
public/html/dingtalk.open.2.10.3.js → public/dingtalk.open.2.10.3.js


+ 45 - 1
src/App.vue

@@ -5,9 +5,15 @@
 </template>
 
 <script lang="ts">
-import { defineComponent } from "vue";
+import { defineComponent, onBeforeMount, ref } from "vue";
 import { ElConfigProvider } from "element-plus";
+
 import zhCn from "element-plus/lib/locale/lang/zh-cn";
+// import { useRouter } from "vue-router";
+// import { JudgeEnvironment } from "/@/utils/validate";
+// import { getCode } from "/@/utils/dingding";
+// import { useUserStoreHook } from "/@/store/modules/user";
+// const { replace } = useRouter();
 export default defineComponent({
   name: "app",
   components: {
@@ -19,4 +25,42 @@ export default defineComponent({
     }
   }
 });
+// const code = ref("");
+
+// function testing() {
+//   getCode(codes => {
+//     code.value = codes ?? "";
+//     if (code.value) {
+//       setcode(code.value);
+//     } else {
+//       logout();
+//     }
+//   });
+// }
+// function setcode(code) {
+//   const model = { code };
+//   useUserStoreHook()
+//     .dingUserInfor(model)
+//     .then(res => {
+//       if (res !== "success") {
+//         logout();
+//       }
+//     })
+//     .catch(() => {
+//       logout();
+//     });
+// }
+
+// function logout() {
+//   const path = window.location.pathname;
+//   const index = path.indexOf("/login");
+//   if (index !== 0) {
+//     replace(`/login`);
+//   }
+// }
+onBeforeMount(async () => {
+  // if (JudgeEnvironment() === "isDingDing") {
+  //   testing();
+  // }
+});
 </script>

+ 4 - 1
src/api/user.ts

@@ -18,7 +18,10 @@ export const getVerify = (): userType => {
 export const getLogin = (data: object) => {
   return http.request("post", `${userAPi}/Api/login`, { data });
 };
-
+// 钉钉获取用户信息
+export function ddDetail(data) {
+  return http.request("post", `${userAPi}/Api/dintalk`, { data });
+}
 // 获取当前账号菜单数据
 export const getAsyncRoutes = (data: object) => {
   return http.request("post", `${yewuApi}menu`, { data });

+ 12 - 0
src/components/PagePower/PagePower.vue

@@ -0,0 +1,12 @@
+<script setup lang="ts">
+const props = defineProps({
+  isShow: Boolean
+});
+</script>
+
+<template>
+  <div class="flex" v-show="props.isShow">
+    <sort />
+  </div>
+  <NoAuth v-show="!props.isShow" />
+</template>

+ 3 - 0
src/components/PagePower/index.ts

@@ -0,0 +1,3 @@
+import PagePower from "./PagePower.vue";
+
+export default PagePower;

+ 4 - 2
src/main.ts

@@ -12,7 +12,8 @@ import { injectResponsiveStorage } from "/@/utils/responsive";
 
 import Table from "@pureadmin/table";
 import PureDescriptions from "@pureadmin/descriptions";
-
+import NoAuth from "./components/NoAuth/index";
+import PagePower from "./components/PagePower/index";
 import "uno.css";
 import "animate.css";
 // 引入重置样式
@@ -42,11 +43,12 @@ import {
   // IconifyIconOnline,
   FontIcon
 } from "./components/ReIcon";
-import NoAuth from "./components/NoAuth/index";
+
 app.component("IconifyIconOffline", IconifyIconOffline);
 // app.component("IconifyIconOnline", IconifyIconOnline);
 app.component("FontIcon", FontIcon);
 app.component("NoAuth", NoAuth);
+app.component("PagePower", PagePower);
 
 getServerConfig(app).then(async config => {
   app.use(router);

+ 22 - 4
src/store/modules/user.ts

@@ -4,7 +4,7 @@ import { userType, resType } from "./types";
 import { router } from "/@/router";
 import { routerArrays } from "/@/layout/types";
 import { storageSession } from "@pureadmin/utils";
-import { getLogin, getAsyncRoutes, refreshToken } from "/@/api/user";
+import { getLogin, getAsyncRoutes, ddDetail, refreshToken } from "/@/api/user";
 import {
   getToken,
   setToken,
@@ -62,7 +62,25 @@ export const useUserStore = defineStore({
           });
       });
     },
-
+    //钉钉code 获取用户账号详情
+    dingUserInfor(code) {
+      return new Promise((resolve, reject) => {
+        ddDetail(code)
+          .then((res: resType) => {
+            const { code, data } = res;
+            if (code === 0) {
+              const { token } = data;
+              setToken(token);
+              resolve("success");
+            } else {
+              resolve("error");
+            }
+          })
+          .catch(error => {
+            reject(error);
+          });
+      });
+    },
     // 获取当前账号菜单数据
     async postMenuList(form) {
       return new Promise((resolve, reject) => {
@@ -80,8 +98,8 @@ export const useUserStore = defineStore({
                   actionList.push(item);
                 });
               });
-              console.log("77777777777");
-              console.log(actionList);
+              // console.log("77777777777");
+              // console.log(actionList);
               setAction(JSON.stringify(actionList));
               resolve(res);
             } else {

+ 10 - 12
src/views/system/menuOperator/index.vue

@@ -22,17 +22,15 @@ onMounted(() => {
 
 <template>
   <div class="main">
-    <div class="flex" v-show="powers.some(i => i == '001')">
-      <ActionTable
-        ref="actionTableRef"
-        :powers="powers"
-        @edit="handleAddChangeCheck"
-        @create="handleAddChangeCheck"
-        @view="handleAddChangeCheck"
-      />
-
-      <EditModel ref="modelRef" @reload="actionTableRef.onSearch()" />
-    </div>
-    <NoAuth v-show="!powers.some(i => i == '001')" />
+    <!-- <PagePower :isShow="powers.some(i => i == '001')"> -->
+    <ActionTable
+      ref="actionTableRef"
+      :powers="powers"
+      @edit="handleAddChangeCheck"
+      @create="handleAddChangeCheck"
+      @view="handleAddChangeCheck"
+    />
+    <EditModel ref="modelRef" @reload="actionTableRef.onSearch()" />
+    <!-- </PagePower> -->
   </div>
 </template>