Browse Source

提交内容

liuqiwen 5 years ago
parent
commit
a4ed16de61

+ 1 - 1
src/views/account/user/index.vue

@@ -82,7 +82,7 @@
                 label="序号"
                 width="50"
               ></el-table-column>
-              <el-table-column prop="name" label="商品类别"></el-table-column>
+              <el-table-column prop="name" label="需求标题"></el-table-column>
               <el-table-column prop="address" label="概要"></el-table-column>
               <el-table-column
                 prop="address"

+ 110 - 49
src/views/home/index.vue

@@ -15,10 +15,16 @@
         <el-col :span="6">
           <div class="loginDiv">
             <div class="txDiv">
-              <img src="@assets/qiyeruzhu.png" alt />
+              <img
+                v-if="loginAccount == ''"
+                src="@assets/touxiang01.png"
+                alt=""
+              />
+              <img v-else src="@assets/touxiang02.png" alt="" />
             </div>
-            <div class="username">您还未登录哦!</div>
-            <div class="btnDiv">
+            <div class="username" v-if="loginAccount == ''">您还未登录哦!</div>
+            <div class="username" v-else>{{ loginAccount }}</div>
+            <div class="btnDiv" v-if="loginAccount == ''">
               <router-link to="/login">
                 <el-button class="leftBtn">登录</el-button>
               </router-link>
@@ -34,8 +40,12 @@
                 >more<i class="el-icon-d-arrow-right"></i
               ></span>
             </div>
-            <div class="notice" v-for="item in 5" :key="item">
-              通知公告通知公告通知公告
+            <div
+              class="notice"
+              v-for="item in noticeListTzgg"
+              :key="item.noticeId"
+            >
+              {{ item.noticeTitle }}
             </div>
           </div>
         </el-col>
@@ -134,9 +144,9 @@
                 >more<i class="el-icon-d-arrow-right"></i
               ></span>
             </div>
-            <div class="xq" v-for="item in 10" :key="item">
-              <div class="con">【求购】通知公告通知公告通知公告</div>
-              <div class="date">2020-01-01</div>
+            <div class="xq" v-for="item in demandList" :key="item.id">
+              <div class="con">【求购】{{ item.purchaseTitle }}</div>
+              <div class="date">{{ item.releaseTime }}</div>
             </div>
           </div>
         </el-col>
@@ -148,9 +158,9 @@
                 >more<i class="el-icon-d-arrow-right"></i
               ></span>
             </div>
-            <div class="xq" v-for="item in 10" :key="item">
-              <div class="con">【供应】通知公告通知公告通知公告</div>
-              <div class="date">2020-01-01</div>
+            <div class="xq" v-for="item in supplyList" :key="item.id">
+              <div class="con">【供应】{{ item.supplyTitle }}</div>
+              <div class="date">{{ item.releaseTime }}</div>
             </div>
           </div>
         </el-col>
@@ -168,22 +178,19 @@
             <div class="topDiv">
               <div class="leftDiv">
                 <div>
-                  <img src="@assets/shangpin.png" alt />
+                  <img :src="hyzxFirst.fmzFileUrl" alt />
                 </div>
               </div>
               <div class="rightDiv">
-                <div class="title">文件柜快速找资料的小妙招</div>
-                <div class="content">
-                  第一界钢制家具企业交流会在上海举行第一界钢制家具企业交流会在上海举行
-                </div>
-                <div class="date">2010-01-18</div>
+                <div class="title">{{ hyzxFirst.noticeTitle }}</div>
+                <div class="content" v-html="hyzxFirst.noticeContent"></div>
+                <div class="date">{{ hyzxFirst.createTime }}</div>
               </div>
             </div>
             <ul class="bottomUl">
-              <li>关于新型电子存储柜的草图关于新型电子存储柜的草图</li>
-              <li>关于新型电子存储柜的草图关于新型电子存储柜的草图</li>
-              <li>关于新型电子存储柜的草图关于新型电子存储柜的草图</li>
-              <li>关于新型电子存储柜的草图关于新型电子存储柜的草图</li>
+              <li v-for="item in hyzxOther" :key="item.noticeId">
+                {{ item.noticeTitle }}
+              </li>
             </ul>
           </div>
         </el-col>
