|
|
@ -2,12 +2,20 @@ |
|
|
<div class="getCode_container"> |
|
|
<div class="getCode_container"> |
|
|
<div class="content"> |
|
|
<div class="content"> |
|
|
<el-card shadow="never"> |
|
|
<el-card shadow="never"> |
|
|
|
|
|
<!-- 使用悬浮球设置组件 --> |
|
|
|
|
|
<FloatBallSetting |
|
|
|
|
|
ref="floatBallSettingRef" |
|
|
|
|
|
:token="uniqueToken" |
|
|
|
|
|
@save="handleFloatBallConfigSaved" |
|
|
|
|
|
@update:config="handleFloatBallConfigUpdate" |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
<el-collapse v-model="activeName" accordion> |
|
|
<el-collapse v-model="activeName" accordion> |
|
|
<el-collapse-item title="超链接" name="1"> |
|
|
<el-collapse-item title="超链接" name="1"> |
|
|
<alink :tokeninfo="token" :site-url="siteUrl" @cget-copy="getCopy"></alink> |
|
|
<alink :tokeninfo="token" :site-url="siteUrl" :unique-token="uniqueToken" @cget-copy="getCopy"></alink> |
|
|
</el-collapse-item> |
|
|
</el-collapse-item> |
|
|
<el-collapse-item title="网页内嵌" name="2"> |
|
|
<el-collapse-item title="网页内嵌" name="2"> |
|
|
<wangye :tokeninfo="token" :site-url="siteUrl" @cget-copy="getCopy"></wangye> |
|
|
<wangye :tokeninfo="token" :site-url="siteUrl" :unique-token="uniqueToken" :float-config="floatBallConfig" @cget-copy="getCopy"></wangye> |
|
|
</el-collapse-item> |
|
|
</el-collapse-item> |
|
|
</el-collapse> |
|
|
</el-collapse> |
|
|
</el-card> |
|
|
</el-card> |
|
|
@ -21,11 +29,15 @@ import { ref, computed, onMounted, getCurrentInstance } from 'vue'; |
|
|
// import { adminAppCustomer, appReset } from '@/api/kefu'; |
|
|
// import { adminAppCustomer, appReset } from '@/api/kefu'; |
|
|
import alink from './components/alink.vue'; |
|
|
import alink from './components/alink.vue'; |
|
|
import wangye from './components/wangye.vue'; |
|
|
import wangye from './components/wangye.vue'; |
|
|
|
|
|
import FloatBallSetting from './components/FloatBallSetting.vue'; |
|
|
|
|
|
import type { FloatBallConfig } from './components/FloatBallSetting.vue'; |
|
|
|
|
|
import { getInfo } from '@/api/login'; |
|
|
// import kaifa from './components/kaifa'; |
|
|
// import kaifa from './components/kaifa'; |
|
|
// import setting from './components/setting'; |
|
|
// import setting from './components/setting'; |
|
|
|
|
|
|
|
|
const activeName = ref('1'); |
|
|
const activeName = ref('1'); |
|
|
|
|
|
const floatBallSettingRef = ref<InstanceType<typeof FloatBallSetting>>(); |
|
|
|
|
|
const uniqueToken = ref(''); |
|
|
const { proxy } = getCurrentInstance() as any; |
|
|
const { proxy } = getCurrentInstance() as any; |
|
|
|
|
|
|
|
|
// const store = useStore(); |
|
|
// const store = useStore(); |
|
|
@ -33,7 +45,11 @@ const { proxy } = getCurrentInstance() as any; |
|
|
// const categoryId = computed(() => store.state.userLevel?.categoryId); |
|
|
// const categoryId = computed(() => store.state.userLevel?.categoryId); |
|
|
// const labelWidth = computed(() => (isMobile.value ? undefined : 75)); |
|
|
// const labelWidth = computed(() => (isMobile.value ? undefined : 75)); |
|
|
// const labelPosition = computed(() => (isMobile.value ? 'top' : 'left')); |
|
|
// const labelPosition = computed(() => (isMobile.value ? 'top' : 'left')); |
|
|
|
|
|
// 👇 定义悬浮球配置(默认空) |
|
|
|
|
|
const floatBallConfig = ref<FloatBallConfig>({ |
|
|
|
|
|
pcImage: '', |
|
|
|
|
|
mobileImage: '', |
|
|
|
|
|
}); |
|
|
const token = ref<any>(''); |
|
|
const token = ref<any>(''); |
|
|
const canfrime = ref(false); |
|
|
const canfrime = ref(false); |
|
|
const srcUrl = ref(`${location.origin}/customerServer.js`); |
|
|
const srcUrl = ref(`${location.origin}/customerServer.js`); |
|
|
@ -42,7 +58,10 @@ const cloneTip = ref(false); |
|
|
const canCustomerServer = ref(''); |
|
|
const canCustomerServer = ref(''); |
|
|
|
|
|
|
|
|
const linkUrl = computed(() => `${location.origin}/chat/index?token=${token.value?.token_md5}&noCanClose=1`); |
|
|
const linkUrl = computed(() => `${location.origin}/chat/index?token=${token.value?.token_md5}&noCanClose=1`); |
|
|
|
|
|
onMounted(() => { |
|
|
|
|
|
// 页面加载就获取当前代理的 uniqueToken ✅ |
|
|
|
|
|
fetchAgentToken(); |
|
|
|
|
|
}); |
|
|
// onMounted(() => { |
|
|
// onMounted(() => { |
|
|
// getAdminAppCustomer(); |
|
|
// getAdminAppCustomer(); |
|
|
// }); |
|
|
// }); |
|
|
@ -60,6 +79,36 @@ const linkUrl = computed(() => `${location.origin}/chat/index?token=${token.valu |
|
|
// // ignore if module not present |
|
|
// // ignore if module not present |
|
|
// } |
|
|
// } |
|
|
// } |
|
|
// } |
|
|
|
|
|
// 获取当前登录用户的 uniqueToken |
|
|
|
|
|
async function fetchAgentToken() { |
|
|
|
|
|
try { |
|
|
|
|
|
const res = await getInfo(); |
|
|
|
|
|
if (res.data?.tokenInfo?.uniqueToken) { |
|
|
|
|
|
// 拿到真正的 token! |
|
|
|
|
|
uniqueToken.value = res.data.tokenInfo.uniqueToken; |
|
|
|
|
|
console.log('✅ 获取成功 uniqueToken =', uniqueToken.value); |
|
|
|
|
|
} |
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
console.error('获取token失败', e); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 处理悬浮球配置更新 |
|
|
|
|
|
function handleFloatBallConfigUpdate(config: FloatBallConfig) { |
|
|
|
|
|
floatBallConfig.value = config; |
|
|
|
|
|
// 这里可以将配置应用到客服组件 |
|
|
|
|
|
console.log('悬浮球配置已更新:', config); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 处理悬浮球配置保存 |
|
|
|
|
|
function handleFloatBallConfigSaved(config: FloatBallConfig) { |
|
|
|
|
|
floatBallConfig.value = config; |
|
|
|
|
|
// 可以在这里执行额外的保存逻辑,比如同步到服务器 |
|
|
|
|
|
console.log('悬浮球配置已保存:', config); |
|
|
|
|
|
|
|
|
|
|
|
// 如果需要保存到服务器,可以在这里调用API |
|
|
|
|
|
// saveFloatBallConfigToServer(config); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
function resetToken() { |
|
|
function resetToken() { |
|
|
canfrime.value = true; |
|
|
canfrime.value = true; |
|
|
@ -144,7 +193,7 @@ function copyToClipboard(elem: HTMLElement) { |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<style> |
|
|
<style lang="scss"> |
|
|
.getCode_container { |
|
|
.getCode_container { |
|
|
.content { |
|
|
.content { |
|
|
width: 100%; |
|
|
width: 100%; |
|
|
@ -242,6 +291,7 @@ function copyToClipboard(elem: HTMLElement) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
</style> |
|
|
</style> |
|
|
|
|
|
|
|
|
<style scoped> |
|
|
<style scoped> |
|
|
.ivu-modal-confirm { |
|
|
.ivu-modal-confirm { |
|
|
display: flex; |
|
|
display: flex; |
|
|
|