| @@ -12,23 +12,6 @@ export function about() { | |||
| method: 'get' | |||
| }) | |||
| } | |||
| export function delLunbo(id) { | |||
| return request({ | |||
| url: '/index/delLunbo', | |||
| method: 'post', | |||
| data: { id } | |||
| }) | |||
| } | |||
| /** 广告位1 */ | |||
| export function guanggao1() { | |||
| return request({ | |||
| url: '/aigc/guanggao1', | |||
| method: 'get' | |||
| }) | |||
| } | |||
| export function saveGuangGao(data) { | |||
| return request({ | |||
| url: '/index/saveGuangGao', | |||
| @@ -36,32 +19,10 @@ export function saveGuangGao(data) { | |||
| data | |||
| }) | |||
| } | |||
| /** 广告位2 */ | |||
| export function guanggao2() { | |||
| export function saveMemeber(data) { | |||
| return request({ | |||
| url: '/aigc/guanggao2', | |||
| method: 'get' | |||
| }) | |||
| } | |||
| /** 数字人形象(共用轮播) */ | |||
| export function saveShuziren() { | |||
| return request({ | |||
| url: '/aigc/saveShuziren', | |||
| method: 'get' | |||
| }) | |||
| } | |||
| export function shuzirenremark() { | |||
| return request({ | |||
| url: '/aigc/shuzirenremark', | |||
| method: 'get' | |||
| }) | |||
| } | |||
| /** 数字人视频 */ | |||
| export function videoSave(data) { | |||
| return request({ | |||
| url: '/aigc/videoSave', | |||
| url: '/aboutUs/saveMemeber', | |||
| method: 'post', | |||
| data | |||
| }) | |||
| } | |||
| } | |||
| @@ -69,3 +69,10 @@ export function guanggao2() { | |||
| method: 'get' | |||
| }) | |||
| } | |||
| export function link() { | |||
| return request({ | |||
| url: '/index/link', | |||
| method: 'get' | |||
| }) | |||
| } | |||
| @@ -66,4 +66,4 @@ export function videoSave(data) { | |||
| method: 'post', | |||
| data | |||
| }) | |||
| } | |||
| } | |||
| @@ -15,13 +15,6 @@ export function saveLunbo(data) { | |||
| }) | |||
| } | |||
| export function delLunbo(id) { | |||
| return request({ | |||
| url: '/index/delLunbo', | |||
| method: 'post', | |||
| data: { id } | |||
| }) | |||
| } | |||
| /** 热点新闻配置(是否显示) */ | |||
| export function hotNewsConfig() { | |||
| return request({ | |||
| @@ -89,6 +89,105 @@ export const constantRoutes = [ | |||
| path: 'banner2', | |||
| component: () => import('@/views/homePage/banner2'), | |||
| meta: { title: '广告位2' } | |||
| }, | |||
| { | |||
| path: 'link', | |||
| component: () => import('@/views/homePage/link'), | |||
| meta: { title: '外链' } | |||
| } | |||
| ] | |||
| }, | |||
| { | |||
| path: '/car', | |||
| component: Layout, | |||
| alwaysShow: true, | |||
| redirect: '/car/carousel', | |||
| name: 'car', | |||
| meta: { | |||
| title: '汽车资讯', | |||
| icon: 'nested' | |||
| }, | |||
| children: [ | |||
| { | |||
| path: 'carousel', | |||
| component: () => import('@/views/car/carousel'), | |||
| meta: { title: '轮播' } | |||
| }, | |||
| { | |||
| path: 'news', | |||
| component: () => import('@/views/car/news'), | |||
| meta: { title: '热点新闻配置' } | |||
| }, | |||
| { | |||
| path: 'banner1', | |||
| component: () => import('@/views/car/banner1'), | |||
| meta: { title: '广告位1' } | |||
| }, | |||
| { | |||
| path: 'video', | |||
| component: () => import('@/views/car/video'), | |||
| meta: { title: '视频轮播' } | |||
| }, | |||
| { | |||
| path: 'banner2', | |||
| component: () => import('@/views/car/banner2'), | |||
| meta: { title: '广告位2' } | |||
| } | |||
| ] | |||
| }, | |||
| { | |||
| path: '/yyzrb', | |||
| component: Layout, | |||
| alwaysShow: true, | |||
| redirect: '/yyzrb/carousel', | |||
| name: 'yyzrb', | |||
| meta: { | |||
| title: '元宇宙日爆', | |||
| icon: 'nested' | |||
| }, | |||
| children: [ | |||
| { | |||
| path: 'carousel', | |||
| component: () => import('@/views/yyzrb/carousel'), | |||
| meta: { title: '轮播' } | |||
| }, | |||
| { | |||
| path: 'news', | |||
| component: () => import('@/views/yyzrb/news'), | |||
| meta: { title: '热点新闻配置' } | |||
| }, | |||
| { | |||
| path: 'banner1', | |||
| component: () => import('@/views/yyzrb/banner1'), | |||
| meta: { title: '广告位1' } | |||
| }, | |||
| { | |||
| path: 'banner2', | |||
| component: () => import('@/views/yyzrb/banner2'), | |||
| meta: { title: '广告位2' } | |||
| } | |||
| ] | |||
| }, | |||
| { | |||
| path: '/about', | |||
| component: Layout, | |||
| alwaysShow: true, | |||
| redirect: '/about/company', | |||
| name: 'about', | |||
| meta: { | |||
| title: '关于我们', | |||
| icon: 'nested' | |||
| }, | |||
| children: [ | |||
| { | |||
| path: 'company', | |||
| component: () => import('@/views/about/company'), | |||
| meta: { title: '公司介绍' } | |||
| }, | |||
| { | |||
| path: 'member', | |||
| component: () => import('@/views/about/member'), | |||
| meta: { title: '成员介绍' } | |||
| } | |||
| ] | |||
| } | |||
| @@ -0,0 +1,77 @@ | |||
| <!-- | |||
| * @Date: 2021-07-08 11:02:40 | |||
| * @LastEditTime: 2022-07-27 10:48:43 | |||
| * @Description: 广告位 | |||
| --> | |||
| <template> | |||
| <div class="app-container"> | |||
| <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="130px" class="resetform"> | |||
| <el-form-item label="图片" prop="image"> | |||
| <uploadFile :url.sync="ruleForm.image" type="image" /> | |||
| </el-form-item> | |||
| <el-form-item label="标题" prop="title"> | |||
| <el-input v-model="ruleForm.title"></el-input> | |||
| </el-form-item> | |||
| <el-form-item label="描述" prop="remark"> | |||
| <el-input v-model="ruleForm.remark" type="textarea"></el-input> | |||
| </el-form-item> | |||
| <el-form-item> | |||
| <el-button type="primary" @click="submitForm('ruleForm')">保存</el-button> | |||
| </el-form-item> | |||
| </el-form> | |||
| </div> | |||
| </template> | |||
| <script> | |||
| import { about } from '@/api/about' | |||
| import { saveGuangGao } from '@/api/homePage' | |||
| import uploadFile from '@/components/uploadFile' | |||
| export default { | |||
| components: { | |||
| uploadFile | |||
| }, | |||
| data() { | |||
| return { | |||
| ruleForm: { | |||
| id: '', | |||
| image: '', | |||
| title: '', | |||
| remark: '' | |||
| }, | |||
| rules: { | |||
| image: [ | |||
| { required: true, message: '请上传图片', trigger: 'blur' } | |||
| ] | |||
| } | |||
| } | |||
| }, | |||
| created() { | |||
| this.getData() | |||
| }, | |||
| methods: { | |||
| getData() { | |||
| about().then(res => { | |||
| this.ruleForm.id = res.id | |||
| this.ruleForm.image = res.image | |||
| this.ruleForm.remark = res.remark | |||
| this.ruleForm.title = res.title | |||
| }) | |||
| }, | |||
| submitForm(formName) { | |||
| this.$refs[formName].validate((valid) => { | |||
| if (valid) { | |||
| saveGuangGao(this.ruleForm).then(res => { | |||
| this.$message({ | |||
| message: '操作成功!', | |||
| type: 'success' | |||
| }) | |||
| }) | |||
| } else { | |||
| console.log('error submit!!') | |||
| return false | |||
| } | |||
| }) | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| @@ -0,0 +1,173 @@ | |||
| <!-- | |||
| * @Date: 2021-07-08 11:02:40 | |||
| * @LastEditTime: 2022-07-27 10:48:43 | |||
| * @Description: 列表查询demo | |||
| --> | |||
| <template> | |||
| <div class="app-container"> | |||
| <!--工具栏--> | |||
| <div class="head-container"> | |||
| <!-- <div> | |||
| 搜索 | |||
| <el-input v-model="query.name" prefix-icon="el-icon-search" clearable placeholder="名称" class="filter-item" | |||
| @keyup.enter.native="crud.toQuery" /> | |||
| <rrOperation /> | |||
| </div> --> | |||
| <div> | |||
| <el-button class="filter-item" size="mini" type="primary" icon="el-icon-plus" | |||
| @click="openSave()">新增</el-button> | |||
| </div> | |||
| </div> | |||
| <!--表格渲染--> | |||
| <el-table ref="table" v-loading="crud.loading" :data="crud.data" style="width: 100%;"> | |||
| <el-table-column :show-overflow-tooltip="true" prop="serialNumber" label="序号" /> | |||
| <el-table-column :show-overflow-tooltip="true" prop="image" label="图片"> | |||
| <template slot-scope="scope"> | |||
| <img :src="scope.row.image" width="50px" /> | |||
| </template> | |||
| </el-table-column> | |||
| <el-table-column :show-overflow-tooltip="true" prop="title" label="标题" /> | |||
| <el-table-column :show-overflow-tooltip="true" prop="subTitle" label="副标题" /> | |||
| <el-table-column :show-overflow-tooltip="true" prop="remark" label="描述" /> | |||
| <el-table-column label="操作" width="230" align="center" fixed="right"> | |||
| <template slot-scope="scope" class="btn"> | |||
| <el-button type="text" size="mini" @click="openSave(scope.row)">编辑</el-button> | |||
| <el-popover placement="top" width="200" :ref="`del-${scope.$index}`"> | |||
| <p>是否确认删除该数据?</p> | |||
| <div style="text-align: right; margin: 0"> | |||
| <el-button size="mini" | |||
| @click="scope._self.$refs[`del-${scope.$index}`].doClose()">取消</el-button> | |||
| <el-button type="primary" size="mini" @click="del(scope)">确定</el-button> | |||
| </div> | |||
| <el-button slot="reference" type="text" size="mini" style="margin-left:10px">删除</el-button> | |||
| </el-popover> | |||
| </template> | |||
| </el-table-column> | |||
| </el-table> | |||
| <!--分页组件--> | |||
| <pagination /> | |||
| <!-- 新增修改弹窗 --> | |||
| <el-dialog v-if="dialogVisible" title="轮播" :visible.sync="dialogVisible" append-to-body width="600px"> | |||
| <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="130px" class="resetform"> | |||
| <el-form-item label="图片" prop="image"> | |||
| <uploadFile :url.sync="ruleForm.image" type="image" /> | |||
| </el-form-item> | |||
| <el-form-item label="序号" prop="serialNumber"> | |||
| <el-input v-model="ruleForm.serialNumber" type="number"></el-input> | |||
| </el-form-item> | |||
| <el-form-item label="标题" prop="title"> | |||
| <el-input v-model="ruleForm.title"></el-input> | |||
| </el-form-item> | |||
| <el-form-item label="副标题" prop="subTitle"> | |||
| <el-input v-model="ruleForm.subTitle"></el-input> | |||
| </el-form-item> | |||
| <el-form-item label="描述" prop="remark"> | |||
| <el-input v-model="ruleForm.remark" type="textarea"></el-input> | |||
| </el-form-item>= | |||
| <el-form-item> | |||
| <el-button type="primary" :loading="loadingBtn" @click="submitForm('ruleForm')">立即创建</el-button> | |||
| <el-button @click="resetForm('ruleForm')">重置</el-button> | |||
| </el-form-item> | |||
| </el-form> | |||
| </el-dialog> | |||
| </div> | |||
| </template> | |||
| <script> | |||
| import { delLunbo } from '@/api/homePage' | |||
| import { saveMemeber } from '@/api/about' | |||
| import CRUD, { presenter, header, crud } from '@crud/crud' | |||
| import pagination from '@crud/Pagination' | |||
| import uploadFile from '@/components/uploadFile' | |||
| export default { | |||
| components: { pagination, uploadFile }, | |||
| mixins: [presenter(), header(), crud()], | |||
| data() { | |||
| return { | |||
| dialogVisible: false, | |||
| ruleForm: { | |||
| image: '', | |||
| serialNumber: '', | |||
| title: '', | |||
| subTitle: '', | |||
| remark: '' | |||
| }, | |||
| rules: { | |||
| name: [ | |||
| { required: true, message: '请上传图片', trigger: 'blur' } | |||
| ], | |||
| serialNumber: [ | |||
| { required: true, message: '请输入序号', trigger: 'blur' } | |||
| ], | |||
| title: [ | |||
| { required: true, message: '请输入标题', trigger: 'blur' } | |||
| ], | |||
| subTitle: [ | |||
| { required: true, message: '请输入副标题', trigger: 'blur' } | |||
| ] | |||
| }, | |||
| loadingBtn: false | |||
| } | |||
| }, | |||
| cruds() { | |||
| return CRUD({ title: '列表', url: '/aboutUs/memberList', query: {}}) | |||
| }, | |||
| methods: { | |||
| openSave(item) { | |||
| if (item) { | |||
| this.ruleForm.id = item.id | |||
| this.ruleForm.image = item.image | |||
| this.ruleForm.serialNumber = item.serialNumber | |||
| this.ruleForm.title = item.title | |||
| this.ruleForm.subTitle = item.subTitle | |||
| this.ruleForm.remark = item.remark | |||
| } | |||
| this.dialogVisible = true | |||
| }, | |||
| close(tag) { | |||
| if (tag) this.crud.toQuery() | |||
| this.dialogVisible = false | |||
| }, | |||
| /* 删除 */ | |||
| del(scope) { | |||
| delLunbo(scope.row.id).then(res => { | |||
| this.$message({ | |||
| message: '删除成功!', | |||
| type: 'success' | |||
| }) | |||
| this.crud.toQuery() | |||
| scope._self.$refs[`del-${scope.$index}`].doClose() | |||
| }) | |||
| }, | |||
| submitForm(formName) { | |||
| this.$refs[formName].validate((valid) => { | |||
| if (valid) { | |||
| this.loadingBtn = true | |||
| saveMemeber(this.ruleForm).then(res => { | |||
| this.$message({ | |||
| message: '操作成功!', | |||
| type: 'success' | |||
| }) | |||
| this.loadingBtn = false | |||
| this.dialogVisible = false | |||
| this.$refs[formName].resetFields() | |||
| this.crud.toQuery() | |||
| }).catch(() => { | |||
| this.loadingBtn = false | |||
| }) | |||
| } else { | |||
| console.log('error submit!!') | |||
| return false | |||
| } | |||
| }) | |||
| }, | |||
| resetForm(formName) { | |||
| this.$refs[formName].resetFields() | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| @@ -0,0 +1,83 @@ | |||
| <!-- | |||
| * @Date: 2021-07-08 11:02:40 | |||
| * @LastEditTime: 2022-07-27 10:48:43 | |||
| * @Description: 广告位 | |||
| --> | |||
| <template> | |||
| <div class="app-container"> | |||
| <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="130px" class="resetform"> | |||
| <el-form-item label="图片" prop="image"> | |||
| <uploadFile :url.sync="ruleForm.image" type="image" /> | |||
| </el-form-item> | |||
| <el-form-item label="链接" prop="link"> | |||
| <el-input v-model="ruleForm.link"></el-input> | |||
| </el-form-item> | |||
| <el-form-item label="是否新开页面打开"> | |||
| <el-radio-group v-model="ruleForm.newOpen"> | |||
| <el-radio :label="1">是</el-radio> | |||
| <el-radio :label="0">否</el-radio> | |||
| </el-radio-group> | |||
| </el-form-item> | |||
| <el-form-item> | |||
| <el-button type="primary" @click="submitForm('ruleForm')">保存</el-button> | |||
| </el-form-item> | |||
| </el-form> | |||
| </div> | |||
| </template> | |||
| <script> | |||
| import { guanggao1 } from '@/api/car' | |||
| import { saveGuangGao } from '@/api/homePage' | |||
| import uploadFile from '@/components/uploadFile' | |||
| export default { | |||
| components: { | |||
| uploadFile | |||
| }, | |||
| data() { | |||
| return { | |||
| ruleForm: { | |||
| id: '', | |||
| image: '', | |||
| link: '', | |||
| newOpen: '1' | |||
| }, | |||
| rules: { | |||
| image: [ | |||
| { required: true, message: '请上传图片', trigger: 'blur' } | |||
| ], | |||
| link: [ | |||
| { required: true, message: '请输入链接', trigger: 'blur' } | |||
| ] | |||
| } | |||
| } | |||
| }, | |||
| created() { | |||
| this.getData() | |||
| }, | |||
| methods: { | |||
| getData() { | |||
| guanggao1().then(res => { | |||
| this.ruleForm.id = res.id | |||
| this.ruleForm.image = res.image | |||
| this.ruleForm.link = res.link | |||
| this.ruleForm.newOpen = res.newOpen | |||
| }) | |||
| }, | |||
| submitForm(formName) { | |||
| this.$refs[formName].validate((valid) => { | |||
| if (valid) { | |||
| saveGuangGao(this.ruleForm).then(res => { | |||
| this.$message({ | |||
| message: '操作成功!', | |||
| type: 'success' | |||
| }) | |||
| }) | |||
| } else { | |||
| console.log('error submit!!') | |||
| return false | |||
| } | |||
| }) | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| @@ -0,0 +1,83 @@ | |||
| <!-- | |||
| * @Date: 2021-07-08 11:02:40 | |||
| * @LastEditTime: 2022-07-27 10:48:43 | |||
| * @Description: 广告位 | |||
| --> | |||
| <template> | |||
| <div class="app-container"> | |||
| <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="130px" class="resetform"> | |||
| <el-form-item label="图片" prop="image"> | |||
| <uploadFile :url.sync="ruleForm.image" type="image" /> | |||
| </el-form-item> | |||
| <el-form-item label="链接" prop="link"> | |||
| <el-input v-model="ruleForm.link"></el-input> | |||
| </el-form-item> | |||
| <el-form-item label="是否新开页面打开"> | |||
| <el-radio-group v-model="ruleForm.newOpen"> | |||
| <el-radio :label="1">是</el-radio> | |||
| <el-radio :label="0">否</el-radio> | |||
| </el-radio-group> | |||
| </el-form-item> | |||
| <el-form-item> | |||
| <el-button type="primary" @click="submitForm('ruleForm')">保存</el-button> | |||
| </el-form-item> | |||
| </el-form> | |||
| </div> | |||
| </template> | |||
| <script> | |||
| import { guanggao2 } from '@/api/car' | |||
| import { saveGuangGao } from '@/api/homePage' | |||
| import uploadFile from '@/components/uploadFile' | |||
| export default { | |||
| components: { | |||
| uploadFile | |||
| }, | |||
| data() { | |||
| return { | |||
| ruleForm: { | |||
| id: '', | |||
| image: '', | |||
| link: '', | |||
| newOpen: '1' | |||
| }, | |||
| rules: { | |||
| image: [ | |||
| { required: true, message: '请上传图片', trigger: 'blur' } | |||
| ], | |||
| link: [ | |||
| { required: true, message: '请输入链接', trigger: 'blur' } | |||
| ] | |||
| } | |||
| } | |||
| }, | |||
| created() { | |||
| this.getData() | |||
| }, | |||
| methods: { | |||
| getData() { | |||
| guanggao2().then(res => { | |||
| this.ruleForm.id = res.id | |||
| this.ruleForm.image = res.image | |||
| this.ruleForm.link = res.link | |||
| this.ruleForm.newOpen = res.newOpen | |||
| }) | |||
| }, | |||
| submitForm(formName) { | |||
| this.$refs[formName].validate((valid) => { | |||
| if (valid) { | |||
| saveGuangGao(this.ruleForm).then(res => { | |||
| this.$message({ | |||
| message: '操作成功!', | |||
| type: 'success' | |||
| }) | |||
| }) | |||
| } else { | |||
| console.log('error submit!!') | |||
| return false | |||
| } | |||
| }) | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| @@ -0,0 +1,176 @@ | |||
| <!-- | |||
| * @Date: 2021-07-08 11:02:40 | |||
| * @LastEditTime: 2022-07-27 10:48:43 | |||
| * @Description: 列表查询demo | |||
| --> | |||
| <template> | |||
| <div class="app-container"> | |||
| <!--工具栏--> | |||
| <div class="head-container"> | |||
| <!-- <div> | |||
| 搜索 | |||
| <el-input v-model="query.name" prefix-icon="el-icon-search" clearable placeholder="名称" class="filter-item" | |||
| @keyup.enter.native="crud.toQuery" /> | |||
| <rrOperation /> | |||
| </div> --> | |||
| <div> | |||
| <el-button class="filter-item" size="mini" type="primary" icon="el-icon-plus" | |||
| @click="openSave()">新增</el-button> | |||
| </div> | |||
| </div> | |||
| <!--表格渲染--> | |||
| <el-table ref="table" v-loading="crud.loading" :data="crud.data" style="width: 100%;"> | |||
| <el-table-column :show-overflow-tooltip="true" prop="serialNumber" label="序号" /> | |||
| <el-table-column :show-overflow-tooltip="true" prop="image" label="图片"> | |||
| <template slot-scope="scope"> | |||
| <img :src="scope.row.image" width="50px" /> | |||
| </template> | |||
| </el-table-column> | |||
| <el-table-column :show-overflow-tooltip="true" prop="link" label="链接" /> | |||
| <el-table-column :show-overflow-tooltip="true" align="center" prop="newOpen" label="是否新开页面打开"> | |||
| <template slot-scope="scope"> | |||
| {{ scope.row.newOpen === 1 ? '是' : '否' }} | |||
| </template> | |||
| </el-table-column> | |||
| <el-table-column label="操作" width="230" align="center" fixed="right"> | |||
| <template slot-scope="scope" class="btn"> | |||
| <el-button type="text" size="mini" @click="openSave(scope.row)">编辑</el-button> | |||
| <el-popover placement="top" width="200" :ref="`del-${scope.$index}`"> | |||
| <p>是否确认删除该数据?</p> | |||
| <div style="text-align: right; margin: 0"> | |||
| <el-button size="mini" | |||
| @click="scope._self.$refs[`del-${scope.$index}`].doClose()">取消</el-button> | |||
| <el-button type="primary" size="mini" @click="del(scope)">确定</el-button> | |||
| </div> | |||
| <el-button slot="reference" type="text" size="mini" style="margin-left:10px">删除</el-button> | |||
| </el-popover> | |||
| </template> | |||
| </el-table-column> | |||
| </el-table> | |||
| <!--分页组件--> | |||
| <pagination /> | |||
| <!-- 新增修改弹窗 --> | |||
| <el-dialog v-if="dialogVisible" title="轮播" :visible.sync="dialogVisible" append-to-body width="600px"> | |||
| <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="130px" class="resetform"> | |||
| <el-form-item label="图片" prop="image"> | |||
| <uploadFile :url.sync="ruleForm.image" type="image" /> | |||
| </el-form-item> | |||
| <el-form-item label="序号" prop="serialNumber"> | |||
| <el-input v-model="ruleForm.serialNumber"></el-input> | |||
| </el-form-item> | |||
| <el-form-item label="链接" prop="link"> | |||
| <el-input v-model="ruleForm.link"></el-input> | |||
| </el-form-item> | |||
| <el-form-item label="是否新开页面打开"> | |||
| <el-radio-group v-model="ruleForm.newOpen"> | |||
| <el-radio label="1">是</el-radio> | |||
| <el-radio label="0">否</el-radio> | |||
| </el-radio-group> | |||
| </el-form-item> | |||
| <el-form-item> | |||
| <el-button type="primary" :loading="loadingBtn" @click="submitForm('ruleForm')">立即创建</el-button> | |||
| <el-button @click="resetForm('ruleForm')">重置</el-button> | |||
| </el-form-item> | |||
| </el-form> | |||
| </el-dialog> | |||
| </div> | |||
| </template> | |||
| <script> | |||
| import { delLunbo } from '@/api/homePage' | |||
| import { saveLunbo } from '@/api/car' | |||
| import CRUD, { presenter, header, crud } from '@crud/crud' | |||
| import pagination from '@crud/Pagination' | |||
| import uploadFile from '@/components/uploadFile' | |||
| export default { | |||
| components: { pagination, uploadFile }, | |||
| mixins: [presenter(), header(), crud()], | |||
| data() { | |||
| return { | |||
| releaseSourceList: [], | |||
| dialogVisible: false, | |||
| id: '', | |||
| ruleForm: { | |||
| image: '', | |||
| serialNumber: '', | |||
| link: [], | |||
| newOpen: '1' | |||
| }, | |||
| rules: { | |||
| name: [ | |||
| { required: true, message: '请上传图片', trigger: 'blur' } | |||
| ], | |||
| serialNumber: [ | |||
| { required: true, message: '请输入序号', trigger: 'blur' } | |||
| ], | |||
| link: [ | |||
| { required: true, message: '请输入链接', trigger: 'blur' } | |||
| ], | |||
| desc: [ | |||
| { required: true, message: '请填写活动形式', trigger: 'blur' } | |||
| ] | |||
| }, | |||
| loadingBtn: false | |||
| } | |||
| }, | |||
| cruds() { | |||
| return CRUD({ title: '列表', url: '/car/lunboList', query: {}}) | |||
| }, | |||
| methods: { | |||
| openSave(item) { | |||
| if (item) { | |||
| this.ruleForm.id = item.id | |||
| this.ruleForm.image = item.image | |||
| this.ruleForm.serialNumber = item.serialNumber | |||
| this.ruleForm.link = item.link | |||
| this.ruleForm.newOpen = item.newOpen || '1' | |||
| } | |||
| this.dialogVisible = true | |||
| }, | |||
| close(tag) { | |||
| if (tag) this.crud.toQuery() | |||
| this.dialogVisible = false | |||
| }, | |||
| /* 删除 */ | |||
| del(scope) { | |||
| delLunbo(scope.row.id).then(res => { | |||
| this.$message({ | |||
| message: '删除成功!', | |||
| type: 'success' | |||
| }) | |||
| this.crud.toQuery() | |||
| scope._self.$refs[`del-${scope.$index}`].doClose() | |||
| }) | |||
| }, | |||
| submitForm(formName) { | |||
| this.$refs[formName].validate((valid) => { | |||
| if (valid) { | |||
| this.loadingBtn = true | |||
| saveLunbo(this.ruleForm).then(res => { | |||
| this.$message({ | |||
| message: '操作成功!', | |||
| type: 'success' | |||
| }) | |||
| this.loadingBtn = false | |||
| this.dialogVisible = false | |||
| this.$refs[formName].resetFields() | |||
| this.crud.toQuery() | |||
| }).catch(() => { | |||
| this.loadingBtn = false | |||
| }) | |||
| } else { | |||
| console.log('error submit!!') | |||
| return false | |||
| } | |||
| }) | |||
| }, | |||
| resetForm(formName) { | |||
| this.$refs[formName].resetFields() | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| @@ -0,0 +1,60 @@ | |||
| <!-- | |||
| * @Date: 2021-07-08 11:02:40 | |||
| * @LastEditTime: 2022-07-27 10:48:43 | |||
| * @Description: 广告位 | |||
| --> | |||
| <template> | |||
| <div class="app-container"> | |||
| <el-form :model="ruleForm" ref="ruleForm" label-width="130px" class="resetform"> | |||
| <el-form-item label="是否显示"> | |||
| <el-radio-group v-model="ruleForm.display"> | |||
| <el-radio :label="1">是</el-radio> | |||
| <el-radio :label="0">否</el-radio> | |||
| </el-radio-group> | |||
| </el-form-item> | |||
| <el-form-item> | |||
| <el-button type="primary" @click="submitForm('ruleForm')">保存</el-button> | |||
| </el-form-item> | |||
| </el-form> | |||
| </div> | |||
| </template> | |||
| <script> | |||
| import { hotNewsConfig, saveHotNewsConfig } from '@/api/car' | |||
| export default { | |||
| data() { | |||
| return { | |||
| ruleForm: { | |||
| display: '', | |||
| id: '' | |||
| } | |||
| } | |||
| }, | |||
| created() { | |||
| this.getData() | |||
| }, | |||
| methods: { | |||
| getData() { | |||
| hotNewsConfig().then(res => { | |||
| this.ruleForm.id = res.id | |||
| this.ruleForm.display = res.display | |||
| }) | |||
| }, | |||
| submitForm(formName) { | |||
| this.$refs[formName].validate((valid) => { | |||
| if (valid) { | |||
| saveHotNewsConfig(this.ruleForm).then(res => { | |||
| this.$message({ | |||
| message: '操作成功!', | |||
| type: 'success' | |||
| }) | |||
| }) | |||
| } else { | |||
| console.log('error submit!!') | |||
| return false | |||
| } | |||
| }) | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| @@ -0,0 +1,146 @@ | |||
| <!-- | |||
| * @Date: 2021-07-08 11:02:40 | |||
| * @LastEditTime: 2022-07-27 10:48:43 | |||
| * @Description: 列表查询demo | |||
| --> | |||
| <template> | |||
| <div class="app-container"> | |||
| <!--工具栏--> | |||
| <div class="head-container"> | |||
| <!-- <div> | |||
| 搜索 | |||
| <el-input v-model="query.name" prefix-icon="el-icon-search" clearable placeholder="名称" class="filter-item" | |||
| @keyup.enter.native="crud.toQuery" /> | |||
| <rrOperation /> | |||
| </div> --> | |||
| <div> | |||
| <el-button class="filter-item" size="mini" type="primary" icon="el-icon-plus" | |||
| @click="openSave()">新增</el-button> | |||
| </div> | |||
| </div> | |||
| <!--表格渲染--> | |||
| <el-table ref="table" v-loading="crud.loading" :data="crud.data" style="width: 100%;"> | |||
| <el-table-column :show-overflow-tooltip="true" prop="serialNumber" label="序号" /> | |||
| <el-table-column :show-overflow-tooltip="true" prop="image" label="图片"> | |||
| <template slot-scope="scope"> | |||
| <img :src="scope.row.image" width="50px" /> | |||
| </template> | |||
| </el-table-column> | |||
| <el-table-column :show-overflow-tooltip="true" prop="link" label="链接" /> | |||
| <el-table-column :show-overflow-tooltip="true" prop="title" label="标题" /> | |||
| <el-table-column label="操作" width="230" align="center" fixed="right"> | |||
| <template slot-scope="scope" class="btn"> | |||
| <el-button type="text" size="mini" @click="openSave(scope.row)">编辑</el-button> | |||
| </template> | |||
| </el-table-column> | |||
| </el-table> | |||
| <!--分页组件--> | |||
| <pagination /> | |||
| <!-- 新增修改弹窗 --> | |||
| <el-dialog v-if="dialogVisible" title="轮播" :visible.sync="dialogVisible" append-to-body width="600px"> | |||
| <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="130px" class="resetform"> | |||
| <el-form-item label="图片" prop="image"> | |||
| <uploadFile :url.sync="ruleForm.image" type="image" /> | |||
| </el-form-item> | |||
| <el-form-item label="序号" prop="serialNumber"> | |||
| <el-input v-model="ruleForm.serialNumber"></el-input> | |||
| </el-form-item> | |||
| <el-form-item label="链接" prop="link"> | |||
| <el-input v-model="ruleForm.link"></el-input> | |||
| </el-form-item> | |||
| <el-form-item label="标题" prop="title"> | |||
| <el-input v-model="ruleForm.title"></el-input> | |||
| </el-form-item> | |||
| <el-form-item> | |||
| <el-button type="primary" :loading="loadingBtn" @click="submitForm('ruleForm')">立即创建</el-button> | |||
| <el-button @click="resetForm('ruleForm')">重置</el-button> | |||
| </el-form-item> | |||
| </el-form> | |||
| </el-dialog> | |||
| </div> | |||
| </template> | |||
| <script> | |||
| import { videoSave } from '@/api/car' | |||
| import CRUD, { presenter, header, crud } from '@crud/crud' | |||
| import pagination from '@crud/Pagination' | |||
| import uploadFile from '@/components/uploadFile' | |||
| export default { | |||
| components: { pagination, uploadFile }, | |||
| mixins: [presenter(), header(), crud()], | |||
| data() { | |||
| return { | |||
| dialogVisible: false, | |||
| id: '', | |||
| ruleForm: { | |||
| image: '', | |||
| serialNumber: '', | |||
| link: '', | |||
| title: '' | |||
| }, | |||
| rules: { | |||
| image: [ | |||
| { required: true, message: '请上传图片', trigger: 'blur' } | |||
| ], | |||
| serialNumber: [ | |||
| { required: true, message: '请输入序号', trigger: 'blur' } | |||
| ], | |||
| link: [ | |||
| { required: true, message: '请输入链接', trigger: 'blur' } | |||
| ], | |||
| title: [ | |||
| { required: true, message: '请填写标题', trigger: 'blur' } | |||
| ] | |||
| }, | |||
| loadingBtn: false | |||
| } | |||
| }, | |||
| cruds() { | |||
| return CRUD({ title: '列表', url: '/car/videoList', query: {}}) | |||
| }, | |||
| methods: { | |||
| openSave(item) { | |||
| if (item) { | |||
| this.ruleForm.id = item.id | |||
| this.ruleForm.image = item.image | |||
| this.ruleForm.serialNumber = item.serialNumber | |||
| this.ruleForm.link = item.link | |||
| this.ruleForm.title = item.title | |||
| } | |||
| this.dialogVisible = true | |||
| }, | |||
| close(tag) { | |||
| if (tag) this.crud.toQuery() | |||
| this.dialogVisible = false | |||
| }, | |||
| submitForm(formName) { | |||
| this.$refs[formName].validate((valid) => { | |||
| if (valid) { | |||
| this.loadingBtn = true | |||
| videoSave(this.ruleForm).then(res => { | |||
| this.$message({ | |||
| message: '操作成功!', | |||
| type: 'success' | |||
| }) | |||
| this.loadingBtn = false | |||
| this.dialogVisible = false | |||
| this.$refs[formName].resetFields() | |||
| this.crud.toQuery() | |||
| }).catch(() => { | |||
| this.loadingBtn = false | |||
| }) | |||
| } else { | |||
| console.log('error submit!!') | |||
| return false | |||
| } | |||
| }) | |||
| }, | |||
| resetForm(formName) { | |||
| this.$refs[formName].resetFields() | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| @@ -4,30 +4,8 @@ | |||
| * @Description: 广告位 | |||
| --> | |||
| <template> | |||
| <div class="app-container"> | |||
| <!--表格渲染--> | |||
| <el-table :data="data" style="width: 100%;"> | |||
| <el-table-column :show-overflow-tooltip="true" align="center" prop="link" label="链接" /> | |||
| <el-table-column :show-overflow-tooltip="true" align="center" prop="image" label="图片"> | |||
| <template slot-scope="scope"> | |||
| <img :src="scope.row.image" width="50px" /> | |||
| </template> | |||
| </el-table-column> | |||
| <el-table-column :show-overflow-tooltip="true" align="center" prop="newOpen" label="是否新开页面打开"> | |||
| <template slot-scope="scope"> | |||
| {{ scope.row.newOpen === 1 ? '是' : '否' }} | |||
| </template> | |||
| </el-table-column> | |||
| <el-table-column label="操作" width="230" align="center" fixed="right"> | |||
| <template slot-scope="scope" class="btn"> | |||
| <el-button type="text" size="mini" @click="openSave(scope.row)">编辑</el-button> | |||
| </template> | |||
| </el-table-column> | |||
| </el-table> | |||
| <!-- 新增修改弹窗 --> | |||
| <el-dialog v-if="dialogVisible" title="轮播" :visible.sync="dialogVisible" append-to-body width="600px"> | |||
| <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="130px" class="resetform"> | |||
| <div class="app-container"> | |||
| <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="130px" class="resetform"> | |||
| <el-form-item label="图片" prop="image"> | |||
| <uploadFile :url.sync="ruleForm.image" type="image" /> | |||
| </el-form-item> | |||
| @@ -41,11 +19,9 @@ | |||
| </el-radio-group> | |||
| </el-form-item> | |||
| <el-form-item> | |||
| <el-button type="primary" @click="submitForm('ruleForm')">立即创建</el-button> | |||
| <el-button @click="dialogVisible = false">取消</el-button> | |||
| <el-button type="primary" @click="submitForm('ruleForm')">保存</el-button> | |||
| </el-form-item> | |||
| </el-form> | |||
| </el-dialog> | |||
| </div> | |||
| </template> | |||
| <script> | |||
| @@ -58,9 +34,6 @@ export default { | |||
| }, | |||
| data() { | |||
| return { | |||
| dialogVisible: false, | |||
| id: '', | |||
| data: [], | |||
| ruleForm: { | |||
| id: '', | |||
| image: '', | |||
| @@ -83,16 +56,12 @@ export default { | |||
| methods: { | |||
| getData() { | |||
| guanggao1().then(res => { | |||
| this.data = [res] | |||
| this.ruleForm.id = res.id | |||
| this.ruleForm.image = res.image | |||
| this.ruleForm.link = res.link | |||
| this.ruleForm.newOpen = res.newOpen | |||
| }) | |||
| }, | |||
| openSave(item) { | |||
| this.ruleForm.id = item.id | |||
| this.ruleForm.image = item.image | |||
| this.ruleForm.link = item.link | |||
| this.ruleForm.newOpen = item.newOpen | |||
| this.dialogVisible = true | |||
| }, | |||
| submitForm(formName) { | |||
| this.$refs[formName].validate((valid) => { | |||
| if (valid) { | |||
| @@ -101,8 +70,6 @@ export default { | |||
| message: '操作成功!', | |||
| type: 'success' | |||
| }) | |||
| this.getData() | |||
| this.dialogVisible = false | |||
| }) | |||
| } else { | |||
| console.log('error submit!!') | |||
| @@ -5,29 +5,7 @@ | |||
| --> | |||
| <template> | |||
| <div class="app-container"> | |||
| <!--表格渲染--> | |||
| <el-table :data="data" style="width: 100%;"> | |||
| <el-table-column :show-overflow-tooltip="true" align="center" prop="link" label="链接" /> | |||
| <el-table-column :show-overflow-tooltip="true" align="center" prop="image" label="图片"> | |||
| <template slot-scope="scope"> | |||
| <img :src="scope.row.image" width="50px" /> | |||
| </template> | |||
| </el-table-column> | |||
| <el-table-column :show-overflow-tooltip="true" align="center" prop="newOpen" label="是否新开页面打开"> | |||
| <template slot-scope="scope"> | |||
| {{ scope.row.newOpen === 1 ? '是' : '否' }} | |||
| </template> | |||
| </el-table-column> | |||
| <el-table-column label="操作" width="230" align="center" fixed="right"> | |||
| <template slot-scope="scope" class="btn"> | |||
| <el-button type="text" size="mini" @click="openSave(scope.row)">编辑</el-button> | |||
| </template> | |||
| </el-table-column> | |||
| </el-table> | |||
| <!-- 新增修改弹窗 --> | |||
| <el-dialog v-if="dialogVisible" title="轮播" :visible.sync="dialogVisible" append-to-body width="600px"> | |||
| <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="130px" class="resetform"> | |||
| <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="130px" class="resetform"> | |||
| <el-form-item label="图片" prop="image"> | |||
| <uploadFile :url.sync="ruleForm.image" type="image" /> | |||
| </el-form-item> | |||
| @@ -41,11 +19,9 @@ | |||
| </el-radio-group> | |||
| </el-form-item> | |||
| <el-form-item> | |||
| <el-button type="primary" @click="submitForm('ruleForm')">立即创建</el-button> | |||
| <el-button @click="dialogVisible = false">取消</el-button> | |||
| <el-button type="primary" @click="submitForm('ruleForm')">保存</el-button> | |||
| </el-form-item> | |||
| </el-form> | |||
| </el-dialog> | |||
| </el-form> | |||
| </div> | |||
| </template> | |||
| <script> | |||
| @@ -58,9 +34,6 @@ export default { | |||
| }, | |||
| data() { | |||
| return { | |||
| dialogVisible: false, | |||
| id: '', | |||
| data: [], | |||
| ruleForm: { | |||
| id: '', | |||
| image: '', | |||
| @@ -83,16 +56,12 @@ export default { | |||
| methods: { | |||
| getData() { | |||
| guanggao2().then(res => { | |||
| this.data = [res] | |||
| this.ruleForm.id = res.id | |||
| this.ruleForm.image = res.image | |||
| this.ruleForm.link = res.link | |||
| this.ruleForm.newOpen = res.newOpen | |||
| }) | |||
| }, | |||
| openSave(item) { | |||
| this.ruleForm.id = item.id | |||
| this.ruleForm.image = item.image | |||
| this.ruleForm.link = item.link | |||
| this.ruleForm.newOpen = item.newOpen | |||
| this.dialogVisible = true | |||
| }, | |||
| submitForm(formName) { | |||
| this.$refs[formName].validate((valid) => { | |||
| if (valid) { | |||
| @@ -101,8 +70,6 @@ export default { | |||
| message: '操作成功!', | |||
| type: 'success' | |||
| }) | |||
| this.getData() | |||
| this.dialogVisible = false | |||
| }) | |||
| } else { | |||
| console.log('error submit!!') | |||
| @@ -29,7 +29,11 @@ | |||
| </template> | |||
| </el-table-column> | |||
| <el-table-column :show-overflow-tooltip="true" prop="link" label="链接" /> | |||
| <el-table-column :show-overflow-tooltip="true" prop="createDate" label="创建时间" /> | |||
| <el-table-column :show-overflow-tooltip="true" align="center" prop="newOpen" label="是否新开页面打开"> | |||
| <template slot-scope="scope"> | |||
| {{ scope.row.newOpen === 1 ? '是' : '否' }} | |||
| </template> | |||
| </el-table-column> | |||
| <el-table-column label="操作" width="230" align="center" fixed="right"> | |||
| <template slot-scope="scope" class="btn"> | |||
| <el-button type="text" size="mini" @click="openSave(scope.row)">编辑</el-button> | |||
| @@ -0,0 +1,82 @@ | |||
| <!-- | |||
| * @Date: 2021-07-08 11:02:40 | |||
| * @LastEditTime: 2022-07-27 10:48:43 | |||
| * @Description: 广告位 | |||
| --> | |||
| <template> | |||
| <div class="app-container"> | |||
| <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="130px" class="resetform"> | |||
| <el-form-item label="图片" prop="image"> | |||
| <uploadFile :url.sync="ruleForm.image" type="image" /> | |||
| </el-form-item> | |||
| <el-form-item label="链接" prop="link"> | |||
| <el-input v-model="ruleForm.link"></el-input> | |||
| </el-form-item> | |||
| <el-form-item label="是否新开页面打开"> | |||
| <el-radio-group v-model="ruleForm.newOpen"> | |||
| <el-radio :label="1">是</el-radio> | |||
| <el-radio :label="0">否</el-radio> | |||
| </el-radio-group> | |||
| </el-form-item> | |||
| <el-form-item> | |||
| <el-button type="primary" @click="submitForm('ruleForm')">保存</el-button> | |||
| </el-form-item> | |||
| </el-form> | |||
| </div> | |||
| </template> | |||
| <script> | |||
| import { link, saveGuangGao } from '@/api/homePage' | |||
| import uploadFile from '@/components/uploadFile' | |||
| export default { | |||
| components: { | |||
| uploadFile | |||
| }, | |||
| data() { | |||
| return { | |||
| ruleForm: { | |||
| id: '', | |||
| image: '', | |||
| link: '', | |||
| newOpen: '1' | |||
| }, | |||
| rules: { | |||
| image: [ | |||
| { required: true, message: '请上传图片', trigger: 'blur' } | |||
| ], | |||
| link: [ | |||
| { required: true, message: '请输入链接', trigger: 'blur' } | |||
| ] | |||
| } | |||
| } | |||
| }, | |||
| created() { | |||
| this.getData() | |||
| }, | |||
| methods: { | |||
| getData() { | |||
| link().then(res => { | |||
| this.ruleForm.id = res.id | |||
| this.ruleForm.image = res.image | |||
| this.ruleForm.link = res.link | |||
| this.ruleForm.newOpen = res.newOpen | |||
| }) | |||
| }, | |||
| submitForm(formName) { | |||
| this.$refs[formName].validate((valid) => { | |||
| if (valid) { | |||
| saveGuangGao(this.ruleForm).then(res => { | |||
| this.$message({ | |||
| message: '操作成功!', | |||
| type: 'success' | |||
| }) | |||
| }) | |||
| } else { | |||
| console.log('error submit!!') | |||
| return false | |||
| } | |||
| }) | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| @@ -0,0 +1,83 @@ | |||
| <!-- | |||
| * @Date: 2021-07-08 11:02:40 | |||
| * @LastEditTime: 2022-07-27 10:48:43 | |||
| * @Description: 广告位 | |||
| --> | |||
| <template> | |||
| <div class="app-container"> | |||
| <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="130px" class="resetform"> | |||
| <el-form-item label="图片" prop="image"> | |||
| <uploadFile :url.sync="ruleForm.image" type="image" /> | |||
| </el-form-item> | |||
| <el-form-item label="链接" prop="link"> | |||
| <el-input v-model="ruleForm.link"></el-input> | |||
| </el-form-item> | |||
| <el-form-item label="是否新开页面打开"> | |||
| <el-radio-group v-model="ruleForm.newOpen"> | |||
| <el-radio :label="1">是</el-radio> | |||
| <el-radio :label="0">否</el-radio> | |||
| </el-radio-group> | |||
| </el-form-item> | |||
| <el-form-item> | |||
| <el-button type="primary" @click="submitForm('ruleForm')">保存</el-button> | |||
| </el-form-item> | |||
| </el-form> | |||
| </div> | |||
| </template> | |||
| <script> | |||
| import { guanggao1 } from '@/api/yyzrb' | |||
| import { saveGuangGao } from '@/api/homePage' | |||
| import uploadFile from '@/components/uploadFile' | |||
| export default { | |||
| components: { | |||
| uploadFile | |||
| }, | |||
| data() { | |||
| return { | |||
| ruleForm: { | |||
| id: '', | |||
| image: '', | |||
| link: '', | |||
| newOpen: '1' | |||
| }, | |||
| rules: { | |||
| image: [ | |||
| { required: true, message: '请上传图片', trigger: 'blur' } | |||
| ], | |||
| link: [ | |||
| { required: true, message: '请输入链接', trigger: 'blur' } | |||
| ] | |||
| } | |||
| } | |||
| }, | |||
| created() { | |||
| this.getData() | |||
| }, | |||
| methods: { | |||
| getData() { | |||
| guanggao1().then(res => { | |||
| this.ruleForm.id = res.id | |||
| this.ruleForm.image = res.image | |||
| this.ruleForm.link = res.link | |||
| this.ruleForm.newOpen = res.newOpen | |||
| }) | |||
| }, | |||
| submitForm(formName) { | |||
| this.$refs[formName].validate((valid) => { | |||
| if (valid) { | |||
| saveGuangGao(this.ruleForm).then(res => { | |||
| this.$message({ | |||
| message: '操作成功!', | |||
| type: 'success' | |||
| }) | |||
| }) | |||
| } else { | |||
| console.log('error submit!!') | |||
| return false | |||
| } | |||
| }) | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| @@ -0,0 +1,83 @@ | |||
| <!-- | |||
| * @Date: 2021-07-08 11:02:40 | |||
| * @LastEditTime: 2022-07-27 10:48:43 | |||
| * @Description: 广告位 | |||
| --> | |||
| <template> | |||
| <div class="app-container"> | |||
| <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="130px" class="resetform"> | |||
| <el-form-item label="图片" prop="image"> | |||
| <uploadFile :url.sync="ruleForm.image" type="image" /> | |||
| </el-form-item> | |||
| <el-form-item label="链接" prop="link"> | |||
| <el-input v-model="ruleForm.link"></el-input> | |||
| </el-form-item> | |||
| <el-form-item label="是否新开页面打开"> | |||
| <el-radio-group v-model="ruleForm.newOpen"> | |||
| <el-radio :label="1">是</el-radio> | |||
| <el-radio :label="0">否</el-radio> | |||
| </el-radio-group> | |||
| </el-form-item> | |||
| <el-form-item> | |||
| <el-button type="primary" @click="submitForm('ruleForm')">保存</el-button> | |||
| </el-form-item> | |||
| </el-form> | |||
| </div> | |||
| </template> | |||
| <script> | |||
| import { guanggao2 } from '@/api/yyzrb' | |||
| import { saveGuangGao } from '@/api/homePage' | |||
| import uploadFile from '@/components/uploadFile' | |||
| export default { | |||
| components: { | |||
| uploadFile | |||
| }, | |||
| data() { | |||
| return { | |||
| ruleForm: { | |||
| id: '', | |||
| image: '', | |||
| link: '', | |||
| newOpen: '1' | |||
| }, | |||
| rules: { | |||
| image: [ | |||
| { required: true, message: '请上传图片', trigger: 'blur' } | |||
| ], | |||
| link: [ | |||
| { required: true, message: '请输入链接', trigger: 'blur' } | |||
| ] | |||
| } | |||
| } | |||
| }, | |||
| created() { | |||
| this.getData() | |||
| }, | |||
| methods: { | |||
| getData() { | |||
| guanggao2().then(res => { | |||
| this.ruleForm.id = res.id | |||
| this.ruleForm.image = res.image | |||
| this.ruleForm.link = res.link | |||
| this.ruleForm.newOpen = res.newOpen | |||
| }) | |||
| }, | |||
| submitForm(formName) { | |||
| this.$refs[formName].validate((valid) => { | |||
| if (valid) { | |||
| saveGuangGao(this.ruleForm).then(res => { | |||
| this.$message({ | |||
| message: '操作成功!', | |||
| type: 'success' | |||
| }) | |||
| }) | |||
| } else { | |||
| console.log('error submit!!') | |||
| return false | |||
| } | |||
| }) | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| @@ -0,0 +1,174 @@ | |||
| <!-- | |||
| * @Date: 2021-07-08 11:02:40 | |||
| * @LastEditTime: 2022-07-27 10:48:43 | |||
| * @Description: 列表查询demo | |||
| --> | |||
| <template> | |||
| <div class="app-container"> | |||
| <!--工具栏--> | |||
| <div class="head-container"> | |||
| <!-- <div> | |||
| 搜索 | |||
| <el-input v-model="query.name" prefix-icon="el-icon-search" clearable placeholder="名称" class="filter-item" | |||
| @keyup.enter.native="crud.toQuery" /> | |||
| <rrOperation /> | |||
| </div> --> | |||
| <div> | |||
| <el-button class="filter-item" size="mini" type="primary" icon="el-icon-plus" | |||
| @click="openSave()">新增</el-button> | |||
| </div> | |||
| </div> | |||
| <!--表格渲染--> | |||
| <el-table ref="table" v-loading="crud.loading" :data="crud.data" style="width: 100%;"> | |||
| <el-table-column :show-overflow-tooltip="true" prop="serialNumber" label="序号" /> | |||
| <el-table-column :show-overflow-tooltip="true" prop="image" label="图片"> | |||
| <template slot-scope="scope"> | |||
| <img :src="scope.row.image" width="50px" /> | |||
| </template> | |||
| </el-table-column> | |||
| <el-table-column :show-overflow-tooltip="true" prop="link" label="链接" /> | |||
| <el-table-column :show-overflow-tooltip="true" align="center" prop="newOpen" label="是否新开页面打开"> | |||
| <template slot-scope="scope"> | |||
| {{ scope.row.newOpen === 1 ? '是' : '否' }} | |||
| </template> | |||
| </el-table-column> | |||
| <el-table-column label="操作" width="230" align="center" fixed="right"> | |||
| <template slot-scope="scope" class="btn"> | |||
| <el-button type="text" size="mini" @click="openSave(scope.row)">编辑</el-button> | |||
| <el-popover placement="top" width="200" :ref="`del-${scope.$index}`"> | |||
| <p>是否确认删除该数据?</p> | |||
| <div style="text-align: right; margin: 0"> | |||
| <el-button size="mini" | |||
| @click="scope._self.$refs[`del-${scope.$index}`].doClose()">取消</el-button> | |||
| <el-button type="primary" size="mini" @click="del(scope)">确定</el-button> | |||
| </div> | |||
| <el-button slot="reference" type="text" size="mini" style="margin-left:10px">删除</el-button> | |||
| </el-popover> | |||
| </template> | |||
| </el-table-column> | |||
| </el-table> | |||
| <!--分页组件--> | |||
| <pagination /> | |||
| <!-- 新增修改弹窗 --> | |||
| <el-dialog v-if="dialogVisible" title="轮播" :visible.sync="dialogVisible" append-to-body width="600px"> | |||
| <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="130px" class="resetform"> | |||
| <el-form-item label="图片" prop="image"> | |||
| <uploadFile :url.sync="ruleForm.image" type="image" /> | |||
| </el-form-item> | |||
| <el-form-item label="序号" prop="serialNumber"> | |||
| <el-input v-model="ruleForm.serialNumber"></el-input> | |||
| </el-form-item> | |||
| <el-form-item label="链接" prop="link"> | |||
| <el-input v-model="ruleForm.link"></el-input> | |||
| </el-form-item> | |||
| <el-form-item label="是否新开页面打开"> | |||
| <el-radio-group v-model="ruleForm.newOpen"> | |||
| <el-radio label="1">是</el-radio> | |||
| <el-radio label="0">否</el-radio> | |||
| </el-radio-group> | |||
| </el-form-item> | |||
| <el-form-item> | |||
| <el-button type="primary" :loading="loadingBtn" @click="submitForm('ruleForm')">立即创建</el-button> | |||
| <el-button @click="resetForm('ruleForm')">重置</el-button> | |||
| </el-form-item> | |||
| </el-form> | |||
| </el-dialog> | |||
| </div> | |||
| </template> | |||
| <script> | |||
| import { delLunbo } from '@/api/homePage' | |||
| import { saveLunbo } from '@/api/yyzrb' | |||
| import CRUD, { presenter, header, crud } from '@crud/crud' | |||
| import pagination from '@crud/Pagination' | |||
| import uploadFile from '@/components/uploadFile' | |||
| export default { | |||
| components: { pagination, uploadFile }, | |||
| mixins: [presenter(), header(), crud()], | |||
| data() { | |||
| return { | |||
| dialogVisible: false, | |||
| ruleForm: { | |||
| image: '', | |||
| serialNumber: '', | |||
| link: [], | |||
| newOpen: '1' | |||
| }, | |||
| rules: { | |||
| name: [ | |||
| { required: true, message: '请上传图片', trigger: 'blur' } | |||
| ], | |||
| serialNumber: [ | |||
| { required: true, message: '请输入序号', trigger: 'blur' } | |||
| ], | |||
| link: [ | |||
| { required: true, message: '请输入链接', trigger: 'blur' } | |||
| ], | |||
| desc: [ | |||
| { required: true, message: '请填写活动形式', trigger: 'blur' } | |||
| ] | |||
| }, | |||
| loadingBtn: false | |||
| } | |||
| }, | |||
| cruds() { | |||
| return CRUD({ title: '列表', url: '/yuanyuzhou/lunboList', query: {}}) | |||
| }, | |||
| methods: { | |||
| openSave(item) { | |||
| if (item) { | |||
| this.ruleForm.id = item.id | |||
| this.ruleForm.image = item.image | |||
| this.ruleForm.serialNumber = item.serialNumber | |||
| this.ruleForm.link = item.link | |||
| this.ruleForm.newOpen = item.newOpen || '1' | |||
| } | |||
| this.dialogVisible = true | |||
| }, | |||
| close(tag) { | |||
| if (tag) this.crud.toQuery() | |||
| this.dialogVisible = false | |||
| }, | |||
| /* 删除 */ | |||
| del(scope) { | |||
| delLunbo(scope.row.id).then(res => { | |||
| this.$message({ | |||
| message: '删除成功!', | |||
| type: 'success' | |||
| }) | |||
| this.crud.toQuery() | |||
| scope._self.$refs[`del-${scope.$index}`].doClose() | |||
| }) | |||
| }, | |||
| submitForm(formName) { | |||
| this.$refs[formName].validate((valid) => { | |||
| if (valid) { | |||
| this.loadingBtn = true | |||
| saveLunbo(this.ruleForm).then(res => { | |||
| this.$message({ | |||
| message: '操作成功!', | |||
| type: 'success' | |||
| }) | |||
| this.loadingBtn = false | |||
| this.dialogVisible = false | |||
| this.$refs[formName].resetFields() | |||
| this.crud.toQuery() | |||
| }).catch(() => { | |||
| this.loadingBtn = false | |||
| }) | |||
| } else { | |||
| console.log('error submit!!') | |||
| return false | |||
| } | |||
| }) | |||
| }, | |||
| resetForm(formName) { | |||
| this.$refs[formName].resetFields() | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| @@ -0,0 +1,60 @@ | |||
| <!-- | |||
| * @Date: 2021-07-08 11:02:40 | |||
| * @LastEditTime: 2022-07-27 10:48:43 | |||
| * @Description: 广告位 | |||
| --> | |||
| <template> | |||
| <div class="app-container"> | |||
| <el-form :model="ruleForm" ref="ruleForm" label-width="130px" class="resetform"> | |||
| <el-form-item label="是否显示"> | |||
| <el-radio-group v-model="ruleForm.display"> | |||
| <el-radio :label="1">是</el-radio> | |||
| <el-radio :label="0">否</el-radio> | |||
| </el-radio-group> | |||
| </el-form-item> | |||
| <el-form-item> | |||
| <el-button type="primary" @click="submitForm('ruleForm')">保存</el-button> | |||
| </el-form-item> | |||
| </el-form> | |||
| </div> | |||
| </template> | |||
| <script> | |||
| import { hotNewsConfig, saveHotNewsConfig } from '@/api/yyzrb' | |||
| export default { | |||
| data() { | |||
| return { | |||
| ruleForm: { | |||
| display: '', | |||
| id: '' | |||
| } | |||
| } | |||
| }, | |||
| created() { | |||
| this.getData() | |||
| }, | |||
| methods: { | |||
| getData() { | |||
| hotNewsConfig().then(res => { | |||
| this.ruleForm.id = res.id | |||
| this.ruleForm.display = res.display | |||
| }) | |||
| }, | |||
| submitForm(formName) { | |||
| this.$refs[formName].validate((valid) => { | |||
| if (valid) { | |||
| saveHotNewsConfig(this.ruleForm).then(res => { | |||
| this.$message({ | |||
| message: '操作成功!', | |||
| type: 'success' | |||
| }) | |||
| }) | |||
| } else { | |||
| console.log('error submit!!') | |||
| return false | |||
| } | |||
| }) | |||
| } | |||
| } | |||
| } | |||
| </script> | |||