Accurate prediction of battery remaining useful life (RUL) under various operating conditions is essential for battery management systems to evaluate battery reliability, reduce the risk of battery usage and provide a rationale for battery maintenance. However, RUL prediction is a challenging problem since battery degradation is a nonlinear process and is influenced by external factors. In order to improve the prediction speed and accuracy, the research proposes a new Li-ion batteries RUL prediction method based on temporal pattern attention-based, which can take into account the influence of different variables for prediction. To model time-invariant patterns across multiple time steps, it combines a gated recurrent unit (GRU), a convolutional neural network, and an attention mechanism. Battery capacity, impedance and temperature are taken as input to train the model. Experiments are validated on public datasets and the results are compared with state of art methods. The experimental results show that the proposed method achieves the lowest MAE with 8.99, which proves the effectiveness of the method.