lalala 6 лет назад
Родитель
Сommit
bbc7e37582

+ 18 - 4
admin-update/src/cool/components/upload/index.vue

@@ -6,7 +6,7 @@
 				(res, file) => {
 				(res, file) => {
 					onSuccess(res, file, item);
 					onSuccess(res, file, item);
 				}
 				}
-			" -->
+		"-->
 		<el-upload
 		<el-upload
 			v-for="(item, index) in list"
 			v-for="(item, index) in list"
 			:key="index"
 			:key="index"
@@ -29,7 +29,7 @@
 		>
 		>
 			<slot name="content">
 			<slot name="content">
 				<div class="upload-wrap" v-loading="item.loading">
 				<div class="upload-wrap" v-loading="item.loading">
-					<img :src="item.url" alt="" v-if="item.url" />
+					<img :src="item.url" alt v-if="item.url" />
 					<i class="el-icon-plus avatar-uploader-icon" v-else></i>
 					<i class="el-icon-plus avatar-uploader-icon" v-else></i>
 
 
 					<i class="el-icon-close" v-if="item.url" @click.stop="removeFile(index)"></i>
 					<i class="el-icon-close" v-if="item.url" @click.stop="removeFile(index)"></i>
@@ -41,6 +41,7 @@
 
 
 <script>
 <script>
 import { mapGetters } from 'vuex';
 import { mapGetters } from 'vuex';
+import { baseUrl } from '@/config/env';
 
 
 export default {
 export default {
 	props: {
 	props: {
@@ -50,7 +51,10 @@ export default {
 				return {};
 				return {};
 			}
 			}
 		},
 		},
-		value: [Array, String]
+		value: [Array, String],
+		hostUrl: {
+			default: ''
+		}
 	},
 	},
 
 
 	data() {
 	data() {
@@ -191,7 +195,17 @@ export default {
 		getFile(file, fileList) {
 		getFile(file, fileList) {
 			this.getBase64(file.raw).then(res => {
 			this.getBase64(file.raw).then(res => {
 				// this.list = res;
 				// this.list = res;
-				this.$service.common.uploadImg({ content: res }).then(subRes => {
+				let host = null;
+				if (this.hostUrl) {
+					host = () => {
+						return this.$service.common[this.hostUrl]({ content: res });
+					};
+				} else {
+					host = () => {
+						return this.$service.common.uploadImg({ content: res });
+					};
+				}
+				host().then(subRes => {
 					console.log('subRes', subRes);
 					console.log('subRes', subRes);
 					this.onSuccess(subRes);
 					this.onSuccess(subRes);
 				});
 				});

+ 14 - 0
admin-update/src/service/common/index.js

@@ -15,6 +15,20 @@ export class CommonService extends BaseService {
 		};
 		};
 	}
 	}
 
 
+	/**
+	 * 图库文件上传
+	 *
+	 * @returns
+	 * @memberof CommonService
+	 */
+	picAdd(data) {
+		return this.request({
+			url: '/pic/add',
+			method: 'POST',
+			data: data
+		});
+	}
+
 	/**
 	/**
 	 * 文件上传
 	 * 文件上传
 	 *
 	 *

+ 8 - 3
admin-update/src/views/goods/img-store.vue

@@ -33,7 +33,11 @@
 					>查看分类</el-button
 					>查看分类</el-button
 				>
 				>
 				<!-- upload-img -->
 				<!-- upload-img -->
-				<cl-upload v-model="addForm.picIdList" :props="{ 'on-success': addImgFn }">
+				<cl-upload
+					v-model="addForm.picIdList"
+					hostUrl="picAdd"
+					:props="{ 'on-success': addImgFn }"
+				>
 					<template slot="content">
 					<template slot="content">
 						<el-button type="primary" size="mini">新增</el-button>
 						<el-button type="primary" size="mini">新增</el-button>
 					</template>
 					</template>
@@ -166,7 +170,7 @@ export default {
 				picIdList: '',
 				picIdList: '',
 				price: 0,
 				price: 0,
 				name: '',
 				name: '',
-                shopImg: [],
+				// shopImg: [],
 				categoryIdList: []
 				categoryIdList: []
 			},
 			},
 			rules: {}
 			rules: {}
@@ -206,7 +210,8 @@ export default {
 		},
 		},
 		// 新增图片
 		// 新增图片
 		addImgFn(res) {
 		addImgFn(res) {
-			this.addForm.shopImg.push(res.shortUrl)
+			this.addForm.picIdList = res.id + '';
+			// this.addForm.shopImg.push(res.shortUrl);
 			this.addImageModal = true;
 			this.addImageModal = true;
 		},
 		},
 		selChangeDialogFn(status, item) {
 		selChangeDialogFn(status, item) {

+ 2 - 1
admin-update/src/views/goods/summary.vue

@@ -43,7 +43,8 @@ export default {
 		},
 		},
 		_updateFn() {
 		_updateFn() {
 			this.$service.single.editGoodsIntro({ introduce: this.form.desc }).then(res => {
 			this.$service.single.editGoodsIntro({ introduce: this.form.desc }).then(res => {
-				this.form.desc = res.introduce;
+				// this.form.desc = res.introduce;
+				this.$message.success('保存成功!');
 			});
 			});
 		},
 		},
 		editor() {},
 		editor() {},

+ 2 - 1
admin-update/vue.config.js

@@ -14,10 +14,11 @@ function resolve(dir) {
 
 
 // const hostUrl = `${window.location.protocol}//static.${getFirstHost()}.com`;
 // const hostUrl = `${window.location.protocol}//static.${getFirstHost()}.com`;
 const hostUrl = `https://static.huaml.com`;
 const hostUrl = `https://static.huaml.com`;
+// const hostUrl = `.`;
 
 
 const cdn = {
 const cdn = {
 	dev: {
 	dev: {
-		css: [`${hostUrl}/cdn/element-ui/2.13.0/theme-chalk/index.css`]
+		css: [`https://cdn.bootcss.com/element-ui/2.13.0/theme-chalk/index.css`]
 	},
 	},
 	pro: {
 	pro: {
 		css: [
 		css: [