Commit 30ff42df authored by 王晓旭's avatar 王晓旭
parents 45280699 ffae5126
...@@ -44,6 +44,16 @@ ...@@ -44,6 +44,16 @@
(current - 1) * size + index + 1 (current - 1) * size + index + 1
}}</span> }}</span>
<!-- 主题封面 -->
<template slot="cover" slot-scope="text">
<img
class="cover"
v-if="text.cover"
:src="api2 + text.cover"
@click="handlePreview(api2 + text.cover)"
/>
<span v-else>--</span>
</template>
<!-- 创建时间 --> <!-- 创建时间 -->
<template slot="createTime" slot-scope="text"> <template slot="createTime" slot-scope="text">
{{ text.createTime | dateFormat }} {{ text.createTime | dateFormat }}
...@@ -65,6 +75,11 @@ ...@@ -65,6 +75,11 @@
:addVisile.sync="addVisile" :addVisile.sync="addVisile"
@addSuccess="getCategoryList" @addSuccess="getCategoryList"
></AddTheme> ></AddTheme>
<!-- 预览 -->
<PrevieModal
:previewData="previewData"
:previewVisible.sync="previewVisible"
></PrevieModal>
</div> </div>
</template> </template>
...@@ -73,6 +88,7 @@ import { getCategoryList, deleteCategory } from "@/services/market"; ...@@ -73,6 +88,7 @@ import { getCategoryList, deleteCategory } from "@/services/market";
import AddTheme from "../modal/AddTheme"; import AddTheme from "../modal/AddTheme";
import local from "@/utils/local"; import local from "@/utils/local";
import { pageSizeOptions } from "@/config/pageConfig.js"; import { pageSizeOptions } from "@/config/pageConfig.js";
import PrevieModal from "@/components/PrevieModal.vue";
const columns = [ const columns = [
{ {
title: "序号", title: "序号",
...@@ -94,6 +110,12 @@ const columns = [ ...@@ -94,6 +110,12 @@ const columns = [
title: "主题编码", title: "主题编码",
dataIndex: "categoryCode", dataIndex: "categoryCode",
}, },
{
title: "主题封面",
scopedSlots: {
customRender: "cover",
},
},
{ {
title: "排序", title: "排序",
dataIndex: "sort", dataIndex: "sort",
...@@ -113,12 +135,15 @@ const columns = [ ...@@ -113,12 +135,15 @@ const columns = [
export default { export default {
components: { components: {
AddTheme, AddTheme,
PrevieModal,
}, },
data() { data() {
return { return {
api: process.env.VUE_APP_API_BASE_URL + "/", api: process.env.VUE_APP_API_BASE_URL + "/",
api2: process.env.VUE_APP_API_IMG_URL, api2: process.env.VUE_APP_API_IMG_URL,
columns, columns,
previewData: {}, // 预览
previewVisible: false,
siteId: local.getLocal("siteId"), siteId: local.getLocal("siteId"),
tableData: [], // 表格数据 tableData: [], // 表格数据
loading: false, loading: false,
...@@ -227,8 +252,21 @@ export default { ...@@ -227,8 +252,21 @@ export default {
}, },
}); });
}, },
// 预览封面
handlePreview(url) {
this.previewData = {
type: "img",
url: url,
};
this.previewVisible = true;
},
}, },
}; };
</script> </script>
<style lang="less" scoped></style> <style lang="less" scoped>
.cover {
width: 50px;
cursor: pointer;
}
</style>
...@@ -48,26 +48,6 @@ ...@@ -48,26 +48,6 @@
<div class="ant-upload-text">选择图标</div> <div class="ant-upload-text">选择图标</div>
</div> </div>
</a-upload> </a-upload>
<!-- <a-upload
name="file"
list-type="picture-card"
class="avatar-uploader"
:show-upload-list="false"
:action="api + 'base/file/commonupload'"
:before-upload="iconBeforeUpload"
@change="handleChangeIcon"
>
<img
class="icon"
v-if="form.appIconPath"
:src="api2 + form.appIconPath"
/>
<div v-else>
<a-icon :type="loading ? 'loading' : 'plus'" />
<div class="ant-upload-text">选择图标</div>
</div>
</a-upload> -->
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="应用简介" prop="summary"> <a-form-model-item label="应用简介" prop="summary">
<a-textarea <a-textarea
...@@ -102,6 +82,7 @@ ...@@ -102,6 +82,7 @@
<a-radio :value="1"> 应用程序 </a-radio> <a-radio :value="1"> 应用程序 </a-radio>
<a-radio :value="2"> URL </a-radio> <a-radio :value="2"> URL </a-radio>
<a-radio :value="3" v-if="form.type != 1"> 微信小程序 </a-radio> <a-radio :value="3" v-if="form.type != 1"> 微信小程序 </a-radio>
<a-radio :value="4" v-if="form.type != 2"> 天府通办 </a-radio>
</a-radio-group> </a-radio-group>
</a-form-model-item> </a-form-model-item>
<a-form-model-item <a-form-model-item
......
...@@ -25,10 +25,32 @@ ...@@ -25,10 +25,32 @@
<a-form-model-item label="主题编码" prop="categoryCode"> <a-form-model-item label="主题编码" prop="categoryCode">
<a-input v-model="form.categoryCode" placeholder="请输入主题编码" /> <a-input v-model="form.categoryCode" placeholder="请输入主题编码" />
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="主题封面" prop="cover">
<a-upload
name="file"
list-type="picture-card"
:action="api + 'base/file/commonupload'"
:file-list="fileList"
@change="handleChangeCover"
:accept="accept"
:before-upload="beforeUpload"
@preview="handlePreview"
>
<div v-if="fileList.length < 1">
<a-icon type="plus" />
<div class="ant-upload-text">选择封面</div>
</div>
</a-upload>
</a-form-model-item>
<a-form-model-item label="排序" prop="sort"> <a-form-model-item label="排序" prop="sort">
<a-input-number v-model="form.sort" :min="1" /> <a-input-number v-model="form.sort" :min="1" />
</a-form-model-item> </a-form-model-item>
</a-form-model> </a-form-model>
<!-- 预览 -->
<PrevieModal
:previewData="previewData"
:previewVisible.sync="previewVisible"
></PrevieModal>
</a-modal> </a-modal>
</div> </div>
</template> </template>
...@@ -36,6 +58,7 @@ ...@@ -36,6 +58,7 @@
<script> <script>
import { saveCategory } from "@/services/market"; import { saveCategory } from "@/services/market";
import local from "@/utils/local"; import local from "@/utils/local";
import PrevieModal from "@/components/PrevieModal.vue";
export default { export default {
props: { props: {
addVisile: { addVisile: {
...@@ -48,15 +71,25 @@ export default { ...@@ -48,15 +71,25 @@ export default {
default: "新增分类", default: "新增分类",
}, },
}, },
components: {}, components: {
PrevieModal,
},
data() { data() {
return { return {
accept: "image/jpeg,image/png",
api: process.env.VUE_APP_API_BASE_URL + "/",
api2: process.env.VUE_APP_API_IMG_URL,
fileList: [],
previewData: {}, // 预览
previewVisible: false,
form: { form: {
siteId: local.getLocal("siteId"), // 站点id siteId: local.getLocal("siteId"), // 站点id
siteName: local.getLocal("siteName"), // 站点名称 siteName: local.getLocal("siteName"), // 站点名称
categoryName: "", // 分类名称 categoryName: "", // 分类名称
categoryCode: "", // 分类编码 categoryCode: "", // 分类编码
sort: 99, // 排序 sort: 99, // 排序
cover: "", // 封面
remark: "", // 备注
}, },
rules: { rules: {
categoryName: [ categoryName: [
...@@ -88,9 +121,21 @@ export default { ...@@ -88,9 +121,21 @@ export default {
// 编辑 // 编辑
onEdit(data) { onEdit(data) {
this.form = { ...data }; this.form = { ...data };
if (this.form.cover) {
this.fileList = [
{
uid: "-2",
name: this.form.cover,
status: "done",
url: this.api2 + this.form.cover,
url2: this.form.cover,
},
];
}
}, },
// 关闭弹窗 // 关闭弹窗
handleClose() { handleClose() {
this.fileList = [];
this.$refs.form.resetFields(); this.$refs.form.resetFields();
this.Visible = false; this.Visible = false;
}, },
...@@ -108,6 +153,43 @@ export default { ...@@ -108,6 +153,43 @@ export default {
} }
}); });
}, },
// 上传之前
beforeUpload(file) {
const isJpgOrPng =
file.type === "image/jpeg" || file.type === "image/png";
if (!isJpgOrPng) {
this.$message.error("请上传jpeg、png格式图片!");
}
const isLt10M = file.size / 1024 / 1024 < 10;
if (!isLt10M) {
this.$message.error("图片大小不能超过 10MB!");
}
return isJpgOrPng && isLt10M;
},
// 上传封面
handleChangeCover({ fileList }) {
this.fileList = [...fileList].slice(-1);
this.fileList = this.fileList.map((v) => {
if (v.response) {
v.url2 = v.response.url;
v.url = this.api2 + v.response.url;
}
return v;
});
if (this.fileList[0]) {
this.form.cover = this.fileList[0].url2;
} else {
this.form.cover = "";
}
},
// 预览
handlePreview(info) {
this.previewData = {
type: "img",
url: info.url,
};
this.previewVisible = true;
},
// 重置 // 重置
handleReset() { handleReset() {
this.$refs.form.resetFields(); this.$refs.form.resetFields();
......
...@@ -671,6 +671,7 @@ export default { ...@@ -671,6 +671,7 @@ export default {
// 业务下拉 // 业务下拉
handleChange(val, node) { handleChange(val, node) {
this.$refs.formData.validateField("siteBusinessId");
if (node) { if (node) {
let { text } = node.componentOptions.children[0]; let { text } = node.componentOptions.children[0];
this.siteBusiness.siteBusinessName = text; this.siteBusiness.siteBusinessName = text;
......
...@@ -184,3 +184,11 @@ CREATE TABLE mortals_sys_app_category( ...@@ -184,3 +184,11 @@ CREATE TABLE mortals_sys_app_category(
`updateTime` datetime COMMENT '更新时间', `updateTime` datetime COMMENT '更新时间',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='自助终端应用分类'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='自助终端应用分类';
-- ----------------------------
2023-7-05
-- ----------------------------
ALTER TABLE mortals_sys_app_category ADD COLUMN `cover` varchar(256) DEFAULT '' COMMENT '封面' AFTER sort;
ALTER TABLE mortals_sys_app_category ADD COLUMN `remark` varchar(256) DEFAULT '' COMMENT '备注' AFTER cover;
...@@ -7,38 +7,46 @@ import com.mortals.framework.model.BaseEntityLong; ...@@ -7,38 +7,46 @@ import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.app.model.vo.AppCategoryVo; import com.mortals.xhx.module.app.model.vo.AppCategoryVo;
import lombok.Data; import lombok.Data;
/** /**
* 自助终端应用分类实体对象 * 自助终端应用分类实体对象
* *
* @author zxfei * @author zxfei
* @date 2023-06-15 * @date 2023-07-05
*/ */
@Data @Data
public class AppCategoryEntity extends AppCategoryVo { public class AppCategoryEntity extends AppCategoryVo {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 站点Id * 站点Id
*/ */
private Long siteId; private Long siteId;
/** /**
* 站点名称 * 站点名称
*/ */
private String siteName; private String siteName;
/** /**
* 分类编码 * 分类编码
*/ */
private String categoryCode; private String categoryCode;
/** /**
* 分类名称 * 分类名称
*/ */
private String categoryName; private String categoryName;
/** /**
* 排序字段 * 排序字段
*/ */
private Integer sort; private Integer sort;
/**
* 封面
*/
private String cover;
/**
* 备注
*/
private String remark;
@Override @Override
public int hashCode() { public int hashCode() {
return this.getId().hashCode(); return this.getId().hashCode();
} }
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
...@@ -46,7 +54,7 @@ public class AppCategoryEntity extends AppCategoryVo { ...@@ -46,7 +54,7 @@ public class AppCategoryEntity extends AppCategoryVo {
if (obj instanceof AppCategoryEntity) { if (obj instanceof AppCategoryEntity) {
AppCategoryEntity tmp = (AppCategoryEntity) obj; AppCategoryEntity tmp = (AppCategoryEntity) obj;
if (this.getId() == tmp.getId()) { if (this.getId() == tmp.getId()) {
return true; return true;
} }
} }
return false; return false;
...@@ -54,14 +62,18 @@ public class AppCategoryEntity extends AppCategoryVo { ...@@ -54,14 +62,18 @@ public class AppCategoryEntity extends AppCategoryVo {
public void initAttrValue(){ public void initAttrValue(){
this.siteId = -1L; this.siteId = -1L;
this.siteName = "";
this.categoryCode = "";
this.siteName = ""; this.categoryName = "";
this.categoryCode = ""; this.sort = 0;
this.categoryName = ""; this.cover = "";
this.sort = 0; this.remark = "";
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment