Browse Source

feat: 保存

gemercheung 1 year ago
parent
commit
d89b3c07ca

+ 2 - 2
.env.development

@@ -1,3 +1,3 @@
-VITE_DOMAIN_URL="http://192.168.20.61:8059"
-VITE_API_URL="http://192.168.20.61:8059/api/"
+VITE_DOMAIN_URL="https://sit-qiushoubwg.4dage.com"
+VITE_API_URL="https://sit-qiushoubwg.4dage.com/api"
 VITE_PUBLIC_DIR="/web/"

+ 11 - 4
src/App.vue

@@ -1,19 +1,26 @@
 <template>
-  <n-config-provider :theme="theme" :themeOverrides="themeOverrides">
+  <n-config-provider
+    :theme="theme"
+    :themeOverrides="themeOverrides"
+    inline-theme-disabled
+  >
     <div class="page" :class="routeName">
-      <router-view />
+      <n-message-provider>
+        <router-view />
+      </n-message-provider>
     </div>
   </n-config-provider>
 </template>
 
 <script setup>
-import { computed, ref } from "vue";
+import { computed, onMounted, ref } from "vue";
 import { themeOverrides } from "./theme/override.js";
-import { darkTheme } from "naive-ui";
 import { useRouter } from "vue-router";
+
 const router = useRouter();
 const routeName = ref();
 const theme = ref(null);
