|
@@ -0,0 +1,69 @@
|
|
|
+<template>
|
|
|
+ <el-dialog
|
|
|
+ :title="title"
|
|
|
+ :visible.sync="modal"
|
|
|
+ width="500px"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ @close="
|
|
|
+ res => {
|
|
|
+ $emit('cancel');
|
|
|
+ }
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
|
|
+ <el-form-item label="图片" prop="imgUrl">
|
|
|
+ <upload v-model="form.imgUrl" params="prefix=/banner" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="modal = false">取消</el-button>
|
|
|
+ <el-button type="primary" @click="handleConfirm">确定</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { saveItem } from '@/api/photoWarehouse';
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: 'PhotoUploadItemModal',
|
|
|
+
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ title: '上传图片'
|
|
|
+ modal: true,
|
|
|
+
|
|
|
+ form: {
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ typeOptions: []
|
|
|
+ };
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ mounted() {},
|
|
|
+
|
|
|
+ methods: {
|
|
|
+ handleConfirm() {
|
|
|
+ this.$refs.form.validate(async valid => {
|
|
|
+ if (valid) {
|
|
|
+ let params = Object.assign({}, this.form);
|
|
|
+ params.imgUrl = this.form.imgUrl[0].url;
|
|
|
+ if (this.id) params.id = this.id;
|
|
|
+ const { success, msg } = await saveItem(params);
|
|
|
+ if (success) {
|
|
|
+ this.$success('保存成功!');
|
|
|
+ this.modal = false;
|
|
|
+ this.$g_emit('banner_reload');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped></style>
|