Просмотр исходного кода

feat(program): live address supports setting through selection

Casper Dai 2 лет назад
Родитель
Сommit
89527befa9

+ 10 - 1
src/views/screen/material/program/ast/Designer.vue

@@ -218,6 +218,7 @@
             :node="widget"
             :attr="item"
             @choose="onEditData"
+            @choose-edit="onEdit"
           />
         </div>
       </div>
@@ -578,7 +579,11 @@ export default {
       }
     },
     changeAttr (value) {
-      const { key, options } = this.widgetAttr
+      const { type, key, options } = this.widgetAttr
+      if (type === 'textarea') {
+        this.widget[key] = value[0].keyName
+        return
+      }
       this.widget[key] = value
       if (options) {
         const { callback } = options
@@ -614,6 +619,10 @@ export default {
           break
       }
     },
+    onEdit (attr) {
+      this.widgetAttr = attr
+      this.$refs.assetDialog.show(attr.options.button[0])
+    },
     transformDataToAsset ({ tag = AssetTag.AD, type, keyName, name, size, md5, duration, thumb }, { durationEditable }) {
       return {
         tag,

+ 18 - 1
src/views/screen/material/program/ast/components/DynamicItem.vue

@@ -3,7 +3,18 @@
     v-if="isDisplay"
     class="c-dynamic-item"
   >
-    <span class="l-flex__none c-dynamic-item__name u-font-size--xs">{{ attrName }}</span>
+    <div class="l-flex__none c-dynamic-item__name">
+      <span class="c-sibling-item--v u-font-size--xs">{{ attrName }}</span>
+      <el-button
+        v-if="isTextAreaButton"
+        class="c-sibling-item--v"
+        type="primary"
+        size="mini"
+        @click="onChooseEdit"
+      >
+        设置
+      </el-button>
+    </div>
     <el-input-number
       v-if="isNumber"
       v-model="node[attrKey]"
@@ -197,6 +208,9 @@ export default {
     isTextArea () {
       return this.attrType === 'textarea'
     },
+    isTextAreaButton () {
+      return this.isTextArea && this.attr.options?.button
+    },
     isSelect () {
       return this.attrType === 'select'
     },
@@ -266,6 +280,9 @@ export default {
     onChoose () {
       this.$emit('choose', this.attr)
     },
+    onChooseEdit () {
+      this.$emit('choose-edit', this.attr)
+    },
     onFit (strat) {
       strat.callback?.(this.node, this.root)
     },

+ 3 - 1
src/views/screen/material/program/ast/core/config-json/live.js

@@ -1,3 +1,4 @@
+import { AssetType } from '@/constant'
 import { WidgetType } from '../constant'
 import { positionConfig } from './base'
 
@@ -55,7 +56,8 @@ export default {
           label: '直播地址',
           type: 'textarea',
           options: {
-            singleLine: true
+            singleLine: true,
+            button: [AssetType.STREAMING_MEDIA]
           }
         }
       ]