hookehuyr

✨ feat(B端视频审核): 微信vue3兼容写法问题

...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
66 </div> 66 </div>
67 <div class="van-hairline--bottom" 67 <div class="van-hairline--bottom"
68 style="color: #222222; font-size: 1.25rem; font-weight: bold; text-align: center; padding-bottom: 1rem;"> 68 style="color: #222222; font-size: 1.25rem; font-weight: bold; text-align: center; padding-bottom: 1rem;">
69 - 作品审核建议</div> 69 + 作品不通过</div>
70 <div> 70 <div>
71 <van-field v-model="message" rows="2" autosize label="" type="textarea" maxlength="200" 71 <van-field v-model="message" rows="2" autosize label="" type="textarea" maxlength="200"
72 placeholder="请填写您对小朋友的温馨鼓励" show-word-limit /> 72 placeholder="请填写您对小朋友的温馨鼓励" show-word-limit />
...@@ -104,6 +104,12 @@ import { Toast } from 'vant'; ...@@ -104,6 +104,12 @@ import { Toast } from 'vant';
104 const $route = useRoute(); 104 const $route = useRoute();
105 const $router = useRouter(); 105 const $router = useRouter();
106 106
107 +const props = defineProps({
108 + item: Object,
109 + status: String,
110 +});
111 +const emit = defineEmits(['on-click']);
112 +
107 // 判断是否显示简介的展开图标 113 // 判断是否显示简介的展开图标
108 const hasToggle = ref(false); // 判断是否有展开文字,默认没有 114 const hasToggle = ref(false); // 判断是否有展开文字,默认没有
109 const isToggle = ref(true); // 判断展开状态,默认展开 115 const isToggle = ref(true); // 判断展开状态,默认展开
...@@ -119,19 +125,57 @@ onMounted(() => { ...@@ -119,19 +125,57 @@ onMounted(() => {
119 }) 125 })
120 }) 126 })
121 127
128 +// 审核视频通过/不通过弹框
129 +const showNotice = ref(false);
130 +const show = ref(false);
131 +const message = ref('');
132 +const onPass = () => { // 通过审核
133 + show.value = true;
134 +}
135 +const onCancel = () => {
136 + show.value = false;
137 +}
138 +
139 +const closeNotice = () => {
140 + showNotice.value = false;
141 +}
142 +const onRefuse = () => { // 不通过审核
143 + showNotice.value = true;
144 +}
145 +const handleAudit = (status) => {
146 + axios.post('/srv/?a=check_prod', {
147 + prod_id: props.item.id,
148 + status,
149 + check_note: message.value,
150 + })
151 + .then(res => {
152 + if (res.data.code === 1) {
153 + Toast.success('操作成功');
154 + message.value = '';
155 + showNotice.value = false;
156 + show.value = false;
157 + emit('on-click', props.item.id);
158 + } else {
159 + console.warn(res);
160 + if (!res.data.show) return false;
161 + Toast({
162 + icon: 'close',
163 + message: res.data.msg
164 + });
165 + }
166 + })
167 + .catch(err => {
168 + console.error(err);
169 + })
170 +}
122 </script> 171 </script>
123 172
124 <script> 173 <script>
125 -// FIXME: VUE2写法
126 export default { 174 export default {
127 - props: ['item', 'status'],
128 data() { 175 data() {
129 return { 176 return {
130 detail: {}, 177 detail: {},
131 mp: '', 178 mp: '',
132 - message: '',
133 - showNotice: false,
134 - show: false
135 } 179 }
136 }, 180 },
137 created() { 181 created() {
...@@ -165,43 +209,6 @@ export default { ...@@ -165,43 +209,6 @@ export default {
165 }, 500); 209 }, 500);
166 }, 210 },
167 methods: { 211 methods: {
168 - closeNotice() {
169 - this.showNotice = false;
170 - },
171 - onRefuse() { // 不通过审核
172 - this.showNotice = true;
173 - },
174 - onPass() { // 通过审核
175 - this.show = true;
176 - },
177 - handleAudit (status) {
178 - axios.post('/srv/?a=check_prod', {
179 - prod_id: this.detail.id,
180 - status,
181 - check_note: this.message,
182 - })
183 - .then(res => {
184 - if (res.data.code === 1) {
185 - Toast.success('操作成功');
186 - this.message = '';
187 - this.showNotice = false;
188 - this.show = false;
189 - } else {
190 - console.warn(res);
191 - if (!res.data.show) return false;
192 - Toast({
193 - icon: 'close',
194 - message: res.data.msg
195 - });
196 - }
197 - })
198 - .catch(err => {
199 - console.error(err);
200 - })
201 - },
202 - onCancel () {
203 - this.show = false;
204 - }
205 } 212 }
206 } 213 }
207 </script> 214 </script>
......
...@@ -4,20 +4,30 @@ ...@@ -4,20 +4,30 @@
4 title-active-color="#222222" title-inactive-color="#777777"> 4 title-active-color="#222222" title-inactive-color="#777777">
5 <van-tab title="待审核" :badge="prod_num" :title-style="titleStyle"> 5 <van-tab title="待审核" :badge="prod_num" :title-style="titleStyle">
6 <template v-if="!active"> 6 <template v-if="!active">
7 - <van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="onLoad"> 7 + <van-list v-model:loading="loading" :finished="finished" :finished-text="prod_list.length ? '没有更多了' : ''" @load="onLoad">
8 <template v-for="item in prod_list" :key="item" style="height: 3rem;"> 8 <template v-for="item in prod_list" :key="item" style="height: 3rem;">
9 - <b-video-card :item="item" status="PENDING"></b-video-card> 9 + <b-video-card :item="item" status="PENDING" @on-click="onClick"></b-video-card>
10 </template> 10 </template>
11 </van-list> 11 </van-list>
12 + <van-empty v-if="!prod_list.length"
13 + class="custom-image"
14 + :image="no_image"
15 + description="暂无审核信息"
16 + />
12 </template> 17 </template>
13 </van-tab> 18 </van-tab>
14 <van-tab title="已审核" :title-style="titleStyle"> 19 <van-tab title="已审核" :title-style="titleStyle">
15 <template v-if="active"> 20 <template v-if="active">
16 - <van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="onLoad"> 21 + <van-list v-model:loading="loading" :finished="finished" :finished-text="prod_list.length ? '没有更多了' : ''" @load="onLoad">
17 <template v-for="item in prod_list" :key="item" style="height: 3rem;"> 22 <template v-for="item in prod_list" :key="item" style="height: 3rem;">
18 <b-video-card :item="item" status="PROCESS"></b-video-card> 23 <b-video-card :item="item" status="PROCESS"></b-video-card>
19 </template> 24 </template>
20 </van-list> 25 </van-list>
26 + <van-empty v-if="!prod_list.length"
27 + class="custom-image"
28 + :image="no_image"
29 + description="暂无审核信息"
30 + />
21 </template> 31 </template>
22 </van-tab> 32 </van-tab>
23 </van-tabs> 33 </van-tabs>
...@@ -26,6 +36,7 @@ ...@@ -26,6 +36,7 @@
26 36
27 <script setup> 37 <script setup>
28 import BVideoCard from '@/components/BVideoCard/index.vue' 38 import BVideoCard from '@/components/BVideoCard/index.vue'
39 +import no_image from '@images/que-shuju@2x.png'
29 40
30 import { ref } from 'vue' 41 import { ref } from 'vue'
31 import { useRoute, useRouter } from 'vue-router' 42 import { useRoute, useRouter } from 'vue-router'
...@@ -112,6 +123,11 @@ const onLoad = () => { ...@@ -112,6 +123,11 @@ const onLoad = () => {
112 }) 123 })
113 }; 124 };
114 125
126 +// 审核请求操作后回调
127 +const onClick = (id) => {
128 + prod_num.value--;
129 + _.remove(prod_list.value, item => item.id === id);
130 +}
115 131
116 </script> 132 </script>
117 133
......