Commit 0a0780aaa254c24b83194473eca7d103227dbc30
1 parent
90bc89ca
add v-cloak
Showing
5 changed files
with
47 additions
and
10 deletions
src/css/test.css
src/html/index.html
| ... | ... | @@ -12,6 +12,11 @@ |
| 12 | 12 | <link rel="bookmark" href="/cms.ico" /> |
| 13 | 13 | <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/element-plus@1.1.0-beta.12/theme-chalk/index.css"> |
| 14 | 14 | <script src="https://cdn.jsdelivr.net/npm/vue@3.2.11/dist/vue.global.js"></script> |
| 15 | + <style> | |
| 16 | + [v-cloak] { | |
| 17 | + display: none; | |
| 18 | + } | |
| 19 | + </style> | |
| 15 | 20 | </head> |
| 16 | 21 | |
| 17 | 22 | <body id="body" class="diy-reset"> |
| ... | ... | @@ -53,7 +58,7 @@ |
| 53 | 58 | <el-input v-model.trim="form.mixing" :maxlength="15" placeholder="请输入混音人名字"></el-input> |
| 54 | 59 | </el-form-item> |
| 55 | 60 | <el-form-item :label="labels.lyric" class="diy-flex-100" prop="lyric"> |
| 56 | - <el-input v-model="form.lyric" maxlength="2500" show-word-limit type="textarea" :rows="10" | |
| 61 | + <el-input v-model="form.lyric" maxlength="2500" :minlength="20" show-word-limit type="textarea" :rows="10" | |
| 57 | 62 | placeholder="请输入歌词"></el-input> |
| 58 | 63 | </el-form-item> |
| 59 | 64 | <el-form-item :label="labels.phone" class="diy-flex-50" prop="phone"> | ... | ... |
src/js/audios.js
| ... | ... | @@ -3,7 +3,7 @@ require("./../css/test.css"); |
| 3 | 3 | // Init Vue |
| 4 | 4 | const Audio = { |
| 5 | 5 | created() { |
| 6 | - parent.postMessage(1000, '*') | |
| 6 | + parent.postMessage(1000, "*"); | |
| 7 | 7 | }, |
| 8 | 8 | data() { |
| 9 | 9 | return { |
| ... | ... | @@ -63,6 +63,14 @@ const Audio = { |
| 63 | 63 | songwriter: [ |
| 64 | 64 | { required: false, trigger: "change", message: "请输入作曲人名字" }, |
| 65 | 65 | ], |
| 66 | + lyric: [ | |
| 67 | + { | |
| 68 | + required: false, | |
| 69 | + trigger: "change", | |
| 70 | + message: "请输入符合要求的歌词,至少20个字,最多不能超过2500个字", | |
| 71 | + validator: all.validateLyric, | |
| 72 | + }, | |
| 73 | + ], | |
| 66 | 74 | }, |
| 67 | 75 | |
| 68 | 76 | uploadUrl: "", |
| ... | ... | @@ -86,6 +94,7 @@ const Audio = { |
| 86 | 94 | this.rules.singer[0].required = false; |
| 87 | 95 | this.rules.songwriter[0].required = false; |
| 88 | 96 | this.rules.lyricist[0].required = true; |
| 97 | + this.rules.lyric[0].required = true; | |
| 89 | 98 | } else if (data == 1278) { |
| 90 | 99 | // 成品 |
| 91 | 100 | this.rules.singer[0].required = true; |
| ... | ... | @@ -93,6 +102,7 @@ const Audio = { |
| 93 | 102 | this.rules.audioId[0].required = true; |
| 94 | 103 | this.rules.lyricist[0].required = false; |
| 95 | 104 | this.rules.songwriter[0].required = false; |
| 105 | + this.rules.lyric[0].required = false; | |
| 96 | 106 | } else if (data == 1280) { |
| 97 | 107 | // 作曲 |
| 98 | 108 | this.rules.songwriter[0].required = true; |
| ... | ... | @@ -100,6 +110,7 @@ const Audio = { |
| 100 | 110 | this.rules.audioId[0].required = true; |
| 101 | 111 | this.rules.singer[0].required = false; |
| 102 | 112 | this.rules.lyricist[0].required = false; |
| 113 | + this.rules.lyric[0].required = false; | |
| 103 | 114 | } else if (data == 1281) { |
| 104 | 115 | // 其他 |
| 105 | 116 | this.rules.songwriter[0].required = false; |
| ... | ... | @@ -107,6 +118,7 @@ const Audio = { |
| 107 | 118 | this.rules.audioId[0].required = true; |
| 108 | 119 | this.rules.singer[0].required = false; |
| 109 | 120 | this.rules.lyricist[0].required = false; |
| 121 | + this.rules.lyric[0].required = false; | |
| 110 | 122 | } |
| 111 | 123 | }, |
| 112 | 124 | // 文件数量超上限响应 |
| ... | ... | @@ -176,7 +188,8 @@ const Audio = { |
| 176 | 188 | const fileSaveObj = { |
| 177 | 189 | videoId: null, |
| 178 | 190 | |
| 179 | - multipleCategory: 100005 + "/" + this.getCategoryText(this.form.channelId), | |
| 191 | + multipleCategory: | |
| 192 | + 100005 + "/" + this.getCategoryText(this.form.channelId), | |
| 180 | 193 | tag: this.getChannelText(this.form.channelId), |
| 181 | 194 | ts: this.getTs(), |
| 182 | 195 | timestamp: this.getTimeStamp(), |
| ... | ... | @@ -188,7 +201,8 @@ const Audio = { |
| 188 | 201 | fileSize: this.form.audioFile.raw.size, |
| 189 | 202 | ts: this.getTs(), |
| 190 | 203 | timestamp: this.getTimeStamp(), |
| 191 | - multipleCategory: 100005 + "/" + this.getCategoryText(this.form.channelId), | |
| 204 | + multipleCategory: | |
| 205 | + 100005 + "/" + this.getCategoryText(this.form.channelId), | |
| 192 | 206 | // masterId: all.secretUrls.masterIdDev, |
| 193 | 207 | masterId: all.secretUrls.masterIdMaster, |
| 194 | 208 | }; |
| ... | ... | @@ -309,7 +323,7 @@ const Audio = { |
| 309 | 323 | fileWholeObj.subscription = |
| 310 | 324 | fileWholeObj.observable.subscribe(observer); |
| 311 | 325 | } else { |
| 312 | - this.reset() | |
| 326 | + this.reset(); | |
| 313 | 327 | this.$message({ |
| 314 | 328 | type: "error", |
| 315 | 329 | duration: 0, | ... | ... |
src/js/config.js
| ... | ... | @@ -152,6 +152,26 @@ const validatePhone = (rules, value, callback) => { |
| 152 | 152 | } |
| 153 | 153 | }; |
| 154 | 154 | |
| 155 | +const validateLyric = (rules, value, callback) => { | |
| 156 | + if(rules.required) { | |
| 157 | + if(value && value.length >= 20) { | |
| 158 | + callback() | |
| 159 | + } else { | |
| 160 | + callback(new Error(rules.message)) | |
| 161 | + } | |
| 162 | + } else { | |
| 163 | + if(value) { | |
| 164 | + if(value.length < 20) { | |
| 165 | + callback(new Error(rules.message)) | |
| 166 | + } else { | |
| 167 | + callback() | |
| 168 | + } | |
| 169 | + } else { | |
| 170 | + callback() | |
| 171 | + } | |
| 172 | + } | |
| 173 | +} | |
| 174 | + | |
| 155 | 175 | const validateName = (rules, value, callback) => { |
| 156 | 176 | if (value.length < 1) { |
| 157 | 177 | callback(new Error("请填写歌曲名称")); |
| ... | ... | @@ -378,6 +398,7 @@ export { |
| 378 | 398 | validateVideoFormat, |
| 379 | 399 | validateNameLength, |
| 380 | 400 | validateVideoSize, |
| 401 | + validateLyric, | |
| 381 | 402 | signFunction, |
| 382 | 403 | parseQueryString, |
| 383 | 404 | request, | ... | ... |
webpack.config.js
| ... | ... | @@ -11,7 +11,7 @@ module.exports = { |
| 11 | 11 | entry: path.join(__dirname, "src", "/js/audios.js"), //__dirname指的是当前目录,是目录形成绝对路径 |
| 12 | 12 | output: { |
| 13 | 13 | //输入的文件名 |
| 14 | - filename: "dada.js", | |
| 14 | + filename: "cloak.js", | |
| 15 | 15 | // filename: '[name].[hash:7].js', |
| 16 | 16 | publicPath: "/", |
| 17 | 17 | //输入的路径 webpack会自动打包生成 |
| ... | ... | @@ -25,7 +25,7 @@ module.exports = { |
| 25 | 25 | //文件中找到的路径 |
| 26 | 26 | template: path.join(__dirname, "src", "html/index.html"), |
| 27 | 27 | //打包输出的路径 |
| 28 | - filename: "dada.html", | |
| 28 | + filename: "cloak.html", | |
| 29 | 29 | }), |
| 30 | 30 | new CleanWebpackPlugin(), |
| 31 | 31 | new JavaScriptObfuscator( | ... | ... |