Przeglądaj źródła

添加微信日志

chaooo 1 rok temu
rodzic
commit
064d9bf95e
3 zmienionych plików z 28 dodań i 3 usunięć
  1. 2 1
      src/pages/report/index.vue
  2. 2 2
      src/pages/start/index.vue
  3. 24 0
      src/utils/wechat_log.js

+ 2 - 1
src/pages/report/index.vue

@@ -1,6 +1,7 @@
 <template>
   <div class="reportContainer">
     <web-view :src="webUrl" @load="webLoading"></web-view>
+    <van-toast id="van-toast"/>
   </div>
 </template>
 <script>
@@ -18,7 +19,7 @@ export default {
   },
   methods: {
     webLoading(params) {
-      console.log("加载完成")
+      console.log("报告页面web-view加载完成")
       wx.hideLoading();
     }
   },

+ 2 - 2
src/pages/start/index.vue

@@ -243,7 +243,7 @@ import {addRawData, gameAddLine, gameEnd} from "../../requests/game";
 import mpvueEcharts from "mpvue-echarts";
 import echarts from "../../../static/echarts.min";
 import {LogInDb} from "@/requests/log";
-
+import WechatLog from '@/utils/wechat_log'
 var att_charts, med_charts, $this;
 
 // 大脑图表初始化
@@ -513,8 +513,8 @@ export default {
         ..._game_datas,
         sn: wx.getStorageSync('deviceSn')
       };
+      WechatLog.info(JSON.stringify($params));
 
-      console.log($params)
       if (!$params.line) {
         return false;
       }

+ 24 - 0
src/utils/wechat_log.js

@@ -0,0 +1,24 @@
+const wechat_log = wx.getRealtimeLogManager ? wx.getRealtimeLogManager() : null;
+module.exports = {
+  debug() {
+    if (!wechat_log) return
+    wechat_log.debug.apply(wechat_log, arguments)
+  },
+  info() {
+    if (!wechat_log) return
+    wechat_log.info.apply(wechat_log, arguments)
+  },
+  warn() {
+    if (!wechat_log) return
+    wechat_log.warn.apply(wechat_log, arguments)
+  },
+  error() {
+    if (!wechat_log) return
+    wechat_log.error.apply(wechat_log, arguments)
+  },
+  setFilterMsg(msg) { // 从基础库2.7.3开始支持
+    if (!wechat_log || !wechat_log.setFilterMsg) return
+    if (typeof msg !== 'string') return
+    wechat_log.setFilterMsg(msg)
+  }
+}