|
@@ -1,3 +1,18 @@
|
|
|
+<style lang="less" scoped>
|
|
|
+.require-class {
|
|
|
+ /deep/ .ant-form-item-label {
|
|
|
+ label::before {
|
|
|
+ display: inline-block;
|
|
|
+ margin-right: 4px;
|
|
|
+ color: #f5222d;
|
|
|
+ font-size: 14px;
|
|
|
+ font-family: SimSun, sans-serif;
|
|
|
+ line-height: 1;
|
|
|
+ content: '*';
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|
|
|
<template>
|
|
|
<div>
|
|
|
<a-modal
|
|
@@ -45,34 +60,6 @@
|
|
|
</a-form-item>
|
|
|
|
|
|
<a-form-item
|
|
|
- label="上传文件"
|
|
|
- v-if="uploadType == '1'"
|
|
|
- :labelCol="{ xs: { span: 24 }, sm: { span: 5 } }"
|
|
|
- :wrapperCol="{ xs: { span: 24 }, sm: { span: 16 } }"
|
|
|
- >
|
|
|
- <!-- <a-upload name="file" :file-list="fileList" :before-upload="beforeUpload" @change="handleChange">
|
|
|
- <a-button><a-icon type="upload" />文件上传</a-button>
|
|
|
- </a-upload> -->
|
|
|
- <a-upload
|
|
|
- name="file"
|
|
|
- :multiple="false"
|
|
|
- :action="uploadAction"
|
|
|
- :headers="tokenHeader"
|
|
|
- :file-list="fileList"
|
|
|
- :showUploadList="false"
|
|
|
- :beforeUpload="beforeUpload"
|
|
|
- @change="handleChange"
|
|
|
- style="margin-right: 20px"
|
|
|
- >
|
|
|
- <a-button :disabled="(!projectId && !fileUrl) || loadDisabled">
|
|
|
- <a-icon type="upload" />
|
|
|
- {{ loadDisabled ? '上传中,请稍后' : '文件上传' }}
|
|
|
- </a-button>
|
|
|
- </a-upload>
|
|
|
- <a @click="downLoadFile">文件格式下载</a>
|
|
|
- </a-form-item>
|
|
|
-
|
|
|
- <a-form-item
|
|
|
v-if="uploadType == '2'"
|
|
|
label="下载链接"
|
|
|
:labelCol="{ xs: { span: 24 }, sm: { span: 5 } }"
|
|
@@ -128,6 +115,7 @@
|
|
|
:labelCol="{ xs: { span: 24 }, sm: { span: 5 } }"
|
|
|
:wrapperCol="{ xs: { span: 24 }, sm: { span: 19 } }"
|
|
|
v-if="application"
|
|
|
+ class="require-class"
|
|
|
>
|
|
|
<uploadFile
|
|
|
v-if="application"
|
|
@@ -138,8 +126,38 @@
|
|
|
@overUpload="overUpload"
|
|
|
:size="100"
|
|
|
></uploadFile>
|
|
|
+ <p class="upload-txt-rules">
|
|
|
+ 文件格式:支持上传png/jpg/jpeg图片,尺寸450*450,小于100kb
|
|
|
+ </p>
|
|
|
+ </a-form-item>
|
|
|
+ <a-form-item
|
|
|
+ label="上传文件"
|
|
|
+ v-if="uploadType == '1'"
|
|
|
+ :labelCol="{ xs: { span: 24 }, sm: { span: 5 } }"
|
|
|
+ :wrapperCol="{ xs: { span: 24 }, sm: { span: 16 } }"
|
|
|
+ class="require-class"
|
|
|
+ >
|
|
|
+ <!-- <a-upload name="file" :file-list="fileList" :before-upload="beforeUpload" @change="handleChange">
|
|
|
+ <a-button><a-icon type="upload" />文件上传</a-button>
|
|
|
+ </a-upload> -->
|
|
|
+ <a-upload
|
|
|
+ name="file"
|
|
|
+ :multiple="false"
|
|
|
+ :action="uploadAction"
|
|
|
+ :headers="tokenHeader"
|
|
|
+ :file-list="fileList"
|
|
|
+ :showUploadList="false"
|
|
|
+ :beforeUpload="beforeUpload"
|
|
|
+ @change="handleChange"
|
|
|
+ style="margin-right: 20px"
|
|
|
+ >
|
|
|
+ <a-button :disabled="fileUrl=='' && !projectId">
|
|
|
+ <a-icon type="upload" />
|
|
|
+ {{ loadDisabled ? '上传中,请稍后' : '文件上传' }}
|
|
|
+ </a-button>
|
|
|
+ </a-upload>
|
|
|
+ <a @click="downLoadFile">文件格式下载</a>
|
|
|
</a-form-item>
|
|
|
-
|
|
|
<a-form-item
|
|
|
label="应用标记"
|
|
|
:labelCol="{ xs: { span: 24 }, sm: { span: 5 } }"
|
|
@@ -187,7 +205,7 @@
|
|
|
:wrapperCol="{ xs: { span: 24 }, sm: { span: 16 } }"
|
|
|
v-if="uploadType == '2'"
|
|
|
>
|
|
|
- <a-input
|
|
|
+ <a-input
|
|
|
v-decorator="[
|
|
|
'appPrivacyUrl',
|
|
|
{
|
|
@@ -197,7 +215,7 @@
|
|
|
placeholder="请填写监测链接"
|
|
|
/>
|
|
|
</a-form-item>
|
|
|
-
|
|
|
+
|
|
|
<a-form-item
|
|
|
label="监测链接"
|
|
|
:labelCol="{ xs: { span: 24 }, sm: { span: 5 } }"
|
|
@@ -309,7 +327,6 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
handleChange(info) {
|
|
|
- console.log(info)
|
|
|
let fileList = [...info.fileList]
|
|
|
|
|
|
// 1. Limit the number of uploaded files
|
|
@@ -341,8 +358,8 @@ export default {
|
|
|
if (info.file.status === 'done') {
|
|
|
this.loadDisabled = false
|
|
|
if (info.file.response.code == 200) {
|
|
|
- this.application = true
|
|
|
- this.$emit('getDataList')
|
|
|
+ // this.application = true
|
|
|
+ // this.$emit('getDataList')
|
|
|
this.$message.success(info.file.response.message)
|
|
|
} else {
|
|
|
this.$message.error(info.file.response.message)
|
|
@@ -538,64 +555,38 @@ export default {
|
|
|
// console.log('图片地址:' + this.imageUrl)
|
|
|
// e.preventDefault()
|
|
|
this.form.validateFields((err, values) => {
|
|
|
- console.log('Received values of form: ', values)
|
|
|
if (!err) {
|
|
|
- let params = {}
|
|
|
- params.projectId = this.projectId
|
|
|
- if (this.uploadType == '1') {
|
|
|
- this.url.insertTemplateUrl = '/kuaishouAppPackage/importAppExcel'
|
|
|
- params.platform = this.appType == 'ios' ? +this.platform + 2 : +this.platform
|
|
|
- params.imageUrl = this.fileUrl
|
|
|
- } else {
|
|
|
- this.url.insertTemplateUrl = '/kuaishouAppPackage/fillInLink'
|
|
|
- params = { ...values }
|
|
|
+ if (this.fileUrl && this.projectId) {
|
|
|
+ let params = {}
|
|
|
params.projectId = this.projectId
|
|
|
- params.appIconUrl = this.fileUrl
|
|
|
- params.platform = this.appType == 'ios' ? +this.platform + 2 : +this.platform
|
|
|
- }
|
|
|
- // if (this.appType == 'android') {
|
|
|
- // if (this.imageUrl != '') {
|
|
|
- // params.imageUrl = this.imageUrl
|
|
|
- // }
|
|
|
- // if (this.platform == '2') {
|
|
|
- // params.url = values.downloadUrl
|
|
|
- // } else {
|
|
|
- // if (this.uploadType == '1') {
|
|
|
- // if (this.file != '') {
|
|
|
- // params.file = this.file
|
|
|
- // }
|
|
|
- // } else if (this.uploadType == '2') {
|
|
|
- // params.url = values.downloadUrl
|
|
|
- // }
|
|
|
- // }
|
|
|
- // params.platform = this.platform
|
|
|
- // params.uploadType = values.uploadType
|
|
|
- // params.appType = 'android'
|
|
|
- // params.packageName = values.packageName
|
|
|
- // params.appName = values.appName
|
|
|
- // params.appVersion = values.appVersion
|
|
|
- // params.loginId = this.userInfo().id
|
|
|
- // } else {
|
|
|
- // params.appType = 'ios'
|
|
|
- // params.platform = this.platform
|
|
|
- // params.uploadType = '2'
|
|
|
- // params.url = values.downloadUrl
|
|
|
- // params.appName = values.appName
|
|
|
- // params.appVersion = values.appVersion
|
|
|
- // params.loginId = this.userInfo().id
|
|
|
- // }
|
|
|
-
|
|
|
- console.log(params)
|
|
|
- postAction(this.url.insertTemplateUrl, params).then((res) => {
|
|
|
- if (res.success) {
|
|
|
-
|
|
|
+ if (this.uploadType == '1') {
|
|
|
+ this.url.insertTemplateUrl = '/kuaishouAppPackage/importAppExcel'
|
|
|
+ params.platform = this.appType == 'ios' ? +this.platform + 2 : +this.platform
|
|
|
+ params.imageUrl = this.fileUrl
|
|
|
this.$message.success('创建成功')
|
|
|
this.handleCancel()
|
|
|
this.$emit('getDataList')
|
|
|
+ return
|
|
|
} else {
|
|
|
- this.$message.error(res.message)
|
|
|
+ this.url.insertTemplateUrl = '/kuaishouAppPackage/fillInLink'
|
|
|
+ params = { ...values }
|
|
|
+ params.projectId = this.projectId
|
|
|
+ params.appIconUrl = this.fileUrl
|
|
|
+ params.platform = this.appType == 'ios' ? +this.platform + 2 : +this.platform
|
|
|
}
|
|
|
- })
|
|
|
+
|
|
|
+ postAction(this.url.insertTemplateUrl, params).then((res) => {
|
|
|
+ if (res.success) {
|
|
|
+ this.$message.success('创建成功')
|
|
|
+ this.handleCancel()
|
|
|
+ this.$emit('getDataList')
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.message)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$message.error('请填写必填项')
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
},
|