@@ -197,22 +204,19 @@
             <div class="topDiv">
               <div class="leftDiv">
                 <div>
-                  <img src="@assets/shangpin.png" alt />
+                  <img :src="hyzxFirst.fmzFileUrl" alt />
                 </div>
               </div>
               <div class="rightDiv">
-                <div class="title">文件柜快速找资料的小妙招</div>
-                <div class="content">
-                  第一界钢制家具企业交流会在上海举行第一界钢制家具企业交流会在上海举行
-                </div>
-                <div class="date">2010-01-18</div>
+                <div class="title">{{ jjbyFirst.noticeTitle }}</div>
+                <div class="content" v-html="jjbyFirst.noticeContent"></div>
+                <div class="date">{{ jjbyFirst.createTime }}</div>
               </div>
             </div>
             <ul class="bottomUl">
-              <li>关于新型电子存储柜的草图关于新型电子存储柜的草图</li>
-              <li>关于新型电子存储柜的草图关于新型电子存储柜的草图</li>
-              <li>关于新型电子存储柜的草图关于新型电子存储柜的草图</li>
-              <li>关于新型电子存储柜的草图关于新型电子存储柜的草图</li>
+              <li v-for="item in hyzxOther" :key="item.noticeId">
+                {{ item.noticeTitle }}
+              </li>
             </ul>
           </div>
         </el-col>
