Authored by TaoHuang

fix($report): 修复上报的问题

@@ -194,8 +194,8 @@ router.onReady(() => { @@ -194,8 +194,8 @@ router.onReady(() => {
194 params: { 194 params: {
195 appop: 'XY_H5_PAGE_OPEN_L', 195 appop: 'XY_H5_PAGE_OPEN_L',
196 param: { 196 param: {
197 - F_URL: `${location.origin}${from.fullPath}`,  
198 - PAGE_URL: `${location.origin}${to.fullPath}`, 197 + F_URL: `${location.origin}${from?.fullPath}`,
  198 + PAGE_URL: `${location.origin}${to?.fullPath}`,
199 PAGE_NAME: to.name, 199 PAGE_NAME: to.name,
200 }, 200 },
201 }, 201 },
@@ -205,8 +205,8 @@ router.onReady(() => { @@ -205,8 +205,8 @@ router.onReady(() => {
205 params: { 205 params: {
206 appop: 'XY_H5_PAGE_EXIT_L', 206 appop: 'XY_H5_PAGE_EXIT_L',
207 param: { 207 param: {
208 - F_URL: `${location.origin}${to.fullPath}`,  
209 - PAGE_URL: `${location.origin}${from.fullPath}`, 208 + F_URL: `${location.origin}${to?.fullPath}`,
  209 + PAGE_URL: `${location.origin}${from?.fullPath}`,
210 PAGE_NAME: from.name, 210 PAGE_NAME: from.name,
211 }, 211 },
212 }, 212 },
@@ -14,6 +14,7 @@ @@ -14,6 +14,7 @@
14 <script> 14 <script>
15 15
16 import Tabs from './components/tabs'; 16 import Tabs from './components/tabs';
  17 +import { mapState, mapMutations } from 'vuex';
17 18
18 export default { 19 export default {
19 name: 'IndexPage', 20 name: 'IndexPage',
@@ -21,11 +22,18 @@ export default { @@ -21,11 +22,18 @@ export default {
21 components: { 22 components: {
22 Tabs 23 Tabs
23 }, 24 },
  25 + computed: {
  26 + ...mapState(['yoho'])
  27 + },
  28 + mounted() {
  29 + this.SET_QUERY(this.$route.query ? this.$route.query : {});
  30 + },
24 methods: { 31 methods: {
  32 + ...mapMutations(['SET_QUERY']),
25 onClick(index) { 33 onClick(index) {
26 this.$store.dispatch('reportYas', { 34 this.$store.dispatch('reportYas', {
27 params: { 35 params: {
28 - param: {TAB_ID: index + 1 }, 36 + param: { TAB_ID: index + 1 },
29 appop: 'XY_UFO_MAIN_TAB' 37 appop: 'XY_UFO_MAIN_TAB'
30 } 38 }
31 }); 39 });
@@ -42,20 +50,20 @@ export default { @@ -42,20 +50,20 @@ export default {
42 this.$yoho.auth({ 50 this.$yoho.auth({
43 refer: '/xianyu/index/news' 51 refer: '/xianyu/index/news'
44 }).then((res) => { 52 }).then((res) => {
45 - if(res) { 53 + if (res) {
46 this.go('NewsPage'); 54 this.go('NewsPage');
47 } 55 }
48 - }) 56 + });
49 break; 57 break;
50 } 58 }
51 case 3: { 59 case 3: {
52 this.$yoho.auth({ 60 this.$yoho.auth({
53 refer: '/xianyu/index/mine' 61 refer: '/xianyu/index/mine'
54 }).then((res) => { 62 }).then((res) => {
55 - if(res) { 63 + if (res) {
56 this.go('MinePage'); 64 this.go('MinePage');
57 } 65 }
58 - }) 66 + });
59 break; 67 break;
60 } 68 }
61 default: { 69 default: {
@@ -65,7 +73,10 @@ export default { @@ -65,7 +73,10 @@ export default {
65 }, 73 },
66 go(name) { 74 go(name) {
67 this.$router.replace({ 75 this.$router.replace({
68 - name 76 + name,
  77 + query: {
  78 + ...this.yoho.context.query
  79 + }
69 }); 80 });
70 } 81 }
71 } 82 }
@@ -24,7 +24,8 @@ export default function(mergeState = {}) { @@ -24,7 +24,8 @@ export default function(mergeState = {}) {
24 isLogin: false, 24 isLogin: false,
25 userHeadIco: '', 25 userHeadIco: '',
26 userName: '', 26 userName: '',
27 - enableQiugou: null, // 是否启用求购,默认不启用, null: 初始状态标识,需要请求api, false: 不启用, true: 启用 27 + enableQiugou: null, // 是否启用求购,默认不启用, null: 初始状态标识,需要请求api, false: 不启用, true: 启用,
  28 + query: {}
28 }, 29 },
29 window: { 30 window: {
30 statusBarStatus: false, 31 statusBarStatus: false,
@@ -140,6 +141,9 @@ export default function(mergeState = {}) { @@ -140,6 +141,9 @@ export default function(mergeState = {}) {
140 }, 141 },
141 [Types.FETCH_XIANYU_CONFIG](state, data) { 142 [Types.FETCH_XIANYU_CONFIG](state, data) {
142 state.config = data; 143 state.config = data;
  144 + },
  145 + [Types.SET_QUERY](state, data) {
  146 + state.context.query = data;
143 } 147 }
144 }, 148 },
145 getters: { 149 getters: {
@@ -228,6 +232,22 @@ export default function(mergeState = {}) { @@ -228,6 +232,22 @@ export default function(mergeState = {}) {
228 }, 232 },
229 asyncindx, 233 asyncindx,
230 ); 234 );
  235 +
  236 + if (window._yasEvents) {
  237 + window._yasEvents.forEach(e => {
  238 + window._yas.sendAppLogs(
  239 + {
  240 + appop: e.appop,
  241 + param: e.param ? JSON.stringify(e.param) : '{}',
  242 + },
  243 + asyncindx,
  244 + );
  245 + });
  246 +
  247 + window._yasEvents = null;
  248 + }
  249 + } else {
  250 + window._yasEvents = window._yasEvents ? window._yasEvents.push({ appop, param }) : [{ appop, param }];
231 } 251 }
232 }, 300); 252 }, 300);
233 } catch (e) { 253 } catch (e) {
@@ -21,3 +21,5 @@ export const FETCH_USER_INFO_FAILD = 'FETCH_USER_INFO_FAILD'; @@ -21,3 +21,5 @@ export const FETCH_USER_INFO_FAILD = 'FETCH_USER_INFO_FAILD';
21 export const FETCH_USER_INFO_SUCCESS = 'FETCH_USER_INFO_SUCCESS'; 21 export const FETCH_USER_INFO_SUCCESS = 'FETCH_USER_INFO_SUCCESS';
22 22
23 export const FETCH_XIANYU_CONFIG = 'FETCH_XIANYU_CONFIG'; 23 export const FETCH_XIANYU_CONFIG = 'FETCH_XIANYU_CONFIG';
  24 +
  25 +export const SET_QUERY = 'SET_QUERY';