lrf402788946 5 years ago
parent
commit
a9e5704f55

+ 2 - 0
.env

@@ -0,0 +1,2 @@
+VUE_APP_AXIOS_BASE_URL = ''
+VUE_APP_ROUTER="/www"

+ 33 - 0
.eslintrc.js

@@ -0,0 +1,33 @@
+// https://eslint.org/docs/user-guide/configuring
+
+module.exports = {
+  root: true,
+  env: {
+    node: true,
+  },
+  extends: ['plugin:vue/essential', '@vue/prettier'],
+  plugins: ['vue'],
+  rules: {
+    'max-len': [
+      'warn',
+      {
+        code: 250,
+      },
+    ],
+    'no-unused-vars': 'off',
+    'no-console': 'off',
+    'prettier/prettier': [
+      'warn',
+      {
+        singleQuote: true,
+        trailingComma: 'es5',
+        bracketSpacing: true,
+        jsxBracketSameLine: true,
+        printWidth: 160,
+      },
+    ],
+  },
+  parserOptions: {
+    parser: 'babel-eslint',
+  },
+};

+ 6 - 0
package.json

@@ -8,8 +8,13 @@
     "lint": "vue-cli-service lint"
   },
   "dependencies": {
+    "axios": "^0.19.2",
     "core-js": "^3.6.4",
+    "element-ui": "^2.13.0",
+    "lodash": "^4.17.15",
+    "naf-core": "^0.1.2",
     "vue": "^2.6.11",
+    "vue-meta": "^2.3.3",
     "vue-router": "^3.1.6",
     "vuex": "^3.1.3"
   },
@@ -24,6 +29,7 @@
     "eslint": "^6.7.2",
     "eslint-plugin-prettier": "^3.1.1",
     "eslint-plugin-vue": "^6.2.2",
+    "jsonwebtoken": "^8.5.1",
     "less": "^3.0.4",
     "less-loader": "^5.0.0",
     "prettier": "^1.19.1",

+ 26 - 23
src/App.vue

@@ -1,32 +1,35 @@
 <template>
-  <div id="app">
-    <div id="nav">
-      <router-link to="/">Home</router-link> |
-      <router-link to="/about">About</router-link>
-    </div>
+  <div id="App" :style="`background:url(${bg}) no-repeat fixed;background-size: 100% 100%;`">
     <router-view />
   </div>
 </template>
 
+<script>
+export default {
+  name: 'App',
+  props: {},
+  components: {},
+  data: () => ({
+    bg: require('@/assets/bg.jpg'),
+  }),
+  created() {},
+  computed: {},
+  methods: {},
+};
+</script>
+
 <style lang="less">
-#app {
-  font-family: Avenir, Helvetica, Arial, sans-serif;
-  -webkit-font-smoothing: antialiased;
-  -moz-osx-font-smoothing: grayscale;
-  text-align: center;
-  color: #2c3e50;
+html {
+  overflow-x: hidden;
+  overflow-y: auto;
 }
-
-#nav {
-  padding: 30px;
-
-  a {
-    font-weight: bold;
-    color: #2c3e50;
-
-    &.router-link-exact-active {
-      color: #42b983;
-    }
-  }
+body {
+  margin: 0;
+  overflow-x: hidden;
+}
+.textOver {
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
 }
 </style>

BIN
src/assets/bg.jpg


BIN
src/assets/logo.png


+ 0 - 130
src/components/HelloWorld.vue

@@ -1,130 +0,0 @@
-<template>
-  <div class="hello">
-    <h1>{{ msg }}</h1>
-    <p>
-      For a guide and recipes on how to configure / customize this project,<br />
-      check out the
-      <a href="https://cli.vuejs.org" target="_blank" rel="noopener"
-        >vue-cli documentation</a
-      >.
-    </p>
-    <h3>Installed CLI Plugins</h3>
-    <ul>
-      <li>
-        <a
-          href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel"
-          target="_blank"
-          rel="noopener"
-          >babel</a
-        >
-      </li>
-      <li>
-        <a
-          href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-router"
-          target="_blank"
-          rel="noopener"
-          >router</a
-        >
-      </li>
-      <li>
-        <a
-          href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-vuex"
-          target="_blank"
-          rel="noopener"
-          >vuex</a
-        >
-      </li>
-      <li>
-        <a
-          href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint"
-          target="_blank"
-          rel="noopener"
-          >eslint</a
-        >
-      </li>
-    </ul>
-    <h3>Essential Links</h3>
-    <ul>
-      <li>
-        <a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a>
-      </li>
-      <li>
-        <a href="https://forum.vuejs.org" target="_blank" rel="noopener"
-          >Forum</a
-        >
-      </li>
-      <li>
-        <a href="https://chat.vuejs.org" target="_blank" rel="noopener"
-          >Community Chat</a
-        >
-      </li>
-      <li>
-        <a href="https://twitter.com/vuejs" target="_blank" rel="noopener"
-          >Twitter</a
-        >
-      </li>
-      <li>
-        <a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a>
-      </li>
-    </ul>
-    <h3>Ecosystem</h3>
-    <ul>
-      <li>
-        <a href="https://router.vuejs.org" target="_blank" rel="noopener"
-          >vue-router</a
-        >
-      </li>
-      <li>
-        <a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a>
-      </li>
-      <li>
-        <a
-          href="https://github.com/vuejs/vue-devtools#vue-devtools"
-          target="_blank"
-          rel="noopener"
-          >vue-devtools</a
-        >
-      </li>
-      <li>
-        <a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener"
-          >vue-loader</a
-        >
-      </li>
-      <li>
-        <a
-          href="https://github.com/vuejs/awesome-vue"
-          target="_blank"
-          rel="noopener"
-          >awesome-vue</a
-        >
-      </li>
-    </ul>
-  </div>
-</template>
-
-<script>
-export default {
-  name: "HelloWorld",
-  props: {
-    msg: String
-  }
-};
-</script>
-
-<!-- Add "scoped" attribute to limit CSS to this component only -->
-<style scoped lang="less">
-h3 {
-  margin: 40px 0 0;
-}
-ul {
-  list-style-type: none;
-  padding: 0;
-}
-li {
-  display: inline-block;
-  margin: 0 10px;
-}
-a {
-  color: #42b983;
-}
-</style>

+ 76 - 0
src/components/upload.vue

