Commit 47feff40 authored by 黄奎's avatar 黄奎

页面修改

parent a21a0f1b
<template> <template>
<div class="navigation"> <div class="navigation">
<template v-if="isShowAdd"> <template v-if="NavIconIsShowAdd">
<div class="head-title"> <div class="head-title">
导航图标列表 导航图标列表
<el-button @click="isShowAdd=false" style="float:right;margin-top: -5px;" size="small" type="primary">添加导航图标</el-button> <el-button @click="NavIconIsShowAdd=false" style="float:right;margin-top: -5px;" size="small" type="primary">
添加导航图标
</el-button>
</div> </div>
<div class="content"> <div class="content">
<div> <div>
<div class="searchInput"> <div class="searchInput">
<el-input style="display:inline-block;width:225px;height:30px" <el-input style="display:inline-block;width:225px;height:30px" placeholder="请输入搜索内容"
placeholder="请输入搜索内容" v-model="msg.NavIconName" size="small" clearable @keyup.enter.native="msg.pageIndex=1,getList()">
v-model="value"
size="small"
clearable>
</el-input> </el-input>
<span class="el-icon-search" style="color:#979dad;font-size:14px;position:relative;top:1px"></span> <span class="el-icon-search" style="color:#979dad;font-size:14px;position:relative;top:1px" @click="msg.pageIndex=1,getList()"> </span>
</div> </div>
</div> </div>
<el-table <el-table :data="dataList" v-loading="loading" border style="width: 100%;margin:20px 0">
:data="tableData" <el-table-column prop="NavIconId" label="编号" width="100">
v-loading="loading"
border
style="width: 100%;margin:20px 0">
<el-table-column
prop="ID"
label="ID"
width="100">
</el-table-column> </el-table-column>
<el-table-column <el-table-column prop="NavIconName" width="120" label="名称">
prop="address"
width="120"
label="名称">
</el-table-column> </el-table-column>
<el-table-column <el-table-column label="导航图标" width="80">
prop="name" <template slot-scope="scope">
label="导航图标"
width="80"> <img :src="scope.row.NavIconImg">
</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column prop="NavIconUrl" label="导航链接">
prop="name"
label="导航链接">
</el-table-column> </el-table-column>
<el-table-column <el-table-column prop="NavIconSort" label="排序" width="180">
prop="name"
label="排序"
width="180">
</el-table-column> </el-table-column>
<el-table-column <el-table-column prop="NavIconIsShowStr" label="是否显示" width="120">
prop="name"
label="是否显示"
width="120">
</el-table-column> </el-table-column>
<el-table-column <el-table-column width="220" label="操作">
prop="address" <template slot-scope="scope">
width="220" <el-button size="mini" type="info" plain @click="EditNavIcon(scope.row)">编辑 </el-button>
label="操作"> <el-button size="mini" type="info" plain @click="RemmoveNavIcon(scope.row)">删除</el-button>
</template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination style="text-align:right" <el-pagination style="text-align:right" background @current-change="handleCurrentChange"
background :page-size="msg.pageSize" layout="prev, pager, next" :total="total">
@current-change="handleCurrentChange"
:page-size="msg.pageSize"
layout="prev, pager, next"
:total="total">
</el-pagination> </el-pagination>
</div> </div>
</template> </template>
<template v-else> <template v-else>
<div class="head-title"> <div class="head-title">
<span @click="isShowAdd=true" style="color:rgb(64, 158, 255);cursor:pointer;">导航图标列表</span><span style="margin:0 9px;color:#C0C4CC">/</span><span>导航图标编辑</span> <span @click="NavIconIsShowAdd=true" style="color:rgb(64, 158, 255);cursor:pointer;">导航图标列表</span><span
style="margin:0 9px;color:#C0C4CC">/</span><span>导航图标编辑</span>
</div> </div>
<div class="content"> <div class="content">
<el-form :model="addMsg" :rules="rules" ref="addMsg" label-width="80px" style="padding:0 20px;"> <el-form :model="addMsg" :rules="rules" ref="addMsg" label-width="80px" style="padding:0 20px;">
<el-form-item label="名称" prop="name"> <el-form-item label="名称" prop="NavIconName">
<el-input v-model="addMsg.name" class="w400" size="small" placeholder="请输入名称" maxlength="20" /> <el-input v-model="addMsg.NavIconName" class="w400" size="small" placeholder="请输入名称" maxlength="20" />
</el-form-item> </el-form-item>
<el-form-item label="排序" prop="Sort"> <el-form-item label="排序" prop="NavIconSort">
<el-input type="text" v-model="addMsg.Sort" size="small" class="w400" placeholder="请输入排序" maxlength="20" /> <el-input type="text" v-model="addMsg.NavIconSort" size="small" class="w400" placeholder="请输入排序"
maxlength="4" />
</el-form-item> </el-form-item>
<el-form-item label="导航图标" prop="img"> <el-form-item label="导航图标" prop="NavIconImg">
<div> <div>
<el-tooltip class="item" effect="dark" content="建议尺寸:88*88" placement="top-start"> <el-tooltip class="item" effect="dark" content="建议尺寸:88*88" placement="top-start">
<el-upload class="avatar-uploader" action="" accept="image/jpeg,image/gif,image/png,image/bmp" <el-upload class="avatar-uploader" action="" accept="image/jpeg,image/gif,image/png,image/bmp"
...@@ -88,72 +68,72 @@ ...@@ -88,72 +68,72 @@
</el-upload> </el-upload>
</el-tooltip> </el-tooltip>
</div> </div>
<div class="navImg"> <div class="navNavIconImg">
<img v-if="addMsg.img" :src="addMsg.img" alt="" /> <img v-if="addMsg.NavIconImg" :src="addMsg.NavIconImg" alt="" />
<img v-else src="../../assets/img/default.png" alt=""/> <img v-else src="../../assets/img/default.png" alt="" />
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="导航链接" prop="link"> <el-form-item label="导航链接" prop="NavIconUrl">
<el-input type="password" v-model="addMsg.link" class="w400" size="small" maxlength="100" /> <el-input v-model="addMsg.NavIconUrl" class="w400" size="small" maxlength="100" />
<el-button plain size="small">选择链接</el-button> <el-button plain size="small">选择链接</el-button>
</el-form-item> </el-form-item>
<el-form-item label="是否显示"> <el-form-item label="是否显示">
<el-switch v-model="addMsg.isShow" ></el-switch> <el-switch v-model="addMsg.NavIconIsShow" :active-value="1" :inactive-value="0"></el-switch>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<el-button size="small" style="margin-top:20px;padding:9px 25px;" type="primary" @click="submitform('addMsg')">保存</el-button> <el-button size="small" style="margin-top:20px;padding:9px 25px;" type="primary" @click="submitform('addMsg')">保存
</el-button>
</template> </template>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
let validataImg = (rule, value, callback) => { let validataNavIconImg = (rule, value, callback) => {
if (this.addMsg.img == '') { if (this.addMsg.NavIconImg == '') {
return callback(new Error('请选择导航图标')); return callback(new Error('请选择导航图标'));
} else { } else {
callback(); callback();
} }
} }
return { return {
loading:false, loading: false,
dialogVisible:false, dataList: [],
value:'', msg: {
options:[], pageIndex: 1,
tableData:[ pageSize: 15,
{ID:'111'} NavIconName: "",
], MallBaseId: 0,
msg:{
pageIndex:1,
pageSize:15,
}, },
total:0, total: 0,
isShowAdd:true, NavIconIsShowAdd: true,
addMsg:{ addMsg: {
name:'', NavIconId: 0, //导航Id
Sort:100, MallBaseId: 0, //小程序Id
img:'', NavIconName: '', //导航名称
link:'', NavIconSort: 100, //导航排序
isShow:true NavIconImg: '', //导航图标
NavIconUrl: '', //导航链接
NavIconIsShow: 0, //是否显示
}, },
rules: { rules: {
name: [{ NavIconName: [{
required: true, required: true,
message: "请输入导航名称", message: "请输入导航名称",
trigger: "blur" trigger: "blur"
}], }],
Sort: [{ NavIconSort: [{
required: true, required: true,
message: "请输入导航排序", message: "请输入导航排序",
trigger: "blur" trigger: "blur"
}], }],
img:[{ NavIconImg: [{
validator: validataImg, validator: validataNavIconImg,
trigger: "blur", trigger: "blur",
required: true required: true
}], }],
link: [{ NavIconUrl: [{
required: true, required: true,
message: "请选择导航链接", message: "请选择导航链接",
trigger: "blur" trigger: "blur"
...@@ -169,14 +149,21 @@ ...@@ -169,14 +149,21 @@
this.msg.pageIndex = val; this.msg.pageIndex = val;
this.getList(); this.getList();
}, },
getList(){ getList() {
this.apipost("/api/Tenant/GetMiniProgrameNaviconPage", this.msg, res => {
if (res.data.resultCode == 1) {
this.dataList = res.data.data.pageData;
this.total = res.data.data.count;
} else {
this.Info(res.data.message);
}
})
}, },
//上传图片 //上传图片
UploadImage(file) { UploadImage(file) {
this.UploadFileToTencent(this.FileType().UserImg, file.file, res => { this.UploadFileToTencent(this.FileType().UserNavIconImg, file.file, res => {
if (res.resultCode == 1) { if (res.resultCode == 1) {
this.addMsg.img = res.FileUrl; this.addMsg.NavIconImg = res.FileUrl;
} }
}) })
}, },
...@@ -191,52 +178,102 @@ ...@@ -191,52 +178,102 @@
}); });
}, },
//保存 //保存
saveMsg(){ saveMsg() {
this.apipost("/api/Tenant/SetMiniProgrameNavicon", this.addMsg, res => {
if (res.data.resultCode == 1) {
this.getList();
this.NavIconIsShowAdd = true;
this.addMsg.NavIconId = 0;
this.addMsg.NavIconName = "";
this.addMsg.NavIconSort = 100;
this.addMsg.NavIconImg = "";
this.addMsg.NavIconUrl = "";
this.addMsg.NavIconIsShow = 0;
} else {
this.Info(res.data.message);
}
})
},
//修改
EditNavIcon(item) {
this.apipost("/api/Tenant/GetMiniProgrameNavicon", {
NavIconId: item.NavIconId
}, res => {
if (res.data.resultCode == 1) {
this.addMsg = res.data.data;
this.NavIconIsShowAdd = false;
} else {
this.Info(res.data.message);
}
})
},
//删除
RemmoveNavIcon(item) {
var that = this;
that.Confirm("是否要删除?", function () {
that.apipost("/api/Tenant/RemoveMiniProgrameNavicon", {
NavIconId: item.NavIconId
}, res => {
if (res.data.resultCode == 1) {
that.getList();
} else {
that.Info(res.data.message);
} }
})
})
},
}, },
mounted() { mounted() {
this.addMsg.MallBaseId = this.getLocalStorage().MallBaseId;
this.msg.MallBaseId = this.getLocalStorage().MallBaseId;;
this.getList();
} }
}; };
</script> </script>
<style> <style>
.navImg{ .navNavIconImg {
width:80px; width: 80px;
height:80px; height: 80px;
} }
.navImg img{
width:100%; .navNavIconImg NavIconImg {
height:100%; width: 100%;
} height: 100%;
.navigation .blue{ }
color:#409EFF;
.navigation .blue {
color: #409EFF;
} }
.navigation .content .searchInput{
.navigation .content .searchInput {
border: 1px solid #DCDFE6; border: 1px solid #DCDFE6;
border-radius: 4px; border-radius: 4px;
} }
.navigation .content .searchInput .el-input__inner{
border:none;outline:none; .navigation .content .searchInput .el-input__inner {
border: none;
outline: none;
height: 30px; height: 30px;
line-height: 30px; line-height: 30px;
} }
.navigation .content .searchInput{
.navigation .content .searchInput {
line-height: normal; line-height: normal;
display: inline-table; display: inline-table;
width: 100%; width: 100%;
border-collapse: separate; border-collapse: separate;
border-spacing: 0; border-spacing: 0;
width:250px; width: 250px;
margin-right: 20px; margin-right: 20px;
} }
.navigation .content{
.navigation .content {
background: #fff; background: #fff;
margin-top:10px; margin-top: 10px;
padding: 20px; padding: 20px;
box-sizing: border-box; box-sizing: border-box;
} }
</style> </style>
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