index.vue
4.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<template>
<div class="app-container">
<div class="block">
<el-row :gutter="20">
<el-col :span="6">
<el-input v-model="listQuery.title" size="mini" placeholder="标题"></el-input>
</el-col>
<el-col :span="6">
<el-button type="success" size="mini" icon="el-icon-search" @click.native="search">{{ $t('button.search') }}</el-button>
<el-button type="primary" size="mini" icon="el-icon-refresh" @click.native="reset">{{ $t('button.reset') }}</el-button>
</el-col>
</el-row>
<br>
<el-row>
<el-col :span="24">
<el-button type="success" size="mini" icon="el-icon-plus" @click.native="add" v-permission="['/banner/edit']">{{ $t('button.add') }}</el-button>
<el-button type="success" size="mini" icon="el-icon-edit" @click.native="setBanner" v-show="shopCategory.show" :disabled="shopCategory.disabled">选中banner</el-button>
<el-button type="danger" size="mini" icon="el-icon-delete" @click.native="remove" v-permission="['/banner/delete']">{{ $t('button.delete') }}</el-button>
</el-col>
</el-row>
</div>
<el-table :data="list" v-loading="listLoading" element-loading-text="Loading" border fit highlight-current-row
@current-change="handleCurrentChange"
@row-click="clickRow">
<el-table-column label="ID">
<template slot-scope="scope">
{{scope.row.id}}
</template>
</el-table-column>
<el-table-column label="标题">
<template slot-scope="scope">
{{scope.row.title}}
</template>
</el-table-column>
<el-table-column label="类别">
<template slot-scope="scope">
{{scope.row.type}}
</template>
</el-table-column>
<el-table-column label="打开界面">
<template slot-scope="scope">
{{scope.row.page}}
</template>
</el-table-column>
<el-table-column label="参数">
<template slot-scope="scope">
{{scope.row.param}}
</template>
</el-table-column>
<el-table-column label="图片">
<template slot-scope="scope">
<img :src="scope.row.img" style="width:200px;">
</template>
</el-table-column>
</el-table>
<el-dialog
:title="formTitle"
:visible.sync="formVisible"
width="70%">
<el-form ref="form" :model="form" :rules="rules" label-width="150px">
<el-row>
<el-col :span="12">
<el-row>
<el-col :span="12">
<el-form-item label="banner图片">
<el-upload
class="upload-demo"
drag
multiple=false
:action="uploadUrl"
:headers="uploadHeaders"
:before-upload="handleBeforeUpload"
:on-success="handleUploadSuccess"
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">上传图片</div>
</el-upload>
</el-form-item>
</el-col>
</el-row>
</el-col>
<el-col :span="12">
<el-row>
<el-col :span="24">
<el-form-item label="标题" prop="title">
<el-input v-model="form.title" minlength=1></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="打开的界面">
<el-input v-model="form.page"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="参数" prop="param">
<el-input type="textarea" v-model="form.param"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="类型">
<el-select v-model="form.type" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-col>
</el-row>
</el-row>
<el-form-item>
<el-button type="primary" @click="save">{{ $t('button.submit') }}</el-button>
<el-button @click.native="formVisible = false">{{ $t('button.cancel') }}</el-button>
</el-form-item>
</el-form>
</el-dialog>
</div>
</template>
<script src="./banner.js"></script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/common.scss";
</style>