Commit d5f0a72e by 王志慧

commit

1 parent 48ae36b3
import api from "~/utils/request/request";
const path = "scrm.api.stoassistant";
class BusassistantApi {
// 获取小程序首页数据列表
getDiscoverList(data) {
return api.post({
method: 'scrm.api.busassistant.discover.weapp.list',
...data
},
true
)
}
// 获取特色产品内容详情
getDiscoverDetail(data) {
return api.post({
method: 'scrm.api.busassistant.discover.content.detail',
...data
},
true
)
}
// 获取案例视频、操作指引详情
getDetailWithLike(data) {
return api.post({
method: 'scrm.api.busassistant.discover.content.detailWithLike',
...data
},
true
)
}
}
export default BusassistantApi;
\ No newline at end of file
import BusassistantApi from './BusassistantApi.js'
export default new BusassistantApi()
\ No newline at end of file
......@@ -8,11 +8,14 @@ import util from './utils/util'
import wxApi from './utils/utils_wx'
import '~/router/routerBefore'
import router from './router/index'
import BusassistantApi from "~/api/busassistantApi/index";
// 有问题 前后顺序不能随意调整
// console.log(test)
import { setSystem_info } from '~/utils/cache/storageApi'
import {
setSystem_info
} from '~/utils/cache/storageApi'
// console.log(setSystem_info)
// 判断小程序是否需要更新
import getUpdateManager from './utils/lib/wxUpdateManager'
......@@ -23,12 +26,16 @@ import getUpdateManager from './utils/lib/wxUpdateManager'
import eventbus from './utils/evenbus'
// 微信小程序异步使用 使用方法wx.pro+对应api即可 promisify 这个是配置单独某个api
import { promisifyAll } from './utils/lib/wx-promise-pro'
import {
promisifyAll
} from './utils/lib/wx-promise-pro'
promisifyAll()
// promisify(wx.getSystemInfo)().then(console.log)
// 实例化对象存储
import { Storage } from './utils/cache/storage'
import {
Storage
} from './utils/cache/storage'
const $Storage = new Storage()
//全局分享
......@@ -55,9 +62,17 @@ App({
onShow(options) {
getUpdateManager()
},
// 获取公共数据
getBaseData() {
return new Promise((resolve, reject) => {
BusassistantApi.getDiscoverList().then(res => {
resolve(res.data)
})
})
},
/**页面不存在时触发 */
onPageNotFound(e) {
wx.$router.goHome()
},
onHide() {}
})
})
\ No newline at end of file
......@@ -123,7 +123,9 @@
"crowdfund-poster": "/components/CrowdfundPoster/CrowdfundPoster",
"glsx-image": "/components/image/index",
"van-datetime-picker": "@vant/weapp/datetime-picker/index",
"van-calendar": "@vant/weapp/calendar/index"
"van-calendar": "@vant/weapp/calendar/index",
"no-product": "/components/NoProduct/index"
},
"resolveAlias": {
"~/*": "/*"
......
// components/NoProduct/index.js
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
IMG_URL: 'https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/',
img_version: 'v1.0.0'
},
/**
* 组件的方法列表
*/
methods: {
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
.no-product {
height: 100vh;
font-weight: 500;
font-size: 48rpx;
color: #2D2D33;
text-align: center;
margin-top: 340rpx;
&-img {
width: 434rpx;
height: 276rpx;
margin-bottom: 50rpx;
}
}
\ No newline at end of file
<!--components/NoProduct/index.wxml-->
<view class="no-product">
<image class="no-product-img" src="{{IMG_URL}}index/productImgs/no-product.png?v={{img_version}}" />
<view>产品已下架</view>
</view>
......@@ -10,9 +10,9 @@
"integrity": "sha512-swM4k3pVwt/6Tnijvq86paLiKE1CzbrBQ4lR7+9uRhwKOM0HS3ooK1Q4IjSEyxQ59ZFKmYYvZln77RZcnSDqmA=="
},
"glsx-applet-component": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/glsx-applet-component/-/glsx-applet-component-1.1.3.tgz",
"integrity": "sha512-Ze+HdtFJImhOsWLfV+ZzB86Kf18pm9M9CZWhctPel/qJNMEn29g9ywC16NXmeac+gTu07MOpURyF+YmO8ojkJA=="
"version": "1.1.10",
"resolved": "https://registry.npmjs.org/glsx-applet-component/-/glsx-applet-component-1.1.10.tgz",
"integrity": "sha512-0jJ1RT28em/lU4sak53LlU8hNgVWpgqDtF+2XxFMxlD8lT8jopA2zrEARJArRvjp0SNyxe58UXAdhJ/a8R/KdA=="
}
}
}
......@@ -5,7 +5,7 @@
"main": "app.js",
"dependencies": {
"@vant/weapp": "^1.10.7",
"glsx-applet-component": "^1.1.3"
"glsx-applet-component": "^1.1.10"
},
"devDependencies": {},
"scripts": {
......
// packagesList/pages/productDetail/components/proDetail/proDetail.js
import { senceData, productData } from '~/pages/tab/discovery/constant/senceData'
// import { senceData, productData } from '~/pages/tab/storeAssistant/pages/discovery/constant/senceData'
const norTabList = ['海报案例', '测算营销', '产品介绍', '项目亮点']
Component({
externalClasses: ['custom-class'],
......@@ -8,30 +8,30 @@ Component({
*/
properties: {
// 场景值下标
actNum: {
type: Number,
value: -1,
observer(n) {
this.getInfo()
if (n == 3) {
this.setVideoCtx()
}
}
},
// 选中的产品
activeNavIdx: {
type: Number,
value: 0
},
cardInfo: {
type: Object,
value: {}
},
// 配置url
activeUrl: {
type: String,
value: ''
},
// actNum: {
// type: Number,
// value: -1,
// observer(n) {
// this.getInfo()
// if (n == 3) {
// this.setVideoCtx()
// }
// }
// },
// // 选中的产品
// activeNavIdx: {
// type: Number,
// value: 0
// },
// cardInfo: {
// type: Object,
// value: {}
// },
// // 配置url
// activeUrl: {
// type: String,
// value: ''
// },
sharephone: {
type: String,
value: ''
......@@ -39,6 +39,14 @@ Component({
showLeftFlag: {
type: Boolean,
value: false
},
detailType: {
type: String,
value: 'pro'
},
proDetail: {
type: Object,
value: {}
}
},
......@@ -48,7 +56,7 @@ Component({
data: {
IMG_URL: 'https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/',
videoBaseUrl: 'https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/',
productData,
// productData,
proInfo: {},
prodItemVideo: '', //选中的场景下的video的第一个
tabAct: 0,
......@@ -59,6 +67,14 @@ Component({
imgTopArr: []
},
// lifetimes: {
// attached() {
// setTimeout(() => {
// this.getImgHeight()
// }, 800)
// },
// },
/**
* 组件的方法列表
*/
......@@ -73,44 +89,58 @@ Component({
let { attr } = e.currentTarget.dataset
this.data[attr] && this.data[attr].pause()
},
getInfo() {
let { activeNavIdx, actNum } = this.data
const spcList = [99] // 订阅模块需要特殊处理
const senceList = this.data.productData[actNum].filter(item => item.name != '全部')
for (let i = 0; i < senceList.length; i++) {
let item = senceList[i]
let proIdList = item?.productList.map(k => k.id)
if (proIdList.includes(activeNavIdx)) {
let proInfo = item.productList.find(k => k.id == activeNavIdx)
this.setData({
proInfo,
productImgs: spcList.includes(actNum) ? proInfo.sceneImgs : (proInfo.productImgs ? proInfo.productImgs : item.productImgs),
tabList: spcList.includes(actNum) ? proInfo.tabList : norTabList,
prodItemVideo: item.videoList.length ? spcList.includes(actNum) ? item.videoList[proInfo.currentIndex] : item.videoList[activeNavIdx] : item.noVideoPicture[0]
})
break
}
}
},
// getInfo() {
// let { activeNavIdx, actNum } = this.data
// const spcList = [99] // 订阅模块需要特殊处理
// const senceList = this.data.productData[actNum].filter(item => item.name != '全部')
// for (let i = 0; i < senceList.length; i++) {
// let item = senceList[i]
// let proIdList = item?.productList.map(k => k.id)
// if (proIdList.includes(activeNavIdx)) {
// let proInfo = item.productList.find(k => k.id == activeNavIdx)
// this.setData({
// proInfo,
// productImgs: spcList.includes(actNum) ? proInfo.sceneImgs : (proInfo.productImgs ? proInfo.productImgs : item.productImgs),
// tabList: spcList.includes(actNum) ? proInfo.tabList : norTabList,
// prodItemVideo: item.videoList.length ? spcList.includes(actNum) ? item.videoList[proInfo.currentIndex] : item.videoList[activeNavIdx] : item.noVideoPicture[0]
// })
// break
// }
// }
// },
handleLongPress(e) {
let { actnum, index } = e.target.dataset
console.log(actnum, index)
// 膨胀金活动,合作方式
if (actnum == 99 && index == 4) {
wx.downloadFile({
// 示例 url,并非真实存在
url: 'https://scrm.glsx.com.cn/frontpdf/expand_agreement.pdf',
// 如果图片有长按事件 posterEventType: 1-无 2-有
let {item} = e.currentTarget.dataset
if (item.posterEventType == 1) return
wx.downloadFile({
url: item.posterEventUrl,
success: function (res) {
const filePath = res.tempFilePath
wx.openDocument({
filePath: filePath,
success: function (res) {
const filePath = res.tempFilePath
wx.openDocument({
filePath: filePath,
success: function (res) {
console.log('打开文档成功')
}
})
}
})
}
})
// let { actnum, index } = e.target.dataset
// console.log(actnum, index)
// // 膨胀金活动,合作方式
// if (actnum == 99 && index == 4) {
// wx.downloadFile({
// // 示例 url,并非真实存在
// url: 'https://scrm.glsx.com.cn/frontpdf/expand_agreement.pdf',
// success: function (res) {
// const filePath = res.tempFilePath
// wx.openDocument({
// filePath: filePath,
// success: function (res) {
// console.log('打开文档成功')
// }
// })
// }
// })
// }
},
async loadImg(e){
this.data.loadedNum += 1
......@@ -121,7 +151,7 @@ Component({
return prev + cur.height;
}, 0)
imgTopArr.push(top)
const imgList = await this.getDomInfo('.img-item')
const imgList = await this.getDomInfo('.img-items')
imgList.reduce((prev, cur, index)=>{
if(index<imgList.length-1){
imgTopArr.push(prev + cur.height)
......@@ -154,7 +184,7 @@ Component({
let _this = this
query
.selectAll('.img-item')
.selectAll('.img-items')
.boundingClientRect(react => {
react.forEach((item, index) => {
//44 tab的高度
......@@ -171,9 +201,11 @@ Component({
// },500)
},
// 1.3查看活动详情按钮
checkActive() {
let { activeUrl } = this.data
wx.$router.jumpH5(activeUrl);
checkActive(e) {
// let { activeUrl } = this.data
// wx.$router.jumpH5(activeUrl);
let { url } = e.currentTarget.dataset
wx.$router.jumpH5(url);
},
onClickTab(event) {
......
......@@ -78,6 +78,10 @@ page {
}
.prod-detail {
.img-items {
width: 100%;
position: relative;
}
.occupancy {
height: 120rpx;
......@@ -85,6 +89,7 @@ page {
.img-item {
position: relative;
width: 100%;
}
.phone {
......@@ -108,6 +113,9 @@ page {
width: 100%;
text-align: center;
position: absolute;
// bottom: 94rpx;
// right: 60rpx;
// font-size: 24rpx;
bottom: 64rpx;
right: 0;
font-weight: 600;
......@@ -115,7 +123,6 @@ page {
color: #3666FE;
text-decoration: underline;
}
.crowd-video {
width: calc(100% - 64rpx);
height: 386rpx;
......@@ -238,6 +245,11 @@ page {
height: 490rpx;
}
.img-item33 {
width: 100%;
height: 2002rpx;
}
.img-item46 {
width: 100%;
height: 1684rpx;
......@@ -287,6 +299,24 @@ page {
width: 100%;
height: 428rpx;
}
.img-item40 {
height: 1564rpx;
}
.img-item41 {
height: 1144rpx;
}
.img-item42 {
height: 1148rpx;
}
.img-item43 {
height: 3504rpx;
}
.img-item44 {
height: 3188rpx;
}
.img-item45 {
height: 1092rpx;
}
}
}
......@@ -340,4 +370,4 @@ page {
height: 4rpx !important;
background: #3666fe;
}
}
}
\ No newline at end of file
<!-- packagesList/pages/productDetail/components/proDetail/proDetail.wxml -->
<view class="view-prod custom-class">
<view class="pro-head calc-wrap">
<!-- 有视频 -->
<video class="frame" id="video" wx:if="{{actNum != 2}}" src="{{prodItemVideo.videoUrl}}" bindplay="handleVideoPlay" data-attr="crowdVideoCtx"/>
<image class="no-video" wx:if="{{actNum == 2}}" src="{{prodItemVideo.posterUrl}}?v={{img_version}}" />
<!-- 产品详情是视频 -->
<!-- mediaType: 1-图片,2-视频 -->
<video class="frame" id="video" wx:if="{{proDetail.mediaType == '2'}}" src="{{proDetail.vedioUrl}}" bindplay="handleVideoPlay" data-attr="crowdVideoCtx" />
<!-- 产品详情是图片 -->
<image class="no-video" wx:if="{{proDetail.mediaType == '1'}}" src="{{proDetail.imageUrl}}?v={{img_version}}" />
<!-- 标题+视频时展示观看人数 -->
<view class="title-wrap">
<view class="title">{{prodItemVideo.name}}</view>
<image class="check" wx:if="{{actNum != 2}}" src="{{IMG_URL}}index/poster/check.png?v={{img_version}}" />
<view class="num" wx:if="{{actNum != 2}}">{{prodItemVideo.view}}</view>
</view>
<view class="title">{{proDetail.title}}</view>
<image class="check" wx:if="{{proDetail.mediaType != '1'}}" src="{{IMG_URL}}index/poster/check.png?v={{img_version}}" />
<view class="num" wx:if="{{proDetail.mediaType != '1'}}">{{proDetail.view}}</view>
</view>
</view>
<view class="tab-wrap calc-wrap">
<van-tabs sticky bind:click="onClickTab" active="{{tabAct}}">
<van-tab wx:for="{{tabList}}" title="{{item}}" wx:key="idnex" />
<van-tab wx:for="{{proDetail.detailList}}" title="{{item.name}}" wx:key="idnex" />
<!-- <van-tab title="合作案例" />
<van-tab title="合作方式" />
<van-tab title="适配产品" /> -->
</van-tabs>
</view>
<view class="prod-detail">
<block wx:for="{{productImgs}}" wx:key="index">
<image bindload="loadImg" data-len="{{ productImgs.length}}" webp wx:if="{{ index < 3}}" webp mode="widthFix" class="img-item {{item.className?item.className:''}}" src="{{item.url?item.url:item}}?v={{img_version}}">
<!-- <block wx:if="{{ index == 0}}">
<view class="phone" bindtap="phoneCall" data-phone="{{sharephone}}">
<block wx:for="{{proDetail.detailList}}" wx:key="index">
<image webp bindload="loadImg" data-len="{{ proDetail.detailList.length}}" mode="widthFix" class="img-items" src="{{item.posterUrl}}?v={{img_version}}" bindlongpress="handleLongPress" data-item="{{item}}">
<!-- 第一张图的点击拨打电话事件 -->
<block wx:if="{{ index == 0}}">
<view class="phone" bindtap="phoneCall" data-phone="{{proDetail.phone}}">
<image src="{{IMGURL}}share-phone.png?v={{img_version}}" class="icon"></image>
<glsx-image webp src="index/phone.png" class="icon" />
请联系我
<view style="color:#3666fe">{{sharephone}}</view>
<view style="color:#3666fe">{{proDetail.phone}}</view>
</view>
</block> -->
<!-- 查看活动那个详情 1.3才有 -->
<block wx:if="{{ index == 0 && actNum == 3 && activeUrl}}">
<view class="check-act" bindtap="checkActive">点击查看活动页面</view>
</block>
<!-- 如果有活动跳转 -->
<!-- 按钮点击事件 buttonClickEvent:1-无 2-有 -->
<block wx:if="{{ item.buttonEventType == 2 }}">
<view class="check-act" bindtap="checkActive" data-url="{{item.buttonEventUrl}}">{{item.buttonEventName}}</view>
</block>
<!-- 获取更多详情 -->
<block wx:if="{{ index == 2 && showLeftFlag}}">
<!-- <block wx:if="{{ index == 2 && showLeftFlag}}">
<button class="more-btn" data-index="{{index}}" bindgetphonenumber="getUserInfo" open-type="getPhoneNumber">
点击查看更多详情
</button>
</block> -->
<!-- 如果有视频 -->
<block wx:if="{{ item.videoUrl }}">
<video class="crowd-video" id="crowd-video" bindplay="handleVideoPlay" data-attr="videoCtx" src="{{item.videoUrl}}" />
</block>
</image>
<image bindlongpress="handleLongPress" data-actnum="{{actNum}}" data-index="{{index}}" bindload="loadImg" data-len="{{ productImgs.length}}" webp wx:if="{{ index >= 3 && !showLeftFlag}}" mode="widthFix" webp class="img-item {{item.className?item.className:''}}" src="{{item.url?item.url:item}}?v={{img_version}}">
<!-- 众筹-视频 -->
<block wx:if="{{ index == 3 && actNum == 3 }}">
<video class="crowd-video" id="crowd-video" bindplay="handleVideoPlay" data-attr="videoCtx" src="{{videoBaseUrl}}video/crowd-detail.mp4" />
</block>
</image>
</block>
<view class="occupancy" wx:if="{{!isShare}}">
<!-- padding底部 占位元素 -->
......
......@@ -6,7 +6,7 @@ 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";
Page({
/**
* 页面的初始数据
......@@ -28,7 +28,8 @@ Page({
// phone: '', //授权手机号
prodItemVideo:'', //选中的场景下的video的第一个
activeUrl:'', // 1.3场景才有的活动配置
sharephone:'' //主要微信用户,服务商
sharephone:'', //主要微信用户,服务商
hasProduct: true
},
// 计算属性
computed: {
......@@ -55,38 +56,54 @@ Page({
* 生命周期函数--监听页面加载
* 分享出去,或扫码进来
*/
onLoad(options) {
async onLoad(options) {
this.getActiveApiFn()
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 proData = await this.getProductDetail(id);
if (!proData) {
this.setData({
isLoadding: false,
hasProduct: false
})
return
}
if(isShare){
wx.hideHomeButton()
}
let sceneObj = {}
if(actNum != 99) {
sceneObj = scenceList.find(item => item.sceneid == actNum)
} else {
sceneObj = productData[99].find(item => item.sceneCode == sceneCode)
}
let proInfo = sceneObj?.productList.find(item => item.id == activeNavIdx)
this.setData({
actNum, //选中的场景下标/sceneid
activeNavIdx, //选中的产品
productData: proData,
isShare,
sharephone
});
// let sceneObj = {}
// if(actNum != 99) {
// sceneObj = scenceList.find(item => item.sceneid == actNum)
// } else {
// sceneObj = productData[99].find(item => item.sceneCode == sceneCode)
// }
// let proInfo = sceneObj?.productList.find(item => item.id == activeNavIdx)
// this.setData({
// actNum, //选中的场景下标/sceneid
// activeNavIdx, //选中的产品
// isShare,
// sharephone
// });
let wx_user_info = wx.$storage.get('wx_user_info'),
shareOpenId = wx_user_info.openId || ''
setTimeout(() => {
utils.setNavigationBarTitle(proInfo?.productName)
utils.setNavigationBarTitle(proData?.proName)
},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}`
console.log(this.shareQuery, 'onload----')
this.shareAppMessage = {
title:this.shareTitle,
......@@ -96,31 +113,44 @@ Page({
},
//接受跳转的路由参数(小程序页面跳转)
onRoute(options) {
async onRoute(options) {
if (!options || utils.isEmptyObj(options)) return
let { actNum = 0, activeNavIdx = 0,phone=123, sceneid99=0 } = options;
let data = actNum != 99 ? scenceList : productData[actNum]
let value = actNum != 99 ? actNum : sceneid99
let sceneObj = data.find(item => item.sceneid == value)
let proInfo = sceneObj?.productList.find(item => item.id == activeNavIdx)
console.log(actNum, activeNavIdx, '选中的场景下标')
// let { actNum = 0, activeNavIdx = 0,phone=123, sceneid99=0 } = options;
// let data = actNum != 99 ? scenceList : productData[actNum]
// let value = actNum != 99 ? actNum : sceneid99
// let sceneObj = data.find(item => item.sceneid == value)
// let proInfo = sceneObj?.productList.find(item => item.id == activeNavIdx)
// console.log(actNum, activeNavIdx, '选中的场景下标')
// this.setData({
// actNum, //选中的场景下标
// activeNavIdx, //选中的产品
// sharephone:phone //联系电话 (登陆的用户)
// });
let { phone=123, id, sceneCode } = options;
let proData = await this.getProductDetail(id);
if (!proData) {
this.setData({
isLoadding: false,
hasProduct: false
})
return
}
this.setData({
actNum, //选中的场景下标
activeNavIdx, //选中的产品
sharephone:phone //联系电话 (登陆的用户)
sharephone:phone, //联系电话 (登陆的用户)
productData: proData,
});
// 设置转发标题
let userInfoObj = wx.$storage.get("userInfo");
// #服务商账号#取该分享者商户的联系人字段,无则取商户简称,无则取商户全称
let name = userInfoObj.merchantName;
this.shareTitle = `${name}给你分享一个活动${proInfo?.productName},戳我参与~`;
this.shareTitle = `${name}给你分享一个活动${proData?.proName},戳我参与~`;
//分享数据
// let item = this.data.proInfo || {}
setTimeout(() => {
utils.setNavigationBarTitle(proInfo?.productName)
utils.setNavigationBarTitle(proData?.proName)
},100)
//分享人openId
......@@ -128,7 +158,8 @@ Page({
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 = `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}`
console.log(this.shareQuery, 'onrouter----')
this.shareAppMessage = {
title:this.shareTitle,
......@@ -137,6 +168,18 @@ Page({
}
},
// 获取产品详情
getProductDetail(id) {
return new Promise((resolve) => {
let _data;
BusassistantApi.getDiscoverDetail({id}).then((res) => {
console.log(res);
_data = res.data;
resolve(_data);
});
});
},
//获取配置url
async getActiveApiFn(){
let {code,data} = await getActiveApi()
......
<!--packagesList/pages/productDetail/productDetail.wxml-->
<pro-detail id="pro-detail" showLeftFlag="{{showLeftFlag}}" sharephone="{{sharephone}}" actNum="{{actNum}}" activeNavIdx="{{activeNavIdx}}" activeUrl="{{activeUrl}}"></pro-detail>
<!-- <pro-detail id="pro-detail" showLeftFlag="{{showLeftFlag}}" sharephone="{{sharephone}}" actNum="{{actNum}}" activeNavIdx="{{activeNavIdx}}" activeUrl="{{activeUrl}}"></pro-detail> -->
<block wx:if="{{!hasProduct}}">
<no-product></no-product>
</block>
<block wx:else>
<pro-detail id="pro-detail" showLeftFlag="{{showLeftFlag}}" sharephone="{{sharephone}}" proDetail="{{productData}}"></pro-detail>
<!-- <block wx:if="{{showLeftFlag}}">
<button class="more-btn" bindgetphonenumber="getUserInfo" open-type="getPhoneNumber">
......@@ -7,4 +12,5 @@
</button>
</block> -->
<!-- 申请按钮 不是分享出去的显示按钮 -->
<apply-button wx:if="{{!isShare}}" downShow="{{false}}"></apply-button>
\ No newline at end of file
<apply-button wx:if="{{!isShare}}" downShow="{{false}}"></apply-button>
</block>
\ No newline at end of file
// packagesList/pages/videoDetal/videoDetal.js
import { IMG_URL } from "~/utils/constantData.js";
import {
IMG_URL
} from "~/utils/constantData.js";
// import { senceData, productData } from "../constant/senceData";
import { senceData, productData } from "~/pages/tab/discovery/constant/senceData";
import {
senceData,
productData
} from "~/pages/tab/discovery/constant/senceData";
// 导入方法
import { behavior as computedBehavior } from "~/utils/lib/miniprogram-computed";
import {
behavior as computedBehavior
} from "~/utils/lib/miniprogram-computed";
import utils from '~/utils/util.js'
import BusassistantApi from "~/api/busassistantApi/index";
Page({
noPageAuth: true,
/**
* 页面的初始数据
*/
data: {
senceData,
productData,
// senceData,
// productData,
hasProduct: true,
videoData: {},
videoId: '',
videoItem: {
index: 0,
videoList: [],
videoUrl: '',
isShare: false,//是否是被分享出去
isShare: false, //是否是被分享出去
tabsActive: 1
},
videoObj: {},
......@@ -27,112 +38,181 @@ Page({
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
wx.$router.getData(res => {
async onLoad(options) {
// wx.$router.getData(res => {
// this.setData({
// videoItem: res
// })
// })
// if (!utils.isEmptyObj(options)) {
// let { isShare, videoIndex, tabActive, sceneCode, leftMenuIndex = 0, tabsActive } = options;
// let item = this.data.productData[tabActive].find(item => item.sceneCode == sceneCode)
// let videoList = []
// let videoUrl = ''
// let videoObj = {}
// if (tabsActive == '3') {
// videoList = item?.operationVideoList
// videoUrl = item?.operationVideoList[videoIndex]?.videoUrl
// videoObj = item?.operationVideoList[videoIndex]
// }else{
// videoList = item?.videoList,
// videoUrl = item.videoList[videoIndex]?.videoUrl
// videoObj = item?.videoList[videoIndex]
// }
// let videoItem = {
// index: videoIndex,
// videoList: videoList,
// videoUrl: videoUrl,
// tabsActive: tabsActive
// }
// this.setData({
// videoItem: videoItem,
// isShare: isShare,
// videoObj: videoObj,
// leftMenuIndex: leftMenuIndex
// })
// this.setpagesTitle()
// this.shareDataFn(options)
// }
if (utils.isEmptyObj(options)) return
const {
id,
isShare
} = options;
let videoData = await this.getDetailWithLike(id);
if (!videoData) {
this.setData({
videoItem: res
isLoadding: false,
hasProduct: false
})
})
if (!utils.isEmptyObj(options)) {
let { isShare, videoIndex, tabActive, sceneCode, leftMenuIndex = 0, tabsActive } = options;
let item = this.data.productData[tabActive].find(item => item.sceneCode == sceneCode)
let videoList = []
let videoUrl = ''
let videoObj = {}
if (tabsActive == '3') {
videoList = item?.operationVideoList
videoUrl = item?.operationVideoList[videoIndex]?.videoUrl
videoObj = item?.operationVideoList[videoIndex]
}else{
videoList = item?.videoList,
videoUrl = item.videoList[videoIndex]?.videoUrl
videoObj = item?.videoList[videoIndex]
}
let videoItem = {
index: videoIndex,
videoList: videoList,
videoUrl: videoUrl,
tabsActive: tabsActive
}
this.setData({
videoItem: videoItem,
isShare: isShare,
videoObj: videoObj,
leftMenuIndex: leftMenuIndex
})
this.setpagesTitle()
this.shareDataFn(options)
return
}
this.setData({
videoData,
videoId: id,
isShare
});
this.setpagesTitle(videoData.title)
this.changeShareData()
},
//接受跳转的路由参数(小程序页面跳转)
onRoute(options) {
async onRoute(options) {
console.log(options);
if (!options || utils.isEmptyObj(options) || options.isShare) return
let { scenIndex, videoList, index, leftMenuIndex = 0 } = options
options.videoIndex = index
options.tabActive = scenIndex
// let { scenIndex, videoList, index, leftMenuIndex = 0 } = options
// options.videoIndex = index
// options.tabActive = scenIndex
// this.setData({
// videoObj: videoList[index],
// leftMenuIndex: leftMenuIndex
// })
let {
id,
sceneCode
} = options;
let videoData = await this.getDetailWithLike(id);
if (!videoData) {
this.setData({
isLoadding: false,
hasProduct: false
})
return
}
this.setData({
videoObj: videoList[index],
leftMenuIndex: leftMenuIndex
})
this.setpagesTitle()
this.shareDataFn(options)
},// 分享数据函数
videoData,
isLoadding: false,
videoId: id,
sceneCode
});
this.setpagesTitle(videoData.title)
this.changeShareData()
},
// 获取视频详情
getDetailWithLike(id) {
return new Promise((resolve) => {
let _data;
BusassistantApi.getDetailWithLike({
id
}).then((res) => {
console.log(res);
_data = res.data;
resolve(_data);
});
});
},
shareDataFn(options) {
if (!options || utils.isEmptyObj(options)) return
let { tabActive, videoIndex, tabsActive } = options
let {
tabActive,
videoIndex,
tabsActive
} = options
this.setData({
tabsActive,
tabActive: tabActive,
videoIndex: videoIndex,
},()=>{
this.changeShareData(options)
}, () => {
this.changeShareData(options)
});
},
changeShareData(options) {
let { senceData, tabActive, videoIndex, videoObj, leftMenuIndex = 0, tabsActive } = this.data
changeShareData() {
let {
title
} = this.data.videoData
let {
sceneCode,
videoId
} = this.data
// // 设置转发标题
// let userInfoObj = wx.$storage.get("userInfo");
// // #服务商账号#取该分享者商户的联系人字段,无则取商户简称,无则取商户全称
// let name = userInfoObj.merchantName;
this.shareTitle = `给您分享一个${videoObj.name} 视频`;
this.shareTitle = `给您分享一个${title} 视频`;
//分享的数据
let senceItem = productData[tabActive][leftMenuIndex]
this.shareQuery = `sceneCode=${senceItem?.sceneCode}&isShare=${true}&tabActive=${tabActive}&videoIndex=${videoIndex}&leftMenuIndex=${leftMenuIndex}&tabsActive=${tabsActive}`
// let senceItem = productData[tabActive][leftMenuIndex]
this.shareQuery = `sceneCode=${sceneCode}&isShare=${true}&id=${videoId}`
this.shareAppMessage = {
title:this.shareTitle,
path: `/${this.route}?${this.shareQuery}`,
query:this.shareQuery
title: title,
path: `/${this.route}?${this.shareQuery}`,
query: this.shareQuery
}
},
},
// 切换视频
chooseVideo(e) {
let { detail } = e
const {
title,
id
} = e.detail
this.setData({
videoIndex: detail.index,
['videoItem.index']: detail.index,
['videoItem.videoUrl']: detail?.info?.videoUrl,
videoObj: detail?.info
videoId: id
})
this.setpagesTitle()
this.setpagesTitle(title)
this.changeShareData()
},
// 下载视频
// 下载视频
downVideo() {
const _this = this
let { videoObj } = this.data
let url = videoObj.videoUrl
// let { videoObj } = this.data
// let url = videoObj.videoUrl
let {
videoId
} = this.data
const {
vedioUrl
} = this.data.videoData.likeList.find(item => item.id == videoId)
wx.getSetting({
success: (res)=> {
if(res.authSetting['scope.writePhotosAlbum']===false){
success: (res) => {
if (res.authSetting['scope.writePhotosAlbum'] === false) {
_this.setData({
showAuth: true
})
}else{
} else {
wx.$api.showToast('正在下载视频...')
wx.downloadFile({
url: url,
url: vedioUrl,
success(res) {
if (res.statusCode === 200) {
wx.saveVideoToPhotosAlbum({
......@@ -142,7 +222,9 @@ Page({
wx.$api.showToast('下载成功!')
}, 2000)
},
fail({ errMsg }) {
fail({
errMsg
}) {
_this.setData({
showAuth: errMsg == "saveVideoToPhotosAlbum:fail auth deny",
})
......@@ -167,16 +249,16 @@ Page({
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() { },
onReady() {},
//设置标题
setpagesTitle() {
setpagesTitle(title) {
//设置标题
let { videoObj } = this.data
setTimeout(() => {
utils.setNavigationBarTitle(videoObj.name)
utils.setNavigationBarTitle(title)
}, 100)
},
/**
* 生命周期函数--监听页面显示
*/
......@@ -217,7 +299,7 @@ Page({
*/
onShareAppMessage() {
return {
...this.shareAppMessage
...this.shareAppMessage
}
}
})
\ No newline at end of file
<!--packagesList/pages/videoDetal/videoDetal.wxml-->
<gl-video-detail list="{{videoItem.videoList}}" index="{{videoItem.index}}" bindchooseVideo="chooseVideo"></gl-video-detail>
<!-- <gl-video-detail list="{{videoItem.videoList}}" index="{{videoItem.index}}" bindchooseVideo="chooseVideo"></gl-video-detail> -->
<block wx:if="{{!hasProduct}}">
<no-product></no-product>
</block>
<block wx:else>
<gl-video-detail list="{{videoData}}" bind:chooseVideo="chooseVideo"></gl-video-detail>
<!-- 申请按钮 -->
<apply-button wx:if="{{!isShare}}" bindvideodown="downVideo"></apply-button>
<block wx:if="{{showAuth}}">
<authorize title="下载前需要获取您的‘添加到相册’权限,是否打开授权设置?" scopeType="writePhotosAlbum" buttonType="openSetting" bindfail="authFail" bindsuccess="authSuccess" show="{{showAuth}}"></authorize>
</block>
</block>
\ No newline at end of file
// pages/tab/output/output.js
const navStyle = "background-color: transparent;";
import { subscriptionBannerUrl, subscriptionSystemData } from './constant/systemData'
import {scenceList} from "./constant/data"
// import { subscriptionBannerUrl, subscriptionSystemData } from './constant/systemData'
// import {scenceList} from "./constant/data"
import ActivityApi from "~/api/activityApi/index";
import {getActivityRecord} from '~/api/viewprod'
import { IMG_VERSION } from "~/utils/constantData";
......@@ -17,8 +17,8 @@ Component({
navList: ["增值服务", "客户数字化"],
// myTabIdx: 0,
IMG_URL,
subscriptionBannerUrl: Object.freeze(subscriptionBannerUrl),
subscriptionSystemData: Object.freeze(subscriptionSystemData),
// subscriptionBannerUrl: Object.freeze(subscriptionBannerUrl),
// subscriptionSystemData: Object.freeze(subscriptionSystemData),
activityList: [],
resScenceList: [],
curTabIdx: 0,
......@@ -29,19 +29,20 @@ Component({
navStyle,
sceneCodeList: [],
showPage: false,
systemData: [],
productData: [],
},
methods: {
// 产品点击事件
proClick(e) {
let { detail } = e
console.log(e.detail)
//登录的用户手机号
let userInfo = wx.$storage.get("userInfo");
console.log(detail.scenIndex)
const { info, sceneCode } = e.detail
let obj = {
actNum: isNaN(detail.scenIndex) ? 99 : detail.scenIndex, //选中的场景 没有就是订阅系统的
sceneid99: detail.sceneid,
activeNavIdx: detail.id, //选中的产品,
phone: userInfo.phone
phone: userInfo.phone,
id:info.id,
sceneCode
}
wx.$router.go('/packagesList/packageDiscovery/pages/productDetail/productDetail', obj)
},
......@@ -53,26 +54,11 @@ Component({
},
// 视频点击事件
videoClick(e) {
const { name } = e.target.dataset
const {
index,
info: { videoUrl },
scenIndex,
list,
tabsActive
} = e.detail
const videoList = list
let userInfo = wx.$storage.get("userInfo")
const { info, sceneCode } = e.detail
const obj = {
index,
videoList,
scenIndex: isNaN(scenIndex) ? 99 : scenIndex,
videoUrl: videoUrl,
phone: userInfo.phone,
tabsActive
}
if (name == '客户数字化') {
obj.leftMenuIndex = leftMenuIndex
id:info.id,
}
wx.$router.go('/packagesList/packageDiscovery/pages/videoDetail/videoDetail', obj)
},
......@@ -87,19 +73,29 @@ Component({
})
},
senceClick(e) {
const { scenIndex } = e.detail
wx.$router.go('/packagesList/packageDiscovery/pages/scenarioDetail/scenarioDetail', {
actNum: scenIndex
})
// const { scenIndex } = e.detail
// wx.$router.go('/packageStoreAssistant/packageDiscovery/pages/scenarioDetail/scenarioDetail', {
// actNum: scenIndex
// })
// 如果没有sceneCode,或者没有配置banner跳转 isBannerLink 2-没有配置 1-有配置
if (!e.detail.sceneCode || e.detail.isBannerLink == 2) return
const { hasPhoneNumber } = this.data
// 获取场景
let systemItem = this.data.systemData.find(item => item.sceneCode == e.detail.sceneCode)
let productItem = this.data.productData.find(item => item.sceneCode == e.detail.sceneCode)
const id = systemItem?.productList[0].id || productItem?.productList[0].id
if (!id) return
console.log(123456)
wx.$router.go('/packagesList/packageDiscovery/pages/scenarioDetail/scenarioDetail', { hasPhoneNumber, id, sceneCode: e.detail.sceneCode })
},
activityClick(e) {
const id = e.detail
wx.$router.go(
"/packagesList/packageDiscovery/pages/activityDetail/activityDetail",
{id}
);
},
const id = e.detail
wx.$router.go(
"/packagesList/packageDiscovery/pages/activityDetail/activityDetail",
{id}
);
},
// 获取全部活动列表
getActivityRecord() {
......@@ -124,16 +120,25 @@ Component({
});
},
onLoad(option) {
const app = getApp()
app.getBaseData().then(res => {
const productData = res[0].list
const systemData = res[1].list
this.getSceneData(productData)
this.setData({
systemData
})
})
// this.setData({
// tabIndex: option?.tabIndex || 0
// })
this.getActivityRecord()
this.getSceneData()
this.getActivityRecord()
},
emitUserInfo(options){
console.log(options)
},
getSceneData() {
getSceneData(list) {
console.log(list, 'list')
const { merchantId } = wx.$storage.get("userInfo");
wx.showLoading({
title: "加载中...",
......@@ -143,7 +148,7 @@ Component({
})
.then((res) => {
wx.hideLoading();
let resScenceList = [];
let productData = []
if(res.code==21){
wx.$router.reLaunch('/packageStoreAssistant/packageAuth/pages/authentication/login/login')
return;
......@@ -179,13 +184,16 @@ Component({
openList.push(item.sceneCode)
}
})
console.log(scenceList,'scenceListscenceList')
resScenceList = scenceList.filter(item => openList.includes(item.sceneCode))
console.log(openList,'openList')
productData = list.filter(item => openList.includes(item.sceneCode))
console.log(productData)
}
this.setData({
showPage: true,
resScenceList,
curTabId: resScenceList?.[this.data.curTabIdx]?.sceneid || 0
productData,
curTabId: productData?.[this.data.curTabIdx]?.sceneid || 0
},()=>{
console.log(productData,'productData111')
});
})
.catch((err) => {
......
......@@ -7,11 +7,13 @@
<view class="topBg" style="height:{{headerHeight}}px; background-image: url('https://img02.glsx.com.cn/weapp/resource/miniprogram/store-assistant/mine_center_bg.png?v=1.0.3')"></view>
<!-- 系统订阅 -->
<block wx:if="{{myTabIdx == 1}}">
<gl-subscription list="{{subscriptionSystemData}}" bindmenuClick="sysMenuClick" bannerUrl="{{subscriptionBannerUrl}}" bind:proClick="proClick" bindcurrentScen="getCurrentScen" data-name="客户数字化" bind:videoClick="videoClick" />
<!-- <gl-subscription list="{{subscriptionSystemData}}" bindmenuClick="sysMenuClick" bannerUrl="{{subscriptionBannerUrl}}" bind:proClick="proClick" bindcurrentScen="getCurrentScen" data-name="客户数字化" bind:videoClick="videoClick" /> -->
<gl-subscription list="{{systemData}}" bindmenuClick="sysMenuClick" bind:proClick="proClick" data-name="客户数字化" bind:videoClick="videoClick" bindsenceClick="senceClick" />
</block>
<!-- 增值服务 -->
<block wx:if="{{myTabIdx==0 && resScenceList.length && showPage}}">
<gl-scenario discoverIndex="{{curTabIdx}}" currentScenIndex="{{curTabId}}" novideo-img="novideo-img" list="{{resScenceList}}" activityList="{{activityList}}" bindactivityClick="activityClick" bindproClick="proClick" bind:videoClick="videoClick" bindsenceClick="senceClick" activityList="{{activityList}}" bindleftClick="leftClick"></gl-scenario>
<block wx:if="{{myTabIdx==0}}">
<!-- <gl-scenario discoverIndex="{{curTabIdx}}" currentScenIndex="{{curTabId}}" novideo-img="novideo-img" list="{{resScenceList}}" activityList="{{activityList}}" bindactivityClick="activityClick" bindproClick="proClick" bind:videoClick="videoClick" bindsenceClick="senceClick" activityList="{{activityList}}" bindleftClick="leftClick"></gl-scenario> -->
<gl-scenario list="{{productData}}" activityList="{{activityList}}" novideo-img="novideo-img" bindactivityClick="activityClick" bindproClick="proClick" bind:videoClick="videoClick" bindsenceClick="senceClick" bindleftClick="leftClick" bindcurrentScen="getCurrentScen"></gl-scenario>
</block>
<!-- 测算按钮 -->
<block wx:if="{{myTabIdx==1 || myTabIdx==0 && resScenceList.length && showPage}}">
......@@ -20,7 +22,7 @@
</view>
</block>
<!-- 增值服务无数据时展示 -->
<block wx:if="{{myTabIdx==0 && resScenceList.length<=0 && showPage}}">
<block wx:if="{{myTabIdx==0 && productData.length<=0 && showPage}}">
<view class="emptyData" style="margin-top: {{headerHeight+32}}px;">
<glsx-image webp src="store-assistant/toLink.png" class="nodata_icon"></glsx-image>
<view class="tip">
......
......@@ -120,7 +120,7 @@
}
},
"setting": {
"urlCheck": true
"urlCheck": false
},
"projectname": "store-assistant-assemble"
}
\ No newline at end of file
......@@ -21,7 +21,7 @@ const systemInfo = wx.getSystemInfoSync()
const manual = false
const release = false
let index = 2
let index = 1
// 判断小程序环境
// develop:开发版(正常开发工具,测试时)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!