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
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
13 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({
...
@@ -138,6 +138,7 @@ Page({
console
.
log
(
"分享options: "
,
options
);
console
.
log
(
"分享options: "
,
options
);
if
(
!
options
||
utils
.
isEmptyObj
(
options
))
return
;
if
(
!
options
||
utils
.
isEmptyObj
(
options
))
return
;
// if(!Object.keys(options).includes('actNum'))return
// if(!Object.keys(options).includes('actNum'))return
let
{
senceData
}
=
this
.
data
//选中场景的index,和产品的index
//选中场景的index,和产品的index
let
{
let
{
...
@@ -326,7 +327,7 @@ Page({
...
@@ -326,7 +327,7 @@ Page({
* 生命周期函数--监听页面加载 (扫码,分享链接)
* 生命周期函数--监听页面加载 (扫码,分享链接)
*/
*/
async onLoad(options) {
async onLoad(options) {
this.getData()
await
this.getData()
console.log("分享options12255565: ", options);
console.log("分享options12255565: ", options);
// actNum,activeNavIdx isShare
// actNum,activeNavIdx isShare
if (!options || utils.isEmptyObj(options)) return;
if (!options || utils.isEmptyObj(options)) return;
...
@@ -338,12 +339,14 @@ Page({
...
@@ -338,12 +339,14 @@ Page({
isShare: true,
isShare: true,
});
});
let ercodeParams = await this.analysisQRcode(options.scene);
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;
let { actNum, activeNavIdx, isShare } = options;
if (isShare == "true") {
console.log('actNum, activeNavIdx, isShare: ', actNum, activeNavIdx, isShare);
if (isShare) {
this.setData({
this.setData({
isShow: false,
isShow: false,
});
});
...
@@ -360,6 +363,7 @@ Page({
...
@@ -360,6 +363,7 @@ Page({
outshowVideo: false, //显示视频列表
outshowVideo: false, //显示视频列表
});
});
// 发请求
// 发请求
console.log()
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
=
$
{
this.shareQuery = `
sceneCode
=
$
{
senceItem
?.
sceneCode
}
&
productCode
=
$
{
...
@@ -389,7 +393,7 @@ Page({
...
@@ -389,7 +393,7 @@ Page({
}
}
},
},
// 解析二维码回调
// 解析二维码回调
async analysisOption() {},
//
async analysisOption() {},
// 解析扫码进来参数
// 解析扫码进来参数
async analysisQRcode(str) {
async analysisQRcode(str) {
...
...
pages/checkProduct/checkProduct.wxml
View file @
277bbcf
pages/tab/index/components/product/product.js
View file @
277bbcf
...
@@ -53,11 +53,8 @@ Component({
...
@@ -53,11 +53,8 @@ Component({
},
},
lifetimes
:
{
lifetimes
:
{
ready
:
function
()
{
ready
:
function
()
{
if
(
this
.
data
.
wrapactiveNavIdx
){
console
.
log
(
'this.data.wrapactiveNavIdx: '
,
this
.
data
.
wrapactiveNavIdx
);
this
.
setData
({
activeNavIdx
:
this
.
data
.
wrapactiveNavIdx
})
}
if
(
!
this
.
data
.
outshowVideo
){
if
(
!
this
.
data
.
outshowVideo
){
this
.
setData
({
this
.
setData
({
...
@@ -116,6 +113,12 @@ Component({
...
@@ -116,6 +113,12 @@ Component({
// 每次切换场景,重新获取流程图高度
// 每次切换场景,重新获取流程图高度
this
.
getImgHeight
();
this
.
getImgHeight
();
this
.
getMoreFn
();
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 @@
...
@@ -331,8 +331,8 @@
}
}
.video-item
video
{
.video-item
video
{
width
:
100%
;
width
:
100%
;
height
:
5
88
rpx
;
height
:
5
90
rpx
;
border
:
1rpx
dashed
#AFB0B2
;
//
border: 1rpx dashed #AFB0B2;
}
}
.video-item
:nth-child
(
even
)
{
.video-item
:nth-child
(
even
)
{
margin-left
:
22rpx
;
margin-left
:
22rpx
;
...
...
utils/util.js
View file @
277bbcf
...
@@ -134,11 +134,13 @@ const isEmptyObj = (obj) => {
...
@@ -134,11 +134,13 @@ const isEmptyObj = (obj) => {
};
};
// 解析参数成对象 "actNum=1&activeNavIdx=0&isShare=true"
// 解析参数成对象 "actNum=1&activeNavIdx=0&isShare=true"
const
parseString
=
(
str
)
=>
{
const
parseString
=
(
str
)
=>
{
// console.log('str: ', str);
if
(
!
str
)
return
;
if
(
!
str
)
return
;
let
obj
=
{};
let
obj
=
{};
let
strArr
=
str
.
split
(
"&"
);
let
strArr
=
str
.
split
(
"&"
);
// console.log('strArr: ', strArr);
strArr
.
forEach
((
item
)
=>
{
strArr
.
forEach
((
item
)
=>
{
console
.
log
(
"item: "
,
item
);
//
console.log("item: ", item);
let
keyArr
=
item
.
split
(
"="
);
let
keyArr
=
item
.
split
(
"="
);
obj
[
keyArr
[
0
]]
=
keyArr
[
1
];
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