Commit 277bbcf1 by luyt

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

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