@@ -0,0 +1,76 @@
+<template>
+  <div id="upload">
+    <el-upload
+      v-if="url"
+      ref="upload"
+      :action="url"
+      list-type="picture-card"
+      :file-list="fileList"
+      :limit="limit"
+      :on-exceed="outLimit"
+      :on-preview="handlePictureCardPreview"
+      :before-remove="handleRemove"
+      :on-success="onSuccess"
+      accept=".jpg,.jpeg,.png,.bmp,.gif,.svg"
+    >
+      <template>
+        <i class="el-icon-plus"></i>
+      </template>
+    </el-upload>
+    <el-dialog :visible.sync="dialogVisible">
+      <img width="100%" :src="dialogImageUrl" alt="" />
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'upload',
+  props: {
+    url: { type: null },
+    limit: { type: Number },
+    data: { type: null },
+    type: { type: String },
+  },
+  components: {},
+  data: () => ({
+    dialogVisible: false,
+    dialogImageUrl: '',
+    fileList: [],
+  }),
+  created() {
+    if (this.data) {
+      this.defalutProcess(this.data);
+    }
+  },
+  watch: {
+    data: {
+      handler(val) {
+        this.defalutProcess(val);
+      },
+    },
+  },
+  computed: {},
+  methods: {
+    handlePictureCardPreview(file) {
+      this.dialogImageUrl = file.url;
+      this.dialogVisible = true;
+    },
+    handleRemove(file) {
+      return true;
+    },
+    outLimit() {
+      this.$message.error('只允许上传1张图片');
+    },
+    onSuccess(response, file, fileList) {
+      //将文件整理好传回父组件
+      this.$emit('upload', { type: this.type, data: response });
+    },
+    defalutProcess(val) {
+      this.$set(this, `fileList`, [{ name: this.type, url: `${this.data}?${new Date().getTime()}` }]);
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped></style>

+ 64 - 0
src/layout/index/dian.vue

@@ -0,0 +1,64 @@
+<template>
+  <div id="dian">
+    <el-row>
+      <el-col :span="24" class="info">
+        <el-col :span="4" class="list" v-for="(item, index) in list" :key="index">
+          <el-link :underline="false" :href="item.url" target="_blank">
+            <el-image style="width:130px;height:160px;" :src="item.pic"></el-image>
+          </el-link>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'dian',
+  props: {},
+  components: {},
+  data: () => ({
+    list: [
+      {
+        url: '',
+        pic: require('@/assets/dian1.jpg'),
+      },
+
+      {
+        url: '',
+        pic: require('@/assets/dian2.jpg'),
+      },
+      {
+        url: '',
+        pic: require('@/assets/dian3.jpg'),
+      },
+      {
+        url: '',
+        pic: require('@/assets/dian4.jpg'),
+      },
+      {
+        url: '',
+        pic: require('@/assets/dian5.jpg'),
+      },
+      {
+        url: '',
+        pic: require('@/assets/dian6.jpg'),
+      },
+    ],
+  }),
+  created() {},
+  computed: {},
+  methods: {},
+};
+</script>
+
+<style lang="less" scoped>
+.list {
+  width: 130px;
+  height: 160px;
+  margin: 0 6px 0 0;
+}
+.list:last-child {
+  margin: 0;
+}
+</style>

+ 49 - 0
src/layout/index/foot.vue

@@ -0,0 +1,49 @@
+<template>
+  <div id="foot">
+    <el-row>
+      <el-col :span="24" class="foot">
+        <div class="div">
+          <p v-html="info.content"></p>
+        </div>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'foot',
+  props: {
+    info: null,
+  },
+  components: {},
+  data: () => ({}),
+  created() {},
+  computed: {},
+  methods: {},
+};
+</script>
+
+<style lang="less" scoped>
+/deep/.foot p p {
+  padding: 0;
+  margin: 0;
+}
+.foot {
+  width: 100%;
+  min-height: 120px;
+  background-color: rgba(0, 0, 0, 0.4);
+  overflow: hidden;
+}
+.foot .div {
+  width: 650px;
+  margin: 0 auto;
+}
+.foot p {
+  float: left;
+  color: #858f9b;
+  font-size: 14px;
+  margin-right: 24px;
+  line-height: 30px;
+}
+</style>

+ 100 - 0
src/layout/index/law.vue

@@ -0,0 +1,100 @@
+<template>
+  <div id="law">
+    <el-row>
+      <el-col :span="24" class="info">
+        <el-col :span="24" class="topInfo">
+          <el-col :span="20" class="left">{{ title }}</el-col>
+          <el-col :span="4" class="more">
+            <el-link :underline="false" @click="moreClick()"><el-image :src="more"></el-image></el-link>
+          </el-col>
+        </el-col>
+        <el-col :span="24" class="list">
+          <ul>
+            <li class="zixunList" v-for="(item, index) in lawList" :key="index" @click="$router.push({ path: '/policy/lawDetail', query: { id: item.id } })">
+              <el-link :underline="false">
+                <span class="title textOver">{{ item.title }}</span>
+                <span class="date textOver">{{ item.meta && item.meta.createdAt ? new Date(item.meta.createdAt).toLocaleDateString() : '' || '' }}</span>
+              </el-link>
+            </li>
+          </ul>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'notice',
+  props: {
+    lawList: null,
+  },
+  components: {},
+  data: () => ({
+    title: '政策法规',
+    more: require('@/assets/更多.png'),
+  }),
+  created() {},
+  computed: {},
+  methods: {
+    moreClick() {
+      this.$router.push({ path: '/policy/policy' });
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+ul {
+  padding: 0;
+  margin: 0;
+}
+li {
+  padding: 0;
+  margin: 0;
+  color: #999;
+}
+.info {
+  width: 100%;
+  height: 310px;
+  overflow: hidden;
+  padding: 20px;
+  background-color: #fff;
+}
+.topInfo {
+  height: 30px;
+  line-height: 30px;
+  margin: 0 0 10px 0;
+}
+.topInfo .left {
+  font-size: 22px;
+  color: #2c3350;
+  font-weight: bold;
+}
+.topInfo .more {
+  height: 30px;
+  text-align: right;
+  padding: 6px 0;
+}
+.list {
+  padding: 0 0 0 20px;
+  height: 230px;
+  overflow: hidden;
+}
+.zixunList {
+  padding: 0 0 4px 0;
+}
+.zixunList .title {
+  font-size: 14px;
+  color: #60626e;
+  display: inline-block;
+  width: 240px;
+  margin: 0 20px 0 0;
+}
+.zixunList .date {
+  font-size: 14px;
+  color: #abaab8;
+  float: right;
+  max-width: 90px;
+}
+</style>

+ 57 - 0
src/layout/index/linkInfo.vue

@@ -0,0 +1,57 @@
+<template>
+  <div id="linkInfo">
+    <el-row>
+      <el-col :span="24" class="info">
+        <el-col :span="2" class="leftTitle">
+          <span>友情链接</span>
+        </el-col>
+        <el-col :span="22">
+          <el-col :span="6" class="list" v-for="(item, index) in linkList" :key="index">
+            <el-link :underline="false" :href="item.url" target="_blank">
+              <el-image style="width:245px;height:53px;" :src="item.pic"></el-image>
+            </el-link>
+          </el-col>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'linkInfo',
+  props: {
+    linkList: null,
+  },
+  components: {},
+  data: () => ({}),
+  created() {},
+  computed: {},
+  methods: {},
+};
+</script>
+
+<style lang="less" scoped>
+.info {
+  padding: 20px;
+}
+.info .leftTitle {
+  text-align: center;
+  height: 60px;
+  line-height: 60px;
+}
+.info .leftTitle span {
+  font-size: 22px;
+  font-weight: bold;
+  color: #2e3351;
+}
+.list {
+  width: 258px;
+  height: 60px;
+  line-height: 60px;
+  margin: 0 10px 0 0;
+}
+.list:last-child {
+  margin: 0;
+}
+</style>

+ 36 - 0
src/layout/index/logo.vue

@@ -0,0 +1,36 @@
+<template>
+  <div id="logo">
+    <el-row>
+      <el-col :span="24" class="logo">
+        <span v-if="info.logourl">
+          <el-image style="width:690px;height:66px;" :src="info.logourl"></el-image>
+        </span>
+        <span v-else>
+          <el-image style="width:690px;height:66px;" :src="logourl"></el-image>
+        </span>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'logo',
+  props: {
+    info: null,
+  },
+  components: {},
+  data: () => ({
+    logourl: require('@/assets/logo.png'),
+  }),
+  created() {},
+  computed: {},
+  methods: {},
+};
+</script>
+
+<style lang="less" scoped>
+.logo {
+  padding: 65px 0;
+}
+</style>

+ 31 - 0
src/layout/index/mapInfo.vue

@@ -0,0 +1,31 @@
+<template>
+  <div id="mapInfo">
+    <el-row>
+      <el-col :span="24" class="map">
+        <el-link :underline="false" href="http://139.210.167.203/free-technological-management/mapApply/getMap" target="_blank">
+          <el-image style="width:550px;height:360px;" :src="map"></el-image>
+        </el-link>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'mapInfo',
+  props: {
+    map: null,
+  },
+  components: {},
+  data: () => ({}),
+  created() {},
+  computed: {},
+  methods: {},
+};
+</script>
+
+<style lang="less" scoped>
+.map {
+  padding: 20px;
+}
+</style>

+ 84 - 0
src/layout/index/menuInfo.vue

