银花优选微信小程序修改后的最新版本代码

This commit is contained in:
ss001
2026-02-07 16:22:31 +08:00
commit c00caf5744
516 changed files with 41796 additions and 0 deletions

291
pages/mytgm/index.js Normal file
View File

@@ -0,0 +1,291 @@
var app = getApp()
var that=null
var sopenFrame=null
var ewmtitle=null
var img1=""
var mCanvas,mCanvas0,mCanvas1
Page( {
data: {
avatarUrl: "../../images/profile.png",
YQRcodeUrl: "",
QRcodeUrl: "",
minQRcodeUrl: "",
NCName:"您还没有登录,请先登录!",
loadingHidden:false,
shareImgSrc:"",
yqm:"",
savetitle:"保存二维码到相册",
ifdownload:0,
selindex:0,
tempFilePath:""
},
onLoad: function() {
that = this
that.rdata(0)
},onPullDownRefresh: function () {
//在当前页面显示导航条加载动画
wx.showNavigationBarLoading();
//显示 loading 提示框。需主动调用 wx.hideLoading 才能关闭提示框
wx.showLoading({
title: '刷新中...',
})
that.rdata(1)
},rdata: function(t) {
var userId = wx.getStorageSync("userId")
var LoginId = wx.getStorageSync("LoginId")
wx.request({
url: app.globalData.apiurl + "/xapiajax.ashx",
data: {
action:"getmytgm",
userId:(!userId?"":userId),
LoginId:(!LoginId?"":LoginId)
},
method:"GET",
dataType:"json",
success (res) {
if(res.data.status==1){
that.setData({
QRcodeUrl:res.data.QRcode,
YQRcodeUrl:res.data.QRcode,
minQRcodeUrl:res.data.QRcode,
yqm:res.data.yqm
})
if(res.data.QRcode!=""){
try{
/*wx.downloadFile({
url: res.data.QRcode,
success (res0) {
if (res0.statusCode === 200) {
img1=res0.tempFilePath
that.setData({
QRcodeUrl:img1,
ifdownload:1
})*/
img1=res.data.QRcode
that.setData({
ifdownload:1
})
wx.createSelectorQuery().select('#myCanvas')
.fields({ node: true, size: true })
.exec((res) => {
let textCanvas = res[0].node; // 重点1
mCanvas=textCanvas
let textCtx = textCanvas.getContext('2d'); // 重点2
const dpr = wx.getSystemInfoSync().pixelRatio
textCanvas.width = res[0].width * dpr
textCanvas.height = res[0].height * dpr
textCtx.scale(dpr, dpr)
textCtx.clearRect(0,0,textCanvas.width,textCanvas.height)
textCtx.beginPath();
//绘制背景
//textCtx.fillStyle = '#fff'
//textCtx.clearRect(0,0,textCanvas.width,textCanvas.height)
//textCtx.fillRect(0, 0, textCanvas.width, textCanvas.height)
const bg = textCanvas.createImage();
bg.src = '../../images/2wm_bg.png';
bg.onload = () => {
textCtx.drawImage(bg, 0, 0, 300, 533)
const bg0 = textCanvas.createImage();
bg0.src = img1;
bg0.onload = () => {
textCtx.drawImage(bg0, 110, 380, 90, 90)
}
}
})
that.setData({
loadingHidden: true
})
//}
//}
//})
}catch(err){
wx.showToast({
title: err,
icon: "none",
duration: 5000
})
}
}
}else{
if(res.data.msg=="您未登录"||res.data.msg=="参数错误"){
wx.removeStorageSync('userId')
wx.removeStorageSync('LoginId')
that.rdata(0)
}
wx.showToast({
title: res.data.msg,
icon: "none",
duration: 3000
})
}
if(t==1){
//隐藏loading 提示框
wx.hideLoading();
//隐藏导航条加载动画
wx.hideNavigationBarLoading();
//停止下拉刷新
wx.stopPullDownRefresh();
}
}
})
},onredata: function(e) {
that.rdata(0)
},swiperchange: function(e) {
that.setData({
selindex:e.detail.current
})
},onsavepic: function(e) {
that.setData({
savetitle:"保存中,请稍候..."
})
var userId = wx.getStorageSync("userId")
var LoginId = wx.getStorageSync("LoginId")
wx.canvasToTempFilePath({
canvasId: "myCanvas"+(that.data.selindex==0?"":(that.data.selindex==1?"0":"1")),
destWidth: 405,
destHeight: 720,
canvas: (that.data.selindex==0?mCanvas:(that.data.selindex==1?mCanvas0:mCanvas1)),
success: function(res0) {
// 获取图片路径
const tempFilePath = res0.tempFilePath;
wx.saveImageToPhotosAlbum({
filePath: tempFilePath,
success(res) {
console.log(res);
wx.showModal({
title: '图片保存成功',
content: '图片成功保存到相册了,去发圈噻~',
showCancel: false,
confirmText: '好哒',
confirmColor: '#72B9C3',
success: function (res0) {
if (res0.confirm) {
}
that.setData({
QRcodeHidden: true,
savetitle:"保存二维码到相册"
})
}
})
}
})
},
fail: function(err) {
wx.showToast({
title: err,
icon: "none",
duration: 10000
})
}
})
},onsavepic0: function() {
/*wx.saveImageToPhotosAlbum({
filePath: img1,
success(res) {
console.log(res);
wx.showModal({
title: '图片保存成功',
content: '图片成功保存到相册了,去发圈噻~',
showCancel: false,
confirmText: '好哒',
confirmColor: '#72B9C3',
success: function (res0) {
if (res0.confirm) {
}
that.setData({
QRcodeHidden: true,
savetitle:"保存二维码到相册"
})
}
})
}
})*/
},gotourl: function(e) {
var index = e.currentTarget.dataset.id
var userId = wx.getStorageSync("userId")
var LoginId = wx.getStorageSync("LoginId")
if(userId&&LoginId){
if(index==0){
that.onQRcode()
}else{
wx.navigateTo({
url: that.data.userListInfo[index].url
})
}
}else{
wx.navigateTo({
url: "../login/index"
})
}
},gouserinfo: function(e) {
var userId = wx.getStorageSync("userId")
var LoginId = wx.getStorageSync("LoginId")
if(userId&&LoginId){
wx.navigateTo({
url: "../myto/index"
})
}else{
wx.navigateTo({
url: "../login/index"
})
}
},
ontreturn:function() {
wx.navigateBack({})
},
onQRcode:function() {
that.setData({
QRcodeHidden:false
})
},closeQRcode:function(e) {
that.setData({
QRcodeHidden: true
})
},inQRcode:function(e) {
},onregister:function(e) {
wx.navigateTo({
url: "../register/index?tguid=" + that.data.yqm
})
},
oncopy:function(e) {
var font = e.currentTarget.dataset.font
wx.setClipboardData({
data: font,
success: function (res) {
wx.showToast({
title: "复制成功"
})
}
})
}
})

