How to assign a local avatar to a user after registering or logging in for the first time

as mentioned above, there are 300 avatars in my project folder. How can I assign an avatar to a user after registering or logging in for the first time, and log in later or this avatar?

the back end said that he would save the profile picture and this account,
. But I don"t know what to do at the front end.

Mar.11,2021

this requires you to discuss with the backend, ah, you are the front end, what you need to do is to construct the request based on the data returned by the backend and get the user image. Ask the backend how to store the image, and then you construct the corresponding request according to the format of the data he stores. For example, the backend stores the avatar by storing the name of the picture. Your avatar is under static/img/ , and the data it returns to you is

.
{
  name: 'xxxx',
  sex: ,
  portrait: 'xxx.png'
}

you need to construct the following path to get the picture:

/static/img/xxx.png

this is basically what the front end does.

Menu