|
@@ -0,0 +1,193 @@
|
|
1
|
+<template>
|
|
2
|
+ <div>
|
|
3
|
+ <el-dialog :model-value="props.dialogVisible" :before-close="handleClose" :show-close="true" :title="dialogTitle" width="600px"
|
|
4
|
+ class="video-dialog">
|
|
5
|
+ <div class="content-wrap">
|
|
6
|
+ <video v-if="props.dialogVisible" class="video-wrap" :src="form.oss_url" :poster="form.pre_oss_url" controls autoplay muted preload="none" controlslist="nodownload noremoteplayback disablePictureInPicture noplaybackrate" />
|
|
7
|
+ </div>
|
|
8
|
+ <div class="footer">
|
|
9
|
+ <!-- <el-button @click="handleClose">取消</el-button>
|
|
10
|
+ <el-button type="primary" @click="handleSave">确定</el-button> -->
|
|
11
|
+ <el-button type="primary" @click="handleClose">关 闭</el-button>
|
|
12
|
+ </div>
|
|
13
|
+ </el-dialog>
|
|
14
|
+ </div>
|
|
15
|
+</template>
|
|
16
|
+
|
|
17
|
+<script setup lang="ts">
|
|
18
|
+import { reactive, watch, computed } from 'vue'
|
|
19
|
+import type { PropType } from 'vue';
|
|
20
|
+import { ElMessage } from 'element-plus'
|
|
21
|
+import { Api as $api } from '@/api/api'
|
|
22
|
+import $http from '@/http/http'
|
|
23
|
+import to from 'await-to-js'
|
|
24
|
+
|
|
25
|
+const emits = defineEmits([
|
|
26
|
+ 'confirm',
|
|
27
|
+ 'cancel'
|
|
28
|
+])
|
|
29
|
+
|
|
30
|
+const props = defineProps({
|
|
31
|
+ dialogVisible: {
|
|
32
|
+ type: Boolean as PropType<boolean>,
|
|
33
|
+ default: () => false,
|
|
34
|
+ },
|
|
35
|
+ videoInfo: {
|
|
36
|
+ type: Object as PropType<object>,
|
|
37
|
+ default: () => ({})
|
|
38
|
+ },
|
|
39
|
+})
|
|
40
|
+
|
|
41
|
+// 弹框标题
|
|
42
|
+const dialogTitle = computed(() => {
|
|
43
|
+ return `视频素材:${form.name}`
|
|
44
|
+})
|
|
45
|
+
|
|
46
|
+// 表单数据
|
|
47
|
+const form = reactive({
|
|
48
|
+ name: '' as any,
|
|
49
|
+ oss_url: '' as any,
|
|
50
|
+ pre_oss_url: '' as any,
|
|
51
|
+})
|
|
52
|
+
|
|
53
|
+// 监听弹框显示
|
|
54
|
+watch(() => props.dialogVisible, isShow => {
|
|
55
|
+ isShow && handleInitForm()
|
|
56
|
+})
|
|
57
|
+
|
|
58
|
+// 表单数据初始化
|
|
59
|
+const handleInitForm = async () => {
|
|
60
|
+ console.log('handleInitForm => ')
|
|
61
|
+ console.log('props.videoInfo => ', props.videoInfo)
|
|
62
|
+ const { name, oss_url, pre_oss_url } = props.videoInfo as any
|
|
63
|
+ form.name = name
|
|
64
|
+ form.oss_url = oss_url
|
|
65
|
+ form.pre_oss_url = pre_oss_url
|
|
66
|
+}
|
|
67
|
+
|
|
68
|
+// 取消
|
|
69
|
+const handleClose = () => {
|
|
70
|
+ emits('cancel')
|
|
71
|
+}
|
|
72
|
+
|
|
73
|
+// 确定
|
|
74
|
+const handleSave = async () => {
|
|
75
|
+ try {
|
|
76
|
+ await handleValidate() // 表单判空校验
|
|
77
|
+ await handleSubmit() // 提交表单
|
|
78
|
+ emits('confirm')
|
|
79
|
+ } catch (error) {
|
|
80
|
+ console.log(error)
|
|
81
|
+ }
|
|
82
|
+}
|
|
83
|
+
|
|
84
|
+// 表单判空校验
|
|
85
|
+const handleValidate = () => {
|
|
86
|
+ return new Promise((resolve, reject) => {
|
|
87
|
+ // const { strategy_name } = form
|
|
88
|
+ // if (strategy_name === '') {
|
|
89
|
+ // ElMessage.warning('请输入策略名称')
|
|
90
|
+ // reject('校验未通过')
|
|
91
|
+ // } else {
|
|
92
|
+ // resolve('校验通过')
|
|
93
|
+ // }
|
|
94
|
+ resolve('校验通过')
|
|
95
|
+ })
|
|
96
|
+}
|
|
97
|
+
|
|
98
|
+// 提交表单
|
|
99
|
+const handleSubmit = async () => {
|
|
100
|
+ // const url = $api.sellStrategy_sellStrategyAdd
|
|
101
|
+ // const params = {
|
|
102
|
+ // strategy_name: form.strategy_name,
|
|
103
|
+ // }
|
|
104
|
+ // const [err, res]: any = await to($http.post(url, params))
|
|
105
|
+ // if (err || res?.errNo !== '0' || res?.rst === false) {
|
|
106
|
+ // ElMessage.error(err?.message || res?.errMsg || "操作失败")
|
|
107
|
+ // return Promise.reject()
|
|
108
|
+ // } else if (res?.rst?.strategy_id) {
|
|
109
|
+ // ElMessage.success('操作成功')
|
|
110
|
+ // return Promise.resolve()
|
|
111
|
+ // }
|
|
112
|
+ return Promise.resolve()
|
|
113
|
+}
|
|
114
|
+
|
|
115
|
+</script>
|
|
116
|
+
|
|
117
|
+<style lang="scss" scoped>
|
|
118
|
+:deep(.el-dialog) {
|
|
119
|
+ margin: 0;
|
|
120
|
+ position: absolute;
|
|
121
|
+ top: 50%;
|
|
122
|
+ left: 50%;
|
|
123
|
+ transform: translate(-50%, -50%);
|
|
124
|
+ .el-dialog__body {
|
|
125
|
+ padding: 0;
|
|
126
|
+ }
|
|
127
|
+ .el-dialog__header{
|
|
128
|
+ border-bottom: 1px solid #e8eaec;
|
|
129
|
+ padding: 20px;
|
|
130
|
+ margin-right: 0;
|
|
131
|
+ margin-left: 0;
|
|
132
|
+ .el-dialog__title{
|
|
133
|
+ font-size: 16px;
|
|
134
|
+ font-weight: bold;
|
|
135
|
+ padding-left: 20px;
|
|
136
|
+ }
|
|
137
|
+ }
|
|
138
|
+ .content-wrap {
|
|
139
|
+ padding: 20px;
|
|
140
|
+ display: flex;
|
|
141
|
+ align-items: center;
|
|
142
|
+ justify-content: center;
|
|
143
|
+ .video-wrap {
|
|
144
|
+ width: 90%;
|
|
145
|
+ max-height: 400px;
|
|
146
|
+ }
|
|
147
|
+ }
|
|
148
|
+ .content {
|
|
149
|
+ padding: 24px 50px 0 40px;
|
|
150
|
+ .form-item {
|
|
151
|
+ display: flex;
|
|
152
|
+ align-items: center;
|
|
153
|
+ margin-top: 30px;
|
|
154
|
+ &:first-child {
|
|
155
|
+ margin-top: 0;
|
|
156
|
+ }
|
|
157
|
+ .item-label {
|
|
158
|
+ flex-shrink: 0;
|
|
159
|
+ width: 80px;
|
|
160
|
+ font-size: 14px;
|
|
161
|
+ color: #333;
|
|
162
|
+ font-weight: 400;
|
|
163
|
+ &.required {
|
|
164
|
+ position: relative;
|
|
165
|
+ }
|
|
166
|
+ &.required::before {
|
|
167
|
+ position: absolute;
|
|
168
|
+ left: -8px;
|
|
169
|
+ top: 0;
|
|
170
|
+ content: '*';
|
|
171
|
+ font-size: 12px;
|
|
172
|
+ color: rgb(245, 108, 108);
|
|
173
|
+ }
|
|
174
|
+ }
|
|
175
|
+ .el-input__inner {
|
|
176
|
+ height: 28px;
|
|
177
|
+ }
|
|
178
|
+ .el-cascader {
|
|
179
|
+ flex: 1;
|
|
180
|
+ }
|
|
181
|
+ .el-select {
|
|
182
|
+ flex: 1;
|
|
183
|
+ }
|
|
184
|
+ }
|
|
185
|
+ }
|
|
186
|
+ .footer {
|
|
187
|
+ padding: 0 0 20px;
|
|
188
|
+ display: flex;
|
|
189
|
+ align-items: center;
|
|
190
|
+ justify-content: center;
|
|
191
|
+ }
|
|
192
|
+}
|
|
193
|
+</style>
|