Commit a72d89d9 by 王志慧

fixed

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