dataCenter.vue 17.7 KB
Newer Older
全球's avatar
全球 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
<template>
    <div class="container dataCenter form-table">
        <el-breadcrumb separator-class="el-icon-arrow-right">
            <el-breadcrumb-item>当前位置</el-breadcrumb-item>
            <el-breadcrumb-item>{{this.$route.name[0]}}</el-breadcrumb-item>
        </el-breadcrumb>
        <div class="assetsContent">
            <div class="formDiv">
                <el-form :inline="true" :model="formInline" class="search-form-inline">
                    <el-form-item label="用户ID:">
                        <el-input v-model="formInline.userId" placeholder="精准查询" clearable></el-input>
                    </el-form-item>
                    <el-form-item>
                        <div class="btn-group marginL10">
                            <button class="vpnButton primary" type="button" @click="search" size="mini">查询</button >
                            <button class="vpnButton cancel" type="button" @click="cancel" size="mini">清空</button>
                        </div>
                    </el-form-item>
                    <el-form-item class="pull-right">
                        <div class="btn-group marginL10">
全球's avatar
全球 committed
21
                            <button class="vpnButton primary" type="button"  style="width: 95px" @click="newFiles" >添加视频资讯</button>
全球's avatar
全球 committed
22 23 24 25 26 27 28 29 30
                            <!--<button class="vpnButton cancel" type="button" @click="delSelect">批量删除</button>-->
                        </div>
                    </el-form-item>
                </el-form>
            </div>
            <div class="assetsList">
                <el-scrollbar>
                    <el-table :data="tableData"style="width: 100%"size="mini"class="commonTable"height="627px">
                        <el-table-column prop="userId" label="用户ID" align="center" min-width="6%"></el-table-column>
全球's avatar
全球 committed
31
                        <el-table-column prop="zxid" label="资讯ID" align="center" min-width="8%"  :show-overflow-tooltip="true"></el-table-column>
全球's avatar
全球 committed
32
                        <el-table-column prop="zxLikes" label="获赞数" align="center" min-width="8%"  :show-overflow-tooltip="true"></el-table-column>
全球's avatar
全球 committed
33 34 35 36 37 38 39
                        <el-table-column prop="auditStatus" label="审核" align="center" min-width="8%"  :show-overflow-tooltip="true">
                            <template slot-scope="scope">
                                <span v-if="scope.row.auditStatus == '0'">未审核</span>
                                <span v-if="scope.row.auditStatus == '1'">已审核</span>
                                <span v-if="scope.row.auditStatus == '2'">驳回</span>
                            </template>
                        </el-table-column>
全球's avatar
全球 committed
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
                        <el-table-column prop="zxField" label="资讯内容" align="center" min-width="8%"  :show-overflow-tooltip="true"></el-table-column>
                        <el-table-column prop="zxDate" label="创建时间" align="center" min-width="8%"  :show-overflow-tooltip="true"></el-table-column>
                        <el-table-column label="操作"align="center"min-width="15%" >
                            <template slot-scope="scope">
                                <el-button type="text"size="small"style="color: #70B603"  @click="editDetail(scope.row)">审核</el-button>
                                <el-button type="text"size="small"style="color: #ff190c" @click="deleteDetail(scope.row)">驳回</el-button>
                                <el-button type="text"size="small" @click="upDetail(scope.row)">查看详情</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                </el-scrollbar>
            </div>
            <el-pagination background class="alignc" @current-change="handleCurrentChange" :current-page="page.currentPage" :page-size="page.pageSize" layout="total, prev, pager, next, jumper" :total="page.total">
            </el-pagination>
        </div>
        <el-dialog class="appFormCommon"  :close-on-click-modal="false"  :visible.sync="dialogDataDetail"  @close="resetForm('formDataApp')" >
            <div class="managerInfo">
                <div class="message-box">
                    <div class="message-box-header">
                        <div class="message-box-title">
                            <span>{{title}}</span>
                        </div>
                        <i class="icon icon-close" @click="dialogDataDetail = false"></i>
                    </div>
                    <div class="message-box-content">
                        <el-form class="demoFormApp" ref="formDataApp" :model="formDataApp"  label-width="125px">
全球's avatar
全球 committed
66 67
                            <el-form-item v-if="!displayType" label="邀请码:">
                                <el-input  v-model="formDataApp.inviteCode "></el-input>
全球's avatar
全球 committed
68
                            </el-form-item>
全球's avatar
全球 committed
69 70 71 72 73
                            <el-form-item  v-if="displayType"  label="用户ID:">
                                <el-input :disabled="true"  v-model="formDataApp.userId "></el-input>
                            </el-form-item>
                            <el-form-item  v-if="displayType"  label="资讯ID:">
                                <el-input :disabled="true"  v-model="formDataApp.zxid "></el-input>
