Jelajahi Sumber

report time

scorpio 2 tahun lalu
induk
melakukan
9579b0c7b3

+ 33 - 0
src/api/dash/index.js

@@ -0,0 +1,33 @@
+import fetch from '../fetch.js'
+
+export default {
+  /**
+   * 更新或者修改状态
+   * @param params
+   * @returns {Promise | Promise<unknown>}
+   */
+  submit(params) {
+    return fetch(
+      '/blade-project-manage-v2/index/v2/v2/submit',
+      params,
+      'post',
+      'json'
+    )
+  },
+  /**
+   * 服务商统计数据
+   * @param params
+   * @returns {Promise<unknown>}
+   */
+  dash(params) {
+    return fetch('/blade-project-manage-v2/index/v2/v2/statistics')
+  },
+
+  /**
+   * 公众号文章
+   * @returns {Promise<unknown>}
+   */
+  mpList() {
+    return fetch('/blade-project-manage-v2/index/v2/v2/mp-list')
+  }
+}

+ 3 - 1
src/api/index.js

@@ -16,6 +16,7 @@ import msg from './msg/index.js'
 import contract from '@/api/contract/index.js'
 import role from '@/api/role/index.js'
 import resource from '@/api/resource/index.js'
+import dash from '@/api/dash/index.js'
 
 export default {
   offices: ['pdf', 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'PDF'],
@@ -37,5 +38,6 @@ export default {
   msg,
   contract,
   role,
-  resource
+  resource,
+  dash
 }

+ 45 - 13
src/views/dash/compoents/data_show.vue

@@ -1,35 +1,37 @@
 <template>
-  <div class="full-width flex flex-col">
+  <div class="full-width flex flex-col full-height" v-if="data">
     <div class="flex flex-center flex-justify-between">
-      <span class="bold font-16">梧桐研究院</span>
-      <span class="font-13 grey-9">数据统计时间:2023年8月11日</span>
+      <span class="bold font-16">{{
+        data.dept ? data.dept.deptName : ''
+      }}</span>
+      <span class="font-13 grey-9">数据统计时间:{{ date }}</span>
     </div>
     <div
       class="flex flex-center flex-justify-between mb-15 ml-20"
-      style="margin-top: 25px"
+      style="margin-top: 65px"
     >
       <div class="flex flex-col flex-center">
         <span class="bold">全部项目数</span>
-        <span class="mt-10 font-24 main-color"
-          >222<span class="font-13 black"> 个</span></span
+        <span class="mt-10 font-34 main-color"
+          >{{ data.projectCount }}<span class="font-13 black"> 个</span></span
         >
       </div>
       <div class="flex flex-col flex-center">
         <span class="bold">全部报告数</span>
-        <span class="mt-10 font-24 main-color"
-          >1122<span class="font-13 black"> 篇</span></span
+        <span class="mt-10 font-34 main-color"
+          >{{ data.fileCount }}<span class="font-13 black"> 篇</span></span
         >
       </div>
       <div class="flex flex-col flex-center">
         <span class="bold">我的项目数</span>
-        <span class="mt-10 font-24 main-color"
-          >32<span class="font-13 black"> 个</span></span
+        <span class="mt-10 font-34 main-color"
+          >{{ data.myProjectCount }}<span class="font-13 black"> 个</span></span
         >
       </div>
       <div class="flex flex-col flex-center mr-20">
         <span class="bold">我的报告数</span>
-        <span class="mt-10 font-24 main-color"
-          >22<span class="font-13 black"> 篇</span></span
+        <span class="mt-10 font-34 main-color"
+          >{{ data.myFileCount }}<span class="font-13 black"> 篇</span></span
         >
       </div>
     </div>
@@ -38,7 +40,37 @@
 
 <script>
 export default {
-  name: 'data_show'
+  name: 'data_show',
+  data() {
+    return {
+      data: {},
+      date: ''
+    }
+  },
+  created() {
+    this.fetch()
+    // 获取当前日期
+    const date = new Date()
+    let nowMonth = date.getMonth() + 1
+    let strDate = date.getDate()
+    const seperator = '-'
+    if (nowMonth >= 1 && nowMonth <= 9) {
+      nowMonth = '0' + nowMonth
+    }
+    if (strDate >= 0 && strDate <= 9) {
+      strDate = '0' + strDate
+    }
+    this.date = date.getFullYear() + seperator + nowMonth + seperator + strDate
+  },
+  methods: {
+    fetch() {
+      this.$api.dash.dash().then(res => {
+        if (res.code === 200) {
+          this.data = res.data
+        }
+      })
+    }
+  }
 }
 </script>
 

+ 74 - 0
src/views/dash/compoents/notice.vue

@@ -0,0 +1,74 @@
+<template>
+  <div class="flex flex-center flex-justify-start">
+    <el-icon class="mr-10">
+      <Bell />
+    </el-icon>
+    <div class="roll full-width">
+      <ul :class="{ marquee_top: animate }">
+        <li v-for="(item, index) in msg" :key="index">
+          <span class="main-color">
+            <span>{{ item.name }}抢得商品{{ item.goods }}</span>
+            <span>已有123人申请</span>
+          </span>
+        </li>
+      </ul>
+    </div>
+  </div>
+</template>
+
+<script>
+export default {
+  components: {},
+  data() {
+    return {
+      msg: [
+        {
+          name: '张**',
+          goods: '牙膏'
+        },
+        {
+          name: '王**',
+          goods: '牙刷'
+        },
+        {
+          name: '钟**',
+          goods: '肥皂'
+        }
+      ],
+      animate: false,
+      setInTime: '' // 定时器
+    }
+  },
+  mounted() {
+    this.setInTime = setInterval(this.showMarquee, 3000)
+  },
+  unmounted() {
+    clearInterval(this.setInTime) // 页面销毁时清除定时器
+  },
+  methods: {
+    // 滚动栏滚动
+    showMarquee() {
+      this.animate = true
+      setTimeout(() => {
+        this.msg.push(this.msg[0])
+        this.msg.shift()
+        this.animate = false
+      }, 500)
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.roll {
+  height: 20px;
+  width: 1200px;
+  text-align: left;
+  overflow: hidden;
+}
+
+.marquee_top {
+  transition: all 0.5s;
+  margin-top: -20px; /* 容器高度 */
+}
+</style>

+ 90 - 32
src/views/dash/compoents/profile.vue

@@ -1,57 +1,115 @@
 <template>
   <div class="full-width flex">
-    <div class="flex flex-col flex-child-average text-left">
+    <div class="flex flex-col flex-justify-around flex-center full-height">
       <div class="bold font-16" style="margin-top: -10px">我的信息</div>
       <div class="mt-10 ml-20">
-        <el-avatar
-          src="https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png"
-          size="large"
-        ></el-avatar>
+        <el-avatar :src="user.info.avatarUrl" :size="100"></el-avatar>
+      </div>
+      <div class="mt-10" style="margin-left: 33px">
+        {{ user.info.nickName }}
       </div>
-      <div class="mt-10" style="margin-left: 33px">张三</div>
     </div>
-    <div class="flex flex-col flex-child-average mr-20 mt-20">
-      <el-input placeholder="填写状态词" size="large" style="width: 100%">
-        <template #prepend>
-          <el-button icon="EditPen" />
-        </template>
-      </el-input>
-      <div class="flex flex-center flex-justify-between mt-10">
+    <div
+      class="flex flex-col flex-child-average mt-20"
+      style="margin-left: 60px"
+    >
+      <el-input
+        placeholder="填写状态词"
+        size="large"
+        v-model="status"
+        class="input"
+      ></el-input>
+      <div
+        class="flex flex-center flex-justify-between mt-10 padding-left padding-right"
+      >
         <img
-          src="../../../assets/svg/task/work.svg"
-          class="icon-task ml-10 mt-5"
+          v-for="icon in icons"
+          :key="icon.value"
+          :src="icon.icon"
+          class="icon-task"
         />
-        <img src="../../../assets/svg/task/trip.svg" class="icon-task3" />
-        <img src="../../../assets/svg/task/leave.svg" class="icon-task2" />
-        <img src="../../../assets/svg/task/stay.svg" class="icon-task1 mr-5" />
       </div>
     </div>
   </div>
 </template>
 
 <script>
-export default {}
+import { useStore } from '@/store/user.js'
+
+export default {
+  setup() {
+    const user = useStore()
+    return { user }
+  },
+  watch: {
+    status: {
+      handler(val) {
+        if (val.length > 0) {
+          setTimeout(() => {
+            this.update()
+          }, 2000)
+        }
+      },
+      immediate: true
+    }
+  },
+  data() {
+    return {
+      status: '',
+      icons: [
+        {
+          icon: new URL('../../../assets/svg/task/work.svg', import.meta.url)
+            .href,
+          tips: '沉迷工作',
+          value: 0
+        },
+        {
+          icon: new URL('../../../assets/svg/task/trip.svg', import.meta.url)
+            .href,
+          tips: '出差',
+          value: 1
+        },
+        {
+          icon: new URL('../../../assets/svg/task/leave.svg', import.meta.url)
+            .href,
+          tips: '休假',
+          value: 2
+        },
+        {
+          icon: new URL('../../../assets/svg/task/stay.svg', import.meta.url)
+            .href,
+          tips: '休息',
+          value: 3
+        }
+      ]
+    }
+  },
+  methods: {
+    update() {
+      this.$api.dash.submit({ workStatusDescribe: this.status }).then(res => {
+        if (res.code === 200) {
+          console.log(res)
+        } else {
+          console.log(res)
+        }
+      })
+    }
+  }
+}
 </script>
 
 <style lang="scss" scoped>
 .icon-task {
   width: 38px;
   height: 45px;
+  object-fit: fill;
 }
 
-.icon-task3 {
-  width: 35px;
-  height: 40px;
-  margin-left: -15px;
-}
-
-.icon-task1 {
-  width: 30px;
-  height: 45px;
-}
+.input {
+  height: 100px;
 
-.icon-task2 {
-  width: 26px;
-  height: 40px;
+  :deep(.el-input__wrapper) {
+    background-color: #eeeeee;
+  }
 }
 </style>

+ 20 - 1
src/views/dash/compoents/read.vue

@@ -37,7 +37,26 @@
 
 <script>
 export default {
-  name: 'read'
+  name: 'read',
+  data() {
+    return {
+      data: []
+    }
+  },
+  created() {
+    this.getList()
+  },
+  methods: {
+    getList() {
+      this.$api.dash.mpList().then(res => {
+        if (res.code === 200) {
+          console.log(res)
+        } else {
+          console.log(res)
+        }
+      })
+    }
+  }
 }
 </script>
 

+ 12 - 10
src/views/dash/index.vue

@@ -2,19 +2,16 @@
   <div>
     <el-card :shadow="hover">
       <div class="full-width flex flex-center flex-justify-start">
-        <el-icon>
-          <Bell />
-        </el-icon>
-        <span class="ml-10">首页</span>
+        <notice :data="[333, 44]" />
       </div>
     </el-card>
     <div class="flex flex-center flex-justify-between">
-      <el-card :shadow="hover" class="flex-child-average mt-20">
+      <el-card :shadow="hover" class="flex-child-average mt-20 card1">
         <profile />
       </el-card>
       <div class="padding"></div>
-      <el-card :shadow="hover" class="flex-child-average mt-20">
-        <data_show />
+      <el-card :shadow="hover" class="flex-child-average mt-20 card1">
+        <data-show />
       </el-card>
     </div>
     <div class="flex flex-center flex-justify-between">
@@ -49,13 +46,18 @@ name: '首页',
 
 <script>
 import Profile from '@/views/dash/compoents/profile.vue'
-import data_show from '@/views/dash/compoents/data_show.vue'
+import dataShow from '@/views/dash/compoents/data_show.vue'
 import agency from '@/views/dash/compoents/agency.vue'
 import read from '@/views/dash/compoents/read.vue'
+import notice from '@/views/dash/compoents/notice.vue'
 
 export default {
-  components: { Profile, data_show, agency, read }
+  components: { Profile, dataShow, agency, read, notice }
 }
 </script>
 
-<style lang="scss" scoped></style>
+<style lang="scss" scoped>
+.card1 {
+  height: 220px;
+}
+</style>

+ 5 - 0
yarn.lock

@@ -4063,6 +4063,11 @@ vue-eslint-parser@^9.3.0:
     lodash "^4.17.21"
     semver "^7.3.6"
 
+vue-infinite-auto-scroll@^1.2.1:
+  version "1.2.1"
+  resolved "https://registry.yarnpkg.com/vue-infinite-auto-scroll/-/vue-infinite-auto-scroll-1.2.1.tgz#6e498670cdbe0840dfe5b216073726d4d7f6e47f"
+  integrity sha512-2olo5FfDXDe+CjJH0SjTz4Y7Rlo3vm4BfxBL+jp88OpjC09rbLE/xLyC1xr7hUHTlfIiHBLrHDYcNoG1u7WofQ==
+
 vue-qr@^4.0.9:
   version "4.0.9"
   resolved "https://registry.yarnpkg.com/vue-qr/-/vue-qr-4.0.9.tgz#6cb965dd0c5a0dff947e6ef582ef149b0780b986"