Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
7
7-Eleven
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
高淑倩
7-Eleven
Commits
9a5770b3
Commit
9a5770b3
authored
Aug 28, 2019
by
赵雅纹
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分享
parent
f52d1736
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
145 additions
and
20 deletions
+145
-20
app.js
src/app.js
+2
-0
waterFlowLayout.js
src/component/waterFlowLayout/waterFlowLayout.js
+4
-1
waterFlowLayout.wxml
src/component/waterFlowLayout/waterFlowLayout.wxml
+1
-1
myShare.js
src/pages/myShare/myShare.js
+58
-9
project.config.json
src/project.config.json
+2
-2
myReleaseDetail.js
src/subPackage/page/pages/myReleaseDetail/myReleaseDetail.js
+5
-0
Http.js
src/utils/Http.js
+17
-6
wxService.js
src/utils/wxService.js
+56
-1
No files found.
src/app.js
View file @
9a5770b3
...
@@ -72,6 +72,8 @@ App({
...
@@ -72,6 +72,8 @@ App({
// }
// }
// })
// })
},
},
onHide
:
function
()
{
onHide
:
function
()
{
this
.
globalData
.
loginFirst
=
false
this
.
globalData
.
loginFirst
=
false
...
...
src/component/waterFlowLayout/waterFlowLayout.js
View file @
9a5770b3
...
@@ -41,7 +41,10 @@ Component({
...
@@ -41,7 +41,10 @@ Component({
console
.
log
(
e
)
console
.
log
(
e
)
let
params
=
{
let
params
=
{
url
:
e
.
currentTarget
.
dataset
.
url
,
url
:
e
.
currentTarget
.
dataset
.
url
,
title
:
e
.
currentTarget
.
dataset
.
title
title
:
e
.
currentTarget
.
dataset
.
title
,
headline
:
e
.
currentTarget
.
dataset
.
headline
,
describe
:
e
.
currentTarget
.
dataset
.
describe
,
id
:
e
.
currentTarget
.
dataset
.
id
}
}
wxService
.
nextTick
(()
=>
{
wxService
.
nextTick
(()
=>
{
this
.
triggerEvent
(
'_onTapShare'
,
params
)
this
.
triggerEvent
(
'_onTapShare'
,
params
)
...
...
src/component/waterFlowLayout/waterFlowLayout.wxml
View file @
9a5770b3
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
<view class="share-oprate" catchtap="onTapLike" data-id="{{id}}" data-type="{{type}}">
<view class="share-oprate" catchtap="onTapLike" data-id="{{id}}" data-type="{{type}}">
<image class="share-img" src="{{type ? '/assets/imgs/heart-primary.png' : '/assets/imgs/heart-default.png'}}"></image>
<image class="share-img" src="{{type ? '/assets/imgs/heart-primary.png' : '/assets/imgs/heart-default.png'}}"></image>
<text class="share-number">{{enjoySum || 0}}</text>
<text class="share-number">{{enjoySum || 0}}</text>
</view> <view class="share-oprate" catchtap="onTapShare" data-title="{{headline}}" data-url="{{url}}">
</view> <view class="share-oprate" catchtap="onTapShare" data-title="{{headline}}" data-url="{{url}}"
data-headline="{{headline}}" data-describe="{{describe}}" data-id="{{id}}"
>
<image class="share-img" src="/assets/imgs/share.png"></image>
<image class="share-img" src="/assets/imgs/share.png"></image>
<text class="share-number">{{transmitSum || 0}}</text>
<text class="share-number">{{transmitSum || 0}}</text>
</view>
</view>
...
...
src/pages/myShare/myShare.js
View file @
9a5770b3
...
@@ -20,12 +20,8 @@ wxService.page({
...
@@ -20,12 +20,8 @@ wxService.page({
showCardModal
:
false
,
showCardModal
:
false
,
cardTitle
:
''
,
cardTitle
:
''
,
cardUrl
:
''
,
cardUrl
:
''
,
contentList
:[
contentList
:[],
{
currentShareContent
:
null
url
:
'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=222247294,2919493301&fm=26&gp=0.jpg'
,
headline
:
'好好爱好好好爱护哦啊哈哦啊'
}
]
},
},
// 点击切换
// 点击切换
...
@@ -51,7 +47,7 @@ wxService.page({
...
@@ -51,7 +47,7 @@ wxService.page({
*/
*/
onShow
()
{
onShow
()
{
this
.
getCategoryList
()
this
.
getCategoryList
()
console
.
log
(
'--------'
,
Integer
.
digit
(
'611935532804608000'
,
10
,
64
)
)
this
.
data
.
currentShareContent
=
null
;
},
},
// 获取分类
// 获取分类
...
@@ -139,11 +135,26 @@ wxService.page({
...
@@ -139,11 +135,26 @@ wxService.page({
// 分享
// 分享
_onTapShare
(
e
){
_onTapShare
(
e
){
console
.
log
(
e
)
let
tentacleInfo
=
{
content
:
JSON
.
stringify
(
e
.
detail
),
contentId
:
e
.
detail
.
id
,
contentType
:
2
,
//内容类型 1.文章 2.商品 3.页面
title
:
e
.
detail
.
title
,
//标题
type
:
3
// 1:门店,2:员工(暂时不做),3:会员,4:第三方外部渠道,5:智能营销
}
this
.
data
.
currentShareContent
=
e
.
detail
;
wxService
.
getTentacleContent
(
tentacleInfo
).
then
(
res
=>
{
if
(
res
&&
res
.
tentacleId
){
this
.
data
.
currentShareContent
.
tentacleId
=
res
.
tentacleId
;
this
.
setData
({
this
.
setData
({
showCardModal
:
true
,
showCardModal
:
true
,
cardTitle
:
e
.
detail
.
title
,
cardTitle
:
e
.
detail
.
title
,
cardUrl
:
e
.
detail
.
url
,
cardUrl
:
e
.
detail
.
url
});
}
})
})
},
},
...
@@ -168,5 +179,42 @@ wxService.page({
...
@@ -168,5 +179,42 @@ wxService.page({
})
})
this
.
getContentList
(
this
.
data
.
currentTab
)
this
.
getContentList
(
this
.
data
.
currentTab
)
}
}
},
/**
* 用户点击右上角分享
*/
onShareAppMessage
:
function
(
res
)
{
if
(
res
.
from
!=
'menu'
){
let
id
=
Integer
.
digit
(
this
.
data
.
currentShareContent
.
id
,
10
,
64
);
let
tentacleId
=
Integer
.
digit
(
this
.
data
.
currentShareContent
.
tentacleId
,
10
,
64
);
var
path
=
'subPackage/page/pages/myReleaseDetail/myReleaseDetail?i='
+
id
+
'&t='
+
tentacleId
;
console
.
log
(
path
)
return
{
path
:
path
}
}
let
tentacleInfo
=
{
content
:
this
.
route
,
title
:
this
.
route
,
contentType
:
3
,
type
:
3
// 1:门店,2:员工(暂时不做),3:会员,4:第三方外部渠道,5:智能营销
};
wxService
.
getTentacleContent
(
tentacleInfo
).
then
(
res
=>
{
if
(
res
&&
res
.
tentacleId
)
{
this
.
data
.
currentShareContent
.
tentacleId
=
res
.
tentacleId
;
this
.
setData
({
showCardModal
:
true
,
cardTitle
:
e
.
detail
.
title
,
cardUrl
:
e
.
detail
.
url
});
let
tentacleId
=
Integer
.
digit
(
res
.
tentacleId
,
10
,
64
);
var
path
=
`pages/myShare/myShare?t=
${
tentacleId
}
`
;
return
{
path
:
path
}
}
});
}
}
})
})
\ No newline at end of file
src/project.config.json
View file @
9a5770b3
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
"list"
:
[]
"list"
:
[]
},
},
"miniprogram"
:
{
"miniprogram"
:
{
"current"
:
23
,
"current"
:
14
,
"list"
:
[
"list"
:
[
{
{
"id"
:
-1
,
"id"
:
-1
,
...
@@ -129,7 +129,7 @@
...
@@ -129,7 +129,7 @@
"id"
:
14
,
"id"
:
14
,
"name"
:
"种草详情"
,
"name"
:
"种草详情"
,
"pathName"
:
"pages/wantToBuyDetail/wantToBuyDetail"
,
"pathName"
:
"pages/wantToBuyDetail/wantToBuyDetail"
,
"query"
:
""
,
"query"
:
"
i= 3QCBjb83JC&t=1001
"
,
"scene"
:
null
"scene"
:
null
},
},
{
{
...
...
src/subPackage/page/pages/myReleaseDetail/myReleaseDetail.js
View file @
9a5770b3
...
@@ -19,9 +19,12 @@ wxService.page({
...
@@ -19,9 +19,12 @@ wxService.page({
* 生命周期函数--监听页面加载
* 生命周期函数--监听页面加载
*/
*/
onLoad
:
function
(
options
)
{
onLoad
:
function
(
options
)
{
console
.
log
(
options
)
if
(
options
&&
options
.
id
)
{
if
(
options
&&
options
.
id
)
{
this
.
setData
({
this
.
setData
({
id
:
options
.
id
id
:
options
.
id
},()
=>
{
this
.
getContentDetail
()
})
})
}
}
},
},
...
@@ -39,6 +42,8 @@ wxService.page({
...
@@ -39,6 +42,8 @@ wxService.page({
}).
then
(
res
=>
{
}).
then
(
res
=>
{
if
(
!
res
)
return
false
if
(
!
res
)
return
false
const
{
result
,
data
}
=
res
.
data
const
{
result
,
data
}
=
res
.
data
console
.
log
(
'content info ----------------------------------'
)
console
.
log
(
data
)
if
(
result
==
0
)
{
if
(
result
==
0
)
{
this
.
setData
({
this
.
setData
({
contentInfo
:
data
contentInfo
:
data
...
...
src/utils/Http.js
View file @
9a5770b3
...
@@ -84,9 +84,8 @@ class Http {
...
@@ -84,9 +84,8 @@ class Http {
url
,
url
,
method
:
'GET'
,
method
:
'GET'
,
header
:
{
header
:
{
'buyer-token'
:
this
.
getToken
()
'buyer-token'
:
this
.
getToken
(),
// 'buyer-token': '3e15b819c551713ae210adc525da028b'
'TENTACLE_CONTENT'
:
this
.
getTentacle
()
// 'seller-token': 'f80d09122733517ea4a0c2628c4eb0e9'
},
},
data
:
parmas
data
:
parmas
})
})
...
@@ -97,9 +96,8 @@ class Http {
...
@@ -97,9 +96,8 @@ class Http {
url
,
url
,
method
:
'POST'
,
method
:
'POST'
,
header
:
{
header
:
{
'buyer-token'
:
this
.
getToken
()
'buyer-token'
:
this
.
getToken
(),
// 'buyer-token':'3e15b819c551713ae210adc525da028b'
'TENTACLE_CONTENT'
:
this
.
getTentacle
()
// 'seller-token': 'f80d09122733517ea4a0c2628c4eb0e9'
},
},
data
:
parmas
,
data
:
parmas
,
channel
:
channel
channel
:
channel
...
@@ -175,6 +173,19 @@ class Http {
...
@@ -175,6 +173,19 @@ class Http {
// }
// }
return
wx
.
getStorageSync
(
'token'
)
return
wx
.
getStorageSync
(
'token'
)
}
}
getTentacle
(){
let
time
=
Date
.
parse
(
new
Date
())
let
TIME_EXPIRATION
=
wx
.
getStorageSync
(
'TIME_EXPIRATION'
)
let
TENTACLE_CONTENT
=
JSON
.
stringify
(
wx
.
getStorageSync
(
'TENTACLE_CONTENT'
))
if
(
TENTACLE_CONTENT
&&
TIME_EXPIRATION
>
time
){
wx
.
setStorageSync
(
'TIME_EXPIRATION'
,
time
)
return
TENTACLE_CONTENT
}
else
{
wx
.
removeStorageSync
(
'TENTACLE_CONTENT'
)
wx
.
removeStorageSync
(
'TIME_EXPIRATION'
)
}
}
}
}
export
default
Http
export
default
Http
src/utils/wxService.js
View file @
9a5770b3
...
@@ -17,6 +17,8 @@ const Promise = require('../lib/bluebird')
...
@@ -17,6 +17,8 @@ const Promise = require('../lib/bluebird')
const
config
=
require
(
'../config/index'
).
envInfo
const
config
=
require
(
'../config/index'
).
envInfo
import
utils
from
'./util'
import
utils
from
'./util'
const
citysData
=
require
(
'./city.js'
)
const
citysData
=
require
(
'./city.js'
)
import
{
Integer
}
from
'./integerDigitalConvertion'
let
openCardLister
=
null
let
openCardLister
=
null
/**
/**
* 单例
* 单例
...
@@ -242,6 +244,40 @@ class WXService extends Http {
...
@@ -242,6 +244,40 @@ class WXService extends Http {
})
})
}
}
//生成触点对象Id
getTentacleContent
(
tentacleInfo
){
return
this
.
post
(
'/marketing/tentacleContent/getTentacleContent'
,
tentacleInfo
).
then
((
res
)
=>
{
let
data
=
res
.
data
.
data
return
Promise
.
resolve
(
data
);
}).
finally
(()
=>
{
})
}
//根据触点对象id获取触点对象信息
getTentacleContentByTentacleId
(
tentacleId
){
this
.
post
(
'/marketing/tentacleContent/getTentacleContent'
,
{
tentacleId
:
tentacleId
}).
then
((
res
)
=>
{
let
data
=
res
.
data
.
data
let
TENTACLE_CONTENT
=
{
id
:
data
.
id
,
tentacleType
:
data
.
type
,
tentacleId
:
data
.
tentacleId
,
contentType
:
data
.
contentType
,
contentId
:
data
.
contentId
}
if
(
data
.
status
==
1
)
{
var
timestamp
=
Date
.
parse
(
new
Date
())
var
expiration
=
timestamp
+
1800000
wx
.
setStorageSync
(
'TENTACLE_CONTENT'
,
TENTACLE_CONTENT
)
wx
.
setStorageSync
(
'TIME_EXPIRATION'
,
expiration
)
}
}).
finally
(()
=>
{
})
}
getManageDate
()
{
getManageDate
()
{
return
manageDate
return
manageDate
}
}
...
@@ -387,13 +423,32 @@ class WXService extends Http {
...
@@ -387,13 +423,32 @@ class WXService extends Http {
onLoad
:
function
(...
args
)
{
onLoad
:
function
(...
args
)
{
const
page
=
this
const
page
=
this
_self
.
initAppGlobalDataSync
()
_self
.
initAppGlobalDataSync
()
config
.
onLoad
&&
config
.
onLoad
.
apply
(
page
,
args
)
//修改参数
let
pageIsFromShare
=
false
,
tentacleId
=
null
;
args
.
forEach
(
item
=>
{
if
(
item
[
't'
]){
pageIsFromShare
=
true
;
tentacleId
=
Integer
.
digit
(
item
[
't'
],
64
,
10
);
if
(
item
[
'i'
]){
item
[
'id'
]
=
Integer
.
digit
(
item
[
'i'
],
64
,
10
);
}
}
});
//如果打开的是分享界面则进行触点对象信息请求并存储到本地 放到后续的header中
if
(
pageIsFromShare
){
//调用接口
_self
.
getTentacleContentByTentacleId
(
tentacleId
);
}
config
.
onLoad
&&
config
.
onLoad
.
apply
(
page
,
args
);
},
},
onShow
:
function
(...
args
)
{
onShow
:
function
(...
args
)
{
const
page
=
this
const
page
=
this
_self
.
currentPage
=
page
_self
.
currentPage
=
page
config
.
onShow
&&
config
.
onShow
.
apply
(
page
,
args
)
config
.
onShow
&&
config
.
onShow
.
apply
(
page
,
args
)
},
},
onReady
:
function
(...
args
)
{
onReady
:
function
(...
args
)
{
config
.
onReady
&&
config
.
onReady
.
apply
(
this
,
args
)
config
.
onReady
&&
config
.
onReady
.
apply
(
this
,
args
)
...
...
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