3
pages/mytgm/index.json Normal file
View File

@@ -0,0 +1,3 @@
{
"navigationBarTitleText": "我的邀请码"
}

38
pages/mytgm/index.wxml Normal file
View File

@@ -0,0 +1,38 @@
<view class="container">
<view class="Hidden_box" bindtap="closeQRcode">
<view class="Hidden_box_to" catchtap="inQRcode">
<view class="body" wx:if='{{tempFilePath==""}}'>
<swiper class="swiper_box" indicator-dots="{{true}}" vertical="{{false}}" circular="true" bindchange="swiperchange"
autoplay="{{true}}" interval="{{6000}}" duration="{{1200}}">
<swiper-item>
<canvas type="2d" canvas-id="myCanvas" id="myCanvas" style="width: 300px; height: 533px;"></canvas>
</swiper-item>
-
</swiper>
</view>
<view class="yqm-box">
<view>邀请码:{{yqm}}</view> <button class="copy" bindtap="oncopy" data-font="{{yqm}}">复制</button>
</view>
<view class="savebutton">
<button class="savepic" bindtap="onsavepic">{{savetitle}}</button>
<button class="register" bindtap="onregister">去注册新会员</button>
</view>
<view class="body" wx:if='{{tempFilePath!=""}}'>
<view class="swiper_box">
<image src="{{tempFilePath}}" style="width: 300px;height:533px;"></image>
</view>
</view>
</view>
</view>
</view>
<loading hidden="{{loadingHidden}}">
加载中...
</loading>

