Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
saas-dml
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
saas-dml
Commits
e59eb8f8
提交
e59eb8f8
authored
3月 01, 2023
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: update
上级
9e7cbfb7
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
225 行增加
和
50 行删除
+225
-50
base.css
src/assets/styles/base.css
+4
-0
Index.vue
src/components/flow/Index.vue
+1
-6
api.ts
src/modules/trip/my/api.ts
+15
-5
BindConnection.vue
src/modules/trip/my/components/BindConnection.vue
+90
-0
types.ts
src/modules/trip/my/types.ts
+24
-0
Index.vue
src/modules/trip/my/views/Index.vue
+87
-34
BindConnection.vue
src/modules/trip/template/components/BindConnection.vue
+3
-4
vite.config.ts
vite.config.ts
+1
-1
没有找到文件。
src/assets/styles/base.css
浏览文件 @
e59eb8f8
...
...
@@ -87,3 +87,7 @@ textarea:focus {
.info
.el-form-item
{
margin-bottom
:
0
;
}
.info
tr
:last-child
td
{
padding-bottom
:
0
!important
;
}
src/components/flow/Index.vue
浏览文件 @
e59eb8f8
...
...
@@ -83,12 +83,7 @@ const onDrop = (event: DragEvent) => {
<slot
name=
"left-panel"
>
</slot>
<el-card
shadow=
"never"
class=
"flow-main"
@
drop=
"onDrop"
>
<slot
name=
"header"
>
</slot>
<VueFlow
fit-view-on-init
:zoom-on-scroll=
"false"
:prevent-scrolling=
"false"
@
dragover=
"onDragOver"
v-bind=
"$attrs"
>
<VueFlow
:zoom-on-scroll=
"false"
:prevent-scrolling=
"false"
@
dragover=
"onDragOver"
v-bind=
"$attrs"
>
<template
#
node-custom=
"node"
>
<CustomNode
:node=
"node"
/>
</
template
>
...
...
src/modules/trip/my/api.ts
浏览文件 @
e59eb8f8
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'
)
}
// 更新旅程
export
function
updateTrip
(
data
:
{
itinerary_id
:
string
;
graph
:
string
;
status
:
number
})
{
return
httpRequest
.
post
(
'/api/lab/v1/experiment/itinerary/student-save-itinerary'
,
data
)
}
// 旅程绑定连接
export
function
bindTripConnections
(
data
:
{
itinerary_id
:
string
;
connections_id
:
string
})
{
return
httpRequest
.
post
(
'/api/lab/v1/experiment/itinerary/student-bind-connections'
,
data
)
}
// 获取旅程模板demo
export
function
getTripTemplateDemo
(
params
:
{
itinerary_id
?:
string
})
{
return
httpRequest
.
get
(
'/api/lab/v1/experiment/itinerary/get-itinerary-demo'
,
{
params
})
}
src/modules/trip/my/components/BindConnection.vue
0 → 100644
浏览文件 @
e59eb8f8
<
script
setup
lang=
"ts"
>
import
type
{
Trip
}
from
'../types'
import
{
ElMessage
}
from
'element-plus'
import
{
bindTripConnections
}
from
'../api'
import
type
{
ConnectionType
}
from
'@/composables/useAllData'
import
{
useConnection
}
from
'@/composables/useAllData'
import
ConnectionIcon
from
'@/components/ConnectionIcon.vue'
const
props
=
defineProps
<
{
data
:
Trip
}
>
()
const
emit
=
defineEmits
<
{
(
e
:
'update'
,
value
:
string
[]):
void
(
e
:
'update:modelValue'
,
visible
:
boolean
):
void
}
>
()
const
{
connectionList
}
=
useConnection
()
const
multipleSelection
=
ref
<
string
[]
>
([])
function
toggleSelection
(
data
:
ConnectionType
)
{
multipleSelection
.
value
.
includes
(
data
.
id
)
?
multipleSelection
.
value
.
filter
(
id
=>
id
!==
data
.
id
)
:
multipleSelection
.
value
.
push
(
data
.
id
)
}
function
isActive
(
data
:
ConnectionType
)
{
return
multipleSelection
.
value
.
includes
(
data
.
id
)
}
// 保存
function
handleSave
()
{
bindTripConnections
({
itinerary_id
:
props
.
data
.
id
,
connections_id
:
multipleSelection
.
value
.
join
(
','
)
}).
then
(()
=>
{
ElMessage
({
message
:
'保存成功'
,
type
:
'success'
})
emit
(
'update'
,
multipleSelection
.
value
)
emit
(
'update:modelValue'
,
false
)
})
}
</
script
>
<
template
>
<el-dialog
title=
"配置连接"
width=
"800px"
append-to-body
@
update:modelValue=
"$emit('update:modelValue')"
>
<div
class=
"connection-list"
>
<div
class=
"connection-item"
v-for=
"item in connectionList"
:key=
"item.id"
:class=
"
{ 'is-active': isActive(item) }"
@click="toggleSelection(item)">
<el-checkbox
@
change=
"toggleSelection(item)"
:model-value=
"isActive(item)"
/>
<div
class=
"connection-item__icon"
><ConnectionIcon
:name=
"item.type + ''"
/></div>
<p>
{{
item
.
name
}}
</p>
</div>
</div>
<template
#
footer
>
<el-row
justify=
"center"
>
<el-button
plain
auto-insert-space
@
click=
"$emit('update:modelValue', false)"
>
关闭
</el-button>
<el-button
type=
"primary"
plain
auto-insert-space
@
click=
"handleSave"
>
保存
</el-button>
</el-row>
</
template
>
</el-dialog>
</template>
<
style
lang=
"scss"
>
.connection-list
{
display
:
grid
;
grid-template-columns
:
repeat
(
4
,
1fr
);
gap
:
20px
;
}
.connection-item
{
position
:
relative
;
height
:
100px
;
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
justify-content
:
center
;
background-color
:
#fff
;
border
:
1px
dashed
#bbb
;
cursor
:
pointer
;
&
.is-active
{
background-color
:
rgb
(
204
247
131
/
38%
);
}
.el-checkbox
{
position
:
absolute
;
left
:
10px
;
top
:
0
;
}
}
</
style
>
src/modules/trip/my/types.ts
0 → 100644
浏览文件 @
e59eb8f8
export
interface
Trip
{
id
:
string
experiment_id
:
string
itinerary_id
:
string
student_id
:
string
connect_ids
:
string
[]
graph
:
string
score
:
string
status
:
string
commit_time
:
string
comment_sso_id
:
string
comment_time
:
string
comment_status
:
string
comment
:
string
created_time
:
string
updated_time
:
string
status_name
:
string
comment_status_name
:
string
course_id
:
string
course_name
:
string
experiment_name
:
string
experiment_itinerary_type
:
string
experiment_itinerary_type_name
:
string
}
src/modules/trip/my/views/Index.vue
浏览文件 @
e59eb8f8
<
script
setup
lang=
"ts"
>
import
type
{
Trip
}
from
'../types'
import
TripFlow
from
'@/components/flow/Index.vue'
import
{
getExperiment
,
getStudentTrip
}
from
'../api'
import
TripFlowSidebar
from
'@/components/flow/Sidebar.vue'
import
{
ElMessage
}
from
'element-plus'
import
{
getStudentTrip
,
getTripTemplateDemo
,
updateTrip
}
from
'../api'
const
experiment
=
ref
<
any
>
()
function
fetchExperiment
()
{
getExperiment
().
then
(
res
=>
{
experiment
.
value
=
res
.
data
.
detail
})
}
onMounted
(()
=>
fetchExperiment
())
const
BindConnection
=
defineAsyncComponent
(()
=>
import
(
'../components/BindConnection.vue'
))
const
detail
=
ref
<
Trip
>
()
const
elements
=
ref
([])
const
connectionIds
=
computed
(()
=>
{
return
detail
.
value
?.
connect_ids
||
[]
})
// 是否是自由旅程
const
isFree
=
computed
(()
=>
{
return
detail
.
value
?.
experiment_itinerary_type
===
'1'
})
// 获取旅程信息
const
detail
=
ref
<
any
>
()
function
fetchInfo
()
{
getStudentTrip
().
then
(
res
=>
{
detail
.
value
=
res
.
data
.
detail
})
async
function
fetchInfo
()
{
const
res
=
await
getStudentTrip
()
detail
.
value
=
res
.
data
try
{
elements
.
value
=
res
.
data
.
graph
?
JSON
.
parse
(
res
.
data
.
graph
)
:
[]
}
catch
(
error
)
{
console
.
log
(
error
)
}
}
onMounted
(()
=>
fetchInfo
())
onMounted
(
async
()
=>
{
await
fetchInfo
()
fetchDemo
()
})
const
elements
=
ref
([
{
id
:
'1'
,
type
:
'custom'
,
label
:
'实时触发'
,
position
:
{
x
:
0
,
y
:
0
},
data
:
{
name
:
'实时触发'
,
type
:
'触发条件'
,
score
:
10
,
componentName
:
'TriggeringConditions6'
}
// 获取模板配置数据
async
function
fetchDemo
()
{
if
(
!
detail
.
value
)
return
if
(
isFree
.
value
||
detail
.
value
.
graph
)
return
const
res
=
await
getTripTemplateDemo
({
itinerary_id
:
detail
.
value
.
itinerary_id
})
try
{
elements
.
value
=
res
.
data
.
graph
?
JSON
.
parse
(
res
.
data
.
graph
)
:
[]
}
catch
(
error
)
{
console
.
log
(
error
)
}
])
watchEffect
(()
=>
{
console
.
log
(
elements
)
})
}
// 保存
function
handleSubmit
()
{}
function
handleSubmit
()
{
if
(
!
detail
.
value
)
return
const
params
=
{
itinerary_id
:
detail
.
value
.
itinerary_id
,
graph
:
JSON
.
stringify
(
elements
.
value
),
status
:
1
}
updateTrip
(
params
).
then
(()
=>
{
ElMessage
.
success
(
'保存成功'
)
})
}
// 配置
let
configVisible
=
$ref
(
false
)
function
handleConfig
()
{
configVisible
=
true
}
function
handleConnectionUpdate
(
value
:
string
[])
{
if
(
!
detail
.
value
)
return
detail
.
value
.
connect_ids
=
value
}
</
script
>
<
template
>
<AppCard
title=
"自由旅程
"
>
<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>
<AppCard
:title=
"detail?.experiment_itinerary_type_name
"
>
<el-card
shadow=
"never"
style=
"margin-bottom: 20px"
v-if=
"
detail
"
>
<el-descriptions
class=
"info
"
>
<el-descriptions-item
label=
"课程名称:"
>
{{
detail
.
course_
name
}}
</el-descriptions-item>
<el-descriptions-item
label=
"实验名称:"
>
{{
detail
.
experiment_
name
}}
</el-descriptions-item>
<el-descriptions-item
label=
"旅程类型:"
>
{{
detail
.
experiment_itinerary_type_name
}}
</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"
>
<template
#
left-panel
v-if=
"isFree"
>
<TripFlowSidebar
:connectionIds=
"connectionIds"
/>
</
template
>
<
template
#
header
>
<el-row
align=
"middle"
>
<el-button
type=
"primary"
size=
"large"
@
click=
"handleConfig"
style=
"margin-right: 20px"
v-if=
"isFree"
>
配置连接
</el-button
>
<el-alert
center
style=
"flex: 1"
>
<p
style=
"text-align: center"
>
<template
v-if=
"isFree"
>
用户旅程的基本组成:触发条件+营销动作+条件分支
<br
/>
您可以从左侧组件区域选择的对应的触发条件、营销动作和条件分支,拖拽到右侧的画布里面,进行编排组合个性化的用户旅程。
</
template
>
<
template
v-else
>
请给本用户旅程的每一个节点进行详细配置,确保每一个节点能够顺利执行。
</
template
>
</p>
</el-alert>
</el-row>
</template>
<
template
#
footer
>
<el-row
justify=
"center"
>
<el-button
type=
"primary"
auto-insert-space
@
click=
"handleSubmit"
>
保存
</el-button>
...
...
@@ -53,4 +99,11 @@ function handleSubmit() {}
</
template
>
</TripFlow>
</AppCard>
<!-- 配置连接 -->
<BindConnection
v-model=
"configVisible"
:data=
"detail"
@
update=
"handleConnectionUpdate"
v-if=
"configVisible && detail"
></BindConnection>
</template>
src/modules/trip/template/components/BindConnection.vue
浏览文件 @
e59eb8f8
...
...
@@ -11,7 +11,7 @@ const props = defineProps<{
}
>
()
const
emit
=
defineEmits
<
{
(
e
:
'update'
):
void
(
e
:
'update'
,
value
:
ConnectionType
[]
):
void
(
e
:
'update:modelValue'
,
visible
:
boolean
):
void
}
>
()
...
...
@@ -40,7 +40,7 @@ function handleSave() {
const
ids
=
multipleSelection
.
value
.
map
(
item
=>
item
.
id
)
bindTripConnections
({
itinerary_id
:
props
.
data
.
id
,
connection_ids
:
ids
}).
then
(()
=>
{
ElMessage
({
message
:
'保存成功'
,
type
:
'success'
})
emit
(
'update'
)
emit
(
'update'
,
multipleSelection
.
value
)
emit
(
'update:modelValue'
,
false
)
})
}
...
...
@@ -54,8 +54,7 @@ function handleSave() {
v-for=
"item in connectionList"
:key=
"item.id"
:class=
"
{ 'is-active': isActive(item) }"
@click="toggleSelection(item)"
>
@click="toggleSelection(item)">
<el-checkbox
@
change=
"toggleSelection(item)"
:model-value=
"isActive(item)"
/>
<div
class=
"connection-item__icon"
><ConnectionIcon
:name=
"item.type + ''"
/></div>
<p>
{{
item
.
name
}}
</p>
...
...
vite.config.ts
浏览文件 @
e59eb8f8
...
...
@@ -26,7 +26,7 @@ export default defineConfig(({ mode }) => ({
cert
:
fs
.
readFileSync
(
path
.
join
(
__dirname
,
'./https/ezijing.com.pem'
))
},
proxy
:
{
'/api'
:
'https://saas-
lab
.ezijing.com'
'/api'
:
'https://saas-
dml
.ezijing.com'
}
},
resolve
:
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论