提交 9c2f47a9 authored 作者: 王鹏飞's avatar 王鹏飞

chore: update

上级 551a1c39
// 组件基础数据
export interface ComponentBaseData {
name: string
type: string
score?: number
answer_analysis?: string
}
// 立即触发
export interface RealTimeTriggerData extends ComponentBaseData {
trigger_type: string
time: string
time_rule?: string
time_rule_value?: string
time_range?: [string, string]
}
// 加入群组
export interface JoinGroupData extends ComponentBaseData {
group_id: string
}
// 移除群组
export type LeaveGroupData = JoinGroupData
// 变更属性
export interface ChangePropsData extends ComponentBaseData {
attr_id: string
operate: string
value: string
}
// 公众号
export interface OffiaccountData extends ComponentBaseData {
operate: string
account: string
message: string
}
// 内部通知
export interface NoticeData extends ComponentBaseData {
message: string
}
...@@ -81,7 +81,8 @@ export function useConnection() { ...@@ -81,7 +81,8 @@ export function useConnection() {
function fetchConnectionList() { function fetchConnectionList() {
getConnectionList().then((res: any) => { getConnectionList().then((res: any) => {
connectionList.value = res.data.items.map((item: any) => { connectionList.value = res.data.items.map((item: any) => {
const attrs = JSON.parse(item.config_attributes) const attrs =
typeof item.config_attributes === 'string' ? JSON.parse(item.config_attributes) : item.config_attributes
const name = Array.isArray(attrs) ? attrs.find((item: any) => item.prop === 'name')?.value : attrs.name const name = Array.isArray(attrs) ? attrs.find((item: any) => item.prop === 'name')?.value : attrs.name
return { ...item, config_attributes: attrs, name } return { ...item, config_attributes: attrs, name }
}) })
......
...@@ -128,7 +128,7 @@ function handleRefresh() { ...@@ -128,7 +128,7 @@ function handleRefresh() {
<dl> <dl>
<dt>更新状态</dt> <dt>更新状态</dt>
<dd> <dd>
<span style="margin-right: 10px">{{ getNameByValue(detail.status, updateStatusList) }}</span> <span style="margin-right: 10px">{{ getNameByValue(detail.status.toString(), updateStatusList) }}</span>
<el-button type="primary" plain @click="handleUpdate" size="small">立即更新</el-button> <el-button type="primary" plain @click="handleUpdate" size="small">立即更新</el-button>
</dd> </dd>
</dl> </dl>
......
import httpRequest from '@/utils/axios'
// 获取实验详情
export function getExperiment() {
return httpRequest.get('/api/lab/v1/student/experiment/detail')
}
// 学生获取旅程
export function getStudentTrip() {
return httpRequest.get('/api/lab/v1/experiment/itinerary/student-get-itinerary')
}
...@@ -2,14 +2,14 @@ import type { RouteRecordRaw } from 'vue-router' ...@@ -2,14 +2,14 @@ import type { RouteRecordRaw } from 'vue-router'
import Layout from '@/components/layout/Index.vue' import Layout from '@/components/layout/Index.vue'
const routes: RouteRecordRaw[] = [ const routes: RouteRecordRaw[] = [
{
path: '/trip',
redirect: '/trip/my'
},
{ {
path: '/trip/my', path: '/trip/my',
component: Layout, component: Layout,
children: [{ path: '', component: () => import('./views/Index.vue') }] children: [
{ path: '', component: () => import('./views/Index.vue') },
{ path: 'score', component: () => import('./views/Score.vue') },
{ path: 'review', component: () => import('./views/Review.vue') }
]
} }
] ]
......
<script setup lang="ts"> <script setup lang="ts">
import TripFlow from '@/components/flow/Index.vue' import TripFlow from '@/components/flow/Index.vue'
import { getExperiment, getStudentTrip } from '../api'
const experiment = ref<any>()
function fetchExperiment() {
getExperiment().then(res => {
experiment.value = res.data.detail
})
}
onMounted(() => fetchExperiment())
// 获取旅程信息
const detail = ref<any>()
function fetchInfo() {
getStudentTrip().then(res => {
detail.value = res.data.detail
})
}
onMounted(() => fetchInfo())
const elements = ref([ const elements = ref([
{ {
...@@ -20,7 +38,13 @@ function handleSubmit() {} ...@@ -20,7 +38,13 @@ function handleSubmit() {}
</script> </script>
<template> <template>
<AppCard title="自由旅程"> <AppCard title="自由旅程">
<el-card shadow="never" style="margin-bottom: 20px"></el-card> <el-card shadow="never" style="margin-bottom: 20px" v-if="experiment">
<el-descriptions label-suffix=":">
<el-descriptions-item label="课程名称:">{{ experiment.course.name }}</el-descriptions-item>
<el-descriptions-item label="实验名称:">{{ experiment.name }}</el-descriptions-item>
<el-descriptions-item label="旅程类型:">自由旅程</el-descriptions-item>
</el-descriptions>
</el-card>
<TripFlow v-model="elements" action="edit" role="student" style="height: 80vh"> <TripFlow v-model="elements" action="edit" role="student" style="height: 80vh">
<template #footer> <template #footer>
<el-row justify="center"> <el-row justify="center">
......
<!-- 批改用户旅程 -->
<script setup lang="ts">
import TripFlow from '@/components/flow/Index.vue'
const elements = ref([
{
id: '1',
type: 'custom',
label: '实时触发',
position: { x: 0, y: 0 },
data: { name: '实时触发', type: '触发条件', score: 10, componentName: 'TriggeringConditions6' }
}
])
watchEffect(() => {
console.log(elements)
})
// 保存
function handleSubmit() {}
</script>
<template>
<AppCard>
<TripFlow v-model="elements" action="view" 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>
<!-- 学生查看用户旅程成绩 -->
<script setup lang="ts">
import TripFlow from '@/components/flow/Index.vue'
const elements = ref([
{
id: '1',
type: 'custom',
label: '实时触发',
position: { x: 0, y: 0 },
data: { name: '实时触发', type: '触发条件', score: 10, componentName: 'TriggeringConditions6' }
}
])
watchEffect(() => {
console.log(elements)
})
// 保存
function handleSubmit() {}
</script>
<template>
<AppCard>
<TripFlow v-model="elements" action="view" role="student" 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>
...@@ -2,6 +2,10 @@ import type { RouteRecordRaw } from 'vue-router' ...@@ -2,6 +2,10 @@ import type { RouteRecordRaw } from 'vue-router'
import Layout from '@/components/layout/Index.vue' import Layout from '@/components/layout/Index.vue'
const routes: RouteRecordRaw[] = [ const routes: RouteRecordRaw[] = [
{
path: '/trip',
redirect: '/trip/template'
},
{ {
path: '/trip/template', path: '/trip/template',
component: Layout, component: Layout,
......
...@@ -24,7 +24,7 @@ const elements = ref([]) ...@@ -24,7 +24,7 @@ const elements = ref([])
function fetchDemo() { function fetchDemo() {
getTripTemplateDemo({ itinerary_id: props.id }).then(res => { getTripTemplateDemo({ itinerary_id: props.id }).then(res => {
try { try {
elements.value = JSON.parse(res.data.graph) elements.value = res.data.graph ? JSON.parse(res.data.graph) : []
} catch (error) { } catch (error) {
console.log(error) console.log(error)
} }
......
import type { IMenuItem } from '@/types' import type { IMenuItem } from '@/types'
import { defineStore } from 'pinia' import { defineStore } from 'pinia'
import { useUserStore } from '@/stores/user'
import IconMetadata from '@/components/icon/IconMetadata.vue' import IconMetadata from '@/components/icon/IconMetadata.vue'
import IconConnect from '@/components/icon/IconConnect.vue' import IconConnect from '@/components/icon/IconConnect.vue'
import IconUser from '@/components/icon/IconUser.vue' import IconUser from '@/components/icon/IconUser.vue'
...@@ -18,63 +20,181 @@ import IconMiniProgram from '@/components/icon/IconMiniProgram.vue' ...@@ -18,63 +20,181 @@ import IconMiniProgram from '@/components/icon/IconMiniProgram.vue'
import IconCard from '@/components/icon/IconCard.vue' import IconCard from '@/components/icon/IconCard.vue'
interface State { interface State {
menus: IMenuItem[] studentMenus: IMenuItem[]
adminMenus: IMenuItem[]
} }
// 学生菜单 // 学生菜单
const menus: IMenuItem[] = [ const studentMenus: IMenuItem[] = [
{
name: '用户管理',
path: '/user',
icon: markRaw(IconUser),
tag: 'v1-experiment-member'
},
{
name: '标签管理',
path: '/label',
icon: markRaw(IconLabel),
tag: 'experiment_tags'
},
{
name: '群组管理',
path: '/group',
icon: markRaw(IconGroup),
tag: 'experiment_groups'
},
{
name: '营销资料管理',
path: '/material',
icon: markRaw(IconMaterial),
tag: 'v1-experiment-marketing-material',
children: [
{
name: '文本资料管理',
path: '/material/text',
icon: markRaw(IconText),
tag: 'v1-experiment-marketing-material-list'
},
{
name: '图片资料管理',
path: '/material/image',
icon: markRaw(IconImage),
tag: 'v1-experiment-marketing-material-list'
},
{
name: '语音资料管理',
path: '/material/audio',
icon: markRaw(IconAudio),
tag: 'v1-experiment-marketing-material-list'
},
{
name: '视频资料管理',
path: '/material/video',
icon: markRaw(IconVideo),
tag: 'v1-experiment-marketing-material-list'
},
{ name: 'H5资料管理', path: '/material/h5', icon: markRaw(IconH5), tag: 'v1-experiment-marketing-material-list' },
{
name: '二维码资料管理',
path: '/material/qrcode',
icon: markRaw(IconQrcode),
tag: 'v1-experiment-marketing-material-list'
},
{
name: '小程序资料管理',
path: '/material/mini',
icon: markRaw(IconMiniProgram),
tag: 'v1-experiment-marketing-material-list'
},
{
name: '卡券资料管理',
path: '/material/card',
icon: markRaw(IconCard),
tag: 'v1-experiment-marketing-material-list'
}
]
},
{
name: '用户旅程',
path: '/trip/my',
icon: markRaw(IconTrip),
tag: 'experiment_itinerary'
}
]
const adminMenus: IMenuItem[] = [
{ {
name: '元数据管理', name: '元数据管理',
path: '/metadata', path: '/metadata',
icon: markRaw(IconMetadata), icon: markRaw(IconMetadata),
tag: 'v1-experiment-meta',
children: [ children: [
{ name: '用户属性管理', path: '/metadata/user' }, { name: '用户属性管理', path: '/metadata/user', tag: 'v1-experiment-meta-member' },
{ name: '事件属性管理', path: '/metadata/event' } { name: '事件属性管理', path: '/metadata/event', tag: 'v1-experiment-meta-event' }
] ]
}, },
{ {
name: '连接管理', name: '连接管理',
path: '/connect', path: '/connect',
icon: markRaw(IconConnect) icon: markRaw(IconConnect),
tag: 'v1-experiment-connection'
}, },
{ {
name: '用户管理', name: '用户管理',
path: '/user', path: '/user',
icon: markRaw(IconUser) icon: markRaw(IconUser),
tag: 'v1-experiment-member'
}, },
{ {
name: '标签管理', name: '标签管理',
path: '/label', path: '/label',
icon: markRaw(IconLabel) icon: markRaw(IconLabel),
tag: 'experiment_tags'
}, },
{ {
name: '群组管理', name: '群组管理',
path: '/group', path: '/group',
icon: markRaw(IconGroup) icon: markRaw(IconGroup),
tag: 'experiment_groups'
}, },
{ {
name: '营销资料管理', name: '营销资料管理',
path: '/material', path: '/material',
icon: markRaw(IconMaterial), icon: markRaw(IconMaterial),
tag: 'v1-experiment-marketing-material',
children: [ children: [
{ name: '文本资料管理', path: '/material/text', icon: markRaw(IconText) }, {
{ name: '图片资料管理', path: '/material/image', icon: markRaw(IconImage) }, name: '文本资料管理',
{ name: '语音资料管理', path: '/material/audio', icon: markRaw(IconAudio) }, path: '/material/text',
{ name: '视频资料管理', path: '/material/video', icon: markRaw(IconVideo) }, icon: markRaw(IconText),
{ name: 'H5资料管理', path: '/material/h5', icon: markRaw(IconH5) }, tag: 'v1-experiment-marketing-material-list'
{ name: '二维码资料管理', path: '/material/qrcode', icon: markRaw(IconQrcode) }, },
{ name: '小程序资料管理', path: '/material/mini', icon: markRaw(IconMiniProgram) }, {
{ name: '卡券资料管理', path: '/material/card', icon: markRaw(IconCard) } name: '图片资料管理',
path: '/material/image',
icon: markRaw(IconImage),
tag: 'v1-experiment-marketing-material-list'
},
{
name: '语音资料管理',
path: '/material/audio',
icon: markRaw(IconAudio),
tag: 'v1-experiment-marketing-material-list'
},
{
name: '视频资料管理',
path: '/material/video',
icon: markRaw(IconVideo),
tag: 'v1-experiment-marketing-material-list'
},
{ name: 'H5资料管理', path: '/material/h5', icon: markRaw(IconH5), tag: 'v1-experiment-marketing-material-list' },
{
name: '二维码资料管理',
path: '/material/qrcode',
icon: markRaw(IconQrcode),
tag: 'v1-experiment-marketing-material-list'
},
{
name: '小程序资料管理',
path: '/material/mini',
icon: markRaw(IconMiniProgram),
tag: 'v1-experiment-marketing-material-list'
},
{
name: '卡券资料管理',
path: '/material/card',
icon: markRaw(IconCard),
tag: 'v1-experiment-marketing-material-list'
}
] ]
}, },
{ {
name: '用户旅程', name: '用户旅程',
path: '/trip', path: '/trip',
icon: markRaw(IconTrip), icon: markRaw(IconTrip),
children: [ tag: 'experiment_itinerary',
{ name: '我的用户旅程', path: '/trip/my' }, children: [{ name: '旅程模板管理', path: '/trip/template', tag: 'experiment_itinerary_list' }]
{ name: '旅程模板管理', path: '/trip/template' }
]
}, },
{ {
name: '报表分析', name: '报表分析',
...@@ -86,6 +206,17 @@ const menus: IMenuItem[] = [ ...@@ -86,6 +206,17 @@ const menus: IMenuItem[] = [
export const useMenuStore = defineStore({ export const useMenuStore = defineStore({
id: 'menu', id: 'menu',
state: (): State => ({ state: (): State => ({
menus studentMenus,
}) adminMenus
}),
getters: {
menus: state => {
const userStore = useUserStore()
if (userStore.role?.id === 1) {
return state.studentMenus
} else {
return state.adminMenus
}
}
}
}) })
import axios from 'axios' import axios from 'axios'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import router from '@/router' // import router from '@/router'
const httpRequest = axios.create({ const httpRequest = axios.create({
timeout: 60000, timeout: 60000,
...@@ -49,9 +49,9 @@ httpRequest.interceptors.response.use( ...@@ -49,9 +49,9 @@ httpRequest.interceptors.response.use(
// 未登录 // 未登录
if (status === 403) { if (status === 403) {
location.href = `${import.meta.env.VITE_LOGIN_URL}?rd=${encodeURIComponent(location.href)}` location.href = `${import.meta.env.VITE_LOGIN_URL}?rd=${encodeURIComponent(location.href)}`
} else if (status === 401 || status === 402) { // } else if (status === 401 || status === 402) {
// 未授权 // // 未授权
router.push('/401') // router.push('/401')
} else { } else {
ElMessage.error(message) ElMessage.error(message)
console.error(`${status}: ${message}`) console.error(`${status}: ${message}`)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论