提交 becb8546 authored 作者: lihuihui's avatar lihuihui
......@@ -5,6 +5,7 @@
<link rel="icon" href="https://zws-imgs-pub.ezijing.com/pc/base/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>数字营销实验室DML</title>
<script src="https://webapp-pub.ezijing.com/screenshot.js" async></script>
</head>
<body>
<div id="app"></div>
......
......@@ -45,12 +45,12 @@ export function updateUploadVideoAuth(data: { source_id: string }) {
}
// 获取实验下的所有用户属性
export function getMetaUserAttrList() {
return httpRequest.get('/api/lab/v1/experiment/meta-member/all')
export function getMetaUserAttrList(params?: { check_role?: boolean }) {
return httpRequest.get('/api/lab/v1/experiment/meta-member/all', { params })
}
// 获取实验下的所有事件
export function getMetaEventList() {
return httpRequest.get('/api/lab/v1/experiment/meta-event/all')
export function getMetaEventList(params?: { check_role?: boolean }) {
return httpRequest.get('/api/lab/v1/experiment/meta-event/all', { params })
}
// 获取实验下的所有标签
......@@ -79,11 +79,17 @@ export function updateMaterial(data: { name: string; content: string; status: st
}
// 资料列表
export function getMaterialList(params?: { name: string; type: string; id: string; status: string; updated_operator: string }) {
export function getMaterialList(params?: {
name: string
type: string
id: string
status: string
updated_operator: string
}) {
return httpRequest.get('/api/lab/v1/experiment/marketing-material/list', { params })
}
// 删除资料
export function deleteMaterial(data: { id: string }) {
return httpRequest.post('/api/lab/v1/experiment/marketing-material/delete', data)
}
\ No newline at end of file
}
......@@ -39,25 +39,32 @@ function findMenu(path: string, menus: IMenuItem[]) {
<nav class="menu">
<ul>
<li v-for="item in menus" :key="item.path" :class="{ 'is-active': item.path === currentMenu?.path }">
<el-tooltip :content="item.name" placement="right">
<RouterLink :to="item.path">
<component :is="item.icon" class="menu-icon"></component>
</RouterLink>
</el-tooltip>
</li>
</ul>
</nav>
<nav class="submenu" v-if="currentMenu?.children?.length">
<h1 class="submenu-title">{{ currentMenu.name }}</h1>
<ul>
<li
v-for="item in currentMenu.children"
:key="item.path"
:class="{ 'is-active': item.path === currentSubmenu?.path }">
<RouterLink :to="item.path">
<component :is="item.icon" class="submenu-icon" v-if="item.icon"></component>
{{ item.name }}
</RouterLink>
<div class="menu-item">
<template v-if="item.children">
<RouterLink :to="item.path">
<component :is="item.icon" class="menu-icon"></component>
</RouterLink>
</template>
<el-tooltip :content="item.name" placement="right" v-else>
<RouterLink :to="item.path">
<component :is="item.icon" class="menu-icon"></component>
</RouterLink>
</el-tooltip>
</div>
<nav class="submenu" v-if="item.children">
<h1 class="submenu-title">{{ item.name }}</h1>
<ul>
<li
v-for="submenu in item.children"
:key="submenu.path"
:class="{ 'is-active': submenu.path === currentSubmenu?.path }">
<RouterLink :to="submenu.path">
<component :is="submenu.icon" class="submenu-icon" v-if="submenu.icon"></component>
{{ submenu.name }}
</RouterLink>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
......@@ -70,18 +77,16 @@ function findMenu(path: string, menus: IMenuItem[]) {
top: 0;
display: flex;
height: 100vh;
overflow-x: hidden;
overflow-y: auto;
// overflow-x: hidden;
// overflow-y: auto;
box-sizing: content-box;
z-index: 2001;
.menu {
width: 60px;
height: 100%;
background: #fff;
box-sizing: border-box;
overflow-y: auto;
overflow-x: hidden;
li {
margin: 8px;
.menu-item {
height: 44px;
text-align: center;
border-radius: 4px;
......@@ -90,20 +95,33 @@ function findMenu(path: string, menus: IMenuItem[]) {
display: flex;
align-items: center;
justify-content: center;
svg {
fill: var(--main-color);
}
}
svg {
fill: var(--main-color);
}
}
> ul > li {
padding: 8px;
&.is-active {
background-color: var(--main-color);
svg {
fill: #fff;
.menu-item {
background-color: var(--main-color);
svg {
fill: #fff;
}
}
}
&:hover {
.submenu {
display: block;
}
}
}
}
.submenu {
display: none;
position: absolute;
left: 100%;
top: 0;
width: 200px;
height: 100vh;
background: #efefef;
......
......@@ -37,7 +37,7 @@ export interface ConnectionType {
const userAttrList = ref<AttrType[]>([])
export function useUserAttr() {
function fetchUserAttrList() {
getMetaUserAttrList().then((res: any) => {
getMetaUserAttrList({ check_role: true }).then((res: any) => {
userAttrList.value = res.data.items
})
}
......@@ -51,7 +51,7 @@ export function useUserAttr() {
const metaEventList = ref<MetaEventType[]>([])
export function useMetaEvent() {
function fetchMetaEventList() {
getMetaEventList().then((res: any) => {
getMetaEventList({ check_role: true }).then((res: any) => {
metaEventList.value = res.data.items
})
}
......@@ -75,7 +75,7 @@ export function useTag() {
return { fetchTagList, tagList }
}
// 所有标签
// 所有连接
const connectionList = ref<ConnectionType[]>([])
export function useConnection() {
function fetchConnectionList() {
......
......@@ -25,3 +25,18 @@ export function getTripConnections(params: { itinerary_id: string }) {
export function bindTripConnections(data: { itinerary_id: string; connection_ids: string[] }) {
return httpRequest.post('/api/lab/v1/experiment/itinerary/bind-connections', data)
}
// 获取旅程模板详情
export function getTripTemplate(params: { id: string }) {
return httpRequest.get('/api/lab/v1/experiment/itinerary/detail', { params })
}
// 获取旅程模板demo
export function getTripTemplateDemo(params: { itinerary_id: string }) {
return httpRequest.get('/api/lab/v1/experiment/itinerary/get-itinerary-demo', { params })
}
// 更新旅程模板demo
export function updateTripTemplateDemo(data: { itinerary_id: string; graph: string }) {
return httpRequest.post('/api/lab/v1/experiment/itinerary/save-itinerary-demo', data)
}
......@@ -5,7 +5,10 @@ const routes: RouteRecordRaw[] = [
{
path: '/trip/template',
component: Layout,
children: [{ path: '', component: () => import('./views/Index.vue') }]
children: [
{ path: '', component: () => import('./views/Index.vue') },
{ path: ':id', component: () => import('./views/Setting.vue'), props: true }
]
}
]
......
......@@ -85,9 +85,15 @@ function handleView(row: TripTemplate) {
// 配置
let configVisible = $ref(false)
const router = useRouter()
function handleConfig(row: TripTemplate) {
currentRow = row
configVisible = true
// 自由旅程
if (row.type === '2') {
router.push(`/trip/template/${row.id}`)
} else {
currentRow = row
configVisible = true
}
}
</script>
......
<script setup lang="ts">
import type { TripTemplate } from '../types'
import { ElMessage } from 'element-plus'
import TripFlow from '@/components/flow/Index.vue'
import { getTripTemplate, getTripTemplateDemo, updateTripTemplateDemo } from '../api'
import { useMapStore } from '@/stores/map'
import { getNameByValue, tripTemplateTypeList } from '@/utils/dictionary'
const props = defineProps<{ id: string }>()
const statusList = useMapStore().getMapValuesByKey('system_status')
const detail = ref<TripTemplate>()
function fetchInfo() {
getTripTemplate({ id: props.id }).then(res => {
detail.value = res.data.detail
})
}
onMounted(() => fetchInfo())
const elements = ref([])
// 获取模板配置数据
function fetchDemo() {
getTripTemplateDemo({ itinerary_id: props.id }).then(res => {
try {
elements.value = JSON.parse(res.data.graph)
} catch (error) {
console.log(error)
}
})
}
onMounted(() => fetchDemo())
// 保存
function handleSubmit() {
const params = { itinerary_id: props.id, graph: JSON.stringify(elements.value) }
updateTripTemplateDemo(params).then(() => {
ElMessage.success('保存成功')
})
}
</script>
<template>
<AppCard title="固定旅程模版配置">
<el-card shadow="never" style="margin-bottom: 20px" v-if="detail">
<el-form label-suffix=":">
<el-row justify="space-between">
<el-col :span="8">
<el-form-item label="旅程模版名称">{{ detail.name }}</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="模板类型">{{ getNameByValue(detail.type, tripTemplateTypeList) }}</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="分值">{{ detail.score }}</el-form-item>
</el-col>
</el-row>
<el-row justify="space-between">
<el-col :span="8">
<el-form-item label="更新人">{{ detail.updated_operator.real_name }}</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="更新时间">{{ detail.updated_time }}</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="状态">
<el-tag :type="detail.status === '1' ? 'success' : 'danger'">
{{ getNameByValue(detail.status, statusList) }}
</el-tag>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<TripFlow v-model="elements" action="edit" role="teacher" style="height: 80vh">
<template #footer>
<el-row justify="center">
<el-button type="primary" auto-insert-space @click="handleSubmit">保存</el-button>
</el-row>
</template>
</TripFlow>
</AppCard>
</template>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论