红包/app下载/分享新增优化

This commit is contained in:
GaoHao 2025-01-08 11:25:33 +08:00
parent 8692626dd1
commit 3291a7573a
17 changed files with 815 additions and 322 deletions

View File

@ -119,4 +119,7 @@ web-view {
top: 800rpx;
transform: translateX(-50%);
}
.u-image{
background-color: transparent!important;
}
</style>

View File

@ -22,6 +22,17 @@ export const selectPayDetails = (data) => {
})
}
/**
* 红包明细记录
*/
export const queryUserMoneyDetails = (data) => {
return http.request({
url: '/moneyDetails/queryUserMoneyDetails',
data: data
})
}
/**
* 修改提现账号
*/

32
api/share/index.js Normal file
View File

@ -0,0 +1,32 @@
import http from '@/http/http.js'
/**
* 获取已邀请列表
*/
export const selectInviteByUserIdLists = (data) => {
return http.request({
url: '/invite/selectInviteByUserIdLists',
data: data,
})
}
/**
* 获取邀请战绩
*/
export const selectInviteMoney = (data) => {
return http.request({
url: '/invite/selectInviteMoney',
data: data,
})
}
/**
* 获取海报数据
*/
export const selectBannerList = (data) => {
return http.request({
url: '/banner/selectBannerList',
data: data,
})
}

View File

@ -73,6 +73,11 @@
"navigationBarTitleText": "忘记密码",
"navigationStyle": "custom"
}
}, {
"path": "pages/login/download",
"style": {
"navigationBarTitleText": "下载"
}
}, {
"path": "pages/me/userInfo",
"style": {
@ -112,6 +117,16 @@
"style": {
"navigationBarTitleText": "提现账号"
}
}, {
"path": "pages/me/withdraw/moneyList",
"style": {
"navigationBarTitleText": "红包明细"
}
}, {
"path": "pages/share/index",
"style": {
"navigationBarTitleText": "分享"
}
},
{
"path": "pages/index/search/index",

View File

@ -1,303 +0,0 @@
<template>
<view class="containersView">
<div style="width: 100%;height: 85%;position: absolute;background: url('../../static/images/appeq_bg.png') no-repeat center bottom / cover;"></div>
<view style="text-align: center;position: relative;height: 100%;display: flex;flex-direction: column;align-items: center;justify-content: center;">
<image style="width: 124rpx;height: 124rpx;margin-top: -920rpx;border-radius:20upx;" src="../../static/images/appLogo.png"></image>
<view style="font-size: 40rpx;margin-top: 22rpx;color: #FFFFFF;font-weight: bold;">斯耀短剧APP</view>
<view style="font-size: 28rpx;margin-top: 16rpx;color: #FFFFFF;font-weight: bold;">海量电子榨菜 免费又过瘾</view>
<button class="confirm-btn" @click="taobaoLogin">{{confirmBtn}}</button>
</view>
<view id="shareit" v-if="show_share" @tap="closeShare">
<image class="arrow" src="https://renwu.xiansqx.com/img/20210813/9aa484db4c60458f86deb2a8ab6fe400.png">
</image>
<view id="follow">点击右上角按钮选择浏览器打开下载</view>
</view>
<!-- #ifdef H5 -->
<div v-if="isWeixin" style="width: 100%;height: 100%;position: absolute;top: 0;background: url('../../static/images/open_guide.png') no-repeat center bottom / cover;"></div>
<!-- #endif -->
</view>
</template>
<script>
export default {
data() {
return {
mobile: '',
code: '',
message: '',
show_share: false,
openShare: false,
openShares: false,
relationId: '',
sending: false,
confirmBtn: '斯耀短剧APP',
isWeixin: false,
};
},
onLoad(e) {
let u = navigator.userAgent;
if ( u.indexOf('iPhone') > -1) {
// #ifdef H5
this.confirmBtn = "跳转网页版首页"
// #endif
}
if ( u.toLowerCase().indexOf('micromessenger') !== -1) {
this.isWeixin = true
}
},
methods: {
closeShare() {
this.show_share = false;
},
taobaoLogin() {
var u = navigator.userAgent;
if (u.indexOf('Android') > -1 || u.indexOf('Adr') > -1) {
this.$Request.get('/app/common/type/49').then(res => {
if (res.code === 0) {
if (res.data && res.data.value) {
if (this.openShare) {
let ua = navigator.userAgent.toLowerCase();
if (ua.indexOf('micromessenger') === -1) {
this.show_share = false;
// #ifndef H5
plus.runtime.openURL(res.data.value, function(res) {
});
// #endif
// #ifdef H5
window.location.href = res.data.value;
// #endif
} else {
this.show_share = true;
}
} else {
// #ifndef H5
plus.runtime.openURL(res.data.value, function(res) {
});
// #endif
// #ifdef H5
uni.setClipboardData({
data: res.data.value,
success: r => {
// this.$queue.showToast('');
}
});
window.location.href = res.data.value;
// #endif
}
}
}
});
} else {
this.$Request.get('/app/common/type/50').then(res => {
if (res.code === 0) {
if (res.data && res.data.value) {
if (this.openShares) {
let ua = navigator.userAgent.toLowerCase();
if (ua.indexOf('micromessenger') === -1) {
this.show_share = false;
// #ifndef H5
plus.runtime.openURL(res.data.value, function(res) {
});
// #endif
// #ifdef H5
window.location.href = res.data.value;
// uni.switchTab({
// url: 'pages/index/index'
// })
// #endif
} else {
this.show_share = true;
}
} else {
// #ifndef H5
plus.runtime.openURL(res.data.value, function(res) {
});
// #endif
// #ifdef H5
uni.setClipboardData({
data: res.data.value,
success: r => {
// this.$queue.showToast('');
}
});
uni.switchTab({
url: '/pages/index/index'
})
// window.location.href = res.data.value;
// #endif
}
}
}
});
}
}
}
};
</script>
<style lang="scss" scoped>
uni-page-body{
width: 100%;
height: 100%;
}
.containersView {
width: 100%;
height: 100%;
}
#shareit {
-webkit-user-select: none;
position: fixed;
/*width: 100%;*/
height: 2000px;
background: rgba(0, 0, 0, 0.85);
text-align: center;
top: 0;
left: 0;
z-index: 999;
}
#shareit img {
max-width: 100%;
}
.arrow {
width: 100px;
height: 150px;
position: absolute;
right: 5%;
top: 1%;
}
#follow {
margin-right: 60px;
margin-left: 30px;
width: 90%;
height: 50px;
line-height: 50px;
text-align: left;
text-decoration: none;
font-size: 18px;
color: white;
float: left;
margin-top: 160px;
}
.footer {
padding-left: 140upx;
margin-top: 32upx;
font-size: 24upx;
color: #666666;
text-align: center;
display: flex;
}
page {
background: #fff;
}
.send-msg {
border-radius: 30px;
color: black;
background: white;
height: 30px;
font-size: 14px;
line-height: 30px;
}
.container {
top: 0;
padding-top: 50px;
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
background: #fff;
}
.wrapper {
position: relative;
z-index: 90;
background: #fff;
padding-bottom: 20px;
}
.right-top-sign {
position: absolute;
top: 40px;
right: -15px;
z-index: 95;
&:before,
&:after {
display: block;
content: '';
width: 20px;
height: 40px;
background: #e10a07;
}
&:before {
transform: rotate(50deg);
border-radius: 0 50px 0 0;
}
&:after {
position: absolute;
right: -198px;
top: 0;
transform: rotate(-50deg);
border-radius: 50px 0 0 0;
/* background: pink; */
}
}
.left-bottom-sign {
position: absolute;
left: -270px;
bottom: -320px;
/*border: 100upx solid #d0d1fd;*/
border-radius: 50%;
padding: 90px;
}
.welcome {
position: relative;
left: 30px;
top: -55px;
font-size: 28px;
color: #555;
text-shadow: 1px 0px 1px rgba(0, 0, 0, 0.3);
}
.input-content {
padding: 0 20px;
}
.confirm-btn {
width: 416rpx;
height: 90rpx;
line-height: 90rpx;
background: #FD5775;
color: #fff;
font-size: 32rpx;
font-weight: bold;
font-size: 32rpx;
color: #FFFFFF;
position: absolute;
left: 0;
right: 0;
bottom: 70rpx;
}
</style>

174
pages/login/download.vue Normal file
View File

@ -0,0 +1,174 @@
<template>
<view class="containersView">
<div style="width: 100%;height: 85%;position: absolute;background: url('/static/download/appeq_bg.png') no-repeat center bottom / cover;"></div>
<view style="text-align: center;position: relative;height: 100%;display: flex;flex-direction: column;align-items: center;justify-content: center;">
<image style="width: 124rpx;height: 124rpx;margin-top: -920rpx;border-radius:20upx;" src="/static/download/appLogo.png"></image>
<view style="font-size: 40rpx;margin-top: 22rpx;color: #FFFFFF;font-weight: bold;">斯耀短剧APP</view>
<view style="font-size: 28rpx;margin-top: 16rpx;color: #FFFFFF;font-weight: bold;">海量电子榨菜 免费又过瘾</view>
<button class="confirm-btn" @click="download">{{data.confirmBtn}}</button>
</view>
<view id="shareit" v-if="data.show_share" @tap="closeShare">
<image class="arrow" src="https://renwu.xiansqx.com/img/20210813/9aa484db4c60458f86deb2a8ab6fe400.png">
</image>
<view id="follow">点击右上角按钮选择浏览器打开下载</view>
</view>
<!-- #ifdef H5 -->
<div v-if="data.isWeixin" style="width: 100%;height: 100%;position: absolute;top: 0;background: url('/static/download/open_guide.png') no-repeat center bottom / cover;"></div>
<!-- #endif -->
</view>
</template>
<script setup>
import { reactive } from 'vue';
import { onLoad} from '@dcloudio/uni-app'
import { commonType } from '@/api/init.js';
let data = reactive({
show_share: false,
openShare: false,
openShares: false,
confirmBtn: '斯耀短剧APP',
isWeixin: false,
})
onLoad(() => {
let u = navigator.userAgent;
if ( u.indexOf('iPhone') > -1) {
// #ifdef H5
data.confirmBtn = "跳转网页版首页"
// #endif
}
if ( u.toLowerCase().indexOf('micromessenger') !== -1) {
data.isWeixin = true
}
})
function closeShare() {
data.show_share = false;
}
function download() {
var u = navigator.userAgent;
if (u.indexOf('Android') > -1 || u.indexOf('Adr') > -1) {
commonType(49).then(res => {
if (res.code === 0) {
if (res.data && res.data.value) {
// #ifndef H5
plus.runtime.openURL(res.data.value, function(res) {
});
// #endif
// #ifdef H5
uni.setClipboardData({
data: res.data.value,
success: r => {
// this.$queue.showToast('');
uni.showToast({
title: '邀请码复制成功',
icon: 'none',
});
}
});
window.location.href = res.data.value;
// #endif
}
}
});
} else {
commonType(50).then(res => {
if (res.code === 0) {
if (res.data && res.data.value) {
// #ifndef H5
plus.runtime.openURL(res.data.value, function(res) {
});
// #endif
// #ifdef H5
uni.setClipboardData({
data: res.data.value,
success: r => {
uni.showToast({
title: '邀请码复制成功',
icon: 'none',
});
}
});
uni.switchTab({
url: '/pages/index/index'
})
// window.location.href = res.data.value;
// #endif
}
}
});
}
}
</script>
<style lang="scss" scoped>
uni-page-body{
width: 100%;
height: 100%;
}
.containersView {
width: 100%;
height: 100%;
}
#shareit {
-webkit-user-select: none;
position: fixed;
/*width: 100%;*/
height: 2000px;
background: rgba(0, 0, 0, 0.85);
text-align: center;
top: 0;
left: 0;
z-index: 999;
}
#shareit img {
max-width: 100%;
}
.arrow {
width: 100px;
height: 150px;
position: absolute;
right: 5%;
top: 1%;
}
#follow {
margin-right: 60px;
margin-left: 30px;
width: 90%;
height: 50px;
line-height: 50px;
text-align: left;
text-decoration: none;
font-size: 18px;
color: white;
float: left;
margin-top: 160px;
}
.confirm-btn {
width: 416rpx;
height: 90rpx;
line-height: 90rpx;
background: #FD5775;
color: #fff;
font-size: 32rpx;
font-weight: bold;
font-size: 32rpx;
color: #FFFFFF;
position: absolute;
left: 0;
right: 0;
bottom: 70rpx;
}
</style>

View File

@ -37,11 +37,9 @@
<view class="u-flex-1" style="color: grey;padding-bottom: 30px;padding-top: 20upx;" @click="navTo('/pages/me/withdraw/alipay')">
提现账号
</view>
<view class="u-flex-1" style="color: grey;padding-bottom: 30px;padding-top: 20upx;" @click="navTo('')">
<view class="u-flex-1" style="color: grey;padding-bottom: 30px;padding-top: 20upx;" @click="navTo('/pages/me/withdraw/moneyList?moneyType=1&viewType=2')">
红包明细
</view>
<!-- <view style="color: grey;padding-bottom: 30px;padding-top: 20upx;width: 33%;" @click="gojilu">提现记录
</view> -->
</view>
<view style="text-align: left" class="moneyList u-p-b-30">
@ -72,16 +70,7 @@
</view>
</view>
</view>
<view class="page-box" v-if="!data.list.length">
<view class="centre">
<!-- <image src="../../static/images/learn/none.png" mode=""></image> -->
<view class="tips">
暂无记录
</view>
</view>
</view>
<emprty-card v-if="!data.list.length" />
</view>
</view>
@ -316,9 +305,7 @@
icon: 'none'
})
setTimeout(function() {
uni.navigateTo({
url: '/me/invite/zhifubao'
});
navTo('/pages/me/withdraw/alipay')
}, 1500)
}
@ -363,9 +350,7 @@
});
}
} else {
uni.navigateTo({
url: "/me/invite/zhifubao"
})
navTo('/pages/me/withdraw/alipay')
}
}

View File

@ -0,0 +1,120 @@
<template>
<view class="container">
<view v-if="data.list.length" v-for="(item, index) in data.list" :key="index" class="item">
<view>
<view style="color: #000000;font-size: 28upx;">
<view style="margin-bottom: 8upx;"> 类型 {{item.title}}</view>
<view style="margin-bottom: 8upx"> 内容 {{item.content}}</view>
<view style="margin-bottom: 8upx"> 时间 {{item.createTime}}</view>
<view style="margin-bottom: 8upx;text-align: right;">
<!-- 提现金额 -->
<text v-if="item.type===2" style="color: #666;font-size: 32upx;font-weight: 600"> - {{item.money}}</text>
<text v-if="item.type===1" style="color: #FD6416;font-size: 32upx;font-weight: 600">+ {{item.money}}</text>
</view>
</view>
</view>
</view>
<emprty-card v-if="!data.list.length" />
</view>
</template>
<script setup>
import { reactive } from 'vue';
import { onLoad } from '@dcloudio/uni-app'
import { queryUserMoneyDetails } from '@/api/me/withdraw.js';
let data = reactive({
list: [],
page: 1,
limit: 10,
totalCount: 0,
moneyType: null,
viewType: null,
})
onLoad((options) => {
if (options.moneyType) {
data.moneyType = options.moneyType
uni.setNavigationBarTitle({
title: options.moneyType == 1 ? '红包明细' : '金币明细'
});
}
if (options.viewType) {
data.viewType = options.viewType
}
getMoney();
})
function getMoney() {
queryUserMoneyDetails({
page : data.page,
limit : data.limit,
moneyType : data.moneyType,
viewType: data.viewType,
}).then(res => {
data.totalCount = res.total;
if ( res.records.length > 0) {
data.list = [...data.list,...res.records];
}
})
}
// onReachBottom: function() {
// if (this.page*this.limit < this.totalCount) {
// this.page = this.page + 1;
// this.getMoney();
// }
// }
// onPullDownRefresh: function() {
// this.page = 1;
// // that.list = []
// this.getMoney();
// }
</script>
<style lang='scss' scoped>
/* @import "../../static/css/index.css"; */
page {
background: #FFFFFF;
}
.item {
background: white;
padding: 32rpx;
margin: 32rpx;
font-size: 28rpx;
box-shadow: 7px 9px 34px rgba(0, 0, 0, 0.1);
border-radius: 16upx;
}
.centre {
text-align: center;
padding: 200rpx 0;
font-size: 32rpx;
box-sizing: border-box;
image {
width: 360rpx;
height: 360rpx;
// margin-bottom: 20rpx;
margin: 0 auto 20rpx;
// border: 1px dotted #000000;
}
.tips {
font-size: 34rpx;
color: #999999;
margin-top: 20rpx;
}
.btn {
margin: 80rpx auto;
width: 600rpx;
border-radius: 32rpx;
line-height: 90rpx;
color: #ffffff;
font-size: 34rpx;
background: #5074FF;
}
}
</style>

