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
db353e68
Commit
db353e68
authored
Sep 18, 2021
by
Xuguangxing
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat/group-buy' of git.quantgroup.cn:ui/group-buy-ui into feat/group-buy
parents
e6ee192d
3ac6efec
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
182 additions
and
76 deletions
+182
-76
App.vue
src/App.vue
+5
-1
groupBuy.js
src/api/groupBuy.js
+6
-3
qqqq.jpg
src/assets/images/qqqq.jpg
+0
-0
groupShare.vue
src/components/groupShare.vue
+40
-53
goodsCheck.mixin.js
src/mixins/goodsCheck.mixin.js
+59
-0
utils.service.js
src/service/utils.service.js
+17
-0
module.js
src/store/module.js
+23
-1
type.js
src/store/type.js
+2
-0
index.less
src/views/goodsList/index.less
+1
-1
index.vue
src/views/goodsList/index.vue
+29
-17
No files found.
src/App.vue
View file @
db353e68
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
<cr-loading
class=
"loading"
size=
"24px"
>
加载中...
</cr-loading>
<cr-loading
class=
"loading"
size=
"24px"
>
加载中...
</cr-loading>
</div>
</div>
<net-error
/>
<net-error
/>
<goods-share
ref=
"gdShare"
/>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
...
@@ -17,11 +18,14 @@ import NetError from '@/components/NetError';
...
@@ -17,11 +18,14 @@ import NetError from '@/components/NetError';
import
{
isApp
,
isWxMp
,
isWechat
}
from
'
@/service/validation.service
'
;
import
{
isApp
,
isWxMp
,
isWechat
}
from
'
@/service/validation.service
'
;
import
store
from
'
@/store
'
;
import
store
from
'
@/store
'
;
import
Weapp
from
'
@/components/weapp
'
;
import
Weapp
from
'
@/components/weapp
'
;
import
goodsShare
from
'
@/components/groupShare
'
;
export
default
{
export
default
{
name
:
'
App
'
,
name
:
'
App
'
,
components
:
{
components
:
{
NetError
,
NetError
,
Weapp
Weapp
,
goodsShare
},
},
data
()
{
data
()
{
return
{};
return
{};
...
...
src/api/groupBuy.js
View file @
db353e68
...
@@ -22,16 +22,19 @@ export default {
...
@@ -22,16 +22,19 @@ export default {
getTemplateList
(
activityId
)
{
getTemplateList
(
activityId
)
{
return
http
.
get
(
return
http
.
get
(
`http://yapi.quantgroups.com/mock/351/api/kdsp/activity/activity-goods-special/template-list`
,
`http://yapi.quantgroups.com/mock/351/api/kdsp/activity/activity-goods-special/template-list`
,
{
params
:
{
activityId
}
}
{
// return http.get(`${talosHost}/api/kdsp/activity/activity-goods-special/template-list`, {
params
:
{
activityId
}
}
);
);
},
},
// 入口活动列表
// 入口活动列表
getGoodsList
(
params
)
{
getGoodsList
(
params
)
{
return
http
.
get
(
return
http
.
get
(
`http://yapi.quantgroups.com/mock/351/api/kdsp/activity/activity-goods-special/goods-list`
,
`http://yapi.quantgroups.com/mock/351/api/kdsp/activity/activity-goods-special/goods-list`
,
{
params
},
{
{
hideLoading
:
true
// return http.get(`${talosHost}/api/kdsp/activity/activity-goods-special/goods-list`, {
params
}
}
);
);
},
},
...
...
src/assets/images/qqqq.jpg
0 → 100644
View file @
db353e68
209 KB
src/components/groupShare.vue
View file @
db353e68
...
@@ -9,17 +9,17 @@
...
@@ -9,17 +9,17 @@
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
{
isWxMp
,
isApp
}
from
'
@/service/validation.service
'
;
import
Bridge
from
'
@qg/js-bridge
'
;
import
MpBridge
from
'
@/service/mp
'
;
import
MpBridge
from
'
@/service/mp
'
;
import
{
mapState
}
from
'
vuex
'
;
export
default
{
export
default
{
name
:
'
GroupShare
'
,
name
:
'
GroupShare
'
,
components
:
{},
components
:
{},
props
:
{},
props
:
{},
data
()
{
data
()
{
return
{
return
{
showFlag
:
false
,
shareOptions
:
null
,
nativeBridge
:
null
,
nativeBridge
:
null
,
showShare
:
false
,
types
:
[
types
:
[
{
value
:
'
weixin
'
,
disabled
:
false
},
{
value
:
'
weixin
'
,
disabled
:
false
},
{
value
:
'
pic
'
,
disabled
:
false
}
{
value
:
'
pic
'
,
disabled
:
false
}
...
@@ -27,66 +27,53 @@ export default {
...
@@ -27,66 +27,53 @@ export default {
};
};
},
},
computed
:
{
computed
:
{
notBwoser
()
{
...
mapState
({
return
!
isWxMp
&&
!
isApp
;
shareInfo
:
state
=>
state
.
pay
.
shareInfo
}),
showShare
:
{
get
()
{
return
this
.
$store
.
state
.
pay
.
showShare
;
},
set
()
{
this
.
$store
.
dispatch
(
'
goods_share_close
'
);
}
}
}
},
},
watch
:
{},
watch
:
{},
created
()
{
created
()
{
if
(
isApp
)
this
.
nativeBridge
=
new
Bridge
();
// 如果是小程序直接调用postMessage像小程序派发事件监听
else
if
(
isWxMp
)
this
.
nativeBridge
=
new
MpBridge
();
this
.
nativeBridge
=
new
MpBridge
();
},
},
methods
:
{
methods
:
{
async
open
()
{
shareCloseChange
()
{},
try
{
let
options
=
await
this
.
getShareData
();
// 判断是否时小程序平台
if
(
!
isWxMp
)
{
this
.
showShare
=
true
;
}
// 判断是否是App
if
(
!
isApp
)
{
this
.
shareAppChange
(
options
);
}
}
catch
(
err
)
{
console
.
log
(
err
);
this
.
$toast
(
'
调用分享失败!
'
);
}
},
async
getShareData
()
{
return
Promise
.
resolve
({
title
:
'
随便砍砍就能拿,价格你来定
'
,
desc
:
'
我正在免费拿商品,请你帮帮我
'
,
link
:
`
${
window
.
location
.
origin
}
/activity/zeroBuy`
,
// 页面地址
imgUrl
:
'
https://appsync.lkbang.net/shareIcon.png
'
// 图片地
});
// await
},
shareCloseChange
()
{
this
.
$emit
(
'
hideShare
'
,
false
);
},
bundleShareClickItem
(
ev
)
{
bundleShareClickItem
(
ev
)
{
console
.
log
(
ev
);
if
(
ev
===
'
pic
'
)
{
console
.
log
(
this
.
nativeBridge
);
this
.
nativeBridge
.
openNewUrl
({
},
newUrl
:
`/pages/goodshare/index?ev=
${
ev
}
`
shareAppChange
({
title
,
desc
,
link
,
imgUrl
})
{
});
const
data
=
{
}
event
:
'
showShareView
'
,
if
(
ev
===
'
weixin
'
)
{
data
:
{
this
.
nativeBridge
.
run
({
platform
:
[
'
weChat
'
,
'
timeLine
'
,
'
QQ
'
,
'
QQZone
'
,
'
CopyLink
'
],
//依次分别是微信、朋友圈、QQ好友、QQ空间、复制链接
event
:
'
showShareView
'
,
shareDic
:
{
data
:
{
title
,
shareDic
:
this
.
shareInfo
desc
,
link
,
// 页面地址
imgUrl
// 图片地址
}
}
});
this
.
shareDialogConfirm
();
}
},
shareDialogConfirm
()
{
this
.
$dialog
({
message
:
'
请在微信小程序中参与此活动哦~
'
,
showCancelButton
:
false
,
confirmButtonText
:
'
我知道了哦~
'
,
onConfirm
:
()
=>
{
// todo 跳转到小程序
this
.
$toast
(
'
确定
'
);
}
}
};
});
this
.
nativeBridge
.
showShareView
(
data
);
}
}
// shareAppChange() {}
}
}
};
};
</
script
>
</
script
>
...
...
src/mixins/goodsCheck.mixin.js
0 → 100644
View file @
db353e68
import
Bridge
from
'
@qg/js-bridge
'
;
import
MpBridge
from
'
@/service/mp
'
;
import
{
isWxMp
,
isApp
}
from
'
@/service/validation.service
'
;
import
localStorage
from
'
@/service/localStorage.service
'
;
export
default
{
data
()
{
return
{
nativeBridge
:
null
};
},
methods
:
{
getToken
()
{
const
that
=
this
;
window
.
xyqbNativeEvent
=
function
(
res
)
{
const
json
=
typeof
res
===
'
string
'
?
JSON
.
parse
(
res
)
:
res
;
if
(
json
.
event
===
'
getTokenSuccess
'
)
{
const
appData
=
json
.
data
||
{};
if
(
appData
&&
appData
.
token
)
{
localStorage
.
get
(
'
vccToken
'
,
appData
.
token
);
that
.
$nextTick
(()
=>
{
window
.
location
.
reload
();
});
}
}
};
this
.
nativeBridge
.
getToken
();
},
checkLogin
()
{
const
vccToken
=
localStorage
.
get
(
'
vccToken
'
);
const
needLogin
=
vccToken
?
false
:
true
;
if
(
needLogin
)
{
if
(
isApp
)
this
.
nativeBridge
=
new
Bridge
();
else
if
(
isWxMp
)
this
.
nativeBridge
=
new
MpBridge
();
this
.
$dialog
({
message
:
'
参与拼团活动需要您先进行登录哦~
'
,
title
:
''
,
showCancelButton
:
false
,
confirmButtonText
:
'
登录
'
,
onConfirm
:
()
=>
{
if
(
isWxMp
)
{
this
.
nativeBridge
.
getToken
();
}
else
if
(
isApp
)
{
// native调用getToken
this
.
getToken
();
}
else
{
this
.
$dialog
({
message
:
'
请在App或小程序中参与活动~
'
,
title
:
''
,
showCancelButton
:
false
,
confirmButtonText
:
'
我知道了
'
});
}
}
});
}
return
needLogin
;
}
}
};
src/service/utils.service.js
View file @
db353e68
import
{
isAndroid
,
isIOS
}
from
'
./validation.service
'
;
import
{
isAndroid
,
isIOS
}
from
'
./validation.service
'
;
import
Bridge
from
'
@qg/js-bridge
'
;
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
export
const
EventBus
=
new
Vue
();
export
const
EventBus
=
new
Vue
();
...
@@ -335,3 +336,19 @@ export function getQueryString(name) {
...
@@ -335,3 +336,19 @@ export function getQueryString(name) {
if
(
r
!=
null
)
return
unescape
(
r
[
2
]);
if
(
r
!=
null
)
return
unescape
(
r
[
2
]);
return
null
;
return
null
;
}
}
export
function
appShareEventChange
({
title
,
desc
,
link
,
imgUrl
})
{
const
data
=
{
event
:
'
showShareView
'
,
data
:
{
platform
:
[
'
weChat
'
,
'
timeLine
'
,
'
QQ
'
,
'
QQZone
'
,
'
CopyLink
'
],
//依次分别是微信、朋友圈、QQ好友、QQ空间、复制链接
shareDic
:
{
title
,
desc
,
link
,
// 页面地址
imgUrl
// 图片地址
}
}
};
Bridge
.
showShareView
(
data
);
}
src/store/module.js
View file @
db353e68
import
*
as
types
from
'
./type
'
;
import
*
as
types
from
'
./type
'
;
import
groupBuy
from
'
@/api/groupBuy
'
;
import
groupBuy
from
'
@/api/groupBuy
'
;
import
{
isWxMp
,
isApp
}
from
'
@/service/validation.service
'
;
import
{
appShareEventChange
}
from
'
@/service/utils.service
'
;
const
state
=
{
const
state
=
{
header
:
true
,
header
:
true
,
title
:
'
支付中心
'
,
title
:
'
支付中心
'
,
...
@@ -7,7 +9,9 @@ const state = {
...
@@ -7,7 +9,9 @@ const state = {
meta
:
{},
meta
:
{},
keepAliveMap
:
[],
keepAliveMap
:
[],
isPrimordialBrowser
:
false
,
// 是否是原生浏览器
isPrimordialBrowser
:
false
,
// 是否是原生浏览器
isWeixinBrowser
:
false
// 是否是微信浏览器
isWeixinBrowser
:
false
,
// 是否是微信浏览器
showShare
:
false
,
// 是否打开底部分享showShare
shareInfo
:
{}
// 分享信息
};
};
// getters
// getters
...
@@ -35,6 +39,12 @@ const actions = {
...
@@ -35,6 +39,12 @@ const actions = {
},
},
change_is_weixin_browser
({
commit
},
bool
)
{
change_is_weixin_browser
({
commit
},
bool
)
{
commit
(
types
.
CHANGE_IS_WEIXIN_BROWSER
,
bool
);
commit
(
types
.
CHANGE_IS_WEIXIN_BROWSER
,
bool
);
},
goods_share_open
({
commit
},
options
)
{
commit
(
types
.
GOODS_SHARE_OPEN
,
options
);
},
goods_share_close
({
commit
})
{
commit
(
types
.
GOODS_SHARE_CLOSE
);
}
}
};
};
...
@@ -99,6 +109,18 @@ const mutations = {
...
@@ -99,6 +109,18 @@ const mutations = {
}
}
});
});
}
}
},
[
types
.
GOODS_SHARE_OPEN
](
state
,
options
)
{
if
(
isWxMp
)
{
state
.
shareInfo
=
options
;
state
.
showShare
=
true
;
}
if
(
isApp
)
{
appShareEventChange
(
options
);
}
},
[
types
.
GOODS_SHARE_CLOSE
](
state
)
{
state
.
showShare
=
false
;
}
}
};
};
...
...
src/store/type.js
View file @
db353e68
...
@@ -7,3 +7,5 @@ export const CHANGE_IS_WEIXIN_BROWSER = 'CHANGE_IS_WEIXIN_BROWSER';
...
@@ -7,3 +7,5 @@ export const CHANGE_IS_WEIXIN_BROWSER = 'CHANGE_IS_WEIXIN_BROWSER';
export
const
ADD_KEEP_ALIVE
=
'
ADD_KEEP_ALIVE
'
;
export
const
ADD_KEEP_ALIVE
=
'
ADD_KEEP_ALIVE
'
;
export
const
DEL_KEEP_ALIVE
=
'
DEL_KEEP_ALIVE
'
;
export
const
DEL_KEEP_ALIVE
=
'
DEL_KEEP_ALIVE
'
;
export
const
CLEAR_KEEP_ALIVE
=
'
CLEAR_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
'
;
src/views/goodsList/index.less
View file @
db353e68
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
font-size: @font-size-14;
font-size: @font-size-14;
position: relative;
position: relative;
&-top {
&-top {
height: 3
80
px;
height: 3
75
px;
}
}
&-puzzle {
&-puzzle {
position: absolute;
position: absolute;
...
...
src/views/goodsList/index.vue
View file @
db353e68
<
template
>
<
template
>
<!-- 配置活动背景色 -->
<!-- 配置活动背景色 -->
<div
class=
"group"
:style=
"
{ backgroundColor: topicCfg.bgcolor }">
<div
class=
"group"
:style=
"
{ backgroundColor: topicCfg.bgcolor }">
<div
v-if=
"!isShowShare"
class=
"group-puzzle"
@
click=
"
openShareEvent
"
>
我的拼团
</div>
<div
v-if=
"!isShowShare"
class=
"group-puzzle"
@
click=
"
goToMyorder
"
>
我的拼团
</div>
<!-- 配置头部动态信息 start -->
<!-- 配置头部动态信息 start -->
<div
class=
"group-top"
>
<div
class=
"group-top"
>
<!-- 动态活动背景图 -->
<!-- 动态活动背景图 -->
...
@@ -59,14 +59,11 @@
...
@@ -59,14 +59,11 @@
</dt>
</dt>
<dd
class=
"group-share-text"
>
分享
</dd>
<dd
class=
"group-share-text"
>
分享
</dd>
</dl>
</dl>
<goods-share
ref=
"gdShare"
/>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
{
mapState
}
from
'
vuex
'
;
import
store
from
'
@/store
'
;
import
store
from
'
@/store
'
;
import
groupBuyApi
from
'
@/api/groupBuy
'
;
import
groupBuyApi
from
'
@/api/groupBuy
'
;
import
goodsShare
from
'
@/components/groupShare
'
;
import
countDown
from
'
@/components/countDown
'
;
import
countDown
from
'
@/components/countDown
'
;
import
swipeCustomerInfo
from
'
@/components/swipeCustomerInfo
'
;
import
swipeCustomerInfo
from
'
@/components/swipeCustomerInfo
'
;
import
gpImagePath
from
'
@/assets/images/groupBuy/bg-top.png
'
;
import
gpImagePath
from
'
@/assets/images/groupBuy/bg-top.png
'
;
...
@@ -75,14 +72,13 @@ import groupSwiper from '@/components/groupSwiper';
...
@@ -75,14 +72,13 @@ import groupSwiper from '@/components/groupSwiper';
import
{
isNull
}
from
'
@/service/validation.service
'
;
import
{
isNull
}
from
'
@/service/validation.service
'
;
import
{
handleRemainTime
,
handleDateFormat
}
from
'
./components/utils
'
;
import
{
handleRemainTime
,
handleDateFormat
}
from
'
./components/utils
'
;
import
localStorage
from
'
@/service/localStorage.service
'
;
import
localStorage
from
'
@/service/localStorage.service
'
;
import
goodsCheckMixin
from
'
@/mixins/goodsCheck.mixin
'
;
let
topicIndex
;
let
topicIndex
;
export
default
{
export
default
{
// beforeRouteEnter(to, from, next) {
// next(vm => {});
// },
// eslint-disable-next-line vue/name-property-casing
// eslint-disable-next-line vue/name-property-casing
name
:
'
groupBuyList
'
,
name
:
'
groupBuyList
'
,
components
:
{
countDown
,
swipeCustomerInfo
,
goodsCard
,
groupSwiper
,
goodsShare
},
components
:
{
countDown
,
swipeCustomerInfo
,
goodsCard
,
groupSwiper
},
mixins
:
[
goodsCheckMixin
],
data
()
{
data
()
{
return
{
return
{
showShare
:
false
,
showShare
:
false
,
...
@@ -125,12 +121,8 @@ export default {
...
@@ -125,12 +121,8 @@ export default {
};
};
},
},
computed
:
{
computed
:
{
...
mapState
({
isPrimordialBrowser
:
state
=>
state
.
pay
.
isPrimordialBrowser
,
isWeixinBrowser
:
state
=>
state
.
pay
.
isWeixinBrowser
}),
isShowShare
()
{
isShowShare
()
{
return
this
.
isPrimordialBrowser
||
this
.
isWeixin
Browser
;
return
this
.
$store
.
state
.
pay
.
isPrimordial
Browser
;
},
},
// 更具goodsSpecialId 获取查询活动模板列表-对应数据项
// 更具goodsSpecialId 获取查询活动模板列表-对应数据项
...
@@ -146,8 +138,9 @@ export default {
...
@@ -146,8 +138,9 @@ export default {
}
}
},
},
created
()
{
created
()
{
console
.
log
(
this
.
isShowShare
);
// console.log(this.isShowShare);
this
.
hasLogin
=
!!
localStorage
.
get
(
'
vccToken
'
);
// console.log(this.activityId);
// this.hasLogin = !!localStorage.get('vccToken');
},
},
mounted
()
{
mounted
()
{
// todo 曝光埋点
// todo 曝光埋点
...
@@ -177,8 +170,26 @@ export default {
...
@@ -177,8 +170,26 @@ export default {
}
}
},
},
methods
:
{
methods
:
{
openShareEvent
()
{
async
goToMyorder
()
{
this
.
$refs
.
gdShare
.
open
();
const
isLogin
=
this
.
checkLogin
();
console
.
log
(
isLogin
);
// const isLogin = await this.checkLogin();
// console.log(isLogin);
// if (isApp) this.nativeBridge = new Bridge();
// else if (isWxMp) this.nativeBridge = new MpBridge();
},
async
openShareEvent
()
{
let
options
=
await
this
.
getShareData
();
this
.
$store
.
dispatch
(
'
goods_share_open
'
,
options
);
},
async
getShareData
()
{
return
Promise
.
resolve
({
title
:
'
随便砍砍就能拿,价格你来定
'
,
desc
:
'
我正在免费拿商品,请你帮帮我
'
,
link
:
`
${
window
.
location
.
origin
}
/activity/zeroBuy`
,
// 页面地址
imgUrl
:
'
https://appsync.lkbang.net/shareIcon.png
'
// 图片地
});
// await
},
},
avatorTimeSyncChange
()
{
avatorTimeSyncChange
()
{
setInterval
(()
=>
{
setInterval
(()
=>
{
...
@@ -284,6 +295,7 @@ async function getActivityList(urlQuery, next) {
...
@@ -284,6 +295,7 @@ async function getActivityList(urlQuery, next) {
vm
.
activityId
=
activityId
;
vm
.
activityId
=
activityId
;
vm
.
topicList
=
list
;
vm
.
topicList
=
list
;
vm
.
topicIndex
=
activityIndex
;
vm
.
topicIndex
=
activityIndex
;
localStorage
.
set
(
'
activityId
'
,
activityId
);
// const { hasStop } = vm.topicCfg;
// const { hasStop } = vm.topicCfg;
// if (hasStop || !list.length) {
// if (hasStop || !list.length) {
// vm.showOverTip = true;
// vm.showOverTip = true;
...
...
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