Dark Horse Blog - Detailed Steps (7) Article Management for the Implementation of Project Functions

3. Article management

 

1. Add article management and article editing page routing:

Verify that two static pages can be accessed

2. Realize the function of clicking to switch the navigation bar:

3. Change the selected state of the connection

 

Implement article management function: (based on database)

Create article collection -> add article specific content

The article collection has five fields: title, author, publication time, article cover, content

Implement the function of publishing new articles

 

Form data must be passed to the server side in binary

 

Add articles to add related routes in the server section:

Validation: publish new article → submit

successfully entered the route

To receive the binary data passed by the client, the server needs a third-party module formidable

formidable

Function: Parse forms, support get request parameters, post request parameters, and file upload.

form.keepExtensions = false; default flase is not saved

 

Store files uploaded by the client

Validation: publish new article → add article content

After submitting:

show author in page

Use js to read the image file and display the read image on the page

file read FileReader

Insert the articles passed by the client into the database

Validation: publish new article → add article content → select file → submit

Display article data on the article page

↑Test data prepared in advance

Published time and author data need to be processed

Author (multi-collection union query)

Date format processing of release time (third-party module dateformat)

 

 

 

 

Guess you like

Origin blog.csdn.net/qq_40794986/article/details/111878834