Seems the hard drive is still ok, just
the enclosure is broken (has contact problem). After you got all the data, you could open it, take the hard drive out, and put it in another enclosure. If it's 2.5in hard drive, the enclosure is only a few dollars.