Commit afaac2d9 authored by 姬鋆屾's avatar 姬鋆屾

pref:提交产品模块所修改内容,轮播图改为多图上传,富文本等修改

parent 790d23a8
#开发环境
NODE_ENV = "development"
VUE_APP_API_BASE_URL= http://192.168.0.98:11086
......@@ -2,6 +2,7 @@
height: 100% !important;
}
.layout-menu-wrapper {
padding: 0 24px;
height: 64px !important;
line-height: 64px !important;
background: linear-gradient(90deg, #1845c6, #2999ff) !important;
......@@ -9,6 +10,13 @@
.layout-menu-wrapper .layout-logo {
font-size: 20px;
font-weight: bold;
width: 200px;
}
.layout-menu-wrapper .menu-list {
margin-left: 50px;
}
.layout-menu-wrapper .menu-list li {
padding: 0 20px;
}
.layout-menu-wrapper .menu-list li a {
display: block;
......
......@@ -3,6 +3,7 @@
}
.layout-menu-wrapper {
padding: 0 24px;
height: 64px !important;
line-height: 64px !important;
background: linear-gradient(90deg, #1845c6, #2999ff) !important;
......@@ -10,16 +11,19 @@
.layout-logo {
font-size: 20px;
font-weight: bold;
width: 200px;
}
.menu-list {
margin-left: 50px;
li {
padding: 0 20px;
a {
display: block;
padding: 0 12px;
height: 100%;
font-size: 14px !important;
color: rgba(254, 254, 254, .65) !important;
color: rgba(254, 254, 254, 0.65) !important;
text-align: center !important;
i {
......@@ -33,7 +37,6 @@
&:hover {
color: #fff !important;
}
&.router-link-active,
......@@ -47,10 +50,7 @@
}
}
}
}
}
.layout-header .layout-submenu-wrapper {
......
// 表单节点封装,支持 input textarea select radio checkbox 及slot方式
<template>
<el-col :span='span'>
<el-form-item :label="label" :prop="prop" class='my-form-field'>
<el-col :span="span">
<el-form-item :label="label" :prop="prop" class="my-form-field">
<slot>
<el-input :disabled='disabled' :placeholder='placeholder' v-model="field" @change="emit" @input="emit" v-if='type === "text"' :class="inputClass" :clearable='clearable'></el-input>
<el-input :disabled='disabled' :placeholder='placeholder' v-model="field" @change="emit" @input="emit" type='password' v-if='type === "password"'></el-input>
<el-input-number :disabled='disabled' v-model="field" size="small" :placeholder='placeholder' @change="emit" @input="emit" v-if='type === "num"'></el-input-number>
<el-input
:disabled="disabled"
:placeholder="placeholder"
v-model="field"
@change="emit"
@input="emit"
v-if="type === 'text'"
:class="inputClass"
:clearable="clearable"
></el-input>
<el-input
:disabled="disabled"
:placeholder="placeholder"
v-model="field"
@change="emit"
@input="emit"
type="password"
v-if="type === 'password'"
></el-input>
<el-input-number
:disabled="disabled"
v-model="field"
size="small"
:placeholder="placeholder"
@change="emit"
@input="emit"
v-if="type === 'num'"
></el-input-number>
<el-input :disabled='disabled' :placeholder='placeholder' v-model="field" @change="emit" :rows='rows' @input="emit" v-if='type === "textarea"' type='textarea' :autosize="textareaSize" :class="inputClass"></el-input>
<el-input
:disabled="disabled"
:placeholder="placeholder"
v-model="field"
@change="emit"
:rows="rows"
@input="emit"
v-if="type === 'textarea'"
type="textarea"
:autosize="textareaSize"
:class="inputClass"
></el-input>
<el-select :disabled='disabled' v-model="field" @change="emit" :multiple='multiple' :filterable='filterable' :clearable='clearable' v-if='type === "select"'>
<el-select
:disabled="disabled"
v-model="field"
@change="emit"
:multiple="multiple"
:filterable="filterable"
:clearable="clearable"
v-if="type === 'select'"
>
<el-option
v-for="($label, $value) in enumData"
:key="$value"
......@@ -21,25 +63,54 @@
></el-option>
</el-select>
<el-radio-group :disabled='disabled' v-model="field" @change="emit" v-if='type === "radio"'>
<el-radio-group
:disabled="disabled"
v-model="field"
@change="emit"
v-if="type === 'radio'"
>
<el-radio
v-for='($label, $value) in enumData'
:key='$value'
v-for="($label, $value) in enumData"
:key="$value"
:label="$value"
>{{$label}}</el-radio>
>{{ $label }}</el-radio
>
</el-radio-group>
<el-checkbox-group :disabled='disabled' v-model="field" @change="emit" v-if='type === "checkbox"'>
<el-checkbox-group
:disabled="disabled"
v-model="field"
@change="emit"
v-if="type === 'checkbox'"
>
<el-checkbox
v-for='($label, $value) in enumData'
:key='$value'
v-for="($label, $value) in enumData"
:key="$value"
:label="$value"
>{{$label}}</el-checkbox>
>{{ $label }}</el-checkbox
>
</el-checkbox-group>
<el-date-picker :disabled='disabled' type="date" value-format="yyyy-MM-dd HH:mm:ss" v-model="field" @change="emit" @input="emit" placeholder="选择日期" v-if='type === "date"'></el-date-picker>
<el-date-picker :disabled='disabled' type="datetime" value-format="yyyy-MM-dd HH:mm:ss" v-model="field" @change="emit" @input="emit" placeholder="选择日期" v-if='type === "datetime"'></el-date-picker>
<el-date-picker
:disabled="disabled"
type="date"
value-format="yyyy-MM-dd HH:mm:ss"
v-model="field"
@change="emit"
@input="emit"
placeholder="选择日期"
v-if="type === 'date'"
></el-date-picker>
<el-date-picker
:disabled="disabled"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
v-model="field"
@change="emit"
@input="emit"
placeholder="选择日期"
v-if="type === 'datetime'"
></el-date-picker>
</slot>
</el-form-item>
</el-col>
......@@ -60,17 +131,17 @@ export default {
// 字段类型: text,password,textarea,select,radio,checkbox,date,datetime
type: {
type: String,
default: 'text',
default: "text",
},
// 字段name
prop: {
type: String,
default: '',
default: "",
},
// 字段中文标题
label: {
type: String,
default: '',
default: "",
},
// 是否禁用
disabled: {
......@@ -80,18 +151,18 @@ export default {
// 是否提示
placeholder: {
type: String,
default: '',
default: "",
},
// 字段所需的枚举类型
enumData: {
type: Object,
default: ()=>{},
default: () => {},
},
// textarea专用-自适应内容高度
textareaSize: {
type: Object,
default: ()=>{},
default: () => {},
},
// select专用-是否可搜索
filterable: {
......@@ -111,38 +182,39 @@ export default {
// 字段所需的枚举类型
options: {
type: Array,
default: ()=>[],
default: () => [],
},
children: {
type: Array,
default: ()=>[],
default: () => [],
},
inputClass: {
type: String,
default: '',
}
default: "",
},
},
methods: {
emit() {
this.$emit('input', this.newVal)
this.$emit('change', this.newVal)
}
this.$emit("input", this.newVal);
this.$emit("change", this.newVal);
console.log(this.newVal);
},
},
computed: {
field: {
get() {
return this.value
return this.value;
},
set(val) {
this.newVal = val;
}
}
},
},
},
data() {
return {
newVal: this.value,
}
}
}
};
},
};
</script>
......@@ -11,11 +11,11 @@
<router-link to="/">
<img
:src="sysLogo ? sysLogo : require('../assets/images/logo.png')"
style="margin-bottom:5px"
style="margin-bottom: 5px"
height="40"
alt=""
/>
<b style="color:white;font-size:18px;"
<b style="color: white; font-size: 18px"
>&nbsp;&nbsp;&nbsp;
{{ sysName ? sysName : "企业服务平台" }}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b
......@@ -43,7 +43,7 @@
</span> -->
<el-dropdown @command="handleCommand">
<span class="el-dropdown-link" style="color:white">
<span class="el-dropdown-link" style="color: white">
{{ userData.currUserName }}
<i class="el-icon-arrow-down el-icon--right"></i>
</span>
......@@ -249,9 +249,7 @@ export default {
}
}
}
.layout-profile {
padding-right: 30px;
}
}
.layout-submenu-wrapper {
......
......@@ -2,7 +2,7 @@
<template>
<div class="component-upload-image">
<el-upload
:action="uploadImgUrl+'?prePath=' +prePath"
:action="uploadImgUrl + '?prePath=' + prePath"
list-type="picture-card"
:on-success="handleUploadSuccess"
:before-upload="handleBeforeUpload"
......@@ -11,14 +11,22 @@
:show-file-list="false"
:headers="headers"
style="display: inline-block; vertical-align: top"
v-if="!isList"
>
<el-image
v-if="!value"
:src="value.indexOf('http') == -1 ? baseUrl + value : value"
>
<el-image v-if="!value" :src="value">
<div slot="error" class="image-slot">
<i class="el-icon-plus" />
</div>
</el-image>
<div v-else class="image">
<el-image :src="value" :style="`width:150px;height:150px;`" fit="fill"/>
<el-image
:src="value.indexOf('http') == -1 ? baseUrl + value : value"
:style="`width:150px;height:150px;`"
fit="fill"
/>
<div class="mask">
<div class="actions">
<span title="预览" @click.stop="dialogVisible = true">
......@@ -31,8 +39,36 @@
</div>
</div>
</el-upload>
<el-dialog :visible.sync="dialogVisible" title="预览" width="800" append-to-body>
<img :src="value" style="display: block; max-width: 100%; margin: 0 auto;">
<el-upload
:action="uploadImgUrl + '?prePath=' + prePath"
list-type="picture-card"
:on-remove="handleRemove"
:on-success="handleUploadSuccess"
:before-upload="handleBeforeUpload"
:on-preview="handlePictureCardPreview"
:file-list="imgList"
accept=".jpeg,.png,.jpg,.bmp,.gif"
:headers="headers"
v-else
>
<i class="el-icon-plus"></i>
</el-upload>
<el-dialog
:visible.sync="dialogVisible"
title="预览"
width="800"
append-to-body
>
<img
:src="dialogImageUrl"
style="display: block; max-width: 100%; margin: 0 auto"
v-if="isList"
/>
<img
:src="value"
style="display: block; max-width: 100%; margin: 0 auto"
v-else
/>
</el-dialog>
</div>
</template>
......@@ -41,8 +77,11 @@
export default {
data() {
return {
baseUrl: process.env.VUE_APP_API_BASE_URL + "/",
dialogVisible: false,
uploadImgUrl: "/enterprise/file/commonupload", // 上传的图片服务器地址
imgList: [],
dialogImageUrl: "",
};
},
props: {
......@@ -53,16 +92,52 @@ export default {
//保存服务器路径前缀地址
prePath: {
type: String,
default: '',
default: "",
},
isList: {
type: Boolean,
default: false,
},
},
mounted() {
// 判断是否为多图上传
if (this.isList) {
if (this.value && this.value != "") {
this.imgList = [];
let arr = [];
arr = this.value?.split(",");
arr.forEach((v) => {
let obj = {};
obj.name = "轮播图";
obj.uid = parseInt(Math.random(0, 100));
v.indexOf("http") == -1
? (obj.url = this.baseUrl + v)
: (obj.url = v);
this.imgList.push(obj);
});
}
}
},
methods: {
handleRemove(file, fileList) {
console.log(fileList);
this.imgList = fileList;
},
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url;
this.dialogVisible = true;
},
removeImage() {
this.$emit("input", "");
},
handleUploadSuccess(res) {
handleUploadSuccess(res, file, fileList) {
if (this.isList) {
this.loading.close();
this.imgList = fileList;
} else {
this.$emit("input", res.url);
this.loading.close();
}
},
handleBeforeUpload() {
this.loading = this.$loading({
......
......@@ -5,50 +5,115 @@
:visible.sync="open"
:direction="direction"
:destroy-on-close="true"
size="100%">
size="100%"
>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<div class="form">
<div class="formleft">
<Field label="标题" :span="24" prop="title" v-model="form.title" placeholder="请输入标题"/>
<Field :span="24" label="内容"><editor v-model="form.content" :min-height="256"/></Field>
<Field
label="标题"
:span="24"
prop="title"
v-model="form.title"
placeholder="请输入标题"
/>
<Field :span="24" label="内容"
><editor v-model="form.content" :min-height="256"
/></Field>
</div>
<div class="formright">
<el-row>
<Field label="类型" :span="20" prop="categoryId" v-model="form.categoryId" type="radio" :enum-data="dict.categoryId" placeholder="请输入分类id"/>
<Field :span="20" label="封面"><imageUpload v-model="form.titleLogoPath" prePath="/file/preview"/></Field>
<Field
label="类型"
:span="20"
prop="categoryId"
v-model="form.categoryId"
type="radio"
:enum-data="dict.categoryId"
placeholder="请输入分类id"
/>
<Field :span="20" label="封面">
<imageUpload
v-model="form.titleLogoPath"
prePath="/file/preview"
:isList="true"
ref="imgList"
/>
</Field>
<Field :span="20" label="责任编辑" prop="editor" v-model="form.editor" placeholder="请输入责任编辑"/>
<Field
:span="20"
label="责任编辑"
prop="editor"
v-model="form.editor"
placeholder="请输入责任编辑"
/>
<Field :span="20" label="发布部门" prop="deptId" v-model="form.deptId" type="select" :enum-data="dict.deptId" placeholder="请输入发布部门"/>
<Field
:span="20"
label="发布部门"
prop="deptId"
v-model="form.deptId"
type="select"
:enum-data="dict.deptId"
placeholder="请输入发布部门"
/>
<Field :span="20" label="文章来源" prop="source" v-model="form.source" placeholder="请输入文章来源"/>
<Field
:span="20"
label="文章来源"
prop="source"
v-model="form.source"
placeholder="请输入文章来源"
/>
<Field label="发布时间" prop="publishTime" v-model="form.publishTime" type="date" />
<Field :span="20" label="声明" prop="statement" v-model="form.statement" type="textarea" placeholder="请输入声明"/>
<Field
label="发布时间"
prop="publishTime"
v-model="form.publishTime"
type="date"
/>
<Field
:span="20"
label="声明"
prop="statement"
v-model="form.statement"
type="textarea"
placeholder="请输入声明"
/>
</el-row>
</div>
</div>
<el-form-item class="footerbtns">
<el-button type="primary" @click='submitForm' icon='el-icon-circle-check-outline'>发布</el-button>
<el-button @click='()=>{open = false}' icon='el-icon-circle-close-outline'>取消</el-button>
<el-button
type="primary"
@click="submitForm"
icon="el-icon-circle-check-outline"
>发布</el-button
>
<el-button
@click="
() => {
open = false;
}
"
icon="el-icon-circle-close-outline"
>取消</el-button
>
</el-form-item>
</el-form>
</el-drawer>
</template>
<script>
import form from "@/assets/mixins/formdialog";
export default {
import form from "@/assets/mixins/formdialog";
export default {
name: "NewsDetail",
mixins: [form],
components: {
},
components: {},
created() {
this.changePath("news")
this.changePath("news");
},
data() {
return {
......@@ -58,59 +123,51 @@
title: "新闻",
// 是否显示弹出层
open: false,
direction:"rtl",
toString:[
"top",
"viewNums",
"categoryId"
],
toDate:[
"publishTime",
],
direction: "rtl",
toString: ["top", "viewNums", "categoryId"],
toDate: ["publishTime"],
// 表单校验
rules: {
categoryId: [
{required: true,message: "请选择频道类型", trigger: "blur" },
{ required: true, message: "请选择频道类型", trigger: "blur" },
],
title: [
{required: true,message: "请输入标题", trigger: "blur" },
{max: 512,message: "最多只能录入512个字符",trigger: "blur",},
{ required: true, message: "请输入标题", trigger: "blur" },
{ max: 512, message: "最多只能录入512个字符", trigger: "blur" },
],
titleLogoPath: [
{required: true,message: "请输入标题logo", trigger: "blur" },
{ required: true, message: "请输入标题logo", trigger: "blur" },
],
publishTime: [
{required: true,message: "请选择发布时间" },
]
}
publishTime: [{ required: true, message: "请选择发布时间" }],
},
};
},
methods: {
/** 编辑 */
edit(row) {
this.reset()
this.reset();
this.query = { id: row.id };
this.urls.currUrl ="news/edit";
this.urls.currUrl = "news/edit";
this.getData();
this.pageInfo.type="edit"
this.pageInfo.type = "edit";
this.title = "修改新闻";
},
/** 新增 */
add(row) {
this.reset()
this.reset();
this.urls.currUrl = "news/add";
this.getData();
this.pageInfo.type="add"
this.pageInfo.type = "add";
this.title = "新增新闻";
},
/** 查看*/
view(row) {
this.reset()
this.reset();
this.query = { id: row.id };
this.urls.currUrl ="news/view";
this.urls.currUrl = "news/view";
this.getData();
this.pageInfo.type="view"
this.pageInfo.type = "view";
this.title = "新闻详细";
},
/**取消按钮 */
......@@ -121,7 +178,16 @@
afterRender(data) {
this.open = true;
},
// 提交前数据处理
beforeSubmit(data) {
console.log(data, "123");
let arr = [];
arr = this.$refs.imgList.imgList.map((v) => {
return v.response ? v.response.url : v.url.substr(v.url.indexOf("f"));
});
data.titleLogoPath = arr.join(",");
return data;
},
afterSubmit(data) {
this.open = false;
this.$emit("ok");
......@@ -130,14 +196,14 @@
// 表单重置
reset() {
this.form = {
categoryId : null,
categoryName : "",
title : "",
titleLogoPath : "",
content : "",
top : 0,
viewNums : 0,
publishTime : null,
categoryId: null,
categoryName: "",
title: "",
titleLogoPath: "",
content: "",
top: 0,
viewNums: 0,
publishTime: null,
};
this.resetForm("form");
},
......@@ -147,10 +213,10 @@
}
},
},
};
};
</script>
<style lang="less" scoped>
.footerbtns{
.footerbtns {
margin-top: 20px;
padding-top: 20px;
border-top: 1px solid gainsboro;
......@@ -158,16 +224,16 @@
justify-content: center;
align-content: center;
}
.form{
.form {
display: flex;
width: 100%;
.formleft{
flex:1;
.formleft {
flex: 1;
width: 60%;
height: calc(100vh - 200px);
overflow: auto;
}
.formright{
.formright {
width: 40%;
flex-shrink: 0;
flex-grow: 0;
......
<template>
<div class="page">
<LayoutTable ref="layouttable" :data="tableData" :config="tableConfig" notDel >
<LayoutTable
ref="layouttable"
:data="tableData"
:config="tableConfig"
notDel
>
<!-- 热门0为非热门1为热门 -->
<div slot="table-search-left" class="onlyhot">
<el-checkbox
......@@ -9,33 +14,30 @@
:checked="ishot"
@change="changeIshot"
>
</el-checkbox>
只看热门
</div>
</LayoutTable>
<drawer-show ref="drawerform" @ok="getData" />
</div>
</template>
<script>
/** 表单弹出框模式需引入 */
import drawerShow from "./drawershow";
import table from "@/assets/mixins/table";
export default {
/** 表单弹出框模式需引入 */
import drawerShow from "./drawershow";
import table from "@/assets/mixins/table";
export default {
name: "ProductList",
components: {
drawerShow
drawerShow,
},
mixins: [table],
mounted() {
// 重写查询
this.$refs.layouttable.$refs.searchform.onSubmit = this.onSearch
this.$refs.layouttable.$refs.searchform.onSubmit = this.onSearch;
// 重写搜索清除
this.$refs.layouttable.$refs.searchform.cleanForm = this.cleanForm
this.$refs.layouttable.$refs.searchform.cleanForm = this.cleanForm;
},
methods: {
renderTable(tableData) {
......@@ -52,8 +54,7 @@
label={options.label}
width={options.width}
formatter={options.formatter}
>
</el-table-column>
></el-table-column>
);
},
/** 重写新增方法 */
......@@ -69,46 +70,51 @@
this.$refs.drawerform.view(row);
},
// 重写查询
onSearch(){
if(this.ishot){
this.$refs.layouttable.$refs.searchform.form = Object.assign({}, this.$refs.layouttable.$refs.searchform.form, {hot:1})
onSearch() {
if (this.ishot) {
this.$refs.layouttable.$refs.searchform.form = Object.assign(
{},
this.$refs.layouttable.$refs.searchform.form,
{ hot: 1 }
);
}
let { path, query } = this.$refs.layouttable.$refs.searchform.$route;
let data = this.$refs.layouttable.$refs.searchform.decode(this.$refs.layouttable.$refs.searchform.form);
let data = this.$refs.layouttable.$refs.searchform.decode(
this.$refs.layouttable.$refs.searchform.form
);
this.$refs.layouttable.$refs.searchform.$router.push({
path: path,
query: Object.assign({}, query, data),
});
},
// 重写搜索清除
cleanForm(){
this.ishot = false
this.$refs.layouttable.$refs.searchform.form.hot = undefined
this.$forceUpdate()
cleanForm() {
this.ishot = false;
this.$refs.layouttable.$refs.searchform.form.hot = undefined;
this.$forceUpdate();
this.$refs.layouttable.$refs.searchform.clean();
this.$refs.layouttable.$refs.searchform.onSubmit();
},
changeIshot(val){
this.ishot = val
}
changeIshot(val) {
this.ishot = val;
},
},
data() {
return {
ishot:false,
ishot: false,
config: {
search: [
{
name: "categoryId",
type: "select",
placeholder:"请选择产品分类",
label: "产品分类"
placeholder: "请选择产品分类",
label: "产品分类",
},
{
name: "companyId",
type: "select",
placeholder:"请选择所属企业",
label: "所属企业"
placeholder: "请选择所属企业",
label: "所属企业",
},
{
name: "productName",
......@@ -118,42 +124,67 @@
},
],
columns: [
{type: "index",label: "序号",width: 50},
{ type: "index", label: "序号", width: 50 },
{label: "产品名称", prop: "productName"},
{ label: "产品名称", prop: "productName" },
{label: "产品分类", prop: "categoryId",formatter: this.formatters},
{ label: "产品分类", prop: "categoryId", formatter: this.formatters },
{label: "所属企业", prop: "companyId",formatter: this.formatters},
{ label: "所属企业", prop: "companyId", formatter: this.formatters },
{label: "产品介绍", prop: "productIntroduction" , width: 500,formatter: this.formatters},
{
label: "产品介绍",
prop: "productIntroduction",
width: 500,
formatter: this.formatters,
},
{label: "发布时间", prop: "publishTime", formatter: this.formatterDate},
{
label: "发布时间",
prop: "publishTime",
formatter: this.formatterDate,
},
{label: "热门", prop: "hot",formatter: this.formatterYES, width: 50},
{
label: "热门",
prop: "hot",
formatter: this.formatterYES,
width: 50,
},
{label: "最近更新时间", prop: "updateTime", formatter: this.formatterDate},
{
label: "最近更新时间",
prop: "updateTime",
formatter: this.formatterDate,
},
{
label: "操作",
width: 240,
formatter: row => {
formatter: (row) => {
return (
<table-buttons noAdd noView row={row} onEdit={this.toEdit} onView={this.toView} onDel={this.toDel} />
<table-buttons
noAdd
noView
row={row}
onEdit={this.toEdit}
onView={this.toView}
onDel={this.toDel}
/>
);
}
}
]
}
};
}
},
},
],
},
};
},
};
</script>
<style lang="less" >
.table-form{
display: flex ;
.table-form {
display: flex;
}
.onlyhot{
.onlyhot {
margin-right: 20px;
line-height: 30px;
font-size: 14px;
......
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