An STPG spectral method for TFFP equations with nonsmooth solutions is developed. The numerical scheme is based on generalised Jacobi functions in time and Legendre polynomials in space. The generalised Jacobi functions match the leading singularity of the corresponding problem. Therefore, the method performs better than methods with polynomial bases. The stability and convergence of the method are proved. Numerical experiments confifirm the theoretical error estimates.