+
 router.beforeEach((to, from, next) => {
   document.title = to.meta.title;
   routeName.value = to.name;

+ 23 - 15
src/components/collectBox.vue

@@ -2,7 +2,7 @@
   <n-card class="collect-box" @click="handleDetail">
     <template #cover>
       <div class="cover">
-        <!-- <img :src="cover" /> -->
+        <img :src="cover" />
       </div>
     </template>
     <div class="info-line">
@@ -38,7 +38,7 @@ const props = defineProps({
 });
 const handleDetail = () => {
   if (props.id) {
-    router.push('/collect-detail/' + props.id)
+    router.push("/collect-detail/" + props.id);
   }
 };
 </script>
@@ -47,35 +47,43 @@ const handleDetail = () => {
 .collect-box {
   --collect-box-remark-color: #9b9b9b;
   --collect-box-background: url("/img/collect-box-bg.png");
-  --collect-box-title-font-size: 1.625rem;
+  --collect-box-title-font-size: 26px;
   --collect-box-title-dot: url("/img/dot.png");
 }
 </style>
 <style lang="scss" scoped>
 .n-card.collect-box {
-  padding: 0.625rem;
+  padding: 10px;
   --n-padding-left: 0 !important;
   --n-padding-bottom: 0 !important;
   background: #f5f5f5;
-  box-shadow: 0rem .125rem .25rem 0rem rgba(46, 25, 16, 0.16);
-  border-radius: 0.8125rem;
+  box-shadow: 0px 2px 4px 0px rgba(46, 25, 16, 0.16);
+  border-radius: 13px;
   padding: 0;
   cursor: pointer;
   .cover {
     background-color: #c1b2b2;
     overflow: hidden;
-    min-height: 20.1875rem;
+    height: 14.1875rem;
     width: 100%;
+    display: inline-flex;
+    justify-content: center;
+    align-items: center;
+    img {
+      height: 90%;
+      width: auto;
+      object-fit: scale-down;
+    }
   }
   .title {
     font-size: var(--collect-box-title-font-size);
-    margin: 0.9375rem;
-    padding-left: 25px;
+    margin: 15px;
+    padding-left: 1.5625rem;
     position: relative;
     line-height: calc(var(--collect-box-title-font-size) * 2);
     text-overflow: ellipsis;
     word-break: break-all;
-    max-height: calc(var(--collect-box-title-font-size) * 3 + 0.9375rem * 2);
+    max-height: calc(var(--collect-box-title-font-size) * 3 + 15px * 2);
     overflow: hidden;
     display: -webkit-box;
     -webkit-box-orient: vertical;
@@ -86,9 +94,9 @@ const handleDetail = () => {
       left: 0;
       position: absolute;
       background-image: var(--collect-box-title-dot);
-      background-size: 1.25rem 1.25rem;
-      width: 1.25rem;
-      height: 1.25rem;
+      background-size: 20px 20px;
+      width: 20px;
+      height: 20px;
       background-repeat: no-repeat;
       background-position: center left;
     }
@@ -108,9 +116,9 @@ const handleDetail = () => {
         justify-content: center;
         align-items: center;
         img {
-          max-height: 1rem;
+          max-height: 16px;
           width: auto;
-          margin-left: 0.3125rem;
+          margin-left: 5px;
         }
       }
     }

+ 15 - 8
src/components/infoBox.vue

@@ -11,7 +11,11 @@
         <span> {{ time }}</span>
         <div class="see-more" @click="$router.push(`/info-detail/${id}`)">
           查看
-          <img class="see-more-img" src="@/assets/see_more.png" alt="see more" />
+          <img
+            class="see-more-img"
+            src="@/assets/see_more.png"
+            alt="see more"
+          />
         </div>
       </div>
     </div>
@@ -49,23 +53,26 @@ defineProps({
 </style>
 <style lang="scss" scoped>
 .n-card.info-box {
-  padding: .625rem;
+  padding: 0.625rem;
   --n-padding-left: 0 !important;
   --n-padding-bottom: 0 !important;
   // width: 32.1875rem;
   // height: 26.5rem;
   background: #f5f5f5;
-  box-shadow: 0rem .125rem .25rem 0rem rgba(46,25,16,0.16);
-  border-radius: .8125rem;
-  border-top: .5rem solid var(--main-primary-color);
+  box-shadow: 0rem 0.125rem 0.25rem 0rem rgba(46, 25, 16, 0.16);
+  border-radius: 0.8125rem;
+  border-top: 0.5rem solid var(--main-primary-color);
   .cover {
     background-color: gray;
     overflow: hidden;
-    max-height: 17.75rem;
+    height: 17.75rem;
+    img {
+      object-fit: cover;
+    }
   }
   .title {
     font-size: 1.625rem;
-    margin: .9375rem 0;
+    margin: 0.9375rem 0;
   }
   .info-line {
     display: flex;
@@ -85,7 +92,7 @@ defineProps({
         img {
           max-height: 1rem;
           width: auto;
-          margin-left: .3125rem;
+          margin-left: 0.3125rem;
         }
       }
     }

+ 1 - 1
src/components/noticeBox.vue

@@ -52,7 +52,7 @@ const handleDetail = () => {
   cursor: pointer;
   background-color: transparent;
   background-image: var(--main-sub-list-bg);
-  background-position: top right;
+  background-position: top center;
   background-size: cover;
   background-repeat: no-repeat;
   height: 15.75rem;

+ 35 - 0
src/store/collect.js

@@ -0,0 +1,35 @@
+import { defineStore } from "pinia";
+import { request } from "../api";
+
+export const useCollectStore = defineStore({
+  id: "collect",
+  state: () => {
+    return {
+      lists: [],
+      pagination: {
+        dictLevel: "",
+        endTime: "",
+        pageNum: 0,
+        pageSize: 0,
+        searchKey: "",
+        startTime: "",
+      },
+    };
+  },
+  getters: {},
+  actions: {
+    async getCollectList(page) {
+      this.pagination.pageNum = page || 1;
+      const { data, status } = await request.post("/show/goods/pageList", {
+        ...this.pagination,
+      });
+      if (data.code === 0) {
+        const { records, total, current, page } = data.data;
+        this.lists = records;
+        this.pagination.total = total;
+        this.pagination.current = current;
+        this.pagination.page = page;
+      }
+    },
+  },
+});

+ 26 - 0
src/store/feedback.js

@@ -0,0 +1,26 @@
+import { defineStore } from "pinia";
+import { request } from "../api";
+
+export const useFeedBackStore = defineStore({
+  id: "feedback",
+  state: () => {
+    return {};
+  },
+  getters: {},
+  actions: {
+    async sendFeedback(param) {
+      const { data } = await request.post("/show/message/save", param);
+      const { msg, data: result, code } = data;
+      if (code === 0) {
+        return Promise.resolve({
+          isOK: true,
+        });
+      } else {
+        return Promise.resolve({
+          isOK: false,
+          msg,
+        });
+      }
+    },
+  },
+});

+ 48 - 9
src/store/info.js

@@ -5,10 +5,23 @@ export const useInfoStore = defineStore({
   id: "info",
   state: () => {
     return {
-      exhibition: [],
-      activity: [],
+      exhibitions: [],
+      activates: [],
       news: [],
       notices: [],
+      detail: {
+        createTime: "",
+        creatorId: "",
+        creatorName: "",
+        display: null,
+        id: "",
+        name: "",
+        publishDate: "",
+        richText: "",
+        thumb: "",
+        type: "",
+        video: "",
+      },
       pagination: {
         pageNum: 1,
         pageSize: 20,
@@ -27,16 +40,25 @@ export const useInfoStore = defineStore({
         ...this.pagination,
       });
       if (data.code === 0) {
-        this.exhibition = data.data;
+        const { records, total, current, page } = data.data;
+        this.exhibition = records;
+        this.pagination.total = total;
+        this.pagination.current = current;
+        this.pagination.page = page;
       }
     },
-    async getActivity() {
+    async getActivity(page) {
+      this.pagination.pageNum = page || 1;
       this.pagination.type = "activity";
       const { data, status } = await request.post("/show/news/pageList", {
         ...this.pagination,
       });
       if (data.code === 0) {
-        this.activity = data.data;
+        const { records, total, current, page } = data.data;
+        this.activates = records;
+        this.pagination.total = total;
+        this.pagination.current = current;
+        this.pagination.page = page;
       }
     },
     async getNews(page) {
@@ -46,17 +68,34 @@ export const useInfoStore = defineStore({
         ...this.pagination,
       });
       if (data.code === 0) {
-        this.news = data.data;
+        const { records, total, current, page } = data.data;
+        this.news = records;
+        this.pagination.total = total;
+        this.pagination.current = current;
+        this.pagination.page = page;
       }
     },
-    async getNotices() {
+    async getNotices(page) {
       this.pagination.type = "notice";
-      this.pagination.pageNum = 1;
+      this.pagination.pageNum = page || 1;
       const { data, status } = await request.post("/show/news/pageList", {
         ...this.pagination,
       });
       if (data.code === 0) {
-        this.notices = data.data;
+        const { records, total, current, page } = data.data;
+        this.notices = records;
+        this.pagination.total = total;
+        this.pagination.current = current;
+        this.pagination.page = page;
+      }
+    },
+
+    async getDetail(id) {
+      const { data, status } = await request.get(`/show/news/detail/${id}`);
+      if (data.code === 0) {
+        this.detail = data.data;
+      } else {
+        this.detail = null;
       }
     },
   },

+ 10 - 0
src/store/survey.js

@@ -58,5 +58,15 @@ export const useSurveyStore = defineStore({
         this.details = data.data;
       }
     },
+    async sendAnswer(answers) {
+      const { data, status } = await request.post(
+        "/show/questionnaire/saveAnswer",
+        answers
+      );
+      console.log("data", data);
+      if (data.code === 0) {
+        // this.details = data.data;
+      }
+    },
   },
 });

+ 12 - 11
src/views/collect.vue

@@ -26,14 +26,15 @@
             </span>
           </template>
           <n-tab-pane name="all" tab="全部">
+            <!-- {{ collectLists }} -->
             <n-grid :x-gap="XGap" :y-gap="YGap" :cols="3" class="tab-grid">
-              <template v-for="(_, index) in 16">
+              <template v-for="item in collectLists">
                 <n-gi>
                   <collect-box
-                    :id="index + 1"
-                    title="里仁学校学生使用的课本——日本东洋博物学 会编《博物标本图汇》里仁学校学生使用的课本——日本东洋博物学 会编《博物标本图汇》"
-                    cover="https://07akioni.oss-cn-beijing.aliyuncs.com/07akioni.jpeg"
-                    time="2023-01-02"
+                    :id="item.id"
+                    :title="item.name"
+                    :cover="domain + item.thumb"
+                    :time="item.publishDate"
                   />
                 </n-gi>
               </template>
@@ -89,21 +90,22 @@
 </template>
 
 <script setup>
-import { onMounted, ref } from "vue";
+import { computed, onMounted, ref } from "vue";
 import { useFullscreen } from "@vueuse/core";
 import collectBox from "../components/collectBox";
 import subHeader from "../components/subHeader";
 import sideMenu from "../components/sideMenu";
 // import noticeBox from "../components/noticeBox";
-// import { useInfoStore } from "../store/info";
-
+import { useCollectStore } from "../store/collect";
+const collectStore = useCollectStore();
+const domain = ref(import.meta.env.VITE_DOMAIN_URL);
+const collectLists = computed(() => collectStore.lists);
 const XGap = ref(50);
 const YGap = ref(50);
 const inputValue = ref("");
 
-
 onMounted(() => {
-  
+  collectStore.getCollectList();
 });
 </script>
 
@@ -117,5 +119,4 @@ onMounted(() => {
     padding: 0 20px;
   }
 }
-
 </style>

+ 44 - 33
src/views/feedback.vue

@@ -13,10 +13,10 @@
               type="textarea"
               autosize
               placeholder="请填入内容,5-500字"
-              style="min-height: 400px"
+              style="min-height: 25rem"
             />
 
-            <n-space align="center" style="padding: 20px" justify="center">
+            <n-space align="center" style="padding: 1.25rem" justify="center">
               <n-input
                 v-model:value="nickName"
                 size="large"
@@ -41,7 +41,7 @@
                 @click="handleCodeReload"
               />
             </n-space>
-            <n-space align="center" justify="center" style="padding: 20px">
+            <n-space align="center" justify="center" style="padding: 1.25rem">
               <n-button
                 class="submit"
                 size="large"
@@ -70,12 +70,16 @@ import { watchEffect, ref } from "vue";
 import subHeader from "../components/subHeader";
 import sideMenu from "../components/sideMenu";
 import heroSubTitle from "../components/heroSubTitle";
-import { useInfoStore } from "../store/info";
+import { useFeedBackStore } from "../store/feedback";
 import { useRouter } from "vue-router";
+import { useMessage } from "naive-ui";
+window.$message = useMessage();
+
 const router = useRouter();
+const feedBackStore = useFeedBackStore();
 
 const imageCode = ref(
-  "http://192.168.20.61:8059/api/show/getRandCode?t=" + Date.now()
+  `${import.meta.env.VITE_API_URL}/show/getRandCode?t=` + Date.now()
 );
 const title = ref("detail");
 const feedBackContent = ref("");
@@ -86,16 +90,23 @@ watchEffect(() => {
   document.title = title.value;
 });
 
-const submit = () => {
-  //to submit
-  const data = {
-    name: nickName.value,
-    content: feedBackContent.value,
-    contact: contact.value,
-    code: verifyCode.value,
-  };
-  console.log("data", data);
-  router.go(-1);
+const submit = async () => {
+  try {
+    const data = {
+      name: nickName.value,
+      content: feedBackContent.value,
+      phone: contact.value,
+      randCode: verifyCode.value,
+    };
+    const res = await feedBackStore.sendFeedback(data);
+    console.log("res", res);
+    if (res.isOK) {
+      window.$message.success("提交成功!");
+      router.go(-1);
+    } else {
+      window.$message.warning(res.msg);
+    }
+  } catch (error) {}
 };
 const handleCodeReload = () => {
   const url = imageCode.value.split("?");
@@ -105,19 +116,19 @@ const handleCodeReload = () => {
 
 <style lang="scss" scoped>
 :deep(.n-input) {
-  font-size: 16px;
+  font-size: 1rem;
 }
 .detail {
   --main-show-case-background: #ddd5d5;
-  --main-detail-margin: 1.875rem;
-  --main-detail-padding: 1.875rem;
+  --main-detail-margin: 30px;
+  --main-detail-padding: 30px;
   // box-shadow: var(--main-box-shadow);
   margin: var(--main-detail-margin);
   margin-bottom: 0;
   flex: 1;
-  border-radius: 0.8125rem;
+  border-radius: 13px;
   background-color: transparent;
-  padding: 2rem 3rem 4rem 3rem;
+  padding: 32px 48px 64px 48px;
   background-image: var(--main-detail-background-img);
   background-size: cover;
   background-position: top 100%;
@@ -130,26 +141,26 @@ const handleCodeReload = () => {
 
   .back {
     background-image: url("/img/back_arrow.png");
-    width: 7.5rem;
-    height: 1.875rem;
+    width: 120px;
+    height: 30px;
     background-repeat: no-repeat;
     background-size: contain;
-    margin-bottom: 0.75rem;
+    margin-bottom: 12px;
   }
   .info {
-    max-width: 66.8125rem;
+    max-width: 1069px;
     margin: 0 auto;
-    font-size: 1.25rem;
+    font-size: 20px;
   }
   .show-case {
-    max-width: 66.8125rem;
-    height: 34.1875rem;
+    max-width: 1069px;
+    height: 547px;
     background: var(--main-show-case-background);
   }
   .submit {
-    font-size: 20px;
-    padding: 1.5625rem 3.125rem;
-    border-radius: 3.75rem;
+    font-size: 1.25rem;
+    padding: 25px 50px;
+    border-radius: 1.1875rem;
   }
   .txt-code {
     vertical-align: middle;
@@ -157,8 +168,8 @@ const handleCodeReload = () => {
   }
 }
 :deep(.detail .info .n-input--textarea) {
-  --n-font-size: 20px !important;
-  padding: 1.25rem;
-  border-radius: 1.875rem;
+  --n-font-size: 1.25rem !important;
+  padding: 20px;
+  border-radius: 19px;
 }
 </style>

+ 52 - 30
src/views/info-detail.vue

@@ -5,28 +5,30 @@
       <div class="left">
         <hero-sub-title />
         <div class="detail">
-          <div class="back" @click="$router.go(-1)"></div>
-
-          <div class="info">
-            <div class="show-case"></div>
-            <h3 class="title">湘鄂赣省工农银行洋银叁角纸币</h3>
-            <div class="label-list">
-              <span>时代:土地革命时期</span>
-              <span>来源:澄潭三星</span>
-              <span>质地:纸质</span>
-              <span>级别:二级</span>
-            </div>
-            <div class="text">
-              这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简
-              这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简
-              这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简
-              这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简
-              这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简
-              这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简
-              这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简
-              这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简
-              这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简
-              这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简
+          <!-- {{ detail }} -->
+          <div class="detail-wrapper">
+            <div class="back" @click="$router.go(-1)"></div>
+            <div class="info">
+              <div class="show-case"></div>
+              <h3 class="title">湘鄂赣省工农银行洋银叁角纸币</h3>
+              <div class="label-list">
+                <span>时代:土地革命时期</span>
+                <span>来源:澄潭三星</span>
+                <span>质地:纸质</span>
+                <span>级别:二级</span>
+              </div>
+              <div class="text">
+                这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简
+                这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简
+                这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简
+                这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简
+                这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简
+                这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简
+                这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简
+                这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简
+                这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简
+                这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简
+              </div>
             </div>
           </div>
         </div>
@@ -37,16 +39,28 @@
 </template>
 
 <script setup>
-import { watchEffect, ref } from "vue";
+import { watchEffect, ref, onMounted, computed } from "vue";
 import { useFullscreen } from "@vueuse/core";
 import subHeader from "../components/subHeader";
 import sideMenu from "../components/sideMenu";
 import heroSubTitle from "../components/heroSubTitle";
 import { useInfoStore } from "../store/info";
 const title = ref("detail");
+const infoStore = useInfoStore();
+const detail = computed(() => infoStore.detail);
 
+const props = defineProps({
+  id: {
+    type: [String, Number],
+    default: () => null,
+    required: true,
+  },
+});
 watchEffect(() => {
   document.title = title.value;
+  if (props.id) {
+    infoStore.getDetail(props.id);
+  }
 });
 </script>
 
@@ -61,17 +75,24 @@ watchEffect(() => {
   flex: 1;
   border-radius: 0.8125rem;
   background: transparent;
-  padding: 2rem 3rem 4rem 3rem;
+  // padding: 2rem 3rem 4rem 3rem;
   background-image: var(--main-detail-background-img);
   background-size: cover;
   background-position: top 100%;
   background-repeat: no-repeat;
+  overflow: hidden;
 
-  overflow-y: scroll;
-  &::-webkit-scrollbar {
-    display: none;
+  .detail-wrapper {
+    display: block;
+    width: 100%;
+    flex: 1;
+    height: calc(100% - var(--main-detail-margin) - 10px);
+    margin-top: var(--main-detail-margin);
+    overflow-y: scroll;
+    &::-webkit-scrollbar {
+      display: none;
+    }
   }
-
   .back {
     background-image: url("/img/back_arrow.png");
     width: 7.5rem;
@@ -79,12 +100,13 @@ watchEffect(() => {
     background-repeat: no-repeat;
     background-size: contain;
     margin-bottom: 0.75rem;
+    margin-left: 3rem;
   }
   .info {
     max-width: 66.8125rem;
     margin: 0 auto;
-    font-size: 20px;
-
+    font-size: 1.25rem;
+    padding-bottom:5rem;
     .title {
       font-size: 1.875rem;
       line-height: 3.75rem;

+ 10 - 8
src/views/info.vue

@@ -44,12 +44,13 @@
           </n-tab-pane>
           <n-tab-pane name="news" tab="新闻">
             <n-grid :x-gap="XGap" :y-gap="YGap" :cols="3" class="tab-grid">
-              <template v-for="item in 16">
+              <template v-for="item in news">
                 <n-gi>
-                  <infoBox
-                    title="卡片"
-                    cover="https://07akioni.oss-cn-beijing.aliyuncs.com/07akioni.jpeg"
-                    time="2023-01-02"
+                  <info-box
+                    :id="item.id"
+                    :title="item.name"
+                    :cover="domain + item.thumb"
+                    :time="item.publishDate"
                   />
                 </n-gi>
               </template>
@@ -77,7 +78,7 @@
 </template>
 
 <script setup>
-import { onMounted, watch } from "vue";
+import { onMounted, watch, computed } from "vue";
 import { vInfiniteScroll } from "@vueuse/components";
 import infoBox from "../components/infoBox";
 import subHeader from "../components/subHeader";
@@ -85,8 +86,9 @@ import sideMenu from "../components/sideMenu";
 import noticeBox from "../components/noticeBox";
 import { useInfoStore } from "../store/info";
 const infoStore = useInfoStore();
-
+const domain = ref(import.meta.env.VITE_DOMAIN_URL);
 const currentTab = ref("exhibition");
+const news = computed(() => infoStore.news);
 
 const handleTabFetch = (type) => {
   switch (type) {
@@ -100,7 +102,7 @@ const handleTabFetch = (type) => {
       infoStore.getNews();
       break;
     case "notice":
-      infoStore.getNews();
+      infoStore.getNotices();
       break;
   }
 };

+ 21 - 4
src/views/survey-detail.vue

@@ -58,13 +58,14 @@
 
 <script setup>
 import { watchEffect, ref, onMounted, computed } from "vue";
+import { useMessage } from "naive-ui";
 import subHeader from "../components/subHeader";
 import sideMenu from "../components/sideMenu";
 import heroSubTitle from "../components/heroSubTitle";
 import { useSurveyStore } from "../store/survey";
 const surveyStore = useSurveyStore();
 const title = ref("detail");
-
+const message = useMessage();
 const details = computed(() => surveyStore.details);
 
 const props = defineProps({
@@ -81,7 +82,23 @@ watchEffect(() => {
   }
 });
 
-const submit = () => {};
+const submit = async () => {
+  const lastAnswers = details.value.map((detail) => {
+    const mapper = {};
+    mapper["otherDesc"] = detail.value;
+    mapper["questionId"] = detail.id;
+    mapper["questionnaireId"] = detail.questionnaireId;
+    mapper["type"] = detail.type;
+    return mapper;
+  });
+  console.log("lastAnswers", lastAnswers);
+
+  try {
+    await surveyStore.sendAnswer(lastAnswers);
+  } catch (error) {
+    message.warning("提交服务器失败!");
+  }
+};
 </script>
 
 <style lang="scss" scoped>
@@ -138,8 +155,8 @@ const submit = () => {};
       align-items: center;
       :deep(.n-button) {
         font-size: 1.25rem;
-        padding: 25px 50px;
-        border-radius: 60px;
+        padding: 1.5625rem 3.125rem;
+        border-radius: 1.1875rem;
       }
     }
   }