Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
quantum-blocks-h5
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
quantum-blocks-h5
Commits
e9da656d
Commit
e9da656d
authored
Oct 20, 2022
by
Xuguangxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 增加优惠券弹窗逻辑及同盾id处理
parent
db75319e
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
123 additions
and
21 deletions
+123
-21
editor.api.ts
app/web/api/editor.api.ts
+4
-0
modal.api.ts
app/web/api/modal.api.ts
+9
-0
index.vue
app/web/page/activity/component/CouponModal/index.vue
+48
-0
index.ts
app/web/page/activity/view/activity/index.ts
+47
-8
index.vue
app/web/page/activity/view/activity/index.vue
+2
-0
apollo.json
config/apollo.json
+11
-11
apollo.ssr.json
config/apollo.ssr.json
+1
-1
package.json
package.json
+1
-1
No files found.
app/web/api/editor.api.ts
View file @
e9da656d
...
...
@@ -43,4 +43,8 @@ export default {
getServerTime
()
{
return
http
.
get
(
`
${
config
.
apiHost
}
/editor/getServerTime`
);
},
getTongDunIdByKey
(
params
)
{
return
http
.
post
(
`
${
config
.
kdspHost
}
/api/kdsp/fraud/getDeviceId`
,
params
);
},
};
\ No newline at end of file
app/web/api/modal.api.ts
0 → 100644
View file @
e9da656d
import
http
from
'
../service/http.service
'
;
import
config
from
'
../config
'
;
export
default
{
// 获取优惠券弹窗
getCouponModal
(
params
)
{
return
http
.
post
(
`
${
config
.
kdspHost
}
/api/kdsp/app-config-push/coupon/push`
,
params
);
},
};
\ No newline at end of file
app/web/page/activity/component/CouponModal/index.vue
0 → 100644
View file @
e9da656d
<
template
>
<div
class=
"couponModal"
>
<cr-popup
v-model=
"show"
round
:close-on-click-overlay=
"false"
>
11
<cr-icon
type=
"close"
size=
"34px"
color=
"#FFF"
@
click=
"close"
/>
</cr-popup>
</div>
</
template
>
<
script
>
export
default
{
name
:
'
CouponModal
'
,
props
:
{
value
:
Boolean
,
},
data
()
{
return
{
show
:
false
,
}
},
methods
:
{
close
()
{
this
.
show
=
false
;
}
},
watch
:
{
value
(
val
)
{
this
.
show
=
val
;
}
}
}
</
script
>
<
style
lang=
"less"
scoped
>
@deep: ~'>>>';
.couponModal{
/deep/ .cr-overlay{
z-index: 103;
}
}
.cr-popup {
z-index: 104;
background-color: transparent;
border-radius: 0;
}
.cr-icon {
display: block;
margin: 20px auto 0;
}
</
style
>
\ No newline at end of file
app/web/page/activity/view/activity/index.ts
View file @
e9da656d
...
...
@@ -3,6 +3,7 @@ import { Getter, State, Mutation } from 'vuex-class';
import
FreedomContainer
from
'
../../component/FreedomContainer/index.vue
'
;
import
BackTop
from
'
../../component/BackTop/index.vue
'
;
import
InvalidNotice
from
'
../../component/invalidNotice/index.vue
'
;
import
CouponModal
from
'
../../component/CouponModal/index.vue
'
;
import
EmptyState
from
'
../../component/EmptyState/index.vue
'
;
import
PageBottomTip
from
'
../../component/PageBottomTip/index.vue
'
;
import
GridLayout
from
'
../../component/VueGridLayout/GridLayout.vue
'
;
...
...
@@ -21,7 +22,8 @@ import Bridge from '@qg/js-bridge';
import
MpBridge
from
'
@qg/citrus-ui/src/helper/service/mp
'
;
import
navigatorApi
from
'
@/api/navigator.api
'
;
import
editorApi
from
'
@/api/editor.api
'
;
@
Component
({
components
:
{
FreedomContainer
,
GridLayout
,
GridItem
,
PageBottomTip
,
BackTop
,
InvalidNotice
,
EmptyState
},
name
:
'
Activity
'
})
import
modalApi
from
'
@/api/modal.api
'
;
@
Component
({
components
:
{
FreedomContainer
,
GridLayout
,
GridItem
,
PageBottomTip
,
BackTop
,
InvalidNotice
,
EmptyState
,
CouponModal
},
name
:
'
Activity
'
})
export
default
class
Activity
extends
Mixins
(
TransformStyleMixin
,
BottomNavStyleMixin
,
SaMixin
,
DisableTouchMixin
)
{
@
Getter
(
'
pageData
'
)
pageData
;
...
...
@@ -52,6 +54,8 @@ export default class Activity extends Mixins(TransformStyleMixin, BottomNavStyle
targetEle
:
HTMLElement
|
null
=
null
;
loading
:
boolean
=
true
;
modfiTabsStyleDebounce
=
debounce
(
this
.
modfiTabsStyle
,
300
);
showCouponModal
:
boolean
=
false
;
couponModalData
:
object
=
{};
get
layout
()
{
if
(
!
isApp
&&
!
isWxMp
&&
!
EASY_ENV_IS_NODE
)
{
this
.
pageData
.
elements
=
this
.
pageData
.
elements
.
filter
(
v
=>
v
.
name
!==
'
cs-search-bar
'
&&
v
.
name
!==
'
cs-snap-up
'
);
...
...
@@ -146,12 +150,47 @@ export default class Activity extends Mixins(TransformStyleMixin, BottomNavStyle
async
created
()
{
const
[
res
,
]
=
await
editorApi
.
getFinanceSetting
();
const
[
serverTime
,
]
=
await
editorApi
.
getServerTime
();
console
.
log
(
res
,
'
finance result
'
);
console
.
log
(
serverTime
,
'
time
'
);
//
console.log(res, 'finance result');
//
console.log(serverTime, 'time');
if
(
res
&&
res
.
showFlag
===
0
)
{
this
.
pageData
.
elements
=
this
.
pageData
.
elements
.
filter
(
v
=>
v
.
name
!==
'
freedom-container
'
||
!
v
.
props
.
isFinance
);
}
this
.
comparePageTime
(
serverTime
);
// 验证活动是否在设定的有效期范围内
this
.
getCouponModalDetail
();
}
async
getCouponModalDetail
()
{
// 获取优惠券弹窗相关配置
if
(
this
.
pageData
?.
props
?.
couponModal
&&
this
.
pageData
?.
props
?.
couponModal
.
length
)
{
const
couponPushIdList
=
this
.
pageData
.
props
.
couponModal
.
join
(
'
,
'
);
let
tongdunDeviceId
=
''
;
// 先获取同盾ID,再调用优惠券弹窗推送接口
if
(
EASY_ENV_IS_BROWSER
)
{
if
(
isApp
)
{
// app的时候通过事件获取同盾id
EventBus
.
$on
(
'
NATIVE_EVENT_GET_TDONGDUN_ID
'
,
res
=>
{
console
.
log
(
'
getTongdunIdInAppSuccess
'
,
JSON
.
stringify
(
res
));
tongdunDeviceId
=
res
.
data
.
tongdunDeviceId
||
''
;
this
.
getCouponModalDetailReq
(
couponPushIdList
,
tongdunDeviceId
);
});
const
bridge
=
new
Bridge
();
bridge
.
run
({
event
:
'
getTongdunId
'
,
data
:
{},
});
}
}
}
},
async
getCouponModalDetailReq
(
couponPushIdList
,
tongdunDeviceId
)
{
// 获取推送弹窗数据
if
(
!
couponPushIdList
||
!
tongdunDeviceId
)
{
return
;
}
const
[
res
,
err
]
=
await
modalApi
.
getCouponModal
({
couponPushIdList
,
tongdunDeviceId
});
if
(
err
)
{
return
;
}
this
.
couponModalData
=
res
;
this
.
showCouponModal
=
true
;
}
comparePageTime
(
serverTime
)
{
const
{
validStartTime
,
validEndTime
}
=
this
.
pageInfo
;
...
...
@@ -208,11 +247,11 @@ export default class Activity extends Mixins(TransformStyleMixin, BottomNavStyle
async
fetchApi
(
options
)
{
const
{
store
,
route
}
=
options
;
const
{
pageId
}
=
route
.
params
;
try
{
await
store
.
dispatch
(
'
getFinanceSetting
'
);
}
catch
(
err
)
{
console
.
log
(
err
);
}
//
try {
//
await store.dispatch('getFinanceSetting');
//
} catch (err) {
//
console.log(err);
//
}
return
store
.
dispatch
(
'
getPageDate
'
,
{
pageId
});
}
updateShopCartCount
()
{
...
...
app/web/page/activity/view/activity/index.vue
View file @
e9da656d
<
template
>
<div
class=
"pageContent"
>
{{
couponModalData
}}
<div
class=
"activity"
:class=
"
{hasBottomNav: navigatorConfig}" :style="transformStyle(pageData.commonStyle)">
<template
v-if=
"!noPageData && tenantIdCorrect"
>
<div
class=
"layout"
>
...
...
@@ -24,6 +25,7 @@
</div>
<back-top
v-if=
"showBackTop"
:show-back-top=
"showBackTop"
ref=
"backTop"
/>
<invalid-notice
v-model=
"pageInvalid"
@
toOtherActivity=
"toOtherActivity"
/>
<coupon-modal
v-modeo=
"showCouponModal"
/>
</template>
<empty-state
v-else
/>
</div>
...
...
config/apollo.json
View file @
e9da656d
{
"api"
:
{
"apiHost"
:
"https://quantum-blocks-
toc
.liangkebang.net"
,
"h5Host"
:
"https://quantum-h5-
toc
.liangkebang.net"
,
"opapiHost"
:
"https://opapi-
toc
.liangkebang.net"
,
"passportHost"
:
"https://passportapi-
toc
.liangkebang.net"
,
"talosHost"
:
"https://talos-
toc
.liangkebang.net"
,
"kdspHost"
:
"https://kdsp-api-
toc
.liangkebang.net"
,
"apiHost"
:
"https://quantum-blocks-
ds
.liangkebang.net"
,
"h5Host"
:
"https://quantum-h5-
ds
.liangkebang.net"
,
"opapiHost"
:
"https://opapi-
ds
.liangkebang.net"
,
"passportHost"
:
"https://passportapi-
ds
.liangkebang.net"
,
"talosHost"
:
"https://talos-
ds
.liangkebang.net"
,
"kdspHost"
:
"https://kdsp-api-
ds
.liangkebang.net"
,
"loginUrl"
:
""
,
"newApolloFlag"
:
true
,
"h5ShopHost"
:
"https://tenet-
toc
.liangkebang.net/#"
,
"mallHost"
:
"https://mall-
toc
.liangkebang.net"
,
"xyqbH5Host"
:
"https://mapi-
toc
.liangkebang.net"
,
"h5ShopHost"
:
"https://tenet-
ds
.liangkebang.net/#"
,
"mallHost"
:
"https://mall-
ds
.liangkebang.net"
,
"xyqbH5Host"
:
"https://mapi-
ds
.liangkebang.net"
,
"yxmTenantId"
:
560761
,
"appIdMap"
:
{
"560761"
:
"wxe16bf9293671506c"
,
...
...
@@ -18,8 +18,8 @@
}
},
"redis"
:
{
"port"
:
"3
0895
"
,
"host"
:
"172.16.4.
89
"
,
"port"
:
"3
1980
"
,
"host"
:
"172.16.4.
7
"
,
"password"
:
""
,
"db"
:
0
},
...
...
config/apollo.ssr.json
View file @
e9da656d
{
"apiHost"
:
"https://quantum-blocks-toc.liangkebang.net","h5Host"
:
"https://quantum-h5-toc.liangkebang.net","opapiHost"
:
"https://opapi-toc.liangkebang.net","passportHost"
:
"https://passportapi-toc.liangkebang.net","talosHost"
:
"https://talos-toc.liangkebang.net","kdspHost"
:
"https://kdsp-api-toc.liangkebang.net","loginUrl"
:
"","newApolloFlag"
:
true
,
"h5ShopHost"
:
"https://tenet-toc.liangkebang.net/#","mallHost"
:
"https://mall-toc.liangkebang.net","xyqbH5Host"
:
"https://mapi-toc.liangkebang.net","yxmTenantId"
:
560761
,
"appIdMap"
:{
"560761"
:
"wxe16bf9293671506c","560867"
:
"wxccb8435d68e8c7d6"},"qiniuUpHost"
:
"https://up-z0.qiniup.com","qiniuHost"
:
"https://appsync.lkbang.net"
}
\ No newline at end of file
{
"apiHost"
:
"https://quantum-blocks-ds.liangkebang.net","h5Host"
:
"https://quantum-h5-ds.liangkebang.net","opapiHost"
:
"https://opapi-ds.liangkebang.net","passportHost"
:
"https://passportapi-ds.liangkebang.net","talosHost"
:
"https://talos-ds.liangkebang.net","kdspHost"
:
"https://kdsp-api-ds.liangkebang.net","loginUrl"
:
"","newApolloFlag"
:
true
,
"h5ShopHost"
:
"https://tenet-ds.liangkebang.net/#","mallHost"
:
"https://mall-ds.liangkebang.net","xyqbH5Host"
:
"https://mapi-ds.liangkebang.net","yxmTenantId"
:
560761
,
"appIdMap"
:{
"560761"
:
"wxe16bf9293671506c","560867"
:
"wxccb8435d68e8c7d6"},"qiniuUpHost"
:
"https://up-z0.qiniup.com","qiniuHost"
:
"https://appsync.lkbang.net"
}
\ No newline at end of file
package.json
View file @
e9da656d
...
...
@@ -8,7 +8,7 @@
"test"
:
"cross-env NODE_ENV=production EGG_SERVER_ENV=sit egg-scripts start --port 80 --workers 1"
,
"stop"
:
"egg-scripts stop"
,
"backend"
:
"nohup egg-scripts start --port 7001 --workers 4"
,
"dev"
:
"cross-env NODE_ENV=test APOLLO_CLUSTER=k8s NAMESPACE=
toc
npm run apollo && egg-bin dev -r egg-ts-helper/register"
,
"dev"
:
"cross-env NODE_ENV=test APOLLO_CLUSTER=k8s NAMESPACE=
ds
npm run apollo && egg-bin dev -r egg-ts-helper/register"
,
"debug"
:
"egg-bin debug -r egg-ts-helper/register"
,
"apollo"
:
"node bin/apollo.js"
,
"build"
:
"cross-env NODE_ENV=production APOLLO_CLUSTER=3C npm run apollo && cross-env COS_ENV=production easy build --devtool"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment