2025-08-16 16:03:42 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<view class="agents-page">
|
|
|
|
|
|
<!-- 头部区域 -->
|
2025-08-26 17:14:01 +08:00
|
|
|
|
<custom-nav-bar :fill="false" :show-back="true" background-color="transparent" title="" />
|
2025-08-16 16:03:42 +08:00
|
|
|
|
<view class="header">
|
|
|
|
|
|
<image :src="commonEnum.INVITE" class="agent-background" mode="aspectFill"></image>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 主要内容区域 -->
|
|
|
|
|
|
<view class="main-content">
|
2025-08-16 17:09:51 +08:00
|
|
|
|
<view class="qrcode-container">
|
2025-08-20 16:59:06 +08:00
|
|
|
|
<uv-qrcode :options="qrcodeOptions" :value="qrcodeValue" size="500rpx"></uv-qrcode>
|
2025-08-16 17:18:47 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
|
2025-08-25 15:26:04 +08:00
|
|
|
|
<view class="button-container">
|
|
|
|
|
|
<button class="action-button" @click="copyQrcodeValue">
|
|
|
|
|
|
<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>
|
2025-08-16 16:03:42 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import commonEnum from '../../enum/commonEnum'
|
2025-08-16 17:09:51 +08:00
|
|
|
|
import UvQrcode from '../../uni_modules/uv-qrcode/components/uv-qrcode/uv-qrcode.vue'
|
2025-08-20 17:11:21 +08:00
|
|
|
|
import { getLocalUserId } from '../../api/user/user.js'
|
2025-08-25 15:26:04 +08:00
|
|
|
|
import { onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
|
|
|
|
|
|
|
|
|
|
|
|
onShareAppMessage(e => {
|
|
|
|
|
|
return {}
|
|
|
|
|
|
})
|
2025-08-16 16:03:42 +08:00
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
|
name: 'AgentsPage',
|
2025-08-16 17:09:51 +08:00
|
|
|
|
components: { UvQrcode },
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
2025-08-20 17:11:21 +08:00
|
|
|
|
qrcodeValue: '',
|
2025-08-16 17:18:47 +08:00
|
|
|
|
qrcodeOptions: {
|
2025-08-16 17:09:51 +08:00
|
|
|
|
errorCorrectLevel: 'Q',
|
|
|
|
|
|
margin: 10,
|
|
|
|
|
|
areaColor: '#fff',
|
|
|
|
|
|
},
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2025-08-16 16:03:42 +08:00
|
|
|
|
computed: {
|
|
|
|
|
|
commonEnum() {
|
|
|
|
|
|
return commonEnum
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
onLoad() {
|
2025-08-20 17:11:21 +08:00
|
|
|
|
// 页面加载时获取本地存储的用户ID作为二维码内容
|
|
|
|
|
|
this.initQrcodeValue()
|
2025-08-16 16:03:42 +08:00
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
2025-08-25 15:26:04 +08:00
|
|
|
|
// 复制二维码链接
|
|
|
|
|
|
copyQrcodeValue() {
|
|
|
|
|
|
uni.setClipboardData({
|
|
|
|
|
|
data: this.qrcodeValue,
|
|
|
|
|
|
success: () => {
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: '链接已复制',
|
|
|
|
|
|
icon: 'success',
|
|
|
|
|
|
})
|
|
|
|
|
|
console.log('复制成功:', this.qrcodeValue)
|
|
|
|
|
|
},
|
|
|
|
|
|
fail: err => {
|
|
|
|
|
|
console.error('复制失败:', err)
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: '复制失败',
|
|
|
|
|
|
icon: 'none',
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2025-08-20 17:11:21 +08:00
|
|
|
|
// 初始化二维码内容
|
|
|
|
|
|
initQrcodeValue() {
|
|
|
|
|
|
const userId = getLocalUserId()
|
|
|
|
|
|
if (userId) {
|
2025-08-21 15:07:36 +08:00
|
|
|
|
// 构建包含登录页面链接和用户ID的二维码内容
|
2025-08-22 11:47:54 +08:00
|
|
|
|
this.qrcodeValue = `https://wx.ccttiot.com/cf/i/?agentId=${userId}`
|
2025-08-21 15:07:36 +08:00
|
|
|
|
console.log('二维码内容:', this.qrcodeValue)
|
2025-08-20 17:11:21 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
// 如果没有用户ID,使用默认值
|
2025-08-22 11:47:54 +08:00
|
|
|
|
this.qrcodeValue = 'https://wx.ccttiot.com/cf/i?/agentId=123456'
|
2025-08-20 17:11:21 +08:00
|
|
|
|
console.warn('未找到用户ID,使用默认二维码内容')
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2025-08-16 17:18:47 +08:00
|
|
|
|
// 保存分享海报
|
|
|
|
|
|
saveAndSharePoster() {
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: '保存分享海报功能',
|
|
|
|
|
|
icon: 'none',
|
|
|
|
|
|
})
|
|
|
|
|
|
// TODO: 实现保存分享海报功能
|
|
|
|
|
|
console.log('保存分享海报')
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 发送给好友扫码
|
|
|
|
|
|
sendToFriends() {
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: '发送给好友扫码功能',
|
|
|
|
|
|
icon: 'none',
|
|
|
|
|
|
})
|
|
|
|
|
|
// TODO: 实现发送给好友扫码功能
|
|
|
|
|
|
console.log('发送给好友扫码')
|
|
|
|
|
|
},
|
2025-08-16 16:03:42 +08:00
|
|
|
|
},
|
|
|
|
|
|
}
|
|
|
|
|
|
</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;
|
2025-08-16 17:09:51 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
align-items: center;
|
2025-08-16 16:03:42 +08:00
|
|
|
|
top: -25rpx;
|
|
|
|
|
|
background: #ffffff;
|
|
|
|
|
|
border-radius: 40rpx;
|
|
|
|
|
|
margin: 0 30rpx;
|
|
|
|
|
|
padding: 40rpx;
|
|
|
|
|
|
height: 1050rpx;
|
|
|
|
|
|
|
2025-08-16 17:09:51 +08:00
|
|
|
|
.qrcode-container {
|
|
|
|
|
|
padding: 40rpx;
|
|
|
|
|
|
background: white;
|
|
|
|
|
|
border-radius: 20rpx;
|
|
|
|
|
|
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.1);
|
2025-08-20 16:59:06 +08:00
|
|
|
|
margin-bottom: 200rpx;
|
2025-08-16 17:09:51 +08:00
|
|
|
|
}
|
2025-08-16 17:18:47 +08:00
|
|
|
|
|
|
|
|
|
|
.button-container {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
gap: 30rpx;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.action-button {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
max-width: 280rpx;
|
2025-08-25 15:26:04 +08:00
|
|
|
|
height: 80rpx;
|
2025-08-16 17:18:47 +08:00
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-08-16 16:03:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
</style>
|