Browse Source

1. 修复第一次进入home页佣金显示问题 2. 修复玩家明细查询控制台报错问题

gongyan 4 years ago
parent
commit
2dd70f5839

+ 3 - 1
src/App.vue

@@ -59,7 +59,6 @@ export default {
       this.showNav = false;
     }
     this.getUserInfo();
-    this.onProfit();
   },
   methods: {
     ...mapActions([
@@ -137,6 +136,9 @@ export default {
         // 成功
         this.$utils.setCookie("userInfo", JSON.stringify(data), 7);
         this.userInfoAction(data);
+
+        // 用户佣金详情
+        this.onProfit();
       });
     },
   },

+ 2 - 1
src/components/TopNav/TopNav.vue

@@ -69,7 +69,7 @@ export default {
   created() {},
   mounted() {},
   methods: {
-    ...mapActions(["userInfoAction"]),
+    ...mapActions(["userInfoAction", "userProfitAction"]),
     // 退出登录
     loginOut() {
       this.$confirm("即将退出登录, 是否继续?", "提示", {
@@ -90,6 +90,7 @@ export default {
             // 成功
             this.$utils.delCookie("userInfo");
             this.userInfoAction({});
+            this.userProfitAction({});
             this.$router.push({
               name: "Login",
             });

+ 5 - 4
src/views/Directly/DirectlyPlayer/DirectlyPlayer.vue

@@ -69,10 +69,11 @@ export default {
           return;
         }
         // 成功
-        data.data.map((ele) => {
-          const { amount } = ele;
-          ele.amount = (amount / 100).toFixed(2);
-        });
+        data.data.length > 0 &&
+          data.data.map((ele) => {
+            const { amount } = ele;
+            ele.amount = (amount / 100).toFixed(2);
+          });
         this.tableList = data.data;
         this.totalPage = Math.ceil(data.count / this.pageSize);
       });

+ 19 - 2
src/views/Home/Home.vue

@@ -13,7 +13,7 @@
 <script>
 import ShowMoney from "@/components/ShowMoney/ShowMoney";
 import HomeLink from "@/views/Home/HomeLink/HomeLink";
-import { mapState } from "vuex";
+import { mapActions, mapState } from "vuex";
 export default {
   name: "Home",
   components: {
@@ -44,9 +44,12 @@ export default {
   },
   created() {},
   mounted() {
-    this.init();
+    this.onProfit();
   },
   methods: {
+    ...mapActions(["userProfitAction"]),
+
+    // 初始化
     init() {
       const {
         game_user_amount,
@@ -69,6 +72,20 @@ export default {
         ((game_user_profit + promo_user_profit) / 100).toFixed(2),
       ];
     },
+
+    // 获取已赚取佣金
+    onProfit() {
+      this.$api.profit().then((res) => {
+        this.checkCode(res);
+        const { code, data } = res.data;
+        if (code) {
+          return;
+        }
+        // 成功 todo
+        this.userProfitAction(data);
+        this.init();
+      });
+    },
   },
 };
 </script>