|
@@ -0,0 +1,103 @@
|
|
|
+<template lang="">
|
|
|
+ <div></div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+export default {
|
|
|
+ auth: false,
|
|
|
+ head() {
|
|
|
+ return {
|
|
|
+ script: [
|
|
|
+ {
|
|
|
+ src: 'https://qiyukf.com/script/98112bcf552907c28ee450c6a58269c3.js',
|
|
|
+ async: true,
|
|
|
+ callback: () => {
|
|
|
+ // console.log(window.ysf);
|
|
|
+ this.init(window.ysf);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ isAutoOpen() {
|
|
|
+ return this.$route.query.autoopen === 'true';
|
|
|
+ },
|
|
|
+ isOnunread() {
|
|
|
+ return this.$route.query.onunread === 'true';
|
|
|
+ },
|
|
|
+ },
|
|
|
+ mounted() {},
|
|
|
+ methods: {
|
|
|
+ async init(ysf) {
|
|
|
+ this.ysf = ysf;
|
|
|
+ // console.log(ysf);
|
|
|
+
|
|
|
+ await new Promise((resolve, reject) => {
|
|
|
+ ysf('onready', resolve);
|
|
|
+ });
|
|
|
+
|
|
|
+ await new Promise((resolve, reject) => {
|
|
|
+ ysf('config', {
|
|
|
+ uid: String(this.$auth.user.id),
|
|
|
+ name: this.$auth.user.userName,
|
|
|
+ mobile: this.$auth.user.phone,
|
|
|
+ email: this.$auth.user.email,
|
|
|
+ data: JSON.stringify([
|
|
|
+ { key: 'real_name', value: this.$auth.user.userName },
|
|
|
+ { key: 'mobile_phone', hidden: true, value: this.$auth.user.phone },
|
|
|
+ { key: 'email', value: this.$auth.user.email },
|
|
|
+ // {
|
|
|
+ // key: 'avatar',
|
|
|
+ // label: '头像',
|
|
|
+ // value:
|
|
|
+ // 'https://ysf.qiyukf.net/operation/080659b993a45dd546fbd71efd5ef000',
|
|
|
+ // }, // 访客头像
|
|
|
+ {
|
|
|
+ index: 0,
|
|
|
+ key: 'account',
|
|
|
+ label: '账号',
|
|
|
+ value: this.$auth.user.phone,
|
|
|
+ // href: 'http://example.domain/user/zhangsan',
|
|
|
+ },
|
|
|
+ // { index: 1, key: 'sex', label: '性别', value: '先生' },
|
|
|
+ // {
|
|
|
+ // index: 5,
|
|
|
+ // key: 'reg_date',
|
|
|
+ // label: '注册日期',
|
|
|
+ // value: '2015-11-16',
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // index: 6,
|
|
|
+ // key: 'last_login',
|
|
|
+ // label: '上次登录时间',
|
|
|
+ // value: '2015-12-22 15:38:54',
|
|
|
+ // },
|
|
|
+ ]),
|
|
|
+ language: 'zh-cn',
|
|
|
+ success: resolve,
|
|
|
+ error: reject,
|
|
|
+ });
|
|
|
+ });
|
|
|
+ if (this.isAutoOpen) {
|
|
|
+ this.open();
|
|
|
+ }
|
|
|
+ if (this.isOnunread) {
|
|
|
+ this.onunread();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ open(data) {
|
|
|
+ this.ysf('open', data);
|
|
|
+ },
|
|
|
+ getUnreadMsg() {
|
|
|
+ const result = this.ysf('getUnreadMsg');
|
|
|
+ console.log(result.total, result.type, result.message);
|
|
|
+ // await new Promise((resolve, reject) => {});
|
|
|
+ },
|
|
|
+ onunread() {
|
|
|
+ this.ysf('onunread', (result) => {
|
|
|
+ console.log(result.total, result.type, result.message);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|