From f8b256ef152e54c19adb85856f62432d59c16b6e Mon Sep 17 00:00:00 2001
From: DESKTOP-CVS3R96\我恁爹 <11>
Date: Mon, 14 Nov 2022 19:00:29 +0800
Subject: [PATCH] wener~

---
 src/page/home/home.vue |   53 ++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 36 insertions(+), 17 deletions(-)

diff --git a/src/page/home/home.vue b/src/page/home/home.vue
index 2f39bad..70d22f2 100644
--- a/src/page/home/home.vue
+++ b/src/page/home/home.vue
@@ -210,19 +210,13 @@
       </div>
     </div>
     <!-- tab -->
-
     <GoToLogin v-show="isGoTo" />
   </div>
 </template>
-
 <script>
-
 import AllList from "@/page/list/list-all";
 import HomeList from "./components/home-list";
 import Echart from "./components/echart.vue";
-import {
-  Toast
-} from "mint-ui";
 import * as api from "@/axios/api";
 import Logo from "@/assets/img/icon_home_logo.png";
 import Searchs from "@/assets/home/search.png";
@@ -239,13 +233,12 @@
 import banner3 from "@/assets/img/b3.png";
 // import indexData from "./data.json";
 import GoToLogin from '@/page/home/components/GoLogin.vue';
-
 export default {
   components: {
     HomeList,
     AllList,
     GoToLogin,
-    Echart
+    Echart,
   },
   props: {},
   data() {
@@ -295,11 +288,22 @@
       newsContent4: [],
       onlineService: "",
       isGoTo: false,
-      bannerList:[]
+      bannerList:[],
+      userInfo: [],
     };
   },
   methods: {
-
+    
+    async getUserInfo() {
+      // 获取用户信息
+      let data = await api.getUserInfo();
+      if (data.status === 0) {
+        // 判断是否登录
+        this.$store.state.userInfo = data.data;
+        this.userInfo = data.data;
+      } else {
+      }
+    },
     getHuo() {
       //123随机
       var num = Math.floor(Math.random() * 3 + 1);
@@ -316,14 +320,18 @@
       }
     },
     goDetail(item) {
+      if(this.userInfo.length==0){
+        this.$store.commit('dialogVisible',true);
+        return;
+      }
       this.$router.push({
         path: "/kline",
         query: {
           name: item.name,
           stockplate: item.stock_plate,
           code: item.symbol.substring(2, item.symbol.length),
-          type: item.stocktype,
-          sok: 0,
+          type: item.market,
+          sok: this.filterSH(item.market),
           if_zhishu: '0',
         }
       });
@@ -336,15 +344,19 @@
       }
     },
     goJy(index){
+      if(this.userInfo.length==0){
+        this.$store.commit('dialogVisible',true);
+        return;
+      }
       switch (index) {
         case 0:
-          this.$router.push('/list');
+          this.$router.push('/trading-list');
           break;
           case 1:
-          this.$router.push('/orderlist');
+          this.$router.push('/warehouse');
           break;
           case 2:
-          //this.$router.push();
+          this.$router.push({path:'/trading-list',query:{listid:3}});
           break;
           case 3:
           this.$router.push('/user');
@@ -353,6 +365,10 @@
         default:
           break;
       }
+      if (navigator.vibrate) {
+          // 支持
+        navigator.vibrate([55]);
+      }
     },
     async getBanner () {
       // 获取显示的banner
@@ -360,7 +376,7 @@
       if (result.status === 0) {
         this.bannerList = result.data
       } else {
-        Toast(result.msg)
+        this.$store.commit('elAlertShow',{'elAlertShow':true,'elAlertText': result.msg});
       }
     },
     goOnline() {
@@ -379,7 +395,7 @@
       if (data.status === 0) {
         this.onlineService = data.data.onlineService
       } else {
-        Toast(data.msg)
+        this.$store.commit('elAlertShow',{'elAlertShow':true,'elAlertText': data.msg});
       }
     },
     async getStock() {
@@ -466,6 +482,7 @@
     this.ProcessData();
   },
   mounted() {
+    this.getUserInfo();
     this.getInfoSite();
     this.getNewsList(1);
     this.getNewsList(2);
@@ -816,6 +833,8 @@
         height: 100%;
         display: flex;
         align-items: center;
+        text-align: center;
+        justify-content: center;
       }
       .percentage span{
         height: 0.5rem;

--
Gitblit v1.9.3