Commit 1d280c08 by 李伟康

修复BUG

1 parent cee9fb4c
<template>
<div id="app">
<router-view />
<template v-if="showWindow">
<transition name="fade">
<keep-alive v-if="$route.meta.keepAlive">
<router-view></router-view>
</keep-alive>
</transition>
<transition name="fade">
<router-view v-if="!$route.meta.keepAlive"></router-view>
</transition>
<template v-if="$route.meta.isTab && entry != 'normal'">
<tab-bar :data="tabList"></tab-bar>
</template>
</template>
</div>
</template>
<script>
const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV)
export default {
name: 'App'
name: 'App',
data() {
return {
entry: IS_PROD ? 'normal' :'chat_attachment',
tabList: [
{
title: '卡券',
name: 'coupon',
active: require('@/assets/images/tabbar/coupon_active.png'),
inactive: require('@/assets/images/tabbar/coupon.png')
},
{
title: '活动',
name: 'activity',
active: require('@/assets/images/tabbar/activity_active.png'),
inactive: require('@/assets/images/tabbar/activity.png')
}
]
}
},
watch: {
watchFlag: {
immediate: true,
handler(newval) {
this.showWindow = newval
this.hideLoading()
}
}
},
computed: {
watchFlag() {
return this.$store.state.app.showWindow
}
},
mounted() {
console.log()
},
methods: {}
}
</script>
<style lang="scss"></style>
<style lang="scss" scoped>
.isTab {
padding-bottom: 50px;
box-sizing: border-box;
}
</style>
\ No newline at end of file
......@@ -3,7 +3,7 @@ const { environment } = window.$fetchConfig
export default {
data() {
return {
entry: ''
entry: 'normal'
}
},
mounted() {
......@@ -41,7 +41,7 @@ export default {
},
sendMessage(i) {
let { merchantId, merchantName, userName, channelType } = this.getLocalStorage('dj_scrm_userInfo')
let { tabIndex, entry, tabList } = this
let { tabIndex, entry } = this
let { name } = this.$route
let { userId, id, couponName, activityName, packageName, goodsName, goodsImage, discountType } = i
let shopmall_appId = environment == 'beta' ? 'wx9f91c1ec493eb425' : 'wxe10067a63c1856ac'
......@@ -51,7 +51,8 @@ export default {
case 'coupon': {
let desc = '您的专属服务顾问为您发来了优惠券,请点击领取~'
let imgUrl = 'http://img01.glsx.com.cn/upload/biz/dracMini-yh-10004.png'
if (tabIndex == 0 && tabList.length > 1) {
console.log(entry)
if (tabIndex == 0 ) {
if (entry != 'normal')
this.sendChatMessage({
// channelType 1 嘀加 2:广汇
......@@ -61,6 +62,7 @@ export default {
page: `/packageMine/pages/boutique/gift/gift.html?id=${id}&userId=${userId}&employName=${this.toUnicode(i.employeeName)}`
})
else {
console.log('?')
boutiquecouponApi.getBoutiqueCoupon({ id }).then(res => {
this.shareAppMessage(res, desc, couponName, imgUrl)
})
......
const pages = [
const pages = {
coupon: [{
name: 'index',
meta: {
isTab: true
}
},
{
name: 'coupon',
name: 'verificationList',
meta: {
isTab: true,
title: '核销列表',
keepAlive: true
},
children: [
{
name: 'verificationList',
meta: {
title: '核销列表',
keepAlive: true
}
},
{
name: 'verificationDetail',
meta: {
title: '核销详情',
keepAlive: true
}
},
{
name: 'goodsVerification',
meta: {
title: '核销订单',
keepAlive: true
}
}
]
}
},
{
name: 'activity',
name: 'verificationDetail',
meta: {
isTab: true,
keepAlive: true,
backgroundColor: '#F7F7F7'
},
children: []
title: '核销详情',
keepAlive: true
}
},
{
name: 'merchant',
name: 'goodsVerification',
meta: {
keepAlive: true,
isIndex: true,
backgroundColor: '#F7F7F7',
title: '店铺中心'
},
children: []
title: '核销订单',
keepAlive: true
}
}
]
const keepAlives = []
const setChildren = (e, parent) => {
let arr = []
e.children.map(child => {
const { children, meta } = child
let url = `${parent}/${child.name}`
let name = url.replace(/\//g, '.')
let route = {
path: `/${url}`,
name,
meta: meta || {},
component: resolve => require([`views/${url}.vue`], resolve)
],
activity: [
{
name: 'index',
meta: {
isTab: true,
keepAlive: true,
backgroundColor: '#F7F7F7'
},
}
if (meta && meta.keepAlive) keepAlives.push(name)
if (children) route.children = setChildren(child, url)
arr.push(route)
})
return arr
],
merchant: [
{
name: 'index',
meta: {
keepAlive: true,
isIndex: true,
backgroundColor: '#F7F7F7',
title: '店铺中心'
}
}
]
}
const getPages = () => {
let router = {
path: '/',
name: 'home',
redirect: '/coupon',
component: resolve => require([`views/home.vue`], resolve)
}
router.children = pages.map(e => {
let name = `${e.name}`
let routes = []
const keepAlives = []
Object.keys(pages).map(parent => {
pages[parent].map(val => {
let childrenPath = `${parent}/${val.name}`
let { meta } = val
const path = `/${val.name == 'index' ? parent : childrenPath}`
const name = val.name == 'index' ? parent : childrenPath.replace('/', '.')
if (meta && meta.keepAlive) keepAlives.push(name)
let route = {
path: `/${name}`,
component: resolve => require([`views/${childrenPath}.vue`], resolve),
path,
name,
meta: e.meta || {},
component: resolve => require([`views/${name}/index.vue`], resolve)
meta
}
if (e.children) route.children = setChildren(e, name)
if (e.meta && e.meta.keepAlive) keepAlives.push(name)
return route
routes.push(route)
})
return [router]
}
})
console.log(routes)
export const keeps = keepAlives
export default getPages()
export default routes
\ No newline at end of file
......@@ -84,7 +84,7 @@ const couponObj = [
{
label: '类型',
format (item) {
return window.$discountType[item.discountType]
return `${window.$discountType[item.discountType]}券`
}
},
{
......
......@@ -199,6 +199,7 @@ export default {
name: '',
data () {
return {
test: '',
tab: [
['', '', ''],
['', ''],
......@@ -231,7 +232,6 @@ export default {
}
},
beforeRouteEnter (to, from, next) {
console.log('from', from)
let { params: { discountType, isGoods } } = from
next(vm => {
if (discountType) {
......@@ -260,13 +260,12 @@ export default {
})
},
activated () {
},
mounted () {
this.getTabNum()
window.$wx = wxConfig
window.$wx.init(['scanQRCode'])
},
mounted () {
},
methods: {
getTabNum () {
this.showLoading()
......
<!-- home -->
<template>
<div class="container">
<template v-if="showWindow">
<transition name="fade">
<keep-alive v-if="$route.meta.keepAlive">
<router-view></router-view>
</keep-alive>
</transition>
<transition name="fade">
<router-view v-if="!$route.meta.keepAlive"></router-view>
</transition>
<template v-if="$route.meta.isTab && entry != 'normal'">
<tab-bar :data="tabList"></tab-bar>
</template>
</template>
</div>
</template>
<script>
const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV)
export default {
data() {
return {
entry: IS_PROD ? 'normal' :'chat_attachment',
tabList: [
{
title: '卡券',
name: 'coupon',
active: require('@/assets/images/tabbar/coupon_active.png'),
inactive: require('@/assets/images/tabbar/coupon.png')
},
{
title: '活动',
name: 'activity',
active: require('@/assets/images/tabbar/activity_active.png'),
inactive: require('@/assets/images/tabbar/activity.png')
}
]
}
},
watch: {
watchFlag: {
immediate: true,
handler(newval) {
this.showWindow = newval
this.hideLoading()
}
}
},
computed: {
watchFlag() {
return this.$store.state.app.showWindow
}
},
mounted() {},
methods: {}
}
</script>
<style lang="scss" scoped>
.isTab {
padding-bottom: 50px;
box-sizing: border-box;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!