分享页面的js倒计时功能制作
import org.springframework.ui.Model;
public String spellShareController
(@RequestParam(“user_token”) String user_token , @RequestParam(“orderId”) Long orderId, Model modeldel) {}
将所要倒计时的时间放入date中,先在controller中取出现在的date值,然后,且转换格式,分别取出小时,分钟,以及秒
Date date = new Date(time);
SimpleDateFormat sd = new SimpleDateFormat(“HH:mm:ss”);
SimpleDateFormat sdh = new SimpleDateFormat(“HH”);
SimpleDateFormat sdm = new SimpleDateFormat(“mm”);
SimpleDateFormat sds = new SimpleDateFormat(“ss”);
int h = Integer.parseInt(sdh.format(date));
int m = Integer.parseInt(sdm.format(date));
int s = Integer.parseInt(sds.format(date));
int ti = h3600+m60+s; 算出总秒数,
modeldel.addAttribute(“ti”,ti); 将总秒数传递给前台
新建一个div ,放入id 以及text,将其隐藏,