Authored by 陈峰

Merge branch 'release/4.0' of http://git.yoho.cn/fe/yohoblk-wap into release/4.0

... ... @@ -12,6 +12,10 @@ yoho.ready(() => {
yoho.showLoading(false);
$('.home').on('click', () => {
yoho.goBack();
if(yoho.isYohoBuy) {
yoho.goNewBack();
} else {
yoho.goBack();
}
});
});
... ...
... ... @@ -299,6 +299,23 @@ const yoho = {
},
/**
* 新的返回上一级页面
* @param args {""}
* @param success
* @param fail
*/
goNewBack(args, success, fail) {
if (this.isYohoBuy && window.yohoInterface) {
window.yohoInterface.triggerEvent(success || nullFun, fail || nullFun, {
method: 'go.newback',
arguments: args
});
} else {
history.go(-1);
}
},
/**
* 联系电话
* @param args {""}
* @param success
... ...
<template>
<img v-if="lazy" v-lazy="currentSrc" alt="" :width="width" :height="height">
<img v-else :src="currentSrc" alt="" :width="width" :height="height">
<img v-else ref="image" :src="currentSrc" alt="" :width="width" :height="height">
</template>
<script>
... ... @@ -27,6 +27,24 @@ export default {
}
return this.src;
}
},
mounted() {
// let timer;
// let img = new Image();
// let maxRetry = 30 * 1000;
// let start = Date.now();
//
// timer = setInterval(() => {
// img.src = this.$refs.image.src;
//
// if (!img.src) {
// clearInterval(timer);
// }
//
// if (img.complete || Date.now() - start > maxRetry) {
// clearInterval(timer);
// }
// }, 3000);
}
};
</script>
... ...
... ... @@ -48,7 +48,22 @@ export default {
},
methods: {
toggle(idx) {
this.$set(this.show, idx, !this.show[idx]);
for (let i = 0; i < this.show.length; i++) {
if (i !== idx) {
this.$set(this.show, i, false);
this.$set(this.sortClass, i, {
'icon-sort-up': false,
'icon-sort-down': true
});
} else {
this.$set(this.show, i, !this.show[idx]);
this.$set(this.sortClass, i, {
'icon-sort-up': true,
'icon-sort-down': false
});
}
}
this.$set(this.sortClass, idx, {
'icon-sort-up': this.show[idx],
'icon-sort-down': !this.show[idx]
... ...
... ... @@ -40,6 +40,13 @@ export default {
computed: {
...mapState(['channel']),
},
beforeRouteEnter (to, from, next) {
next(vm => {
if (vm.$yoho && vm.$yoho.isAndroid) {
vm.$yoho.blkBackStatus(true);
}
});
},
asyncData({store}) {
return store.dispatch(FETCH_ABOUT_REQUEST);
},
... ...
... ... @@ -67,6 +67,13 @@
return this.$store.state.channel[this.gender].floors;
}
},
beforeRouteEnter (to, from, next) {
next(vm => {
if (vm.$yoho && vm.$yoho.isAndroid) {
vm.$yoho.blkBackStatus(true);
}
});
},
asyncData({store, router: to}) {
const gender = /\/channel\/men/.test(to.path) ? 'men' : 'women';
return store.dispatch(FETCH_CHANNEL_REQUEST, {gender});
... ...
... ... @@ -2,9 +2,11 @@ import {
FETCH_HOME_REQUEST,
FETCH_HOME_FAILURE,
FETCH_HOME_SUCCESS,
REFRESH_HOME_RESET,
FETCH_CHANNEL_REQUEST,
FETCH_CHANNEL_SUCCESS,
FETCH_CHANNEL_FAILURE,
REFRESH_CHANNEL_RESET,
FETCH_ABOUT_REQUEST,
FETCH_ABOUT_SUCCESS,
FETCH_ABOUT_FAILURE
... ... @@ -22,7 +24,7 @@ export function createChannel() {
return {
state: {
home: {},
slider: {},
slider: [],
about: {},
gender: 'men',
men: {
... ... @@ -50,6 +52,10 @@ export function createChannel() {
state.home = result.data;
state.slider = slider.data[0].data;
},
[REFRESH_HOME_RESET](state) {
state.home = [];
state.slider = [];
},
[FETCH_ABOUT_REQUEST](state) {
state.fetchingAbout = true;
},
... ... @@ -67,6 +73,10 @@ export function createChannel() {
[FETCH_CHANNEL_FAILURE](state) {
state[state.gender].isFetching = false;
},
[REFRESH_CHANNEL_RESET](state) {
state[state.gender].floors = [];
state[state.gender].sort = [];
},
[FETCH_CHANNEL_SUCCESS](state, {data, sort, cache}) {
if (!cache) {
const keyCvt = {
... ... @@ -96,6 +106,10 @@ export function createChannel() {
}
commit(FETCH_HOME_REQUEST);
if (refresh) {
commit(REFRESH_HOME_RESET);
}
try {
const getContent = this.$api.get('/api/resource/get', {
home_invalid_cache: Date.now(),
... ... @@ -121,6 +135,10 @@ export function createChannel() {
commit(FETCH_CHANNEL_SUCCESS, {cache: true});
return Promise.resolve();
}
if (refresh) {
commit(REFRESH_CHANNEL_RESET);
}
try {
let getSort = this.$api.get('/sort/list', {
home_invalid_cache: Date.now(),
... ...
export const FETCH_HOME_REQUEST = 'FETCH_HOME_REQUEST';
export const FETCH_HOME_SUCCESS = 'FETCH_HOME_SUCCESS';
export const FETCH_HOME_FAILURE = 'FETCH_HOME_FAILURE';
export const REFRESH_HOME_RESET = 'REFRESH_HOME_RESET';
export const FETCH_CHANNEL_REQUEST = 'FETCH_CHANNEL_REQUEST';
export const FETCH_CHANNEL_SUCCESS = 'FETCH_CHANNEL_SUCCESS';
export const FETCH_CHANNEL_FAILURE = 'FETCH_CHANNEL_FAILURE';
export const REFRESH_CHANNEL_RESET = 'REFRESH_CHANNEL_RESET';
export const FETCH_ABOUT_REQUEST = 'FETCH_ABOUT_REQUEST';
export const FETCH_ABOUT_SUCCESS = 'FETCH_ABOUT_SUCCESS';
... ...