Commit df9d76c3 authored by nick zheng's avatar nick zheng

fix: 发布应用后状态没有更新及分享链接有误

parent 2a5514dd
...@@ -2,9 +2,7 @@ import { h } from 'vue' ...@@ -2,9 +2,7 @@ import { h } from 'vue'
import CustomIcon from '@/components/custom-icon/custom-icon.vue' import CustomIcon from '@/components/custom-icon/custom-icon.vue'
import { formatDateTime } from '@/utils/date-formatter' import { formatDateTime } from '@/utils/date-formatter'
export function createChannelPublishColumn( export function createChannelPublishColumn(handleChannelPublishTableAction: (actionType: string) => void) {
handleChannelPublishTableAction: (actionType: string, linkUrl: string) => void,
) {
return [ return [
{ {
title: '发布渠道', title: '发布渠道',
...@@ -122,7 +120,7 @@ export function createChannelPublishColumn( ...@@ -122,7 +120,7 @@ export function createChannelPublishColumn(
key: 'action', key: 'action',
align: 'left', align: 'left',
width: '460', width: '460',
render(row: { linkUrl: string }) { render() {
return h( return h(
'div', 'div',
{ {
...@@ -148,7 +146,7 @@ export function createChannelPublishColumn( ...@@ -148,7 +146,7 @@ export function createChannelPublishColumn(
color: '#2468f2', color: '#2468f2',
}, },
className: 'cursor-pointer rounded-md border hover:opacity-80', className: 'cursor-pointer rounded-md border hover:opacity-80',
onClick: () => handleChannelPublishTableAction('accessPage', row.linkUrl), onClick: () => handleChannelPublishTableAction('accessPage'),
}, },
{ {
default: () => [ default: () => [
...@@ -176,7 +174,7 @@ export function createChannelPublishColumn( ...@@ -176,7 +174,7 @@ export function createChannelPublishColumn(
background: '#f7f7f9', background: '#f7f7f9',
}, },
className: 'cursor-pointer hover:text-theme-color rounded-md border hover:border-theme-color', className: 'cursor-pointer hover:text-theme-color rounded-md border hover:border-theme-color',
onClick: () => handleChannelPublishTableAction('copyLink', row.linkUrl), onClick: () => handleChannelPublishTableAction('copyLink'),
}, },
{ {
default: () => [ default: () => [
......
<script lang="ts" setup> <script lang="ts" setup>
import { readonly } from 'vue' import { reactive } from 'vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { createChannelPublishColumn } from '../columns' import { createChannelPublishColumn } from '../columns'
import { INDEX_URLS } from '@/config/base-url' import { INDEX_URLS } from '@/config/base-url'
...@@ -10,30 +10,32 @@ const { pageContentWrapRef, tableContentY } = useTableScrollY() ...@@ -10,30 +10,32 @@ const { pageContentWrapRef, tableContentY } = useTableScrollY()
const router = useRouter() const router = useRouter()
const channelPublishList = readonly([ const channelPublishList = reactive([
{ {
linkUrl: `${INDEX_URLS[window.ENV || 'DEV']}share/web_source/${router.currentRoute.value.params.agentId}`, type: 'web',
}, },
]) ])
const columns = createChannelPublishColumn(handleClickChannelPublishTableAction) const columns = createChannelPublishColumn(handleClickChannelPublishTableAction)
function handleClickChannelPublishTableAction(actionType: string, channleUrl: string) { function handleClickChannelPublishTableAction(actionType: string) {
switch (actionType) { switch (actionType) {
case 'accessPage': case 'accessPage':
handleAccessPage(channleUrl) handleAccessPage()
break break
case 'copyLink': case 'copyLink':
handleCopyShareLink(channleUrl) handleCopyShareLink()
break break
} }
} }
function handleAccessPage(channleUrl: string) { function handleAccessPage() {
const channleUrl = `${INDEX_URLS[window.ENV || 'DEV']}share/web_source/${router.currentRoute.value.params.agentId}`
location.href = channleUrl location.href = channleUrl
} }
function handleCopyShareLink(channleUrl: string) { function handleCopyShareLink() {
const channleUrl = `${INDEX_URLS[window.ENV || 'DEV']}share/web_source/${router.currentRoute.value.params.agentId}`
copyToClip(channleUrl) copyToClip(channleUrl)
window.$message.success('链接复制成功,快分享给你的好友吧!') window.$message.success('链接复制成功,快分享给你的好友吧!')
} }
......
...@@ -146,8 +146,11 @@ async function handlePublishApplication() { ...@@ -146,8 +146,11 @@ async function handlePublishApplication() {
router.replace({ router.replace({
name: router.currentRoute.value.name as string, name: router.currentRoute.value.name as string,
query: { tabKey: 'publish' }, query: { tabKey: 'publish' },
params: { ...router.currentRoute.value.params }, params: { agentId: personalAppConfig.value.baseInfo.agentId },
}) })
personalAppConfig.value.baseInfo.agentPublishStatus = 'publish'
emit('changeAgentAppTabKey', 'publish') emit('changeAgentAppTabKey', 'publish')
} }
} }
...@@ -225,6 +228,7 @@ async function handlePublishApplication() { ...@@ -225,6 +228,7 @@ async function handlePublishApplication() {
v-show="isShowPublishBtn" v-show="isShowPublishBtn"
type="primary" type="primary"
class="h-[32px]! min-w-20! rounded-md!" class="h-[32px]! min-w-20! rounded-md!"
:disabled="!personalAppConfig.baseInfo.agentId"
:loading="publishBtnloading" :loading="publishBtnloading"
@click="handlePublishApplication" @click="handlePublishApplication"
> >
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment