|
@@ -133,15 +133,16 @@
|
|
v-if="uploadType == '1'"
|
|
v-if="uploadType == '1'"
|
|
:labelCol="{ xs: { span: 24 }, sm: { span: 5 } }"
|
|
:labelCol="{ xs: { span: 24 }, sm: { span: 5 } }"
|
|
:wrapperCol="{ xs: { span: 24 }, sm: { span: 16 } }"
|
|
:wrapperCol="{ xs: { span: 24 }, sm: { span: 16 } }"
|
|
- class="require-class"
|
|
|
|
|
|
+ class="require-class fileUpload"
|
|
|
|
+ id="fileUpload"
|
|
>
|
|
>
|
|
<!-- <a-upload name="file" :file-list="fileList" :before-upload="beforeUpload" @change="handleChange">
|
|
<!-- <a-upload name="file" :file-list="fileList" :before-upload="beforeUpload" @change="handleChange">
|
|
<a-button><a-icon type="upload" />文件上传</a-button>
|
|
<a-button><a-icon type="upload" />文件上传</a-button>
|
|
</a-upload> -->
|
|
</a-upload> -->
|
|
|
|
+ <!-- :action="uploadAction" -->
|
|
<a-upload
|
|
<a-upload
|
|
name="file"
|
|
name="file"
|
|
:multiple="false"
|
|
:multiple="false"
|
|
- :action="uploadAction"
|
|
|
|
:headers="tokenHeader"
|
|
:headers="tokenHeader"
|
|
:file-list="fileList"
|
|
:file-list="fileList"
|
|
:showUploadList="false"
|
|
:showUploadList="false"
|
|
@@ -166,7 +167,7 @@
|
|
v-decorator="[
|
|
v-decorator="[
|
|
'appVersion',
|
|
'appVersion',
|
|
{
|
|
{
|
|
- rules: [{ required: true, message: '请填写应用标记' }, { validator: checkAppVersion }],
|
|
|
|
|
|
+ rules: [{ required: true, message: ' ' }, { validator: checkAppVersion }],
|
|
},
|
|
},
|
|
]"
|
|
]"
|
|
placeholder="请填写应用标记,必填且不可重复,如快手-5.6.1.66"
|
|
placeholder="请填写应用标记,必填且不可重复,如快手-5.6.1.66"
|
|
@@ -200,7 +201,7 @@
|
|
v-decorator="[
|
|
v-decorator="[
|
|
'useSdk',
|
|
'useSdk',
|
|
{
|
|
{
|
|
- rules: [{ required: true, message: '安卓应用已接入快手广告监测SDK必选' }],
|
|
|
|
|
|
+ rules: [{ message: '安卓应用已接入快手广告监测SDK必选' }],
|
|
},
|
|
},
|
|
]"
|
|
]"
|
|
>
|
|
>
|
|
@@ -230,7 +231,7 @@
|
|
:wrapperCol="{ xs: { span: 24 }, sm: { span: 16 } }"
|
|
:wrapperCol="{ xs: { span: 24 }, sm: { span: 16 } }"
|
|
v-if="uploadType == '2' && appType == 'android'"
|
|
v-if="uploadType == '2' && appType == 'android'"
|
|
>
|
|
>
|
|
- <a-input v-decorator="['trackUrl', { validator: handleConfirmValue }]" placeholder="请填写监测链接" />
|
|
|
|
|
|
+ <a-input v-decorator="['trackUrl']" placeholder="请填写监测链接" />
|
|
</a-form-item>
|
|
</a-form-item>
|
|
</a-form>
|
|
</a-form>
|
|
</a-card>
|
|
</a-card>
|
|
@@ -246,6 +247,7 @@ import uploadFile from './uploadFile.vue'
|
|
import { mapActions, mapGetters } from 'vuex'
|
|
import { mapActions, mapGetters } from 'vuex'
|
|
import BMF from 'browser-md5-file'
|
|
import BMF from 'browser-md5-file'
|
|
import selectTable from '@/views/modules/Statistics/components/selectPagination.vue'
|
|
import selectTable from '@/views/modules/Statistics/components/selectPagination.vue'
|
|
|
|
+import $ from 'jquery'
|
|
const fileSuffix = ['xlsx', 'xls', 'zip']
|
|
const fileSuffix = ['xlsx', 'xls', 'zip']
|
|
export default {
|
|
export default {
|
|
name: 'BaseForm',
|
|
name: 'BaseForm',
|
|
@@ -290,29 +292,32 @@ export default {
|
|
application: false,
|
|
application: false,
|
|
confirmLoading: false,
|
|
confirmLoading: false,
|
|
imageToken: '',
|
|
imageToken: '',
|
|
- uploadAction: '/kuaishouAppPackage/importAppExcel',
|
|
|
|
|
|
+ // uploadAction: '/kuaishouAppPackage/importAppExcel',
|
|
tokenHeader: { 'X-Access-Token': Vue.ls.get(ACCESS_TOKEN) },
|
|
tokenHeader: { 'X-Access-Token': Vue.ls.get(ACCESS_TOKEN) },
|
|
okCreated: false,
|
|
okCreated: false,
|
|
|
|
+ dataFile: null,
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
checkAppVersion(rule, value, callback) {
|
|
checkAppVersion(rule, value, callback) {
|
|
if (value != '') {
|
|
if (value != '') {
|
|
- let params = {}
|
|
|
|
- params.projectId = this.projectId
|
|
|
|
- params.appVersion = value
|
|
|
|
- getAction('/kuaishouAppPackage/checkAppVersion', params).then((res) => {
|
|
|
|
- if (res.success) {
|
|
|
|
- callback()
|
|
|
|
- } else {
|
|
|
|
- callback(res.message)
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+ if (this.projectId) {
|
|
|
|
+ let params = {}
|
|
|
|
+ params.projectId = this.projectId
|
|
|
|
+ params.appVersion = value
|
|
|
|
+ getAction('/kuaishouAppPackage/checkAppVersion', params).then((res) => {
|
|
|
|
+ if (res.success) {
|
|
|
|
+ callback()
|
|
|
|
+ } else {
|
|
|
|
+ callback(res.message)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ callback('应用标记必填')
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- overUpload(file) {
|
|
|
|
- console.log(file)
|
|
|
|
- },
|
|
|
|
|
|
+ overUpload(file) {},
|
|
downLoadFile() {
|
|
downLoadFile() {
|
|
downFile('/kuaishouAppPackage/exportAppTemplate').then((res) => {
|
|
downFile('/kuaishouAppPackage/exportAppTemplate').then((res) => {
|
|
let blob = new Blob([res], {
|
|
let blob = new Blob([res], {
|
|
@@ -329,64 +334,66 @@ export default {
|
|
})
|
|
})
|
|
},
|
|
},
|
|
handleChange(info) {
|
|
handleChange(info) {
|
|
- let fileList = [...info.fileList]
|
|
|
|
|
|
+ // let fileList = [...info.fileList]
|
|
|
|
|
|
- // 1. Limit the number of uploaded files
|
|
|
|
- // Only to show two recent uploaded files, and old ones will be replaced by the new
|
|
|
|
- fileList = fileList.slice(-2)
|
|
|
|
|
|
+ // // 1. Limit the number of uploaded files
|
|
|
|
+ // // Only to show two recent uploaded files, and old ones will be replaced by the new
|
|
|
|
+ // fileList = fileList.slice(-2)
|
|
|
|
|
|
- // 2. read from response and show file link
|
|
|
|
- fileList = fileList.map((file) => {
|
|
|
|
- if (file.response) {
|
|
|
|
- // Component will show file.url as link
|
|
|
|
- file.url = file.response.url
|
|
|
|
- }
|
|
|
|
- return file
|
|
|
|
- })
|
|
|
|
- if (fileList.length > 0) {
|
|
|
|
- this.fileList = [
|
|
|
|
- {
|
|
|
|
- ...fileList[fileList.length - 1],
|
|
|
|
- },
|
|
|
|
- ]
|
|
|
|
- } else {
|
|
|
|
- this.fileList = []
|
|
|
|
- }
|
|
|
|
- // this.loadDisabled = false
|
|
|
|
- // this.$message.success('文件导入成功,异步创建中,请稍后查看...')
|
|
|
|
- if (info.file.status !== 'uploading') {
|
|
|
|
- console.log(info.file, info.fileList)
|
|
|
|
- }
|
|
|
|
- if (info.file.status === 'done') {
|
|
|
|
- this.loadDisabled = false
|
|
|
|
- if (info.file.response.code == 200) {
|
|
|
|
- // this.application = true
|
|
|
|
- // this.$emit('getDataList')
|
|
|
|
- this.okCreated = true
|
|
|
|
- this.$message.success(info.file.response.message)
|
|
|
|
- } else {
|
|
|
|
- this.okCreated = false
|
|
|
|
- this.$message.error(info.file.response.message)
|
|
|
|
- }
|
|
|
|
- } else if (info.file.status === 'error') {
|
|
|
|
- this.$message.error(`${info.file.name}上传失败`)
|
|
|
|
- this.loadDisabled = false
|
|
|
|
- }
|
|
|
|
|
|
+ // // 2. read from response and show file link
|
|
|
|
+ // fileList = fileList.map((file) => {
|
|
|
|
+ // if (file.response) {
|
|
|
|
+ // // Component will show file.url as link
|
|
|
|
+ // file.url = file.response.url
|
|
|
|
+ // }
|
|
|
|
+ // return file
|
|
|
|
+ // })
|
|
|
|
+ // if (fileList.length > 0) {
|
|
|
|
+ // this.fileList = [
|
|
|
|
+ // {
|
|
|
|
+ // ...fileList[fileList.length - 1],
|
|
|
|
+ // },
|
|
|
|
+ // ]
|
|
|
|
+ // } else {
|
|
|
|
+ // this.fileList = []
|
|
|
|
+ // }
|
|
|
|
+ this.loadDisabled = false
|
|
|
|
+ this.$message.success('文件导入成功')
|
|
|
|
+ // if (info.file.status !== 'uploading') {
|
|
|
|
+ // console.log(info.file, info.fileList)
|
|
|
|
+ // }
|
|
|
|
+ // if (info.file.status === 'done') {
|
|
|
|
+ // this.loadDisabled = false
|
|
|
|
+ // if (info.file.response.code == 200) {
|
|
|
|
+ // // this.application = true
|
|
|
|
+ // // this.$emit('getDataList')
|
|
|
|
+ // this.okCreated = true
|
|
|
|
+ // this.$message.success(info.file.response.message)
|
|
|
|
+ // } else {
|
|
|
|
+ // this.okCreated = false
|
|
|
|
+ // this.$message.error(info.file.response.message)
|
|
|
|
+ // }
|
|
|
|
+ // } else if (info.file.status === 'error') {
|
|
|
|
+ // this.$message.error(`${info.file.name}上传失败`)
|
|
|
|
+ // this.loadDisabled = false
|
|
|
|
+ // }
|
|
|
|
|
|
// console.log(this.form)
|
|
// console.log(this.form)
|
|
},
|
|
},
|
|
beforeUpload(file) {
|
|
beforeUpload(file) {
|
|
// this.cosUpload(file)
|
|
// this.cosUpload(file)
|
|
- if (process.env.NODE_ENV == 'development') {
|
|
|
|
- this.uploadAction = `/jeecg-boot/kuaishouAppPackage/importAppExcel?projectId=${this.projectId}&platform=${
|
|
|
|
- this.appType == 'ios' ? +this.platform + 2 : +this.platform
|
|
|
|
- }&imageUrl=${this.fileUrl}`
|
|
|
|
- } else if (process.env.NODE_ENV == 'debug') {
|
|
|
|
- } else if (process.env.NODE_ENV == 'production') {
|
|
|
|
- this.uploadAction = `${this.axios.defaults.baseURL}/kuaishouAppPackage/importAppExcel?projectId=${
|
|
|
|
- this.projectId
|
|
|
|
- }&platform=${this.appType == 'ios' ? +this.platform + 2 : +this.platform}&imageUrl=${this.fileUrl}`
|
|
|
|
- }
|
|
|
|
|
|
+ // if (process.env.NODE_ENV == 'development') {
|
|
|
|
+ // this.uploadAction = `/jeecg-boot/kuaishouAppPackage/importAppExcel?projectId=${this.projectId}&platform=${
|
|
|
|
+ // this.appType == 'ios' ? +this.platform + 2 : +this.platform
|
|
|
|
+ // }&imageUrl=${this.fileUrl}`
|
|
|
|
+ // } else if (process.env.NODE_ENV == 'debug') {
|
|
|
|
+ // } else if (process.env.NODE_ENV == 'production') {
|
|
|
|
+ // this.uploadAction = `${this.axios.defaults.baseURL}/kuaishouAppPackage/importAppExcel?projectId=${
|
|
|
|
+ // this.projectId
|
|
|
|
+ // }&platform=${this.appType == 'ios' ? +this.platform + 2 : +this.platform}&imageUrl=${this.fileUrl}`
|
|
|
|
+ // }
|
|
|
|
+ // this.dataFile = file
|
|
|
|
+ this.dataFile = $('.fileUpload').eq(0).find('input')[0].files[0]
|
|
this.loadDisabled = true
|
|
this.loadDisabled = true
|
|
const size = (Number(file.size) / (1024 * 1024)).toFixed(2)
|
|
const size = (Number(file.size) / (1024 * 1024)).toFixed(2)
|
|
const fileName = file.name
|
|
const fileName = file.name
|
|
@@ -493,6 +500,9 @@ export default {
|
|
this.handleSubmit()
|
|
this.handleSubmit()
|
|
},
|
|
},
|
|
handleCancel() {
|
|
handleCancel() {
|
|
|
|
+ this.dataFile = null
|
|
|
|
+ this.appType = 'android'
|
|
|
|
+ this.okCreated = false
|
|
this.form.resetFields()
|
|
this.form.resetFields()
|
|
this.fileUrl = ''
|
|
this.fileUrl = ''
|
|
this.projectId = undefined
|
|
this.projectId = undefined
|
|
@@ -555,36 +565,61 @@ export default {
|
|
// console.log('文件地址:' + this.file)
|
|
// console.log('文件地址:' + this.file)
|
|
// console.log('图片地址:' + this.imageUrl)
|
|
// console.log('图片地址:' + this.imageUrl)
|
|
// e.preventDefault()
|
|
// e.preventDefault()
|
|
-
|
|
|
|
|
|
+
|
|
this.form.validateFields((err, values) => {
|
|
this.form.validateFields((err, values) => {
|
|
if (!err) {
|
|
if (!err) {
|
|
if (this.fileUrl && this.projectId) {
|
|
if (this.fileUrl && this.projectId) {
|
|
|
|
+ this.confirmLoading = true
|
|
let params = {}
|
|
let params = {}
|
|
params.projectId = this.projectId
|
|
params.projectId = this.projectId
|
|
if (this.uploadType == '1') {
|
|
if (this.uploadType == '1') {
|
|
|
|
+ // var file = document.getElementById('fileId').files[0] //获取文件流
|
|
this.url.insertTemplateUrl = '/kuaishouAppPackage/importAppExcel'
|
|
this.url.insertTemplateUrl = '/kuaishouAppPackage/importAppExcel'
|
|
params.platform = this.appType == 'ios' ? +this.platform + 2 : +this.platform
|
|
params.platform = this.appType == 'ios' ? +this.platform + 2 : +this.platform
|
|
params.imageUrl = this.fileUrl
|
|
params.imageUrl = this.fileUrl
|
|
- if (this.okCreated) {
|
|
|
|
- this.okCreated = false
|
|
|
|
- this.$message.success('创建成功')
|
|
|
|
- this.handleCancel()
|
|
|
|
- this.$emit('getDataList')
|
|
|
|
|
|
+ if (this.dataFile) {
|
|
|
|
+ let formData = new FormData()
|
|
|
|
+ formData.append('file', this.dataFile)
|
|
|
|
+ formData.append('projectId', this.projectId)
|
|
|
|
+ formData.append('platform', this.appType == 'ios' ? +this.platform + 2 : +this.platform)
|
|
|
|
+ formData.append('imageUrl', this.fileUrl)
|
|
|
|
+ // if (process.env.NODE_ENV == 'development') {
|
|
|
|
+ // this.uploadAction = `/jeecg-boot/kuaishouAppPackage/importAppExcel?projectId=${
|
|
|
|
+ // this.projectId
|
|
|
|
+ // }&platform=${this.appType == 'ios' ? +this.platform + 2 : +this.platform}&imageUrl=${this.fileUrl}`
|
|
|
|
+ // } else if (process.env.NODE_ENV == 'debug') {
|
|
|
|
+ // } else if (process.env.NODE_ENV == 'production') {
|
|
|
|
+ // this.uploadAction = `${this.axios.defaults.baseURL}/kuaishouAppPackage/importAppExcel?projectId=${
|
|
|
|
+ // this.projectId
|
|
|
|
+ // }&platform=${this.appType == 'ios' ? +this.platform + 2 : +this.platform}&imageUrl=${this.fileUrl}`
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ postAction('/kuaishouAppPackage/importAppExcel', formData).then((res) => {
|
|
|
|
+ this.confirmLoading = false
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
+ this.$message.success('创建成功')
|
|
|
|
+ this.handleCancel()
|
|
|
|
+ this.$emit('getDataList')
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.error(res.message)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
} else {
|
|
} else {
|
|
- this.$message.error('excel文件有误,请重新上传后点击')
|
|
|
|
|
|
+ this.$message.error('请上传文件')
|
|
}
|
|
}
|
|
|
|
|
|
return
|
|
return
|
|
} else {
|
|
} else {
|
|
this.url.insertTemplateUrl = '/kuaishouAppPackage/fillInLink'
|
|
this.url.insertTemplateUrl = '/kuaishouAppPackage/fillInLink'
|
|
params = { ...values }
|
|
params = { ...values }
|
|
- params.useSdk = params.useSdk?params.useSdk.length > 0 ? 1 : 0:null
|
|
|
|
|
|
+ params.useSdk = params.useSdk ? (params.useSdk.length > 0 ? 1 : 0) : null
|
|
params.projectId = this.projectId
|
|
params.projectId = this.projectId
|
|
params.appIconUrl = this.fileUrl
|
|
params.appIconUrl = this.fileUrl
|
|
params.platform = this.appType == 'ios' ? +this.platform + 2 : +this.platform
|
|
params.platform = this.appType == 'ios' ? +this.platform + 2 : +this.platform
|
|
}
|
|
}
|
|
|
|
|
|
postAction(this.url.insertTemplateUrl, params).then((res) => {
|
|
postAction(this.url.insertTemplateUrl, params).then((res) => {
|
|
|
|
+ this.confirmLoading = false
|
|
if (res.success) {
|
|
if (res.success) {
|
|
this.$message.success('创建成功')
|
|
this.$message.success('创建成功')
|
|
this.handleCancel()
|
|
this.handleCancel()
|
|
@@ -600,9 +635,7 @@ export default {
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
|
|
- onChange(value) {
|
|
|
|
- console.log(value)
|
|
|
|
- },
|
|
|
|
|
|
+ onChange(value) {},
|
|
},
|
|
},
|
|
created: function () {
|
|
created: function () {
|
|
let params = {}
|
|
let params = {}
|