其他名片详情页面

This commit is contained in:
高健 2021-08-06 11:33:10 +08:00
parent c2ed1e14f2
commit 97a5e257c2
9 changed files with 544 additions and 645 deletions

View File

@ -81,6 +81,7 @@ Page({
}
})
},
//保存用户头像及微信昵称
doSaveUserInfo() {
try {
console.log('保存')
@ -328,12 +329,16 @@ Page({
}
},
onPullDownRefresh() {
this.setData({
dataList: [],
cardInfo: null,
areaList: null
})
this.getCard()
if (app.globalData.token != '') {
this.setData({
dataList: [],
cardInfo: null,
areaList: null
})
this.getCard()
} else {
this.doLogin()
}
},
//预览图片
viewImg(e) {
@ -500,33 +505,13 @@ Page({
data: {}
}).then(res => {
var area = res.data.areaList
for (let i = 0; i < area.length; i++) {
if (area[i].templateAreaServerLink == '1') {
if (area[i].templateAreaFontValue.length > area[i].templateAreaFontLength) {
area[i].templateAreaFontValue = area[i].templateAreaFontValue.substring(area[i].templateAreaFontLength, -1)
}
}
area[i].templateAreaFontSize = Math.floor(area[i].templateAreaFontSize * 750 / wx.getSystemInfoSync().windowWidth) + 'rpx'
if (area[i].templateAreaFontCenter == '1') {
area[i].templateAreaFontCenter = 'left'
} else if (area[i].templateAreaFontCenter == '2') {
area[i].templateAreaFontCenter = 'center'
} else {
area[i].templateAreaFontCenter = 'right'
}
if (area[i].templateAreaFontBold == '0') {
area[i].templateAreaFontBold = 'normal'
} else if (area[i].templateAreaFontBold == '1') {
area[i].templateAreaFontBold = 'bold'
} else {
area[i]['templateAreaFontStyle'] = 'italic'
}
if (area[i].templateAreaSource == 'name') {
area.forEach(it => {
if (it.templateAreaSource == 'name') {
self.setData({
nameTxt: area[i].templateAreaFontValue
nameTxt: it.templateAreaFontValue
})
}
}
})
self.setData({
cardInfo: res.data,
areaList: area,
@ -534,7 +519,7 @@ Page({
})
if (res.data) {
self.toSaveLocalImg(res.data.cardTemplateUseDispatchPhoto)
self.toSaveLocalImg(res.data.cardTemplateUsePhotoUrl)
self.getBrowCardUserList(res.data.cardTemplateUseId)
self.setData({
tempUserId: res.data.creator,
@ -821,14 +806,27 @@ Page({
},
//将分享的Base64图片保存至本地
toSaveLocalImg(data) {
var base64 = data
var _self = this
var base64 = _self.data.cardUrl + data
var imgPath = wx.env.USER_DATA_PATH + '/index' + 'share.png'
var imageData = base64.replace(/^data:image\/\w+;base64,/, "");
var fs = wx.getFileSystemManager();
fs.writeFileSync(imgPath, imageData, "base64");
this.setData({
shareImgUrl: imgPath
wx.downloadFile({
url: base64,
header: {
token: app.globalData.token
},
filePath: imgPath,
success(res) {
if (res.statusCode == 200) {
_self.setData({
shareImgUrl: imgPath
})
}
},
fail(err) {
console.log(err)
}
})
},
//显示详情
showDetail(e) {
@ -866,57 +864,41 @@ Page({
getCard() {
var self = this
app.http.get(app.urls.shareCard.format({
cardTemplateUseId: self.data.cardTemplateUseId
}), {
header: {
token: app.globalData.token
}
}).then(res => {
var area = res.data.areaList
for (let i = 0; i < area.length; i++) {
if (area[i].templateAreaServerLink == '1') {
if (area[i].templateAreaFontValue.length > area[i].templateAreaFontLength) {
area[i].templateAreaFontValue = area[i].templateAreaFontValue.substring(area[i].templateAreaFontLength, -1)
cardTemplateUseId: self.data.cardTemplateUseId
}), {
header: {
token: app.globalData.token
}
}).then(res => {
wx.stopPullDownRefresh({})
var area = res.data.areaList
area.forEach(it => {
if (it.templateAreaSource == 'name') {
self.setData({
nameTxt: it.templateAreaFontValue
})
}
}
area[i].templateAreaFontSize = Math.floor(area[i].templateAreaFontSize * 750 / wx.getSystemInfoSync().windowWidth) + 'rpx'
if (area[i].templateAreaFontCenter == '1') {
area[i].templateAreaFontCenter = 'left'
} else if (area[i].templateAreaFontCenter == '2') {
area[i].templateAreaFontCenter = 'center'
} else {
area[i].templateAreaFontCenter = 'right'
}
if (area[i].templateAreaFontBold == '0') {
area[i].templateAreaFontBold = 'normal'
} else if (area[i].templateAreaFontBold == '1') {
area[i].templateAreaFontBold = 'bold'
} else {
area[i]['templateAreaFontStyle'] = 'italic'
}
if (area[i].templateAreaSource == 'name') {
self.setData({
nameTxt: area[i].templateAreaFontValue
})
}
}
self.setData({
cardInfo: res.data,
areaList: area,
dataList: []
})
if (res.data) {
self.toSaveLocalImg(res.data.cardTemplateUseDispatchPhoto) //保存分享的图片
self.getBrowCardUserList(res.data.cardTemplateUseId) //获取浏览数量
app.globalData.userId = res.data.creator //保存当前名片的用户ID
self.setData({
tempUserId: res.data.creator
})
self.getMainColumn(res.data.creator) //获取当前用户的栏目
self.getMainBaseUserInfo(res.data.creator)
}
})
self.setData({
cardInfo: res.data,
areaList: area,
dataList: []
})
if (res.data) {
self.toSaveLocalImg(res.data.cardTemplateUsePhotoUrl) //保存分享的图片
self.getBrowCardUserList(res.data.cardTemplateUseId) //获取浏览数量
app.globalData.userId = res.data.creator //保存当前名片的用户ID
self.setData({
tempUserId: res.data.creator
})
self.getMainColumn(res.data.creator) //获取当前用户的栏目
self.getMainBaseUserInfo(res.data.creator)
}
})
.catch(err => {
wx.stopPullDownRefresh({})
})
},
// 保存查看记录
@ -1021,50 +1003,4 @@ Page({
otherCardList: _self.data.otherCardList
})
},
//构建名片数据
buildCardData(res) {
var area = res.data.areaList
for (let i = 0; i < area.length; i++) {
if (area[i].templateAreaServerLink == '1') {
if (area[i].templateAreaFontValue.length > area[i].templateAreaFontLength) {
area[i].templateAreaFontValue = area[i].templateAreaFontValue.substring(area[i].templateAreaFontLength, -1)
}
}
area[i].templateAreaFontSize = Math.floor(area[i].templateAreaFontSize * 750 / wx.getSystemInfoSync().windowWidth) + 'rpx'
if (area[i].templateAreaFontCenter == '1') {
area[i].templateAreaFontCenter = 'left'
} else if (area[i].templateAreaFontCenter == '2') {
area[i].templateAreaFontCenter = 'center'
} else {
area[i].templateAreaFontCenter = 'right'
}
if (area[i].templateAreaFontBold == '0') {
area[i].templateAreaFontBold = 'normal'
} else if (area[i].templateAreaFontBold == '1') {
area[i].templateAreaFontBold = 'bold'
} else {
area[i]['templateAreaFontStyle'] = 'italic'
}
if (area[i].templateAreaSource == 'name') {
self.setData({
nameTxt: area[i].templateAreaFontValue
})
}
}
self.setData({
cardInfo: res.data,
areaList: area,
dataList: []
})
if (res.data) {
self.toSaveLocalImg(res.data.cardTemplateUseDispatchPhoto) //保存分享的图片
self.getBrowCardUserList(res.data.cardTemplateUseId) //获取浏览数量
app.globalData.userId = res.data.creator //保存当前名片的用户ID
self.setData({
tempUserId: res.data.creator
})
self.getMainColumn(res.data.creator) //获取当前用户的栏目
}
}
})

View File

@ -14,19 +14,8 @@
<view class="card"
style="padding-bottom:{{(cardInfo.cardTemplateUseHeight / cardInfo.cardTemplateUseWidth) *100 +'%'}};">
<!-- 背景图 -->
<image src="{{cardUrl}}{{cardInfo.cardTemplateUseBackgroundImage}}" alt="" class="card-bgImg" mode="widthFix"
wx:if="{{cardInfo.cardTemplateUseBackgroundImage}}"></image>
<!-- 文字 -->
<view class="area-box" wx:for="{{areaList}}" wx:key="index"
style="position:absolute;top: {{(item.templateAreaTop / cardInfo.cardTemplateUseHeight) * 100 + '%'}};left:{{(item.templateAreaLeft / cardInfo.cardTemplateUseWidth) * 100 + '%'}};color:{{item.templateAreaFontColor}};width:{{(item.templateAreaWidth / cardInfo.cardTemplateUseWidth) * 100 + '%'}};height:{{(item.templateAreaHeight / cardInfo.cardTemplateUseHeight) * 100 + '%'}};font-size:{{item.templateAreaFontSize}};font-style:{{item.templateAreaFontStyle}};font-weight:{{item.templateAreaFontBold}};text-align:{{item.templateAreaFontCenter}}"
wx:if="{{item.templateAreaServerLink == '1'}}">{{item.templateAreaFontValue}}</view>
<!-- 图片 -->
<view wx:for="{{areaList}}" data-cur="{{index}}" wx:key="index"
style="position:absolute;top: {{(item.templateAreaTop / cardInfo.cardTemplateUseHeight) * 100 + '%'}};left:{{(item.templateAreaLeft / cardInfo.cardTemplateUseWidth) * 100 + '%'}};color:{{item.templateAreaFontColor}};width:{{(item.templateAreaWidth / cardInfo.cardTemplateUseWidth) * 100 + '%'}};height:{{(item.templateAreaHeight / cardInfo.cardTemplateUseHeight) * 100 + '%'}}"
wx:if="{{item.templateAreaServerLink != '1'}}">
<image src="{{cardUrl}}{{item.templateAreaFile}}" style="width: 100%;height:100%" mode="widthFix">
</image>
</view>
<image src="{{cardUrl}}{{cardInfo.cardTemplateUsePhotoUrl}}" alt="" class="card-bgImg" mode="scaleToFill">
</image>
</view>
</view>
<!-- 功能区 -->

View File

@ -33,6 +33,7 @@ page {
left: 0;
width: 100%;
height: 100%;
padding: 10rpx;
}
.person {
@ -413,9 +414,8 @@ page {
justify-content: space-between;
padding-left: 40rpx;
width: 100%;
margin-top: 40rpx;
padding-top: 40rpx;
padding-bottom: 30rpx;
padding-bottom: 20rpx;
background-color: #fff;
}
@ -452,6 +452,7 @@ page {
.good-avatar image {
width: 100%;
height: 100%;
border-radius: 50%;
}
.good-click image {

View File

@ -61,7 +61,7 @@
<text>{{group.configColumnGroupName}}</text>
</view>
<view wx:if="{{group.configColumnGroupStyle=='ec3605f5-3409-4554-ae85-efac8a75fc0d'}}"
class="flex align-center justify-center" style="width:100%;">
class="flex align-center justify-center" style="width:100%;" bindtap="toFunction">
<swiper style="width:80%;margin-top:20rpx;height:{{Height}};" indicator-dots="{{true}}" autoplay="{{true}}">
<block wx:for="{{group.configColumnList}}" wx:key="pIndex" wx:for-index="pIndex" wx:for-item="photo">
<swiper-item style="width:100%;">
@ -73,7 +73,7 @@
</swiper>
</view>
<!-- 平铺 -->
<view wx:else class="flex flex-direction align-center justify-center" style="width:100%;">
<view wx:else class="flex flex-direction align-center justify-center" style="width:100%;" bindtap="toFunction">
<block wx:for="{{group.configColumnList}}" wx:key="pIndex" wx:for-index="pIndex" wx:for-item="photo">
<image style="width:90%;border-radius:20rpx;margin-top:5rpx;" src="{{imgUrl + photo.configColumnPhoto}}"
mode="widthFix">

View File

@ -23,9 +23,8 @@ Page({
// 我的名片列表
getList: function () {
var self = this
wx.showToast({
title: '加载中',
icon: 'loading'
wx.showLoading({
title: '加载中...',
})
wx.showNavigationBarLoading()
app.http.get(app.urls.getMyCard, {
@ -34,13 +33,14 @@ Page({
},
data: {}
}).then(res => {
wx.hideLoading({})
self.setData({
cardList: res.data
})
wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新
wx.hideToast()
}).catch(res => {
wx.hideLoading({})
wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新
})
@ -54,6 +54,9 @@ Page({
},
// 获取他人名片列表
getOtherCard: function () {
wx.showLoading({
title: '加载中...',
})
var self = this
app.http.get(app.urls.otherCardList, {
header: {
@ -61,6 +64,7 @@ Page({
},
data: {}
}).then(res => {
wx.hideLoading({})
wx.stopPullDownRefresh({})
var curArr
if (res.data.rows.length > 0) {
@ -75,10 +79,14 @@ Page({
}
})
.catch(err => {
wx.hideLoading({})
wx.stopPullDownRefresh({})
})
},
getHistory() {
wx.showLoading({
title: '加载中...',
})
var _self = this
app.http.get(app.urls.getBrowseHistoryList, {
header: {
@ -86,6 +94,7 @@ Page({
}
})
.then(res => {
wx.hideLoading({})
wx.stopPullDownRefresh({})
var curArr
if (res.data.rows.length > 0) {
@ -100,6 +109,7 @@ Page({
}
})
.catch(err => {
wx.hideLoading({})
wx.stopPullDownRefresh({})
console.log(err)
})

View File

@ -15,7 +15,7 @@
style="padding-bottom:{{(list.cardTemplateUseHeight / list.cardTemplateUseWidth) *100 +'%'}};">
<view class="card-img">
<view class="main" wx:if="{{list.cardTemplateUseDefault == '1'}}">主名片</view>
<image src="{{list.picturesTemplatePictureUrl}}" style="width: 100%"></image>
<image src="{{imgUrl+list.cardTemplateUsePhotoUrl}}" style="width: 100%"></image>
</view>
</view>
<view class="card-name">{{list.cardTemplateUseTitle}}</view>
@ -35,7 +35,7 @@
style="padding-bottom:{{(list.cardTemplateUseDTO.cardTemplateUseHeight / list.cardTemplateUseDTO.cardTemplateUseWidth) *100 +'%'}};">
<view class="card-img">
<view class="main" wx:if="{{list.cardTemplateUseTop == '1'}}">置顶</view>
<image src="{{list.cardTemplateUseDTO.picturesTemplatePictureUrl}}" style="width: 100%"></image>
<image src="{{list.cardTemplateUseDTO.cardTemplateUsePhotoUrl}}" style="width: 100%"></image>
</view>
</view>
<view class="card-name other-card">
@ -61,7 +61,7 @@
style="padding-bottom:{{(list.cardTemplateUseDTO.cardTemplateUseHeight / list.cardTemplateUseDTO.cardTemplateUseWidth) *100 +'%'}};">
<view class="card-img">
<view class="main" wx:if="{{list.cardTemplateUseTop == '1'}}">置顶</view>
<image src="{{list.cardTemplateUseDTO.picturesTemplatePictureUrl}}" style="width: 100%"></image>
<image src="{{list.cardTemplateUseDTO.cardTemplateUsePhotoUrl}}" style="width: 100%"></image>
</view>
</view>
<view class="card-name-sm other-card">

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,7 @@
<cu-custom id="head" isCustom="{{false}}" isBack="{{false}}" isIndex="{{true}}" bind:show="showCardHistory">
<cu-custom id="head" isCustom="{{false}}" isBack="{{true}}">
<view slot="content">
<view>
{{nameTxt}}
<text class="cuIcon-triangledownfill"></text>
</view>
</view>
</cu-custom>
@ -14,19 +13,8 @@
<view class="card"
style="padding-bottom:{{(cardInfo.cardTemplateUseHeight / cardInfo.cardTemplateUseWidth) *100 +'%'}};">
<!-- 背景图 -->
<image src="{{cardUrl}}{{cardInfo.cardTemplateUseBackgroundImage}}" alt="" class="card-bgImg" mode="widthFix"
wx:if="{{cardInfo.cardTemplateUseBackgroundImage}}"></image>
<!-- 文字 -->
<view class="area-box" wx:for="{{areaList}}" wx:key="index"
style="position:absolute;top: {{(item.templateAreaTop / cardInfo.cardTemplateUseHeight) * 100 + '%'}};left:{{(item.templateAreaLeft / cardInfo.cardTemplateUseWidth) * 100 + '%'}};color:{{item.templateAreaFontColor}};width:{{(item.templateAreaWidth / cardInfo.cardTemplateUseWidth) * 100 + '%'}};height:{{(item.templateAreaHeight / cardInfo.cardTemplateUseHeight) * 100 + '%'}};font-size:{{item.templateAreaFontSize}};font-style:{{item.templateAreaFontStyle}};font-weight:{{item.templateAreaFontBold}};text-align:{{item.templateAreaFontCenter}}"
wx:if="{{item.templateAreaServerLink == '1'}}">{{item.templateAreaFontValue}}</view>
<!-- 图片 -->
<view wx:for="{{areaList}}" data-cur="{{index}}" wx:key="index"
style="position:absolute;top: {{(item.templateAreaTop / cardInfo.cardTemplateUseHeight) * 100 + '%'}};left:{{(item.templateAreaLeft / cardInfo.cardTemplateUseWidth) * 100 + '%'}};color:{{item.templateAreaFontColor}};width:{{(item.templateAreaWidth / cardInfo.cardTemplateUseWidth) * 100 + '%'}};height:{{(item.templateAreaHeight / cardInfo.cardTemplateUseHeight) * 100 + '%'}}"
wx:if="{{item.templateAreaServerLink != '1'}}">
<image src="{{cardUrl}}{{item.templateAreaFile}}" style="width: 100%;height:100%" mode="widthFix">
</image>
</view>
<image src="{{cardUrl}}{{cardInfo.picturesTemplatePictureUrl}}" alt="" class="card-bgImg" mode="widthFix">
</image>
</view>
</view>
<!-- 功能区 -->

View File

@ -413,9 +413,8 @@ page {
justify-content: space-between;
padding-left: 40rpx;
width: 100%;
margin-top: 40rpx;
padding-top: 40rpx;
padding-bottom: 30rpx;
padding-bottom: 20rpx;
background-color: #fff;
}
@ -452,6 +451,7 @@ page {
.good-avatar image {
width: 100%;
height: 100%;
border-radius: 50%;
}
.good-click image {