|
|
@@ -40,6 +40,11 @@
|
|
|
>
|
|
|
<el-table-column align="center" prop="name" label="股票名称" />
|
|
|
<el-table-column align="center" prop="code" label="股票代码" />
|
|
|
+ <el-table-column align="center" prop="date" label="操作">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <img v-if="scope.row.img" :src="scope.row.img" alt="" width="100" height="80">
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column align="center" prop="desc" label="简介" />
|
|
|
<el-table-column align="center" prop="date" label="操作">
|
|
|
<template slot-scope="scope">
|
|
|
@@ -76,12 +81,25 @@
|
|
|
placeholder="请输入代码"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="封面图">
|
|
|
+ <el-upload
|
|
|
+ class="avatar-uploader"
|
|
|
+ action="/api/admin/uploadfile"
|
|
|
+ :show-file-list="false"
|
|
|
+ :on-success="handleAvatarSuccess"
|
|
|
+ :before-upload="beforeAvatarUpload"
|
|
|
+ >
|
|
|
+ <img v-if="form.img" :src="form.img" class="avatar" width="100%" />
|
|
|
+ <i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
|
|
+ </el-upload>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="股票简介" prop="desc">
|
|
|
<el-input
|
|
|
type="textarea"
|
|
|
clearable
|
|
|
- v-model="form.code"
|
|
|
+ v-model="form.desc"
|
|
|
placeholder="请输入股票简介"
|
|
|
+ rows="10"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
@@ -136,6 +154,22 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
+ handleAvatarSuccess(res, file) {
|
|
|
+ this.form.img = res.data.url;
|
|
|
+ },
|
|
|
+ beforeAvatarUpload(file) {
|
|
|
+ return
|
|
|
+ const isJPG = file.type === "image/jpeg";
|
|
|
+ const isLt2M = file.size / 1024 / 1024 < 2;
|
|
|
+
|
|
|
+ if (!isJPG) {
|
|
|
+ this.$message.error("上传头像图片只能是 JPG 格式!");
|
|
|
+ }
|
|
|
+ if (!isLt2M) {
|
|
|
+ this.$message.error("上传头像图片大小不能超过 2MB!");
|
|
|
+ }
|
|
|
+ return isJPG && isLt2M;
|
|
|
+ },
|
|
|
del(id) {
|
|
|
this.$confirm("确定删除吗?", "提示", {
|
|
|
type: "warning",
|