标注,4.4之前

This commit is contained in:
DESKTOP-RQ919RC\Pc 2025-04-16 18:33:36 +08:00
parent 626155a820
commit ced718c079
15 changed files with 302 additions and 672 deletions

View File

@ -24,8 +24,7 @@
"pages/circularize/circularize",
"pages/askHousing/askHousing",
"pages/transfer/transfer",
"pages/video_show/video_show",
"pages/dome/dome"
"pages/video_show/video_show"
],
"subpackages": [{

View File

@ -328,7 +328,7 @@ Page({
const roomList = this.data.roomList || []
let title = `${ roomList.length > 1 ? '多房型' : '' }`
const price = Math.min(...roomList.map(item => item.price));
const price = data.rentprice
title += ` HK$${ price }`
const bj = data.image

View File

@ -1,287 +0,0 @@
// pages/dome/dome.js
Page({
/**
* 页面的初始数据
*/
data: {},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.drawPoster();
},
async drawPoster() {
return
// 修改画布创建方式
const canvas = wx.createOffscreenCanvas({
type: "2d",
width: 280 * 2, // 增加分辨率
height: 224 * 2, // 增加分辨率
});
const ctx = canvas.getContext("2d");
ctx.scale(2, 2); // 缩放绘图上下文
// 绘制背景
let bgImg = canvas.createImage();
await new Promise((resolve) => {
bgImg.onload = resolve;
bgImg.src = "https://oss.x-php.com/Zvt57TuJSUvkyhw-xG7Y2l-T9pwkfHvqqsgFptxhXa6QWi2uePJ5Bg8cFLPIqoYV7MsLCmeW5lr_-kU8uRQ0NDI5";
});
// 计算aspectFill模式参数
const containerRatio = 280 / 219; // 容器宽高比 (280x219)
const imageRatio = bgImg.width / bgImg.height;
let drawWidth,
drawHeight,
offsetX = 0,
offsetY = 0;
if (imageRatio > containerRatio) {
// 图片更宽,按高度缩放
drawHeight = 219;
drawWidth = drawHeight * imageRatio;
offsetX = (280 - drawWidth) / 2;
} else {
// 图片更高,按宽度缩放
drawWidth = 280;
drawHeight = drawWidth / imageRatio;
offsetY = (219 - drawHeight) / 2;
}
// 绘制圆角背景修改drawImage参数
ctx.save();
ctx.beginPath();
ctx.moveTo(15, 4);
ctx.arcTo(280, 4, 280, 224, 15);
ctx.arcTo(280, 224, 0, 224, 15);
ctx.arcTo(0, 224, 0, 4, 15);
ctx.arcTo(0, 4, 280, 4, 15);
ctx.closePath();
ctx.clip();
// 计算源图片裁剪区域
let srcX = 0,
srcY = 0,
srcWidth = bgImg.width,
srcHeight = bgImg.height;
// 修正缩放逻辑
if (imageRatio > containerRatio) {
// 图片更宽时,按容器高度缩放
drawHeight = 219;
drawWidth = drawHeight * imageRatio;
offsetX = (280 - drawWidth) / 2;
// 源图片裁剪:取中间宽度区域
srcWidth = bgImg.height * containerRatio;
srcX = (bgImg.width - srcWidth) / 2;
} else {
// 图片更高时,按容器宽度缩放
drawWidth = 280;
drawHeight = drawWidth / imageRatio;
offsetY = (219 - drawHeight) / 2;
// 源图片裁剪:取中间高度区域
srcHeight = bgImg.width / containerRatio;
srcY = (bgImg.height - srcHeight) / 2;
}
// 修改后的drawImage调用
ctx.drawImage(
bgImg,
srcX,
srcY,
srcWidth, // 改为计算后的裁剪宽度
srcHeight, // 改为计算后的裁剪高度
offsetX,
4,
drawWidth,
drawHeight
);
ctx.restore();
// 绘制右上角标签
let tagImg = canvas.createImage();
await new Promise((resolve) => {
tagImg.onload = resolve;
tagImg.src = "https://app.gter.net/image/miniApp/HKRenting/high-quality-tag.png";
});
ctx.drawImage(tagImg, 215, 0, 65, 54);
let username = "asdfghjjkl,jhasdfghjjkl,jhasdfghjjkl,jhasdfghjjkl,jh";
// 绘制用户信息区域
// 绘制用户信息区域
// 先测量文本长度
ctx.font = "14px PingFang SC";
ctx.fillStyle = "#000";
let displayText = username + " 为你推荐14";
let textMetrics = ctx.measureText(displayText);
let textWidth = textMetrics.width;
// 添加文本截断逻辑
const MAX_TEXT_WIDTH = 165; // 最大允许文本宽度
if (textWidth > MAX_TEXT_WIDTH) {
let limit = username.length;
// 逐步减少字符直到宽度合适
while (textWidth > MAX_TEXT_WIDTH && limit > 0) {
limit--;
displayText = username.substring(0, limit) + "... 为你推荐";
textMetrics = ctx.measureText(displayText);
textWidth = textMetrics.width;
}
}
// 动态计算区域宽度头像24 + 边距4 + 文本宽度 + 右边距10
const infoWidth = 24 + 4 + textWidth + 10;
const startX = 0;
const startY = 24;
const radius = 16;
ctx.fillStyle = "#f2f2f2";
ctx.beginPath();
ctx.moveTo(startX, startY);
ctx.lineTo(infoWidth - radius, startY);
ctx.arcTo(infoWidth, startY, infoWidth, startY + 28, radius);
ctx.lineTo(infoWidth, startY + 28 - radius);
ctx.arcTo(infoWidth, startY + 28, startX, startY + 28, radius);
ctx.lineTo(startX, startY + 28);
ctx.closePath();
ctx.fill();
// 绘制头像
let avatarImg = canvas.createImage();
await new Promise((resolve) => {
avatarImg.onload = resolve;
avatarImg.src = "https://oss.x-php.com/avatar/97K4EWIMLrsbGTWXslC0UlxSH_WP0kIg22nLYMG8a1OEctxifNbDW9U7oWFhY2E~/middle";
});
ctx.save();
ctx.beginPath();
ctx.arc(14, 38, 12, 0, Math.PI * 2);
ctx.clip();
ctx.drawImage(avatarImg, 2, 26, 24, 24);
ctx.restore();
// 绘制用户名
ctx.fillStyle = "#000";
ctx.font = "14px PingFang SC";
// 修改最终文本绘制调用
console.log("displayText", displayText);
ctx.fillText(displayText, 30, 43); // 使用处理后的文本
// 绘制底部信息栏
const gradient = ctx.createLinearGradient(0, 190, 0, 224);
gradient.addColorStop(0, "rgba(51, 51, 51, 0.2)");
gradient.addColorStop(1, "rgba(51, 51, 51, 0.9)");
ctx.fillStyle = gradient;
ctx.beginPath();
ctx.moveTo(0, 190);
ctx.arcTo(280, 190, 280, 224, 0);
ctx.arcTo(280, 224, 0, 224, 15);
ctx.arcTo(0, 224, 0, 190, 15);
ctx.closePath();
ctx.fill();
// 绘制位置图标
let positionIcon = canvas.createImage();
await new Promise((resolve) => {
positionIcon.onload = resolve;
positionIcon.src = "https://app.gter.net/image/miniApp/HKRenting/position-icon.svg";
});
ctx.drawImage(positionIcon, 9, 200, 10, 14);
// 绘制位置文本
ctx.fillStyle = "#fff";
ctx.font = "15px microsoft yahei";
ctx.fillText("香港 | 多房型 HK$5600起", 25, 212);
// 绘制箭头图标
let arrowIcon = canvas.createImage();
await new Promise((resolve) => {
arrowIcon.onload = resolve;
arrowIcon.src = "https://app.gter.net/image/miniApp/HKRenting/arrow-round-yellow.svg";
});
ctx.drawImage(arrowIcon, 255, 200, 16, 16);
// 修改最后保存图片的尺寸
const imgData = canvas.toDataURL({
width: 280,
height: 224,
destWidth: 280 * 2, // 输出双倍分辨率
destHeight: 224 * 2,
});
const time = new Date().getTime();
const filePath = wx.env.USER_DATA_PATH + "/poster" + time + "share" + ".png";
const fs = wx.getFileSystemManager();
// console.log("imgData", imgData);
this.setData({
src: imgData,
});
fs.writeFile({
filePath,
data: imgData.replace(/^data:image\/\w+;base64,/, ""),
encoding: "base64",
success: (res) => {
wx.getImageInfo({
src: filePath,
success: (res) => {
console.log("res", res);
},
});
this.setData({
filePath,
});
},
fail: (err) => {
// 此处可能存在内存满了的情况
// 需要根据具体需求处理
console.log(err);
},
});
fs.close();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {},
/**
* 生命周期函数--监听页面显示
*/
onShow() {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
return {
imageUrl: this.data.filePath,
};
},
});

View File

@ -1,4 +0,0 @@
{
"usingComponents": {
}
}

View File

@ -1,154 +0,0 @@
/* pages/dome/dome.wxss */
.image {
width: 280px;
height: 168px;
// background-color: royalblue;
}
.container {
padding-top: 180rpx;
}
.placard {
width: 280px;
height: 224px;
position: relative;
padding-top: 4px;
.placard-bj {
width: 280px;
height: 219px;
border-radius: 15px;
}
.placard-tag {
position: absolute;
top: 0;
right: 0;
width: 65px;
height: 54px;
}
.placard-info {
position: absolute;
top: 24px;
left: 0;
background-color: rgba(242, 242, 242, 1);
display: flex;
align-items: center;
padding-right: 10px;
height: 28px;
background-color: rgba(242, 242, 242, 1);
border-radius: 0 16px 16px 0;
font-size: 14px;
font-family: 'PingFangSC-Regular', 'PingFang SC', sans-serif;
.avatar {
width: 24px;
height: 24px;
border-radius: 50%;
margin-left: 2px;
margin-right: 4px;
}
}
.position {
position: absolute;
bottom: 0;
left: 0;
width: 280px;
height: 34px;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
padding: 0 9px;
border-radius: 0 0 15px 15px;
.position-icon {
width: 10px;
height: 14px;
margin-right: 3px;
}
.position-text {
flex: 1;
font-family: 'microsoft yahei';
font-size: 15px;
color: #FFFFFF;
}
.position-arrow {
width: 16px;
height: 16px;
}
}
}
.placard-no-pic {
width: 280px;
height: 224px;
position: relative;
.info {
display: flex;
align-items: center;
color: #555555;
font-size: 14px;
margin-bottom: 13px;
.avatar {
width: 24px;
height: 24px;
border-radius: 50%;
margin-right: 5px;
}
}
.box {
position: relative;
.bj {
width: 280px;
height: 188px;
border-radius: 10px;
}
.text {
font-size: 16px;
color: #000000;
font-family: 'PingFangSC-Regular', 'PingFang SC', sans-serif;
line-height: 50px;
}
.position {
position: absolute;
top: 0;
left: 44px;
}
.type {
position: absolute;
top: 50px;
left: 44px;
}
.price {
position: absolute;
top: 100px;
left: 44px;
display: flex;
align-items: center;
.sum {
font-family: 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC', sans-serif;
font-weight: 650;
font-size: 20px;
color: #FA6B11;
margin-right: 4px;
}
}
}
}

View File

@ -1,44 +0,0 @@
<!--pages/dome/dome.wxml-->
<view class="container">
<view class="placard-no-pic">
<view class="info">
<image class="avatar"
src="https://oss.x-php.com/Zvt57TuJSUvkyhw-xG7Y2l-d_Zwocn3qqsgFptxhcq_cQnrld6YjDgwVBq_D-81qNDQyOQ~~"
mode="widthFix"></image>
肖荣豪 为你推荐
</view>
<view class="box">
<image class="bj" src="https://app.gter.net/image/miniApp/HKRenting/share-default-bj.png" mode="widthFix">
</image>
<view class="position text">香港 > 新界 > 大围/沙田</view>
<view class="type text">合租 · 房间</view>
<view class="price text"><view class="sum">5300</view> HK$/月</view>
</view>
</view>
<image class="image" src="{{ src }}" mode="widthFix"></image>
23
<view class="placard">
<image class="placard-bj"
src="https://oss.x-php.com/Zvt57TuJSUvkyhw-xG7Y2l-T9pwkfHvqqsgFptxhXa6QWi2uePJ5Bg8cFLPIqoYV7MsLCmeW5lr_-kU8uRQ0NDI5"
mode="aspectFill"></image>
<image class="placard-tag" src="https://app.gter.net/image/miniApp/HKRenting/high-quality-tag.png"
mode="widthFix"></image>
<view class="placard-info">
<image class="avatar"
src="https://oss.x-php.com/Zvt57TuJSUvkyhw-xG7Y2l-d_Zwocn3qqsgFptxhcq_cQnrld6YjDgwVBq_D-81qNDQyOQ~~"
mode="widthFix"></image>
肖荣豪 为你推荐
</view>
<view class="position">
<image class="position-icon" src="https://app.gter.net/image/miniApp/HKRenting/position-icon.svg"
mode="widthFix"></image>
<view class="position-text">
香港 | 多房型 HK$5600起
</view>
<image class="position-arrow" src="https://app.gter.net/image/miniApp/HKRenting/arrow-round-yellow.svg">
</image>
</view>
</view>
</view>

View File

@ -1,129 +0,0 @@
/* pages/dome/dome.wxss */
.image {
width: 280px;
height: 168px;
}
.container {
padding-top: 180rpx;
}
.placard {
width: 280px;
height: 224px;
position: relative;
padding-top: 4px;
}
.placard .placard-bj {
width: 280px;
height: 219px;
border-radius: 15px;
}
.placard .placard-tag {
position: absolute;
top: 0;
right: 0;
width: 65px;
height: 54px;
}
.placard .placard-info {
position: absolute;
top: 24px;
left: 0;
display: flex;
align-items: center;
padding-right: 10px;
height: 28px;
background-color: #f2f2f2;
border-radius: 0 16px 16px 0;
font-size: 14px;
font-family: 'PingFangSC-Regular', 'PingFang SC', sans-serif;
}
.placard .placard-info .avatar {
width: 24px;
height: 24px;
border-radius: 50%;
margin-left: 2px;
margin-right: 4px;
}
.placard .position {
position: absolute;
bottom: 0;
left: 0;
width: 280px;
height: 34px;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
padding: 0 9px;
border-radius: 0 0 15px 15px;
}
.placard .position .position-icon {
width: 10px;
height: 14px;
margin-right: 3px;
}
.placard .position .position-text {
flex: 1;
font-family: 'microsoft yahei';
font-size: 15px;
color: #FFFFFF;
}
.placard .position .position-arrow {
width: 16px;
height: 16px;
}
.placard-no-pic {
width: 280px;
height: 224px;
position: relative;
}
.placard-no-pic .info {
display: flex;
align-items: center;
color: #555555;
font-size: 14px;
margin-bottom: 13px;
}
.placard-no-pic .info .avatar {
width: 24px;
height: 24px;
border-radius: 50%;
margin-right: 5px;
}
.placard-no-pic .box {
position: relative;
}
.placard-no-pic .box .bj {
width: 280px;
height: 188px;
border-radius: 10px;
}
.placard-no-pic .box .text {
font-size: 16px;
color: #000000;
font-family: 'PingFangSC-Regular', 'PingFang SC', sans-serif;
line-height: 50px;
}
.placard-no-pic .box .position {
position: absolute;
top: 0;
left: 44px;
}
.placard-no-pic .box .type {
position: absolute;
top: 50px;
left: 44px;
}
.placard-no-pic .box .price {
position: absolute;
top: 100px;
left: 44px;
display: flex;
align-items: center;
}
.placard-no-pic .box .price .sum {
font-family: 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC', sans-serif;
font-weight: 650;
font-size: 20px;
color: #FA6B11;
margin-right: 4px;
}

View File

@ -131,11 +131,13 @@ Page({
if (el['select']) listType = el['type']
})
data.apartment = data.apartment.slice(0, 5)
this.setData({
...data,
listType,
loding: false
})
this.getNoticeNumber()
this.getListData()
})

View File

@ -1,4 +1,5 @@
<import src="../common/common.wxml" />
<view class="container" wx:if="{{ !loding }}">
<to-top wx:if="{{ showTOTOP }}"></to-top>
<view style="position: fixed;top: -200px;right: 0;">
@ -11,7 +12,6 @@
<header-nav inner-text="Some text" isIndexPage="index" headerSrc="{{ miniProgram == 'gx' ? 'top-image1.png' : 'top-image.png' }}" bgcolor="{{ operationsTop ? 'rgba(246, 246, 246, 1)' : 'linear-gradient(0deg, rgba(246, 246, 246, 1) 2%, rgba(98, 177, 255, 1) 333%)'}}" topImage="{{ !operationsTop }}"></header-nav>
<!-- 新的 首页轮播图 -->
<!-- 搜索框 -->
<view url="/pages/search/search" hover-class="hover">
<view class="search-box flexacenter" bindtap="publicJumps" data-url="/pages/search/search">
@ -25,9 +25,11 @@
</view>
</view>
</view>
<view style="margin-bottom: 30rpx;">
<xin-head-swiper data="{{ banner }}"></xin-head-swiper>
</view>
<!-- 新的 首页轮播图 -->
<xin-head-swiper class="xin-head-swiper" data="{{ banner }}"></xin-head-swiper>
<!-- 分类 -->
<view class="types-tab">
@ -88,27 +90,42 @@
</view>
<!-- 公寓列表 新 -->
<view class="apartment-block-new" wx:if="{{ true }}">
<scroll-view scroll-x="{{ true }}" class="list scroll">
<view class="item" wx:for="{{ apartment }}" wx:key="index" bindtap="publicJumps" data-url="/pages/brandApartmentDetail/brandApartmentDetail?uniqid={{ item.id }}">
<image class="bj" src="https://app.gter.net/image/miniApp/HKRenting/apartment-bj.jpg" mode="widthFix"></image>
<view class="title one-line-display">{{ item.title }}</view>
<view class="describe one-line-display">{{ item.propaganda }}</view>
<view class="cover">
<image class="cover-img" src="{{ item.images[0] }}" mode="widthFix"></image>
<image class="play" src="/img/frontPlay.svg" mode="widthFix"></image>
</view>
</view>
</scroll-view>
</view>
<!-- 公寓列表 新 -->
<view class="apartment-block">
<scroll-view scroll-x="{{ true }}" class="apartment-list scroll">
<!-- <view class="apartment-list flexflex"> -->
<view class="apartment-item flexflex" wx:for="{{ apartment }}" wx:key="index" bindtap="publicJumps" data-url="/pages/brandApartmentDetail/brandApartmentDetail?uniqid={{ item.id }}">
<!-- 更多 -->
<view class="apartment-item-more flexcenter" wx:if="{{ index == 4 }}" catch:tap="goIrentList">
<view class="apartment-item-more-btn flexcenter">
更多
<image class="apartment-item-more-icon" src="https://app.gter.net/image/miniApp/HKRenting/arrows-yellow.png"></image>
</view>
</view>
<view class="apartment-name one-line-display">{{ item.title }}</view>
<view class="apartment-introduce one-line-display">{{ item.propaganda }}</view>
<view class="apartment-image-list flexacenter">
<view class="apartment-image-item" wx:for="{{ item.images }}" wx:key="index">
<image class="" mode="aspectFill" wx:if="{{ index < 2}}" src="{{ item }}"></image>
<image mode="widthFix" class="apartment-image-item-icon" src="/img/frontPlay.svg"></image>
</view>
<view class="apartment-item flexflex" wx:for="{{ apartment }}" wx:key="index" bindtap="publicJumps" data-url="/pages/brandApartmentDetail/brandApartmentDetail?uniqid={{ item.id }}">
<!-- 更多 -->
<view class="apartment-item-more flexcenter" wx:if="{{ index == 4 }}" catch:tap="goIrentList">
<view class="apartment-item-more-btn flexcenter">
更多
<image class="apartment-item-more-icon" src="https://app.gter.net/image/miniApp/HKRenting/arrows-yellow.png"></image>
</view>
</view>
<view class="apartment-name one-line-display">{{ item.title }}</view>
<view class="apartment-introduce one-line-display">{{ item.propaganda }}</view>
<view class="apartment-image-list flexacenter">
<view class="apartment-image-item" wx:for="{{ item.images }}" wx:key="index">
<image class="" mode="aspectFill" wx:if="{{ index < 2}}" src="{{ item }}"></image>
<image mode="widthFix" class="apartment-image-item-icon" src="/img/frontPlay.svg"></image>
</view>
</view>
</view>
<!-- </view> -->
</scroll-view>
</view>

View File

@ -227,6 +227,96 @@
right: -15rpx;
transform: rotate(90deg);
}
}
}
.xin-head-swiper {
margin-bottom: 30rpx;
display: block;
}
.apartment-block-new {
margin-top: 37.5rpx;
.list {
width: 100vw;
box-sizing: border-box;
white-space: nowrap;
.item {
position: relative;
width: 322.5rpx;
height: 390rpx;
border-radius: 24rpx;
display: inline-flex;
&:first-of-type {
margin-left: 30rpx;
}
&:not(:last-of-type) {
margin-right: 18rpx;
}
&:last-of-type {
margin-right: 30rpx;
}
.bj {
width: 322.5rpx;
height: 390rpx;
border-radius: 24rpx;
}
.title {
font-family: 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC', sans-serif;
font-weight: 650;
font-style: normal;
font-size: 30rpx;
position: absolute;
top: 18rpx;
left: 22.5rpx;
width: 294rpx;
}
.describe {
font-family: 'PingFangSC-Regular',
'PingFang SC',
sans-serif;
font-weight: 400;
font-style: normal;
color: #555555;
font-size: 21rpx;
position: absolute;
top: 103.5rpx;
left: 66rpx;
width: 211.5rpx;
}
.cover {
position: absolute;
top: 184.5rpx;
left: 27rpx;
width: 270rpx;
height: 177rpx;
.cover-img {
width: 270rpx;
height: 177rpx;
border-radius: 10rpx;
}
.play {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 84rpx;
height: 84rpx;
}
}
}
}
}

