|
@@ -91,7 +91,11 @@
|
91
|
91
|
:accept="getPictureAccept()"
|
92
|
92
|
:show-upload-list="false"
|
93
|
93
|
>
|
94
|
|
- <img v-if="addForm.newspic" :src="$api.showImageUrl" />
|
|
94
|
+ <img
|
|
95
|
+ style="width: 200px"
|
|
96
|
+ v-if="addForm.newspic"
|
|
97
|
+ :src="$api.showImageUrl + addForm.newspic"
|
|
98
|
+ />
|
95
|
99
|
<Button v-else icon="ios-cloud-upload-outline">上传封面</Button>
|
96
|
100
|
</Upload>
|
97
|
101
|
</FormItem>
|
|
@@ -115,29 +119,152 @@
|
115
|
119
|
<FormItem label="摘要" prop="newssummary">
|
116
|
120
|
<Input
|
117
|
121
|
type="textarea"
|
118
|
|
- :rows="3"
|
|
122
|
+ :rows="2"
|
119
|
123
|
v-model="addForm.newssummary"
|
120
|
124
|
:maxlength="255"
|
121
|
125
|
show-word-limit
|
122
|
126
|
placeholder="请输入摘要"
|
123
|
127
|
/>
|
124
|
128
|
</FormItem>
|
125
|
|
- <FormItem label="内容" prop="newscontent"></FormItem>
|
|
129
|
+ <FormItem label="内容" prop="newscontent">
|
|
130
|
+ <NewsEditor
|
|
131
|
+ :height="300"
|
|
132
|
+ @change="getNewsContent($event, addForm)"
|
|
133
|
+ :content="addForm.newscontent"
|
|
134
|
+ ></NewsEditor>
|
|
135
|
+ </FormItem>
|
126
|
136
|
</Form>
|
127
|
137
|
<div slot="footer" style="text-align: right">
|
128
|
138
|
<Button @click="addForm.show = false">取消</Button>
|
129
|
139
|
<Button @click="toSaveAdd()" type="primary">保存</Button>
|
130
|
140
|
</div>
|
131
|
141
|
</Modal>
|
|
142
|
+ <Modal
|
|
143
|
+ v-model="modifyForm.show"
|
|
144
|
+ class="modal1"
|
|
145
|
+ :mask-closable="false"
|
|
146
|
+ title="修改新闻资讯"
|
|
147
|
+ >
|
|
148
|
+ <Form
|
|
149
|
+ :label-width="60"
|
|
150
|
+ label-position="right"
|
|
151
|
+ ref="modifyForm"
|
|
152
|
+ :rules="formRules"
|
|
153
|
+ :model="modifyForm"
|
|
154
|
+ >
|
|
155
|
+ <FormItem label="封面" prop="newspic">
|
|
156
|
+ <Upload
|
|
157
|
+ :format="pictureFormat"
|
|
158
|
+ :max-size="10 * 1024"
|
|
159
|
+ action
|
|
160
|
+ :before-upload="
|
|
161
|
+ (file) => {
|
|
162
|
+ beforeUploadPicture(file, modifyForm);
|
|
163
|
+ return false;
|
|
164
|
+ }
|
|
165
|
+ "
|
|
166
|
+ :accept="getPictureAccept()"
|
|
167
|
+ :show-upload-list="false"
|
|
168
|
+ >
|
|
169
|
+ <img
|
|
170
|
+ style="width: 200px"
|
|
171
|
+ v-if="modifyForm.newspic"
|
|
172
|
+ :src="$api.showImageUrl + modifyForm.newspic"
|
|
173
|
+ />
|
|
174
|
+ <Button v-else icon="ios-cloud-upload-outline">上传封面</Button>
|
|
175
|
+ </Upload>
|
|
176
|
+ </FormItem>
|
|
177
|
+ <FormItem label="置顶" prop="newsup">
|
|
178
|
+ <RadioGroup v-model="modifyForm.newsup">
|
|
179
|
+ <Radio :label="1">置顶</Radio>
|
|
180
|
+ <Radio :label="2">不置顶</Radio>
|
|
181
|
+ </RadioGroup>
|
|
182
|
+ </FormItem>
|
|
183
|
+ <FormItem label="排序" prop="newsorder">
|
|
184
|
+ <InputNumber :min="1" v-model="modifyForm.newsorder" />
|
|
185
|
+ </FormItem>
|
|
186
|
+ <FormItem label="标题" prop="newstitle">
|
|
187
|
+ <Input
|
|
188
|
+ :maxlength="255"
|
|
189
|
+ show-word-limit
|
|
190
|
+ v-model="modifyForm.newstitle"
|
|
191
|
+ placeholder="请输入标题"
|
|
192
|
+ />
|
|
193
|
+ </FormItem>
|
|
194
|
+ <FormItem label="摘要" prop="newssummary">
|
|
195
|
+ <Input
|
|
196
|
+ type="textarea"
|
|
197
|
+ :rows="2"
|
|
198
|
+ v-model="modifyForm.newssummary"
|
|
199
|
+ :maxlength="255"
|
|
200
|
+ show-word-limit
|
|
201
|
+ placeholder="请输入摘要"
|
|
202
|
+ />
|
|
203
|
+ </FormItem>
|
|
204
|
+ <FormItem label="内容" prop="newscontent">
|
|
205
|
+ <NewsEditor
|
|
206
|
+ :height="400"
|
|
207
|
+ @change="getNewsContent($event, modifyForm)"
|
|
208
|
+ :content="modifyForm.newscontent"
|
|
209
|
+ ></NewsEditor>
|
|
210
|
+ </FormItem>
|
|
211
|
+ </Form>
|
|
212
|
+ <div slot="footer" style="text-align: right">
|
|
213
|
+ <Button @click="modifyForm.show = false">取消</Button>
|
|
214
|
+ <Button @click="toSaveModify()" type="primary">保存</Button>
|
|
215
|
+ </div>
|
|
216
|
+ </Modal>
|
|
217
|
+ <Modal
|
|
218
|
+ v-model="detailInfo.show"
|
|
219
|
+ class="modal1"
|
|
220
|
+ :mask-closable="false"
|
|
221
|
+ title="查看新闻资讯"
|
|
222
|
+ >
|
|
223
|
+ <Form :label-width="60" label-position="right" :model="detailInfo">
|
|
224
|
+ <FormItem label="语言">{{
|
|
225
|
+ detailInfo.ltype === 1 ? "中文" : "英文"
|
|
226
|
+ }}</FormItem>
|
|
227
|
+ <FormItem label="封面" prop="newspic">
|
|
228
|
+ <img
|
|
229
|
+ style="width: 200px"
|
|
230
|
+ v-viewer
|
|
231
|
+ v-if="detailInfo.newspic"
|
|
232
|
+ :src="$api.showImageUrl + detailInfo.newspic"
|
|
233
|
+ />
|
|
234
|
+ </FormItem>
|
|
235
|
+ <FormItem label="置顶" prop="newsup">{{
|
|
236
|
+ detailInfo.newsup === 1 ? "置顶" : "不置顶"
|
|
237
|
+ }}</FormItem>
|
|
238
|
+ <FormItem label="排序" prop="newsorder">{{
|
|
239
|
+ detailInfo.newsorder
|
|
240
|
+ }}</FormItem>
|
|
241
|
+ <FormItem label="标题" prop="newstitle">{{
|
|
242
|
+ detailInfo.newstitle
|
|
243
|
+ }}</FormItem>
|
|
244
|
+ <FormItem label="摘要" prop="newssummary">{{
|
|
245
|
+ detailInfo.newssummary
|
|
246
|
+ }}</FormItem>
|
|
247
|
+ <FormItem label="内容" prop="newscontent">
|
|
248
|
+ <div v-html="detailInfo.newscontent"></div>
|
|
249
|
+ </FormItem>
|
|
250
|
+ </Form>
|
|
251
|
+ <div slot="footer" style="text-align: center">
|
|
252
|
+ <Button @click="detailInfo.show = false">关闭</Button>
|
|
253
|
+ </div>
|
|
254
|
+ </Modal>
|
132
|
255
|
</div>
|
133
|
256
|
</template>
|
134
|
257
|
|
135
|
258
|
<script>
|
136
|
259
|
import axios from "axios";
|
|
260
|
+import NewsEditor from "./newsEditor.vue";
|
137
|
261
|
import { n_list, n_save, n_update, n_remove } from "@/api";
|
138
|
262
|
import { dateFormat } from "@/utils";
|
139
|
263
|
import { pictureFormat } from "@/utils/fileConfig";
|
140
|
264
|
export default {
|
|
265
|
+ components: {
|
|
266
|
+ NewsEditor
|
|
267
|
+ },
|
141
|
268
|
data() {
|
142
|
269
|
return {
|
143
|
270
|
dateFormat,
|
|
@@ -223,6 +350,7 @@ export default {
|
223
|
350
|
ltype: [
|
224
|
351
|
{
|
225
|
352
|
required: true,
|
|
353
|
+ type: "number",
|
226
|
354
|
message: "请选择语言",
|
227
|
355
|
trigger: "change"
|
228
|
356
|
}
|
|
@@ -231,6 +359,7 @@ export default {
|
231
|
359
|
{
|
232
|
360
|
required: true,
|
233
|
361
|
message: "请选择是否置顶",
|
|
362
|
+ type: "number",
|
234
|
363
|
trigger: "change"
|
235
|
364
|
}
|
236
|
365
|
],
|
|
@@ -266,6 +395,7 @@ export default {
|
266
|
395
|
{
|
267
|
396
|
required: true,
|
268
|
397
|
message: "请输入排序",
|
|
398
|
+ type: "number",
|
269
|
399
|
trigger: "blur"
|
270
|
400
|
}
|
271
|
401
|
]
|
|
@@ -297,9 +427,12 @@ export default {
|
297
|
427
|
this.getNewsList();
|
298
|
428
|
},
|
299
|
429
|
methods: {
|
|
430
|
+ getNewsContent(html, formObj) {
|
|
431
|
+ formObj.newscontent = html;
|
|
432
|
+ },
|
300
|
433
|
beforeUploadPicture(file, formObj) {
|
301
|
434
|
let formData = new FormData();
|
302
|
|
- formData.append("files", file);
|
|
435
|
+ formData.append("file", file);
|
303
|
436
|
formData.append("savefolder", "news");
|
304
|
437
|
axios
|
305
|
438
|
.post(this.$api.baseUrl + "file/upload", formData, {
|
|
@@ -371,6 +504,7 @@ export default {
|
371
|
504
|
newsup: this.addForm.newsup,
|
372
|
505
|
createid: this.userInfo.userid
|
373
|
506
|
}).then((res) => {
|
|
507
|
+ this.addForm.show = false;
|
374
|
508
|
if (res.code === 0) {
|
375
|
509
|
this.$Message.success(res.msg);
|
376
|
510
|
this.searchList();
|
|
@@ -401,6 +535,7 @@ export default {
|
401
|
535
|
newsup: this.modifyForm.newsup,
|
402
|
536
|
newsid: this.modifyForm.newsid
|
403
|
537
|
}).then((res) => {
|
|
538
|
+ this.modifyForm.show = false;
|
404
|
539
|
if (res.code === 0) {
|
405
|
540
|
this.$Message.success(res.msg);
|
406
|
541
|
this.searchList();
|
|
@@ -427,7 +562,6 @@ export default {
|
427
|
562
|
});
|
428
|
563
|
},
|
429
|
564
|
toViewDetail(row) {
|
430
|
|
- console.log("toViewDetail", row);
|
431
|
565
|
this.detailInfo = {
|
432
|
566
|
show: true,
|
433
|
567
|
ltype: row.ltype,
|