@@ -231,27 +235,84 @@ export default {
   data() {
     return {
       shangpin: [],
-      activeIndex: "a",
-      activeIndex2: "a"
+      demandList: [],
+      supplyList: [],
+      noticeListTzgg: [],
+      noticeListHyzx: [],
+      hyzxFirst: {},
+      hyzxOther: [],
+      noticeListJjby: [],
+      jjbyFirst: {},
+      jjbyOther: [],
+      loginAccount: ""
     };
   },
   methods: {
-    menuMouseOver(index) {
-      console.log(index);
-      this.activeIndex = index;
+    // 通知公告前5条 liuqiwen
+    noticeList(noticeType) {
+      var that = this;
+      that
+        .$post("/interface/notice/getNoticeListTop5", {
+          noticeType: noticeType
+        })
+        .then(function(res) {
+          console.log(res);
+          var target = `${process.env.VUE_APP_Target}`.replace(/\/$/, "");
+          if (res[0]) {
+            that.$message("数据请求错误!");
+          } else {
+            for (let i = 0; i < res[1].list.length; i++) {
+              res[1].list[i].fmzFileUrl = target + res[1].list[i].fmzFileUrl;
+            }
+            if (noticeType == 1) {
+              that.noticeListTzgg = res[1].list;
+            } else if (noticeType == 2) {
+              that.noticeListHyzx = res[1].list;
+              that.hyzxFirst = that.noticeListHyzx[0];
+              that.hyzxOther = that.noticeListHyzx.splice(1, 4);
+            } else {
+              that.noticeListJjby = res[1].list;
+              that.jjbyFirst = that.noticeListJjby[0];
+              that.jjbyOther = that.noticeListJjby.splice(1, 4);
+            }
+          }
+        });
     },
-    menuMouseLeave(index) {
-      console.log(index);
-      this.activeIndex = "a";
-    },
-    menuMouseOver2(index) {
-      console.log(index);
-      this.activeIndex = index;
+    // 需求信息前十条数据  liuqiwen
+    demandInfoTenList() {
+      var that = this;
+      that.$post("/demand/info/getDemandInfoTenList").then(function(res) {
+        console.log(res);
+        if (res[0]) {
+          that.$message("数据请求错误!");
+        } else {
+          that.demandList = res[1].demandList;
+        }
+      });
     },
-    menuMouseLeave2(index) {
-      console.log(index);
-      this.activeIndex = "a";
+    // 供应信息前10条 liuqiwen
+    supplyInfoTenLsit() {
+      var that = this;
+      that.$post("/supply/info/getSupplyInfoTenLsit").then(function(res) {
+        console.log(res);
+        if (res[0]) {
+          that.$message("数据请求错误!");
+        } else {
+          that.supplyList = res[1].supplyList;
+        }
+      });
     }
+  },
+  activated() {
+    this.loginAccount = this.$store.state.user.UserInfo.loginAccount;
+  },
+  mounted() {
+    console.log(this.$store.state.user.UserInfo);
+    this.noticeList(1);
+    this.noticeList(2);
+    this.noticeList(3);
+    this.demandInfoTenList();
+    this.supplyInfoTenLsit();
   }
 };
 </script>
@@ -496,7 +557,7 @@ export default {
       line-height: 3.6rem;
       overflow: hidden;
       .con {
-        width: 80%;
+        width: 65%;
         float: left;
         height: 100%;
         font-size: 1.4rem;
@@ -506,7 +567,7 @@ export default {
         overflow: hidden;
       }
       .date {
-        width: 20%;
+        width: 35%;
         float: left;
         height: 100%;
         font-size: 1.2rem;
@@ -556,7 +617,7 @@ export default {
       }
       .content {
         height: 5rem;
-        line-height: 2rem;
+        line-height: 2.5rem;
         font-size: 1.2rem;
         color: #666;
         overflow: hidden;

+ 70 - 21
src/views/info/details/buy.vue

@@ -4,29 +4,38 @@
     <div class="container">
       <div class="partTitle"><span class="orangeLine"></span>服务能力</div>
       <div class="formDiv">
-        <el-form class="form" ref="form" :model="form" label-width="110px">
-          <el-form-item label="商品类别:">
-            <el-select v-model="form.type" placeholder="请选择商品类别">
-              <el-option label="区域一" value="shanghai"></el-option>
-              <el-option label="区域二" value="beijing"></el-option>
-            </el-select>
+        <el-form
+          class="form"
+          :rules="rules"
+          ref="form"
+          :model="form"
+          label-width="110px"
+        >
+          <!--<el-form-item label="商品类别:">-->
+          <!--<el-select v-model="form.type" placeholder="请选择商品类别">-->
+          <!--<el-option label="区域一" value="shanghai"></el-option>-->
+          <!--<el-option label="区域二" value="beijing"></el-option>-->
+          <!--</el-select>-->
+          <!--</el-form-item>-->
+          <el-form-item label="需求标题:" prop="purchaseTitle">
+            <el-input v-model="form.purchaseTitle"></el-input>
           </el-form-item>
-          <el-form-item label="需求概要:">
-            <el-input v-model="form.xqgy"></el-input>
+          <el-form-item label="需求概要:" prop="summaryOfNeeds">
+            <el-input v-model="form.summaryOfNeeds"></el-input>
           </el-form-item>
-          <el-form-item label="需求详情:">
-            <el-input v-model="form.xqxq" type="textarea"></el-input>
+          <el-form-item label="需求详情:" prop="demandDetails">
+            <el-input v-model="form.demandDetails" type="textarea"></el-input>
           </el-form-item>
-          <el-form-item label="联系人:">
-            <el-input v-model="form.name"></el-input>
+          <el-form-item label="联系人:" prop="contacts">
+            <el-input v-model="form.contacts"></el-input>
           </el-form-item>
-          <el-form-item label="联系电话:">
-            <el-input v-model="form.tel"></el-input>
+          <el-form-item label="联系电话:" prop="contactNumber">
+            <el-input v-model="form.contactNumber"></el-input>
           </el-form-item>
         </el-form>
         <div class="line"></div>
         <div class="tc">
-          <el-button class="submitBtn" type="primary" @click="onSubmit"
+          <el-button class="submitBtn" type="primary" @click="onSubmit('form')"
             >提交</el-button
           >
         </div>
@@ -42,15 +51,55 @@ export default {
   data() {
     return {
       form: {
-        name: "",
-        tel: "",
-        type: "",
-        xqxq: "",
-        xqgy: ""
+        purchaseTitle: "",
+        summaryOfNeeds: "",
+        demandDetails: "",
+        contacts: "",
+        contactNumber: ""
+      },
+      rules: {
+        purchaseTitle: [
+          { required: true, message: "请输入需求标题", trigger: "blur" }
+        ],
+        summaryOfNeeds: [
+          { required: true, message: "请输入需求概要", trigger: "blur" }
+        ],
+        demandDetails: [
+          { required: true, message: "请输入需求详情", trigger: "blur" }
+        ],
+        contacts: [
+          { required: true, message: "请输入联系人", trigger: "blur" }
+        ],
+        contactNumber: [
+          { required: true, message: "请输入联系电话", trigger: "blur" }
+        ]
       }
     };
   },
-  methods: {}
+  methods: {
+    onSubmit(formName) {
+      var that = this;
+      if (that.$store.state.user.UserInfo === null) {
+        that.$message("用户未登录,请登录之后提交!");
+      } else {
+        this.$refs[formName].validate(valid => {
+          if (valid) {
+            that
+              .$post("/demand/info/insertDemandInfo", that.form)
+              .then(function(res) {
+                console.log(res);
+                // if (res[0]) {
+                //     that.$message("数据请求错误!");
+                // } else {
+                //     that.demandInfo = res[1].demandInfo;
+                // }
+              });
+          }
+        });
+      }
+    }
+  },
+  mounted() {}
 };
 </script>
 <style lang="scss" scoped>

File diff suppressed because it is too large
+ 43 - 9
src/views/info/details/buyDetail.vue


+ 48 - 12
src/views/info/details/supplyDetail.vue

@@ -31,23 +31,25 @@
         <el-col :span="14">
           <div class="title">
             <span class="type">供应</span>
-            <span class="name">钢制储物柜现货</span>
+            <span class="name">{{ noticeSupply.supplyTitle }}</span>
           </div>
-          <div class="info">生产厂家:洛阳科飞亚钢制家具有限公司</div>
-          <div class="info">联&nbsp;系&nbsp;人:任先生</div>
-          <div class="info">发布时间:2020-01-20</div>
-          <div class="info">联系电话:12345612312</div>
+          <div class="info">生产厂家:{{ noticeSupply.manufacturer }}</div>
+          <div class="info">
+            联&nbsp;系&nbsp;人:{{ noticeSupply.contacts }}
+          </div>
+          <div class="info">发布时间:{{ noticeSupply.releaseTime }}</div>
+          <div class="info">联系电话:{{ noticeSupply.telephone }}</div>
         </el-col>
       </el-row>
       <div class="infoDiv">
-        <div class="info">
-          <div class="tit">供应概要:</div>
-          <div class="con">钢制储物柜现货</div>
-        </div>
+        <!--<div class="info">-->
+        <!--<div class="tit">供应概要:</div>-->
+        <!--<div class="con">{{noticeSupply.telephone}}</div>-->
+        <!--</div>-->
         <div class="info">
           <div class="tit">供应详情:</div>
           <div class="con">
-            钢制储物柜现货钢制储物柜现货钢制储物柜现货钢制储物柜现货钢制储物柜现货钢制储物柜现货钢制储物柜现货钢制储物柜现货钢制储物柜现货钢制储物柜现货钢制储物柜现货钢制储物柜现货钢制储物柜现货钢制储物柜现货钢制储物柜现货钢制储物柜现货钢制储物柜现货
+            {{ noticeSupply.supplyDetails }}
           </div>
         </div>
       </div>
@@ -56,8 +58,42 @@
 </template>
 <script lang="ts">
 import { Component, Vue, Watch } from "vue-property-decorator";
-@Component
-export default class extends Vue {}
+export default {
+  name: "app",
+  components: {},
+  data() {
+    return {
+      id: null,
+      noticeSupply: {}
+    };
+  },
+  methods: {
+    // 需求信息详情数据请求 liuqiwen
+    detailData() {
+      var that = this;
+      that
+        .$post("/supply/info/getSupplyInfo", {
+          id: that.id
+        })
+        .then(function(res) {
+          console.log(res);
+          if (res[0]) {
+            that.$message("数据请求错误!");
+          } else {
+            that.noticeSupply = res[1].noticeSupply;
+          }
+        });
+    }
+  },
+  activated() {
+    this.id = parseInt(this.$route.query.id);
+    this.detailData();
+  },
+  mounted() {
+    this.id = parseInt(this.$route.query.id);
+    this.detailData();
+  }
+};
 </script>
 <style lang="scss" scoped>
 .container {

+ 71 - 16
src/views/info/index.vue

@@ -7,23 +7,27 @@
         </el-col>
         <el-col :span="20">
           <div class="infoTabDiv">
-            <el-tabs v-model="activeName" @tab-click="handleClick">
-              <el-tab-pane label="求购信息" name="first">
+            <el-tabs v-model="activeName" @tab-click="tabChange">
+              <el-tab-pane label="求购信息" name="demand">
                 <ul class="listUl">
-                  <li v-for="item in 10" :key="item">
-                    <router-link to="/info/buyDetail">
-                      <span class="name">信息信息信信息信息信息息11111</span
-                      ><span class="date">2010-01-01发布</span></router-link
+                  <li v-for="item in demandAllList" :key="item.id">
+                    <router-link :to="`/info/buyDetail?id=${item.id}`">
+                      <span class="name">{{ item.purchaseTitle }}</span
+                      ><span class="date"
+                        >{{ item.updateTime }}发布</span
+                      ></router-link
                     >
                   </li>
                 </ul>
               </el-tab-pane>
-              <el-tab-pane label="供应信息" name="second">
+              <el-tab-pane label="供应信息" name="supply">
                 <ul class="listUl">
-                  <li v-for="item in 10" :key="item">
-                    <router-link to="/info/supplyDetail">
-                      <span class="name">信息信息信信息信息信息息11111</span
-                      ><span class="date">2010-01-01发布</span></router-link
+                  <li v-for="item in supplyAllList" :key="item.id">
+                    <router-link :to="`/info/supplyDetail?id=${item.id}`">
+                      <span class="name">{{ item.supplyTitle }}</span
+                      ><span class="date"
+                        >{{ item.updateTime }}发布</span
+                      ></router-link
                     >
                   </li>
                 </ul>
@@ -60,20 +64,71 @@ export default {
   },
   data() {
     return {
-      activeName: "first",
+      activeName: "demand",
       currentPage: 1,
       pageSize: 10,
-      total: 20
+      total: 0,
+      demandAllList: [],
+      supplyAllList: []
     };
   },
   methods: {
-    handleClick(tab, event) {
-      console.log(tab, event);
+    tabChange(tab, event) {
+      var that = this;
+      that.currentPage = 1;
+      if (that.activeName == "demand") {
+        that.demandInfoAllList();
+      } else if (that.activeName == "supply") {
+        that.supplyInfoAllList();
+      }
     },
     handleCurrentChange(val) {
       this.currentPage = val;
-      this.requestData();
+      if (that.activeName == "demand") {
+        that.demandInfoAllList();
+      } else if (that.activeName == "supply") {
+        that.supplyInfoAllList();
+      }
+    },
+    // 求购信息列表 liuqiwen
+    demandInfoAllList() {
+      var that = this;
+      that
+        .$post("/demand/info/getDemandInfoAllList", {
+          pageNum: that.currentPage,
+          pageSize: that.pageSize
+        })
+        .then(function(res) {
+          console.log(res);
+          if (res[0]) {
+            that.$message("数据请求错误!");
+          } else {
+            that.demandAllList = res[1].rows;
+            that.total = res[1].total;
+          }
+        });
+    },
+    // 供应信息列表 liuqiwen
+    supplyInfoAllList() {
+      var that = this;
+      that
+        .$post("/supply/info/getSupplyInfoAllList", {
+          pageNum: that.currentPage,
+          pageSize: that.pageSize
+        })
+        .then(function(res) {
+          console.log(res);
+          if (res[0]) {
+            that.$message("数据请求错误!");
+          } else {
+            that.supplyAllList = res[1].rows;
+            that.total = res[1].total;
+          }
+        });
     }
+  },
+  mounted() {
+    this.demandInfoAllList();
   }
 };
 </script>