Concise writing
if(res.data){ //如果存在链接,打开第三方 window.location.href=res.data }else{ //不存在跳转到其他页面 uni.$utils.common.on('/pages/index/index') }