index.vue
8.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
<template>
<div class="video-wrapper" style="position: relative;">
<div v-if="status === 'PROCESS' && detail.showStatus" class="status">
<van-image v-if="item.status === 'ENABLE'" round width="6rem" height="6rem" style="vertical-align: bottom;"
:src="icon_enable" />
<van-image v-if="item.status === 'DISABLE'" round width="6rem" height="6rem" style="vertical-align: bottom;"
:src="icon_refuse" />
<van-image v-if="item.status === 'APPLY'" round width="6rem" height="6rem" style="vertical-align: bottom;"
:src="icon_apply" />
</div>
<div class="video-div" :id="'mui-player-' + item.id">
</div>
<div class="control-bar">
<div>
<div class="video-bar">
<van-row align="center">
<van-col span="8">
<van-image round width="2rem" height="2rem" style="vertical-align: middle;" :src="item.cover" />
<span style="font-size: 1.05rem; vertical-align: middle;">{{ item.name }}</span>
</van-col>
<van-col span="16">
<div style="color: #999999; text-align: right;">{{ item.book_name }} | {{ item.localism_type }}</div>
</van-col>
</van-row>
</div>
</div>
<div v-if="status === 'PROCESS'" style="margin-top: 1rem;">
<div v-if="item.status === 'DISABLE'" style="padding: 0 1rem 1rem 1rem; font-size: 0.85rem;">
<p style="color: #999999; margin-bottom: 0.25rem;">老师留言:</p>
<p>{{ item.check_note }}</p>
</div>
</div>
<div class="book-intro">
<div id="book-intro" :class="{ 'van-multi-ellipsis--l3': isToggle }">{{ item.note }}</div>
<div v-if="hasToggle">
<div v-if="isToggle" @click="onToggle(false)" class="book-toggle-icon">展开
<van-icon style="vertical-align: middle;" size="0.9rem" :name="icon_down" />
</div>
<div v-else @click="onToggle(true)" class="book-toggle-icon">折叠
<van-icon style="vertical-align: middle;" size="0.9rem" :name="icon_up" />
</div>
</div>
</div>
<div v-if="status === 'PENDING'" class="van-hairline--top" style="padding: 0 1rem;">
<van-row>
<van-col offset="3" style="padding: 1rem;" @click="onRefuse()">
<div style="background: #B4B4B3; border-radius: 15px; color: #FFFFFF; padding: 0.25rem 0.8rem;">
<van-icon name="close" /> 不通过
</div>
</van-col>
<van-col style="padding: 1rem;" @click="onPass()">
<div style="background: #F9D95C; border-radius: 15px; color: #713610; padding: 0.25rem 1.5rem;">
<van-icon name="passed" /> 通过
</div>
</van-col>
</van-row>
</div>
</div>
</div>
<van-overlay :show="showNotice" z-index="1000">
<div class="wrapper" @click.stop>
<div class="block">
<div style="position: absolute; top: -2rem; right: 1rem; font-size: 1.5rem;">
<van-icon name="close" color="#FFFFFF" @click="closeNotice" />
</div>
<div class="van-hairline--bottom"
style="color: #222222; font-size: 1.25rem; font-weight: bold; text-align: center; padding-bottom: 1rem;">
作品审核建议</div>
<div>
<van-field v-model="message" rows="2" autosize label="" type="textarea" maxlength="200"
placeholder="请填写您对小朋友的温馨鼓励" show-word-limit />
</div>
<div style="margin: 3rem 0;">
<my-button @on-click="handleAudit('disable')" type="primary">确定</my-button>
</div>
</div>
</div>
</van-overlay>
<van-dialog v-model:show="show" title="温馨提示" show-cancel-button confirmButtonColor="#F9D95C" @confirm="handleAudit('enable')" @cancel="onCancel">
<div style="padding: 1rem; text-align: center;">是否确认审核通过该视频 ?</div>
</van-dialog>
</template>
<script setup>
import icon_up from '@images/icon-guanbi@2x.png'
import icon_down from '@images/icon-zhankai@2x.png'
import icon_refuse from '@images/icon-jujue@2x.png'
import icon_apply from '@images/icon-shenhe@2x.png'
import icon_enable from '@images/icon-tongguo@2x.png'
import MyButton from '@/components/MyButton/index.vue'
import { ref, reactive, onMounted, nextTick, watch, onUpdated } from 'vue'
import 'mui-player/dist/mui-player.min.css'
import MuiPlayer from 'mui-player'
import axios from '@/utils/axios';
import _ from 'lodash';
import tools from '@/common/tool'
import { useRoute, useRouter } from 'vue-router'
import { Toast } from 'vant';
const $route = useRoute();
const $router = useRouter();
// 判断是否显示简介的展开图标
const hasToggle = ref(false); // 判断是否有展开文字,默认没有
const isToggle = ref(true); // 判断展开状态,默认展开
const onToggle = (v) => { // 展开/折叠
isToggle.value = v
}
onMounted(() => {
// 判断是否显示简介的展开图标
nextTick(() => {
hasToggle.value = tools.hasEllipsis('book-intro');
})
})
</script>
<script>
// FIXME: VUE2写法
export default {
props: ['item', 'status'],
data() {
return {
detail: {},
mp: '',
message: '',
showNotice: false,
show: false
}
},
created() {
},
mounted() {
setTimeout(() => {
var mp = new MuiPlayer({
container: '#mui-player-' + this.item.id,
title: this.item.title,
src: this.item.video,
poster: this.item.cover,
autoFit: false,
videoAttribute: [ // 声明启用同层播放, 不让会自动全屏播放
{ attrKey: 'webkit-playsinline', attrValue: 'webkit-playsinline' },
{ attrKey: 'playsinline', attrValue: 'playsinline' },
{ attrKey: 'x5-video-player-type', attrValue: 'h5-page' },
]
})
this.mp = mp;
this.detail = _.cloneDeep(this.item);
this.detail.showStatus = true;
var video = mp.video();
// 监听原生video事件,审核状态标签显示控制
var _this = this;
video && video.addEventListener('play', function (event) {
_this.detail.showStatus = false;
});
video && video.addEventListener('pause', function (event) {
_this.detail.showStatus = true;
});
}, 500);
},
methods: {
closeNotice() {
this.showNotice = false;
},
onRefuse() { // 不通过审核
this.showNotice = true;
},
onPass() { // 通过审核
this.show = true;
},
handleAudit (status) {
axios.post('/srv/?a=check_prod', {
prod_id: this.detail.id,
status,
check_note: this.message,
})
.then(res => {
if (res.data.code === 1) {
Toast.success('操作成功');
this.message = '';
this.showNotice = false;
this.show = false;
} else {
console.warn(res);
if (!res.data.show) return false;
Toast({
icon: 'close',
message: res.data.msg
});
}
})
.catch(err => {
console.error(err);
})
},
onCancel () {
this.show = false;
}
}
}
</script>
<style lang="less" scoped>
.video-wrapper {
margin: 1rem;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.13);
.status {
position: absolute;
top: 0;
right: 0;
z-index: 999;
}
.video-div {
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
.video-bar {
color: #713610;
padding: 1rem;
padding-bottom: 0.5rem;
}
.book-intro {
padding: 1rem;
padding-top: 0;
.book-post {
color: #222222;
font-size: 1.25rem;
font-weight: bold;
}
#book-intro {
color: #333333;
margin-top: 0.25rem;
}
.book-toggle-icon {
text-align: right;
color: #713610;
font-size: 1rem;
}
}
}
.wrapper {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
width: auto;
text-align: center;
}
.block {
width: 80%;
// height: 25rem;
background-color: #fff;
border-radius: 10px;
padding: 1rem;
position: relative;
margin-top: 1rem;
margin-bottom: 5rem;
}
</style>