|
@@ -15,35 +15,40 @@
|
|
<el-form-item label="图片:">
|
|
<el-form-item label="图片:">
|
|
<el-upload :http-request="httpRequest" multiple :show-file-list="true" list-type="picture-card">
|
|
<el-upload :http-request="httpRequest" multiple :show-file-list="true" list-type="picture-card">
|
|
<el-icon>
|
|
<el-icon>
|
|
- <Plus/>
|
|
|
|
|
|
+ <Plus />
|
|
</el-icon>
|
|
</el-icon>
|
|
</el-upload>
|
|
</el-upload>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="类型:">
|
|
<el-form-item label="类型:">
|
|
<el-select v-model="productDetail.type" @change="handleTypeChange" placeholder="请选择添加类型">
|
|
<el-select v-model="productDetail.type" @change="handleTypeChange" placeholder="请选择添加类型">
|
|
- <el-option label="服务" value="serve"/>
|
|
|
|
- <el-option label="产品" value="product"/>
|
|
|
|
|
|
+ <el-option label="服务" value="serve" />
|
|
|
|
+ <el-option label="产品" value="product" />
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="产品类型:">
|
|
<el-form-item label="产品类型:">
|
|
<el-select v-model="productDetail.ptype" :disabled="productDetail.type === 'serve'"
|
|
<el-select v-model="productDetail.ptype" :disabled="productDetail.type === 'serve'"
|
|
- placeholder="请选择软件或者硬件"
|
|
|
|
- style="width: 20vw">
|
|
|
|
- <el-option label="硬件" value="hardware"/>
|
|
|
|
- <el-option label="软件" value="software"/>
|
|
|
|
|
|
+ placeholder="请选择软件或者硬件" style="width: 20vw">
|
|
|
|
+ <el-option label="硬件" value="hardware" />
|
|
|
|
+ <el-option label="软件" value="software" />
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="是否首页展示:">
|
|
<el-form-item label="是否首页展示:">
|
|
<el-select v-model="productDetail.isIndex" placeholder="请选择是否首页显示" style="width: 20vw">
|
|
<el-select v-model="productDetail.isIndex" placeholder="请选择是否首页显示" style="width: 20vw">
|
|
- <el-option label="是" value="true"/>
|
|
|
|
- <el-option label="否" value="false"/>
|
|
|
|
|
|
+ <el-option label="是" value="true" />
|
|
|
|
+ <el-option label="否" value="false" />
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="简介:">
|
|
<el-form-item label="简介:">
|
|
<el-input v-model="productDetail.synopsis"></el-input>
|
|
<el-input v-model="productDetail.synopsis"></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="详情:">
|
|
<el-form-item label="详情:">
|
|
- <EditorWithBinding v-model="productDetail.detail"></EditorWithBinding>
|
|
|
|
|
|
+ <el-upload :http-request="detailhttpRequests" multiple :show-file-list="true"
|
|
|
|
+ list-type="picture-card">
|
|
|
|
+ <el-icon>
|
|
|
|
+ <Plus />
|
|
|
|
+ </el-icon>
|
|
|
|
+ </el-upload>
|
|
|
|
+ <!-- <EditorWithBinding v-model="productDetail.detail"></EditorWithBinding> -->
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="产品介绍:">
|
|
<el-form-item label="产品介绍:">
|
|
<EditorWithBinding v-model="productDetail.product_introduction"></EditorWithBinding>
|
|
<EditorWithBinding v-model="productDetail.product_introduction"></EditorWithBinding>
|
|
@@ -55,14 +60,9 @@
|
|
<EditorWithBinding v-model="productDetail.instructions"></EditorWithBinding>
|
|
<EditorWithBinding v-model="productDetail.instructions"></EditorWithBinding>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="支持软件:">
|
|
<el-form-item label="支持软件:">
|
|
- <el-upload
|
|
|
|
- :http-request="httpRequests"
|
|
|
|
- class="upload-demo"
|
|
|
|
- drag
|
|
|
|
- multiple
|
|
|
|
- >
|
|
|
|
|
|
+ <el-upload :http-request="httpRequests" class="upload-demo" drag multiple>
|
|
<el-icon class="el-icon--upload">
|
|
<el-icon class="el-icon--upload">
|
|
- <upload-filled/>
|
|
|
|
|
|
+ <upload-filled />
|
|
</el-icon>
|
|
</el-icon>
|
|
<div class="el-upload__text" style="width: 300px">
|
|
<div class="el-upload__text" style="width: 300px">
|
|
选择上传文件
|
|
选择上传文件
|
|
@@ -78,12 +78,12 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
-import {onBeforeMount, reactive, ref} from 'vue';
|
|
|
|
-import {useRoute, useRouter} from 'vue-router'
|
|
|
|
|
|
+import { onBeforeMount, reactive, ref } from 'vue';
|
|
|
|
+import { useRoute, useRouter } from 'vue-router'
|
|
import product from "../../api/product.js";
|
|
import product from "../../api/product.js";
|
|
-import {ElMessage} from "element-plus";
|
|
|
|
|
|
+import { ElMessage } from "element-plus";
|
|
import EditorWithBinding from "../EditorWithBinding.vue";
|
|
import EditorWithBinding from "../EditorWithBinding.vue";
|
|
-import {Plus} from "@element-plus/icons-vue";
|
|
|
|
|
|
+import { Plus } from "@element-plus/icons-vue";
|
|
import resource from "../../api/resource.js";
|
|
import resource from "../../api/resource.js";
|
|
|
|
|
|
const route = useRoute();
|
|
const route = useRoute();
|
|
@@ -119,10 +119,18 @@ const fileLists = ref([])
|
|
|
|
|
|
//自定义函数用来覆盖原有的XHR行为(默认提交行为)
|
|
//自定义函数用来覆盖原有的XHR行为(默认提交行为)
|
|
function httpRequests(option) {
|
|
function httpRequests(option) {
|
|
-//将图片存到数组中
|
|
|
|
|
|
+ //将图片存到数组中
|
|
fileLists.value.push(option)
|
|
fileLists.value.push(option)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+const detailfileLists = ref([])
|
|
|
|
+
|
|
|
|
+//自定义函数用来覆盖原有的XHR行为(默认提交行为)
|
|
|
|
+function detailhttpRequests(option) {
|
|
|
|
+ //将图片存到数组中
|
|
|
|
+ detailfileLists.value.push(option)
|
|
|
|
+}
|
|
|
|
+
|
|
const addProduct = async () => {
|
|
const addProduct = async () => {
|
|
let dataForm = new FormData();
|
|
let dataForm = new FormData();
|
|
dataForm.append('types', "serve")
|
|
dataForm.append('types', "serve")
|
|
@@ -136,6 +144,16 @@ const addProduct = async () => {
|
|
fileLists.value.forEach((it, index) => {
|
|
fileLists.value.forEach((it, index) => {
|
|
dataForms.append('file', it.file)
|
|
dataForms.append('file', it.file)
|
|
})
|
|
})
|
|
|
|
+ //详情图开始
|
|
|
|
+ let detaildataForms = new FormData();
|
|
|
|
+ detaildataForms.append('types', "file")
|
|
|
|
+ //将图片的二进制通过表单的形式发送到后台
|
|
|
|
+ detailfileLists.value.forEach((it, index) => {
|
|
|
|
+ detaildataForms.append('file', it.file)
|
|
|
|
+ })
|
|
|
|
+ const detailfileRes = await product.uploadFile(detaildataForms)
|
|
|
|
+ productDetail.detail = detailfileRes.data.Data
|
|
|
|
+ //详情图结束
|
|
const fileRes = await product.uploadFile(dataForms)
|
|
const fileRes = await product.uploadFile(dataForms)
|
|
productDetail.supporting_software = fileRes.data.Data
|
|
productDetail.supporting_software = fileRes.data.Data
|
|
const resoursRes = await resource.uploadResource(dataForm)
|
|
const resoursRes = await resource.uploadResource(dataForm)
|
|
@@ -176,7 +194,7 @@ const addProduct = async () => {
|
|
}
|
|
}
|
|
onBeforeMount(async () => {
|
|
onBeforeMount(async () => {
|
|
if (route.query.id) {
|
|
if (route.query.id) {
|
|
- const res = await product.getProductDetail({id: route.query.id})
|
|
|
|
|
|
+ const res = await product.getProductDetail({ id: route.query.id })
|
|
console.log(res.data)
|
|
console.log(res.data)
|
|
Object.assign(productDetail, res.data.Data);
|
|
Object.assign(productDetail, res.data.Data);
|
|
}
|
|
}
|