|
@@ -37,7 +37,7 @@
|
|
<el-dialog :visible.sync="wxDialog" title="绑定微信" width="30%" center :destroy-on-close="true">
|
|
<el-dialog :visible.sync="wxDialog" title="绑定微信" width="30%" center :destroy-on-close="true">
|
|
<el-row type="flex" justify="center">
|
|
<el-row type="flex" justify="center">
|
|
<el-col :span="24" style="text-align:center">
|
|
<el-col :span="24" style="text-align:center">
|
|
- <img :src="dataUrl" />
|
|
|
|
|
|
+ <qrcode exchange="qrcode.bind" :uri="qrUri" :config="config" :qrcode="qrcode" @toReturn="toReturn"></qrcode>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
@@ -45,7 +45,9 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import QRCode from 'qrcode';
|
|
|
|
|
|
+import Vue from 'vue';
|
|
|
|
+import '@frame/plugins/setting';
|
|
|
|
+import qrcode from '@frame/components/qrcode.vue';
|
|
import dataForm from '@frame/components/form';
|
|
import dataForm from '@frame/components/form';
|
|
import { mapState, mapMutations, createNamespacedHelpers } from 'vuex';
|
|
import { mapState, mapMutations, createNamespacedHelpers } from 'vuex';
|
|
import _ from 'lodash';
|
|
import _ from 'lodash';
|
|
@@ -53,7 +55,7 @@ const { mapActions } = createNamespacedHelpers('login');
|
|
export default {
|
|
export default {
|
|
name: 'navBar',
|
|
name: 'navBar',
|
|
props: {},
|
|
props: {},
|
|
- components: { dataForm },
|
|
|
|
|
|
+ components: { dataForm, qrcode },
|
|
data: () => ({
|
|
data: () => ({
|
|
weixin: require('@frame/assets/wechat.png'),
|
|
weixin: require('@frame/assets/wechat.png'),
|
|
dataUrl: '',
|
|
dataUrl: '',
|
|
@@ -67,6 +69,9 @@ export default {
|
|
{ min: 6, message: '密码最少6位', trigger: 'blur' },
|
|
{ min: 6, message: '密码最少6位', trigger: 'blur' },
|
|
],
|
|
],
|
|
},
|
|
},
|
|
|
|
+ qrUri: '',
|
|
|
|
+ config: {},
|
|
|
|
+ qrcode: '',
|
|
}),
|
|
}),
|
|
created() {},
|
|
created() {},
|
|
computed: {
|
|
computed: {
|
|
@@ -74,7 +79,7 @@ export default {
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
...mapMutations(['deleteUser']),
|
|
...mapMutations(['deleteUser']),
|
|
- ...mapActions(['login', 'update']),
|
|
|
|
|
|
+ ...mapActions(['login', 'update', 'getQrcode']),
|
|
async toLogout() {
|
|
async toLogout() {
|
|
this.deleteUser();
|
|
this.deleteUser();
|
|
this.$notify({
|
|
this.$notify({
|
|
@@ -104,10 +109,19 @@ export default {
|
|
if (this.$checkRes(res, '修改成功', '修改失败')) this.toClose();
|
|
if (this.$checkRes(res, '修改成功', '修改失败')) this.toClose();
|
|
},
|
|
},
|
|
async bind() {
|
|
async bind() {
|
|
- let uri = `http://free.liaoningdoupo.com/api/train/authtest?redirect_uri=http://10.16.10.7:8001/confirm&uid=${this.user.id}&type=1`;
|
|
|
|
- this.dataUrl = await QRCode.toDataURL(uri);
|
|
|
|
|
|
+ let res = await this.getQrcode();
|
|
|
|
+ this.$set(this, `qrcode`, res);
|
|
|
|
+ this.$set(this, `config`, { weixin: Vue.config.weixin, stomp: Vue.config.stomp });
|
|
|
|
+ let uri = `/api/train/authtest?redirect_uri=${Vue.config.weixin.target}/confirm&uid=${this.user.id}&type=1&qrcode=${res}`;
|
|
|
|
+ this.$set(this, `qrUri`, uri);
|
|
this.wxDialog = true;
|
|
this.wxDialog = true;
|
|
},
|
|
},
|
|
|
|
+ toReturn(message) {
|
|
|
|
+ this.$notify({
|
|
|
|
+ type: 'success',
|
|
|
|
+ message: message.body,
|
|
|
|
+ });
|
|
|
|
+ },
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|