guhongwei 4 年之前
父節點
當前提交
b577c1589b
共有 10 個文件被更改,包括 466 次插入25 次删除
  1. 二進制
      public/favicon.ico
  2. 1 1
      public/index.html
  3. 41 17
      src/router/index.js
  4. 2 0
      src/store/index.js
  5. 25 0
      src/store/upload.js
  6. 36 0
      src/views/declare/index.vue
  7. 3 7
      src/views/index.vue
  8. 156 0
      src/views/login.vue
  9. 161 0
      src/views/policy/index.vue
  10. 41 0
      src/views/userCenter/index.vue

二進制
public/favicon.ico


+ 1 - 1
public/index.html

@@ -5,7 +5,7 @@
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta name="viewport" content="width=device-width,initial-scale=1.0">
     <link rel="icon" href="<%= BASE_URL %>favicon.ico">
-    <title><%= htmlWebpackPlugin.options.title %></title>
+    <title>加载中...</title>
   </head>
   <body>
     <noscript>

+ 41 - 17
src/router/index.js

@@ -14,6 +14,30 @@ const web = [
     meta: { title: '网站首页' },
     component: () => import('../views/index.vue'),
   },
+  {
+    path: '/policy',
+    name: 'policy_index',
+    meta: { title: '高企政策服务' },
+    component: () => import('../views/policy/index.vue'),
+  },
+  {
+    path: '/declare',
+    name: 'declare_index',
+    meta: { title: '高企申报服务' },
+    component: () => import('../views/declare/index.vue'),
+  },
+  {
+    path: '/userCenter',
+    name: 'userCenter_index',
+    meta: { title: '个人中心' },
+    component: () => import('../views/userCenter/index.vue'),
+  },
+  {
+    path: '/login',
+    name: 'login',
+    meta: { title: '登录页面' },
+    component: () => import('../views/login.vue'),
+  },
 ];
 const routes = [...web];
 const router = new VueRouter({
@@ -21,22 +45,22 @@ const router = new VueRouter({
   base: process.env.VUE_APP_ROUTER,
   routes,
 });
-// router.beforeEach((to, from, next) => {
-//   document.title = `${to.meta.title} `;
-//   const token = localStorage.getItem('token');
-//   if (to.path == '/adminCenter/homeIndex') {
-//     if (!token) {
-//       next('/login');
-//     } else {
-//       let user = jwt.decode(token);
-//       store.commit('setUser', user, { root: true });
-//       next();
-//     }
-//   } else {
-//     let user = jwt.decode(token);
-//     store.commit('setUser', user, { root: true });
-//     next();
-//   }
-// });
+router.beforeEach((to, from, next) => {
+  document.title = `${to.meta.title} `;
+  const token = localStorage.getItem('token');
+  if (to.path == '/policy') {
+    if (!token) {
+      next(`/login?path=${to.path}`);
+    } else {
+      let user = jwt.decode(token);
+      store.commit('setUser', user, { root: true });
+      next();
+    }
+  } else {
+    let user = jwt.decode(token);
+    store.commit('setUser', user, { root: true });
+    next();
+  }
+});
 
 export default router;

+ 2 - 0
src/store/index.js

@@ -2,6 +2,7 @@ import Vue from 'vue';
 import Vuex from 'vuex';
 import * as ustate from '@common/src/store/user/state';
 import * as umutations from '@common/src/store/user/mutations';
+import upload from './upload';
 import login from '@common/src/store/login';
 import news from '@common/src/store/news';
 import openInfo from '@common/src/store/openInfo';
@@ -25,6 +26,7 @@ export default new Vuex.Store({
   mutations: { ...umutations },
   actions: {},
   modules: {
+    upload,
     login,
     news,
     openInfo,

+ 25 - 0
src/store/upload.js

@@ -0,0 +1,25 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+import axios from 'axios';
+Vue.use(Vuex);
+const api = {
+  upload: (dir) => `/files/article/${dir}/upload`,
+};
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async upload({ commit }, { file, dir }) {
+    var formdata = new FormData();
+    formdata.append('file', file, file.name);
+    const res = await axios.post(api.upload(dir), formdata, { headers: { 'Content-Type': 'multipart/form-data' } });
+    return res.data;
+  },
+};
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 36 - 0
src/views/declare/index.vue

@@ -0,0 +1,36 @@
+<template>
+  <div id="index">
+    <el-row>
+      <el-col :span="24" class="main"> test </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  name: 'index',
+  props: {},
+  components: {},
+  data: function () {
+    return {};
+  },
+  created() {},
+  methods: {},
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped></style>

+ 3 - 7
src/views/index.vue

@@ -5,7 +5,7 @@
         <el-col :span="24" class="top">
           <top topType="2" :leftArrow="false"></top>
         </el-col>
-        <el-col :span="24" class="info" :style="{ height: clientHeight + 'px' }"> 内容 </el-col>
+        <el-col :span="24" class="info" :style="{ height: clientHeight + 'px' }"> <van-button @click="$router.push('policy')">登录</van-button> </el-col>
         <el-col :span="24" class="foot"> 底部 </el-col>
       </el-col>
     </el-row>
@@ -26,16 +26,12 @@ export default {
       clientHeight: '',
     };
   },
-  async created() {
-    await this.search();
-  },
+  async created() {},
   mounted() {
     let clientHeight = (document.documentElement.clientHeight || document.body.clientHeight) - 90;
     this.$set(this, `clientHeight`, clientHeight);
   },
-  methods: {
-    search({ skip = 0, limit = 10, searchName, ...info } = {}) {},
-  },
+  methods: {},
   computed: {
     ...mapState(['user']),
   },

+ 156 - 0
src/views/login.vue

@@ -0,0 +1,156 @@
+<template>
+  <div id="login">
+    <el-row>
+      <el-col :span="24" class="main">
+        <el-col :span="24" class="top">
+          <top topType="2" :leftArrow="false"></top>
+        </el-col>
+        <el-col :span="24" class="info" :style="{ height: clientHeight + 'px' }">
+          <van-tabs v-model="active">
+            <van-tab title="管理登录">
+              <van-form>
+                <van-field v-model="form.phone" label="用户名" placeholder="用户名" :rules="[{ required: true, message: '请填写用户名' }]" />
+                <van-field v-model="form.passwd" label="密码" placeholder="密码" type="password" :rules="[{ required: true, message: '请填写密码' }]" />
+                <van-col span="24" class="btn">
+                  <van-button type="danger" round>取消登录</van-button>
+                  <van-button type="info" round @click="oneSubmit">确认登录</van-button>
+                </van-col>
+              </van-form>
+            </van-tab>
+            <van-tab title="企业登录">
+              <van-form>
+                <van-field v-model="form.phone" label="用户名" placeholder="用户名" :rules="[{ required: true, message: '请填写用户名' }]" />
+                <van-field v-model="form.passwd" label="密码" placeholder="密码" type="password" :rules="[{ required: true, message: '请填写密码' }]" />
+                <van-col span="24" class="btn">
+                  <van-button type="danger" round>取消登录</van-button>
+                  <van-button type="info" round @click="twoSubmit">确认登录</van-button>
+                </van-col>
+              </van-form>
+            </van-tab>
+            <van-tab title="机构登录">
+              <van-form>
+                <van-field v-model="form.phone" label="用户名" placeholder="用户名" :rules="[{ required: true, message: '请填写用户名' }]" />
+                <van-field v-model="form.passwd" label="密码" placeholder="密码" type="password" :rules="[{ required: true, message: '请填写密码' }]" />
+                <van-col span="24" class="btn">
+                  <van-button type="danger" round>取消登录</van-button>
+                  <van-button type="info" round @click="thrSubmit">确认登录</van-button>
+                </van-col>
+              </van-form>
+            </van-tab>
+            <van-tab title="专家登录">
+              <van-form>
+                <van-field v-model="form.phone" label="用户名" placeholder="用户名" :rules="[{ required: true, message: '请填写用户名' }]" />
+                <van-field v-model="form.passwd" label="密码" placeholder="密码" type="password" :rules="[{ required: true, message: '请填写密码' }]" />
+                <van-col span="24" class="btn">
+                  <van-button type="danger" round>取消登录</van-button>
+                  <van-button type="info" round @click="fourSubmit">确认登录</van-button>
+                </van-col>
+              </van-form>
+            </van-tab>
+          </van-tabs>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import top from '@/layout/common/top.vue';
+const _ = require('lodash');
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: adminLogin } = createNamespacedHelpers('login');
+const { mapActions: organization } = createNamespacedHelpers('organization');
+const { mapActions: mechanism } = createNamespacedHelpers('mechanism');
+const { mapActions: expertLogin } = createNamespacedHelpers('expert');
+export default {
+  name: 'login',
+  props: {},
+  components: {
+    top,
+  },
+  data: function () {
+    return {
+      clientHeight: '',
+      active: '0',
+      form: {},
+    };
+  },
+  created() {},
+  mounted() {
+    let clientHeight = (document.documentElement.clientHeight || document.body.clientHeight) - 40;
+    this.$set(this, `clientHeight`, clientHeight);
+  },
+  methods: {
+    // 管理登录
+    ...adminLogin({ adminLogin: 'login' }),
+    // 企业
+    ...organization(['login']),
+    // 机构
+    ...mechanism({ interLogin: 'login' }),
+    // 专家
+    ...expertLogin({ expertLogin: 'login' }),
+    // 管理员
+    oneSubmit() {
+      let data = _.get(this, 'form');
+      data.code_phone = data.phone;
+      console.log(data);
+    },
+    // 企业
+    async twoSubmit() {
+      let data = _.get(this, 'form');
+      data.institution_code = data.phone;
+      const res = await this.login(data);
+      if (this.$checkRes(res)) {
+        this.$router.push({ path: this.path });
+      }
+    },
+    // 机构
+    thrSubmit() {
+      let data = this.form;
+      console.log(data);
+    },
+    // 专家
+    fourSubmit() {
+      let data = this.form;
+      console.log(data);
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+    path() {
+      return this.$route.query.path;
+    },
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  .top {
+    height: 40px;
+    overflow: hidden;
+    border-bottom: 1px solid #f1f1f1;
+  }
+  .info {
+    overflow-x: hidden;
+    overflow-y: auto;
+    .btn {
+      text-align: center;
+      padding: 15px 0;
+      .van-button {
+        margin: 0 10px;
+      }
+    }
+  }
+}
+</style>

+ 161 - 0
src/views/policy/index.vue

@@ -0,0 +1,161 @@
+<template>
+  <div id="index">
+    <el-row>
+      <el-col :span="24" class="main">
+        <el-col :span="24" class="top">
+          <top topType="2" :leftArrow="false"></top>
+        </el-col>
+        <el-col :span="24" class="info" :style="{ height: clientHeight + 'px' }">
+          <van-form>
+            <van-field name="radio" label="政策类型" label-width="60">
+              <template #input>
+                <van-radio-group v-model="form.type" direction="horizontal">
+                  <van-radio name="研发补贴">研发补贴</van-radio>
+                  <van-radio name="奖励兑现">奖励兑现</van-radio>
+                  <van-radio name="创新券">创新券</van-radio>
+                </van-radio-group>
+              </template>
+            </van-field>
+            <van-field v-model="form.company" label="申请单位" placeholder="申请单位" :rules="[{ required: true, message: '请填写申请单位' }]" />
+            <van-field v-model="form.apply_personal" label="申请人" placeholder="申请人" :rules="[{ required: true, message: '请填写申请人' }]" />
+            <van-field v-model="form.phone" label="联系电话" placeholder="联系电话" :rules="[{ required: true, message: '请填写联系电话' }]" />
+            <van-field name="uploader" label="法人复印件" label-width="70">
+              <template #input>
+                <van-uploader
+                  :fileList="form.qyfr"
+                  :max-count="1"
+                  :after-read="(file) => toUpload(file, 'qyfr')"
+                  @delete="(file) => toDelete(file, 'qyfr')"
+                  max-size="11534336"
+                  @oversize="onOversize"
+                />
+              </template>
+            </van-field>
+            <van-field name="uploader" label="营业执照" label-width="70">
+              <template #input>
+                <van-uploader
+                  :fileList="form.yyzz"
+                  :max-count="1"
+                  :after-read="(file) => toUpload(file, 'yyzz')"
+                  @delete="(file) => toDelete(file, 'yyzz')"
+                  max-size="11534336"
+                  @oversize="onOversize"
+                />
+              </template>
+            </van-field>
+            <van-field name="uploader" label="企业利润表" label-width="70">
+              <template #input>
+                <van-uploader
+                  :fileList="form.qylr"
+                  :max-count="1"
+                  :after-read="(file) => toUpload(file, 'qylr')"
+                  @delete="(file) => toDelete(file, 'qylr')"
+                  max-size="11534336"
+                  @oversize="onOversize"
+                />
+              </template>
+            </van-field>
+            <van-col span="24" class="btn">
+              <van-button type="danger" round>取消申报</van-button>
+              <van-button type="info" round @click="oneSubmit">提交申报</van-button>
+            </van-col>
+          </van-form>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import top from '@/layout/common/top.vue';
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: upload } = createNamespacedHelpers('upload');
+const { mapActions: mapPolicy } = createNamespacedHelpers('policy');
+export default {
+  name: 'index',
+  props: {},
+  components: {
+    top,
+  },
+  data: function () {
+    return {
+      clientHeight: '',
+      form: {
+        qyfr: [],
+        yyzz: [],
+        qylr: [],
+        status: '0',
+      },
+    };
+  },
+  async created() {},
+  mounted() {
+    let clientHeight = (document.documentElement.clientHeight || document.body.clientHeight) - 40;
+    this.$set(this, `clientHeight`, clientHeight);
+  },
+  methods: {
+    ...upload(['upload']),
+    ...mapPolicy(['create']),
+    async oneSubmit() {
+      let data = _.get(this, 'form');
+      data.user_id = this.user.id;
+      let res = await this.create(data);
+      if (this.$checkRes(res)) {
+        this.$toast({ type: 'success', message: '政策服务申报成功,请耐心等待结果' });
+        this.$router.push({ path: '/userCenter' });
+      }
+    },
+    async toUpload({ file }, model) {
+      // 上传,赋值
+      const res = await this.upload({ file, dir: 'serve' });
+      if (this.$checkRes(res)) {
+        this.form[model].push({ url: res.uri, name: res.name });
+      }
+    },
+    toDelete(file, model) {
+      const index = this.form[model].findIndex((f) => _.isEqual(f, file));
+      this.form[model].splice(index, 1);
+    },
+    onOversize() {
+      Toast('文件大小不能超过 10MB');
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  .top {
+    height: 40px;
+    overflow: hidden;
+    border-bottom: 1px solid #f1f1f1;
+  }
+  .info {
+    overflow-x: hidden;
+    overflow-y: auto;
+    /deep/.van-radio__label {
+      margin-left: 7px;
+    }
+    .btn {
+      text-align: center;
+      padding: 15px 0;
+      .van-button {
+        margin: 0 10px;
+      }
+    }
+  }
+}
+</style>

+ 41 - 0
src/views/userCenter/index.vue

@@ -0,0 +1,41 @@
+<template>
+  <div id="index">
+    <el-row>
+      <el-col :span="24" class="main"> test </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  name: 'index',
+  props: {},
+  components: {},
+  data: function () {
+    return {};
+  },
+  created() {
+    console.log(this.type);
+  },
+  methods: {},
+  computed: {
+    ...mapState(['user']),
+    type() {
+      return localStorage.getItem('type');
+    },
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped></style>