|
@@ -2,41 +2,60 @@
|
|
|
<div>
|
|
|
<div class="addfrom">
|
|
|
<div class="addcenter">
|
|
|
- <el-form ref="pubform" label-width="100px" :style="{ border: '1px soild #ccc' }" :model="pubform" :rules="rules">
|
|
|
+ <el-form
|
|
|
+ ref="pubform"
|
|
|
+ label-width="100px"
|
|
|
+ :style="{ border: '1px soild #ccc' }"
|
|
|
+ :model="pubform"
|
|
|
+ :rules="rules"
|
|
|
+ >
|
|
|
<el-form-item label="发行方名称" prop="collectionTitle">
|
|
|
<el-input v-model="pubform.collectionTitle"></el-input>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item label="联系人" prop="issuerName">
|
|
|
- <el-input v-model="pubform.issuerName"></el-input>
|
|
|
+ <el-form-item label="联系人" prop="aname">
|
|
|
+ <el-input></el-input>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item label="联系电话" prop="issuerPhone">
|
|
|
- <el-input v-model="pubform.issuerPhone"></el-input>
|
|
|
+ <el-form-item label="联系电话" prop="tel">
|
|
|
+ <el-input></el-input>
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="电子邮箱" prop="email">
|
|
|
- <el-input v-model="pubform.email"></el-input>
|
|
|
+ <el-input></el-input>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item label="详细地址" prop="issuerAddress">
|
|
|
- <el-input v-model="pubform.issuerAddress"></el-input>
|
|
|
+ <el-form-item label="详细地址" prop="address">
|
|
|
+ <el-input></el-input>
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="上传头像" prop="headPortrait">
|
|
|
- <el-upload class="avatar-uploader" action="http://39.105.160.25:10996" :show-file-list="false"
|
|
|
- :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload">
|
|
|
- <img v-if="this.pubform.headPortrait" :src="this.pubform.headPortrait" class="avatar">
|
|
|
+ <el-upload
|
|
|
+ class="avatar-uploader"
|
|
|
+ action="http://39.105.160.25:10996"
|
|
|
+ :show-file-list="false"
|
|
|
+ :on-success="handleAvatarSuccess"
|
|
|
+ :before-upload="beforeAvatarUpload"
|
|
|
+ >
|
|
|
+ <img
|
|
|
+ v-if="this.pubform.headPortrait"
|
|
|
+ :src="this.pubform.headPortrait"
|
|
|
+ class="avatar"
|
|
|
+ />
|
|
|
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
|
|
</el-upload>
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="备注" prop="remark">
|
|
|
- <el-input type="textarea" :rows="4" v-model="pubform.remark"></el-input>
|
|
|
+ <el-input
|
|
|
+ type="textarea"
|
|
|
+ :rows="4"
|
|
|
+ v-model="pubform.remark"
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-button type="primary" @click="submitpub">提交</el-button>
|
|
|
- <el-button>重置</el-button>
|
|
|
+ <el-button @click="empty">重置</el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</div>
|
|
@@ -45,12 +64,19 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { addpublish, upload } from "../../api/publisher/publish";
|
|
|
+import {
|
|
|
+ addpublish,
|
|
|
+ upload,
|
|
|
+ searchPublish,
|
|
|
+ updatapub,
|
|
|
+} from "../../api/publisher/publish";
|
|
|
export default {
|
|
|
name: "addPublisher",
|
|
|
+ // props: ["issuerID"],
|
|
|
data() {
|
|
|
return {
|
|
|
- imageUrl: '',
|
|
|
+ imageUrl: "",
|
|
|
+ fileList: [], //上传的文件列表
|
|
|
pubform: {
|
|
|
collectionTitle: "",
|
|
|
issuerName: "",
|
|
@@ -59,7 +85,9 @@ export default {
|
|
|
issuerAddress: "",
|
|
|
headPortrait: "",
|
|
|
remark: "",
|
|
|
+ issuerId: "",
|
|
|
},
|
|
|
+
|
|
|
rules: {
|
|
|
pname: [
|
|
|
{ required: true, message: "请输入发行方名称", trigger: "blur" },
|
|
@@ -67,45 +95,106 @@ export default {
|
|
|
},
|
|
|
};
|
|
|
},
|
|
|
- watch: {},
|
|
|
+
|
|
|
+ created() {
|
|
|
+
|
|
|
+ this.init()
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ $route(to, from) {
|
|
|
+ //这里可以加你监听到路由改变时要触发的方法
|
|
|
+
|
|
|
+ this.init();
|
|
|
+ },
|
|
|
+ },
|
|
|
+
|
|
|
methods: {
|
|
|
+ init() {
|
|
|
+ let pubformdetail = this.$route.params.rows;
|
|
|
+ console.log(pubformdetail);
|
|
|
+ if (pubformdetail == undefined) {
|
|
|
+ this.pubform.collectionTitle = "";
|
|
|
+ this.pubform.issuerName = "";
|
|
|
+ this.pubform.email = "";
|
|
|
+ this.pubform.issuerPhone = "";
|
|
|
+ this.pubform.issuerAddress = "";
|
|
|
+ this.pubform.headPortrait = "";
|
|
|
+ this.pubform.remark = "";
|
|
|
+ this.pubform.issuerId = ''
|
|
|
+ } else {
|
|
|
+ this.pubform.issuerId = pubformdetail.issuerId;
|
|
|
+ this.searchPublisher(this.pubform.issuerId);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async searchPublisher(id) {
|
|
|
+ let { code, data } = await searchPublish(id).catch((err) => err);
|
|
|
+ console.log(code, data);
|
|
|
+ if (code === 200) {
|
|
|
+ this.pubform.collectionTitle = data.collectionTitle;
|
|
|
+ this.pubform.issuerName = data.issuerName;
|
|
|
+ this.pubform.email = data.email;
|
|
|
+ this.pubform.issuerPhone = data.issuerPhone;
|
|
|
+ this.pubform.issuerAddress = data.issuerAddress;
|
|
|
+ this.pubform.headPortrait = data.headPortrait;
|
|
|
+ this.pubform.remark = data.remark;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ empty() {
|
|
|
+ this.pubform.collectionTitle = "";
|
|
|
+ this.pubform.issuerName = "";
|
|
|
+ this.pubform.email = "";
|
|
|
+ this.pubform.issuerPhone = "";
|
|
|
+ this.pubform.issuerAddress = "";
|
|
|
+ this.pubform.headPortrait = "";
|
|
|
+ this.pubform.remark = "";
|
|
|
+ },
|
|
|
handleAvatarSuccess() {
|
|
|
console.log("上传成功");
|
|
|
},
|
|
|
beforeAvatarUpload(file) {
|
|
|
let formData = new FormData();
|
|
|
- formData.append('file', file);
|
|
|
- upload(formData).then(res => {
|
|
|
+ formData.append("file", file);
|
|
|
+ upload(formData).then((res) => {
|
|
|
+ console.log(res);
|
|
|
this.pubform.headPortrait = res.url;
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
submitpub() {
|
|
|
- this.$refs.pubform.validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- addpublish(this.pubform).then(() => {
|
|
|
- this.pubform.collectionTitle = "";
|
|
|
- this.pubform.issuerName = "";
|
|
|
- this.pubform.email = "";
|
|
|
- this.pubform.issuerPhone = "";
|
|
|
- this.pubform.issuerAddress = "";
|
|
|
- this.pubform.headPortrait = "";
|
|
|
- this.pubform.remark = ""
|
|
|
- });
|
|
|
+ let valid = this.$refs.pubform.validate().catch((err) => false);
|
|
|
+ if (!valid) {
|
|
|
+ this.$notify({
|
|
|
+ title: "警告",
|
|
|
+ message: "请填写内容",
|
|
|
+ type: "warning",
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.pubform.issuerId) {
|
|
|
+ // console.log("获取到id了");
|
|
|
+ updatapub(this.pubform).then(() => {
|
|
|
this.$notify({
|
|
|
title: "成功",
|
|
|
- message: "创建消息成功",
|
|
|
+ message: "修改发行人成功",
|
|
|
type: "success",
|
|
|
});
|
|
|
- this.$router.push("./publisherList");
|
|
|
- } else {
|
|
|
- this.$notify({
|
|
|
- title: "警告",
|
|
|
- message: "请填写内容",
|
|
|
- type: "warning",
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ addpublish(this.pubform).then(() => {
|
|
|
+ this.pubform.collectionTitle = "";
|
|
|
+ this.pubform.issuerName = "";
|
|
|
+ this.pubform.email = "";
|
|
|
+ this.pubform.issuerPhone = "";
|
|
|
+ this.pubform.issuerAddress = "";
|
|
|
+ this.pubform.headPortrait = "";
|
|
|
+ this.pubform.remark = "";
|
|
|
+ });
|
|
|
+ this.$notify({
|
|
|
+ title: "成功",
|
|
|
+ message: "创建消息成功",
|
|
|
+ type: "success",
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
},
|
|
|
};
|
|
@@ -119,7 +208,6 @@ export default {
|
|
|
margin-top: 40px;
|
|
|
border-radius: 4px;
|
|
|
}
|
|
|
-
|
|
|
.addcenter {
|
|
|
margin: auto;
|
|
|
width: 60%;
|
|
@@ -137,7 +225,7 @@ export default {
|
|
|
}
|
|
|
|
|
|
.avatar-uploader .el-upload:hover {
|
|
|
- border-color: #409EFF;
|
|
|
+ border-color: #409eff;
|
|
|
}
|
|
|
|
|
|
.avatar-uploader-icon {
|
|
@@ -151,7 +239,6 @@ export default {
|
|
|
|
|
|
.avatar {
|
|
|
width: 100%;
|
|
|
- height: 100%;
|
|
|
display: block;
|
|
|
}
|
|
|
</style>
|