@@ -0,0 +1,84 @@
+<template>
+  <div id="menuInfo">
+    <el-row>
+      <el-col :span="24" class="menu">
+        <el-menu
+          :default-active="thisRouter()"
+          class="el-menu-demo"
+          mode="horizontal"
+          :router="false"
+          :default-openeds="defalutMenu"
+          @select="to"
+          text-color="#fff"
+        >
+          <el-menu-item index="/">网站首页</el-menu-item>
+          <el-menu-item index="/government/government">科技政务</el-menu-item>
+          <el-menu-item index="/policy/policy">科技政策</el-menu-item>
+          <el-menu-item index="/supermaket/supermarket">科技超市</el-menu-item>
+          <el-menu-item index="/shuju/shuju">科技数据</el-menu-item>
+          <el-menu-item index="/service/service">科技服务</el-menu-item>
+          <el-menu-item index="/">
+            <el-link
+              style="padding: 0px 0px;font-size: 22px;"
+              :underline="false"
+              href="http://139.210.167.203/free-technological-management/mapApply/getMap"
+              target="_blank"
+              >科技资源</el-link
+            >
+          </el-menu-item>
+          <el-menu-item index="/personnel/personnel">科技人才</el-menu-item>
+        </el-menu>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'menuInfo',
+  props: {},
+  components: {},
+  data: () => ({
+    defalutMenu: [],
+  }),
+  created() {},
+  computed: {},
+  methods: {
+    thisRouter() {
+      console.log(this.$route.path);
+    },
+    to(index) {
+      this.$router.push({ path: index });
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.menu {
+  height: 70px;
+  overflow: hidden;
+  background-color: rgba(0, 0, 0, 0.4);
+}
+/deep/.el-menu {
+  background-color: rgba(0, 0, 0, 0.4);
+}
+/deep/.el-menu--horizontal > .el-menu-item {
+  height: 70px;
+  line-height: 70px;
+  border-right: 1px solid #ccc;
+  padding: 0 30px;
+  font-size: 22px;
+}
+/deep/.el-menu--horizontal > .el-menu-item:last-child {
+  padding: 0 34px;
+}
+/deep/.el-menu--horizontal > .el-menu-item.is-active {
+  border-bottom: none;
+  color: #fff;
+  background-color: #215299;
+}
+/deep/.el-menu--horizontal > .el-menu-item:hover {
+  background-color: #215299;
+}
+</style>

+ 105 - 0
src/layout/index/notice.vue

@@ -0,0 +1,105 @@
+<template>
+  <div id="notice">
+    <el-row>
+      <el-col :span="24" class="info">
+        <el-col :span="24" class="topInfo">
+          <el-col :span="20" class="left">{{ title }}</el-col>
+          <el-col :span="4" class="more">
+            <el-link :underline="false" @click="moreClick()"><el-image :src="more"></el-image></el-link>
+          </el-col>
+        </el-col>
+        <el-col :span="24" class="list">
+          <ul>
+            <li
+              class="zixunList"
+              v-for="(item, index) in noticeList"
+              :key="index"
+              @click="$router.push({ path: '/government/governmentDetail', query: { id: item.id } })"
+            >
+              <el-link :underline="false">
+                <span class="title textOver">{{ item.title }}</span>
+                <span class="date textOver">{{ item.meta && item.meta.createdAt ? new Date(item.meta.createdAt).toLocaleDateString() : '' || '' }}</span>
+              </el-link>
+            </li>
+          </ul>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'notice',
+  props: {
+    noticeList: null,
+  },
+  components: {},
+  data: () => ({
+    title: '通知公告',
+    more: require('@/assets/更多.png'),
+  }),
+  created() {},
+  computed: {},
+  methods: {
+    moreClick() {
+      this.$router.push({ path: '/government/governmentList' });
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+ul {
+  padding: 0;
+  margin: 0;
+}
+li {
+  padding: 0;
+  margin: 0;
+  color: #999;
+}
+.info {
+  width: 100%;
+  height: 310px;
+  overflow: hidden;
+  padding: 20px;
+  background-color: #fff;
+}
+.topInfo {
+  height: 30px;
+  line-height: 30px;
+  margin: 0 0 10px 0;
+}
+.topInfo .left {
+  font-size: 22px;
+  color: #2c3350;
+  font-weight: bold;
+}
+.topInfo .more {
+  height: 30px;
+  text-align: right;
+  padding: 6px 0;
+}
+.list {
+  padding: 0 0 0 20px;
+  height: 230px;
+  overflow: hidden;
+}
+.zixunList {
+  padding: 0 0 4px 0;
+}
+.zixunList .title {
+  font-size: 14px;
+  color: #60626e;
+  display: inline-block;
+  width: 240px;
+  margin: 0 20px 0 0;
+}
+.zixunList .date {
+  font-size: 14px;
+  color: #abaab8;
+  float: right;
+  max-width: 90px;
+}
+</style>

+ 72 - 0
src/layout/index/top.vue

@@ -0,0 +1,72 @@
+<template>
+  <div id="top">
+    <el-row>
+      <el-col :span="24" class="top">
+        <div class="w_1200">
+          <el-col :span="22" class="date">
+            {{ gettime }}
+          </el-col>
+          <el-col :span="2" class="btn">
+            <el-link :underline="false" @click="loginBtn()" target="_blank">注册</el-link>|<el-link :underline="false" @click="loginBtn()" target="_blank"
+              >登录</el-link
+            >
+          </el-col>
+        </div>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'top',
+  props: {},
+  components: {},
+  data: () => ({
+    gettime: '',
+  }),
+  created() {
+    this.currentTime();
+  },
+  computed: {},
+  methods: {
+    currentTime() {
+      setInterval(this.getTime, 500);
+    },
+    getTime: function() {
+      var _this = this;
+      let yy = new Date().getFullYear();
+      let mm = new Date().getMonth() + 1;
+      let dd = new Date().getDate();
+      let day = new Date().getDay();
+      var weekday = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
+      _this.gettime = yy + '-' + mm + '-' + dd + ' ' + weekday[day];
+    },
+    loginBtn() {
+      this.$router.push({ path: '/login' });
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.w_1200 {
+  width: 1200px;
+  margin: 0 auto;
+}
+.date {
+  height: 40px;
+  line-height: 40px;
+  color: #fff;
+  font-size: 16px;
+}
+.btn {
+  height: 40px;
+  line-height: 40px;
+  color: #fff;
+}
+.btn .el-link {
+  color: #fff;
+  margin: 0 5px;
+}
+</style>

+ 120 - 0
src/layout/index/xinpin.vue

@@ -0,0 +1,120 @@
+<template>
+  <div id="xinpin">
+    <el-row>
+      <el-col :span="24" class="xinpin">
+        <el-col :span="24" class="info">
+          <el-col :span="24" class="topInfo">
+            <el-col :span="20" class="left">{{ title }}</el-col>
+            <el-col :span="4" class="more">
+              <el-link :underline="false"><el-image :src="more"></el-image></el-link>
+            </el-col>
+          </el-col>
+          <el-col :span="24" class="list">
+            <ul>
+              <li class="zixunList" v-for="(item, index) in xinpinList" :key="index">
+                <el-link :underline="false">
+                  <span class="title textOver">{{ item.name }}</span>
+                  <span class="date textOver">{{ item.meta && item.meta.createdAt ? new Date(item.meta.createdAt).toLocaleDateString() : '' || '' }}</span>
+                </el-link>
+              </li>
+            </ul>
+          </el-col>
+        </el-col>
+        <el-col :span="24" class="info">
+          <el-col :span="24" class="topInfo">
+            <el-col :span="20" class="left">{{ chuangxintitle }}</el-col>
+            <el-col :span="4" class="more">
+              <el-link :underline="false"><el-image :src="more"></el-image></el-link>
+            </el-col>
+          </el-col>
+          <el-col :span="24" class="list">
+            <ul>
+              <li class="zixunList" v-for="(item, index) in chuangxinList" :key="index">
+                <el-link :underline="false">
+                  <span class="title textOver">{{ item.name }}</span>
+                  <span class="date textOver">{{ item.meta && item.meta.createdAt ? new Date(item.meta.createdAt).toLocaleDateString() : '' || '' }}</span>
+                </el-link>
+              </li>
+            </ul>
+          </el-col>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'xinpin',
+  props: {
+    xinpinList: null,
+    chuangxinList: null,
+  },
+  components: {},
+  data: () => ({
+    title: '新品发布',
+    chuangxintitle: '创新服务',
+    more: require('@/assets/更多.png'),
+  }),
+  created() {},
+  computed: {},
+  methods: {},
+};
+</script>
+
+<style lang="less" scoped>
+.xinpin {
+  padding: 20px;
+}
+ul {
+  padding: 0;
+  margin: 0;
+}
+li {
+  padding: 0;
+  margin: 0;
+  color: #999;
+}
+.info {
+  width: 100%;
+  height: 220px;
+  overflow: hidden;
+  background-color: #fff;
+}
+.topInfo {
+  height: 30px;
+  line-height: 30px;
+  margin: 0 0 10px 0;
+}
+.topInfo .left {
+  font-size: 22px;
+  color: #2c3350;
+  font-weight: bold;
+}
+.topInfo .more {
+  height: 30px;
+  text-align: right;
+  padding: 6px 0;
+}
+.list {
+  padding: 0 0 0 20px;
+  height: 180px;
+  overflow: hidden;
+}
+.zixunList {
+  padding: 0 0 5px 0;
+}
+.zixunList .title {
+  font-size: 14px;
+  color: #60626e;
+  display: inline-block;
+  width: 220px;
+  margin: 0 20px 0 0;
+}
+.zixunList .date {
+  font-size: 14px;
+  color: #abaab8;
+  float: right;
+  max-width: 90px;
+}
+</style>

+ 156 - 0
src/layout/index/zixun.vue

@@ -0,0 +1,156 @@
+<template>
+  <div id="zixun">
+    <el-row>
+      <el-col :span="24">
+        <el-col :span="24" class="search">
+          <el-col :span="15" class="input">
+            <el-input v-model="input" placeholder="请输入搜索关键词"></el-input>
+          </el-col>
+          <el-col :span="8" class="btn">
+            <el-select v-model="region" placeholder="请选择搜索条件">
+              <el-option label="科技政务" value="zhengwu"></el-option>
+              <el-option label="科技政策" value="zhengce"></el-option>
+            </el-select>
+            <i class="el-icon-search icons"></i>
+          </el-col>
+        </el-col>
+        <el-col :span="24" class="info">
+          <el-col :span="24" class="topInfo">
+            <el-col :span="20" class="left">{{ title }}</el-col>
+            <el-col :span="4" class="more">
+              <el-link :underline="false" @click="moreClick()"><el-image :src="more"></el-image></el-link>
+            </el-col>
+          </el-col>
+          <el-col :span="24" class="list">
+            <ul>
+              <li
+                class="zixunList"
+                v-for="(item, index) in zixunList"
+                :key="index"
+                @click="$router.push({ path: '/government/governmentDetail', query: { id: item.id } })"
+              >
+                <el-link :underline="false">
+                  <span class="title textOver">{{ item.title }}</span>
+                  <span class="date textOver">{{ item.meta && item.meta.createdAt ? new Date(item.meta.createdAt).toLocaleDateString() : '' || '' }}</span>
+                </el-link>
+              </li>
+            </ul>
+          </el-col>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'zixun',
+  props: {
+    zixunList: null,
+  },
+  components: {},
+  data: () => ({
+    more: require('@/assets/更多.png'),
+    input: '',
+    select: '',
+    region: '',
+    title: '最新资讯',
+  }),
+  created() {},
+  computed: {},
+  methods: {
+    moreClick() {
+      this.$router.push({ path: '/government/governmentList' });
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+ul {
+  padding: 0;
+  margin: 0;
+}
+li {
+  padding: 0;
+  margin: 0;
+  color: #999;
+}
+.search {
+  width: 100%;
+  height: 80px;
+  overflow: hidden;
+  margin: 0 0 10px 0;
+  padding: 20px;
+  background-color: #fff;
+}
+.search .input {
+  margin: 0 5px 0 0;
+}
+/deep/.el-input__inner {
+  background-color: #f3f3f3;
+  border-radius: 0;
+  border: none;
+}
+.search .btn {
+  width: 205px;
+  height: 40px;
+}
+.search .btn .el-select {
+  width: 160px;
+  background-color: #f3f3f3;
+}
+/deep/.el-select-dropdown__item {
+  padding: 0 15px;
+}
+.search .btn .icons {
+  width: 45px;
+  color: #4978bb;
+  font-size: 25px;
+  font-weight: bold;
+  text-align: center;
+}
+.info {
+  width: 100%;
+  height: 310px;
+  overflow: hidden;
+  padding: 20px;
+  background-color: #fff;
+}
+.topInfo {
+  height: 30px;
+  line-height: 30px;
+  margin: 0 0 10px 0;
+}
+.topInfo .left {
+  font-size: 22px;
+  color: #2c3350;
+  font-weight: bold;
+}
+.topInfo .more {
+  height: 30px;
+  text-align: right;
+  padding: 6px 0;
+}
+.list {
+  padding: 0 0 0 20px;
+  height: 230px;
+  overflow: hidden;
+}
+.zixunList {
+  padding: 0 0 4px 0;
+}
+.zixunList .title {
+  font-size: 14px;
+  color: #60626e;
+  display: inline-block;
+  width: 440px;
+  margin: 0 20px 0 0;
+}
+.zixunList .date {
+  font-size: 14px;
+  color: #abaab8;
+  float: right;
+  max-width: 90px;
+}
+</style>

+ 88 - 0
src/layout/login.vue

@@ -0,0 +1,88 @@
+<template>
+  <div id="login">
+    <el-row>
+      <el-col :span="24" class="top">
+        <top></top>
+      </el-col>
+      <el-col :span="24" class="logo">
+        <div class="w_1200">
+          <logo :info="info"></logo>
+        </div>
+      </el-col>
+      <el-col :span="24" class="menu">
+        <div class="w_1200">
+          <menuInfo></menuInfo>
+        </div>
+      </el-col>
+      <el-col :span="24" class="main">
+        <div class="w_1200">
+          <loginMain v-on="$listeners" :form="form" :forms="forms"></loginMain>
+        </div>
+      </el-col>
+      <el-col :span="24" class="foot">
+        <div class="w_1200">
+          <foot :info="info"></foot>
+        </div>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import top from '@/layout/index/top.vue';
+import logo from '@/layout/index/logo.vue';
+import menuInfo from '@/layout/index/menuInfo.vue';
+import loginMain from '@/layout/login/loginMain.vue';
+import foot from '@/layout/index/foot.vue';
+export default {
+  name: 'login',
+  props: {
+    info: null, //站点信息
+    form: null, //登录
+    forms: null, //注册
+  },
+  components: {
+    top, //头部
+    logo, //logo
+    menuInfo, //导航
+    foot, //底部
+    loginMain, //登录
+  },
+  data: () => ({}),
+  created() {},
+  computed: {},
+  methods: {},
+};
+</script>
+
+<style lang="less" scoped>
+.w_1200 {
+  width: 1200px;
+  margin: 0 auto;
+}
+.top {
+  height: 40px;
+  overflow: hidden;
+  background-color: rgba(11, 58, 125, 0.8);
+}
+.logo {
+  height: 200px;
+  overflow: hidden;
+}
+.menu {
+  height: 70px;
+  overflow: hidden;
+}
+
+.main {
+  min-height: 800px;
+  overflow: hidden;
+  margin: 10px 0;
+}
+.foot {
+  float: left;
+  width: 100%;
+  height: 120px;
+  overflow: hidden;
+}
+</style>

+ 177 - 0
src/layout/login/loginMain.vue

@@ -0,0 +1,177 @@
+<template>
+  <div id="loginMain">
+    <el-row class="loginMains">
+      <el-col :span="6"><p>&nbsp;</p></el-col>
+      <el-col :span="12">
+        <el-tabs v-model="activeName" @tab-click="handleClick">
+          <el-tab-pane label="登录" name="first">
+            <el-col :span="24">
+              <el-form ref="form" :model="form" label-width="80px">
+                <el-form-item label="用户类别">
+                  <el-radio v-model="form.role" label="1">管理员</el-radio>
+                  <el-radio v-model="form.role" label="2">个人</el-radio>
+                  <el-radio v-model="form.role" label="3">企业管理员</el-radio>
+                </el-form-item>
+                <el-form-item label="手机号">
+                  <el-input v-model="form.phone" placeholder="请输入手机号" :minlength="11" :maxlength="11"></el-input>
+                </el-form-item>
+                <el-form-item label="登录密码">
+                  <el-input v-model="form.password" placeholder="请输入登录密码" show-password></el-input>
+                </el-form-item>
+                <el-col :span="24" class="loginSubmit"><el-button type="primary" @click="loginSubmit">登录</el-button></el-col>
+              </el-form>
+            </el-col>
+          </el-tab-pane>
+          <el-tab-pane label="注册" name="second">
+            <el-col :span="24">
+              <el-form ref="forms" :model="forms" label-width="120px">
+                <el-form-item label="用户名称">
+                  <el-input v-model="forms.name" placeholder="请输入用户名称"></el-input>
+                </el-form-item>
+                <el-form-item label="登录密码">
+                  <el-input v-model="forms.password" placeholder="请输入登录密码" show-password></el-input>
+                </el-form-item>
+                <el-form-item label="身份证号">
+                  <el-input v-model="forms.cardnumber" placeholder="请输入身份证号" :minlength="18" :maxlength="18"></el-input>
+                </el-form-item>
+                <el-form-item label="手机号">
+                  <el-input v-model="forms.phone" placeholder="请输入手机号" :minlength="11" :maxlength="11"></el-input>
+                </el-form-item>
+                <el-form-item label="邮箱">
+                  <el-input v-model="forms.email" placeholder="请输入邮箱"></el-input>
+                </el-form-item>
+                <el-form-item label="地址">
+                  <el-input v-model="forms.addr" placeholder="请输入地址"></el-input>
+                </el-form-item>
+                <el-form-item label="头像图片" prop="img_path">
+                  <upload :limit="1" :data="forms.img_path" type="img_path" :url="'/files/imgpath/upload'" @upload="uploadSuccess"></upload>
+                </el-form-item>
+                <el-form-item label="用户类别">
+                  <!-- <el-radio v-model="forms.role" label="1">管理员</el-radio> -->
+                  <el-radio-group v-model="forms.role" @change="setIsQy">
+                    <el-radio label="2">个人</el-radio>
+                    <el-radio label="3">企业管理员</el-radio>
+                  </el-radio-group>
+                </el-form-item>
+                <!-- <el-form-item label="个人/法人">
+                  <el-radio v-model="forms.is_qy" label="0">个人</el-radio>
+                  <el-radio v-model="forms.is_qy" label="1">法人</el-radio>
+                </el-form-item> -->
+                <el-form-item label="身份证正面">
+                  <upload :limit="1" :data="forms.cardfile_a" type="cardfile_a" :url="'/files/cardfilea/upload'" @upload="uploadSuccess"></upload>
+                </el-form-item>
+                <el-form-item label="身份证背面">
+                  <upload :limit="1" :data="forms.cardfile_b" type="cardfile_b" :url="'/files/cardfileb/upload'" @upload="uploadSuccess"></upload>
+                </el-form-item>
+                <el-form-item label="组织机构图片" v-if="forms.role == '3'">
+                  <upload :limit="1" :data="forms.img_qy" type="img_qy" :url="'/files/imgqy/upload'" @upload="uploadSuccess"></upload>
+                </el-form-item>
+                <el-form-item label="简介" placeholder="请输入简介">
+                  <el-input type="textarea" v-model="forms.resume"></el-input>
+                </el-form-item>
+                <el-form-item label="专业领域" placeholder="请输入专业领域">
+                  <el-input v-model="forms.major"></el-input>
+                </el-form-item>
+                <template v-if="forms.role == '3'">
+                  <el-form-item label="机构类型" placeholder="请输入机构类型">
+                    <el-input v-model="forms.institution_type"></el-input>
+                  </el-form-item>
+                  <el-form-item label="机构名称" placeholder="请输入机构名称">
+                    <el-input v-model="forms.institution_name"></el-input>
+                  </el-form-item>
+                  <el-form-item label="机构代码" placeholder="请输入机构代码">
+                    <el-input v-model="forms.institution_code"></el-input>
+                  </el-form-item>
+                  <el-form-item label="机构性质" placeholder="请输入机构性质">
+                    <el-input v-model="forms.institution_nature"></el-input>
+                  </el-form-item>
+                </template>
+                <el-form-item label="办公电话" placeholder="请输入办公电话">
+                  <el-input v-model="forms.office_phone"></el-input>
+                </el-form-item>
+                <el-form-item label="所属行业" placeholder="请输入所属行业">
+                  <el-input v-model="forms.profession"></el-input>
+                </el-form-item>
+                <el-col :span="24" class="loginSubmit"><el-button type="primary" @click="registerSubmit">注册</el-button></el-col>
+              </el-form>
+            </el-col>
+          </el-tab-pane>
+        </el-tabs>
+      </el-col>
+      <el-col :span="6"><p>&nbsp;</p></el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import upload from '@/components/upload.vue';
+export default {
+  name: 'loginMain',
+  props: {
+    form: null,
+    forms: null,
+  },
+  components: {
+    upload,
+  },
+  data: () => ({
+    activeName: 'first',
+  }),
+  created() {},
+  computed: {},
+  methods: {
+    handleClick(tab, event) {
+      console.log(tab, event);
+    },
+    loginSubmit() {
+      this.$emit('submitDate', this.form);
+    },
+    registerSubmit() {
+      this.$emit('submitDates', { data: this.forms, id: this.forms.id });
+    },
+    uploadSuccess({ type, data }) {
+      this.$set(this.forms, `${type}`, data.uri);
+    },
+    setIsQy(data) {
+      let val = '0';
+      data == '2' ? (val = '0') : (val = '1');
+      this.$set(this.forms, `is_qy`, val);
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.loginMains {
+  min-height: 800px;
+  padding: 40px 0;
+  background-color: #fff;
+}
+/deep/.el-tabs__header {
+  margin: 0;
+}
+/deep/.el-tabs__nav-wrap::after {
+  background-color: transparent;
+}
+/deep/.el-tabs--top .el-tabs__item.is-top:nth-child(2) {
+  padding-left: 50px;
+}
+/deep/.el-tabs--top .el-tabs__item.is-top:last-child {
+  padding-right: 50px;
+}
+/deep/.el-tabs__active-bar {
+  background-color: transparent;
+}
+/deep/.el-tabs__nav {
+  margin: 0 130px;
+}
+/deep/.el-tabs__item {
+  padding: 0 60px;
+  height: 70px;
+  line-height: 70px;
+  font-size: 30px;
+}
+.loginSubmit {
+  text-align: center;
+}
+</style>

+ 12 - 7
src/main.js

@@ -1,12 +1,17 @@
-import Vue from "vue";
-import App from "./App.vue";
-import router from "./router";
-import store from "./store";
-
+import Vue from 'vue';
+import App from './App.vue';
+import router from './router';
+import store from './store';
+import '@/plugins/element.js';
+import '@/plugins/axios';
+import '@/plugins/check-res';
+import '@/plugins/meta';
+import '@/plugins/filters';
+import '@/plugins/loading';
 Vue.config.productionTip = false;
 
 new Vue({
   router,
   store,
-  render: h => h(App)
-}).$mount("#app");
+  render: h => h(App),
+}).$mount('#app');

+ 19 - 0
src/plugins/axios.js

@@ -0,0 +1,19 @@
+import Vue from 'vue';
+import AxiosWrapper from '@/util/axios-wrapper';
+
+const Plugin = {
+  install(vue, options) {
+    // 3. 注入组件
+    vue.mixin({
+      created() {
+        if (this.$store && !this.$store.$axios) {
+          this.$store.$axios = this.$axios;
+        }
+      },
+    });
+    // 4. 添加实例方法
+    vue.prototype.$axios = new AxiosWrapper(options);
+  },
+};
+
+Vue.use(Plugin, { baseUrl: process.env.VUE_APP_AXIOS_BASE_URL });

+ 39 - 0
src/plugins/check-res.js

@@ -0,0 +1,39 @@
+/* eslint-disable no-underscore-dangle */
+/* eslint-disable no-param-reassign */
+/* eslint-disable no-unused-vars */
+/* eslint-disable no-shadow */
+import Vue from 'vue';
+import _ from 'lodash';
+import { Message } from 'element-ui';
+
+const vm = new Vue({});
+const Plugin = {
+  install(Vue, options) {
+    // 4. 添加实例方法
+    Vue.prototype.$checkRes = (res, okText, errText) => {
+      let _okText = okText;
+      let _errText = errText;
+      if (!_.isFunction(okText) && _.isObject(okText) && okText != null) {
+        ({ okText: _okText, errText: _errText } = okText);
+      }
+      const { errcode = 0, errmsg } = res || {};
+      if (errcode === 0) {
+        if (_.isFunction(_okText)) {
+          return _okText();
+        }
+        if (_okText) {
+          Message.success(_okText);
+        }
+        return true;
+      }
+      if (_.isFunction(_errText)) {
+        return _errText();
+      }
+      Message.error(_errText || errmsg);
+      // Message({ message: _errText || errmsg, duration: 60000 });
+      return false;
+    };
+  },
+};
+
+Vue.use(Plugin);

+ 5 - 0
src/plugins/element.js

@@ -0,0 +1,5 @@
+import Vue from 'vue';
+import Element from 'element-ui';
+import 'element-ui/lib/theme-chalk/index.css';
+
+Vue.use(Element);

+ 6 - 0
src/plugins/filters.js

@@ -0,0 +1,6 @@
+import Vue from 'vue';
+import filters from '@/util/filters';
+
+for (const method in filters) {
+  Vue.filter(method, filters[method]);
+}

+ 27 - 0
src/plugins/loading.js

@@ -0,0 +1,27 @@
+/* eslint-disable no-console */
+/* eslint-disable no-param-reassign */
+
+import Vue from 'vue';
+
+const Plugin = {
+  // eslint-disable-next-line no-unused-vars
+  install(vue, options) {
+    // 3. 注入组件
+    vue.mixin({
+      created() {
+        // eslint-disable-next-line no-underscore-dangle
+        const isRoot = this.constructor === Vue;
+        // console.log(`rootId:${rootVue_uid}; thisId:${this._uid}`);
+        // if (rootVue_uid !== 3) {
+        //   console.log(this);
+        // }
+        if (isRoot) {
+          const el = document.getElementById('loading');
+          if (el) el.style.display = 'none';
+        }
+      },
+    });
+  },
+};
+
+Vue.use(Plugin, { baseUrl: process.env.VUE_APP_AXIOS_BASE_URL });

+ 4 - 0
src/plugins/meta.js

@@ -0,0 +1,4 @@
+import Vue from 'vue';
+import Meta from 'vue-meta';
+
+Vue.use(Meta);

+ 65 - 0
src/plugins/stomp.js

@@ -0,0 +1,65 @@
+/**
+ * 基于WebStomp的消息处理插件
+ */
+
+import Vue from 'vue';
+import _ from 'lodash';
+import assert from 'assert';
+import { Client } from '@stomp/stompjs/esm5/client';
+
+const Plugin = {
+  install(Vue, options) {
+    assert(_.isObject(options));
+    if (options.debug && !_.isFunction(options.debug)) {
+      options.debug = str => {
+        console.log(str);
+      };
+    }
+    assert(_.isString(options.brokerURL));
+    if (!options.brokerURL.startsWith('ws://')) {
+      options.brokerURL = `ws://${location.host}${options.brokerURL}`;
+    }
+
+    // 3. 注入组件
+    Vue.mixin({
+      beforeDestroy: function() {
+        if (this.$stompClient) {
+          this.$stompClient.deactivate();
+          delete this.$stompClient;
+        }
+      },
+    });
+
+    // 4. 添加实例方法
+    Vue.prototype.$stomp = function(subscribes = {}) {
+      // connect to mq
+      const client = new Client(options);
+      client.onConnect = frame => {
+        // Do something, all subscribes must be done is this callback
+        // This is needed because this will be executed after a (re)connect
+        console.log('[stomp] connected');
+        Object.keys(subscribes)
+          .filter(p => _.isFunction(subscribes[p]))
+          .forEach(key => {
+            client.subscribe(key, subscribes[key]);
+          });
+      };
+
+      client.onStompError = frame => {
+        // Will be invoked in case of error encountered at Broker
+        // Bad login/passcode typically will cause an error
+        // Complaint brokers will set `message` header with a brief message. Body may contain details.
+        // Compliant brokers will terminate the connection after any error
+        console.log('Broker reported error: ' + frame.headers['message']);
+        console.log('Additional details: ' + frame.body);
+      };
+
+      client.activate();
+
+      this.$stompClient = client;
+    };
+  },
+};
+export default () => {
+  Vue.use(Plugin, Vue.config.stomp);
+};

+ 18 - 0
src/router/before.js

@@ -0,0 +1,18 @@
+import store from "@/store/index";
+
+const checkLogin = router => {
+  router.beforeEach((to, form, next) => {
+    store.commit("setUser");
+    if (to.name === "login") {
+      next();
+      return;
+    }
+    let user = store.state.user;
+    if (user) {
+      next();
+    }
+    //下面是没登录的情况,需要跳转页面到用户未登录页
+    else next({ name: "login" });
+  });
+};
+export default checkLogin;

+ 8 - 16
src/router/index.js

@@ -1,28 +1,20 @@
-import Vue from "vue";
-import VueRouter from "vue-router";
-import Home from "../views/Home.vue";
+import Vue from 'vue';
+import VueRouter from 'vue-router';
 
 Vue.use(VueRouter);
 
 const routes = [
   {
-    path: "/",
-    name: "Home",
-    component: Home
+    path: '/login',
+    meta: { title: '登陆' },
+    component: () => import('../views/login.vue'),
   },
-  {
-    path: "/about",
-    name: "About",
-    // route level code-splitting
-    // this generates a separate chunk (about.[hash].js) for this route
-    // which is lazy-loaded when the route is visited.
-    component: () =>
-      import(/* webpackChunkName: "about" */ "../views/About.vue")
-  }
 ];
 
 const router = new VueRouter({
-  routes
+  mode: 'history',
+  base: process.env.BASE_URL,
+  routes,
 });
 
 export default router;

+ 10 - 6
src/store/index.js

@@ -1,11 +1,15 @@
-import Vue from "vue";
-import Vuex from "vuex";
-
+import Vue from 'vue';
+import Vuex from 'vuex';
+import site from './site';
+import market from './market';
+import login from './login';
+import * as ustate from './user/state';
+import * as umutations from './user/mutations';
 Vue.use(Vuex);
 
 export default new Vuex.Store({
-  state: {},
-  mutations: {},
+  state: { ...ustate },
+  mutations: { ...umutations },
   actions: {},
-  modules: {}
+  modules: { market, site, login },
 });

+ 81 - 0
src/store/login.js

@@ -0,0 +1,81 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+import { Notification } from 'element-ui';
+const jwt = require('jsonwebtoken');
+Vue.use(Vuex);
+const api = {
+  interface: `/api/user/login`,
+  updatePassword: '/api/user/pwd_edit',
+};
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  /**
+    user:Object required 登陆信息 
+    router:router 如果跳转就传
+    path:String 跳转到的路由位置
+    needReturn: Boolean 是否返回结果
+    typeCheck: Boolean 是否检查身份对应匹配的前端项目
+    isWx: Boolean 是否是微信登陆
+    needNotice:Boolean 是否需要提示
+   */
+  async login({ commit }, { user, router, path = '/', needReturn = false, typeCheck = false, isWx = false, needNotice = true }) {
+    let res;
+    //wx登陆,openid存在,user中是openid和qrcode;正常登陆,user中是mobile和passwd
+    if (isWx) res = await this.$axios.$post(`${api.wxLogin}`, user);
+    else res = await this.$axios.$post(`${api.interface}`, user);
+    const setUser = (token, commit) => {
+      localStorage.setItem('token', JSON.stringify(user));
+      commit('setUser', token, { root: true });
+    };
+    if (res.errcode == '0') {
+      setUser(res.data, commit);
+      // Notification({
+      //   title: '登录成功',
+      //   message: `欢迎,${user.user_name}`,
+      //   type: 'success',
+      //   duration: 2000,
+      // });
+    } else {
+      if (needReturn) return res;
+      else {
+        Notification({
+          title: '登录失败',
+          message: `失败原因:${res.errmsg || '登陆失败'}`,
+          type: 'error',
+        });
+      }
+    }
+  },
+  async update({ commit }, payload) {
+    let res = await this.$axios.$post(`${api.updatePassword}`, { data: payload });
+    return res;
+  },
+  async bind({ commit }, payload) {
+    let res = await this.$axios.$post(`${api.bind}`, payload);
+    return res;
+  },
+  async userBind({ commit }, payload) {
+    let res = await this.$axios.$post(`${api.userBind}`, payload);
+    return res;
+  },
+  async getQrcode({ commit }, payload) {
+    let res = await this.$axios.$get(`${api.connection}`);
+    if (res.errcode === 0) return res.data;
+    else {
+      console.warn('请求qrcode失败');
+    }
+  },
+  async wxCheck({ commit }, payload) {
+    let res = await this.$axios.$post(`${api.wxCheck}`, payload);
+    return res;
+  },
+};
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 39 - 0
src/store/market.js

@@ -0,0 +1,39 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  userInfo: `/api/market/user`,
+};
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async query({ commit }, { skip = 0, limit, ...info } = {}) {
+    const res = await this.$axios.$get(`${api.userInfo}`, { skip, limit, ...info });
+    return res;
+  },
+  async create({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.userInfo}`, payload);
+    return res;
+  },
+  async fetch({ commit }, payload) {
+    const res = await this.$axios.$get(`${api.userInfo}/${payload}`);
+    return res;
+  },
+  async update({ commit }, { id, ...data }) {
+    const res = await this.$axios.$post(`${api.userInfo}/update/${id}`, data);
+    return res;
+  },
+
+  async delete({ commit }, payload) {
+    const res = await this.$axios.$delete(`${api.userInfo}/${payload}`);
+    return res;
+  },
+};
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 22 - 0
src/store/site.js

@@ -0,0 +1,22 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  shows: `/api/setting/set/show`,
+};
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async showInfo({ commit }, { ...info } = {}) {
+    const res = await this.$axios.$get(`${api.shows}`, { ...info });
+    return res;
+  },
+};
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 29 - 0
src/store/user/mutations.js

@@ -0,0 +1,29 @@
+const jwt = require('jsonwebtoken');
+
+export const setUser = (state, payload) => {
+  let res = true;
+  //登陆时
+  if (payload) {
+    state.token = payload;
+    let user = jwt.decode(payload);
+    console.log(user);
+  } else {
+    //已经登陆,切换路由时取出用户信息放在总store中
+    let token = localStorage.getItem('token');
+    if (token) {
+      state.user = jwt.decode(token);
+    } else {
+      res = false;
+      state.user = undefined;
+      console.warn('用户未登录');
+    }
+  }
+  return res;
+};
+
+export const deleteUser = (state, payload) => {
+  state.user = {};
+  state.menuList = [];
+  localStorage.removeItem('user');
+  localStorage.removeItem('menuList');
+};

+ 2 - 0
src/store/user/state.js

@@ -0,0 +1,2 @@
+export const user = {};
+export const token = undefined;

+ 117 - 0
src/util/axios-wrapper.js

@@ -0,0 +1,117 @@
+/* eslint-disable no-console */
+/* eslint-disable no-param-reassign */
+
+import _ from 'lodash';
+import Axios from 'axios';
+import { Util, Error } from 'naf-core';
+// import { Indicator } from 'mint-ui';
+import util from './user-util';
+
+const { trimData, isNullOrUndefined } = Util;
+const { ErrorCode } = Error;
+
+let currentRequests = 0;
+
+export default class AxiosWrapper {
+  constructor({ baseUrl = '', unwrap = true } = {}) {
+    this.baseUrl = baseUrl;
+    this.unwrap = unwrap;
+  }
+
+  // 替换uri中的参数变量
+  static merge(uri, query = {}) {
+    if (!uri.includes(':')) {
+      return uri;
+    }
+    const keys = [];
+    const regexp = /\/:([a-z0-9_]+)/gi;
+    let res;
+    // eslint-disable-next-line no-cond-assign
+    while ((res = regexp.exec(uri)) != null) {
+      keys.push(res[1]);
+    }
+    keys.forEach(key => {
+      if (!isNullOrUndefined(query[key])) {
+        uri = uri.replace(`:${key}`, query[key]);
+      }
+    });
+    return uri;
+  }
+
+  $get(uri, query, options) {
+    return this.$request(uri, null, query, options);
+  }
+
+  $post(uri, data = {}, query, options) {
+    return this.$request(uri, data, query, options);
+  }
+  $delete(uri, data = {}, router, query, options = {}) {
+    options = { ...options, method: 'delete' };
+    return this.$request(uri, data, query, options, router);
+  }
+  async $request(uri, data, query, options) {
+    // TODO: 合并query和options
+    if (_.isObject(query) && _.isObject(options)) {
+      options = { ...options, params: query, method: 'get' };
+    } else if (_.isObject(query) && !query.params) {
+      options = { params: query };
+    } else if (_.isObject(query) && query.params) {
+      options = query;
+    }
+    if (!options) options = {};
+    if (options.params) options.params = trimData(options.params);
+    const url = AxiosWrapper.merge(uri, options.params);
+    currentRequests += 1;
+    // Indicator.open({
+    //   spinnerType: 'fading-circle',
+    // });
+
+    try {
+      const axios = Axios.create({
+        baseURL: this.baseUrl,
+      });
+      axios.defaults.headers.common.Authorization = util.token;
+      let res = await axios.request({
+        method: isNullOrUndefined(data) ? 'get' : 'post',
+        url,
+        data,
+        responseType: 'json',
+        ...options,
+      });
+      res = res.data;
+      const { errcode, errmsg, details } = res;
+      if (errcode) {
+        console.warn(`[${uri}] fail: ${errcode}-${errmsg} ${details}`);
+        return res;
+      }
+      // unwrap data
+      if (this.unwrap) {
+        res = _.omit(res, ['errmsg', 'details']);
+        const keys = Object.keys(res);
+        if (keys.length === 1 && keys.includes('data')) {
+          res = res.data;
+        }
+      }
+      return res;
+    } catch (err) {
+      let errmsg = '接口请求失败,请稍后重试';
+      if (err.response) {
+        const { status } = err.response;
+        if (status === 401) errmsg = '用户认证失败,请重新登录';
+        if (status === 403) errmsg = '当前用户不允许执行该操作';
+      }
+      console.error(
+        `[AxiosWrapper] 接口请求失败: ${err.config && err.config.url} - 
+        ${err.message}`
+      );
+      return { errcode: ErrorCode.SERVICE_FAULT, errmsg, details: err.message };
+    } finally {
+    /* eslint-disable */
+      currentRequests -= 1;
+      if (currentRequests <= 0) {
+        currentRequests = 0;
+        // Indicator.close();
+      }
+    }
+  }
+}

+ 10 - 0
src/util/filters.js

@@ -0,0 +1,10 @@
+import _ from 'lodash';
+
+const filters = {
+  getName(object) {
+    const { data, searchItem } = object;
+    return _.get(data, searchItem) === undefined ? '' : _.get(data, searchItem);
+  },
+};
+
+export default filters;

+ 50 - 0
src/util/methods-util.js

@@ -0,0 +1,50 @@
+import { Util } from 'naf-core';
+
+const { isNullOrUndefined } = Util;
+
+export default {
+  //判断信息是否过期
+  isDateOff(dataDate) {
+    const now = new Date(new Date().getTime() - 24 * 60 * 60 * 1000);
+    dataDate = new Date(dataDate);
+    return now.getTime() <= dataDate.getTime();
+  },
+  //判断企业是否可以执行此动作/显示
+  checkCorp(data) {
+    const { role, unit, selfUnit, status, displayType, userid } = data;
+    if (!isNullOrUndefined(selfUnit) && !isNullOrUndefined(status)) {
+      return role === 'corp' && selfUnit === unit && status === '0';
+    } else if (!isNullOrUndefined(displayType)) {
+      if (role === 'corp') {
+        return role === displayType;
+      } else {
+        return role === displayType && !isNullOrUndefined(userid);
+      }
+    }
+  },
+  //获取url的参数params
+  getParams() {
+    let str = location.href;
+    let num = str.indexOf('?');
+    const param = {};
+    str = str.substr(num + 1);
+    let num2 = str.indexOf('#');
+    let str2 = '';
+    if (num2 > 0) {
+      str2 = str.substr(0, num2);
+    } else {
+      num2 = str.indexOf('/');
+      str2 = str.substr(0, num2);
+    }
+    const arr = str2.split('&');
+    for (let i = 0; i < arr.length; i++) {
+      num = arr[i].indexOf('=');
+      if (num > 0) {
+        const name = arr[i].substring(0, num);
+        const value = arr[i].substr(num + 1);
+        param[name] = decodeURI(value);
+      }
+    }
+    return param;
+  },
+};

+ 47 - 0
src/util/optionTitles.js

@@ -0,0 +1,47 @@
+export const JOBFAIR_TITLE = [
+  { prop: 'subject', label: '' },
+  { prop: 'address', label: '举办地址' },
+  { prop: 'date', label: '举办日期' },
+  { prop: 'unit', label: '分站信息' },
+];
+
+export const CAMPUS_TITLE = [
+  { prop: 'subject', label: '' },
+  { prop: 'address', label: '举办地址' },
+  { prop: 'status', label: '审核状态' },
+  { prop: 'date', label: '举办日期' },
+  { prop: 'unit', label: '分站信息' },
+];
+
+export const JOBINFO_TITLE = [
+  { prop: 'title', label: '' },
+  { prop: 'count', label: '需求人数' },
+  { prop: 'nature.name', label: '工作性质' },
+  { prop: 'salary.name', label: '薪资待遇' },
+  { prop: 'xlreqs.name', label: '最低学历' },
+  { prop: 'city.name', label: '所在城市' },
+  // { prop: 'expired', label: '状态' },
+];
+
+export const RESUME_TITLE = [{ prop: 'title', label: '' }];
+
+export const LETTER_TITLE = [
+  { prop: 'title', label: '' },
+  { prop: 'corpname', label: '企业名称' },
+  { prop: 'type', label: '类型' },
+  { prop: 'status', label: '状态' },
+];
+
+export const TICKET_TITLE = [
+  { prop: 'subject', label: '' },
+  { prop: 'type', label: '门票类型' },
+  { prop: 'origin', label: '' },
+  { prop: 'date', label: '举办日期' },
+];
+
+export const CORP_JOBFAIR = [
+  { prop: 'subject', label: '' },
+  { prop: 'time', label: '举办时间' },
+  { prop: 'date', label: '举办日期' },
+  { prop: 'unit', label: '分站信息' },
+];

+ 69 - 0
src/util/user-util.js

@@ -0,0 +1,69 @@
+/* eslint-disable no-console */
+export default {
+  get user() {
+    const val = sessionStorage.getItem('user');
+    try {
+      if (val) return JSON.parse(val);
+    } catch (err) {
+      console.error(err);
+    }
+    return null;
+  },
+  set user(userinfo) {
+    sessionStorage.setItem('user', JSON.stringify(userinfo));
+  },
+  get token() {
+    return sessionStorage.getItem('token');
+  },
+  set token(token) {
+    sessionStorage.setItem('token', token);
+  },
+  get openid() {
+    return sessionStorage.getItem('openid');
+  },
+  set openid(openid) {
+    sessionStorage.setItem('openid', openid);
+  },
+  get isGuest() {
+    return !this.user || this.user.role === 'guest';
+  },
+  save({ userinfo, token }) {
+    sessionStorage.setItem('user', JSON.stringify(userinfo));
+    sessionStorage.setItem('token', token);
+  },
+
+  get corpInfo() {
+    const val = sessionStorage.getItem('corpInfo');
+    if (val) return JSON.parse(val);
+    return null;
+  },
+  set corpInfo(corpInfo) {
+    sessionStorage.setItem('corpInfo', JSON.stringify(corpInfo));
+  },
+  saveCorpInfo(corpInfo) {
+    sessionStorage.setItem('corpInfo', JSON.stringify(corpInfo));
+  },
+
+  get unit() {
+    const val = sessionStorage.getItem('unit');
+    if (val) return JSON.parse(val);
+    return null;
+  },
+  set unit(unitList) {
+    sessionStorage.setItem('unit', JSON.stringify(unitList));
+  },
+  saveUnit(unitList) {
+    sessionStorage.setItem('unit', JSON.stringify(unitList));
+  },
+  get userInfo() {
+    const val = sessionStorage.getItem('userInfo');
+    if (val) return JSON.parse(val);
+    return null;
+  },
+  set userInfo(userInfo) {
+    sessionStorage.setItem('userInfo', JSON.stringify(userInfo));
+  },
+  saveUserInfo(userInfo) {
+    sessionStorage.setItem('userInfo', JSON.stringify(userInfo));
+  },
+};

+ 0 - 5
src/views/About.vue

@@ -1,5 +0,0 @@
-<template>
-  <div class="about">
-    <h1>This is an about page</h1>
-  </div>
-</template>

+ 0 - 18
src/views/Home.vue

@@ -1,18 +0,0 @@
-<template>
-  <div class="home">
-    <img alt="Vue logo" src="../assets/logo.png" />
-    <HelloWorld msg="Welcome to Your Vue.js App" />
-  </div>
-</template>
-
-<script>
-// @ is an alias to /src
-import HelloWorld from "@/components/HelloWorld.vue";
-
-export default {
-  name: "Home",
-  components: {
-    HelloWorld
-  }
-};
-</script>

+ 62 - 0
src/views/login.vue

@@ -0,0 +1,62 @@
+<template>
+  <div id="login">
+    <login-detail :info="info" :form="form" @submitDate="submitLogin" :forms="forms" @submitDates="submitRegister"></login-detail>
+  </div>
+</template>
+
+<script>
+import loginDetail from '@/layout/login.vue';
+import { createNamespacedHelpers, mapGetters } from 'vuex';
+const { mapActions: mapSite } = createNamespacedHelpers('site');
+const { mapActions: mapMarket } = createNamespacedHelpers('market');
+const { mapActions: login } = createNamespacedHelpers('login');
+export default {
+  name: 'login',
+  props: {},
+  components: { loginDetail },
+  data: () => {
+    return {
+      info: {},
+      form: {},
+      forms: {},
+    };
+  },
+  created() {
+    this.searchSite();
+  },
+  methods: {
+    ...mapSite(['showInfo']),
+    ...mapMarket({ userFetch: 'fetch', userCreate: 'create', userUpdate: 'update' }),
+    ...login({ toLogin: 'login' }),
+    // 查询站点信息
+    async searchSite() {
+      let res = await this.showInfo();
+      let object = JSON.parse(JSON.stringify(res.data));
+      if (object) {
+        this.$set(this, `info`, res.data);
+      } else {
+        this.$message.error(res.errmsg ? res.errmsg : 'error');
+      }
+    },
+    async submitLogin(form) {
+      await this.toLogin({ user: form });
+    },
+    async submitRegister(forms) {
+      let data = this.forms;
+      let res = await this.userCreate(data);
+      let msg = `注册成功`;
+      if (this.$checkRes(res, msg)) this.$router.push({ path: '/login' });
+    },
+  },
+  computed: {
+    pageTitle() {
+      return `${this.$route.meta.title}`;
+    },
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+};
+</script>
+
+<style lang="less" scoped></style>

+ 72 - 1
vue.config.js

@@ -1,3 +1,74 @@
+const path = require('path');
 module.exports = {
-  lintOnSave: false
+  publicPath: '/',
+  configureWebpack: config => {
+    Object.assign(config, {
+      // 开发生产共同配置
+      resolve: {
+        alias: {
+          '@': path.resolve(__dirname, './src'),
+          '@c': path.resolve(__dirname, './src/components'),
+          '@a': path.resolve(__dirname, './src/assets'),
+        },
+      },
+    });
+  },
+  devServer: {
+    port: '8100',
+    //api地址前缀
+    proxy: {
+      '/weixin': {
+        target: 'http://smart.cc-lotus.info',
+        changeOrigin: true,
+        ws: true,
+      },
+      '/files': {
+        target: 'http://free.liaoningdoupo.com',
+      },
+      '/api/setting': {
+        target: 'http://free.liaoningdoupo.com', //http://free.liaoningdoupo.com
+        changeOrigin: true,
+        ws: true,
+      },
+      '/api/affairs': {
+        target: 'http://free.liaoningdoupo.com',
+        changeOrigin: true,
+        ws: true,
+      },
+      '/api/policy': {
+        target: 'http://free.liaoningdoupo.com',
+        changeOrigin: true,
+        ws: true,
+      },
+      '/api/record': {
+        target: 'http://free.liaoningdoupo.com',
+        changeOrigin: true,
+        ws: true,
+      },
+      '/api/serve': {
+        target: 'http://free.liaoningdoupo.com',
+        changeOrigin: true,
+        ws: true,
+        // pathRewrite: { '^/api/affairs': '/api' },
+      },
+      '/api/talent': {
+        target: 'http://free.liaoningdoupo.com',
+        changeOrigin: true,
+        ws: true,
+        // pathRewrite: { '^/api/affairs': '/api' },
+      },
+      '/api/market': {
+        target: 'http://127.0.0.1:9004',
+        changeOrigin: true,
+        ws: true,
+        // pathRewrite: { '^/api/affairs': '/api' },
+      },
+      '/api': {
+        target: 'http://127.0.0.1:9004',
+        changeOrigin: true,
+        ws: true,
+        // pathRewrite: { '^/api/affairs': '/api' },
+      },
+    },
+  },
 };