89
pages/mytgm/index.wxss Normal file
View File

@@ -0,0 +1,89 @@
/**index.wxss**/
page{
background: #ccc;
}
.container {
position: relative;
width: 100%;
height: 100%;
font-size: 14px;
}
.Hidden_box{position: relative; display: flex;align-items: center; justify-content: center; width:100%;height:100vh; }
.Hidden_box_to{position: relative; margin-top: 0; padding: 0; width:100%;height:100vh; box-sizing: border-box; }
.Hidden_box_to.addcart_box{ position: absolute; bottom:0; width:100%;border-radius:0.5em 0.5em 0 0;}
.Hidden_box_to .close{position: absolute; right:-0.5em; top:-0.5em;z-index:10000; width:1.5em; height:1.5em; padding:0.15em; background-color:#fff;border:1px solid #dfdfdf;border-radius:50%;box-sizing:border-box;}
.Hidden_box_to .close image{width:100%;height:100%;}
.Hidden_box_to .title{width:100%;height:2.5em;}
.Hidden_box_to .body{line-height:1.5em; position: relative; float: left;width:100%;height:100vh; padding: 0.8em; box-sizing: border-box;}
.Hidden_box_to .body .swiper_box{
position: relative;
margin: 0 auto;
width: 300px;
height: 533px;
background-color:#fff;
/*padding: 0.8em;*/
border-radius:0.5em;
box-sizing: border-box;
overflow: hidden;
}
.Hidden_box_to .body .swiper_box .wx-swiper-dots{bottom: 0em;}
.Hidden_box_to .body .swiper_box canvas{
position: relative;
width: 300px;
height: 533px;
border-radius:0.5em;
}
.Hidden_box_to .body .swiper_box image{
width:100%;
height:100%;
border-radius:0.5em;
}
.Hidden_box_to .body .swiper_box view image{
width:100%;
height:100%;
border-radius:0;
}
.Hidden_box_to .body .swiper_box view.minQRcodeUrl{
position: absolute;
bottom:1.2em;
right:6.5em;
width:3em;
height:3em;
background-color: #fff;
padding: 0.2em;
border-radius:0.5em;
}
.Hidden_box_to .body .swiper_box view.minQRcodeUrl0{
position: absolute;
top:11.8em;
left:7.8em;
width:5em;
height:5em;
background-color: #fff;
padding: 0.2em;
border-radius:0.5em;
}
.Hidden_box_to .body .swiper_box view.minQRcodeUrl1{
position: absolute;
bottom:0.8em;
right:0.8em;
width:3.6em;
height:3.6em;
background-color: #fff;
padding: 0.2em;
border-radius:0.5em;
}
.Hidden_box_to .yqm-box{position:fixed; bottom:2.8em; left:0; display: flex; flex-direction: row; text-align: center;z-index: 1000000; width:100%; background-color: #fff; padding:0.5em; box-sizing: border-box;align-items: center; justify-content: center; }
.Hidden_box_to .yqm-box view{width:60%;text-align: right;}
.Hidden_box_to .yqm-box button{margin-left:0.5em; padding:0; width:5em;height:2em;line-height:2em;background:linear-gradient(to right,#00B050,#00B050); text-align: center; color:#fff;border-radius:0.5em; font-size: 0.85em;
}
.Hidden_box_to .savebutton{position:fixed; bottom:0em; left:0; display: flex; flex-direction: row; text-align: center;z-index: 1000000; width:100%; background-color: #fff; padding:0.5em; box-sizing: border-box;}
.Hidden_box_to .savebutton button{margin:0 auto; margin-top:0.2em; padding:0; display: block; width:10em;height:2em;line-height:2em;background:linear-gradient(to right,#00B050,#00B050); text-align: center; color:#fff;border-radius:0.5em; font-size: 0.85em;
}
.Hidden_box_to .savebutton button.register{width:9em; margin-left:0.5em;}
.Hidden_box_to .savebutton button.copy{width:8em; margin-left:0.5em;}
.Hidden_box_to .savebutton button.redata{width:8em; margin-left:0.5em;}