|
|
@@ -114,10 +114,9 @@
|
|
|
class="upload-demo"
|
|
|
action=""
|
|
|
:on-remove="handleRemove"
|
|
|
- :before-remove="beforeRemove"
|
|
|
:limit="1"
|
|
|
:on-exceed="handleExceed"
|
|
|
- :before-upload="beforeFileUpload"
|
|
|
+ :before-upload="beforeApkUpload"
|
|
|
:http-request="uploadApkFile"
|
|
|
:file-list="project.file"
|
|
|
>
|
|
|
@@ -151,7 +150,6 @@
|
|
|
|
|
|
<script>
|
|
|
import Enum from '@/constants/enum/index'
|
|
|
-import PlatformType from '@/constants/enum/platform-type'
|
|
|
import Http from '@/js/http.js'
|
|
|
import Apis from '@/js/api.js'
|
|
|
import provincecity from '@/components/commons/ProvinceCity'
|
|
|
@@ -189,8 +187,10 @@ export default {
|
|
|
type: [],
|
|
|
platform: [],
|
|
|
desc: '',
|
|
|
- doc: '123',
|
|
|
- file: '123',
|
|
|
+ doc: [],
|
|
|
+ file: [],
|
|
|
+ requireDocUrl: '',
|
|
|
+ fileUrl: '',
|
|
|
resource: '0',
|
|
|
location: {provinceCode: '3200', cityCode: '3201'},
|
|
|
institution: '',
|
|
|
@@ -307,13 +307,13 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
init () {
|
|
|
- this.project.platform.map(item => {
|
|
|
- this.platformType.push(PlatformType[item])
|
|
|
- })
|
|
|
+ // this.project.platform.map(item => {
|
|
|
+ // this.platformType.push(PlatformType[item])
|
|
|
+ // })
|
|
|
},
|
|
|
submitForm (formName) {
|
|
|
Http.post(Apis.PROJECT.CREATE_PROJECT, this.project).then((res) => {
|
|
|
- console.log(res.status)
|
|
|
+ //console.log(res.status)
|
|
|
if (window.history.length <= 1) {
|
|
|
this.$router.push({path: '/'})
|
|
|
return false
|
|
|
@@ -351,14 +351,28 @@ export default {
|
|
|
this.project.usage = ''
|
|
|
this.project.budget = ''
|
|
|
},
|
|
|
+ beforeApkUpload (file) {
|
|
|
+ const isAPK = file.type === 'application/vnd.android.package-archive'
|
|
|
+ const isDMG = file.type === 'application/octet-stream'
|
|
|
+
|
|
|
+ if (!isAPK && !isDMG) {
|
|
|
+ this.$message.error('上传安装包只能是 APK 或 DMG 格式!')
|
|
|
+ }
|
|
|
+ return isAPK || isDMG
|
|
|
+ },
|
|
|
beforeFileUpload (file) {
|
|
|
- // const isAPK = file.type === 'application/vnd.android.package-archive'
|
|
|
- // const isDMG = file.type === 'application/octet-stream'
|
|
|
- //
|
|
|
- // if (!isAPK && !isDMG) {
|
|
|
- // this.$message.error('上传安装包只能是 APK 或 DMG 格式!')
|
|
|
- // }
|
|
|
- // return isAPK && isDMG
|
|
|
+ console.log(file)
|
|
|
+ const isPDF = file.type === 'application/pdf'
|
|
|
+ const isDOC = file.type === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
|
|
|
+ const isEXCEL = file.type === 'application/vnd.ms-excel'
|
|
|
+ const isXLS = file.type === 'application/x-xls'
|
|
|
+ const isTXT = file.type === 'text/plain'
|
|
|
+ const isXLSX = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
|
|
+ //console.log(file)
|
|
|
+ if (!(isDOC || isEXCEL || isPDF || isTXT || isXLS || isXLSX)) {
|
|
|
+ this.$message.error('上传文件只能是 PDF 、 DOC 、DOCX 、XLS、TXT、XLSX 格式!')
|
|
|
+ }
|
|
|
+ return isDOC || isEXCEL || isPDF || isTXT || isXLS || isXLSX
|
|
|
},
|
|
|
loadData () {
|
|
|
Http.get(Apis.PAGE.PROJECT_DETAIL_PAGE).then((res) => {
|
|
|
@@ -366,7 +380,7 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
handleRemove (file, fileList) {
|
|
|
- console.log(file, fileList)
|
|
|
+ //console.log(file, fileList)
|
|
|
},
|
|
|
handleExceed (files, fileList) {
|
|
|
this.$message.warning(
|
|
|
@@ -376,7 +390,7 @@ export default {
|
|
|
)
|
|
|
},
|
|
|
beforeRemove (file, fileList) {
|
|
|
- return this.$confirm(`确定移除 ${file.name}?`)
|
|
|
+ //return this.$confirm(`确定移除 ${file.name}?`)
|
|
|
},
|
|
|
uploadRequireDoc (param) {
|
|
|
const formData = new FormData()
|
|
|
@@ -386,10 +400,12 @@ export default {
|
|
|
}
|
|
|
formData.append('file', param.file)
|
|
|
Http.upload(Apis.FILE.REQUIREMENT_FILE.replace('{userId}', 3), formData, config).then((res) => {
|
|
|
- console.log('上传成功')
|
|
|
+ //console.log('上传成功')
|
|
|
this.project.requireDocUrl = res.data
|
|
|
- console.log(res.data)
|
|
|
+ console.log(this.project.doc)
|
|
|
+ //console.log(res.data)
|
|
|
})
|
|
|
+
|
|
|
},
|
|
|
uploadApkFile (param) {
|
|
|
const formData = new FormData()
|