wang jun 3 years ago
parent
commit
0f9b246133
3 changed files with 134 additions and 3 deletions
  1. 28 0
      src/api/data.js
  2. 2 2
      src/router/routers.js
  3. 104 1
      src/view/home/home.vue

+ 28 - 0
src/api/data.js

@@ -122,3 +122,31 @@ export const getPartyInfoById = (id) => {
     data: { id }
   })
 }
+// 首页
+/**
+ * 获取活动信息
+ */
+export const getHomePartyInfo = () => {
+  return axios.request({
+    url: '/admin/home/getpartyinfo',
+    method: 'post'
+  })
+}
+/**
+ * 获取公司信息
+ */
+export const getHomeCompanyInfo = () => {
+  return axios.request({
+    url: '/admin/home/getcompanyinfo',
+    method: 'post'
+  })
+}
+/**
+ * 获取会员信息
+ */
+export const getHomeUserInfo = () => {
+  return axios.request({
+    url: '/admin/home/getuserinfo',
+    method: 'post'
+  })
+}

+ 2 - 2
src/router/routers.js

@@ -108,7 +108,7 @@ export default [
     meta: {
       icon: 'ios-megaphone',
       title: 'party',
-      /* access: ['admin'], */
+      access: ['operation'],
       showAlways: true
     },
     component: Main,
@@ -140,7 +140,7 @@ export default [
     meta: {
       icon: 'ios-nutrition',
       title: 'company',
-      /* access: ['admin'], */
+      access: ['operation'],
       showAlways: true
     },
     component: Main,

+ 104 - 1
src/view/home/home.vue

@@ -1,5 +1,108 @@
+<style>
+    .ivu-card-head
+    {
+        background-color: #3091f2 !important;
+    }
+    .ivu-card-head p
+    {
+        color: #fff !important;
+    }
+    .ivu-card-extra{
+        color: #eee !important;
+    }
+</style>
 <template>
     <div>
-        <h2>home</h2>
+        <Row type="flex" justify="center" align="top" :gutter="16">
+            <Col span="8" v-if="partyinfo">
+                <Card :bordered="false">
+                    <p slot="title">活动信息</p>
+                    <p slot="extra">总数:{{ partyinfo.count }}</p>
+                     <Row :gutter="16">
+                        <Col span="24">
+                            <div>目前活动:{{ partyinfo.info.name }}</div>
+                        </Col>
+                        <Col span="24">
+                            <div>报名企业总量:{{ partyinfo.prcount }}</div>
+                        </Col>
+                    </Row>
+                </Card>
+            </Col>
+            <Col span="8" v-if="companyinfo">
+                <Card :bordered="false">
+                    <p slot="title">企业信息</p>
+                    <p slot="extra">总数:{{ companyinfo.count }}</p>
+                    <Row :gutter="16">
+                        <Col span="12">
+                            <div>待审核:{{ companyinfo.count0 }}</div>
+                        </Col>
+                        <Col span="12">
+                            <div>审核通过:{{ companyinfo.count1 }}</div>
+                        </Col>
+                        <Col span="12">
+                            <div>审核失败:{{ companyinfo.count2 }}</div>
+                        </Col>
+                    </Row>
+                </Card>
+            </Col>
+            <Col span="8" v-if="userinfo">
+                <Card :bordered="false">
+                    <p slot="title">会员信息</p>
+                    <p slot="extra">总数:{{ userinfo.count }}</p>
+                    <Row :gutter="16">
+                        <Col span="12">
+                            <div>可用会员:{{ userinfo.count_isactive_1 }}</div>
+                        </Col>
+                        <Col span="12">
+                            <div>不可用会员:{{ userinfo.count_isactive_0 }}</div>
+                        </Col>
+                    </Row>
+                </Card>
+            </Col>
+        </Row>
     </div>
 </template>
+<script>
+import { getHomePartyInfo, getHomeCompanyInfo, getHomeUserInfo } from '@/api/data'
+export default {
+  name: 'home',
+  data () {
+    return {
+      partyinfo: false,
+      companyinfo: false,
+      userinfo: false
+    }
+  },
+  methods: {
+    getinfo () {
+      getHomePartyInfo().then(res => {
+        const data = res.data
+        if (data.code !== 200) {
+          this.$Message.error(data.msg)
+        } else {
+          this.partyinfo = data.data
+        }
+      })
+      getHomeCompanyInfo().then(res => {
+        const data = res.data
+        if (data.code !== 200) {
+          this.$Message.error(data.msg)
+        } else {
+          this.companyinfo = data.data
+        }
+      })
+      getHomeUserInfo().then(res => {
+        const data = res.data
+        if (data.code !== 200) {
+          this.$Message.error(data.msg)
+        } else {
+          this.userinfo = data.data
+        }
+      })
+    }
+  },
+  mounted () {
+    this.getinfo()
+  }
+}
+</script>