You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
1.4 KiB
69 lines
1.4 KiB
6 years ago
|
import { createQRCode } from '../../utils/api'
|
||
|
|
||
|
Component({
|
||
|
data: {
|
||
|
qrcodeValue: 'https://www.baidu.com',
|
||
|
visible: false,
|
||
|
qrCodeImage: ''
|
||
|
},
|
||
|
properties: {
|
||
|
dialogVisible: {
|
||
|
type: Boolean,
|
||
|
observer: function (value) {
|
||
|
this.setData({
|
||
|
visible: value
|
||
|
})
|
||
|
},
|
||
|
value: false
|
||
|
},
|
||
|
groupInfo: {
|
||
|
type: Object,
|
||
|
value: {
|
||
|
groupAvatar: '',
|
||
|
groupLeader: '',
|
||
|
groupName:'',
|
||
|
groupId: ''
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
pageLifetimes: {
|
||
|
show () {
|
||
|
this.createQRCode()
|
||
|
}
|
||
|
},
|
||
|
methods: {
|
||
|
// 预览 二维码
|
||
|
previewImage() {
|
||
|
const that = this.selectComponent('#qrcode')
|
||
|
wx.canvasToTempFilePath({
|
||
|
canvasId: 'wux-qrcode',
|
||
|
success: (res) => {
|
||
|
wx.previewImage({
|
||
|
urls: [res.tempFilePath]
|
||
|
})
|
||
|
}
|
||
|
}, that)
|
||
|
},
|
||
|
// 关闭 弹框
|
||
|
closeDialog () {
|
||
|
this.triggerEvent('parentVisibleValue', {visibleValue: false})
|
||
|
this.setData({
|
||
|
visible: false
|
||
|
})
|
||
|
},
|
||
|
createQRCode () {
|
||
|
const para = {
|
||
|
gridId: '1169158285790900226',
|
||
|
inviteUserId: '31f31a620399d18a39329f663437da72'
|
||
|
}
|
||
|
createQRCode(para).then(res => {
|
||
|
console.log('生成邀请二维码', res)
|
||
|
this.setData({
|
||
|
qrCodeImage: res.data
|
||
|
})
|
||
|
}).catch(err => {
|
||
|
console.log(err)
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
})
|