View File

@ -190,3 +190,77 @@
right: -15rpx;
transform: rotate(90deg);
}
.xin-head-swiper {
margin-bottom: 30rpx;
display: block;
}
.apartment-block-new {
margin-top: 37.5rpx;
}
.apartment-block-new .list {
width: 100vw;
box-sizing: border-box;
white-space: nowrap;
}
.apartment-block-new .list .item {
position: relative;
width: 322.5rpx;
height: 390rpx;
border-radius: 24rpx;
display: inline-flex;
}
.apartment-block-new .list .item:first-of-type {
margin-left: 30rpx;
}
.apartment-block-new .list .item:not(:last-of-type) {
margin-right: 18rpx;
}
.apartment-block-new .list .item:last-of-type {
margin-right: 30rpx;
}
.apartment-block-new .list .item .bj {
width: 322.5rpx;
height: 390rpx;
border-radius: 24rpx;
}
.apartment-block-new .list .item .title {
font-family: 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC', sans-serif;
font-weight: 650;
font-style: normal;
font-size: 30rpx;
position: absolute;
top: 18rpx;
left: 22.5rpx;
width: 294rpx;
}
.apartment-block-new .list .item .describe {
font-family: 'PingFangSC-Regular', 'PingFang SC', sans-serif;
font-weight: 400;
font-style: normal;
color: #555555;
font-size: 21rpx;
position: absolute;
top: 103.5rpx;
left: 66rpx;
width: 211.5rpx;
}
.apartment-block-new .list .item .cover {
position: absolute;
top: 184.5rpx;
left: 27rpx;
width: 270rpx;
height: 177rpx;
}
.apartment-block-new .list .item .cover .cover-img {
width: 270rpx;
height: 177rpx;
border-radius: 10rpx;
}
.apartment-block-new .list .item .cover .play {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 84rpx;
height: 84rpx;
}

