|
@@ -34,16 +34,6 @@ export function create (node) {
|
|
|
return canvas
|
|
return canvas
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-export function check ({ bgm, widgets }) {
|
|
|
|
|
- if (bgm.length === 0) {
|
|
|
|
|
- const videos = widgets.filter(widget => widget.type === widgetVideo.type)
|
|
|
|
|
- if (videos.length > 0 && !videos.some(video => video.mute === 0)) {
|
|
|
|
|
- return { code: 1 }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- return { code: 0 }
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
export function toJSON (node) {
|
|
export function toJSON (node) {
|
|
|
const transformOptions = { color: transformColorToAndroid }
|
|
const transformOptions = { color: transformColorToAndroid }
|
|
|
const canvas = transform({ ...node }, widgetCanvas.transform, transformOptions)
|
|
const canvas = transform({ ...node }, widgetCanvas.transform, transformOptions)
|
|
@@ -136,3 +126,47 @@ function transform (data, transformOptions = {}, strat = {}) {
|
|
|
})
|
|
})
|
|
|
return data
|
|
return data
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+export function inquire (node) {
|
|
|
|
|
+ const { bgm, widgets } = node
|
|
|
|
|
+ if (bgm.length === 0) {
|
|
|
|
|
+ const videoType = widgetVideo.type
|
|
|
|
|
+ const liveType = widgetLive.type
|
|
|
|
|
+ const videos = widgets.filter(widget => {
|
|
|
|
|
+ const type = widget.type
|
|
|
|
|
+ if (type === videoType && widget.sources.length) {
|
|
|
|
|
+ return true
|
|
|
|
|
+ }
|
|
|
|
|
+ if (type === liveType && widget.url) {
|
|
|
|
|
+ return true
|
|
|
|
|
+ }
|
|
|
|
|
+ return false
|
|
|
|
|
+ })
|
|
|
|
|
+ if (videos.length > 0 && !videos.some(({ mute }) => mute === 0)) {
|
|
|
|
|
+ return '视频均未设置音频输出'
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+export function validate (node) {
|
|
|
|
|
+ const { widgets } = node
|
|
|
|
|
+ if (!widgets.length) {
|
|
|
|
|
+ return '未配置组件,请先进行配置'
|
|
|
|
|
+ }
|
|
|
|
|
+ const sourceTypes = [widgetImage.type, widgetVideo.type]
|
|
|
|
|
+ const webType = widgetWeb.type
|
|
|
|
|
+ const liveType = widgetLive.type
|
|
|
|
|
+ for (let i = 0; i < widgets.length; i++) {
|
|
|
|
|
+ const widget = widgets[i]
|
|
|
|
|
+ const type = widget.type
|
|
|
|
|
+ if (sourceTypes.includes(type) && widget.sources.length === 0) {
|
|
|
|
|
+ return `${widget.layerName}未配置数据,请先进行配置`
|
|
|
|
|
+ }
|
|
|
|
|
+ if (type === webType && !widget.href) {
|
|
|
|
|
+ return `${widget.layerName}未配置链接地址,请先进行配置`
|
|
|
|
|
+ }
|
|
|
|
|
+ if (type === liveType && !widget.url) {
|
|
|
|
|
+ return `${widget.layerName}未配置播放地址,请先进行配置`
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|