分享二维码里面是用户id
This commit is contained in:
parent
bd7f74c346
commit
449f86727a
|
|
@ -30,13 +30,14 @@
|
|||
<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: '123456',
|
||||
qrcodeValue: '',
|
||||
qrcodeOptions: {
|
||||
errorCorrectLevel: 'Q',
|
||||
margin: 10,
|
||||
|
|
@ -50,9 +51,23 @@ export default {
|
|||
},
|
||||
},
|
||||
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({
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user