leisure-core 0.4.11 → 0.4.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -42,6 +42,8 @@ import { LeHelp, LeHelpDetail } from "./le-help/index.js";
42
42
  import LeDistribution from "./le-distribution/index.js";
43
43
  import LeDistributionCategory from "./le-distribution-category/index.js";
44
44
  import LeSelectUser from "./le-select-user/index.js";
45
+ import LeAdSpace from "./le-ad-space/index.js";
46
+ import LeAd from "./le-ad/index.js";
45
47
 
46
48
  const components = [
47
49
  LeArea,
@@ -85,6 +87,8 @@ const components = [
85
87
  LeDistribution,
86
88
  LeDistributionCategory,
87
89
  LeSelectUser,
90
+ LeAdSpace,
91
+ LeAd,
88
92
  ];
89
93
 
90
94
  const install = function (Vue) {
@@ -198,4 +202,6 @@ export default {
198
202
  LeDistribution,
199
203
  LeDistributionCategory,
200
204
  LeSelectUser,
205
+ LeAdSpace,
206
+ LeAd,
201
207
  };
package/le-ad/index.js ADDED
@@ -0,0 +1,7 @@
1
+ import LeAd from "./src/main.vue";
2
+
3
+ LeAd.install = function (Vue) {
4
+ Vue.component(LeAd.name, LeAd);
5
+ };
6
+
7
+ export default LeAd;
@@ -0,0 +1,133 @@
1
+ <template>
2
+ <div>
3
+ <el-form :inline="true" :model="searchData">
4
+ <el-form-item label="终端">
5
+ <el-select
6
+ v-model="searchData.dtype"
7
+ placeholder="请选择终端类型"
8
+ clearable
9
+ >
10
+ <el-option label="PC" value="0" key="0"></el-option>
11
+ <el-option label="移动" value="1" key="1"></el-option>
12
+ </el-select>
13
+ </el-form-item>
14
+ <el-form-item>
15
+ <el-button type="primary" @click="searData">查询</el-button>
16
+ <el-button type="primary" @click="addAd()">新增广告</el-button>
17
+ </el-form-item>
18
+ </el-form>
19
+ <el-table :data="tableData" border row-key="id" stripe style="width: 100%">
20
+ <el-table-column prop="dtype" label="终端">
21
+ <template slot-scope="scope">
22
+ <span v-if="scope.row.dtype == 0">PC端</span>
23
+ <span v-if="scope.row.dtype == 1">移动端</span>
24
+ </template>
25
+ </el-table-column>
26
+ <el-table-column prop="title" label="广告标题"> </el-table-column>
27
+ <el-table-column prop="title" label="广告图片" width="100" align="center">
28
+ <template slot-scope="scope">
29
+ <el-image style="width: 50px; height: 50px" :src="scope.row.imgsrc">
30
+ </el-image>
31
+ </template>
32
+ </el-table-column>
33
+ <el-table-column prop="linktype" label="导航类型">
34
+ <template slot-scope="scope">
35
+ <span v-if="scope.row.linktype == 0">不导航</span>
36
+ <span v-if="scope.row.linktype == 1">商城页面</span>
37
+ <span v-if="scope.row.linktype == 2">商品页面</span>
38
+ <span v-if="scope.row.linktype == 3">自定义链接</span>
39
+ </template>
40
+ </el-table-column>
41
+ <el-table-column prop="link_address" label="导航地址"> </el-table-column>
42
+ <el-table-column prop="note" label="备注"> </el-table-column>
43
+ <el-table-column fixed="right" label="操作" align="center" row>
44
+ <template slot-scope="scope">
45
+ <le-button
46
+ id="btnEdit"
47
+ text="编辑"
48
+ @click="openEditWindow(scope.row)"
49
+ ></le-button>
50
+ <le-button-msg @click="del(scope.row)"></le-button-msg>
51
+ </template>
52
+ </el-table-column>
53
+ </el-table>
54
+ <div style="text-align: center; margin-top: 30px">
55
+ <el-pagination
56
+ background
57
+ layout="prev, pager, next"
58
+ :total="searchData.total"
59
+ :page-size="10"
60
+ @current-change="current_change"
61
+ ></el-pagination>
62
+ </div>
63
+ <le-dialog-container :showDialog="showDialog" @close="closeDialog">
64
+ <le-ad-sub
65
+ @close="closeDialog"
66
+ @rowRefresh="list"
67
+ :rowitem="currentRow"
68
+ ></le-ad-sub>
69
+ </le-dialog-container>
70
+ </div>
71
+ </template>
72
+ <script>
73
+ import { list, del } from "@/api/system-ad";
74
+ import LeAdSub from "./sub.vue";
75
+ export default {
76
+ name: "le-ad",
77
+ components: {
78
+ LeAdSub,
79
+ },
80
+ data() {
81
+ return {
82
+ searchData: {
83
+ pageNo: 1,
84
+ total: 1,
85
+ dtype: null,
86
+ },
87
+ tableData: [],
88
+ showDialog: false,
89
+ currentRow: {},
90
+ };
91
+ },
92
+ mounted() {
93
+ this.list();
94
+ },
95
+ methods: {
96
+ list() {
97
+ let params = JSON.parse(JSON.stringify(this.searchData));
98
+ list(params).then((res) => {
99
+ let data = res.data.data;
100
+ if (data) this.tableData = data.list;
101
+ });
102
+ },
103
+ del(id) {
104
+ let param = {};
105
+ param.id = id;
106
+ del(id).then((response) => {
107
+ this.list();
108
+ this.$message.success(response.data.info);
109
+ });
110
+ },
111
+ searData() {
112
+ this.searchData.pageNo = 1;
113
+ this.list();
114
+ },
115
+ current_change(currentPage) {
116
+ this.searchData.pageNo = currentPage;
117
+ this.list();
118
+ },
119
+ addAd() {
120
+ this.currentRow = null;
121
+ this.showDialog = true;
122
+ },
123
+ openEditWindow(item) {
124
+ this.currentRow = item;
125
+ this.showDialog = true;
126
+ },
127
+ closeDialog() {
128
+ this.currentRow = null;
129
+ this.showDialog = false;
130
+ },
131
+ },
132
+ };
133
+ </script>
@@ -0,0 +1,180 @@
1
+ <template>
2
+ <el-form ref="form" :model="form" :rules="rules" label-width="80px">
3
+ <el-form-item label="广告标题" prop="title">
4
+ <el-input v-model="form.title"></el-input>
5
+ </el-form-item>
6
+ <el-form-item label="终端类型" prop="dtype">
7
+ <el-select
8
+ v-model="form.dtype"
9
+ placeholder="请选择终端类型"
10
+ clearable
11
+ @change="changeDType"
12
+ >
13
+ <el-option label="PC" :value="0" :key="0"></el-option>
14
+ <el-option label="移动" :value="1" :key="1"></el-option>
15
+ </el-select>
16
+ </el-form-item>
17
+ <el-form-item label="广告位" prop="sid">
18
+ <el-select v-model="form.sid" placeholder="请选择广告位" clearable>
19
+ <el-option
20
+ v-for="option in sidOptions"
21
+ :key="option.id"
22
+ :label="option.title"
23
+ :value="option.id"
24
+ >
25
+ </el-option>
26
+ </el-select>
27
+ </el-form-item>
28
+ <el-form-item label="图片" prop="imgsrc">
29
+ <le-image
30
+ :images="initPrimaryImages"
31
+ :limit="1"
32
+ @getImages="getPrimaryImages"
33
+ ></le-image>
34
+ </el-form-item>
35
+ <el-form-item label="链接类型" prop="linktype">
36
+ <el-select v-model="form.linktype" placeholder="请选择链接类型" clearable>
37
+ <el-option label="不导航" :value="0" :key="0"></el-option>
38
+ <el-option label="商城页面" :value="1" :key="1"></el-option>
39
+ <el-option label="商品页面" :value="2" :key="2"></el-option>
40
+ <el-option label="自定义链接" :value="3" :key="3"></el-option>
41
+ </el-select>
42
+ </el-form-item>
43
+ <el-form-item label="链接地址">
44
+ <el-input v-model="form.link_address"></el-input>
45
+ </el-form-item>
46
+ <el-form-item label="排序">
47
+ <el-input v-model="form.seq"></el-input>
48
+ </el-form-item>
49
+ <el-form-item label="备注" prop="note">
50
+ <el-input v-model="form.note"></el-input>
51
+ </el-form-item>
52
+ <el-form-item v-rfooter>
53
+ <el-button type="primary" @click="onSubmit">保存</el-button>
54
+ <el-button @click="close()">取消</el-button>
55
+ </el-form-item>
56
+ </el-form>
57
+ </template>
58
+ <script>
59
+ import { add, edit } from "@/api/system-ad";
60
+ import { options as listOptions } from "@/api/system-ad-space";
61
+ export default {
62
+ name: "le-ad-sub",
63
+ props: {
64
+ rowitem: {},
65
+ },
66
+ data() {
67
+ return {
68
+ form: {
69
+ id: "",
70
+ sid: "",
71
+ dtype: 0,
72
+ title: "",
73
+ imgsrc: "",
74
+ linktype: 0,
75
+ link_address: "",
76
+ seq: 1,
77
+ status: 0,
78
+ note: "",
79
+ },
80
+
81
+ initPrimaryImages: [],
82
+
83
+ sidOptions: [],
84
+
85
+ rules: {
86
+ sid: [{ required: true, message: "广告位置必须选择", trigger: "blur" }],
87
+ dtype: [
88
+ { required: true, message: "终端类型必须选择", trigger: "blur" },
89
+ ],
90
+ title: [
91
+ { required: true, message: "请输入标题名称", trigger: "blur" },
92
+ {
93
+ min: 1,
94
+ max: 80,
95
+ message: "长度在 1 到 80 个字符",
96
+ trigger: "blur",
97
+ },
98
+ ],
99
+ imgsrc: [
100
+ { required: true, message: "图片地址必须定义", trigger: "blur" },
101
+ ],
102
+ linktype: [
103
+ { required: true, message: "链接类型必须选择", trigger: "blur" },
104
+ ],
105
+ note: [
106
+ {
107
+ max: 200,
108
+ message: "长度在 0 到 200个字符",
109
+ trigger: "blur",
110
+ },
111
+ ],
112
+ },
113
+ };
114
+ },
115
+ watch: {
116
+ rowitem: {
117
+ handler(newValue) {
118
+ if (newValue && newValue.id && newValue.id.length > 0) {
119
+ this.form = newValue;
120
+ if (this.form.imgsrc && this.form.imgsrc.length > 0) {
121
+ this.initPrimaryImages = [];
122
+ this.initPrimaryImages.push(this.form.imgsrc);
123
+ }
124
+ }
125
+ },
126
+ immediate: true,
127
+ },
128
+ },
129
+ mounted() {
130
+ let params = {};
131
+ params.dtype = null;
132
+ this.getSidOptions();
133
+ },
134
+ methods: {
135
+ onSubmit() {
136
+ this.$refs["form"].validate((valid) => {
137
+ if (valid) {
138
+ let params = JSON.parse(JSON.stringify(this.form));
139
+ if (params.id && params.id.length > 0) {
140
+ edit(params).then((res) => {
141
+ this.$message(res.data.info);
142
+ this.$emit("rowRefresh");
143
+ this.close();
144
+ });
145
+ } else {
146
+ add(params).then((response) => {
147
+ this.$emit("rowRefresh");
148
+ this.$message(response.data.info);
149
+ this.close();
150
+ });
151
+ }
152
+ }
153
+ });
154
+ },
155
+ close() {
156
+ this.$emit("close");
157
+ },
158
+ changeDType(e) {
159
+ let params = {};
160
+ params.dtype = e;
161
+ this.getSidOptions(params);
162
+ },
163
+ getSidOptions(params) {
164
+ listOptions(params).then((res) => {
165
+ let data = res.data.data;
166
+ if (data) {
167
+ this.sidOptions = data;
168
+ } else this.sidOptions = [];
169
+ });
170
+ },
171
+ getPrimaryImages(images) {
172
+ if (images && images.length > 0) {
173
+ this.form.imgsrc = images[0];
174
+ } else {
175
+ this.form.imgsrc = "";
176
+ }
177
+ },
178
+ },
179
+ };
180
+ </script>
@@ -0,0 +1,7 @@
1
+ import LeAdSpace from "./src/main.vue";
2
+
3
+ LeAdSpace.install = function (Vue) {
4
+ Vue.component(LeAdSpace.name, LeAdSpace);
5
+ };
6
+
7
+ export default LeAdSpace;
@@ -0,0 +1,130 @@
1
+ <template>
2
+ <div>
3
+ <el-form :inline="true" :model="searchData">
4
+ <el-form-item label="终端">
5
+ <el-select
6
+ v-model="searchData.dtype"
7
+ placeholder="请选择终端类型"
8
+ clearable
9
+ >
10
+ <el-option label="PC" value="0" key="0"></el-option>
11
+ <el-option label="移动" value="1" key="1"></el-option>
12
+ </el-select>
13
+ </el-form-item>
14
+ <el-form-item>
15
+ <el-button type="primary" @click="searData">查询</el-button>
16
+ <el-button type="primary" @click="addAd()">新增广告位</el-button>
17
+ </el-form-item>
18
+ </el-form>
19
+ <el-table :data="tableData" border row-key="id" stripe style="width: 100%">
20
+ <el-table-column prop="dtype" label="终端">
21
+ <template slot-scope="scope">
22
+ <span v-if="scope.row.dtype == 0">PC端</span>
23
+ <span v-if="scope.row.dtype == 1">移动端</span>
24
+ </template>
25
+ </el-table-column>
26
+ <el-table-column prop="title" label="广告位"> </el-table-column>
27
+ <el-table-column prop="status" label="状态">
28
+ <template slot-scope="scope">
29
+ <span v-if="scope.row.status == 0">未启用</span>
30
+ <span v-if="scope.row.status == 1">已经启用</span>
31
+ </template>
32
+ </el-table-column>
33
+ <el-table-column prop="note" label="备注"> </el-table-column>
34
+ <el-table-column
35
+ fixed="right"
36
+ label="操作"
37
+ align="center"
38
+ width="160"
39
+ row
40
+ >
41
+ <template slot-scope="scope">
42
+ <le-button
43
+ id="btnEdit"
44
+ text="编辑"
45
+ @click="openEditWindow(scope.row)"
46
+ ></le-button>
47
+ <le-button-msg @click="del(scope.row)"></le-button-msg>
48
+ </template>
49
+ </el-table-column>
50
+ </el-table>
51
+ <div style="text-align: center; margin-top: 30px">
52
+ <el-pagination
53
+ background
54
+ layout="prev, pager, next"
55
+ :total="searchData.total"
56
+ :page-size="10"
57
+ @current-change="current_change"
58
+ ></el-pagination>
59
+ </div>
60
+ <le-dialog-container :showDialog="showDialog" @close="closeDialog">
61
+ <le-ad-space-sub
62
+ @close="closeDialog"
63
+ @rowRefresh="list"
64
+ :rowitem="currentRow"
65
+ ></le-ad-space-sub>
66
+ </le-dialog-container>
67
+ </div>
68
+ </template>
69
+ <script>
70
+ import { list, del } from "@/api/system-ad-space";
71
+ import LeAdSpaceSub from "./sub.vue";
72
+ export default {
73
+ name: "le-ad-space",
74
+ components: {
75
+ LeAdSpaceSub,
76
+ },
77
+ data() {
78
+ return {
79
+ searchData: {
80
+ pageNo: 1,
81
+ total: 1,
82
+ dtype: null,
83
+ },
84
+ tableData: [],
85
+ showDialog: false,
86
+ currentRow: {},
87
+ };
88
+ },
89
+ computed: {},
90
+ mounted() {
91
+ this.list();
92
+ },
93
+ methods: {
94
+ list() {
95
+ let params = JSON.parse(JSON.stringify(this.searchData));
96
+ list(params).then((res) => {
97
+ let data = res.data.data;
98
+ if (data) {
99
+ this.tableData = data.list;
100
+ }
101
+ });
102
+ },
103
+ del(id) {
104
+ del(id).then((response) => {
105
+ this.list();
106
+ this.$message.success(response.data.info);
107
+ });
108
+ },
109
+ searData() {
110
+ this.searchData.pageNo = 1;
111
+ this.list();
112
+ },
113
+ current_change(currentPage) {
114
+ this.searchData.pageNo = currentPage;
115
+ this.list();
116
+ },
117
+ addAd() {
118
+ this.currentRow = null;
119
+ this.showDialog = true;
120
+ },
121
+ openEditWindow(item) {
122
+ this.currentRow = item;
123
+ this.showDialog = true;
124
+ },
125
+ closeDialog() {
126
+ this.showDialog = false;
127
+ },
128
+ },
129
+ };
130
+ </script>
@@ -0,0 +1,116 @@
1
+ <template>
2
+ <el-form ref="form" :model="form" :rules="rules" label-width="80px">
3
+ <el-form-item label="广告位" prop="title">
4
+ <el-input v-model="form.title"></el-input>
5
+ </el-form-item>
6
+ <el-form-item label="终端类型" prop="dtype">
7
+ <el-select v-model="form.dtype" placeholder="请选择终端类型" clearable>
8
+ <el-option label="PC" :value="0" :key="0"></el-option>
9
+ <el-option label="移动" :value="1" :key="1"></el-option>
10
+ </el-select>
11
+ </el-form-item>
12
+ <el-form-item label="图片长度" prop="img_length">
13
+ <el-input v-model="form.img_length" clearable>
14
+ <template slot="append">像素(PX)</template>
15
+ </el-input>
16
+ </el-form-item>
17
+ <el-form-item label="图片宽度" prop="img_width">
18
+ <el-input v-model="form.img_width" clearable>
19
+ <template slot="append">像素(PX)</template></el-input
20
+ >
21
+ </el-form-item>
22
+ <el-form-item label="是否启用">
23
+ <el-radio-group v-model="form.status">
24
+ <el-radio-button :label="0">不启用</el-radio-button>
25
+ <el-radio-button :label="1">启用</el-radio-button>
26
+ </el-radio-group>
27
+ </el-form-item>
28
+ <el-form-item label="备注" prop="note">
29
+ <el-input v-model="form.note"></el-input>
30
+ </el-form-item>
31
+ <el-form-item v-rfooter>
32
+ <el-button type="primary" @click="onSubmit">保存</el-button>
33
+ <el-button @click="close()">取消</el-button>
34
+ </el-form-item>
35
+ </el-form>
36
+ </template>
37
+ <script>
38
+ import { add, edit } from "@/api/system-ad-space";
39
+ export default {
40
+ name: "le-ad-space-sub",
41
+ props: {
42
+ rowitem: {},
43
+ },
44
+ data() {
45
+ return {
46
+ form: {
47
+ id: "",
48
+ dtype: 1,
49
+ title: "",
50
+ img_length: 300,
51
+ img_width: 300,
52
+ status: 1,
53
+ note: "",
54
+ },
55
+ rules: {
56
+ dtype: [{ required: true, message: "请选择终端", trigger: "blur" }],
57
+ img_length: [
58
+ { required: true, message: "请选择终端", trigger: "blur" },
59
+ ],
60
+ img_width: [{ required: true, message: "请选择终端", trigger: "blur" }],
61
+ title: [
62
+ { required: true, message: "请输入广告位名称", trigger: "blur" },
63
+ {
64
+ min: 1,
65
+ max: 100,
66
+ message: "长度在 1 到 80 个字符",
67
+ trigger: "blur",
68
+ },
69
+ ],
70
+ note: [
71
+ {
72
+ max: 100,
73
+ message: "长度在 0 到 100个字符",
74
+ trigger: "blur",
75
+ },
76
+ ],
77
+ },
78
+ };
79
+ },
80
+ watch: {
81
+ rowitem: {
82
+ handler(newValue) {
83
+ if (newValue && newValue.id && newValue.id.length > 0)
84
+ this.form = newValue;
85
+ },
86
+ immediate: true,
87
+ },
88
+ },
89
+ mounted() {},
90
+ methods: {
91
+ onSubmit() {
92
+ this.$refs["form"].validate((valid) => {
93
+ if (valid) {
94
+ let param = JSON.parse(JSON.stringify(this.form));
95
+ if (param.id && param.id.length > 0) {
96
+ edit(param).then((res) => {
97
+ this.$message(res.data.info);
98
+ this.$emit("rowRefresh");
99
+ this.close();
100
+ });
101
+ } else {
102
+ add(param).then((response) => {
103
+ this.$message(response.data.info);
104
+ this.$emit("rowRefresh");
105
+ this.close();
106
+ });
107
+ }
108
+ }
109
+ });
110
+ },
111
+ close() {
112
+ this.$emit("close");
113
+ },
114
+ },
115
+ };
116
+ </script>
@@ -98,8 +98,7 @@
98
98
  :total="searchData.total"
99
99
  :page-size="10"
100
100
  @current-change="current_change"
101
- >></el-pagination
102
- >
101
+ ></el-pagination>
103
102
  </div>
104
103
  </div>
105
104
  </template>
@@ -56,8 +56,12 @@ export default {
56
56
  };
57
57
  },
58
58
  watch: {
59
- images(val) {
60
- this.imageList = val;
59
+ images: {
60
+ handler(val) {
61
+ this.imageList = val;
62
+ },
63
+ immediate: true,
64
+ deep: true,
61
65
  },
62
66
  },
63
67
  mounted() {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leisure-core",
3
- "version": "0.4.11",
3
+ "version": "0.4.12",
4
4
  "description": "leisure-core是leisure-ui-core的简称,是京心数据基于vue2.0开发的一套后台系统框架与js库,包含登录,首页框架等",
5
5
  "private": false,
6
6
  "author": "北方乐逍遥(zcx7878)",