前文
JavaScript——易班優課YOOC課羣在線測試自動答題解決方案(一)答案獲取
Spring Boot——易班優課YOOC課羣在線測試自動答題解決方案(二)答案儲存
Spring Boot——易班優課YOOC課羣在線測試自動答題解決方案(三)答案查詢
JavaScript——易班優課YOOC課羣在線測試自動答題解決方案(四)答案顯示
JavaScript——易班優課YOOC課羣在線測試自動答題解決方案(五)簡單腳本
Spring Boot——易班優課YOOC課羣在線測試自動答題解決方案(六)後端改造
JavaScript——易班優課YOOC課羣在線測試自動答題解決方案(七)隨機答案
JavaScript——易班優課YOOC課羣在線測試自動答題解決方案(八)功能面板
JavaScript——易班優課YOOC課羣在線測試自動答題解決方案(九)ID標籤
Vue + Element UI + Spring Boot——易班優課YOOC課羣在線測試自動答題解決方案(十)問題管理頁面
JavaScript——易班優課YOOC課羣在線測試自動答題解決方案(十一)恢復右鍵、選擇和複製
JavaScript——易班優課YOOC課羣在線測試自動答題解決方案(十二)腳本整合
JavaScript——易班優課YOOC課羣在線測試自動答題解決方案(十三)自動答題
JavaScript——易班優課YOOC課羣在線測試自動答題解決方案(十四)自動刷題
JavaScript——易班優課YOOC課羣在線測試自動答題解決方案(十五)整合升級+引入jQuery
JavaScript——易班優課YOOC課羣在線測試自動答題解決方案(十六)利用PC端和移動端BUG
JavaScript + Tampermonkey——易班優課YOOC課羣在線測試自動答題解決方案(十七)複合型解決方案油猴腳本
官方文檔
JavaScript和CSS模板:https://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html#natural-javascript-and-css-templates
解決方案
Thymeleaf 3.0允許以一般模板的形式開發複雜的JavaScript腳本和CSS樣式表,這些模板既可以作爲原型也可以作爲工作模板使用。
Controller
@RequestMapping(value = "/yooc_helper.js",method = RequestMethod.GET)
public String updateJS(Model model){
model.addAttribute("ID", UUID.randomUUID().toString());
return "yooc_helper.js";
}
Thymeleaf的JavaScript腳本模板
運行結果
參考文章
https://shentuzhigang.blog.csdn.net/article/details/106643406