全球's avatar
全球 committed
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
                            </el-form-item>
                            <el-upload
                                    class="avatar-uploader"
                                    action=""
                                    :disabled="distype"
                                    v-bind:show-file-list="false"
                                    :http-request="handleUploadImg"
                                    v-bind:before-upload="beforeUploadVideo">
                                <video v-if="videoForm.showVideoPath !='' && !videoFlag"
                                v-bind:src="videoForm.showVideoPath"
                                class="avatar video-avatar"
                                controls="controls" style="width: 300px">
                                您的浏览器不支持视频播放
                                </video>
                                <i v-else-if="videoForm.showVideoPath =='' && !videoFlag"
                                   class="el-icon-plus avatar-uploader-icon"></i>
                                <el-progress style="margin-left: 64px"
                                             v-bind:percentage="videoUploadPercent"
                                             type="circle" v-if="videoFlag == true"
                                             :percentage="0"></el-progress>
                            </el-upload>
                        </el-form>
                    </div>
                    <div class="message-box-footer" slot="footer" >
                        <div class="message-box-btn btn-group">
                                <button  class="vpnButton primary" @click="submitForm('formDataApp')" type="button">确定</button>
                                <button  class="vpnButton cancel" @click="resetForm('formDataApp')" type="button">取消</button>
                        </div>
                    </div>
                </div>
            </div>
        </el-dialog>
    </div>
</template>


<script>
    import "../../../style/table.scss"
    //删除弹框
    import dialogDel from '../../../components/dialog/dialogDel'
    import workService from '../../../services/fos/work.service'
    let workHttps = new workService()
    import qs from "qs";
    export default {
        data() {
            return {
                dialogDataDetail:false,
                formDataApp:{
                },
                page: {currentPage: 1, pageSize: 14, total: 1},
                formInline: {
                    userId: '',
                },
                displayType:true,
                tableData:[],
                visible: false,
                cheackAllChecked: false,
                clCode:0,
                videoFlag: false,
                distype:false,
                //是否显示进度条
                videoUploadPercent: "",
                //进度条的进度,
                isShowUploadVideo: false,
                //显示上传按钮
                videoForm: {
                    showVideoPath: ''
                },
                title:'',
全球's avatar
全球 committed
143 144 145 146 147
                dataList:[],
                files:'',
                param:'',
                playVideoUrl:'',
                objurl:'',
全球's avatar
全球 committed
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
            }
        },
        components: {},
        mounted() {
            this.search()
        },
        methods: {
            handleCurrentChange(val) {
                this.page.currentPage = val;
                let param = this.getSearchQuery()
                this.getDataDetail(param)
            },

            //查询
            search(){
                let vm = this;
                let param = vm.getSearchQuery()
                vm.getDataDetail(param)
            },
            cancel(){
                this.formInline = {}
                this.search()
            },
            //获取当前参数
            getSearchQuery(){
                let vm = this
                let searchObj = {
                    "pageNo":vm.page.currentPage,
                    "pageSize":vm.page.pageSize
                }
                for(let key in vm.formInline){
                    if(vm.formInline[key]){
                        //key是名称
                        searchObj[key] = vm.formInline[key]
                    }
                }
                return searchObj
            },
            //获取信息列表
            getDataDetail(param) {
                //请求接口的方法
                let vm = this;
                //请求接口的方法
                //  let requestObj = {page: 1,limit: 100000000}
                workHttps.getShopZx(param).then((res)=>{
                    vm.tableData = res.data.list
                    vm.page.total = Number(res.data.total)
                }).catch((err=>{
                    console.log(err)
                }))
            },

            //审核通过
            editDetail(val){
                let vm = this;
                let obj = {
                    approval:1,
                    zxid:val.zxid
                }
                var param = qs.stringify(obj)
                workHttps.setToExamine(param).then((res)=>{
                   if(res.code == 0){
                     vm.search()
                     vm.$message.success(res.msg)
                   }
                }).catch((err=>{
                    console.log(err)
                }))
            },

            //驳回
            deleteDetail(val){
                let vm = this;
                let obj = {
全球's avatar
全球 committed
222
                    approval:2,
全球's avatar
全球 committed
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240
                    zxid:val.zxid
                }
                var param = qs.stringify(obj)
                workHttps.setToExamine(param).then((res)=>{
                    if(res.code == 0){
                        vm.search()
                        vm.$message.success(res.msg)
                    }
                }).catch((err=>{
                    console.log(err)
                }))
            },


            //获取信息列表
            upDetail(val) {
                //请求接口的方法
                let vm = this;
全球's avatar
全球 committed
241 242 243
                vm.distype = true
                vm.displayType = true
                this.title = "查看视频资讯"
全球's avatar
全球 committed
244 245 246 247 248 249 250 251 252
                let obj = {
                    pageNo:1,
                    pageSize:1,
                    userId:val.userId
                }
                //请求接口的方法
                workHttps.getShopZx(obj).then((res)=>{
                    if(res.code == 0){
                        vm.dialogDataDetail= true
全球's avatar
全球 committed
253 254 255 256 257 258 259 260
                        vm.videoForm.showVideoPath="https://www.xitiansen.com/" + res.data.list[0].zxUrl;
                        // var url = URL.createObjectURL(res.data.list[0].zxUrl);
                        // document.getElementById("aa").src=url;
                        // let player = document.querySelector('#root')
                        // var str= res.data.list[0].zxUrl;
                        // player.src = str
                        // player.play()
                       // vm.videoForm.showVideoPath = str
全球's avatar
全球 committed
261 262 263 264 265 266 267 268 269 270
                        vm.formDataApp = res.data.list[0]
                    }
                }).catch((err=>{
                    console.log(err)
                }))
            },

            newFiles(){
                let vm = this
                vm.dialogDataDetail = true
全球's avatar
全球 committed
271 272 273
                vm.title = "添加视频资讯"
                vm.displayType = false
                vm.distype = false
全球's avatar
全球 committed
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293
            },
            //取消按钮
            resetForm(formData){
                this.$refs[formData].resetFields();
                this.dialogDataDetail = false
                this.formDataApp = {}
                this.videoForm.showVideoPath = ""
            },

            //上传前回调
            beforeUploadVideo(file) {
                var fileSize = file.size / 1024 / 1024 < 50;
                if (['video/mp4', 'video/ogg', 'video/flv', 'video/avi', 'video/wmv', 'video/rmvb', 'video/mov'].indexOf(file.type) == -1) {
                    layer.msg("请上传正确的视频格式");
                    return false;
                }
                if (!fileSize) {
                    layer.msg("视频大小不能超过50MB");
                    return false;
                }
全球's avatar
全球 committed
294 295
                this.videoForm.showVideoPath = file
                this.imagePreview(this.videoForm.showVideoPath, 2)
全球's avatar
全球 committed
296 297 298
                this.isShowUploadVideo = false;
            },

全球's avatar
全球 committed
299 300 301 302 303 304 305 306 307 308 309 310 311
            imagePreview(file) {
                var self = this
                //定义一个文件阅读器
                var reader = new FileReader()
                //文件装载后将其显示在图片预览里
                reader.onload = function (e) {
                    //将bade64位图片保存至数组里供上面图片显示
                        self.videoForm.showVideoPath = e.target.result
                }
                reader.readAsDataURL(file)
            },


全球's avatar
全球 committed
312 313 314 315 316
            handleUploadImg(file){
                let vm = this;
                let obj = {
                    inviteCode:this.formDataApp.inviteCode
                }
全球's avatar
全球 committed
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333
                 vm.files = new FormData();
                vm.files.append("files", file.file);
                 vm.param = qs.stringify(obj)
                // workHttps.setupload(formData,param).then((res)=>{
                //     if(res.code == 0){
                //         vm.distype = true
                //        // vm.videoForm.showVideoPath = res.videoUrl
                //         vm.$message.success(res.msg)
                //     }
                // }).catch((err=>{
                //     console.log(err)
                // }))
            },

            submitForm(){
                let vm = this
                workHttps.setupload(vm.files,vm.param).then((res)=>{
全球's avatar
全球 committed
334 335
                    if(res.code == 0){
                        vm.distype = true
全球's avatar
全球 committed
336 337 338
                       // vm.videoForm.showVideoPath = res.videoUrl
                        this.dialogDataDetail = false
                        vm.search()
全球's avatar
全球 committed
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416
                        vm.$message.success(res.msg)
                    }
                }).catch((err=>{
                    console.log(err)
                }))
            },

        },

    }
