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
81c086f6
Commit
81c086f6
authored
Sep 23, 2021
by
郭志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(backTop): ios双击修复
parent
2384150b
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
53 additions
and
24 deletions
+53
-24
activity.ts
app/controller/activity.ts
+19
-15
index.ts
app/web/component/layout/activity/index.ts
+4
-2
index.vue
app/web/page/activity/component/BackTop/index.vue
+10
-4
index.ts
app/web/page/activity/view/activity/index.ts
+3
-2
index.vue
app/web/page/activity/view/activity/index.vue
+2
-1
disableTouch.mixin.ts
app/web/page/mixins/disableTouch.mixin.ts
+15
-0
No files found.
app/controller/activity.ts
View file @
81c086f6
...
@@ -2,20 +2,24 @@ import { Controller, Context } from 'egg';
...
@@ -2,20 +2,24 @@ import { Controller, Context } from 'egg';
export
default
class
ActivityController
extends
Controller
{
export
default
class
ActivityController
extends
Controller
{
public
async
home
(
ctx
:
Context
)
{
public
async
home
(
ctx
:
Context
)
{
// const redisKey = `quantum-blocks:page:${ctx.params.id}`;
// 开发环境不走redis缓存
// let body = await ctx.service.redis.get(redisKey);
if
(
process
.
env
.
NODE_ENV
===
'
development
'
)
{
// if (body) {
// ctx.logger.info('请求redis成功 key: %j', redisKey);
// }
// if (!body) {
// let apollo = {};
// if (process.env.NODE_ENV === 'production' && process.env.EGG_SERVER_ENV === 'sit') {
// apollo = ctx.app.config.apollo || {};
// }
// body = await ctx.renderView('activity.js', { url: ctx.url, apollo });
// await ctx.service.redis.set(redisKey, body);
// }
// ctx.body = body;
ctx
.
body
=
await
ctx
.
renderView
(
'
activity.js
'
,
{
url
:
ctx
.
url
});
ctx
.
body
=
await
ctx
.
renderView
(
'
activity.js
'
,
{
url
:
ctx
.
url
});
return
;
}
const
redisKey
=
`quantum-blocks:page:
${
ctx
.
params
.
id
}
`
;
let
body
=
await
ctx
.
service
.
redis
.
get
(
redisKey
);
if
(
body
)
{
ctx
.
logger
.
info
(
'
请求redis成功 key: %j
'
,
redisKey
);
}
if
(
!
body
)
{
let
apollo
=
{};
if
(
process
.
env
.
NODE_ENV
===
'
production
'
&&
process
.
env
.
EGG_SERVER_ENV
===
'
sit
'
)
{
apollo
=
ctx
.
app
.
config
.
apollo
||
{};
}
body
=
await
ctx
.
renderView
(
'
activity.js
'
,
{
url
:
ctx
.
url
,
apollo
});
await
ctx
.
service
.
redis
.
set
(
redisKey
,
body
);
}
ctx
.
body
=
body
;
}
}
}
}
\ No newline at end of file
app/web/component/layout/activity/index.ts
View file @
81c086f6
...
@@ -23,11 +23,12 @@ if (process.env.SENTRY_ENV !== 'test' && process.env.NODE_ENV === 'production')
...
@@ -23,11 +23,12 @@ if (process.env.SENTRY_ENV !== 'test' && process.env.NODE_ENV === 'production')
if
(
EASY_ENV_IS_BROWSER
)
{
if
(
EASY_ENV_IS_BROWSER
)
{
// ! 上线后务必取掉;
// ! 上线后务必取掉;
const
vConsole
=
require
(
'
vconsole
'
);
//
const vConsole = require('vconsole');
new
vConsole
();
//
new vConsole();
}
}
if
(
EASY_ENV_IS_BROWSER
)
{
if
(
EASY_ENV_IS_BROWSER
)
{
// ios回退刷新,防止缓存
const
isSafari
=
/^.*
((
iPhone
)
|
(
iPad
)
|
(
Safari
))
+.*$/
;
const
isSafari
=
/^.*
((
iPhone
)
|
(
iPad
)
|
(
Safari
))
+.*$/
;
const
fromHost
=
getParameterByName
(
'
fromHost
'
,
window
.
location
.
href
);
const
fromHost
=
getParameterByName
(
'
fromHost
'
,
window
.
location
.
href
);
if
(
isSafari
.
test
(
navigator
.
userAgent
)
&&
fromHost
?.
indexOf
(
'
xc.bmall
'
)
===
-
1
&&
fromHost
?.
indexOf
(
'
tob
'
)
===
-
1
)
{
if
(
isSafari
.
test
(
navigator
.
userAgent
)
&&
fromHost
?.
indexOf
(
'
xc.bmall
'
)
===
-
1
&&
fromHost
?.
indexOf
(
'
tob
'
)
===
-
1
)
{
...
@@ -41,6 +42,7 @@ if (EASY_ENV_IS_BROWSER) {
...
@@ -41,6 +42,7 @@ if (EASY_ENV_IS_BROWSER) {
const
saDirective
=
new
SaDirective
();
const
saDirective
=
new
SaDirective
();
Vue
.
directive
(
'
track
'
,
saDirective
.
directive
);
Vue
.
directive
(
'
track
'
,
saDirective
.
directive
);
Vue
.
config
.
ignoredElements
=
[
'
wx-open-launch-weapp
'
,
'
wx-open-launch-app
'
];
Vue
.
config
.
ignoredElements
=
[
'
wx-open-launch-weapp
'
,
'
wx-open-launch-app
'
];
// 全局app登录态监听
window
.
xyqbNativeEvent
=
function
(
res
)
{
window
.
xyqbNativeEvent
=
function
(
res
)
{
const
json
=
typeof
res
===
'
string
'
?
JSON
.
parse
(
res
)
:
res
;
const
json
=
typeof
res
===
'
string
'
?
JSON
.
parse
(
res
)
:
res
;
console
.
log
(
'
xyqbNativeEvent toggle
'
);
console
.
log
(
'
xyqbNativeEvent toggle
'
);
...
...
app/web/page/activity/component/BackTop/index.vue
View file @
81c086f6
<
template
>
<
template
>
<div>
<div>
<cr-back-top
:show-back-top=
"showTop"
:list=
"backTopList"
@
click=
"handleBackTopClick"
ref=
"crBackTop"
/>
<cr-back-top
:show-back-top=
"showTop"
:list=
"backTopList"
@
click=
"handleBackTopClick"
ref=
"crBackTop"
@
touchend.native=
"disTouch"
/>
<cr-popover
<cr-popover
class=
"wxmp-tip"
class=
"wxmp-tip"
:value=
"showMpTip"
:value=
"showMpTip"
...
@@ -24,6 +24,8 @@ import { mapGetters } from 'vuex';
...
@@ -24,6 +24,8 @@ import { mapGetters } from 'vuex';
import
{
isApp
,
isWxMp
,
isWechat
,
isH5Normal
}
from
'
@/service/utils.service
'
;
import
{
isApp
,
isWxMp
,
isWechat
,
isH5Normal
}
from
'
@/service/utils.service
'
;
import
api
from
'
@/api/editor.api
'
;
import
api
from
'
@/api/editor.api
'
;
import
localStorage
from
'
@/service/localStorage.service
'
;
import
localStorage
from
'
@/service/localStorage.service
'
;
import
DisableTouchMixin
from
'
../../../mixins/disableTouch.mixin
'
;
import
{
navToDlApp
}
from
'
@qg/citrus-ui/src/helper/service/utils
'
;
import
LaunchWeapp
from
'
./components/LaunchWeapp.vue
'
;
import
LaunchWeapp
from
'
./components/LaunchWeapp.vue
'
;
import
LaunchApp
from
'
./components/LaunchApp.vue
'
;
import
LaunchApp
from
'
./components/LaunchApp.vue
'
;
const
SHARE_CONFIG
=
{
const
SHARE_CONFIG
=
{
...
@@ -34,6 +36,7 @@ const SHARE_CONFIG = {
...
@@ -34,6 +36,7 @@ const SHARE_CONFIG = {
};
};
export
default
{
export
default
{
name
:
'
BackTop
'
,
name
:
'
BackTop
'
,
mixins
:
[
DisableTouchMixin
],
components
:
{
components
:
{
LaunchWeapp
,
LaunchWeapp
,
LaunchApp
LaunchApp
...
@@ -69,7 +72,7 @@ export default {
...
@@ -69,7 +72,7 @@ export default {
return
[];
return
[];
},
},
appSchema
()
{
appSchema
()
{
return
`xyqb://open
http?jumpu
rl=
${
this
.
link
}
`
;
return
`xyqb://open
Http?jumpU
rl=
${
this
.
link
}
`
;
},
},
shareOpenMethod
()
{
shareOpenMethod
()
{
return
this
.
pageInfo
.
shareOpenMethod
;
return
this
.
pageInfo
.
shareOpenMethod
;
...
@@ -79,7 +82,7 @@ export default {
...
@@ -79,7 +82,7 @@ export default {
if
(
!
EASY_ENV_IS_NODE
)
{
if
(
!
EASY_ENV_IS_NODE
)
{
this
.
renderTpl
=
true
;
this
.
renderTpl
=
true
;
this
.
jsBridge
=
new
Bridge
();
this
.
jsBridge
=
new
Bridge
();
this
.
link
=
`
${
window
.
location
.
origin
}${
window
.
location
.
pathname
}
?vccToken={token}&vccChannel={registerFrom}
`
;
this
.
link
=
`
${
window
.
location
.
origin
}${
window
.
location
.
pathname
}
`
;
this
.
getMpSchema
();
this
.
getMpSchema
();
this
.
initShareInfo
();
this
.
initShareInfo
();
}
}
...
@@ -102,6 +105,9 @@ export default {
...
@@ -102,6 +105,9 @@ export default {
onShareOverlayClick
()
{
onShareOverlayClick
()
{
if
(
isH5Normal
)
{
if
(
isH5Normal
)
{
window
.
location
.
href
=
this
.
shareOpenMethod
===
1
?
this
.
mpSchema
:
this
.
appSchema
;
window
.
location
.
href
=
this
.
shareOpenMethod
===
1
?
this
.
mpSchema
:
this
.
appSchema
;
setTimeout
(()
=>
{
this
.
shareOpenMethod
===
2
&&
navToDlApp
();
},
2000
);
}
}
},
},
handleBackTopClick
(
e
)
{
handleBackTopClick
(
e
)
{
...
@@ -125,7 +131,7 @@ export default {
...
@@ -125,7 +131,7 @@ export default {
platform
:
[
"
weChat
"
,
"
timeLine
"
,
"
CopyLink
"
],
platform
:
[
"
weChat
"
,
"
timeLine
"
,
"
CopyLink
"
],
shareDic
:
{
shareDic
:
{
title
:
pageName
||
'
羊小咩
'
,
title
:
pageName
||
'
羊小咩
'
,
desc
:
pageDescribe
||
'
羊小咩
'
,
desc
:
pageDescribe
||
'
美好生活更从容
'
,
link
,
link
,
imgUrl
:
shareCoverImage
||
coverImage
// 图片地址
imgUrl
:
shareCoverImage
||
coverImage
// 图片地址
}
}
...
...
app/web/page/activity/view/activity/index.ts
View file @
81c086f6
...
@@ -7,12 +7,13 @@ import GridLayout from '../../component/VueGridLayout/GridLayout.vue';
...
@@ -7,12 +7,13 @@ import GridLayout from '../../component/VueGridLayout/GridLayout.vue';
import
GridItem
from
'
../../component/VueGridLayout/GridItem.vue
'
;
import
GridItem
from
'
../../component/VueGridLayout/GridItem.vue
'
;
import
TransformStyleMixin
from
'
@/page/mixins/transformStyle.mixin
'
;
import
TransformStyleMixin
from
'
@/page/mixins/transformStyle.mixin
'
;
import
SaMixin
from
'
@/page/mixins/sa.mixin
'
;
import
SaMixin
from
'
@/page/mixins/sa.mixin
'
;
import
{
getStyle
,
debounce
,
isApp
,
isWechat
,
isH5Normal
}
from
'
@/service/utils.service
'
;
import
DisableTouchMixin
from
'
@/page/mixins/disableTouch.mixin
'
;
import
{
getStyle
,
debounce
,
isApp
}
from
'
@/service/utils.service
'
;
import
{
EventBus
}
from
'
@qg/citrus-ui/src/helper/service/eventBus
'
;
import
{
EventBus
}
from
'
@qg/citrus-ui/src/helper/service/eventBus
'
;
import
{
setAppTitleColor
}
from
'
@/service/color.service
'
;
import
{
setAppTitleColor
}
from
'
@/service/color.service
'
;
import
localStorage
from
'
@/service/localStorage.service
'
;
import
localStorage
from
'
@/service/localStorage.service
'
;
@
Component
({
components
:
{
FreedomContainer
,
GridLayout
,
GridItem
,
PageBottomTip
,
BackTop
},
name
:
'
Activity
'
})
@
Component
({
components
:
{
FreedomContainer
,
GridLayout
,
GridItem
,
PageBottomTip
,
BackTop
},
name
:
'
Activity
'
})
export
default
class
Activity
extends
Mixins
(
TransformStyleMixin
,
SaMixin
)
{
export
default
class
Activity
extends
Mixins
(
TransformStyleMixin
,
SaMixin
,
DisableTouchMixin
)
{
@
Getter
(
'
pageData
'
)
pageData
;
@
Getter
(
'
pageData
'
)
pageData
;
@
State
(
state
=>
state
.
activity
.
pageInfo
.
pageName
)
pageName
;
@
State
(
state
=>
state
.
activity
.
pageInfo
.
pageName
)
pageName
;
@
State
(
state
=>
state
.
activity
.
pageInfo
.
appLoginState
)
appLoginState
;
@
State
(
state
=>
state
.
activity
.
pageInfo
.
appLoginState
)
appLoginState
;
...
...
app/web/page/activity/view/activity/index.vue
View file @
81c086f6
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
:i=
"item.point.i"
:i=
"item.point.i"
:key=
"item.point.i"
:key=
"item.point.i"
@
click.native=
"dot(item.title)"
@
click.native=
"dot(item.title)"
@
touchend.native=
"disTouch"
>
>
<component
:data-index=
"index"
:id=
"item.id"
:containerIndex=
"index"
:childItem=
"item"
:is=
"item.name"
:key=
"item.id"
:sa-info=
"getSaInfo(item)"
v-bind=
"item.props"
></component>
<component
:data-index=
"index"
:id=
"item.id"
:containerIndex=
"index"
:childItem=
"item"
:is=
"item.name"
:key=
"item.id"
:sa-info=
"getSaInfo(item)"
v-bind=
"item.props"
></component>
</grid-item>
</grid-item>
...
...
app/web/page/mixins/disableTouch.mixin.ts
0 → 100644
View file @
81c086f6
import
{
Component
,
Vue
}
from
'
vue-property-decorator
'
;
let
lastTouchEnd
=
0
;
@
Component
({
name
:
'
DisableTouchMixin
'
})
export
default
class
DisableTouchMixin
extends
Vue
{
disTouch
(
e
)
{
const
now
=
(
new
Date
()).
getTime
();
if
(
now
-
lastTouchEnd
<=
300
)
{
e
.
preventDefault
();
return
false
;
}
lastTouchEnd
=
now
;
}
}
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