|
@@ -55,7 +55,7 @@
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
- <view class="flex-row justify-center">
|
|
|
|
|
|
|
+ <view class="flex-row justify-center" v-if="showQrCode">
|
|
|
<view class="qrView" @click="qrCodePopup">
|
|
<view class="qrView" @click="qrCodePopup">
|
|
|
<uv-qrcode ref="qrcode" size="600rpx" :value="qrcodeUrl" :options="options"></uv-qrcode>
|
|
<uv-qrcode ref="qrcode" size="600rpx" :value="qrcodeUrl" :options="options"></uv-qrcode>
|
|
|
</view>
|
|
</view>
|
|
@@ -89,7 +89,7 @@
|
|
|
},
|
|
},
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
- qrcodeUrl:this.$xcxUrl+'?expandUserId={expandUserId}&ruleId={ruleId}×tamp={timestamp}&type=2&expand1=2',
|
|
|
|
|
|
|
+ qrcodeUrl: this.$tkUrl + '?roleId={roleId}&parentId={parentId}×tamp={timestamp}&type=2&expand1=2',
|
|
|
options: {
|
|
options: {
|
|
|
// 指定二维码前景,一般可在中间放logo
|
|
// 指定二维码前景,一般可在中间放logo
|
|
|
foregroundImagePadding:2,
|
|
foregroundImagePadding:2,
|
|
@@ -99,6 +99,8 @@
|
|
|
homeStaticsData:{},
|
|
homeStaticsData:{},
|
|
|
value:0,
|
|
value:0,
|
|
|
roleList:[],
|
|
roleList:[],
|
|
|
|
|
+ roleBindRuleList:[],
|
|
|
|
|
+ showQrCode:true
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
created() {
|
|
created() {
|
|
@@ -110,6 +112,7 @@
|
|
|
methods: {
|
|
methods: {
|
|
|
selectChange(e){
|
|
selectChange(e){
|
|
|
console.log(e)
|
|
console.log(e)
|
|
|
|
|
+ this.getRuleByRoleId(this.roleList[this.value].id)
|
|
|
},
|
|
},
|
|
|
formatDate() {
|
|
formatDate() {
|
|
|
this.qrCreateTime = commonUtils.formatDate(new Date())
|
|
this.qrCreateTime = commonUtils.formatDate(new Date())
|
|
@@ -135,6 +138,19 @@
|
|
|
this.roleList[i].value = i;
|
|
this.roleList[i].value = i;
|
|
|
this.roleList[i].text = this.roleList[i].name
|
|
this.roleList[i].text = this.roleList[i].name
|
|
|
}
|
|
}
|
|
|
|
|
+ this.getRuleByRoleId(this.roleList[this.value].id)
|
|
|
|
|
+
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ //查询角色已经绑定的规则
|
|
|
|
|
+ getRuleByRoleId(roleId) {
|
|
|
|
|
+ this.$api.service.getRuleByRoleId({
|
|
|
|
|
+ roleId: roleId
|
|
|
|
|
+ }).then(res => {
|
|
|
|
|
+ console.log("1111111111111111111111")
|
|
|
|
|
+ this.roleBindRuleList = res.data.data
|
|
|
|
|
+ this.createQrCode()
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
|
|
|
|
@@ -147,6 +163,32 @@
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ createQrCode() {
|
|
|
|
|
+ if (!this.roleBindRuleList || this.roleBindRuleList.length === 0) {
|
|
|
|
|
+ this.showQrCode = false
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ icon: 'error',
|
|
|
|
|
+ duration: 3000,
|
|
|
|
|
+ title: '当前角色没有添加规则!'
|
|
|
|
|
+ });
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ this.showQrCode = true
|
|
|
|
|
+ let data = {
|
|
|
|
|
+ roleId: this.roleList[this.value].id,
|
|
|
|
|
+ parentId: this.userInfo.id,
|
|
|
|
|
+ timestamp: new Date().getTime() + (60 * 1000 * 60 * 24 * 365 * 10)
|
|
|
|
|
+ };
|
|
|
|
|
+ this.qrcodeUrl = this.$tkUrl + '?roleId={roleId}&parentId={parentId}×tamp={timestamp}&type=2&expand1=2',
|
|
|
|
|
+ console.log('获取到的角色ID',data.roleId)
|
|
|
|
|
+ for (let key in data) {
|
|
|
|
|
+ let regexp = new RegExp("{" + key + "}"); // 构造正则表达式
|
|
|
|
|
+ this.qrcodeUrl = this.qrcodeUrl.replace(regexp, data[key]); // 执行替换操作
|
|
|
|
|
+ }
|
|
|
|
|
+ console.log('++++qrcodeUrl+++++', this.qrcodeUrl)
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|