</script>

<style lang="scss" scoped>

                     /*.el-upload {*/
                        /*border: 1px dashed #6e6e6a;*/
                        /*border-radius: 6px;*/
                        /*cursor: pointer;*/
                        /*position: relative;*/
                        /*overflow: hidden;*/
                         /*width: 300px;*/
                    /*}*/
                    /*.avatar-uploader .el-upload:hover {*/
                        /*border-color: #409EFF;*/
                    /*}*/
                    /*.avatar-uploader-icon {*/
                        /*font-size: 28px;*/
                        /*color: #8c939d;*/
                        /*width: 300px;*/
                        /*height: 178px;*/
                        /*line-height: 178px;*/
                        /*text-align: center;*/
                        /*border: 1px dashed #080408;*/

                    /*}*/
                    /*.avatar {*/
                        /*width: 178px;*/
                        /*height: 178px;*/
                        /*display: block;*/
                        /*border: 1px dashed #ff190c;*/
                    /*}*/

                    /*.el-progress el-progress--circle{*/
                        /*.el-progress__text{*/
                            /*padding-left: 64px!important;*/
                        /*}*/
                    /*}*/

                     .avatar-uploader .el-upload {
                         border: 1px dashed #d9d9d9;
                         border-radius: 6px;
                         cursor: pointer;
                         position: relative;
                         overflow: hidden;
                         padding-left: 125px;
                     }
                     .avatar-uploader .el-upload:hover {
                         border-color: #409EFF;
                     }
                     .avatar-uploader{
                         padding-left: 125px;
                     }
                     .avatar-uploader-icon {
                         font-size: 28px;
                         color: #8c939d;
                         width: 300px;
                         height: 178px;
                         line-height: 178px;
                         text-align: center;
                         border: 1px dashed #6e6e6a;
                     }
                     .avatar {
                         width: 178px;
                         height: 178px;
                         display: block;
                     }

</style>