Commit 02b60c9b by 胡悦

提交

1 parent 913b05cf
...@@ -207,5 +207,9 @@ App({ ...@@ -207,5 +207,9 @@ App({
} }
}) })
}, },
globalData: {} globalData: {},
onPageNotFound(res) {
console.log(res, '不存在的页面')
},
}) })
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
</block> </block>
</view> </view>
<view wx:if="{{type == 'scenario'}}" class="isFullSucreen video-btn"> <view wx:if="{{type == 'scenario'}}" class="isFullSucreen video-btn">
<view class="forward-box"> <button class="forward-box forward_box" open-type="share">
<image class="icon-forward" webp src="{{IMGURL}}home/icon-forward.png"></image> <image class="icon-forward" webp src="{{IMGURL}}home/icon-forward.png"></image>
<view class="forward-text" bindtap="forward">转发</view> <view class="forward-text" bindtap="forward">转发</view>
</view> </button>
<button wx:if="{{hasPhone}}" class="phoneNumber" bindtap="jump">合作申请1</button> <button wx:if="{{hasPhone}}" class="phoneNumber" bindtap="jump">合作申请1</button>
<button wx:else class="phoneNumber" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">合作申请</button> <button wx:else class="phoneNumber" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">合作申请</button>
</view> </view>
......
...@@ -11,7 +11,20 @@ Page({ ...@@ -11,7 +11,20 @@ Page({
}, },
toActivity(){ toActivity(){
// wx.$util.getMockConfig().then(({businessParams, businessappId}) => {
// console.log(businessParams, businessappId)
wx.navigateToMiniProgram({
appId: 'wx1cf40dc91c28a7fd',
path: 'pages/crowdfunding/index/index',
extraData: {
id: this.data.activityInfo.id
},
envVersion: 'trial',
success(res) {
// 打开成功
}
})
// })
}, },
/** /**
......
...@@ -17,11 +17,11 @@ ...@@ -17,11 +17,11 @@
<view class="activity-info"> <view class="activity-info">
<view class="activity-item"> <view class="activity-item">
<glsx-image custom-class="activity-icon" webp src="image/activity/icon-company.png"></glsx-image> <glsx-image custom-class="activity-icon" webp src="image/activity/icon-company.png"></glsx-image>
<view class="text">{{activityInfo.merchantName}}</view> <view class="text">{{activityInfo.sponsorName}}</view>
</view> </view>
<view class="activity-item"> <view class="activity-item">
<glsx-image custom-class="activity-icon" webp src="image/activity/icon-address.png"></glsx-image> <glsx-image custom-class="activity-icon" webp src="image/activity/icon-address.png"></glsx-image>
<view class="text">兰州鑫通汽车销售有限公司</view> <view class="text">{{activityInfo.address}}</view>
</view> </view>
<view class="activity-item"> <view class="activity-item">
<glsx-image custom-class="activity-icon" webp src="image/activity/icon-time.png"></glsx-image> <glsx-image custom-class="activity-icon" webp src="image/activity/icon-time.png"></glsx-image>
......
...@@ -13,6 +13,7 @@ import { ...@@ -13,6 +13,7 @@ import {
import utils from '~/utils/util' import utils from '~/utils/util'
import {entmicroApi} from "~/api/api" import {entmicroApi} from "~/api/api"
import {trackData} from '../../../utils/data' import {trackData} from '../../../utils/data'
import Draw from '../../../utils/Draw'
Page({ Page({
...@@ -77,60 +78,16 @@ Page({ ...@@ -77,60 +78,16 @@ Page({
// console.log( options); // console.log( options);
if (!options || utils.isEmptyObj(options)) return if (!options || utils.isEmptyObj(options)) return
let { let {
actNum = 0, activeNavIdx = 0, phone, cardInfo actNum = 0, activeNavIdx = 0, phone, hasPhoneNumber
} = options } = options
console.log(options) console.log(options)
this.setData({ this.setData({
actNum, //选中的场景下标 actNum, //选中的场景下标
activeNavIdx, //选中的产品 activeNavIdx, //选中的产品
sharephone: phone, //联系电话 (登陆的用户) sharephone: phone, //联系电话 (登陆的用户)
cardInfo, hasPhoneNumber:hasPhoneNumber
hasPhoneNumber:options.hasPhoneNumber
}) })
wx.$Track.sendTrack(this.data.trackList[actNum][activeNavIdx]) wx.$Track.sendTrack(this.data.trackList[actNum][activeNavIdx])
// console.log(this.data.senceData, 'senceData-----')
const senceList = productData[this.data.actNum].filter(item => item.name != '全部')
for (let i = 0; i < senceList.length; i++) {
let item = senceList[i]
let proIdList = senceList[i]?.productList.map(k => k.id)
if (proIdList.includes(activeNavIdx)) {
let proInfo = item.productList.find(k => k.id == activeNavIdx)
this.setData({
proInfo,
sceneCode: item.sceneCode
})
break
}
}
// console.log(this.data.proInfo, '---------proInfo')
// 设置转发标题
let userInfoObj = wx.$storage.get("userInfo")
// #服务商账号#取该分享者商户的联系人字段,无则取商户简称,无则取商户全称
let name = userInfoObj.merchantName
this.shareTitle = `${name}给你分享一个活动${this.data.proInfo.productName},戳我参与~`
//分享数据
let item = this.data.proInfo || {}
// console.log('title2',item.productName)
setTimeout(() => {
utils.setNavigationBarTitle(item.productName)
}, 100)
//分享人openId
let wx_user_info = wx.$storage.get('wx_user_info'),
shareOpenId = wx_user_info.openId || ''
this.shareQuery = `sceneCode=${this.data.sceneCode}&productCode=${item?.productCode}&isShare=${true}&productDesc=${item?.productName}&category=${item?.category}&actNum=${actNum}&activeNavIdx=${activeNavIdx}&sharephone=${phone}`
this.shareTrackData = {
sceneCode: this.data.sceneCode,
productCode: item?.productCode,
productName: item?.productName,
category: item?.category,
productDesc: item?.productName,
shareOpenId: shareOpenId
}
}, },
onPageScroll: (function () { onPageScroll: (function () {
let timer = null; let timer = null;
...@@ -177,58 +134,13 @@ Page({ ...@@ -177,58 +134,13 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
this.getActiveApiFn() if (options && options.cardId) {
// 是否已经查看详情 // const options = wx.getEnterOptionsSync()
this.isgetAuthphone() wx.$trackData = options.query
if (!options || utils.isEmptyObj(options)) return wx.$storage.set('scene', options)
let { actNum = 0, activeNavIdx = 0, isShare = true,sharephone = 123 } = options this.getCardDetail()
if(isShare){ } else {
wx.hideHomeButton() this.getCardDetail()
}
this.setData({
actNum,
activeNavIdx,
isShare,
sharephone
});
let wx_user_info = wx.$storage.get('wx_user_info'),
shareOpenId = wx_user_info.openId || ''
// console.log('shareOpenId: ', shareOpenId);
// &shareOpenId=${shareOpenId}
const senceList = productData[this.data.actNum].filter(item => item.name != '全部')
for (let i = 0; i < senceList.length; i++) {
let item = senceList[i]
let proIdList = senceList[i]?.productList.map(k => k.id)
if (proIdList.includes(activeNavIdx)) {
let proInfo = item.productList.find(k => k.id == activeNavIdx)
console.log(proInfo)
this.setData({
proInfo,
sceneCode: item.sceneCode
})
break
}
}
//分享数据
let item = this.data.proInfo || {}
setTimeout(() => {
utils.setNavigationBarTitle(item?.productName)
},100)
this.shareQuery = `sceneCode=${this.data.sceneCode}&productCode=${item?.productCode}&isShare=${true}&productDesc=${item?.productName}&category=${item?.category}&actNum=${actNum}&activeNavIdx=${activeNavIdx}&sharephone=${sharephone}`
this.shareTrackData = {
sceneCode: this.data.sceneCode,
productCode: item?.productCode,
productName: item?.productName,
category: item?.category,
productDesc: item?.productName,
shareOpenId:shareOpenId
// actNum,
// activeNavIdx,
} }
}, },
...@@ -278,7 +190,16 @@ Page({ ...@@ -278,7 +190,16 @@ Page({
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage() { onShareAppMessage() {
const cardId = wx.$storage.get('scene').cardId
// merchantId 兼容旧链接
const merchant = wx.$storage.get('scene').merchant || wx.$storage.get('scene').merchantId
const shareType = 'SHARE_SCEN'
console.log('cardId', cardId, 'merchant', merchant)
return {
title: `您好,我向你推荐了广联数科${this.data.cardInfo.staffName}的智能名片~`,
imageUrl: this.data.shareImg,
path: `packagesList/pages/scenarioDetail/scenarioDetail?cardId=${cardId}&merchant=${merchant}&shareType=${shareType}`
}
}, },
// 更新手机号码 // 更新手机号码
...@@ -287,6 +208,165 @@ Page({ ...@@ -287,6 +208,165 @@ Page({
this.setData({ this.setData({
hasPhoneNumber: e.detail ? true : false hasPhoneNumber: e.detail ? true : false
}) })
},
setShareInfo(data = {}) {
const canvasWidth = 208,
canvasHeight = 166,
textBaseline = 'top'
const draw_function = new Draw(this, {
width: canvasWidth,
height: canvasHeight
// pixelRatio: 2,
// backgroundColor: '#096'
})
const drawCard = callBack => {
let index = 0
const iconWidth = 9,
iconHeight = 9,
iconX = 18,
iconY = 79,
imgList = [
{
url: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/share/bg.png',
x: 0,
y: 0,
width: canvasWidth,
height: 124
},
{
url: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/share/logo.png',
x: 15,
y: 18,
width: 152,
height: 10
},
// 头像的
{
// url: "https://img.zcool.cn/community/01e47e60ab5b4011013eaf70962e3f.jpg@520w_390h_1c_1e_2o_100sh.jpg",
url: data.image,
x: 154,
y: 36,
width: 36,
height: 36
},
{
url: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/share/icon-phone.png',
x: iconX,
y: iconY,
width: iconWidth,
height: iconHeight
},
{
url: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/share/icon-address.png',
x: iconX,
y: iconY + 13,
width: iconWidth,
height: iconHeight
},
{
url: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/share/btn.png',
x: 64,
y: 138,
width: 80,
height: 24
}
],
textList = [
{
text: data.staffName,
x: 18,
y: 40,
color: '#2D2D33',
fontWeight: 600,
fontSize: 14
},
{
text: data.operation,
x: 22 + draw_function.getTextWidth(data.staffName, 14),
y: 44,
color: '#6E6E7A',
fontWeight: 400,
fontSize: 8
},
{
text: data.staffPhone,
x: 30,
y: 80,
color: '#6E6E7A',
fontSize: 7
},
{
text: '深圳市南山区留仙大道3370号南山智园崇文园区1号楼14层',
x: 30,
y: 94,
color: '#6E6E7A',
fontSize: 7,
lineNum: 2,
width: 185,
lineHeight: 9
}
]
const drawImages = callBack => {
draw_function.drawImages(imgList[index], () => {
index += 1
if (index != imgList.length) drawImages(callBack)
else callBack()
})
}
drawImages(() => {
try {
textList.map((e, ind) => {
e.textBaseline = textBaseline
draw_function.drawText(e)
if (ind == textList.length - 1) throw true
})
} catch (error) {
draw_function.toDataURL(({ path }) => {
this.setData(
{
shareImg: path,
shareDisabled: false
},
() => {
wx.showShareMenu({
menus: ['shareAppMessage']
})
}
)
})
}
})
}
drawCard()
},
// 获取员工名片信息
getCardDetail() {
const scene = wx.$storage.get('scene')
let params = {
cardId: scene.cardId
}
console.log(params)
entmicroApi.getCardDetail(params).then(({ data, code, message }) => {
wx.hideLoading()
if (code == -1) {
wx.showToast({
title: message,
icon: 'none',
duration: 2000
})
}
const cardInfo = data || this.data.defaultInfo
console.log(data, cardInfo)
this.setData(
{
cardInfo
},
() => {
this.setShareInfo(cardInfo)
}
)
})
} }
}) })
\ No newline at end of file \ No newline at end of file
...@@ -5,6 +5,8 @@ import { senceData, productData } from "~/pages/tab/index/constant/senceData" ...@@ -5,6 +5,8 @@ import { senceData, productData } from "~/pages/tab/index/constant/senceData"
// import USERAPI from '~/api/usersApi/index' // import USERAPI from '~/api/usersApi/index'
import utils from '~/utils/util' import utils from '~/utils/util'
import {trackData} from '../../../utils/data' import {trackData} from '../../../utils/data'
import { entmicroApi } from '../../../api/api'
import Draw from '../../../utils/Draw'
// import {getActiveApi} from "~/api/viewprod" // import {getActiveApi} from "~/api/viewprod"
Page({ Page({
...@@ -30,7 +32,9 @@ Page({ ...@@ -30,7 +32,9 @@ Page({
prodItemVideo:'', //选中的场景下的video的第一个 prodItemVideo:'', //选中的场景下的video的第一个
activeUrl:'', // 1.3场景才有的活动配置 activeUrl:'', // 1.3场景才有的活动配置
sharephone:'', //主要微信用户,服务商 sharephone:'', //主要微信用户,服务商
trackList: [trackData.CARDETAIL, trackData.FINEDETAIL, trackData.CUSTOMEDETAIL, trackData.CROWDDETAIL, trackData.EXPANDETAIL] trackList: [trackData.CARDETAIL, trackData.FINEDETAIL, trackData.CUSTOMEDETAIL, trackData.CROWDDETAIL, trackData.EXPANDETAIL],
cardInfo: {},
hasPhoneNumber: false
}, },
// 计算属性 // 计算属性
computed: { computed: {
...@@ -56,12 +60,13 @@ Page({ ...@@ -56,12 +60,13 @@ Page({
//接受跳转的路由参数(小程序页面跳转) //接受跳转的路由参数(小程序页面跳转)
onRoute(options) { onRoute(options) {
if (!options || utils.isEmptyObj(options)) return if (!options || utils.isEmptyObj(options)) return
let { actNum = 0, activeNavIdx = 0, phone } = options let { actNum = 0, activeNavIdx = 0, phone, hasPhoneNumber } = options
// wx.$Track.sendTrack() // wx.$Track.sendTrack()
this.setData({ this.setData({
actNum, //选中的场景下标 actNum, //选中的场景下标
activeNavIdx, //选中的产品 activeNavIdx, //选中的产品
sharephone: phone //联系电话 (登陆的用户) sharephone: phone, //联系电话 (登陆的用户)
hasPhoneNumber:hasPhoneNumber
}) })
wx.$Track.sendTrack(this.data.trackList[this.data.actNum]) wx.$Track.sendTrack(this.data.trackList[this.data.actNum])
// console.log(this.data.senceData, 'senceData-----') // console.log(this.data.senceData, 'senceData-----')
...@@ -127,7 +132,14 @@ Page({ ...@@ -127,7 +132,14 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
if (options && options.cardId) {
// const options = wx.getEnterOptionsSync()
wx.$trackData = options.query
wx.$storage.set('scene', options)
this.getCardDetail()
} else {
this.getCardDetail()
}
}, },
/** /**
...@@ -176,6 +188,174 @@ Page({ ...@@ -176,6 +188,174 @@ Page({
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage() { onShareAppMessage() {
const cardId = wx.$storage.get('scene').cardId
// merchantId 兼容旧链接
const merchant = wx.$storage.get('scene').merchant || wx.$storage.get('scene').merchantId
const shareType = 'SHARE_SCEN'
console.log('cardId', cardId, 'merchant', merchant)
return {
title: `您好,我向你推荐了广联数科${this.data.cardInfo.staffName}的智能名片~`,
imageUrl: this.data.shareImg,
path: `packagesList/pages/scenarioDetail/scenarioDetail?cardId=${cardId}&merchant=${merchant}&shareType=${shareType}`
}
},
setShareInfo(data = {}) {
const canvasWidth = 208,
canvasHeight = 166,
textBaseline = 'top'
const draw_function = new Draw(this, {
width: canvasWidth,
height: canvasHeight
// pixelRatio: 2,
// backgroundColor: '#096'
})
const drawCard = callBack => {
let index = 0
const iconWidth = 9,
iconHeight = 9,
iconX = 18,
iconY = 79,
imgList = [
{
url: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/share/bg.png',
x: 0,
y: 0,
width: canvasWidth,
height: 124
},
{
url: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/share/logo.png',
x: 15,
y: 18,
width: 152,
height: 10
},
// 头像的
{
// url: "https://img.zcool.cn/community/01e47e60ab5b4011013eaf70962e3f.jpg@520w_390h_1c_1e_2o_100sh.jpg",
url: data.image,
x: 154,
y: 36,
width: 36,
height: 36
},
{
url: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/share/icon-phone.png',
x: iconX,
y: iconY,
width: iconWidth,
height: iconHeight
},
{
url: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/share/icon-address.png',
x: iconX,
y: iconY + 13,
width: iconWidth,
height: iconHeight
},
{
url: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/share/btn.png',
x: 64,
y: 138,
width: 80,
height: 24
}
],
textList = [
{
text: data.staffName,
x: 18,
y: 40,
color: '#2D2D33',
fontWeight: 600,
fontSize: 14
},
{
text: data.operation,
x: 22 + draw_function.getTextWidth(data.staffName, 14),
y: 44,
color: '#6E6E7A',
fontWeight: 400,
fontSize: 8
},
{
text: data.staffPhone,
x: 30,
y: 80,
color: '#6E6E7A',
fontSize: 7
},
{
text: '深圳市南山区留仙大道3370号南山智园崇文园区1号楼14层',
x: 30,
y: 94,
color: '#6E6E7A',
fontSize: 7,
lineNum: 2,
width: 185,
lineHeight: 9
}
]
const drawImages = callBack => {
draw_function.drawImages(imgList[index], () => {
index += 1
if (index != imgList.length) drawImages(callBack)
else callBack()
})
}
drawImages(() => {
try {
textList.map((e, ind) => {
e.textBaseline = textBaseline
draw_function.drawText(e)
if (ind == textList.length - 1) throw true
})
} catch (error) {
draw_function.toDataURL(({ path }) => {
this.setData(
{
shareImg: path,
shareDisabled: false
},
() => {
wx.showShareMenu({
menus: ['shareAppMessage']
})
}
)
})
}
})
}
drawCard()
},
// 获取员工名片信息
getCardDetail() {
const scene = wx.$storage.get('scene')
let params = {
cardId: scene.cardId
}
console.log(params)
entmicroApi.getCardDetail(params).then(({ data, code, message }) => {
wx.hideLoading()
if (code == -1) {
wx.showToast({
title: message,
icon: 'none',
duration: 2000
})
}
const cardInfo = data || this.data.defaultInfo
console.log(data, cardInfo)
this.setData(
{
cardInfo
},
() => {
this.setShareInfo(cardInfo)
}
)
})
} }
}) })
\ No newline at end of file \ No newline at end of file
{ {
"usingComponents": { "usingComponents": {
"pro-detail": "../../../components/proDetail/proDetail" "pro-detail": "../../../components/proDetail/proDetail",
"phone-number": "../../../components/PhoneNumber/PhoneNumber"
} }
} }
\ No newline at end of file \ No newline at end of file
<!--packagesList/pages/scenarioDetail/scenarioDetail.wxml--> <!--packagesList/pages/scenarioDetail/scenarioDetail.wxml-->
<pro-detail id="pro-detail" actNum="{{actNum}}" activeNavIdx="{{activeNavIdx}}"></pro-detail> <pro-detail id="pro-detail" actNum="{{actNum}}" activeNavIdx="{{activeNavIdx}}" cardInfo="{{cardInfo}}"></pro-detail>
<phone-number custom-class="pro_phone_number" type="scenario" hasPhoneNumber="{{hasPhoneNumber}}" bind:updatePhoneNumber="updatePhoneNumber"></phone-number>
...@@ -31,14 +31,6 @@ Page({ ...@@ -31,14 +31,6 @@ Page({
let {videoItem: {url}} = this.data let {videoItem: {url}} = this.data
console.log(url) console.log(url)
}, },
// 申请合作
toApplication() {
},
// 转发
toForward() {
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
......
...@@ -126,12 +126,12 @@ Page({ ...@@ -126,12 +126,12 @@ Page({
//登录的用户手机号 //登录的用户手机号
console.log(detail) console.log(detail)
// let userInfo = wx.$storage.get("userInfo") // let userInfo = wx.$storage.get("userInfo")
const { cardInfo } = this.data // const { cardInfo } = this.data
let obj = { let obj = {
// || 99 // || 99
actNum: isNaN(detail.scenIndex) ? 99 : detail.scenIndex, //选中的场景 没有就是订阅系统的 actNum: isNaN(detail.scenIndex) ? 99 : detail.scenIndex, //选中的场景 没有就是订阅系统的
activeNavIdx: detail.id, //选中的产品, activeNavIdx: detail.id, //选中的产品,
cardInfo, // cardInfo,
hasPhoneNumber: this.data.hasPhoneNumber hasPhoneNumber: this.data.hasPhoneNumber
} }
wx.$router.go('/packagesList/pages/productDetail/productDetail', obj) wx.$router.go('/packagesList/pages/productDetail/productDetail', obj)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!