2 Commits b97cdd11d3 ... d93125f3af

Auteur SHA1 Bericht Datum
  wxy d93125f3af Merge branch 'master' of http://git.cc-lotus.info/service-platform/mobile-official 4 jaren geleden
  wxy 8b81eb0561 11 4 jaren geleden
2 gewijzigde bestanden met toevoegingen van 98 en 6 verwijderingen
  1. 2 0
      src/views/user/index/notice.vue
  2. 96 6
      src/views/user/index/question.vue

+ 2 - 0
src/views/user/index/notice.vue

@@ -62,9 +62,11 @@ export default {
         this.$set(this, `list`, res.data);
       }
     },
+    //搜索
     async onSearch({ ...info } = {}) {
       if (this.value) {
         info.title = this.value;
+        info.column_id = this.colId;
         const res = await this.newQuery({ ...info });
         if (this.$checkRes(res)) {
           this.$set(this, `list`, res.data);

+ 96 - 6
src/views/user/index/question.vue

@@ -1,8 +1,19 @@
 <template>
   <div id="question">
     <el-row>
-      <el-col :span="24">
-        <p>调查问卷</p>
+      <el-col :span="24" class="question">
+        <el-col :span="24" class="search">
+          <van-search v-model="value" placeholder="请输入信息标题" @search="onSearch" />
+        </el-col>
+        <el-col :span="24" class="mess">
+          <el-col :span="24" v-for="(item, index) in list" :key="index" class="list">
+            <p class="title textOver">{{ item.title }}</p>
+            <p>
+              <span class="textOver">发布时间:{{ item.publish_time }}</span>
+              <span class="textOver">来源:{{ item.orgin || '暂无' }}</span>
+            </p>
+          </el-col>
+        </el-col>
       </el-col>
     </el-row>
   </div>
@@ -20,10 +31,53 @@ export default {
   props: {},
   components: {},
   data: function() {
-    return {};
+    return {
+      //栏目列表
+      columnList: [],
+      colId: '',
+      list: [],
+      value: '',
+    };
+  },
+  async created() {
+    await this.search();
+    await this.searchList();
+  },
+  methods: {
+    ...column(['query', 'delete', 'update', 'create']),
+    ...news({ newQuery: 'query' }),
+    //查栏目
+    async search() {
+      const res = await this.query();
+      if (this.$checkRes(res)) {
+        this.$set(this, `columnList`, res.data);
+        const colData = this.columnList.find(i => i.site == 'dcwj');
+        this.colId = colData.id;
+      }
+    },
+    //查列表
+    async searchList() {
+      const res = await this.newQuery({ column_id: this.colId });
+      if (this.$checkRes(res)) {
+        this.$set(this, `list`, res.data);
+        // console.log(this.list);
+      }
+    },
+    //搜索
+    async onSearch({ ...info } = {}) {
+      if (this.value) {
+        info.title = this.value;
+        info.column_id = this.colId;
+        const res = await this.newQuery({ ...info });
+        console.log(res.data);
+        if (this.$checkRes(res)) {
+          this.$set(this, `list`, res.data);
+        }
+      } else {
+        this.searchList();
+      }
+    },
   },
-  created() {},
-  methods: {},
   computed: {
     ...mapState(['user']),
   },
@@ -31,4 +85,40 @@ export default {
 };
 </script>
 
-<style lang="less" scoped></style>
+<style lang="less" scoped>
+.question {
+  position: relative;
+  .search {
+    position: fixed;
+    width: 100%;
+    z-index: 999;
+    border-bottom: 1px solid #ccc;
+    background-color: #fff;
+    .van-search {
+      padding: 10px 12px 10px 12px;
+    }
+  }
+  .mess {
+    padding: 0px 10px;
+    margin-top: 55px;
+    .list {
+      padding: 10px 0px;
+      border-bottom: 1px dashed #ccc;
+      .title {
+        font-size: 18px;
+        font-weight: bold;
+      }
+      p:nth-child(2) {
+        margin-top: 5px;
+        span {
+          display: inline-block;
+          width: 50%;
+          height: 42px;
+          line-height: 42px;
+          color: #666;
+        }
+      }
+    }
+  }
+}
+</style>