Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
mini-program
/
ai-card
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 02b60c9b
authored
Dec 23, 2022
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
提交
1 parent
913b05cf
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
395 additions
and
125 deletions
app.js
components/PhoneNumber/PhoneNumber.wxml
packagesList/pages/activityDetail/activityDetail.js
packagesList/pages/activityDetail/activityDetail.wxml
packagesList/pages/productDetail/productDetail.js
packagesList/pages/scenarioDetail/scenarioDetail.js
packagesList/pages/scenarioDetail/scenarioDetail.json
packagesList/pages/scenarioDetail/scenarioDetail.scss
packagesList/pages/scenarioDetail/scenarioDetail.wxml
packagesList/pages/videoDetal/videoDetal.js
pages/tab/index/index.js
app.js
View file @
02b60c9
...
...
@@ -207,5 +207,9 @@ App({
}
})
},
globalData
:
{}
globalData
:
{},
onPageNotFound
(
res
)
{
console
.
log
(
res
,
'不存在的页面'
)
},
})
components/PhoneNumber/PhoneNumber.wxml
View file @
02b60c9
...
...
@@ -22,10 +22,10 @@
</block>
</view>
<view wx:if="{{type == 'scenario'}}" class="isFullSucreen video-btn">
<
view class="forward-box
">
<image class="icon-forward" webp src="{{IMGURL}}home/icon-forward.png"></image>
<view class="forward-text" bindtap="forward">转发</view>
</view
>
<
button class="forward-box forward_box" open-type="share
">
<image class="icon-forward" webp src="{{IMGURL}}home/icon-forward.png"></image>
<view class="forward-text" bindtap="forward">转发</view>
</button
>
<button wx:if="{{hasPhone}}" class="phoneNumber" bindtap="jump">合作申请1</button>
<button wx:else class="phoneNumber" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">合作申请</button>
</view>
...
...
packagesList/pages/activityDetail/activityDetail.js
View file @
02b60c9
...
...
@@ -11,7 +11,20 @@ Page({
},
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
)
{
// 打开成功
}
})
// })
},
/**
...
...
packagesList/pages/activityDetail/activityDetail.wxml
View file @
02b60c9
...
...
@@ -17,11 +17,11 @@
<view class="activity-info">
<view class="activity-item">
<glsx-image custom-class="activity-icon" webp src="image/activity/icon-company.png"></glsx-image>
<view class="text">{{activityInfo.
merchant
Name}}</view>
<view class="text">{{activityInfo.
sponsor
Name}}</view>
</view>
<view class="activity-item">
<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 class="activity-item">
<glsx-image custom-class="activity-icon" webp src="image/activity/icon-time.png"></glsx-image>
...
...
packagesList/pages/productDetail/productDetail.js
View file @
02b60c9
...
...
@@ -13,6 +13,7 @@ import {
import
utils
from
'~/utils/util'
import
{
entmicroApi
}
from
"~/api/api"
import
{
trackData
}
from
'../../../utils/data'
import
Draw
from
'../../../utils/Draw'
Page
({
...
...
@@ -77,60 +78,16 @@ Page({
// console.log( options);
if
(
!
options
||
utils
.
isEmptyObj
(
options
))
return
let
{
actNum
=
0
,
activeNavIdx
=
0
,
phone
,
cardInfo
actNum
=
0
,
activeNavIdx
=
0
,
phone
,
hasPhoneNumber
}
=
options
console
.
log
(
options
)
this
.
setData
({
actNum
,
//选中的场景下标
activeNavIdx
,
//选中的产品
sharephone
:
phone
,
//联系电话 (登陆的用户)
cardInfo
,
hasPhoneNumber
:
options
.
hasPhoneNumber
hasPhoneNumber
:
hasPhoneNumber
})
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
()
{
let
timer
=
null
;
...
...
@@ -177,58 +134,13 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad
(
options
)
{
this.getActiveApiFn()
// 是否已经查看详情
this.isgetAuthphone()
if (!options || utils.isEmptyObj(options)) return
let { actNum = 0, activeNavIdx = 0, isShare = true,sharephone = 123 } = options
if(isShare){
wx.hideHomeButton()
}
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,
if
(
options
&&
options
.
cardId
)
{
// const options = wx.getEnterOptionsSync()
wx
.
$trackData
=
options
.
query
wx
.
$storage
.
set
(
'scene'
,
options
)
this
.
getCardDetail
()
}
else
{
this
.
getCardDetail
()
}
},
...
...
@@ -278,7 +190,16 @@ Page({
* 用户点击右上角分享
*/
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({
this
.
setData
({
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
packagesList/pages/scenarioDetail/scenarioDetail.js
View file @
02b60c9
...
...
@@ -5,6 +5,8 @@ import { senceData, productData } from "~/pages/tab/index/constant/senceData"
// import USERAPI from '~/api/usersApi/index'
import
utils
from
'~/utils/util'
import
{
trackData
}
from
'../../../utils/data'
import
{
entmicroApi
}
from
'../../../api/api'
import
Draw
from
'../../../utils/Draw'
// import {getActiveApi} from "~/api/viewprod"
Page
({
...
...
@@ -30,7 +32,9 @@ Page({
prodItemVideo
:
''
,
//选中的场景下的video的第一个
activeUrl
:
''
,
// 1.3场景才有的活动配置
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
:
{
...
...
@@ -56,12 +60,13 @@ Page({
//接受跳转的路由参数(小程序页面跳转)
onRoute
(
options
)
{
if
(
!
options
||
utils
.
isEmptyObj
(
options
))
return
let
{
actNum
=
0
,
activeNavIdx
=
0
,
phone
}
=
options
let
{
actNum
=
0
,
activeNavIdx
=
0
,
phone
,
hasPhoneNumber
}
=
options
// wx.$Track.sendTrack()
this
.
setData
({
actNum
,
//选中的场景下标
activeNavIdx
,
//选中的产品
sharephone
:
phone
//联系电话 (登陆的用户)
sharephone
:
phone
,
//联系电话 (登陆的用户)
hasPhoneNumber
:
hasPhoneNumber
})
wx
.
$Track
.
sendTrack
(
this
.
data
.
trackList
[
this
.
data
.
actNum
])
// console.log(this.data.senceData, 'senceData-----')
...
...
@@ -127,7 +132,14 @@ Page({
* 生命周期函数--监听页面加载
*/
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({
* 用户点击右上角分享
*/
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
packagesList/pages/scenarioDetail/scenarioDetail.json
View file @
02b60c9
{
"usingComponents"
:
{
"pro-detail"
:
"../../../components/proDetail/proDetail"
"pro-detail"
:
"../../../components/proDetail/proDetail"
,
"phone-number"
:
"../../../components/PhoneNumber/PhoneNumber"
}
}
\ No newline at end of file
packagesList/pages/scenarioDetail/scenarioDetail.scss
View file @
02b60c9
/* packagesList/pages/scenarioDetail/scenarioDetail.wxss */
\ No newline at end of file
/* packagesList/pages/scenarioDetail/scenarioDetail.wxss */
packagesList/pages/scenarioDetail/scenarioDetail.wxml
View file @
02b60c9
<!--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>
packagesList/pages/videoDetal/videoDetal.js
View file @
02b60c9
...
...
@@ -31,14 +31,6 @@ Page({
let
{
videoItem
:
{
url
}}
=
this
.
data
console
.
log
(
url
)
},
// 申请合作
toApplication
()
{
},
// 转发
toForward
()
{
},
/**
* 生命周期函数--监听页面初次渲染完成
...
...
pages/tab/index/index.js
View file @
02b60c9
...
...
@@ -126,12 +126,12 @@ Page({
//登录的用户手机号
console
.
log
(
detail
)
// let userInfo = wx.$storage.get("userInfo")
const
{
cardInfo
}
=
this
.
data
//
const { cardInfo } = this.data
let
obj
=
{
// || 99
actNum
:
isNaN
(
detail
.
scenIndex
)
?
99
:
detail
.
scenIndex
,
//选中的场景 没有就是订阅系统的
activeNavIdx
:
detail
.
id
,
//选中的产品,
cardInfo
,
//
cardInfo,
hasPhoneNumber
:
this
.
data
.
hasPhoneNumber
}
wx
.
$router
.
go
(
'/packagesList/pages/productDetail/productDetail'
,
obj
)
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment