XuZinan 3 سال پیش
والد
کامیت
da6a9e1170
5فایلهای تغییر یافته به همراه108 افزوده شده و 8 حذف شده
  1. 9 0
      manifest.json
  2. 3 0
      pages.json
  3. 90 7
      pages/index/index.vue
  4. 1 1
      pages/login/login.vue
  5. 5 0
      services/index.js

+ 9 - 0
manifest.json

@@ -54,5 +54,14 @@
             "urlCheck" : false
         },
         "usingComponents" : true
+    },
+    "h5" : {
+        "devServer" : {
+            "https" : false,
+            "port" : ""
+        },
+        "router" : {
+            "base" : ""
+        }
     }
 }

+ 3 - 0
pages.json

@@ -1,5 +1,8 @@
 {
   "pages": [
+    {
+      "path": "pages/index/index"
+    },
     {
       "path": "pages/WorkingHours/index"
     },

+ 90 - 7
pages/index/index.vue

@@ -1,14 +1,97 @@
 <template>
-    
+  <view class="content">
+    <view class="group">
+      <button class="page" v-if="true" @click="onHandleClick(0)">
+        <uni-icons type="list" size="40"></uni-icons>
+        <view>项目列表</view>
+      </button>
+      <button class="page" v-if="true" @click="onHandleClick(1)">
+        <uni-icons type="checkmarkempty" size="40"></uni-icons>
+        <view>项目审核</view>
+      </button>
+      <button class="page" v-if="true" @click="onHandleClick(2)">
+        <uni-icons type="calendar" size="40"></uni-icons>
+        <view>工时上报</view>
+      </button>
+      <button class="page" v-if="true" @click="onHandleClick(3)">
+        <uni-icons type="auth" size="40"></uni-icons>
+        <view>工时审批</view>
+      </button>
+    </view>
+  </view>
 </template>
 
-
 <script>
+import { queryUser } from "@/services/index";
+
 export default {
-}
+  data() {
+    return { user: {} };
+  },
+  onShow() {
+    this.getCurrentUser();
+  },
+  computed: {
+    permission() {
+      let permission = {};
+      this.user?.Permissions.forEach((item) => {
+        permission = {
+          ...permission,
+          ...item.Menus,
+        };
+      });
+      return permission;
+    },
+  },
+  methods: {
+    onHandleClick(index) {
+      switch (index) {
+        case 0:
+          uni.navigateTo({
+            url: "../Project/list",
+          });
+          break;
+        case 1:
+          uni.navigateTo({
+            url: "../Project/auth",
+          });
+          break;
+        case 2:
+          uni.navigateTo({
+            url: "../WorkingHours/index",
+          });
+          break;
+        case 3:
+          uni.navigateTo({
+            url: "../WorkingHours/audit",
+          });
+          break;
+      }
+    },
+    async getCurrentUser() {
+      let res = {};
+      res = await queryUser();
+      this.user = res.data;
+    },
+  },
+};
 </script>
 
-
-<style scoped>
-
-</style>
+<style lang="less" scoped>
+.content {
+  display: flex;
+  justify-content: center;
+}
+.group {
+  width: 90%;
+  padding: 10%;
+  display: flex;
+  justify-content: center;
+  flex-wrap: wrap;
+  background-color: #ffffff;
+}
+.page {
+  width: 40%;
+  margin: 5%;
+}
+</style>

+ 1 - 1
pages/login/login.vue

@@ -83,7 +83,7 @@ export default {
       uni.setStorageSync("token", data.token);
       uni.setStorageSync("user", data.user);
       uni.reLaunch({
-        url: "../WorkingHours/index",
+        url: "../index/index",
       });
     },
     // toogle() {

+ 5 - 0
services/index.js

@@ -0,0 +1,5 @@
+import request from "./request"
+
+export async function queryUser(){
+    return await request('v2/user/current-user', 'GET');
+}