wuhongyu 5 lat temu
rodzic
commit
fd8a980cd0

+ 7 - 3
src/layout/live/head.vue

@@ -10,8 +10,11 @@
             欢迎来到吉林省计算中心科技平台
           </p>
           <p class="username">
-            <span v-if="user.uid"
-              >{{ user.name }}
+            <span v-if="user.uid">
+              <button type="text" style="color:blue" @click="stnmae">
+                个人中心
+              </button>
+              {{ user.name }}
               <button type="button" class="logininfo" @click="zhuxiao">注销</button>
             </span>
             <span v-else>
@@ -97,7 +100,8 @@ export default {
     stnmae() {
       if (this.user.role == '2' || this.user.role == '3') {
         this.$router.push({ path: '/enterprise/enterprisejb' });
-      }
+      } else if (res.role == '5') this.$router.push('/hallList/index');
+      else this.$router.push('/market/index');
     },
     async zhuxiao() {
       this.logout();

+ 7 - 0
src/router/index.js

@@ -40,6 +40,13 @@ const live = [
         meta: { title: '科技超市', subSite: true },
         component: () => import('../views/market/index.vue'),
       },
+      {
+        path: '/market/marketfabu',
+        name: 'market_index',
+        meta: { title: '我要发布', subSite: true },
+        component: () => import('../views/market/marketfabu.vue'),
+      },
+
       {
         path: '/personnel/rencai',
         name: 'personnel',

+ 2 - 0
src/store/index.js

@@ -19,6 +19,7 @@ import enterpriseproject from '@common/store/market/enterpriseproject';
 import newmarketproduct from '@common/store/market/newmarketproduct';
 import place from '@common/store/place/place';
 import password from '@common/store/market/password';
+import maarkettype from '@common/store/market/markettype';
 
 Vue.use(Vuex);
 
@@ -44,5 +45,6 @@ export default new Vuex.Store({
     newmarketproduct,
     place,
     password,
+    maarkettype,
   },
 });

+ 0 - 5
src/views/login.vue

@@ -27,11 +27,6 @@ export default {
     ...login({ toLogin: 'login' }),
     async submitLogin(form) {
       let res = await this.toLogin({ user: form });
-      if (res.uid) {
-        if (res.role == '2' || res.role == '3') this.$router.push('/enterprise/enterprisejb');
-        else if (res.role == '5') this.$router.push('/hallList/index');
-        else this.$router.push('/market/index');
-      }
     },
     async submitRegister(forms) {
       let data = this.forms;

+ 1 - 1
src/views/market/index.vue

@@ -246,7 +246,7 @@ export default {
     },
     fabu() {
       if (this.user.role == '2' || this.user.role == '3') {
-        this.$router.push({ path: '/enterprise/enterprisexuqiu' });
+        this.$router.push({ path: '/market/marketfabu' });
       } else if (this.user.uid == undefined) {
         this.$router.push({ path: '/login' });
       } else {

+ 106 - 0
src/views/market/marketfabu.vue

@@ -0,0 +1,106 @@
+<template>
+  <div id="index">
+    <div class="w_0100">
+      <div class="w_1200">
+        <div class="servicemain">
+          <div class="infocontext">
+            <contextfabu v-on="$listeners" :demandForm="demandForm" @demandSubmit="sumbit" :columnList="columnList"></contextfabu>
+          </div>
+        </div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import contextfabu from '@/layout/enterprise/contextfabu.vue';
+const { mapActions: mapMarkettype } = createNamespacedHelpers('markettype');
+const { mapActions: mapMarketproduct } = createNamespacedHelpers('marketproduct');
+import { createNamespacedHelpers, mapGetters, mapState } from 'vuex';
+export default {
+  name: 'index',
+  props: {},
+  components: {
+    contextfabu,
+  },
+  data: () => {
+    return {
+      demandForm: {},
+      columnList: [],
+    };
+  },
+  created() {
+    this.maarkettype();
+  },
+  methods: {
+    ...mapMarkettype({ markettypeList: 'query' }),
+    ...mapMarketproduct({ productFetch: 'fetch', productCreate: 'create', productUpdate: 'update' }),
+    async sumbit(demandForm) {
+      this.demandForm.status = '0';
+
+      let data = this.demandForm;
+      console.log(data);
+
+      console.log(data);
+      data.userid = this.user.uid;
+      let res;
+      let msg;
+
+      if (data.id) {
+        res = await this.productUpdate(data);
+        msg = `${this.keyWord}修改成功`;
+      } else {
+        res = await this.productCreate(data);
+        msg = `${this.keyWord}添加成功等待审核`;
+      }
+      if (this.$checkRes(res, msg)) this.$router.push({ path: '/market/index' });
+    },
+    // 查询类型
+    async maarkettype({ category = 123, ...info } = {}) {
+      const res = await this.markettypeList({ category, ...info });
+      console.log(res.data);
+
+      if (this.$checkRes(res)) {
+        this.$set(this, `columnList`, res.data);
+      }
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+    id() {
+      return this.$route.query.id;
+    },
+    keyWord() {
+      let meta = this.$route.meta;
+      let main = meta.title || '';
+      return main;
+    },
+    pageTitle() {
+      return `${this.$route.meta.title}`;
+    },
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.w_1200 {
+  margin: 0 auto;
+  width: 80%;
+  min-height: 600px;
+}
+.serviceOne {
+  margin: 20px 0 0 0;
+}
+
+.infocontext {
+  min-height: 100px;
+  box-shadow: 0 0 10px #2d64b3;
+  width: 100%;
+  float: left;
+
+  margin: 25px 0 10px 0;
+}
+</style>