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 277bbcf1
authored
Oct 24, 2022
by
luyt
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix:处理扫码进来获取产品的信息问题
1 parent
50b4f246
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
14 deletions
pages/checkProduct/checkProduct.js
pages/checkProduct/checkProduct.wxml
pages/tab/index/components/product/product.js
pages/tab/index/components/product/product.scss
utils/util.js
pages/checkProduct/checkProduct.js
View file @
277bbcf
...
...
@@ -138,6 +138,7 @@ Page({
console
.
log
(
"分享options: "
,
options
);
if
(
!
options
||
utils
.
isEmptyObj
(
options
))
return
;
// if(!Object.keys(options).includes('actNum'))return
let
{
senceData
}
=
this
.
data
//选中场景的index,和产品的index
let
{
...
...
@@ -326,7 +327,7 @@ Page({
* 生命周期函数--监听页面加载 (扫码,分享链接)
*/
async onLoad(options) {
this.getData()
await
this.getData()
console.log("分享options12255565: ", options);
// actNum,activeNavIdx isShare
if (!options || utils.isEmptyObj(options)) return;
...
...
@@ -338,12 +339,14 @@ Page({
isShare: true,
});
let ercodeParams = await this.analysisQRcode(options.scene);
options = utils.parseString(ercodeParams.scene);
options = JSON.parse(ercodeParams.scene)
}
let {senceData} = this.data
// 扫码进来
let { actNum, activeNavIdx, isShare } = options;
if (isShare == "true") {
console.log('actNum, activeNavIdx, isShare: ', actNum, activeNavIdx, isShare);
if (isShare) {
this.setData({
isShow: false,
});
...
...
@@ -360,6 +363,7 @@ Page({
outshowVideo: false, //显示视频列表
});
// 发请求
console.log()
let senceItem = senceData[actNum];
let item = senceData[actNum]?.productList[activeNavIdx];
this.shareQuery = `
sceneCode
=
$
{
senceItem
?.
sceneCode
}
&
productCode
=
$
{
...
...
@@ -389,7 +393,7 @@ Page({
}
},
// 解析二维码回调
async analysisOption() {},
//
async analysisOption() {},
// 解析扫码进来参数
async analysisQRcode(str) {
...
...
pages/checkProduct/checkProduct.wxml
View file @
277bbcf
...
...
@@ -4,7 +4,7 @@
</view> -->
<product stickyTop="{{headerHeight}}" class="productCon" style="padding-top:{{headerHeight}}px" isAuthphone="{{isAuthphone}}" actNum="{{actNum}}" wrapactiveNavIdx="{{activeNavIdx}}" senceData="{{senceData}}" outshowVideo="{{outshowVideo}}" isShare="{{isShare}}" bindauthorized="authorizedFn" />
<product stickyTop="{{headerHeight}}" class="productCon" style="padding-top:{{headerHeight}}px" isAuthphone="{{isAuthphone}}" actNum="{{actNum}}"
wrapactiveNavIdx="{{activeNavIdx}}" senceData="{{senceData}}" outshowVideo="{{outshowVideo}}" isShare="{{isShare}}" bindauthorized="authorizedFn" />
<!-- 分享弹框 -->
<!-- <shareModel actNum="{{actNum}}" isShow="{{isShow}}" bindmodelclose="modelcloseFn" /> -->
<view class="share-wrap" wx:if="{{isShow}}">
...
...
pages/tab/index/components/product/product.js
View file @
277bbcf
...
...
@@ -53,11 +53,8 @@ Component({
},
lifetimes
:
{
ready
:
function
()
{
if
(
this
.
data
.
wrapactiveNavIdx
){
this
.
setData
({
activeNavIdx
:
this
.
data
.
wrapactiveNavIdx
})
}
console
.
log
(
'this.data.wrapactiveNavIdx: '
,
this
.
data
.
wrapactiveNavIdx
);
if
(
!
this
.
data
.
outshowVideo
){
this
.
setData
({
...
...
@@ -116,6 +113,12 @@ Component({
// 每次切换场景,重新获取流程图高度
this
.
getImgHeight
();
this
.
getMoreFn
();
// this
if
(
this
.
data
.
wrapactiveNavIdx
){
this
.
setData
({
activeNavIdx
:
this
.
data
.
wrapactiveNavIdx
})
}
},
},
...
...
pages/tab/index/components/product/product.scss
View file @
277bbcf
...
...
@@ -331,8 +331,8 @@
}
.video-item
video
{
width
:
100%
;
height
:
5
88
rpx
;
border
:
1rpx
dashed
#AFB0B2
;
height
:
5
90
rpx
;
//
border: 1rpx dashed #AFB0B2;
}
.video-item
:nth-child
(
even
)
{
margin-left
:
22rpx
;
...
...
utils/util.js
View file @
277bbcf
...
...
@@ -134,11 +134,13 @@ const isEmptyObj = (obj) => {
};
// 解析参数成对象 "actNum=1&activeNavIdx=0&isShare=true"
const
parseString
=
(
str
)
=>
{
// console.log('str: ', str);
if
(
!
str
)
return
;
let
obj
=
{};
let
strArr
=
str
.
split
(
"&"
);
// console.log('strArr: ', strArr);
strArr
.
forEach
((
item
)
=>
{
console
.
log
(
"item: "
,
item
);
//
console.log("item: ", item);
let
keyArr
=
item
.
split
(
"="
);
obj
[
keyArr
[
0
]]
=
keyArr
[
1
];
});
...
...
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