View File

@ -8,6 +8,7 @@ Component({
*/
properties: {
data: Array,
page: String,
},
/**
@ -16,6 +17,7 @@ Component({
data: {
swiperCurrent: 0,
HeadSwiperHeight: 100,
swiperHeightObj: {},
loadIndex: 0, // 加载图片的数量
},
@ -26,17 +28,25 @@ Component({
methods: {
// 轮播图的加载事件
loadHeadSwiper(e) {
const index = e.target.dataset.index || 0
let ratio = app.globalData.screen_data['windowWidth'] / 750
let originalWidth = e.detail.width;
let originalHeight = e.detail.height;
let height = originalHeight / originalWidth * 690 * ratio
this.data.loadIndex++
if (height > this.data.HeadSwiperHeight) {
this.setData({
HeadSwiperHeight: height
})
}
let swiperHeightObj = this.data.swiperHeightObj || {}
swiperHeightObj[index] = height
this.setData({
swiperHeightObj,
})
// if (height > this.data.HeadSwiperHeight) {
// this.setData({
// HeadSwiperHeight: height
// })
// }
if (this.data.loadIndex != this.data.data.length) return
this.triggerEvent("recordSwiperHeight")
},

View File

@ -1,18 +1,18 @@
<view class="headSwiper">
<swiper class='headSwiper-swiper' current="{{ swiperCurrent }}" autoplay="{{ true }}" circular interval="{{ 3000 }}" duration="{{ 500 }}" bindanimationfinish="bindchangeSwiper" style="height: {{ HeadSwiperHeight + 5 }}px;">
<block wx:for="{{ data }}" wx:key="index">
<swiper-item>
<form class="form" bindsubmit="handleSwiper" report-submit='true' data-types="confirm" data-type="{{ item.type }}" data-appid="{{ item.appid }}" data-url="{{ item.url }}" data-statid="{{ item.statid }}" data-finderUserName="{{ item.finderUserName }}" data-feedId="{{ item.feedId }}">
<image class="headSwiper-img" lazy-load mode="widthFix" src="{{ item.imageurl || item.image }}" bindload="loadHeadSwiper"></image>
<button form-type="submit" hover-class="none" type="default" size="mini"></button>
</form>
</swiper-item>
</block>
<!-- <swiper class='headSwiper-swiper' current="{{ swiperCurrent }}" autoplay="{{ true }}" circular interval="{{ 3000 }}" duration="{{ 500 }}" bindanimationfinish="bindchangeSwiper" style="height: {{ HeadSwiperHeight + 5 }}px;"> -->
<swiper class='headSwiper-swiper' current="{{ swiperCurrent }}" autoplay="{{ false }}" circular interval="{{ 3000 }}" duration="{{ 500 }}" bindanimationfinish="bindchangeSwiper" style="height: {{ swiperHeightObj[swiperCurrent] }}px;">
<swiper-item wx:for="{{ data }}" wx:key="index">
<form class="form" bindsubmit="handleSwiper" report-submit='true' data-types="confirm" data-type="{{ item.type }}" data-appid="{{ item.appid }}" data-url="{{ item.url }}" data-statid="{{ item.statid }}" data-finderUserName="{{ item.finderUserName }}" data-feedId="{{ item.feedId }}">
<image class="headSwiper-img" lazy-load mode="widthFix" src="{{ item.imageurl || item.image }}" bindload="loadHeadSwiper" data-index="{{ index }}"></image>
<button form-type="submit" hover-class="none" type="default" size="mini"></button>
</form>
</swiper-item>
</swiper>
<view class="indication-point flexacenter">
<block wx:for="{{ data }}" wx:key="index">
<view class="indication-point-item {{ index == swiperCurrent ? 'pitch' : '' }}"></view>
</block>
<view class="red-point" wx:if="{{ page == 'index' }}">
<view class="item {{ index == swiperCurrent ? 'pitch' : '' }}" wx:for="{{ data }}" wx:key="index"></view>
</view>
<view class="indication-point flexacenter" wx:else>
<view wx:for="{{ data }}" wx:key="index" class="indication-point-item {{ index == swiperCurrent ? 'pitch' : '' }}"></view>
</view>
</view>

View File

@ -4,6 +4,7 @@
.headSwiper-swiper {
position: relative;
transition: all .2s;
}
.headSwiper {
@ -68,4 +69,26 @@
background: transparent;
border: none;
outline: none;
}
.red-point {
display: flex;
justify-content: center;
align-items: center;
margin-top: 15rpx;
}
.red-point .item {
width: 7.5rpx;
height: 7.5rpx;
background-color: rgba(170, 170, 170, 1);
border-radius: 30rpx;
}
.red-point .item.pitch {
background-color: rgba(249, 93, 93, 1);
}
.red-point .item:not(:last-of-type) {
margin-right: 7.5rpx;
}

View File

@ -2,19 +2,19 @@ var initial_url = "https://app.gter.net/tenement";
var app = null;
function initial(self) {
const fs = wx.getFileSystemManager();
console.log("getCurrentDate", getCurrentDate());
fs.mkdir({
dirPath: `${wx.env.USER_DATA_PATH}/${getCurrentDate()}`,
// dirPath: `${wx.env.USER_DATA_PATH}/2025-04-13`,
success(res) {
console.log("res", res);
},
fail(err) {
console.log("err", err);
},
});
fs.close();
// const fs = wx.getFileSystemManager();
// console.log("getCurrentDate", getCurrentDate());
// fs.mkdir({
// dirPath: `${wx.env.USER_DATA_PATH}/${getCurrentDate()}`,
// // dirPath: `${wx.env.USER_DATA_PATH}/2025-04-13`,
// success(res) {
// console.log("res", res);
// },
// fail(err) {
// console.log("err", err);
// },
// });
// fs.close();
app = self;
getUserInfo(function (code) {
@ -962,7 +962,21 @@ function generatePoster(target) {
arrowIcon.src = `https://app.gter.net/image/miniApp/HKRenting/arrow-round-yellow.png?${Date.now()}`;
});
ctx.drawImage(arrowIcon, 255, 200, 16, 16);
console.log("绘制箭头图标完成");
console.log("绘制箭头图标完成-开始保存");
wx.canvasToTempFilePath({
quality: 1,
canvas,
success: (res) => {
console.log("生成路径", res.tempFilePath)
resolve(res.tempFilePath);
},
fail: err => {
console.log("生成失败", err);
}
})
return
// 修改最后保存图片的尺寸
const imgData = canvas.toDataURL({
@ -974,6 +988,8 @@ function generatePoster(target) {
const filePath = `${wx.env.USER_DATA_PATH}/${getCurrentDate()}/poster_share_${Date.now()}.png`;
const fs = wx.getFileSystemManager();
console.log("开始保存");
let writeFileSum = 0; // 写入次数
const writeFile = () => {
@ -1124,12 +1140,15 @@ function generatePosterNoImage(target) {
// 绘制文字信息
ctx.font = "16px PingFang SC";
ctx.fillStyle = "#000000";
console.log("渲染文字信息完成");
// 位置信息
ctx.fillText(target.position, 44, 71);
console.log("渲染位置信息完成");
// 类型信息
ctx.fillText(target.typeText, 44, 121);
console.log("渲染类型完成");
// 价格信息
ctx.font = "20px PingFang SC";
@ -1138,7 +1157,21 @@ function generatePosterNoImage(target) {
ctx.font = "16px PingFang SC";
ctx.fillStyle = "#000000";
ctx.fillText("HK$/月", 44 + ctx.measureText(target.price).width + 12, 171);
console.log("渲染价格完成");
wx.canvasToTempFilePath({
quality: 1,
canvas,
success: (res) => {
console.log("生成路径", res.tempFilePath)
resolve(res.tempFilePath);
},
fail: err => {
console.log("生成失败", err);
}
})
return
// 导出图片
const imgData = canvas.toDataURL({
destWidth: 280 * 2,