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