diff --git a/data/picture/2d0553b0-6333-44bd-adae-90e4546a0660 b/data/picture/93a8371bdaaa702e85bf197a42861951f48e308ed6f2422247ed0b7a1cdab930 similarity index 100% rename from data/picture/2d0553b0-6333-44bd-adae-90e4546a0660 rename to data/picture/93a8371bdaaa702e85bf197a42861951f48e308ed6f2422247ed0b7a1cdab930 diff --git a/src/main/kotlin/team8/fruitable/controller/action/Account.kt b/src/main/kotlin/team8/fruitable/controller/action/Account.kt index 7e495e5..3fda1e2 100644 --- a/src/main/kotlin/team8/fruitable/controller/action/Account.kt +++ b/src/main/kotlin/team8/fruitable/controller/action/Account.kt @@ -8,7 +8,7 @@ import org.springframework.web.bind.annotation.PostMapping import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.bind.annotation.RequestParam import org.springframework.web.servlet.mvc.support.RedirectAttributes -import team8.fruitable.controller.util.Util.Companion.error +import team8.fruitable.controller.util.error import team8.fruitable.datebase.entity.User import team8.fruitable.datebase.repository.AccountRepository diff --git a/src/main/kotlin/team8/fruitable/controller/action/ItemEditor.kt b/src/main/kotlin/team8/fruitable/controller/action/ItemEditor.kt index b498b78..92ceafd 100644 --- a/src/main/kotlin/team8/fruitable/controller/action/ItemEditor.kt +++ b/src/main/kotlin/team8/fruitable/controller/action/ItemEditor.kt @@ -5,15 +5,16 @@ import org.springframework.stereotype.Controller import org.springframework.web.bind.annotation.* import org.springframework.web.multipart.MultipartFile import org.springframework.web.servlet.mvc.support.RedirectAttributes -import team8.fruitable.controller.util.Util.Companion.error +import team8.fruitable.controller.util.error import team8.fruitable.datebase.entity.Item import team8.fruitable.datebase.entity.Tag import team8.fruitable.datebase.entity.User import team8.fruitable.datebase.repository.AccountRepository import team8.fruitable.datebase.repository.ItemRepository import team8.fruitable.datebase.repository.TagRepository +import team8.fruitable.util.hash import java.io.File -import java.util.* +import kotlin.io.path.Path @Controller @RequestMapping("/action/edit/item") @@ -39,12 +40,12 @@ class ItemEditor( private fun autoCreateTag(tags: List): MutableList { val result: MutableList = mutableListOf() - for (i in tags) { - val oldTag = tagRepository.findByName(i); + tags.forEach { + val oldTag = tagRepository.findByName(it) if (oldTag != null) { result.add(oldTag) } else { - val newTag = Tag(i) + val newTag = Tag(it) tagRepository.save(newTag) result.add(newTag) } @@ -56,10 +57,11 @@ class ItemEditor( return this.autoCreateTag(tags.split(" ")) } - private fun uploadPicture(file: MultipartFile): String { - val uuid = UUID.randomUUID().toString() - file.transferTo(File("${pictureUploadPath}${File.separator}${uuid}")) - return uuid + private fun uploadPicture(file: MultipartFile): String? { + if (file.isEmpty) return null + val hash = hash(file) + file.transferTo(Path("${pictureUploadPath}${File.separator}${hash}")) + return hash } @PostMapping("/create") @@ -74,8 +76,9 @@ class ItemEditor( @RequestParam("redirect", required = false) redirect: String? ): String { if (!this.hasAdminPermissions(token)) return error(attributes, "创建商品", "账户无权限") - if (name.isBlank()) return error(attributes, "更新商品", "商品名不能为空") - if (price == 0.0) return error(attributes, "更新商品", "商品价格不能为0") + if (name.isBlank()) return error(attributes, "创建商品", "商品名不能为空") + if (price == 0.0) return error(attributes, "创建商品", "商品价格不能为0") + if (picture.isEmpty) return error(attributes, "创建商品", "必须上传商品图片") itemRepository.save(Item(name, price, description, uploadPicture(picture), tag?.let { this.autoCreateTag(it) })) redirect?.let { return "redirect:/${it}" } return "redirect:/editor?use=item" @@ -97,7 +100,12 @@ class ItemEditor( if (name.isBlank()) return error(attributes, "更新商品", "商品名不能为空") if (price == 0.0) return error(attributes, "更新商品", "商品价格不能为0") val item = itemRepository.findById(id).orElse(null) ?: return error(attributes, "更新商品", "未找到目标商品") - item.update(name, price, description, picture?.let { uploadPicture(it) }, tag?.let { this.autoCreateTag(it) }) + item.update( + name, + price, + description, + picture?.let { this.uploadPicture(it) }, + tag?.let { this.autoCreateTag(it) }) itemRepository.save(item) redirect?.let { return "redirect:/${it}" } return "redirect:/editor?use=item" diff --git a/src/main/kotlin/team8/fruitable/controller/action/UserEditor.kt b/src/main/kotlin/team8/fruitable/controller/action/UserEditor.kt index 670fb9b..30bea8d 100644 --- a/src/main/kotlin/team8/fruitable/controller/action/UserEditor.kt +++ b/src/main/kotlin/team8/fruitable/controller/action/UserEditor.kt @@ -5,7 +5,7 @@ import jakarta.servlet.http.HttpServletResponse import org.springframework.stereotype.Controller import org.springframework.web.bind.annotation.* import org.springframework.web.servlet.mvc.support.RedirectAttributes -import team8.fruitable.controller.util.Util.Companion.error +import team8.fruitable.controller.util.error import team8.fruitable.datebase.entity.User import team8.fruitable.datebase.repository.AccountRepository @@ -64,8 +64,14 @@ class UserEditor(private val accountRepository: AccountRepository) { ): String { val currentUser = this.getCurrentUser(token) ?: return error(attributes, "更新用户", "账户未登录") if (!this.hasAdminPermissions(currentUser)) return error(attributes, "更新用户", "账户无权限") - val user = accountRepository.findById(id).orElse(null) ?: return error(attributes, "更新用户", "未找到此用户", "/editor?use=user") + val user = accountRepository.findById(id).orElse(null) ?: return error( + attributes, + "更新用户", + "未找到此用户", + "/editor?use=user" + ) user.update(name, password, age, gender, phone, email, address, isAdmin) + accountRepository.save(user) if (currentUser.id == id) { val cookie = Cookie("TOKEN", user.token) cookie.path = "/" @@ -86,7 +92,12 @@ class UserEditor(private val accountRepository: AccountRepository) { val currentUser = this.getCurrentUser(token) ?: return error(attributes, "删除用户", "账户未登录") if (!this.hasAdminPermissions(currentUser)) return error(attributes, "删除用户", "账户无权限") if (currentUser.id == id) return error(attributes, "删除用户", "无法删除当前使用的账户", "/editor?use=user") - val user = accountRepository.findById(id).orElse(null) ?: return error(attributes, "删除用户", "未找到此用户", "/editor?use=user") + val user = accountRepository.findById(id).orElse(null) ?: return error( + attributes, + "删除用户", + "未找到此用户", + "/editor?use=user" + ) accountRepository.delete(user) redirect?.let { return "redirect:/${it}" } return "redirect:/editor?use=user" diff --git a/src/main/kotlin/team8/fruitable/controller/page/Editor.kt b/src/main/kotlin/team8/fruitable/controller/page/Editor.kt index 2dd5c10..538be58 100644 --- a/src/main/kotlin/team8/fruitable/controller/page/Editor.kt +++ b/src/main/kotlin/team8/fruitable/controller/page/Editor.kt @@ -8,7 +8,7 @@ import org.springframework.web.bind.annotation.CookieValue import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.bind.annotation.RequestParam import org.springframework.web.servlet.mvc.support.RedirectAttributes -import team8.fruitable.controller.util.Util +import team8.fruitable.controller.util.error import team8.fruitable.datebase.entity.User import team8.fruitable.datebase.repository.AccountRepository import team8.fruitable.datebase.repository.ItemRepository @@ -20,8 +20,8 @@ import team8.fruitable.datebase.repository.PagebleItemRepository class Editor( private val accountRepository: AccountRepository, private val itemRepository: ItemRepository, - private val pagebleAccountRepository: PagebleAccountRepository, - private val pagebleItemRepository: PagebleItemRepository + private val pagingAccountRepository: PagebleAccountRepository, + private val pagingItemRepository: PagebleItemRepository ) { private fun getCurrentUser(token: String?): User? { return token?.let(accountRepository::findByToken) @@ -74,15 +74,17 @@ class Editor( @RequestParam("search_content", required = false) searchContent: String?, @RequestParam("page", required = false) page: Int?, ): String { - val user = this.getCurrentUser(token) ?: return Util.error(attributes, "更新", "账户未登录", "/login") - if (!this.hasAdminPermissions(user)) return Util.error(attributes, "编辑", "账户无权限编辑网站") + val user = this.getCurrentUser(token) ?: return error(attributes, "编辑", "账户未登录", "/login") + if (!this.hasAdminPermissions(user)) return error(attributes, "编辑", "账户无权限编辑网站") + model["isEditor"] = true + model["user"] = user model["using"] = use model["tabs"] = editorTabs if (searchContent != null) model["searching"] = searchContent val pageRequested = PageRequest.of(page ?: 0, 15) val data = when (use) { - "item" -> pagebleItemRepository.findAll(pageRequested) - else -> pagebleAccountRepository.findAll(pageRequested) + "item" -> pagingItemRepository.findAll(pageRequested) + else -> pagingAccountRepository.findAll(pageRequested) } model["data"] = data model["pages"] = (page ?: 0).let { @@ -115,15 +117,15 @@ class Editor( "item" -> { target?.let { itemRepository.findById(it) - .orElse(null) ?: return Util.error(attributes, "编辑", "无法找到目标商品") - } ?: return Util.error(attributes, "编辑", "目标商品为空") + .orElse(null) ?: return error(attributes, "编辑", "无法找到目标商品") + } ?: return error(attributes, "编辑", "目标商品为空") } else -> { val targetUser = target?.let { accountRepository.findById(it) - .orElse(null) ?: return Util.error(attributes, "编辑", "无法找到目标用户") - } ?: return Util.error(attributes, "编辑", "目标用户为空") + .orElse(null) ?: return error(attributes, "编辑", "无法找到目标用户") + } ?: return error(attributes, "编辑", "目标用户为空") if (action == "updating") when (targetUser.gender) { "M" -> model["isGenderAsMale"] = true "F" -> model["isGenderAsFemale"] = true diff --git a/src/main/kotlin/team8/fruitable/controller/page/Pages.kt b/src/main/kotlin/team8/fruitable/controller/page/Pages.kt index 500f33e..0a599a1 100644 --- a/src/main/kotlin/team8/fruitable/controller/page/Pages.kt +++ b/src/main/kotlin/team8/fruitable/controller/page/Pages.kt @@ -6,7 +6,7 @@ import org.springframework.ui.set import org.springframework.web.bind.annotation.CookieValue import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.servlet.mvc.support.RedirectAttributes -import team8.fruitable.controller.util.Util.Companion.error +import team8.fruitable.controller.util.error import team8.fruitable.datebase.entity.User import team8.fruitable.datebase.repository.AccountRepository diff --git a/src/main/kotlin/team8/fruitable/controller/util/Util.kt b/src/main/kotlin/team8/fruitable/controller/util/Util.kt index 4c3d8b3..0287117 100644 --- a/src/main/kotlin/team8/fruitable/controller/util/Util.kt +++ b/src/main/kotlin/team8/fruitable/controller/util/Util.kt @@ -2,18 +2,14 @@ package team8.fruitable.controller.util import org.springframework.web.servlet.mvc.support.RedirectAttributes -class Util { - companion object { - fun error( - redirectAttributes: RedirectAttributes, - title: String, - message: String, - redirect: String = "/" - ): String { - redirectAttributes.addFlashAttribute("title", title) - redirectAttributes.addFlashAttribute("message", message) - redirectAttributes.addFlashAttribute("redirect", redirect) - return "redirect:/error" - } - } +fun error( + redirectAttributes: RedirectAttributes, + title: String, + message: String, + redirect: String = "/" +): String { + redirectAttributes.addFlashAttribute("title", title) + redirectAttributes.addFlashAttribute("message", message) + redirectAttributes.addFlashAttribute("redirect", redirect) + return "redirect:/error" } diff --git a/src/main/kotlin/team8/fruitable/datebase/entity/Item.kt b/src/main/kotlin/team8/fruitable/datebase/entity/Item.kt index 9d4a078..6444617 100644 --- a/src/main/kotlin/team8/fruitable/datebase/entity/Item.kt +++ b/src/main/kotlin/team8/fruitable/datebase/entity/Item.kt @@ -1,6 +1,7 @@ package team8.fruitable.datebase.entity import jakarta.persistence.* +import org.springframework.context.annotation.Bean import java.time.LocalDateTime @Entity @@ -26,7 +27,7 @@ class Item( @Column(name = "description", length = 320, nullable = true) var description: String? = null, - @Column(name = "picture", length = 36, nullable = true) + @Column(name = "picture", length = 64, nullable = true) var picture: String? = null, @Column(name = "is_removed", nullable = false) @@ -36,11 +37,20 @@ class Item( @JoinColumn(name = "carts") var carted: User? = null, - @ManyToOne - @JoinColumn(name = "items") - var ordered: Order? = null, + @ManyToMany(cascade = [CascadeType.ALL], fetch = FetchType.LAZY) + @JoinTable( + name = "orders_to_items", + joinColumns = [JoinColumn(name = "item_id", nullable = false)], + inverseJoinColumns = [JoinColumn(name = "order_id", nullable = false)] + ) + var orders: MutableList = mutableListOf(), - @OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.LAZY, mappedBy = "tagedItem") + @ManyToMany(cascade = [CascadeType.ALL], fetch = FetchType.LAZY) + @JoinTable( + name = "items_to_tags", + joinColumns = [JoinColumn(name = "item_id")], + inverseJoinColumns = [JoinColumn(name = "tag_id")] + ) var tags: MutableList = mutableListOf(), @OneToOne(mappedBy = "item") @@ -77,7 +87,7 @@ class Item( this.price = price?.let { if (it <= 0) null else it } if (!description.isNullOrBlank()) this.description = description if (!picture.isNullOrBlank()) this.picture = picture - tags?.let { this.tags.addAll(it) } + tags?.let { this.tags = it } isRemoved?.let { this.isRemoved = it } this.updateEditTime() } @@ -85,4 +95,14 @@ class Item( fun updateEditTime() { this.editTime = LocalDateTime.now() } + + @Bean + fun getTagPretty(): String { + return this.tags.joinToString(", ") + } + + @Bean + fun getTagString(): String { + return this.tags.joinToString(" ") + } } diff --git a/src/main/kotlin/team8/fruitable/datebase/entity/Order.kt b/src/main/kotlin/team8/fruitable/datebase/entity/Order.kt index 3b31b74..0fe9918 100644 --- a/src/main/kotlin/team8/fruitable/datebase/entity/Order.kt +++ b/src/main/kotlin/team8/fruitable/datebase/entity/Order.kt @@ -27,8 +27,8 @@ class Order( @Column(name = "address", length = 64, nullable = false) var address: String? = null, - @ManyToOne(optional = false) - @JoinColumn(name = "pay_type") + @ManyToOne + @JoinColumn(name = "order_id") var payType: PayType? = null, @Column(name = "pay_status", nullable = false) @@ -37,6 +37,11 @@ class Order( @Column(name = "price", nullable = false) var priceSum: Double = .0, - @OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.LAZY, mappedBy = "ordered") - var items: MutableList = mutableListOf() + @ManyToMany(cascade = [CascadeType.ALL], fetch = FetchType.LAZY) + @JoinTable( + name = "orders_to_items", + joinColumns = [JoinColumn(name = "order_id", nullable = false)], + inverseJoinColumns = [JoinColumn(name = "item_id", nullable = false)] + ) + var items: MutableList = mutableListOf() ) diff --git a/src/main/kotlin/team8/fruitable/datebase/entity/OrderedItem.kt b/src/main/kotlin/team8/fruitable/datebase/entity/OrderedItem.kt new file mode 100644 index 0000000..0dae231 --- /dev/null +++ b/src/main/kotlin/team8/fruitable/datebase/entity/OrderedItem.kt @@ -0,0 +1,23 @@ +package team8.fruitable.datebase.entity + +import jakarta.persistence.* + +@Entity +@Table(name = "orders_to_items") +class OrderedItem( + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id", nullable = false) + var id: Long? = null, + + @ManyToOne + @JoinColumn(name = "order_id") + var order: Order? = null, + + @ManyToOne + @JoinColumn(name = "item_id") + var item: Item? = null, + + @Column(name = "number", nullable = false) + var number: Int? = 0 +) diff --git a/src/main/kotlin/team8/fruitable/datebase/entity/PayType.kt b/src/main/kotlin/team8/fruitable/datebase/entity/PayType.kt index 784c2a4..5e4990a 100644 --- a/src/main/kotlin/team8/fruitable/datebase/entity/PayType.kt +++ b/src/main/kotlin/team8/fruitable/datebase/entity/PayType.kt @@ -13,6 +13,7 @@ class PayType( @Column(name = "NAME", length = 16, nullable = false) var name: String? = null, - @OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.LAZY, mappedBy = "payType") - var orders: MutableList = mutableListOf() + @OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.LAZY) + @JoinColumn(name = "pay_type", nullable = false) + var orders: MutableList = mutableListOf() ) diff --git a/src/main/kotlin/team8/fruitable/datebase/entity/Tag.kt b/src/main/kotlin/team8/fruitable/datebase/entity/Tag.kt index f0c7070..30dace2 100644 --- a/src/main/kotlin/team8/fruitable/datebase/entity/Tag.kt +++ b/src/main/kotlin/team8/fruitable/datebase/entity/Tag.kt @@ -13,11 +13,19 @@ class Tag( @Column(name = "name", length = 16, nullable = false) var name: String? = null, - @ManyToOne - @JoinColumn(name = "taged") - var tagedItem: Item? = null + @ManyToMany(cascade = [CascadeType.ALL], fetch = FetchType.LAZY) + @JoinTable( + name = "items_to_tags", + joinColumns = [JoinColumn(name = "tag_id", referencedColumnName = "id")], + inverseJoinColumns = [JoinColumn(name = "item_id", referencedColumnName = "id")] + ) + var items: MutableList = mutableListOf() ) { constructor(name: String) : this() { this.name = name } + + override fun toString(): String { + return this.name ?: super.toString() + } } diff --git a/src/main/kotlin/team8/fruitable/datebase/entity/User.kt b/src/main/kotlin/team8/fruitable/datebase/entity/User.kt index 763ed14..12ac835 100644 --- a/src/main/kotlin/team8/fruitable/datebase/entity/User.kt +++ b/src/main/kotlin/team8/fruitable/datebase/entity/User.kt @@ -1,7 +1,8 @@ package team8.fruitable.datebase.entity import jakarta.persistence.* -import team8.fruitable.util.Util +import org.springframework.context.annotation.Bean +import team8.fruitable.util.hash import java.time.LocalDateTime import java.util.* @@ -76,7 +77,7 @@ class User( } private final fun genPassword(password: String): String { - return Util.hash(password) + return hash(password) } fun update( @@ -93,15 +94,16 @@ class User( if (!password.isNullOrBlank()) this.updatePassword(password) this.age = age?.let { if (it <= 0) null else it } if (!gender.isNullOrBlank()) this.gender = gender - if (!phone.isNullOrBlank()) this.phone = phone - if (!email.isNullOrBlank()) this.email = email - if (!address.isNullOrBlank()) this.address = address + this.phone = phone?.ifBlank { null } + println("email: ${email?.ifBlank { "null" } ?: "null"}") + this.email = email?.ifBlank { null } + this.address = address?.ifBlank { null } isAdmin?.let { this.isAdmin = it } this.updateToken() } fun testPassword(password: String): Boolean { - return Util.hash(password) == this.password + return hash(password) == this.password } fun updatePassword(password: String) { @@ -115,4 +117,13 @@ class User( fun updateToken() { this.token = UUID.randomUUID().toString() } + + @Bean + fun getGenderPretty(): String { + return when (this.gender) { + "F" -> "女性" + "M" -> "男性" + else -> "未知" + } + } } diff --git a/src/main/kotlin/team8/fruitable/util/Util.kt b/src/main/kotlin/team8/fruitable/util/Util.kt index 6e5c35e..0b1bc3a 100644 --- a/src/main/kotlin/team8/fruitable/util/Util.kt +++ b/src/main/kotlin/team8/fruitable/util/Util.kt @@ -1,12 +1,17 @@ package team8.fruitable.util +import org.springframework.web.multipart.MultipartFile import java.security.MessageDigest -class Util { - companion object { - fun hash(input: String, algorithm: String = "SHA-256"): String { - return MessageDigest.getInstance(algorithm).digest(input.toByteArray()) - .joinToString("") { "%02x".format(it) } - } - } +fun hash(bytes: ByteArray, algorithm: String = "SHA-256"): String { + return MessageDigest.getInstance(algorithm).digest(bytes) + .joinToString("") { "%02x".format(it) } +} + +fun hash(string: String, algorithm: String = "SHA-256"): String { + return hash(string.toByteArray(), algorithm) +} + +fun hash(multipartFile: MultipartFile, algorithm: String = "SHA-256"): String { + return hash(multipartFile.bytes, algorithm) } diff --git a/src/main/resources/static/styles/edit.less b/src/main/resources/static/styles/edit.less index 2f8b90a..a81d01a 100644 --- a/src/main/resources/static/styles/edit.less +++ b/src/main/resources/static/styles/edit.less @@ -49,17 +49,22 @@ div { > .ResultPanel { flex: 2 auto; + align-items: start; - td { - border: 1px solid cornflowerblue; - } + > .Result { + flex-grow: 1; - > thead { - background-color: #044488; - } + > thead { + background-color: #044488; + } - > tbody { - background-color: #008080; + > tbody { + background-color: #008080; + } + + td { + border: 1px solid cornflowerblue; + } } } diff --git a/src/main/resources/static/styles/form.css b/src/main/resources/static/styles/form.css deleted file mode 100644 index 4c301df..0000000 --- a/src/main/resources/static/styles/form.css +++ /dev/null @@ -1,49 +0,0 @@ -.TabForm { - display: flex; - flex-direction: column; - justify-content: center; -} - -.TabForm > .TabTitle { - margin: 20px 0px; - font-weight: bold; - font-size: 32px; -} - -.TabForm > .TabFormItems { - flex-direction: column; -} - -.TabForm > .TabFormItems > .TabFormItem { - margin-top: 10px; - margin-bottom: 10px; -} - -.TabForm > .TabFormItems > .TabFormItem > .ItemName { - flex: 1 0 0; -} - -.TabForm > .TabFormItems > .TabFormItem > .ItemInput { - flex: 1 0 0; - margin-left: 20px; - border-radius: 10px; - border: 3px solid skyblue; -} - -.TabForm > .TabButtons > .TabButton { - flex: 1; - margin: 20px 15px; - padding: 8px 0px; - border: 3px solid skyblue; - border-radius: 10px; - font-size: 18px; - background: unset; -} - -.TabForm > .TabButtons > .TabButton[type="reset"] { - background: cornflowerblue; -} - -.TabForm > .TabButtons > .TabButton[type="submit"] { - background: aqua; -} diff --git a/src/main/resources/static/styles/form.less b/src/main/resources/static/styles/form.less new file mode 100644 index 0000000..c2b54bb --- /dev/null +++ b/src/main/resources/static/styles/form.less @@ -0,0 +1,53 @@ +.TabForm { + display: flex; + flex-direction: column; + justify-content: center; + + > .TabTitle { + margin: 20px 0; + font-weight: bold; + font-size: 32px; + + &[lowSize] { + font-size: 24px; + } + } + + > .TabFormItems { + flex-direction: column; + + > .TabFormItem { + margin-top: 10px; + margin-bottom: 10px; + + > .ItemName { + flex: 1 0 0; + } + + > .ItemInput { + flex: 1 0 0; + margin-left: 20px; + border-radius: 10px; + border: 3px solid skyblue; + } + } + } + + > .TabButtons > .TabButton { + flex: 1; + margin: 20px 15px; + padding: 8px 0; + border: 3px solid skyblue; + border-radius: 10px; + font-size: 18px; + background: unset; + + &[type="reset"] { + background: cornflowerblue; + } + + &[type="submit"] { + background: aqua; + } + } +} diff --git a/src/main/resources/templates/account.mustache b/src/main/resources/templates/account.mustache index 046786d..b7c59a4 100644 --- a/src/main/resources/templates/account.mustache +++ b/src/main/resources/templates/account.mustache @@ -12,9 +12,11 @@ - + + + diff --git a/src/main/resources/templates/editor.mustache b/src/main/resources/templates/editor.mustache index 9b148cb..111084a 100644 --- a/src/main/resources/templates/editor.mustache +++ b/src/main/resources/templates/editor.mustache @@ -13,7 +13,7 @@ - + diff --git a/src/main/resources/templates/editor/item.mustache b/src/main/resources/templates/editor/item.mustache index 798c1a1..f0b038f 100644 --- a/src/main/resources/templates/editor/item.mustache +++ b/src/main/resources/templates/editor/item.mustache @@ -1,40 +1,44 @@ - - - - - - - - - - - - - - {{#data}} - - - - - - - - +
+
ID商品名创建时间更新时间价格标签操作
{{id}}{{name}}{{createTime}}{{editTime}}{{price}}{{tags}} - - -
+ + + + + + + + + - {{/data}} - -
ID商品名创建时间更新时间价格标签操作
+ + + {{#data}} + + {{id}} + {{name}} + {{createTime}} + {{editTime}} + {{price}} + {{tagPretty}} + + + + + + {{/data}} + + +
{{#isNothing}}
-

请在左侧列表中选择需要进行的操作!

- +
请在左侧列表中选择需要进行的操作!
+
+ +
{{/isNothing}} @@ -50,7 +54,8 @@
- +
@@ -77,7 +82,8 @@ {{/isCreating}} {{#isUpdating}} -
+
更新商品详情
@@ -89,7 +95,7 @@
-
@@ -102,7 +108,7 @@
+ {{#target.tags}}value="{{target.tagString}}"{{/target.tags}}/>
diff --git a/src/main/resources/templates/editor/user.mustache b/src/main/resources/templates/editor/user.mustache index b1963ec..d929ac3 100644 --- a/src/main/resources/templates/editor/user.mustache +++ b/src/main/resources/templates/editor/user.mustache @@ -1,48 +1,52 @@ - - - - - - - - - - - - - - - - - - {{#data}} - - - - - - - - - - - - +
+
ID用户名帐户创建时间最后登录时间年龄性别手机号码邮箱地址管理员操作
{{id}}{{name}}{{createTime}}{{loginTime}}{{#age}}{{age}}{{/age}}{{#gender}}{{gender}}{{/gender}}{{#phone}}{{phone}}{{/phone}}{{#email}}{{email}}{{/email}}{{#address}}{{address}}{{/address}}{{#isAdmin}}是{{/isAdmin}}{{^isAdmin}}否{{/isAdmin}} - - -
+ + + + + + + + + + + + + - {{/data}} - -
ID用户名帐户创建时间最后登录时间年龄性别手机号码邮箱地址管理员操作
+ + + {{#data}} + + {{id}} + {{name}} + {{createTime}} + {{loginTime}} + {{#age}}{{age}}{{/age}} + {{genderPretty}} + {{#phone}}{{phone}}{{/phone}} + {{#email}}{{email}}{{/email}} + {{#address}}{{address}}{{/address}} + {{#isAdmin}}是{{/isAdmin}}{{^isAdmin}}否{{/isAdmin}} + + + + + + {{/data}} + + +
{{#isNothing}} -

请在左侧列表中选择需要进行的操作!

- +
请在左侧列表中选择需要进行的操作!
+
+ +
{{/isNothing}} diff --git a/src/main/resources/templates/login.mustache b/src/main/resources/templates/login.mustache index d35d382..af3cb21 100644 --- a/src/main/resources/templates/login.mustache +++ b/src/main/resources/templates/login.mustache @@ -15,11 +15,12 @@ - - + + + diff --git a/src/main/resources/templates/register.mustache b/src/main/resources/templates/register.mustache index c8846ab..659d45b 100644 --- a/src/main/resources/templates/register.mustache +++ b/src/main/resources/templates/register.mustache @@ -9,17 +9,18 @@ - + - + +