Chosen Solution

When I turn off the phone’s screen, the page starts flashing shortly, what to do with this problem?

From what you have written I concluded that your display is broken and you need to replace it, here is some help: Samsung Galaxy J7 Display / LCD Replacement

factory restore, backing up your data for sure. if not might be a hardware problem.