HomeLease/pages/agents/requestAgent.vue
2025-08-20 17:11:21 +08:00

171 lines
3.8 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="agents-page">
<!-- 头部区域 -->
<custom-nav-bar3 title=""></custom-nav-bar3>
<view class="header">
<image :src="commonEnum.INVITE" class="agent-background" mode="aspectFill"></image>
</view>
<!-- 主要内容区域 -->
<view class="main-content">
<view class="qrcode-container">
<uv-qrcode :options="qrcodeOptions" :value="qrcodeValue" size="500rpx"></uv-qrcode>
</view>
<!-- 按钮区域 -->
<view class="button-container">
<button class="action-button" @click="saveAndSharePoster">
<text class="button-text">保存分享海报</text>
</button>
<button class="action-button" @click="sendToFriends">
<text class="button-text">保存分享海报</text>
<text class="button-sub-text">发给好友扫码</text>
</button>
</view>
</view>
</view>
</template>
<script>
import commonEnum from '../../enum/commonEnum'
import UvQrcode from '../../uni_modules/uv-qrcode/components/uv-qrcode/uv-qrcode.vue'
import { getLocalUserId } from '../../api/user/user.js'
export default {
name: 'AgentsPage',
components: { UvQrcode },
data() {
return {
qrcodeValue: '',
qrcodeOptions: {
errorCorrectLevel: 'Q',
margin: 10,
areaColor: '#fff',
},
}
},
computed: {
commonEnum() {
return commonEnum
},
},
onLoad() {
// 页面加载时获取本地存储的用户ID作为二维码内容
this.initQrcodeValue()
},
methods: {
// 初始化二维码内容
initQrcodeValue() {
const userId = getLocalUserId()
if (userId) {
this.qrcodeValue = userId
console.log('使用用户ID作为二维码内容:', userId)
} else {
// 如果没有用户ID使用默认值
this.qrcodeValue = '123456'
console.warn('未找到用户ID使用默认二维码内容')
}
},
// 保存分享海报
saveAndSharePoster() {
uni.showToast({
title: '保存分享海报功能',
icon: 'none',
})
// TODO: 实现保存分享海报功能
console.log('保存分享海报')
},
// 发送给好友扫码
sendToFriends() {
uni.showToast({
title: '发送给好友扫码功能',
icon: 'none',
})
// TODO: 实现发送给好友扫码功能
console.log('发送给好友扫码')
},
},
}
</script>
<style lang="scss" scoped>
.agents-page {
position: relative;
background: #fbe4ba;
min-height: 100vh;
}
// 头部区域
.header {
position: relative;
background: #fedfcd;
.agent-background {
position: relative;
width: 750rpx;
}
}
// 主要内容区域
.main-content {
position: relative;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
top: -25rpx;
background: #ffffff;
border-radius: 40rpx;
margin: 0 30rpx;
padding: 40rpx;
height: 1050rpx;
.qrcode-container {
padding: 40rpx;
background: white;
border-radius: 20rpx;
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.1);
margin-bottom: 200rpx;
}
.button-container {
display: flex;
gap: 30rpx;
width: 100%;
justify-content: center;
}
.action-button {
flex: 1;
max-width: 280rpx;
height: 100rpx;
background: white;
border: 2rpx solid #ff6b35;
border-radius: 50rpx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 20rpx;
box-shadow: 0 4rpx 12rpx rgba(255, 107, 53, 0.2);
.button-text {
color: #ff6b35;
font-size: 28rpx;
font-weight: 500;
line-height: 1.2;
}
.button-sub-text {
color: #ff6b35;
font-size: 20rpx;
opacity: 0.8;
margin-top: 4rpx;
}
}
}
</style>