02 - Unit07:显示笔记下拉菜单、笔记的分享功能、笔记的删除功能
顯示筆記下拉菜單
筆記的分享功能
發(fā)送Ajax請求
-
綁定事件:綁定分享按鈕單擊事件
-
參數(shù)獲取:筆記ID
-
發(fā)送請求:/share/add.do
服務(wù)器處理
-
ShareController
-
ShareService
-
ShareDao
-
ShareMapper: inert inot cn_share
Ajax回調(diào)處理
-
SUCCESS: 提示分享成功
-
ERROR:提示分享失敗
筆記的刪除功能
發(fā)送Ajax請求
-
綁定事件:監(jiān)聽alert頁面創(chuàng)建按鈕(給按鈕增加ID:deleteNote)
$("#can").on("click","#deleteNote",function(){}); -
獲取參數(shù):筆記ID
var $li=$("#note_ul a.checked").parent(); var noteId=$li.data("noteId"); -
發(fā)送請求: /note/delete.do
服務(wù)器處理
-
NoteController.delNote(String noteId)
-
NoteService.delNote(String noteId);
-
NoteDao.updateStatus(String noteId)
-
Mapper:
<update id="updateStatus" parameterType="String"> update cn_noteset cn_note_status_id='2' where cn_note_id=#{id} </update> -
測試數(shù)據(jù)準(zhǔn)備
select cn_note_id from cn_note where cn_user_id='48595f52- b22c-4485-9244-f4004255b972' and cn_notebook_id='1db556b9-d1dc-4ed9-8274-45cf0afbe859'; -
測試執(zhí)行完成
select cn_note_status_id from cn_note where cn_note_id='b11608c5-1f77-4e10-a557-c08fd4becbc5';+-------------------+ | cn_note_status_id | +-------------------+ | 2 | +-------------------+ 1 row in set (0.00 sec)
Ajax回調(diào)處理
-
success:
-
刪除筆記列表中的li元素
-
提示:筆記刪除成功
success:function(result){ if(result.state==0){ $li.remove(); alert("刪除筆記成功"); } }
-
error:提示筆記刪除失敗
作業(yè):密碼修改功能
- 邏輯處理:
輸入原密碼與數(shù)據(jù)庫中查詢處理的密碼進(jìn)行匹配
匹配成功,更新數(shù)據(jù)庫密碼字段值
- 回調(diào)處理:
密碼修改成功(服務(wù)器處理完成)以后,重定位到登錄頁面
轉(zhuǎn)載于:https://www.cnblogs.com/tangshengwei/p/6602584.html
總結(jié)
以上是生活随笔為你收集整理的02 - Unit07:显示笔记下拉菜单、笔记的分享功能、笔记的删除功能的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Spring MVC Servlet
- 下一篇: IDA*-洛谷P1379 八数码难题