guhongwei 4 роки тому
батько
коміт
1786a39538

+ 4 - 0
src/store/index.js

@@ -42,6 +42,8 @@ import newsguidance from './live/newsguidance';
 import newsroadshow from './live/newsroadshow';
 import liveTechnicalColumn from './live/liveTechnicalColumn';
 import liveTechnicalNews from './live/liveTechnicalNews';
+// 网上调查
+import survey from './market/survey';
 
 Vue.use(Vuex);
 
@@ -88,5 +90,7 @@ export default new Vuex.Store({
     newsroadshow,
     liveTechnicalColumn,
     liveTechnicalNews,
+    // 网上调查
+    survey,
   },
 });

+ 42 - 0
src/store/market/survey.js

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

+ 84 - 0
src/views/dynamic/downparts/wsdc.vue

@@ -0,0 +1,84 @@
+<template>
+  <div id="wsdc">
+    <el-row>
+      <el-col :span="24" class="wsdc">
+        <el-image :src="cha"></el-image>
+        <el-form ref="form" :model="form">
+          <el-form-item>
+            <span slot="label">您是否愿意继续关注本平台 </span>
+            <el-radio-group v-model="form.resource">
+              <el-radio label="愿意"></el-radio>
+              <el-radio label="不愿意"></el-radio>
+            </el-radio-group>
+          </el-form-item>
+          <el-col :span="24" class="btn">
+            <el-button type="primary" @click="onSubmit">确认提交</el-button>
+          </el-col>
+        </el-form>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: survey } = createNamespacedHelpers('survey');
+export default {
+  name: 'wsdc',
+  props: {},
+  components: {},
+  data: function() {
+    return {
+      cha: require('@a/cha.png'),
+      form: {},
+    };
+  },
+  created() {},
+  methods: {
+    ...survey(['create']),
+    async onSubmit() {
+      let data = this.form;
+      data.uid = this.user.uid;
+      if (data.uid) {
+        let res = await this.create(data);
+        if (res.errcode === 0) {
+          this.$message({
+            message: '提交成功',
+            type: 'success',
+          });
+          this.$emit('handleClose');
+        }
+      } else {
+        this.$message({
+          message: '游客不可参与网上调查!',
+          type: 'warning',
+        });
+      }
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  watch: {},
+};
+</script>
+
+<style lang="less" scoped>
+.wsdc {
+  .el-image {
+    padding: 0px 40%;
+  }
+  .btn {
+    text-align: center;
+  }
+}
+/deep/.el-form-item__label {
+  width: 100%;
+  text-align: center;
+  font-size: 22px;
+  margin: 15px 0;
+}
+/deep/.el-radio-group {
+  padding: 0 35%;
+}
+</style>

+ 12 - 1
src/views/dynamic/index.vue

@@ -26,6 +26,9 @@
     <el-dialog title="建言献策" :visible.sync="jyxcdialog" width="60%" :before-close="handleClose">
       建言献策
     </el-dialog>
+    <el-dialog title="网上调查" :visible.sync="wsdcialog" width="30%" :before-close="handleClose">
+      <wsdc @handleClose="handleClose"></wsdc>
+    </el-dialog>
   </div>
 </template>
 
@@ -35,11 +38,13 @@ import pie from './parts/down-pie.vue';
 import maps from './parts/map.vue';
 // 公众参与
 import gzcy from './parts/gzcy.vue';
+// 网上调查
+import wsdc from './downparts/wsdc.vue';
 
 export default {
   name: 'index',
   props: {},
-  components: { userTwo, gzcy, maps },
+  components: { userTwo, gzcy, maps, wsdc },
   data: () => ({
     centerImage: require('@/assets/dynamic5.png'),
     // 公众参与
@@ -73,6 +78,8 @@ export default {
     zhfwdialog: false,
     // 建言献策
     jyxcdialog: false,
+    // 网上调查
+    wsdcialog: false,
   }),
   created() {},
   computed: {},
@@ -82,6 +89,8 @@ export default {
         this.zhfwdialog = true;
       } else if (data.title == '建言献策') {
         this.jyxcdialog = true;
+      } else if (data.title == '网上调查') {
+        this.wsdcialog = true;
       }
     },
     // 公共关闭
@@ -90,6 +99,8 @@ export default {
       this.zhfwdialog = false;
       // 建言献策
       this.jyxcdialog = false;
+      // 网上调查
+      this.wsdcialog = false;
     },
   },
 };