丰都 投票
This commit is contained in:
		| @@ -8,19 +8,24 @@ | ||||
|       <ai-card title="规则设置"> | ||||
|         <template #content> | ||||
|           <el-form ref="form" class="ai-form" :model="form" label-width="110px" label-position="right"> | ||||
|             <el-form-item label="投票设置" style="width: 100%" prop="title" :rules="[{required: true, message: '请输入投票设置', trigger: 'blur'}]"> | ||||
|               <el-input-number v-model="form.day" size="small" placeholder="请输入投票设置"></el-input-number> | ||||
|             <el-form-item label="投票设置" style="width: 100%" prop="voteLimitNumber" :rules="[{required: true, message: '请输入投票设置', trigger: 'blur'}]"> | ||||
|               <el-input-number v-model="form.voteLimitNumber" :min="1" size="small" placeholder="请输入投票设置"></el-input-number> | ||||
|               <span style="margin-left: 10px;">票/人天</span> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="前言设置" style="width: 100%" prop="preface" :rules="[{required: true, message: '请输入视频简介', trigger: 'blur'}]"> | ||||
|             <el-form-item label="前言设置" style="width: 100%" prop="preface" :rules="[{required: true, message: '请输入前言设置', trigger: 'change'}]"> | ||||
|               <ai-editor v-model="form.preface" :instance="instance"/> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="结尾设置" style="width: 100%" prop="end" :rules="[{required: true, message: '请输入视频简介', trigger: 'blur'}]"> | ||||
|               <ai-editor v-model="form.end" :instance="instance"/> | ||||
|             <el-form-item label="结尾设置" style="width: 100%" prop="ending" :rules="[{required: true, message: '请输入结尾设置', trigger: 'change'}]"> | ||||
|               <ai-editor v-model="form.ending" :instance="instance"/> | ||||
|             </el-form-item> | ||||
|           </el-form> | ||||
|         </template> | ||||
|       </ai-card> | ||||
|     </template> | ||||
|     <template slot="footer"> | ||||
|       <el-button @click="cancel" style="width: 100px">取消</el-button> | ||||
|       <el-button type="primary" @click="onConfirm" style="width: 100px">确认</el-button> | ||||
|     </template> | ||||
|   </ai-detail> | ||||
| </template> | ||||
|  | ||||
| @@ -39,7 +44,8 @@ | ||||
|         form: { | ||||
|           day: '', | ||||
|           preface: '', | ||||
|           end: '' | ||||
|           ending: '', | ||||
|           id: '' | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
| @@ -50,23 +56,36 @@ | ||||
|  | ||||
|     methods: { | ||||
|       getInfo () { | ||||
|  | ||||
|         this.instance.post(`/app/appvideovoteconfig/queryDetailByCorpId`).then(res => { | ||||
|           if (res.code == 0) { | ||||
|             if (res.data) { | ||||
|               this.id = res.data.id | ||||
|               this.form = { | ||||
|                 ...res.data | ||||
|               } | ||||
|             } | ||||
|           } | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       onConfirm () { | ||||
|         this.$refs.form.validate((valid) => { | ||||
|           if (valid) { | ||||
|             this.instance.post(`/app/appassessmentscorev2task/addOrUpdate`, { | ||||
|             if (!this.form.preface) { | ||||
|               return this.$message.error('请输入前言设置') | ||||
|             } | ||||
|  | ||||
|             if (!this.form.ending) { | ||||
|               return this.$message.error('请输入前言设置') | ||||
|             } | ||||
|  | ||||
|             this.instance.post(`/app/appvideovoteconfig/addOrUpdate`, { | ||||
|               ...this.form, | ||||
|               beginTime: this.form.date[0], | ||||
|               endTime: this.form.date[1], | ||||
|               date: '' | ||||
|               id: this.id || '' | ||||
|             }).then(res => { | ||||
|               if (res.code == 0) { | ||||
|                 this.$message.success('提交成功!') | ||||
|                 this.isShow = false | ||||
|  | ||||
|                 this.getList() | ||||
|                 this.cancel() | ||||
|               } | ||||
|             }) | ||||
|           } | ||||
|   | ||||
| @@ -10,12 +10,12 @@ | ||||
|           </template> | ||||
|           <template #right> | ||||
|             <el-input | ||||
|               v-model="search.title" | ||||
|               v-model="search.videoName" | ||||
|               size="small" | ||||
|               placeholder="请输入视频名称" | ||||
|               clearable | ||||
|               v-throttle="() => {search.current = 1, getList()}" | ||||
|               @clear="search.current = 1, search.title = '', getList()" | ||||
|               @clear="search.current = 1, search.videoName = '', getList()" | ||||
|               suffix-icon="iconfont iconSearch"> | ||||
|             </el-input> | ||||
|           </template> | ||||
| @@ -31,9 +31,8 @@ | ||||
|           <el-table-column slot="options" width="140px" fixed="right" label="操作" align="center"> | ||||
|             <template slot-scope="{ row }"> | ||||
|               <div class="table-options"> | ||||
|                 <el-button type="text" @click="toDetail(row.id)">详情</el-button> | ||||
|                 <el-button type="text" v-if="row.status !== '1'" @click="remove(row.id)">删除</el-button> | ||||
|                 <el-button type="text" v-if="row.status === '1'" @click="stop(row.id)">停止</el-button> | ||||
|                 <el-button type="text" @click="edit(row)">编辑</el-button> | ||||
|                 <el-button type="text" @click="remove(row.id)">删除</el-button> | ||||
|               </div> | ||||
|             </template> | ||||
|           </el-table-column> | ||||
| @@ -42,15 +41,15 @@ | ||||
|       <ai-dialog | ||||
|         :visible.sync="isShow" | ||||
|         width="890px" | ||||
|         title="视频上传" | ||||
|         :title="id ? '编辑视频上传' : '添加视频上传'" | ||||
|         @close="onClose" | ||||
|         @onConfirm="onConfirm"> | ||||
|         <el-form ref="form" class="ai-form" :model="form" label-width="110px" label-position="right"> | ||||
|           <el-form-item label="视频名称" style="width: 100%" prop="title" :rules="[{required: true, message: '请输入视频名称', trigger: 'blur'}]"> | ||||
|             <el-input v-model="form.title" size="small" placeholder="请输入视频名称"></el-input> | ||||
|           <el-form-item label="视频名称" style="width: 100%" prop="videoName" :rules="[{required: true, message: '请输入视频名称', trigger: 'blur'}]"> | ||||
|             <el-input v-model="form.videoName" size="small" placeholder="请输入视频名称"></el-input> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="视频简介" style="width: 100%" prop="title" :rules="[{required: true, message: '请输入视频简介', trigger: 'blur'}]"> | ||||
|             <el-input v-model="form.title" type="textarea" size="small" :rows="4" placeholder="请输入视频简介"></el-input> | ||||
|           <el-form-item label="视频简介" style="width: 100%" prop="videoIntroduction" :rules="[{required: true, message: '请输入视频简介', trigger: 'blur'}]"> | ||||
|             <el-input v-model="form.videoIntroduction" type="textarea" size="small" :rows="4" placeholder="请输入视频简介"></el-input> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="视频" prop="files" style="width: 100%;" :rules="[{required: true, message: '请上传视频', trigger: 'change'}]"> | ||||
|             <el-upload :show-file-list="false" ref="upload1" action :http-request="submitUpload" :accept="accept" :limit="1"> | ||||
| @@ -100,20 +99,27 @@ | ||||
|     data () { | ||||
|       return { | ||||
|         accept: '.mp4', | ||||
|         id: '', | ||||
|         search: { | ||||
|           current: 1, | ||||
|           size: 10, | ||||
|           title: '' | ||||
|           videoName: '' | ||||
|         }, | ||||
|         isShow: false, | ||||
|         form: { | ||||
|           title: '', | ||||
|           files: [] | ||||
|           files: [], | ||||
|           imageFileId: '', | ||||
|           imageFileUrl: '', | ||||
|           videoFileId: '', | ||||
|           videoFileUrl: '', | ||||
|           videoIntroduction: '', | ||||
|           videoName: '' | ||||
|         }, | ||||
|         id: '', | ||||
|         colConfigs: [ | ||||
|           { prop: 'title', label: '视频名称' }, | ||||
|           { prop: 'createUserName', align: 'center', label: '视频简介' }, | ||||
|           { prop: 'createUserName', align: 'center', label: '票数' } | ||||
|           { prop: 'videoName', label: '视频名称' }, | ||||
|           { prop: 'videoIntroduction', align: 'center', label: '视频简介' }, | ||||
|           { prop: 'voteNumber', align: 'center', label: '票数' } | ||||
|         ], | ||||
|         tableData: [], | ||||
|         total: 0 | ||||
| @@ -126,12 +132,33 @@ | ||||
|  | ||||
|     methods: { | ||||
|       onClose () { | ||||
|         this.form.date = '' | ||||
|         this.form.templateId = '' | ||||
|         this.form.title = '' | ||||
|         this.id = '' | ||||
|         this.form.files = [] | ||||
|         this.form.videoName = '' | ||||
|         this.form.videoIntroduction = '' | ||||
|         this.form.videoFileUrl = '' | ||||
|         this.form.videoFileId = '' | ||||
|         this.form.imageFileUrl = '' | ||||
|         this.form.imageFileId = '' | ||||
|         this.isShow = false | ||||
|       }, | ||||
|  | ||||
|       edit (e) { | ||||
|         this.id = e.id | ||||
|  | ||||
|         this.form.videoName = e.videoName | ||||
|         this.form.videoIntroduction = e.videoIntroduction | ||||
|         this.form.videoFileUrl = e.videoFileUrl | ||||
|         this.form.videoFileId = e.videoFileId | ||||
|         this.form.imageFileUrl = e.imageFileUrl | ||||
|         this.form.imageFileId = e.imageFileId | ||||
|         this.form.files = [{ | ||||
|           id: e.videoFileId, | ||||
|           url: e.videoFileUrl | ||||
|         }] | ||||
|  | ||||
|         this.isShow = true | ||||
|       }, | ||||
|  | ||||
|       submitUpload(file) { | ||||
|         this.$refs['upload1']?.clearFiles(); | ||||
| @@ -159,21 +186,21 @@ | ||||
|  | ||||
|           if (fileType && this.accept.indexOf(fileType.toLocaleLowerCase()) > -1) { | ||||
|             let formData = new FormData() | ||||
|             formData.append('file', file.file); | ||||
|             this.isLoading = true | ||||
|             this.instance.post(`/admin/file/add-unlimited`, formData).then(res => { | ||||
|             formData.append('file', file.file) | ||||
|             formData.append('bizType', 1) | ||||
|             this.instance.post(`/admin/file/addVideo`, formData).then(res => { | ||||
|               if (res && res.data) { | ||||
|                 let videoList = res.data[0].split(";"); | ||||
|                 let videoList = res.data[0].split(";") | ||||
|                 this.form.videoFileUrl = res.data[0].split(";")[0] | ||||
|                 this.form.videoFileId = res.data[0].split(";")[1] | ||||
|                 this.form.imageFileUrl = res.data[1].split(";")[0] | ||||
|                 this.form.imageFileId = res.data[1].split(";")[1] | ||||
|  | ||||
|                 this.form.files = [{ | ||||
|                   id: videoList[1], | ||||
|                   url: videoList[0] | ||||
|                 }] | ||||
|               } | ||||
|  | ||||
|               this.isLoading = false | ||||
|             }).catch(() => { | ||||
|               this.isLoading = false | ||||
|             }) | ||||
|           } else { | ||||
|             return this.$message.error("视频格式错误") | ||||
| @@ -184,11 +211,9 @@ | ||||
|       onConfirm () { | ||||
|         this.$refs.form.validate((valid) => { | ||||
|           if (valid) { | ||||
|             this.instance.post(`/app/appassessmentscorev2task/addOrUpdate`, { | ||||
|             this.instance.post(`/app/appvideoinfo/addOrUpdate`, { | ||||
|               ...this.form, | ||||
|               beginTime: this.form.date[0], | ||||
|               endTime: this.form.date[1], | ||||
|               date: '' | ||||
|               id: this.id || '' | ||||
|             }).then(res => { | ||||
|               if (res.code == 0) { | ||||
|                 this.$message.success('提交成功!') | ||||
| @@ -202,7 +227,7 @@ | ||||
|       }, | ||||
|  | ||||
|       getList () { | ||||
|         this.instance.post(`/app/appassessmentscorev2task/list`, null, { | ||||
|         this.instance.post(`/app/appvideoinfo/list`, null, { | ||||
|           params: { | ||||
|             ...this.search | ||||
|           } | ||||
| @@ -210,7 +235,6 @@ | ||||
|           if (res.code == 0) { | ||||
|             this.tableData = res.data.records | ||||
|             this.total = res.data.total | ||||
|             this.loading = false | ||||
|           } | ||||
|         }) | ||||
|       }, | ||||
| @@ -226,7 +250,7 @@ | ||||
|  | ||||
|       remove (id) { | ||||
|         this.$confirm('确定删除该数据?').then(() => { | ||||
|           this.instance.post(`/app/appassessmentscorev2task/delete?ids=${id}`).then(res => { | ||||
|           this.instance.post(`/app/appvideoinfo/delete?ids=${id}`).then(res => { | ||||
|             if (res.code == 0) { | ||||
|               this.$message.success('删除成功!') | ||||
|               this.getList() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user