提交 617e5efb 编写于 作者: E Evan

update: 实现图书删除功能

上级 83679055
......@@ -12,7 +12,7 @@
<el-menu-item v-for="(item,i) in navList" :key="i" :index="item.name">
{{ item.navItem }}
</el-menu-item>
<span style="float: right;padding: 20px;"><a href="#nowhere" style="color: #222">更多功能</a></span>
<a href="#nowhere" style="color: #222;float: right;padding: 20px;">更多功能</a>
<i class="el-icon-menu" style="float:right;font-size: 45px;color: #222;padding-top: 8px"></i>
<span style="position: absolute;padding-top: 20px;right: 43%;font-size: 20px;font-weight: bold">White Jotter - Your Mind Palace</span>
<el-input
......@@ -56,4 +56,8 @@
a{
text-decoration: none;
}
span {
pointer-events: none;
}
</style>
<script>
export default {
beforeRouteEnter (to, from, next) {
next(vm => {
vm.$router.replace(from.path)
})
}
}
</script>
<style scoped>
</style>
......@@ -6,9 +6,15 @@
</div>
<div class="block">
<el-timeline>
<el-timeline-item timestamp="2019/4/4" placement="top">
<el-card>
<h4>实现图书删除功能</h4>
<p>Evan 提交于 2019/4/4 22:50</p>
</el-card>
</el-timeline-item>
<el-timeline-item timestamp="2019/4/3" placement="top">
<el-card>
<h4>实现图书添加功能与无空白刷新页面</h4>
<h4>实现图书添加功能</h4>
<p>Evan 提交于 2019/4/3 21:34</p>
</el-card>
</el-timeline-item>
......@@ -30,18 +36,6 @@
<p>Evan 提交于 2019/3/31 09:19</p>
</el-card>
</el-timeline-item>
<el-timeline-item timestamp="2019/3/30" placement="top">
<el-card>
<h4>完善左侧导航</h4>
<p>Evan 提交于 2019/3/30 21:59</p>
</el-card>
</el-timeline-item>
<el-timeline-item timestamp="2019/3/30" placement="top">
<el-card>
<h4>更新首页布局</h4>
<p>Evan 提交于 2019/3/30 21:23</p>
</el-card>
</el-timeline-item>
</el-timeline>
</div>
</el-card>
......
......@@ -60,14 +60,6 @@
mounted: {
},
methods: {
refresh () {
this.$router.replace({
path: '/refresh',
query: {
t: Date.now()
}
})
},
onSubmit () {
console.log('submit!')
this.$axios
......@@ -81,7 +73,7 @@
}).then(resp => {
if (resp && resp.status === 200) {
this.dialogFormVisible = false
this.refresh()
this.$emit('onSubmit')
}
})
}
......
......@@ -30,16 +30,18 @@
<div class="title">
<a href="">{{item.title}}</a>
</div>
<div class="author">{{item.author}}</div>
<i class="el-icon-delete" @click="deleteBook(item.id)"></i>
</div>
<div class="author">{{item.author}}</div>
</el-card>
</el-tooltip>
<add-button></add-button>
<add-button @onSubmit="loadBooks()"></add-button>
</div>
</template>
<script>
import AddButton from './AddButton'
export default {
name: 'BookCard',
components: {AddButton},
......@@ -58,6 +60,27 @@
})
}
})
},
deleteBook (id) {
this.$confirm('此操作将永久删除该书籍, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$axios
.post('/delete', {id: id}).then(resp => {
if (resp && resp.status === 200) {
this.loadBooks()
}
})
}
).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
// alert(id)
}
},
data: function () {
......@@ -102,6 +125,11 @@
line-height: 17px;
}
.el-icon-delete {
cursor: pointer;
float: right;
}
a {
text-decoration: none;
}
......
......@@ -8,7 +8,7 @@
<el-col :span="24" style="width: 100%;text-align: left;line-height: 100%;height: 40px"><Tag></Tag></el-col>
</el-row>
<el-row>
<book-card></book-card>
<books></books>
</el-row>
<el-row>
<!--<pagination></pagination>-->
......@@ -24,10 +24,10 @@
import SideMenu from './SideMenu'
import Tag from './Tag'
import Pagination from './Pagination'
import BookCard from './BookCard'
import Books from './Books'
export default {
name: 'AppLibrary',
components: {BookCard, Pagination, Tag, SideMenu}
components: {Books, Pagination, Tag, SideMenu}
}
</script>
......
......@@ -7,7 +7,6 @@ import LibraryIndex from '@/components/library/LibraryIndex'
import Login from '@/components/Login'
import Home from '@/components/Home'
import Subject from '@/components/library/subject/Subject'
import Refresh from '@/components/common/Refresh'
Vue.use(Router)
......@@ -20,11 +19,6 @@ export default new Router({
redirect: '/login',
component: Login
},
{
path: '/refresh',
name: 'Refresh',
component: Refresh
},
{
// 表面是appindex,实际上是先访问了home然后跳转的。
// home页面并不需要被访问,只是作为其它组件的父组件
......
......@@ -24,7 +24,13 @@ public class LibraryController {
@PostMapping(value = "/api/library")
public Book add(@RequestBody Book book) throws Exception {
bookService.add(book);
System.out.printf("test");
return book;
}
@CrossOrigin
@PostMapping(value = "/api/delete")
public void delete(@RequestBody Book book) throws Exception {
bookService.deleteById(book.getId());
// System.out.println(book.getId());
}
}
......@@ -21,4 +21,8 @@ public class BookService {
public void add(Book book) {
bookDAO.save(book);
}
public void deleteById(int id) {
bookDAO.deleteById(id);
}
}
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>白卷 - White Jotter</title><link href=/static/css/app.b8ac91fdbe9c2cf2ccd6e773ff36a296.css rel=stylesheet></head><body style="background: #f6f6f6"><div id=app></div><script type=text/javascript src=/static/js/manifest.2ae2e69a05c33dfc65f8.js></script><script type=text/javascript src=/static/js/vendor.578a67f45ff71504b68d.js></script><script type=text/javascript src=/static/js/app.82efdbe31204b981fe4b.js></script></body></html>
\ No newline at end of file
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>白卷 - White Jotter</title><link href=/static/css/app.a23d4adcc63c3f13864170b6dc3a1d0e.css rel=stylesheet></head><body style="background: #f6f6f6"><div id=app></div><script type=text/javascript src=/static/js/manifest.2ae2e69a05c33dfc65f8.js></script><script type=text/javascript src=/static/js/vendor.578a67f45ff71504b68d.js></script><script type=text/javascript src=/static/js/app.073480a1c08d20dc611b.js></script></body></html>
\ No newline at end of file
{"version":3,"sources":["webpack:///webpack/bootstrap 1deeddc449301fc090cc"],"names":["parentJsonpFunction","window","chunkIds","moreModules","executeModules","moduleId","chunkId","result","i","resolves","length","installedChunks","push","Object","prototype","hasOwnProperty","call","modules","shift","__webpack_require__","s","installedModules","2","exports","module","l","m","c","d","name","getter","o","defineProperty","configurable","enumerable","get","n","__esModule","object","property","p","oe","err","console","error"],"mappings":"aACA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GAAA,SAAAC,GAA8D,MAApBC,QAAAC,MAAAF,GAAoBA","file":"static/js/manifest.2ae2e69a05c33dfc65f8.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tvar parentJsonpFunction = window[\"webpackJsonp\"];\n \twindow[\"webpackJsonp\"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) {\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [], result;\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules);\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n \t\tif(executeModules) {\n \t\t\tfor(i=0; i < executeModules.length; i++) {\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = executeModules[i]);\n \t\t\t}\n \t\t}\n \t\treturn result;\n \t};\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// objects to store loaded and loading chunks\n \tvar installedChunks = {\n \t\t2: 0\n \t};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n \t// on error function for async loading\n \t__webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 1deeddc449301fc090cc"],"sourceRoot":""}
\ No newline at end of file
{"version":3,"sources":["webpack:///webpack/bootstrap 4c118a982729e776c515"],"names":["parentJsonpFunction","window","chunkIds","moreModules","executeModules","moduleId","chunkId","result","i","resolves","length","installedChunks","push","Object","prototype","hasOwnProperty","call","modules","shift","__webpack_require__","s","installedModules","2","exports","module","l","m","c","d","name","getter","o","defineProperty","configurable","enumerable","get","n","__esModule","object","property","p","oe","err","console","error"],"mappings":"aACA,IAAAA,EAAAC,OAAA,aACAA,OAAA,sBAAAC,EAAAC,EAAAC,GAIA,IADA,IAAAC,EAAAC,EAAAC,EAAAC,EAAA,EAAAC,KACQD,EAAAN,EAAAQ,OAAoBF,IAC5BF,EAAAJ,EAAAM,GACAG,EAAAL,IACAG,EAAAG,KAAAD,EAAAL,GAAA,IAEAK,EAAAL,GAAA,EAEA,IAAAD,KAAAF,EACAU,OAAAC,UAAAC,eAAAC,KAAAb,EAAAE,KACAY,EAAAZ,GAAAF,EAAAE,IAIA,IADAL,KAAAE,EAAAC,EAAAC,GACAK,EAAAC,QACAD,EAAAS,OAAAT,GAEA,GAAAL,EACA,IAAAI,EAAA,EAAYA,EAAAJ,EAAAM,OAA2BF,IACvCD,EAAAY,IAAAC,EAAAhB,EAAAI,IAGA,OAAAD,GAIA,IAAAc,KAGAV,GACAW,EAAA,GAIA,SAAAH,EAAAd,GAGA,GAAAgB,EAAAhB,GACA,OAAAgB,EAAAhB,GAAAkB,QAGA,IAAAC,EAAAH,EAAAhB,IACAG,EAAAH,EACAoB,GAAA,EACAF,YAUA,OANAN,EAAAZ,GAAAW,KAAAQ,EAAAD,QAAAC,IAAAD,QAAAJ,GAGAK,EAAAC,GAAA,EAGAD,EAAAD,QAKAJ,EAAAO,EAAAT,EAGAE,EAAAQ,EAAAN,EAGAF,EAAAS,EAAA,SAAAL,EAAAM,EAAAC,GACAX,EAAAY,EAAAR,EAAAM,IACAhB,OAAAmB,eAAAT,EAAAM,GACAI,cAAA,EACAC,YAAA,EACAC,IAAAL,KAMAX,EAAAiB,EAAA,SAAAZ,GACA,IAAAM,EAAAN,KAAAa,WACA,WAA2B,OAAAb,EAAA,SAC3B,WAAiC,OAAAA,GAEjC,OADAL,EAAAS,EAAAE,EAAA,IAAAA,GACAA,GAIAX,EAAAY,EAAA,SAAAO,EAAAC,GAAsD,OAAA1B,OAAAC,UAAAC,eAAAC,KAAAsB,EAAAC,IAGtDpB,EAAAqB,EAAA,IAGArB,EAAAsB,GAAA,SAAAC,GAA8D,MAApBC,QAAAC,MAAAF,GAAoBA","file":"static/js/manifest.2ae2e69a05c33dfc65f8.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tvar parentJsonpFunction = window[\"webpackJsonp\"];\n \twindow[\"webpackJsonp\"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) {\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [], result;\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules);\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n \t\tif(executeModules) {\n \t\t\tfor(i=0; i < executeModules.length; i++) {\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = executeModules[i]);\n \t\t\t}\n \t\t}\n \t\treturn result;\n \t};\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// objects to store loaded and loading chunks\n \tvar installedChunks = {\n \t\t2: 0\n \t};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n \t// on error function for async loading\n \t__webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 4c118a982729e776c515"],"sourceRoot":""}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册