Commit a72d89d9 by 王志慧

fixed

1 parent 5e335b5e
// pages/viewProd/index.js
import { behavior as computedBehavior } from '~/utils/lib/miniprogram-computed'
import { IMG_URL_STORE } from "~/utils/constantData.js";
import { scenceList } from '~/pages/tab/discovery/constant/data'
import { senceData, productData } from '~/pages/tab/discovery/constant/senceData'
import {
behavior as computedBehavior
} from '~/utils/lib/miniprogram-computed'
import {
IMG_URL_STORE
} from "~/utils/constantData.js";
import {
scenceList
} from '~/pages/tab/discovery/constant/data'
import {
senceData,
productData
} from '~/pages/tab/discovery/constant/senceData'
import USERAPI from '~/api/usersApi/index'
import utils from '~/utils/util.js'
import {getActiveApi} from "~/api/viewprod"
import BusassistantApi from "~/api/busassistantApi/index";
import {
getActiveApi
} from "~/api/viewprod"
import BusassistantApi from "~/api/busassistantApi/index";
Page({
/**
* 页面的初始数据
......@@ -14,21 +25,21 @@ Page({
noPageAuth: true,
behaviors: [computedBehavior],
data: {
IMG_URL:IMG_URL_STORE,
IMG_URL: IMG_URL_STORE,
proInfo: {},
isShare:false, //是否是分享出去的
isShare: false, //是否是分享出去的
actNum: -1,
activeNavIdx: 0,
tabAct: 0,
showLeft:false, //更多按钮显示的内容
scrollTop:0,
showLeft: false, //更多按钮显示的内容
scrollTop: 0,
img_version: '0.1.0',
// 是否授权昵称
hasUserInfo: false,
// phone: '', //授权手机号
prodItemVideo:'', //选中的场景下的video的第一个
activeUrl:'', // 1.3场景才有的活动配置
sharephone:'', //主要微信用户,服务商
prodItemVideo: '', //选中的场景下的video的第一个
activeUrl: '', // 1.3场景才有的活动配置
sharephone: '', //主要微信用户,服务商
hasProduct: true
},
// 计算属性
......@@ -38,8 +49,12 @@ Page({
// 2.点击可以改变状态
return data.isShare && !data.showLeft
},
prodItemVideo(data){
let {senceData,actNum,activeNavIdx} = data
prodItemVideo(data) {
let {
senceData,
actNum,
activeNavIdx
} = data
// return senceData[actNum]?.productList[activeNavIdx]
// if(actNum == 2){
// return senceData[actNum]?.noVideoPicture[0]
......@@ -47,7 +62,7 @@ Page({
// return senceData[actNum]?.videoList[activeNavIdx]
},
// 授权昵称弹框显示
authNcknameShow(data){
authNcknameShow(data) {
return data.isShare && !data.hasUserInfo
}
......@@ -61,16 +76,21 @@ Page({
if (!options || utils.isEmptyObj(options)) return
// let { actNum, activeNavIdx, isShare,sharephone, sceneCode } = options
let { isShare,sharephone, sceneCode, id } = options
let {
isShare,
sharephone,
sceneCode,
id
} = options
let proData = await this.getProductDetail(id);
if (!proData) {
if (!proData || proData?.status == 2) {
this.setData({
isLoadding: false,
hasProduct: false
})
return
}
if(isShare){
if (isShare) {
wx.hideHomeButton()
}
......@@ -96,18 +116,18 @@ Page({
// });
let wx_user_info = wx.$storage.get('wx_user_info'),
shareOpenId = wx_user_info.openId || ''
shareOpenId = wx_user_info.openId || ''
setTimeout(() => {
utils.setNavigationBarTitle(proData?.proName)
},100)
}, 100)
// this.shareQuery = `sceneCode=${sceneObj.sceneCode}&productCode=${proInfo?.productCode}&isShare=${true}&productDesc=${proInfo?.productName}&category=${proInfo?.category}&actNum=${actNum}&activeNavIdx=${activeNavIdx}&sharephone=${sharephone}`
this.shareQuery = `id=${id}&sceneCode=${sceneCode}&productCode=${proData?.productCode}&isShare=${true}&sharephone=${sharephone}`
this.shareAppMessage = {
title:this.shareTitle,
path: `/${this.route}?${this.shareQuery}`,
query:this.shareQuery
title: this.shareTitle,
path: `/${this.route}?${this.shareQuery}`,
query: this.shareQuery
}
},
......@@ -126,9 +146,11 @@ Page({
// sharephone:phone //联系电话 (登陆的用户)
// });
let { phone=123, id, sceneCode } = options;
let {
phone = 123, id, sceneCode
} = options;
let proData = await this.getProductDetail(id);
if (!proData) {
if (!proData || proData?.status == 2) {
this.setData({
isLoadding: false,
hasProduct: false
......@@ -136,7 +158,7 @@ Page({
return
}
this.setData({
sharephone:phone, //联系电话 (登陆的用户)
sharephone: phone, //联系电话 (登陆的用户)
productData: proData,
});
......@@ -144,25 +166,25 @@ Page({
let userInfoObj = wx.$storage.get("userInfo");
// #服务商账号#取该分享者商户的联系人字段,无则取商户简称,无则取商户全称
let name = userInfoObj.merchantName;
this.shareTitle = `${name}给你分享一个活动${proData?.proName},戳我参与~`;
this.shareTitle = `${name||''}给你分享一个活动${proData?.proName},戳我参与~`;
//分享数据
// let item = this.data.proInfo || {}
setTimeout(() => {
utils.setNavigationBarTitle(proData?.proName)
},100)
}, 100)
//分享人openId
let wx_user_info = wx.$storage.get('wx_user_info'),
shareOpenId = wx_user_info.openId || ''
shareOpenId = wx_user_info.openId || ''
// &shareOpenId=${shareOpenId}
// this.shareQuery = `sceneCode=${sceneObj?.sceneCode}&productCode=${proInfo?.productCode}&isShare=${true}&productDesc=${proInfo?.productName}&category=${proInfo?.category}&actNum=${actNum}&activeNavIdx=${activeNavIdx}&sharephone=${phone}`
this.shareQuery = `id=${id}&sceneCode=${sceneCode}&productCode=${proData?.productCode}&isShare=${true}&sharephone=${phone}`
this.shareAppMessage = {
title:this.shareTitle,
path: `/${this.route}?${this.shareQuery}`,
query:this.shareQuery
title: this.shareTitle,
path: `/${this.route}?${this.shareQuery}`,
query: this.shareQuery
}
},
......@@ -170,7 +192,9 @@ Page({
getProductDetail(id) {
return new Promise((resolve) => {
let _data;
BusassistantApi.getDiscoverDetail({id}).then((res) => {
BusassistantApi.getDiscoverDetail({
id
}).then((res) => {
_data = res.data;
resolve(_data);
});
......@@ -178,9 +202,12 @@ Page({
},
//获取配置url
async getActiveApiFn(){
let {code,data} = await getActiveApi()
if(code == 0){
async getActiveApiFn() {
let {
code,
data
} = await getActiveApi()
if (code == 0) {
this.setData({
activeUrl: data
})
......@@ -201,8 +228,7 @@ Page({
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
onReady() {},
// 1.3查看活动详情按钮
// checkActive(){
// // 跳转
......@@ -214,7 +240,16 @@ Page({
/**
* 生命周期函数--监听页面显示
*/
onShow() {},
onShow() {
let {
productData
} = this.data
if(productData){
setTimeout(() => {
utils.setNavigationBarTitle(productData.proName)
}, 100)
}
},
/**
* 生命周期函数--监听页面隐藏
......@@ -241,11 +276,11 @@ Page({
*/
onShareAppMessage() {
return {
...this.shareAppMessage
...this.shareAppMessage
}
},
/**
* 浏览埋点
*/
onShareTimeline() {}
});
});
\ No newline at end of file
......@@ -79,7 +79,7 @@ Page({
isShare
} = options;
let videoData = await this.getDetailWithLike(id);
if (!videoData) {
if (!videoData || videoData?.status == 2) {
this.setData({
isLoadding: false,
hasProduct: false
......@@ -109,7 +109,7 @@ Page({
sceneCode
} = options;
let videoData = await this.getDetailWithLike(id);
if (!videoData) {
if (!videoData || videoData?.status == 2) {
this.setData({
isLoadding: false,
hasProduct: false
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!