|
95 | 95 | </template>
|
96 | 96 |
|
97 | 97 | <script>
|
98 |
| - import WxNews from '@/views/mp/components/wx-news/main.vue'; |
99 |
| - import WxVoicePlayer from '@/views/mp/components/wx-voice-play/main.vue'; |
100 |
| - import WxVideoPlayer from '@/views/mp/components/wx-video-play/main.vue'; |
101 |
| - import { getMaterialPage } from "@/api/mp/material"; |
102 |
| - import { getFreePublishPage } from "@/api/mp/freePublish"; |
103 |
| - import { getDraftPage } from "@/api/mp/draft"; |
| 98 | +import WxNews from '@/views/mp/components/wx-news/main.vue'; |
| 99 | +import WxVoicePlayer from '@/views/mp/components/wx-voice-play/main.vue'; |
| 100 | +import WxVideoPlayer from '@/views/mp/components/wx-video-play/main.vue'; |
| 101 | +import { getMaterialPage } from "@/api/mp/material"; |
| 102 | +import { getFreePublishPage } from "@/api/mp/freePublish"; |
| 103 | +import { getDraftPage } from "@/api/mp/draft"; |
104 | 104 |
|
105 |
| - export default { |
106 |
| - name: "wxMaterialSelect", |
107 |
| - components: { |
108 |
| - WxNews, |
109 |
| - WxVoicePlayer, |
110 |
| - WxVideoPlayer |
| 105 | +export default { |
| 106 | + name: "wxMaterialSelect", |
| 107 | + components: { |
| 108 | + WxNews, |
| 109 | + WxVoicePlayer, |
| 110 | + WxVideoPlayer |
| 111 | + }, |
| 112 | + props: { |
| 113 | + objData: { |
| 114 | + type: Object, // type - 类型;accountId - 公众号账号编号 |
| 115 | + required: true |
111 | 116 | },
|
112 |
| - props: { |
113 |
| - objData: { |
114 |
| - type: Object, // type - 类型;accountId - 公众号账号编号 |
115 |
| - required: true |
116 |
| - }, |
117 |
| - newsType:{ // 图文类型:1、已发布图文;2、草稿箱图文 |
118 |
| - type: String, |
119 |
| - default: "1" |
| 117 | + newsType:{ // 图文类型:1、已发布图文;2、草稿箱图文 |
| 118 | + type: String, |
| 119 | + default: "1" |
| 120 | + }, |
| 121 | + }, |
| 122 | + data() { |
| 123 | + return { |
| 124 | + // 遮罩层 |
| 125 | + loading: false, |
| 126 | + // 总条数 |
| 127 | + total: 0, |
| 128 | + // 数据列表 |
| 129 | + list: [], |
| 130 | + // 查询参数 |
| 131 | + queryParams: { |
| 132 | + pageNo: 1, |
| 133 | + pageSize: 10, |
| 134 | + accountId: this.objData.accountId, |
120 | 135 | },
|
| 136 | + } |
| 137 | + }, |
| 138 | + created() { |
| 139 | + this.getPage() |
| 140 | + }, |
| 141 | + methods:{ |
| 142 | + selectMaterial(item) { |
| 143 | + this.$emit('selectMaterial', item) |
121 | 144 | },
|
122 |
| - data() { |
123 |
| - return { |
124 |
| - // 遮罩层 |
125 |
| - loading: false, |
126 |
| - // 总条数 |
127 |
| - total: 0, |
128 |
| - // 数据列表 |
129 |
| - list: [], |
130 |
| - // 查询参数 |
131 |
| - queryParams: { |
132 |
| - pageNo: 1, |
133 |
| - pageSize: 10, |
134 |
| - accountId: this.objData.accountId, |
135 |
| - }, |
| 145 | + /** 搜索按钮操作 */ |
| 146 | + handleQuery() { |
| 147 | + this.queryParams.pageNo = 1 |
| 148 | + this.getPage() |
| 149 | + }, |
| 150 | + getPage() { |
| 151 | + this.loading = true |
| 152 | + if (this.objData.type === 'news' && this.newsType === '1') { // 【图文】+ 【已发布】 |
| 153 | + this.getFreePublishPage(); |
| 154 | + } else if (this.objData.type === 'news' && this.newsType === '2') { // 【图文】+ 【草稿】 |
| 155 | + this.getDraftPage(); |
| 156 | + } else { // 【素材】 |
| 157 | + this.getMaterialPage(); |
136 | 158 | }
|
137 | 159 | },
|
138 |
| - created() { |
139 |
| - this.getPage() |
| 160 | + getMaterialPage() { |
| 161 | + getMaterialPage({ |
| 162 | + ...this.queryParams, |
| 163 | + type: this.objData.type |
| 164 | + }).then(response => { |
| 165 | + this.list = response.data.list |
| 166 | + this.total = response.data.total |
| 167 | + }).finally(() => { |
| 168 | + this.loading = false |
| 169 | + }) |
140 | 170 | },
|
141 |
| - methods:{ |
142 |
| - selectMaterial(item) { |
143 |
| - this.$emit('selectMaterial', item) |
144 |
| - }, |
145 |
| - /** 搜索按钮操作 */ |
146 |
| - handleQuery() { |
147 |
| - this.queryParams.pageNo = 1 |
148 |
| - this.getPage() |
149 |
| - }, |
150 |
| - getPage() { |
151 |
| - this.loading = true |
152 |
| - if (this.objData.type === 'news' && this.newsType === '1') { // 【图文】+ 【已发布】 |
153 |
| - this.getFreePublishPage(); |
154 |
| - } else if (this.objData.type === 'news' && this.newsType === '2') { // 【图文】+ 【草稿】 |
155 |
| - this.getDraftPage(); |
156 |
| - } else { // 【素材】 |
157 |
| - this.getMaterialPage(); |
158 |
| - } |
159 |
| - }, |
160 |
| - getMaterialPage() { |
161 |
| - getMaterialPage({ |
162 |
| - ...this.queryParams, |
163 |
| - type: this.objData.type |
164 |
| - }).then(response => { |
165 |
| - this.list = response.data.list |
166 |
| - this.total = response.data.total |
167 |
| - }).finally(() => { |
168 |
| - this.loading = false |
169 |
| - }) |
170 |
| - }, |
171 |
| - getFreePublishPage() { |
172 |
| - getFreePublishPage(this.queryParams).then(response => { |
173 |
| - // 将 thumbUrl 转成 picUrl,保证 wx-news 组件可以预览封面 |
174 |
| - response.data.list.forEach(item => { |
175 |
| - const newsItem = item.content.newsItem; |
176 |
| - newsItem.forEach(article => { |
177 |
| - article.picUrl = article.thumbUrl; |
178 |
| - }) |
| 171 | + getFreePublishPage() { |
| 172 | + getFreePublishPage(this.queryParams).then(response => { |
| 173 | + // 将 thumbUrl 转成 picUrl,保证 wx-news 组件可以预览封面 |
| 174 | + response.data.list.forEach(item => { |
| 175 | + const newsItem = item.content.newsItem; |
| 176 | + newsItem.forEach(article => { |
| 177 | + article.picUrl = article.thumbUrl; |
179 | 178 | })
|
180 |
| - this.list = response.data.list |
181 |
| - this.total = response.data.total |
182 |
| - }).finally(() => { |
183 |
| - this.loading = false |
184 | 179 | })
|
185 |
| - }, |
186 |
| - getDraftPage() { |
187 |
| - getDraftPage((this.queryParams)).then(response => { |
188 |
| - // 将 thumbUrl 转成 picUrl,保证 wx-news 组件可以预览封面 |
189 |
| - response.data.list.forEach(item => { |
190 |
| - const newsItem = item.content.newsItem; |
191 |
| - newsItem.forEach(article => { |
192 |
| - article.picUrl = article.thumbUrl; |
193 |
| - }) |
| 180 | + this.list = response.data.list |
| 181 | + this.total = response.data.total |
| 182 | + }).finally(() => { |
| 183 | + this.loading = false |
| 184 | + }) |
| 185 | + }, |
| 186 | + getDraftPage() { |
| 187 | + getDraftPage((this.queryParams)).then(response => { |
| 188 | + // 将 thumbUrl 转成 picUrl,保证 wx-news 组件可以预览封面 |
| 189 | + response.data.list.forEach(item => { |
| 190 | + const newsItem = item.content.newsItem; |
| 191 | + newsItem.forEach(article => { |
| 192 | + article.picUrl = article.thumbUrl; |
194 | 193 | })
|
195 |
| - this.list = response.data.list |
196 |
| - this.total = response.data.total |
197 |
| - }).finally(() => { |
198 |
| - this.loading = false |
199 | 194 | })
|
200 |
| - } |
| 195 | + this.list = response.data.list |
| 196 | + this.total = response.data.total |
| 197 | + }).finally(() => { |
| 198 | + this.loading = false |
| 199 | + }) |
201 | 200 | }
|
202 |
| - }; |
| 201 | + } |
| 202 | +}; |
203 | 203 | </script>
|
204 | 204 |
|
205 | 205 | <style lang="scss" scoped>
|
206 |
| - /*瀑布流样式*/ |
| 206 | +/*瀑布流样式*/ |
| 207 | +.waterfall { |
| 208 | + width: 100%; |
| 209 | + column-gap:10px; |
| 210 | + column-count: 5; |
| 211 | + margin: 0 auto; |
| 212 | +} |
| 213 | +.waterfall-item { |
| 214 | + padding: 10px; |
| 215 | + margin-bottom: 10px; |
| 216 | + break-inside: avoid; |
| 217 | + border: 1px solid #eaeaea; |
| 218 | +} |
| 219 | +.material-img { |
| 220 | + width: 100%; |
| 221 | +} |
| 222 | +p { |
| 223 | + line-height: 30px; |
| 224 | +} |
| 225 | +@media (min-width: 992px) and (max-width: 1300px) { |
207 | 226 | .waterfall {
|
208 |
| - width: 100%; |
209 |
| - column-gap:10px; |
210 |
| - column-count: 5; |
211 |
| - margin: 0 auto; |
212 |
| - } |
213 |
| - .waterfall-item { |
214 |
| - padding: 10px; |
215 |
| - margin-bottom: 10px; |
216 |
| - break-inside: avoid; |
217 |
| - border: 1px solid #eaeaea; |
218 |
| - } |
219 |
| - .material-img { |
220 |
| - width: 100%; |
| 227 | + column-count: 3; |
221 | 228 | }
|
222 | 229 | p {
|
223 |
| - line-height: 30px; |
| 230 | + color:red; |
224 | 231 | }
|
225 |
| - @media (min-width: 992px) and (max-width: 1300px) { |
226 |
| - .waterfall { |
227 |
| - column-count: 3; |
228 |
| - } |
229 |
| - p { |
230 |
| - color:red; |
231 |
| - } |
| 232 | +} |
| 233 | +@media (min-width: 768px) and (max-width: 991px) { |
| 234 | + .waterfall { |
| 235 | + column-count: 2; |
232 | 236 | }
|
233 |
| - @media (min-width: 768px) and (max-width: 991px) { |
234 |
| - .waterfall { |
235 |
| - column-count: 2; |
236 |
| - } |
237 |
| - p { |
238 |
| - color: orange; |
239 |
| - } |
| 237 | + p { |
| 238 | + color: orange; |
240 | 239 | }
|
241 |
| - @media (max-width: 767px) { |
242 |
| - .waterfall { |
243 |
| - column-count: 1; |
244 |
| - } |
| 240 | +} |
| 241 | +@media (max-width: 767px) { |
| 242 | + .waterfall { |
| 243 | + column-count: 1; |
245 | 244 | }
|
246 |
| - /*瀑布流样式*/ |
| 245 | +} |
| 246 | +/*瀑布流样式*/ |
247 | 247 | </style>
|
0 commit comments