diff --git a/ruoyi-ui/src/views/playlist/normal/index.vue b/ruoyi-ui/src/views/playlist/normal/index.vue
index a6de291..d3fa363 100644
--- a/ruoyi-ui/src/views/playlist/normal/index.vue
+++ b/ruoyi-ui/src/views/playlist/normal/index.vue
@@ -48,7 +48,7 @@
-
+
-
+
+
+ {{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}
+
+
{
+ if (value && (value.trim() === '' || value !== value.trim())) {
+ callback(new Error('音乐名称不能为纯空格或包含首尾空格'));
+ } else {
+ callback();
+ }
+ },
+ trigger: "blur"
+ }
],
author: [
- { required: true, message: "作者不能为空", trigger: "blur" }
+ { required: true, message: "作者不能为空", trigger: "blur" },
+ {
+ validator: (rule, value, callback) => {
+ if (value && (value.trim() === '' || value !== value.trim())) {
+ callback(new Error('作者不能为纯空格或包含首尾空格'));
+ } else {
+ callback();
+ }
+ },
+ trigger: "blur"
+ }
],
vip: [
{ required: true, message: "VIP权限不能为空", trigger: "change" }
@@ -380,6 +405,24 @@ export default {
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
+ // 提交前清理数据,去除首尾空格
+ if (this.form.name) {
+ this.form.name = this.form.name.trim();
+ }
+ if (this.form.author) {
+ this.form.author = this.form.author.trim();
+ }
+
+ // 再次验证清理后的数据
+ if (!this.form.name || this.form.name === '') {
+ this.$modal.msgError("音乐名称不能为空或纯空格");
+ return;
+ }
+ if (!this.form.author || this.form.author === '') {
+ this.$modal.msgError("作者不能为空或纯空格");
+ return;
+ }
+
if (this.form.id != null) {
updateNormalSong(this.form).then(response => {
this.$modal.msgSuccess("修改成功");