|
@@ -49,6 +49,9 @@
|
|
|
:loading="loading"
|
|
|
>
|
|
|
<span slot="action" slot-scope="text, record">
|
|
|
+ <a @click="preview(record)">替换素材</a>
|
|
|
+
|
|
|
+ <a-divider type="vertical" />
|
|
|
<a @click="preview(record)">预览</a>
|
|
|
|
|
|
<a-divider type="vertical" />
|
|
@@ -71,24 +74,106 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <a-modal title="素材替换" :visible="previewVisible" @cancel="handleCancel" :width="1000"> </a-modal>
|
|
|
+ <a-modal
|
|
|
+ title="模板上传"
|
|
|
+ :visible="previewVisible"
|
|
|
+ @cancel="handleCancel"
|
|
|
+ :width="1000"
|
|
|
+ @ok="saveFile"
|
|
|
+ :confirm-loading="confirmLoading"
|
|
|
+ >
|
|
|
+ <a-form :form="form">
|
|
|
+ <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="模板所属账户">
|
|
|
+ <Treeselect :appId.sync="appId" :multiple="false" request="1,3" ref="treeSelect" style="width: 100%" />
|
|
|
+ </a-form-item>
|
|
|
+ <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="模板类型">
|
|
|
+ <a-input
|
|
|
+ placeholder="请输入模板类型"
|
|
|
+ v-decorator.trim="['fileType', { rules: [{ required: true, message: '请输入模板类型' }] }]"
|
|
|
+ />
|
|
|
+ </a-form-item>
|
|
|
+ <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="模板文件">
|
|
|
+ <a-upload
|
|
|
+ name="file"
|
|
|
+ action="http://192.168.1.251/jeecg-boot"
|
|
|
+ :customRequest="customRequest"
|
|
|
+ :fileList="defaultFileList"
|
|
|
+ >
|
|
|
+ <a-button> <a-icon type="upload" /> Click to Upload </a-button>
|
|
|
+ </a-upload>
|
|
|
+ <!-- <input type="file" @change="customRequest"> -->
|
|
|
+ </a-form-item>
|
|
|
+ </a-form>
|
|
|
+ </a-modal>
|
|
|
+ <a-modal
|
|
|
+ title="替换素材"
|
|
|
+ :visible="changeVisible"
|
|
|
+ @cancel="handleCancel"
|
|
|
+ :width="1000"
|
|
|
+ @ok="saveFile"
|
|
|
+ :confirm-loading="confirmLoading"
|
|
|
+ >
|
|
|
+ <a-form :form="form">
|
|
|
+ <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="模板所属账户">
|
|
|
+ <Treeselect :appId.sync="appId" :multiple="false" request="1,3" ref="treeSelect" style="width: 100%" />
|
|
|
+ </a-form-item>
|
|
|
+ <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="模板类型">
|
|
|
+ <a-input
|
|
|
+ placeholder="请输入模板类型"
|
|
|
+ v-decorator.trim="['fileType', { rules: [{ required: true, message: '请输入模板类型' }] }]"
|
|
|
+ />
|
|
|
+ </a-form-item>
|
|
|
+ <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="模板文件">
|
|
|
+ <a-upload
|
|
|
+ name="file"
|
|
|
+ action="http://192.168.1.251/jeecg-boot"
|
|
|
+ :customRequest="customRequest"
|
|
|
+ :fileList="defaultFileList"
|
|
|
+ >
|
|
|
+ <a-button> <a-icon type="upload" /> Click to Upload </a-button>
|
|
|
+ </a-upload>
|
|
|
+ <!-- <input type="file" @change="customRequest"> -->
|
|
|
+ </a-form-item>
|
|
|
+ </a-form>
|
|
|
+ </a-modal>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getAction, postAction } from '../../api/manage'
|
|
|
+import { getAction, postAction, uploadAction } from '../../api/manage'
|
|
|
import playerList from './playerData'
|
|
|
import { mapGetters } from 'vuex'
|
|
|
-
|
|
|
+import Treeselect from '@/views/modules/Statistics/components/Treeselect.vue'
|
|
|
+import qs from 'qs'
|
|
|
export default {
|
|
|
+ components: {
|
|
|
+ Treeselect,
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
+ confirmLoading: false,
|
|
|
+ labelCol: {
|
|
|
+ xs: { span: 24 },
|
|
|
+ sm: { span: 5 },
|
|
|
+ },
|
|
|
+ wrapperCol: {
|
|
|
+ xs: { span: 24 },
|
|
|
+ sm: { span: 16 },
|
|
|
+ },
|
|
|
+ headers: {
|
|
|
+ 'Content-Type': 'multipart/form-data',
|
|
|
+ },
|
|
|
+ defaultFileList: [],
|
|
|
+ fileAll: null,
|
|
|
playerList,
|
|
|
previewBody: false,
|
|
|
playerSrc: '',
|
|
|
previewVisible: false,
|
|
|
+ changeVisible:false,
|
|
|
loading: false,
|
|
|
dataSource: [],
|
|
|
+ form: this.$form.createForm(this),
|
|
|
+ appId: '',
|
|
|
columns: [
|
|
|
{
|
|
|
title: '试玩名称',
|
|
@@ -117,7 +202,56 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ customRequest(data) {
|
|
|
+ var dataAll = {
|
|
|
+ uid: '1',
|
|
|
+ name: data.file.name,
|
|
|
+ status: 'done',
|
|
|
+ }
|
|
|
+
|
|
|
+ this.defaultFileList = [dataAll]
|
|
|
+ this.fileAll = data.file
|
|
|
+ // this.saveFile(data.file)
|
|
|
+ },
|
|
|
+ saveFile(e) {
|
|
|
+ this.confirmLoading = true
|
|
|
+ this.form.validateFields((err, values) => {
|
|
|
+ if (!err) {
|
|
|
+ let that = this
|
|
|
+ let formData = new FormData()
|
|
|
+ console.log(this.defaultFileList)
|
|
|
+ formData.append('file', this.fileAll)
|
|
|
+ formData.append('userId', this.userInfo().id)
|
|
|
+ formData.append('fileType', values.fileType)
|
|
|
+ uploadAction('/shiwan/shiwanFileUpload/saveOrUpdateFile', formData).then((res) => {
|
|
|
+ if (res.success) {
|
|
|
+ this.confirmLoading = false
|
|
|
+ this.defaultFileList = []
|
|
|
+ this.fileAll = null
|
|
|
+ this.form.resetFields()
|
|
|
+ this.previewVisible = false
|
|
|
+ this.getPlayableList()
|
|
|
+ } else {
|
|
|
+ this.confirmLoading = false
|
|
|
+ this.$message.error(res.message)
|
|
|
+ this.defaultFileList = []
|
|
|
+ this.fileAll = null
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
...mapGetters(['nickname', 'avatar', 'userInfo']),
|
|
|
+ changeView(item) {
|
|
|
+ getAction('/shiwan/shiwanFileUpload/selectListByParentId', { id: item.id }).then((res) => {
|
|
|
+ if (res.success) {
|
|
|
+ this.previewBody = true
|
|
|
+ this.playerSrc = res.result.filter((i) => {
|
|
|
+ return i.fileSuffix == 'html'
|
|
|
+ })[0].fileUrl
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
preview(item) {
|
|
|
console.log(item)
|
|
|
|
|
@@ -136,7 +270,9 @@ export default {
|
|
|
handleCancel() {
|
|
|
this.previewVisible = false
|
|
|
},
|
|
|
- addModules() {},
|
|
|
+ addModules() {
|
|
|
+ this.previewVisible = true
|
|
|
+ },
|
|
|
handleDelete(item) {
|
|
|
postAction('/shiwan/shiwanFileUpload/edit', { id: item, fileStatus: '0' }).then((res) => {
|
|
|
if (res.success) {
|