Authored by htoooth

fix app go.back

... ... @@ -212,17 +212,9 @@ const yoho = {
* @param success 调用成功的回调方法
* @param fail 调用失败的回调方法
*/
goNewPage(args, success, fail) {
if (this.isApp && window.yohoInterface) {
if (args.header && args.header.headerid === '-1') {
args.showScrollbar = 'no';
}
goNewPage(args) {
if (this.isYohoBuy) {
window.yohoInterface.triggerEvent(success || nullFun, fail || nullFun, {
method: 'go.newPage',
arguments: args
});
} else if (this.isYohoBuy) {
let url = args.url;
if (url.indexOf('openby:') < 0) {
... ...
<template>
<div :class="prefixCls" v-show="show"><slot></slot></div>
<div :class="prefixCls" v-show="show">
<slot></slot>
</div>
</template>
<script>
const prefixCls = 'yoho-tabs-tabpane';
const prefixCls = 'yoho-tabs-tabpane';
export default {
export default {
name: 'TabPane',
props: {
index: {
type: String
},
label: {
type: String,
default: ''
... ... @@ -19,36 +18,28 @@
default: false
}
},
data () {
data() {
return {
prefixCls: prefixCls,
show: true
show: this.disabled
};
},
methods: {
updateNav () {
updateNav() {
this.$parent.updateNav();
}
},
watch: {
label () {
this.updateNav();
},
disabled () {
this.updateNav();
}
},
created () {
created() {
this.updateNav();
}
};
};
</script>
<style lang="scss" scoped>
.yoho-tabs-tabpane {
background: #F0F0F0;
.yoho-tabs-tabpane {
background: #f0f0f0;
width: 100%;
height: 100%;
}
}
</style>
... ...
... ... @@ -2,10 +2,10 @@
<div :class="classes">
<slot name="tabs" v-bind:navList="navList">
<div :class="[prefixCls + '-bar']">
<span class="back">
<span class="back" @click="onBackClick">
<i class="iconfont fontcls">&#xe763;</i>
</span>
<span class="help">
<span class="help" @click="onHelpClick">
<i class="iconfont fontcls">&#xe630;</i>
</span>
<div>
... ... @@ -26,7 +26,7 @@
<script>
export default {
name: "Tabs",
name: 'Tabs',
props: {
value: {
type: [String, Number]
... ... @@ -34,7 +34,7 @@ export default {
},
data() {
return {
prefixCls: "yoho-tabs",
prefixCls: 'yoho-tabs',
navList: [],
activeKey: this.value
};
... ... @@ -44,7 +44,7 @@ export default {
return [`${this.prefixCls}`];
},
contentClasses() {
return [`yoho-tabs-pane`];
return ['yoho-tabs-pane'];
},
contentStyle() {
return [];
... ... @@ -53,6 +53,7 @@ export default {
methods: {
updateNav() {
this.navList = [];
console.log();
this.getTabs().forEach((pane, index) => {
this.navList.push({
label: pane.label,
... ... @@ -60,7 +61,9 @@ export default {
disabled: pane.disabled
});
if (!pane.currentName) pane.currentName = index;
if (!pane.currentName) {
pane.currentName = index;
}
if (index === 0) {
if (!this.activeKey) {
... ... @@ -72,7 +75,7 @@ export default {
this.updateStatus();
},
getTabs() {
return this.$children.filter(item => item.$options.name === "TabPane");
return this.$children.filter(item => item.$options.name === 'TabPane');
},
updateStatus() {
const tabs = this.getTabs();
... ... @@ -83,19 +86,27 @@ export default {
const nav = this.navList[index];
this.activeKey = nav.name;
this.$emit("input", nav.name);
this.$emit('input', nav.name);
},
tabCls(item) {
return [
"yoho-tab",
'yoho-tab',
{
[`yoho-tab-active`]: item.name === this.activeKey
['yoho-tab-active']: item.name === this.activeKey
}
];
},
onBackClick() {
this.$yoho.finishPage({});
},
onHelpClick() {
this.$yoho.goNewPage({
url: window.location.protocol + '//m.yohobuy.com/service/qaDetail?keyword=%E4%BC%98%E6%83%A0%E5%88%B8&sonId=181'
});
}
},
watch: {
activeKey(val) {
activeKey() {
this.updateStatus();
},
value(val) {
... ... @@ -103,7 +114,7 @@ export default {
}
},
created() {
// this.updateNav();
this.updateNav();
}
};
</script>
... ... @@ -120,7 +131,7 @@ $yoho-tab: yoho-tab;
display: inline-block;
width: 200px;
height: 56px;
font-size: 12px;
font-size: 24px;
color: white;
border: 1px solid white;
box-sizing: border-box;
... ... @@ -129,6 +140,10 @@ $yoho-tab: yoho-tab;
line-height: 56px;
}
.#{$yoho-tab} + .#{$yoho-tab} {
border-left: none;
}
.#{$yoho-tab}s-bar {
width: 100%;
height: 90px;
... ... @@ -136,12 +151,11 @@ $yoho-tab: yoho-tab;
background: #3a3a3a;
justify-content: center;
align-items: center;
position: fixed;
z-index: 4;
}
.#{$yoho-tab}-active {
color: #444444;
color: #444;
background-color: white;
}
... ... @@ -156,13 +170,23 @@ $yoho-tab: yoho-tab;
}
.back {
display: inline-block;
width: 90px;
height: 90px;
line-height: 90px;
position: absolute;
left: 20px;
left: 0;
text-align: center;
}
.help {
display: inline-block;
width: 90px;
height: 90px;
line-height: 90px;
position: absolute;
right: 20px;
right: 0;
text-align: center;
}
</style>
... ...
import Ufo from './ufo';
import Yoho from './yoho';
import Header from './components/header';
import YohoPage from './list';
export default [{
path: '/mapp/coupon',
component: Header,
children: [Ufo, Yoho]
path: '/mapp/coupon/yoho.html',
component: YohoPage,
}];
... ...
<template>
<LayoutApp>
<Tabs>
<template slot="panes">
<TabPane label="有货优惠券" disable="true">
<YohoPage></YohoPage>
</TabPane>
<TabPane label="UFO优惠券" disable="false">
<UfoPage></UfoPage>
</TabPane>
</template>
</Tabs>
</LayoutApp>
</template>
<script>
import Tabs from './components/tabs';
import YohoPage from './yoho';
import UfoPage from './ufo';
const TYPE = {notuse: 'notuse', use: 'use', overtime: 'overtime'};
export default {
name: 'ListPage',
asyncData({store}) {
return Promise.all([
store.dispatch('coupon/yoho/fetchYohoList', {
type: TYPE.notuse,
refresh: true
}),
store.dispatch('coupon/yoho/fetchYohoList', {
type: TYPE.use,
refresh: true
}),
store.dispatch('coupon/yoho/fetchYohoList', {
type: TYPE.overtime,
refresh: true
}),
store.dispatch('coupon/yoho/fetchUfoList', {
limit: 100,
page: 1
}),
]);
},
components: {
Tabs,
TabPane: Tabs.Pane,
YohoPage,
UfoPage
}
};
</script>
<style lang="scss" scoped>
</style>
... ...
export default {
path: 'ufo.html',
name: 'couponUfo',
component: () => import(/* webpackChunkName: "coupon" */ './list')
};
// export default {
// path: 'ufo.html',
// name: 'couponUfo',
// component: () => import(/* webpackChunkName: "coupon" */ './list')
// };
import UfoList from './list';
export default UfoList;
... ...
... ... @@ -21,12 +21,6 @@ export default {
computed: {
...mapState(['ufoList']),
},
asyncData({store}) {
return store.dispatch('coupon/yoho/fetchUfoList', {
limit: 100,
page: 1
});
},
data() {
return {
scrollOptions: {
... ... @@ -40,6 +34,12 @@ export default {
mounted() {
},
methods: {
getList() {
return this.$store.dispatch('coupon/yoho/fetchUfoList', {
limit: 100,
page: 1
});
}
},
components: {
ScrollView,
... ...
export default {
path: 'yoho.html',
name: 'couponYoho',
component: () => import(/* webpackChunkName: "coupon" */ './list')
};
// export default {
// path: 'yoho.html',
// name: 'couponYoho',
// component: () => import(/* webpackChunkName: "coupon" */ './list')
// };
import YohoList from './list';
export default YohoList;
... ...
... ... @@ -63,22 +63,6 @@ const TYPE = {notuse: 'notuse', use: 'use', overtime: 'overtime'};
export default {
name: 'YohoCouponListPage',
asyncData({store}) {
return Promise.all([
store.dispatch('coupon/yoho/fetchYohoList', {
type: TYPE.notuse,
refresh: true
}),
store.dispatch('coupon/yoho/fetchYohoList', {
type: TYPE.use,
refresh: true
}),
store.dispatch('coupon/yoho/fetchYohoList', {
type: TYPE.overtime,
refresh: true
})
]);
},
data() {
return {
selectIndex: 0,
... ... @@ -134,8 +118,6 @@ export default {
return index;
}
},
created() {
},
mounted() {
this.fetchYohoNum();
},
... ... @@ -162,12 +144,16 @@ export default {
this.inputCouponCode = '';
this.$createToast({
txt: result.message,
type: 'correct'
type: 'txt',
mask: true,
time: 1000
}).show();
} else {
this.$createToast({
txt: result.message,
type: 'error'
type: 'txt',
mask: true,
time: 1000
}).show();
}
});
... ...