Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
group-buy-ui
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
group-buy-ui
Commits
0862a107
Commit
0862a107
authored
Sep 24, 2021
by
beisir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:更改 分享通信方式
parent
a95d9fd0
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
103 additions
and
91 deletions
+103
-91
groupShare.vue
src/components/groupShare.vue
+1
-5
groupBuy.js
src/router/groupBuy.js
+1
-1
module.js
src/store/module.js
+8
-1
type.js
src/store/type.js
+1
-0
index.vue
src/views/goodsList/index.vue
+58
-58
index.vue
src/views/orderList/index.vue
+34
-26
No files found.
src/components/groupShare.vue
View file @
0862a107
...
...
@@ -12,7 +12,6 @@
import
MpBridge
from
'
@/service/mp
'
;
import
{
mapState
}
from
'
vuex
'
;
import
{
registeredEvents
}
from
'
@/service/sa.service
'
;
import
{
EventBus
}
from
'
@/service/utils.service
'
;
export
default
{
name
:
'
GroupShare
'
,
components
:
{},
...
...
@@ -53,10 +52,7 @@ export default {
this
.
shareDialogConfirm
();
}
const
nativeBridge
=
this
.
nativeBridge
;
const
name
=
this
.
$route
.
name
;
console
.
log
(
`shareClickItem
${
name
}
`
);
console
.
log
(
name
);
EventBus
.
$emit
(
`shareClickItem
${
name
}
`
,
{
ev
,
nativeBridge
});
this
.
$store
.
dispatch
(
'
goods_send_shareinfo
'
,
{
ev
,
nativeBridge
});
registeredEvents
(
'
H5_GroupZeroYuanPurchaseActivityPageSharePopupWindowBtnClick
'
,
{
sku_no
:
''
,
buttons_name
:
''
,
// 按钮名称
...
...
src/router/groupBuy.js
View file @
0862a107
...
...
@@ -15,7 +15,7 @@ module.exports = [
path
:
'
/groupBuy/list
'
,
name
:
'
groupBuyList
'
,
component
:
()
=>
import
(
'
../views/goodsList/index.vue
'
),
meta
:
{
title
:
'
0元购大牌
'
}
meta
:
{
title
:
'
0元购大牌
'
,
keepLive
:
true
}
},
{
path
:
'
/orderList/:status
'
,
...
...
src/store/module.js
View file @
0862a107
...
...
@@ -11,7 +11,8 @@ const state = {
isPrimordialBrowser
:
false
,
// 是否是原生浏览器
isWeixinBrowser
:
false
,
// 是否是微信浏览器
showShare
:
false
,
// 是否打开底部分享showShare
shareInfo
:
{}
// 分享信息
shareInfo
:
{},
// 分享信息
goodsShareInfo
:
null
};
// getters
...
...
@@ -45,6 +46,9 @@ const actions = {
},
goods_share_close
({
commit
})
{
commit
(
types
.
GOODS_SHARE_CLOSE
);
},
goods_send_shareinfo
({
commit
},
options
)
{
commit
(
types
.
GOODS_SEND_SHAREINFO
,
options
);
}
};
...
...
@@ -121,6 +125,9 @@ const mutations = {
},
[
types
.
GOODS_SHARE_CLOSE
](
state
)
{
state
.
showShare
=
false
;
},
[
types
.
GOODS_SEND_SHAREINFO
](
state
,
options
)
{
state
.
goodsShareInfo
=
options
;
}
};
...
...
src/store/type.js
View file @
0862a107
...
...
@@ -9,3 +9,4 @@ export const DEL_KEEP_ALIVE = 'DEL_KEEP_ALIVE';
export
const
CLEAR_KEEP_ALIVE
=
'
CLEAR_KEEP_ALIVE
'
;
export
const
GOODS_SHARE_OPEN
=
'
GOODS_SHARE_OPEN
'
;
export
const
GOODS_SHARE_CLOSE
=
'
GOODS_SHARE_CLOSE
'
;
export
const
GOODS_SEND_SHAREINFO
=
'
GOODS_SEND_SHAREINFO
'
;
src/views/goodsList/index.vue
View file @
0862a107
...
...
@@ -82,10 +82,12 @@ import groupSwiper from '@/components/groupSwiper';
import
{
handleRemainTime
,
handleDateFormat
}
from
'
./components/utils
'
;
import
localStorage
from
'
@/service/localStorage.service
'
;
import
goodsCheckMixin
from
'
@/mixins/goodsCheck.mixin
'
;
import
{
setAppTitleColor
,
EventBus
}
from
'
@/service/utils.service
'
;
import
{
setAppTitleColor
}
from
'
@/service/utils.service
'
;
import
{
registeredEvents
}
from
'
@/service/sa.service
'
;
import
{
isNull
}
from
'
@/service/validation.service
'
;
import
config
from
'
@/config
'
;
console
.
log
(
config
.
localHost
);
let
topicIndex
;
export
default
{
// eslint-disable-next-line vue/name-property-casing
name
:
'
groupBuyList
'
,
...
...
@@ -115,6 +117,9 @@ export default {
isShowShare
()
{
return
this
.
$store
.
state
.
pay
.
isPrimordialBrowser
;
},
goodsShareInfo
()
{
return
this
.
$store
.
state
.
pay
.
goodsShareInfo
;
},
isShowSwiper
()
{
const
{
hasStart
,
hasStop
}
=
this
.
goodsTemp
;
return
(
!
hasStart
&&
!
hasStop
)
||
(
hasStart
&&
hasStop
);
...
...
@@ -128,21 +133,19 @@ export default {
return
+
new
Date
(
endTime
||
0
);
}
},
watch
:
{
goodsShareInfo
:
{
immediate
:
false
,
handler
(
val
)
{
this
.
onShareEventChange
(
val
);
}
}
},
created
()
{
this
.
reload
=
true
;
// console.log(this.isShowShare);
// console.log(this.activityId);
// this.hasLogin = !!localStorage.get('vccToken');
},
mounted
()
{
this
.
showLoops
=
true
;
this
.
$nextTick
(()
=>
{
this
.
$refs
.
swipeRota
&&
this
.
$refs
.
swipeRota
.
onSlidePrevChange
();
});
this
.
showLoading
=
true
;
this
.
onShareEventChange
();
console
.
log
(
'
开启EventBus
'
);
},
beforeRouteEnter
(
to
,
from
,
next
)
{
const
{
activityId
}
=
to
.
query
;
...
...
@@ -153,30 +156,25 @@ export default {
});
return
;
}
else
{
getActivityList
(
to
.
query
,
next
);
if
(
isNull
(
topicIndex
))
{
getActivityList
(
to
.
query
,
next
);
}
else
{
next
();
}
}
},
beforeDestroy
()
{
console
.
log
(
'
关闭EventBus
'
);
const
name
=
this
.
$route
.
name
;
EventBus
.
$off
(
`shareClickItem
${
name
}
`
);
// beforeDestroy() {
// },
deactivated
()
{
clearTimeout
((
this
.
$refs
.
swipeRota
&&
this
.
$refs
.
swipeRota
.
timer
)
||
null
);
this
.
showLoops
=
false
;
},
// deactivated() {
// clearTimeout((this.$refs.swipeRota && this.$refs.swipeRota.timer) || null);
// this.showLoops = false;
// },
// activated() {
// this.showLoops = true;
// this.$nextTick(() => {
// this.$refs.swipeRota && this.$refs.swipeRota.onSlidePrevChange();
// });
// console.log('开启EventBus');
// // this.setTitleColor(this.goodsTemp.bgcolor);
// // store.commit('changeTitle', this.goodsTemp.title || '活动页');
// },
activated
()
{
this
.
showLoops
=
true
;
this
.
$nextTick
(()
=>
{
this
.
$refs
.
swipeRota
&&
this
.
$refs
.
swipeRota
.
onSlidePrevChange
();
});
},
methods
:
{
animationEventStart
()
{
this
.
showSwipe
=
false
;
...
...
@@ -202,40 +200,41 @@ export default {
activity_id
});
},
onShareEventChange
(
)
{
async
onShareEventChange
({
ev
,
nativeBridge
}
)
{
const
vm
=
this
;
const
name
=
this
.
$route
.
name
;
EventBus
.
$on
(
`shareClickItem
${
name
}
`
,
async
function
({
ev
,
nativeBridge
})
{
let
shareDic
=
await
vm
.
getShareData
();
if
(
ev
===
'
pic
'
)
{
// 分享海报跳转小程序海报分享页面
nativeBridge
.
openNewUrl
({
newUrl
:
`/pages/goodshare/index?url=
${
encodeURIComponent
(
JSON
.
stringify
(
shareDic
.
posterUrl
)
)}
`
});
}
if
(
ev
===
'
weixin
'
)
{
console
.
log
(
shareDic
);
// 分享朋友派发微信postMessage事件
nativeBridge
.
run
({
event
:
'
showShareView
'
,
data
:
{
shareDic
}
});
}
});
let
shareDic
=
await
vm
.
getShareData
();
if
(
ev
===
'
pic
'
)
{
nativeBridge
.
openNewUrl
({
newUrl
:
`/pages/goodshare/index?url=
${
encodeURIComponent
(
JSON
.
stringify
(
shareDic
.
posterUrl
)
)}
`
});
}
if
(
ev
===
'
weixin
'
)
{
// 分享朋友派发微信postMessage事件
nativeBridge
.
run
({
event
:
'
showShareView
'
,
data
:
{
shareDic
}
});
}
},
async
getShareData
()
{
const
{
sharePosterTemplateUrl
,
shareTitle
,
shareSubTitle
,
shareIconUrl
}
=
this
.
goodsTemp
;
const
{
sharePosterTemplateUrl
,
shareTitle
,
shareSubTitle
,
shareIconUrl
,
img
}
=
this
.
goodsTemp
;
const
link
=
`
${
config
.
localHost
}
/groupBuy/list?activityId=
${
this
.
activityId
}
`
;
return
Promise
.
resolve
({
title
:
shareTitle
,
desc
:
shareSubTitle
,
link
:
`pages/webview/webview?url=
${
encodeURIComponent
(
JSON
.
stringify
(
link
))}
`
,
// 页面地址
imgUrl
:
shareIconUrl
,
// 图片地
imgUrl
:
shareIconUrl
||
img
,
// 图片地
posterUrl
:
sharePosterTemplateUrl
});
},
...
...
@@ -261,7 +260,7 @@ export default {
}
},
async
getGoodsList
()
{
async
getGoodsList
(
cover
)
{
const
{
pageSize
,
pageNo
,
activityId
}
=
this
;
const
{
goodsSpecialIds
,
templateDetailIds
}
=
this
.
goodsTemp
;
this
.
loading
=
true
;
...
...
@@ -277,7 +276,7 @@ export default {
if
(
res
.
size
)
{
this
.
loading
=
false
;
this
.
showLoading
=
false
;
this
.
goodsList
=
res
.
items
||
[];
this
.
goodsList
=
cover
?
res
.
items
:
[...
this
.
goodsList
,
...
res
.
items
]
||
[];
if
(
!
res
.
hasNext
)
{
this
.
finished
=
true
;
}
else
{
...
...
@@ -327,10 +326,11 @@ async function getActivityList(urlQuery, next) {
t
.
groupBuyUserInfoList
=
t
.
groupBuyUserInfoList
.
reverse
();
store
.
commit
(
'
CHANGE_TITLE
'
,
t
.
title
||
'
活动页
'
);
nextFns
(
vm
=>
{
topicIndex
=
0
;
vm
.
activityId
=
activityId
;
vm
.
goodsTemp
=
t
;
localStorage
.
set
(
'
activityId
'
,
activityId
);
vm
.
getGoodsList
();
vm
.
getGoodsList
(
true
);
vm
.
reload
=
false
;
});
}
else
{
...
...
src/views/orderList/index.vue
View file @
0862a107
...
...
@@ -82,10 +82,23 @@ export default {
orderStatusInfo
:
{}
};
},
computed
:
{
goodsShareInfo
()
{
return
this
.
$store
.
state
.
pay
.
goodsShareInfo
;
}
},
watch
:
{
goodsShareInfo
:
{
immediate
:
false
,
handler
(
val
)
{
this
.
onShareEventChange
(
val
);
}
}
},
mounted
()
{
this
.
getstatusQuery
();
this
.
getList
();
this
.
onShareEventChange
();
//
this.onShareEventChange();
},
beforeDestroy
()
{
console
.
log
(
'
订单页EventBusClose
'
);
...
...
@@ -118,28 +131,24 @@ export default {
imgUrl
:
shareInfo
.
skuImg
// 图片地
});
},
onShareEventChange
(
)
{
async
onShareEventChange
({
ev
,
nativeBridge
}
)
{
const
vm
=
this
;
const
name
=
this
.
$route
.
name
;
console
.
log
(
`shareClickItem
${
name
}
`
);
EventBus
.
$on
(
`shareClickItem
${
name
}
`
,
async
function
({
ev
,
nativeBridge
})
{
console
.
log
(
'
订单页EventBusOpen
'
);
const
shareDic
=
await
vm
.
getShareData
(
vm
.
sharePicData
);
console
.
log
(
shareDic
);
if
(
ev
===
'
pic
'
)
{
vm
.
$refs
.
sharePic
.
createAndUploadPic
();
// 分享海报跳转小程序海报分享页面
}
if
(
ev
===
'
weixin
'
)
{
// 分享朋友派发微信postMessage事件
nativeBridge
.
run
({
event
:
'
showShareView
'
,
data
:
{
shareDic
}
});
}
});
console
.
log
(
'
订单页EventBusOpen
'
);
const
shareDic
=
await
vm
.
getShareData
(
vm
.
sharePicData
);
console
.
log
(
shareDic
);
if
(
ev
===
'
pic
'
)
{
// 分享海报跳转小程序海报分享页面
vm
.
$refs
.
sharePic
.
createAndUploadPic
();
}
if
(
ev
===
'
weixin
'
)
{
// 分享朋友派发微信postMessage事件
nativeBridge
.
run
({
event
:
'
showShareView
'
,
data
:
{
shareDic
}
});
}
},
getstatusQuery
()
{
const
{
status
}
=
this
.
$route
.
params
||
{};
...
...
@@ -153,9 +162,9 @@ export default {
handleLoad
()
{
this
.
getList
();
},
async
openShareEvent
()
{
async
openShareEvent
(
info
)
{
try
{
const
[
res
]
=
await
groupBuyApi
.
getGroupShareInfo
(
'
1440884214932389888
'
);
const
[
res
]
=
await
groupBuyApi
.
getGroupShareInfo
(
info
.
orderNo
);
console
.
log
(
res
);
this
.
sharePicData
=
res
;
this
.
$store
.
dispatch
(
'
goods_share_open
'
);
...
...
@@ -164,11 +173,10 @@ export default {
}
},
handleOptionClick
(
info
)
{
console
.
log
(
info
);
this
.
currentOrder
=
info
;
switch
(
info
.
eventType
)
{
case
'
share
'
:
this
.
openShareEvent
();
this
.
openShareEvent
(
info
);
break
;
default
:
this
.
currentOrder
=
{};
...
...
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