iPad or iPhone doesn't charge until unlocked?
What you are observing is due to a security related change made in iOS 11.4.1.
- Using USB accessories with iOS 11.4.1 and later
Starting with iOS 11.4.1, if you use USB accessories with your iPhone, iPad, or iPod touch, or if you connect your device to a Mac or PC, you might need to unlock your device for it to recognize and use the accessory. Your accessory then remains connected, even if your device is subsequently locked.
This setting can be accessed on your iPhone/iPad by going to Settings app → Face ID & Passcode → USB Accessories.
When the USB Accessories setting is off, as in the image above, you might need to unlock your iOS device to connect USB accessories.
This is turned off by default for security reasons. If you turn it on, your iPhone/iPad will start charging instantly, without unlocking it's connected to your laptop.