分享朋友圈调整

This commit is contained in:
唐明明
2023-09-14 09:25:37 +08:00
parent 510cbeb181
commit 0dcf23bfde
43 changed files with 458 additions and 219 deletions

View File

@@ -10,9 +10,11 @@ Page({
*/
data: {
barHeight : getApp().globalData.barHeight, // 状态栏高度
shareSee : false, //分享弹出
inviteText : '', //邀请码
inviteCode : '', //二维码
shareSee : false, // 分享弹出
inviteText : '', // 邀请码
inviteCode : '', // 二维码
nickname : '', // 用户名称
invite : '', // 邀请码
//海报
canvas : ''
},
@@ -38,6 +40,7 @@ Page({
onShow() {
// 小程序码
this.ShareInfo();
console.log(wx.getStorageSync("invite"))
},
/**
@@ -47,12 +50,40 @@ Page({
wx.$api.user.miniShare({
url: 'pages/mall/index'
}).then(res => {
let { user_info, qrcode, invite } = res.data
this.setData({
inviteCode: res.data.qrcode
invite : invite,
inviteCode: qrcode,
nickname : user_info.nickname
})
}).catch(err => {})
},
/**
* 检查授权信息
*/
onSetting(){
wx.getSetting({
success: res => {
if(res.authSetting['scope.writePhotosAlbum'] || res.authSetting['scope.writePhotosAlbum'] === undefined){
this.onCanvas()
return
}
wx.showModal({
title : '提示',
content : '暂未授权小程序写入您的相册,无法存储海报',
confirmColor: '#144592',
confirmText : '去设置',
success: res => {
if (res.confirm) {
wx.openSetting()
}
}
})
}
})
},
/**
* 生成海报
*/
@@ -66,9 +97,8 @@ Page({
const codeImgEl = canvas.createImage()
const backBackEl = canvas.createImage()
// codeImgEl.src = this.data.inviteCode //二维码
codeImgEl.src = '/static/imgs/userHead.png' //二维码
backBackEl.src = 'https://cdn.douhuofalv.com/images/2023/08/11/cd8093d6ab1a248e5154be48b0ddcaac.jpg' //背景素材
codeImgEl.src = this.data.inviteCode //二维码
backBackEl.src = 'https://douhuo-storage.oss-cn-beijing.aliyuncs.com/images/2023/08/31/555d989b496e6d68ee8405bcae16555e.jpg' //背景素材
const codeImgLoding = new Promise((resolve, reason) => {
codeImgEl.onload = () => {
resolve()
@@ -83,21 +113,27 @@ Page({
ctx.drawImage(backBackEl, 0, 0, 375, 800)
// 绘制[二维码-白色背景]
ctx.fillStyle = "#ffffff";
ctx.fillRect(140, 610, 130, 130);
ctx.fillRect(140, 570, 130, 130);
// 绘制[二维码-白色背景黑框]
ctx.strokeStyle = "#da2b54";
ctx.lineWidth = 2
ctx.strokeRect(140, 610, 132, 132);
ctx.strokeRect(140, 570, 132, 132);
// 绘制[二维码]
ctx.drawImage(codeImgEl, 150, 620, 110, 110)
ctx.drawImage(codeImgEl, 150, 580, 110, 110)
// 文字
ctx.font = "bold 14px Arial"; //字体大小
ctx.fillStyle = "#ffffff"; //字体颜色
ctx.textAlign = "center"
ctx.fillText('保存并分享二维码', 208, 770);
ctx.fillText('保存并分享二维码', 208, 740);
// 用户昵称
ctx.font = "bold 14px Arial"; //字体大小
ctx.fillStyle = "#ffffff"; //字体颜色
ctx.textAlign = "center"
ctx.fillText(this.data.nickname, 208, 770);
wx.hideLoading()
wx.canvasToTempFilePath({
@@ -116,22 +152,12 @@ Page({
},
fail: () => {
wx.hideLoading()
wx.showModal({
title: '提示',
content: '暂未授权小程序写入您的相册,无法存储海报',
confirmColor: '#e50d01',
confirmText: '去设置',
success: res => {
if (res.confirm) {
wx.openSetting()
}
}
})
}
})
},
})
}).catch(err => {
wx.hideLoading()
wx.showToast({
title: '图片加载失败',
icon : 'none'
@@ -161,9 +187,9 @@ Page({
shareSee: false
})
return {
title : '水感应修复、紧致、舒缓喷雾',
path : "/pages/index/index?invite=" + wx.getStorageSync("invite"),
imageUrl: "https://cdn.shuiganying.com/images/2023/04/04/9cd9968136e7efd85028fba69e4c587a.jpg"
title : '绚火健康,生命可以如此精彩~',
path : "/pages/mall/index?invite=" + this.data.invite,
imageUrl: "https://douhuo-storage.oss-cn-beijing.aliyuncs.com/images/2023/08/31/555d989b496e6d68ee8405bcae16555e.jpg"
}
}
})

View File

@@ -6,7 +6,7 @@
<!-- 二维码海报 -->
<view class="code">
<image src="https://cdn.douhuofalv.com/images/2023/08/11/cd8093d6ab1a248e5154be48b0ddcaac.jpg" class="code-back"></image>
<image src="https://douhuo-storage.oss-cn-beijing.aliyuncs.com/images/2023/08/31/555d989b496e6d68ee8405bcae16555e.jpg" class="code-back"></image>
<view class="code-cont">
<view class="code-img">
<image src="{{inviteCode}}" mode="widthFix"></image>
@@ -30,7 +30,7 @@
<image src="https://cdn.shuiganying.com/images/2023/03/28/f8b773edc2fe6db8e45f96773b9a8dc4.png"></image>
微信好友
</button>
<view class="shareCont-label" bindtap="onCanvas">
<view class="shareCont-label" bindtap="onSetting">
<image src="https://cdn.shuiganying.com/images/2023/03/28/cfe0efbb53eaf7911ea5211923859c65.png"></image>
保存二维码
</view>

View File

@@ -68,9 +68,10 @@
</view>
<view class="order-item" bindtap="userNav" data-url="/pages/user/team/index">
<image class="tool-icon" src="/static/imgs/tool_06.png" mode="widthFix"></image>
<view class="order-label">我的团队</view>
<view class="order-label">我的市场</view>
</view>
<view class="order-item" bindtap="userNav" data-url="/pages/refund/refund">
<text class="order-number" wx:if="{{userData.refund > 0}}">{{userData.refund}}</text>
<image class="tool-icon" src="/static/imgs/tool_08.png" mode="widthFix"></image>
<view class="order-label">售后记录</view>
</view>
@@ -113,7 +114,7 @@
<view class="nowrap goodsItem-text">{{item.description}}</view>
<view class="goodsItem-tips">
<view class="goodsItem-price">¥{{item.original_price}}</view>
<view class="goodsItem-sales">览 {{item.clicks}}</view>
<view class="goodsItem-sales">览 {{item.clicks}}</view>
</view>
</view>
</view>

View File

@@ -94,6 +94,19 @@ page {
margin: 20rpx 0;
}
.order-number{
position: absolute;
right: 25%;
top: 0;
background: #da2b54;
color: white;
font-size: 22rpx;
min-width: 30rpx;
height: 30rpx;
line-height: 30rpx;
border-radius: 15rpx;
}
.order-icon {
width: 52rpx;
}

View File

@@ -124,7 +124,6 @@ Page({
if (res.confirm) {
// 清理客户端登录缓存
wx.removeStorageSync("token")
wx.switchTab({
url: '/pages/user/index'
})

View File

@@ -1,18 +1,18 @@
<view class="item">
<view class="item-label">
<view class="item-name">个人当日消费额</view>
<view class="item-name">个人当日销售额</view>
<view class="item-number item-number-red">{{perfInfo.day_perf}}</view>
<image class="item-icon" src="/static/imgs/teamIcon_01.png" mode="widthFix"></image>
</view>
<view class="item-label">
<view class="item-name">个人累计消费额</view>
<view class="item-name">个人累计销售额</view>
<view class="item-number item-number-red">{{perfInfo.self_perf}}</view>
<image class="item-icon" src="/static/imgs/teamIcon_02.png" mode="widthFix"></image>
</view>
</view>
<view class="item">
<view class="item-label item-blue">
<view class="item-name">个人当日消费额</view>
<view class="item-name">市场业绩</view>
<view class="item-number item-number-blue">{{perfInfo.group_perf}}</view>
<image class="item-icon" src="/static/imgs/teamIcon_04.png" mode="widthFix"></image>
</view>
@@ -24,7 +24,7 @@
<image class="item-icon" src="/static/imgs/teamIcon_03.png" mode="widthFix"></image>
</view>
<view class="item-label">
<view class="item-name">团队客户</view>
<view class="item-name">市场客户</view>
<view class="item-number item-number-yellow">{{teamsInfo.group}}</view>
<image class="item-icon" src="/static/imgs/teamIcon_03.png" mode="widthFix"></image>
</view>
@@ -37,19 +37,10 @@
</view>
<view class="listItem" wx:if="{{childrenArr.length > 0}}">
<view class="listItem-item" wx:for="{{childrenArr}}" wx:key="childrenArr">
<view class="listItem-top">
<image class="listItem-head" src="/static/imgs/userHead.png" mode="widthFix"></image>
<view class="listItem-cont">
<view class="listItem-name">
李莉莉
</view>
<view class="listItem-tel">
152****7708
</view>
</view>
</view>
<view class="listItem-time">
2023-08-18
<image class="listItem-head" src="/static/imgs/userHead.png" mode="widthFix"></image>
<view class="listItem-cont">
<view class="listItem-name nowrap">{{item.nickname || '-'}}<text>{{item.hidden_username || '-'}}</text></view>
<view class="listItem-time nowrap">{{item.created_at}}</view>
</view>
</view>
<view class="pagesLoding" wx:if="{{lodingStats}}">

View File

@@ -78,40 +78,37 @@ page {
.listItem-item {
background-color: #ffffff;
border-radius: 20rpx;
padding: 30rpx;
padding: 25rpx 30rpx;
box-sizing: border-box;
display: flex;
margin-bottom: 30rpx;
}
.listItem-top {
position: relative;
flex: 1;
display: flex;
align-items: center;
}
.listItem-head {
width: 100rpx;
width: 88rpx;
}
.listItem-cont {
position: absolute;
left: 0;
top: 0;
width: 100%;
padding-left: 130rpx;
width: 100% - 88rpx;
padding-left: 30rpx;
box-sizing: border-box;
}
.listItem-name {
font-weight: 600;
line-height: 40rpx;
}
.listItem-tel {
margin-top: 20rpx;
color: #666666;
.listItem-name text {
padding-left: 20rpx;
font-weight: normal;
}
.listItem-time {
line-height: 100rpx;
font-size: 26rpx;
color: gray;
line-height: 40rpx;
}