tt0101 1 週間 前
コミット
63adf9ffc1
2 ファイル変更73 行追加5 行削除
  1. 8 2
      src/router/index.js
  2. 65 3
      src/views/home/index.vue

+ 8 - 2
src/router/index.js

@@ -60,7 +60,10 @@ const routes = [
   {
     path: "/register",
     name: "Register",
-    component: Register
+    component: Register,
+    meta: {
+      hideTabBar: true
+    }
   },
   {
     path: "/charges",
@@ -106,7 +109,10 @@ const routes = [
     path: "/login",
     name: "login",
     component: () =>
-      import(/* webpackChunkName: "login" */ "../views/login.vue")
+      import(/* webpackChunkName: "login" */ "../views/login.vue"),
+    meta: {
+      hideTabBar: true
+    }
   },
   {
     path: "/forget",

+ 65 - 3
src/views/home/index.vue

@@ -56,13 +56,28 @@
       src="https://www.nongfuspring.com/en/aboutus/management.html"
       frameborder="0"
     ></iframe> -->
-    
+    <van-dialog
+      v-model="showDialog"
+      :show-confirm-button="false"
+      :show-cancel-button="false"
+      :close-on-click-overlay="true"
+      class="welcome-dialog"
+    >
+      <div class="close-icon-wrapper">
+        <van-icon name="cross" class="close-icon" @click="showDialog = false" />
+      </div>
+      <div class="dialog-title">{{userInfo.gonggao.title}}</div>
+      <div class="dialog-content" v-html="userInfo.gonggao.value">
+      </div>
+    </van-dialog>
   </div>
 </template>
 
 <script>
-import { getBanners, getUserInfo,getNews } from '@/api/home';
-import { Swipe, SwipeItem } from 'vant';
+import { getBanners, getUserInfo, getNews } from '@/api/home';
+import { Swipe, SwipeItem, Dialog, Icon } from 'vant';
+import Vue from 'vue';
+
 export default {
   name: "Home",
   data() {
@@ -70,11 +85,16 @@ export default {
       banners: [],
       userInfo: {},
       newsList: [],
+      showDialog: true,
     };
   },
   components: {
     [Swipe.name]: Swipe,
     [SwipeItem.name]: SwipeItem,
+    [Icon.name]: Icon,
+  },
+  created() {
+    Vue.use(Dialog);
   },
   mounted() {
     this.getBanners();
@@ -250,4 +270,46 @@ export default {
   border-radius: 8px;
   background: #fff;
 }
+
+.close-icon-wrapper {
+  position: absolute;
+  top: 16px;
+  right: 16px;
+  z-index: 1;
+  
+  .close-icon {
+    font-size: 20px;
+    color: #969799;
+    cursor: pointer;
+    padding: 4px;
+    
+    &:hover {
+      color: #323233;
+    }
+  }
+}
+
+.dialog-title {
+  text-align: center;
+  font-size: 18px;
+  font-weight: bold;
+  padding: 16px 0;
+  margin-top: 8px;
+}
+
+.welcome-dialog {
+  :deep(.van-dialog__content) {
+    padding: 20px;
+    position: relative;
+  }
+}
+
+.dialog-content {
+  text-align: center;
+  p {
+    margin: 10px 0;
+    font-size: 16px;
+    color: #333;
+  }
+}
 </style>