456
pages/share/index.vue Normal file
View File

@ -0,0 +1,456 @@
<!-- 我的邀请 -->
<template>
<view class="container">
<view class="head">
<up-image src="/static/share/share-bg.png" alt="" width="100%" mode="widthFix"></up-image>
<view class="top-title">
<view>
<up-image src="/static/share/title.png" alt="" width="544rpx" mode="widthFix"></up-image>
</view>
<view style="padding-right:70rpx;justify-content: flex-end">
<up-image src="/static/share/rule.png" alt="" width="400rpx" mode="widthFix"></up-image>
</view>
</view>
</view>
<view class="inviteBox">
<view class="top">
<u-image src="/static/share/bg1.png" alt="" width="422rpx" height="76rpx"></u-image>
<view class="u-absolute">
<text>邀请详情</text>
</view>
</view>
<view class="codeTitle">
您的邀请码
</view>
<view class="content">
<view class="code" style="">
{{data.invitationCode}}
</view>
<view class="u-flex u-row-between" style="padding: 0 88rpx;">
<u-button @tap="sharurl" :custom-style="data.customStyle" :hair-line="false"
:ripple="true">一键分享</u-button>
<u-button style="margin-left: 50rpx;" @click.stop="createPoster()" :custom-style="data.customStyle"
:hair-line="false" :ripple="true">保存海报</u-button>
</view>
</view>
<view class="gap u-m-t-32"></view>
<view class="u-m-t-32">
<view style="font-size: 32rpx;font-weight:bold;color: #000;text-align: center;">我的邀请战绩</view>
<view class="u-m-t-32" style="line-height: 46rpx;font-weight: bold;text-align: center;display: flex;justify-content: space-around;">
<view>
<view class="">已邀请</view>
<view class="text-red u-m-t-16 "><text class=" u-font-40">{{data.inviteCount}}</text></view>
</view>
<view>
<view class="">签到</view>
<view class="text-red u-m-t-16 "><text class=" u-font-40">{{data.inviteSignCount}}</text></view>
</view>
<view @click="goNav('/pages/me/withdraw/moneyList?moneyType=2&viewType=1')">
<view class="">金币收益</view>
<!-- <view class="text-red u-m-t-16 "><text class=" u-font-40">{{earning.inviteGoldMoney||0}}</text></view> -->
</view>
<view @click="goNav('/pages/me/withdraw/moneyList?moneyType=1&viewType=1')">
<view class="">红包收益</view>
<!-- <view class="text-red u-m-t-16 "><text class=" u-font-40">{{earning.inviteMoney||0}}</text></view> -->
</view>
</view>
<view class="u-m-t-16 u-p-b-32" style="text-align: center;color: #999;">好友签到成功可额外获得1元现金红包</view>
</view>
</view>
<view class="u-m-t-40 u-m-b-32" style="background-color: #fff;padding: 32rpx;border-radius: 16rpx;margin: 32rpx;">
<view class="u-font-32 " style="text-align: center;color: #333;font-weight: bold;">已邀请列表</view>
<view v-if="data.inviterList.length" class="u-m-t-20">
<view class="u-m-b-20" style="line-height: 80rpx;display: flex;justify-content: space-between;" v-for="(item, index) in data.inviterList"
:key='index'>
<view style="display: flex;">
<image src="/static/share/5.png" style="width: 80rpx;" mode="widthFix"></image>
<text class="margin-left-sm">{{item.userName}}</text>
</view>
<view style="width: 160rpx;" class="u-flex u-row-right font-bold">
<text class="text-red" v-if="item.recordNum>0">已签到</text>
<text class="color-999" v-else>未签到</text>
</view>
</view>
</view>
</view>
<view class="u-p-t-30 u-p-b-30" v-if="!data.inviterList.length">
<up-divider text="没有更多了"></up-divider>
</view>
<view style="width: 0;height: 0;overflow: hidden;">
<up-qrcode :size="200" :val="data.erweima" @result="qrR"></up-qrcode>
<canvas id="canvas" canvas-id="poster" :style="{width: data.canvasW+'px', height: data.canvasH+'px'}"></canvas>
</view>
<up-image :src="data.haibaoImg" alt="" width="400rpx" mode="widthFix"></up-image>
<!-- <tki-qrcode ref="qrcode" :val="erweima" :size="200" background="#fff" foreground="#000" pdground="#000"
:onval="true" :loadMake="true" @result="qrR" :show="false"></tki-qrcode> -->
<view class="cu-modal" :class="modalName == 'Image' ? 'show' : 'show'" @tap="hideModal">
<view class="cu-dialog" v-if="bgImg && erweimapath && haibaoShow" @tap="hideModal">
<view class="bg-img">
<!-- <wm-poster @success="posterSuccess" @successH5="successH5" :imgSrc="bgImg"
:Referrer="'我的邀请码:'+invitationCode" :QrSrc="erweimapath" :LineType="false"></wm-poster> -->
</view>
</view>
</view>
</view>
</template>
<script setup>
import { reactive, nextTick, ref } from 'vue';
import { onReady,onLoad,onShow } from '@dcloudio/uni-app'
import { updateUser } from '@/api/me/withdraw.js';
import { selectInviteMoney, selectInviteByUserIdLists, selectBannerList } from '@/api/share/index.js';
import { commonType } from '@/api/init.js';
import config from '@/commons/config.js';
let data = reactive({
loading:false,
qrcode: false,
earning: {
inviteMoney: 0,
inviteGoldMoney: 0,
},
erweimapath: '',
haibaoImg: null,
haibaoShow: false,
customStyle: {
background: '#DDDCFF',
border: '8rpx',
color: '#4544FF',
fontSize: '28rpx',
fontWeight: '700',
padding: '10rpx 32rpx',
},
page: 1,
limit: 10,
isEnd:false,
inviteCount: '', //
inviterList: [], //
erweima: '',
bgImg: '',
tuiguang: '',
invitationCode: uni.getStorageSync('userInfo').invitationCode,
h5SaveImg: '',
modalName: '',
haibaoImgH5: '',
inviteSignCount:0,
canvasW: 350,
canvasH: 667,
})
let settingWritePhotosAlbum = false;
onLoad(() => {
getInviter()
queryInviter()
getBgImg()
data.erweima = config.baseUrl + `/pages/login/register/?invitation=${data.invitationCode}&qdCode=${uni.getStorageSync('userInfo').qdCode}`
console.log(data.erweima)
})
/**
* 获取邀请战绩
*/
function queryInviter() {
selectInviteMoney().then(res => {
data.inviteCount = res.inviteCount //
data.inviteSignCount = res.inviteSignCount
data.earning.inviteGoldMoney = res.earning.inviteGoldMoney||0
data.earning.inviteMoney = res.earning.inviteMoney||0
console.log(data.earning)
// Object.assign(data.earning,res.earning)
})
}
/**
* 获取已邀请列表
*/
function getInviter() {
data.loading=true;
selectInviteByUserIdLists({
page: data.page,
limit: data.limit
}).then(res => {
data.loading=false;
data.inviterList =data.inviterList.concat(res.list)
data.isEnd=data.page>=res.totalPage?true:false;
})
}
/**
* 跳转收益列表
* @param {Object} url
*/
function goNav ( url) {
uni.navigateTo({
url: url
})
}
/**
* 一键分享
*/
function sharurl() {
uni.showModal({
title: '链接推广',
content: data.tuiguang + data.erweima,
showCancel: true,
cancelText: '关闭',
confirmText: '一键复制',
success: res => {
if (res.confirm) {
uni.setClipboardData({
data: data.tuiguang + data.erweima,
success: function() {
console.log('success');
uni.showToast({
title: '复制成功',
duration: 1000,
icon: 'none'
});
}
});
}
}
});
}
function posterSuccess(haibaoImg) {
data.haibaoImg = haibaoImg;
data.modalName = 'Image';
uni.hideLoading();
}
function successH5(haibaoImg) {
if ( haibaoImg ) {
data.haibaoImgH5 = haibaoImg
uni.previewImage({
urls: [haibaoImg],
current: 1,
})
}
}
function hideModal() {
data.modalName = null;
}
function qrR(path) {
data.erweimapath = path;
}
/**
* 获取海报图
*/
function getBgImg() {
selectBannerList({
classify: 5
}).then(res => {
data.bgImg = res[0].imageUrl
data.tuiguang = res[0].describes
// data.bgImg = "https://jiaoyu.xianmxkj.com/img/20230822/27d37f847db9481bb3dc54cd12258147.jpg"
});
}
function createdCanvas(imageInfos){
return new Promise((resolve, reject) => {
//
const ctx = uni.createCanvasContext('poster');
uni.createSelectorQuery()
.in(this)
.select('#canvas')
.boundingClientRect(rect => {
if(!rect) return
//
ctx.drawImage( data.bgImg, 0, 0, data.canvasW, data.canvasH );
console.log(data.canvasW)
//
ctx.drawImage( data.erweimapath, data.canvasW - 174, data.canvasH - 134, 64, 64 );
ctx.draw();
}).exec()
resolve()
})
}
/**
* 生成海报
*/
async function createPoster() {
uni.showLoading({
title: '海报生成中'
});
const Images = [data.bgImg, data.erweimapath];
Promise.all(Images.map(img => uni.getImageInfo({ src: img }))).then(
imageInfos => {
console.log('Images then>>>>>>', imageInfos);
data.bgImg = imageInfos[0].path;
data.erweimapath = imageInfos[1].path;
//
createdCanvas(imageInfos[0]).then(()=>{
//
setTimeout(() => {
// canvas-
uni.canvasToTempFilePath({
x: 0,
y: 0,
canvasId: "poster",
success: res => {
data.haibaoImg = res.tempFilePath;
data.modalName = 'Image';
data.haibaoShow = true
// #ifdef H5
uni.previewImage({
urls: [data.haibaoImg],
current: 1,
})
// #endif
// #ifndef H5
uni.saveImageToPhotosAlbum({
filePath: data.haibaoImg,
success: function() {
console.log('save success');
uni.showToast({
title: '海报已保存相册',
icon: 'success',
duration: 2000
});
}
});
// #endif
console.log('真实图片>>>>>>', res);
uni.hideLoading();
},
fail: (err) => { console.log('error', err) }
},this);
}, 500);
})
});
}
// onReachBottom() {
// if(data.isEnd||data.loading){
// return
// }
// data.page+=1
// getInviter()
// }
</script>
<style lang="scss" scoped>
$color1: #5857FF;
page {
background: #F3F4F8;
}
.container {
background: #F3F4F8;
.head{
position: relative;
.top-title {
position: absolute;
left: 0;
right: 0;
top: 192rpx;
>view{
display: flex;
justify-content: center;
}
}
}
}
.inviteBox {
position: relative;
margin-top: -240rpx;
background-color: #fff;
border-radius: 16rpx 16rpx 16rpx 16rpx;
margin-left: 28rpx;
margin-right: 28rpx;
.top {
position: absolute;
display: flex;
justify-content: center;
left: 134rpx;
right: 134rpx;
top: -24rpx;
.u-absolute {
position: absolute;
left: 0;
right: 0;
z-index: 1;
top: 0;
bottom: 0;
display: flex;
justify-content: center;
align-items: center;
font-size: 32rpx;
color: #FFFFFF;
font-weight: bold;
}
}
.codeTitle{
padding-top: 84rpx;
font-size: 32rpx;
font-weight: bold;
text-align: center;
color: #000;
}
.content{
.code{
font-size: 44rpx;
font-weight: bold;
text-align: center;
color: #5857FF;
margin: 32rpx auto;
}
}
}
.cu-dialog {
background-color: transparent;
}
.text-red {
color: $color1;
}
.gap {
width: 100%;
height: 0;
position: relative;
border-bottom: 1px dashed #eee;
&:before,
&::after {
display: block;
content: '';
position: absolute;
width: 34rpx;
height: 34rpx;
background: #F3F4F8;
border-radius: 50%;
z-index: 2;
top: 50%;
transform: translateY(-50%);
background-size: 100% 18px;
background-repeat: repeat-x
}
&:before {
left: -16rpx;
}
&::after {
right: -16rpx;
}
}
.bg-img {
background-color: transparent;
}
</style>

BIN
static/download/appLogo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 676 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

BIN
static/share/5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
static/share/bg1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
static/share/rule.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
static/share/share-bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 KiB

BIN
static/share/title.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB