Commit 277bbcf1 by luyt

fix:处理扫码进来获取产品的信息问题

1 parent 50b4f246
......@@ -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) {
......
......@@ -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}}">
......
......@@ -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
})
}
},
},
......
......@@ -331,8 +331,8 @@
}
.video-item video {
width: 100%;
height: 588rpx;
border: 1rpx dashed #AFB0B2;
height: 590rpx;
// border: 1rpx dashed #AFB0B2;
}
.video-item:nth-child(even) {
margin-left: 22rpx;
......
......@@ -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];
});
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!