Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
business-assistant
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 33775768
authored
Nov 28, 2022
by
luyt
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat:分享视频
1 parent
33e23bc5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
109 additions
and
36 deletions
pages/tab/index/components/indexProduct/indexProduct.js
pages/viewProd/index.js
pages/viewProd/index.wxml
pages/viewVideo/index.js
pages/viewVideo/index.wxml
pages/tab/index/components/indexProduct/indexProduct.js
View file @
3377576
...
@@ -181,11 +181,13 @@ Component({
...
@@ -181,11 +181,13 @@ Component({
},
},
checkProd
(
e
){
checkProd
(
e
){
let
{
tabActive
}
=
this
.
data
let
{
tabActive
}
=
this
.
data
let
userInfo
=
wx
.
$storage
.
get
(
'userInfo'
)
// let item = e.currentTarget.dataset.item
// let item = e.currentTarget.dataset.item
let
index
=
e
.
currentTarget
.
dataset
.
index
let
index
=
e
.
currentTarget
.
dataset
.
index
let
obj
=
{
let
obj
=
{
actNum
:
tabActive
,
//选中的场景
actNum
:
tabActive
,
//选中的场景
activeNavIdx
:
index
//选中的产品
activeNavIdx
:
index
,
//选中的产品
phone
:
userInfo
.
phone
}
}
wx
.
$router
.
go
(
"/pages/viewProd/index"
,
obj
)
wx
.
$router
.
go
(
"/pages/viewProd/index"
,
obj
)
...
...
pages/viewProd/index.js
View file @
3377576
...
@@ -23,16 +23,24 @@ Page({
...
@@ -23,16 +23,24 @@ Page({
// 是否授权昵称
// 是否授权昵称
hasUserInfo
:
false
,
hasUserInfo
:
false
,
phone
:
''
,
//授权手机号
phone
:
''
,
//授权手机号
prodItemVideo
:
''
//选中的场景下的video的第一个
},
},
// 计算属性
// 计算属性
computed
:
{
computed
:
{
showLeftFlag
(
data
)
{
showLeftFlag
(
data
)
{
return
data
.
showLeft
// 1.分享出去
// 2.点击可以改变状态
return
data
.
isShare
&&
!
data
.
showLeft
},
},
// // 授权昵称弹框显示
prodItemVideo
(
data
){
// authNcknameShow(){
let
{
senceData
,
actNum
,
activeNavIdx
}
=
data
// return senceData[actNum]?.productList[activeNavIdx]
// }
return
senceData
[
actNum
]?.
videoList
[
0
]
},
// 授权昵称弹框显示
authNcknameShow
(
data
){
return
data
.
isShare
&&
!
data
.
hasUserInfo
}
},
},
/**
/**
...
@@ -41,17 +49,25 @@ Page({
...
@@ -41,17 +49,25 @@ Page({
*/
*/
onLoad
(
options
)
{
onLoad
(
options
)
{
if
(
!
options
||
utils
.
isEmptyObj
(
options
))
return
if
(
!
options
||
utils
.
isEmptyObj
(
options
))
return
let
{
actNum
,
activeNavIdx
,
isShare
}
=
options
let
{
actNum
,
activeNavIdx
,
isShare
,
phone
}
=
options
this
.
setData
({
this
.
setData
({
actNum
,
actNum
,
activeNavIdx
,
activeNavIdx
,
isShare
isShare
,
phone
});
});
//分享数据
//分享数据
let
senceItem
=
senceData
[
actNum
]
let
senceItem
=
senceData
[
actNum
]
let
item
=
senceData
[
actNum
]?.
productList
[
activeNavIdx
]
let
item
=
senceData
[
actNum
]?.
productList
[
activeNavIdx
]
this
.
shareQuery
=
`sceneCode=
${
senceItem
?.
sceneCode
}
&
productCode
=
$
{
item
?.
productCode
}
&
isShare
=
$
{
true
}
&
productDesc
=
$
{
item
?.
productName
}
&
category
=
$
{
item
?.
category
}
&
actNum
=
$
{
actNum
}
&
activeNavIdx
=
$
{
activeNavIdx
}
`
console
.
log
(
'title'
,
item
.
productName
)
setTimeout
(()
=>
{
wx
.
setNavigationBarTitle
({
title
:
item
.
productName
,
});
},
100
)
this
.
shareQuery
=
`sceneCode=
${
senceItem
?.
sceneCode
}
&
productCode
=
$
{
item
?.
productCode
}
&
isShare
=
$
{
true
}
&
productDesc
=
$
{
item
?.
productName
}
&
category
=
$
{
item
?.
category
}
&
actNum
=
$
{
actNum
}
&
activeNavIdx
=
$
{
activeNavIdx
}
&
phone
=
$
{
phone
}
`
this.shareTrackData = {
this.shareTrackData = {
sceneCode: senceItem?.sceneCode,
sceneCode: senceItem?.sceneCode,
productCode: item?.productCode,
productCode: item?.productCode,
...
@@ -66,26 +82,34 @@ Page({
...
@@ -66,26 +82,34 @@ Page({
//接受跳转的路由参数(小程序页面跳转)
//接受跳转的路由参数(小程序页面跳转)
onRoute(options) {
onRoute(options) {
if (!options || utils.isEmptyObj(options)) return
if (!options || utils.isEmptyObj(options)) return
let { actNum = 0, activeNavIdx = 0 } = options;
let { actNum = 0, activeNavIdx = 0
,phone=123
} = options;
this.setData({
this.setData({
actNum, //选中的场景下标
actNum, //选中的场景下标
activeNavIdx, //选中的产品
activeNavIdx, //选中的产品
phone //联系电话
});
});
// 设置标题
// 设置
转发
标题
let userInfoObj = wx.$storage.get("userInfo");
let userInfoObj = wx.$storage.get("userInfo");
// #服务商账号#取该分享者商户的联系人字段,无则取商户简称,无则取商户全称
// #服务商账号#取该分享者商户的联系人字段,无则取商户简称,无则取商户全称
let name = userInfoObj.merchantName;
let name = userInfoObj.merchantName;
this.shareTitle = `
$
{
name
}
给你分享一个活动
$
{
senceData
[
actNum
]?.
productList
[
activeNavIdx
].
proName
}
,戳我参与
~
`;
this.shareTitle = `
$
{
name
}
给你分享一个活动
$
{
senceData
[
actNum
]?.
productList
[
activeNavIdx
].
proName
}
,戳我参与
~
`;
wx.setNavigationBarTitle({
title: "查看产品",
});
//分享数据
//分享数据
let item = senceData[actNum]?.productList[activeNavIdx]
let item = senceData[actNum]?.productList[activeNavIdx]
this.shareQuery = `
sceneCode
=
$
{
senceData
[
actNum
].
sceneCode
}
&
productCode
=
$
{
item
?.
productCode
}
&
isShare
=
$
{
true
}
&
productDesc
=
$
{
item
?.
productName
}
&
category
=
$
{
item
?.
category
}
&
actNum
=
$
{
actNum
}
&
activeNavIdx
=
$
{
activeNavIdx
}
`
console.log('title2',item.productName)
setTimeout(() => {
wx.setNavigationBarTitle({
title: item.productName,
});
},100)
this.shareQuery = `
sceneCode
=
$
{
senceData
[
actNum
].
sceneCode
}
&
productCode
=
$
{
item
?.
productCode
}
&
isShare
=
$
{
true
}
&
productDesc
=
$
{
item
?.
productName
}
&
category
=
$
{
item
?.
category
}
&
actNum
=
$
{
actNum
}
&
activeNavIdx
=
$
{
activeNavIdx
}
&
phone
=
$
{
phone
}
`
this.shareTrackData = {
this.shareTrackData = {
sceneCode: senceData[actNum]?.sceneCode,
sceneCode: senceData[actNum]?.sceneCode,
productCode: item?.productCode,
productCode: item?.productCode,
...
@@ -233,6 +257,7 @@ Page({
...
@@ -233,6 +257,7 @@ Page({
},
},
// 获取用户昵称(昵称头像)
// 获取用户昵称(昵称头像)
getUserProfile(e) {
getUserProfile(e) {
//关闭授权框
this.setData({
this.setData({
hasUserInfo: true
hasUserInfo: true
})
})
...
@@ -261,6 +286,11 @@ Page({
...
@@ -261,6 +286,11 @@ Page({
}
}
})
})
},
},
// 1.3查看活动详情按钮
checkActive(){
// 跳转
console.log('跳转')
},
/**
/**
* 生命周期函数--监听页面显示
* 生命周期函数--监听页面显示
*/
*/
...
...
pages/viewProd/index.wxml
View file @
3377576
<view class="view-prod">
<view class="view-prod">
<video class="frame" src=""></video>
<video class="frame" src="
{{prodItemVideo.videoUrl}}
"></video>
<view class="title-wrap">
<view class="title-wrap">
<view class="title">
单品AR导航-新增产值20w+
</view>
<view class="title">
{{prodItemVideo.name}}
</view>
<!-- <glsx-image class="check" src="index/poster/check.png" /> -->
<!-- <glsx-image class="check" src="index/poster/check.png" /> -->
<image class="check" src="{{IMG_URL}}index/poster/check.png?v={{img_version}}" />
<image class="check" src="{{IMG_URL}}index/poster/check.png?v={{img_version}}" />
<view class="num">
3256
</view>
<view class="num">
{{prodItemVideo.view}}
</view>
</view>
</view>
<view class="tab-wrap">
<view class="tab-wrap">
<van-tabs sticky bind:click="onClickTab" active="{{tabAct}}">
<van-tabs sticky bind:click="onClickTab" active="{{tabAct}}">
...
@@ -24,31 +24,30 @@
...
@@ -24,31 +24,30 @@
<glsx-image webp src="index/phone.png" class="icon"></glsx-image>
<glsx-image webp src="index/phone.png" class="icon"></glsx-image>
请联系我
请联系我
<view style="color:#3666fe">
<view style="color:#3666fe">
<!-- {{phone}} -->
{{phone}}
132456413
</view>
</view>
</view>
</view>
</block>
</block>
<!-- 查看活动那个详情 1.3才有 -->
<!-- 查看活动那个详情 1.3才有 -->
<block wx:if="{{ index == 1 && actNum == 3}}">
<block wx:if="{{ index == 1 && actNum == 3}}">
<button class="check-act" type="default" plain="true">查看活动详情</button>
<button class="check-act" type="default" plain="true"
bindtap="checkActive"
>查看活动详情</button>
</block>
</block>
<!-- 获取更多详情 -->
<!-- 获取更多详情 -->
<block wx:if="{{ index == 2 &&
!
showLeftFlag}}">
<block wx:if="{{ index == 2 && showLeftFlag}}">
<button class="more-btn" data-index="{{index}}" bindgetphonenumber="getUserInfo" open-type="getPhoneNumber">
<button class="more-btn" data-index="{{index}}" bindgetphonenumber="getUserInfo" open-type="getPhoneNumber">
点击查看更多详情
点击查看更多详情
</button>
</button>
</block>
</block>
</image>
</image>
<image wx:if="{{ index >= 3 && showLeftFlag}}" webp class="img-item img-item{{actNum}}{{index}}" src="{{item}}?v={{img_version}}">
<image wx:if="{{ index >= 3 &&
!
showLeftFlag}}" webp class="img-item img-item{{actNum}}{{index}}" src="{{item}}?v={{img_version}}">
</image>
</image>
</block>
</block>
<view class="occupancy">
<view class="occupancy"
wx:if="{{!isShare}}"
>
<!-- padding底部 占位元素 -->
<!-- padding底部 占位元素 -->
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 申请按钮 -->
<!-- 申请按钮
不是分享出去的显示按钮
-->
<apply-button downShow="{{false}}"></apply-button>
<apply-button
wx:if="{{!isShare}}"
downShow="{{false}}"></apply-button>
<!-- 授权昵称 -->
<!-- 授权昵称 -->
<view wx:if="{{!hasUserInfo}}" class="user-profile" bindtap="getUserProfile"></view>
\ No newline at end of file
\ No newline at end of file
<view wx:if="{{authNcknameShow}}" class="user-profile" bindtap="getUserProfile"></view>
\ No newline at end of file
\ No newline at end of file
pages/viewVideo/index.js
View file @
3377576
...
@@ -3,8 +3,10 @@ import { IMG_URL } from "~/utils/constantData.js";
...
@@ -3,8 +3,10 @@ import { IMG_URL } from "~/utils/constantData.js";
import
{
senceData
}
from
"~/pages/tab/index/constant/data"
;
import
{
senceData
}
from
"~/pages/tab/index/constant/data"
;
// 导入方法
// 导入方法
import
{
behavior
as
computedBehavior
}
from
"~/utils/lib/miniprogram-computed"
;
import
{
behavior
as
computedBehavior
}
from
"~/utils/lib/miniprogram-computed"
;
import
utils
from
'~/utils/util.js'
Page
({
Page
({
noPageAuth
:
true
,
// 混入
// 混入
behaviors
:
[
computedBehavior
],
behaviors
:
[
computedBehavior
],
/**
/**
...
@@ -12,6 +14,7 @@ Page({
...
@@ -12,6 +14,7 @@ Page({
*/
*/
data
:
{
data
:
{
IMG_URL
,
IMG_URL
,
isShare
:
false
,
//是否是被分享出去
videoSrc
:
""
,
videoSrc
:
""
,
senceData
,
senceData
,
tabActive
:
0
,
//场景值
tabActive
:
0
,
//场景值
...
@@ -32,29 +35,68 @@ Page({
...
@@ -32,29 +35,68 @@ Page({
/**
/**
* 生命周期函数--监听页面加载
* 生命周期函数--监听页面加载
*/
*/
onLoad
(
options
)
{},
onLoad
(
options
)
{
let
{
isShare
}
=
options
;
this
.
setData
({
isShare
:
isShare
,
//
})
this
.
shareDataFn
(
options
)
},
//接受跳转的路由参数(小程序页面跳转)
//接受跳转的路由参数(小程序页面跳转)
onRoute
(
options
)
{
onRoute
(
options
)
{
console
.
log
(
"options: "
,
options
);
this
.
shareDataFn
(
options
)
},
// 分享数据函数
shareDataFn
(
options
){
if
(
!
options
||
utils
.
isEmptyObj
(
options
))
return
let
{
tabActive
,
videoIndex
}
=
options
// console.log("options: ", options, !!options);
console
.
log
(
'tabActive,videoIndex: '
,
tabActive
,
videoIndex
);
this
.
setData
({
this
.
setData
({
tabActive
:
options
.
tabActive
,
tabActive
:
tabActive
,
videoIndex
:
options
.
videoIndex
,
videoIndex
:
videoIndex
,
});
wx
.
setNavigationBarTitle
({
title
:
"当前页面当前页面当前页面当前页面当前页面"
,
});
});
//
//分享的数据
this
.
changeShareData
()
},
changeShareData
(){
let
{
senceData
,
tabActive
,
videoIndex
,
videoitem
}
=
this
.
data
// // 设置转发标题
// let userInfoObj = wx.$storage.get("userInfo");
// // #服务商账号#取该分享者商户的联系人字段,无则取商户简称,无则取商户全称
// let name = userInfoObj.merchantName;
this
.
shareTitle
=
`给您分享一个
${
videoitem
.
name
}
视频`
;
//分享的数据
let
senceItem
=
senceData
[
tabActive
]
this
.
shareQuery
=
`sceneCode=
${
senceItem
?.
sceneCode
}
&
isShare
=
$
{
true
}
&
tabActive
=
$
{
tabActive
}
&
videoIndex
=
$
{
videoIndex
}
`
},
},
changeVideo(e) {
changeVideo(e) {
let { index } = e.currentTarget.dataset;
let { index } = e.currentTarget.dataset;
this.setData({
this.setData({
videoIndex: index,
videoIndex: index,
});
});
this.setpagesTitle()
this.changeShareData()
},
},
/**
/**
* 生命周期函数--监听页面初次渲染完成
* 生命周期函数--监听页面初次渲染完成
*/
*/
onReady
()
{},
onReady() {
this.setpagesTitle()
},
//设置标题
setpagesTitle(){
//设置标题
let {videoitem} = this.data
wx.setNavigationBarTitle({
title: videoitem.name,
});
},
/**
/**
* 生命周期函数--监听页面显示
* 生命周期函数--监听页面显示
...
...
pages/viewVideo/index.wxml
View file @
3377576
...
@@ -28,4 +28,4 @@
...
@@ -28,4 +28,4 @@
</view>
</view>
<!-- 申请按钮 -->
<!-- 申请按钮 -->
<apply-button ></apply-button>
<apply-button
wx:if="{{!isShare}}"
></apply-button>
Write
Preview
Markdown
is supported
Attach a file
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 post a comment