Commit 0a0780aaa254c24b83194473eca7d103227dbc30

Authored by 杨泽宇
1 parent 90bc89ca

add v-cloak

src/css/test.css
1 -[v-cloak]{  
2 - display: none;  
3 -}  
4 .diy-reset { 1 .diy-reset {
5 margin: 0; 2 margin: 0;
6 padding: 0 3 padding: 0
src/html/index.html
@@ -12,6 +12,11 @@ @@ -12,6 +12,11 @@
12 <link rel="bookmark" href="/cms.ico" /> 12 <link rel="bookmark" href="/cms.ico" />
13 <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/element-plus@1.1.0-beta.12/theme-chalk/index.css"> 13 <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/element-plus@1.1.0-beta.12/theme-chalk/index.css">
14 <script src="https://cdn.jsdelivr.net/npm/vue@3.2.11/dist/vue.global.js"></script> 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 </head> 20 </head>
16 21
17 <body id="body" class="diy-reset"> 22 <body id="body" class="diy-reset">
@@ -53,7 +58,7 @@ @@ -53,7 +58,7 @@
53 <el-input v-model.trim="form.mixing" :maxlength="15" placeholder="请输入混音人名字"></el-input> 58 <el-input v-model.trim="form.mixing" :maxlength="15" placeholder="请输入混音人名字"></el-input>
54 </el-form-item> 59 </el-form-item>
55 <el-form-item :label="labels.lyric" class="diy-flex-100" prop="lyric"> 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 placeholder="请输入歌词"></el-input> 62 placeholder="请输入歌词"></el-input>
58 </el-form-item> 63 </el-form-item>
59 <el-form-item :label="labels.phone" class="diy-flex-50" prop="phone"> 64 <el-form-item :label="labels.phone" class="diy-flex-50" prop="phone">
src/js/audios.js
@@ -3,7 +3,7 @@ require(&quot;./../css/test.css&quot;); @@ -3,7 +3,7 @@ require(&quot;./../css/test.css&quot;);
3 // Init Vue 3 // Init Vue
4 const Audio = { 4 const Audio = {
5 created() { 5 created() {
6 - parent.postMessage(1000, '*') 6 + parent.postMessage(1000, "*");
7 }, 7 },
8 data() { 8 data() {
9 return { 9 return {
@@ -63,6 +63,14 @@ const Audio = { @@ -63,6 +63,14 @@ const Audio = {
63 songwriter: [ 63 songwriter: [
64 { required: false, trigger: "change", message: "请输入作曲人名字" }, 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 uploadUrl: "", 76 uploadUrl: "",
@@ -86,6 +94,7 @@ const Audio = { @@ -86,6 +94,7 @@ const Audio = {
86 this.rules.singer[0].required = false; 94 this.rules.singer[0].required = false;
87 this.rules.songwriter[0].required = false; 95 this.rules.songwriter[0].required = false;
88 this.rules.lyricist[0].required = true; 96 this.rules.lyricist[0].required = true;
  97 + this.rules.lyric[0].required = true;
89 } else if (data == 1278) { 98 } else if (data == 1278) {
90 // 成品 99 // 成品
91 this.rules.singer[0].required = true; 100 this.rules.singer[0].required = true;
@@ -93,6 +102,7 @@ const Audio = { @@ -93,6 +102,7 @@ const Audio = {
93 this.rules.audioId[0].required = true; 102 this.rules.audioId[0].required = true;
94 this.rules.lyricist[0].required = false; 103 this.rules.lyricist[0].required = false;
95 this.rules.songwriter[0].required = false; 104 this.rules.songwriter[0].required = false;
  105 + this.rules.lyric[0].required = false;
96 } else if (data == 1280) { 106 } else if (data == 1280) {
97 // 作曲 107 // 作曲
98 this.rules.songwriter[0].required = true; 108 this.rules.songwriter[0].required = true;
@@ -100,6 +110,7 @@ const Audio = { @@ -100,6 +110,7 @@ const Audio = {
100 this.rules.audioId[0].required = true; 110 this.rules.audioId[0].required = true;
101 this.rules.singer[0].required = false; 111 this.rules.singer[0].required = false;
102 this.rules.lyricist[0].required = false; 112 this.rules.lyricist[0].required = false;
  113 + this.rules.lyric[0].required = false;
103 } else if (data == 1281) { 114 } else if (data == 1281) {
104 // 其他 115 // 其他
105 this.rules.songwriter[0].required = false; 116 this.rules.songwriter[0].required = false;
@@ -107,6 +118,7 @@ const Audio = { @@ -107,6 +118,7 @@ const Audio = {
107 this.rules.audioId[0].required = true; 118 this.rules.audioId[0].required = true;
108 this.rules.singer[0].required = false; 119 this.rules.singer[0].required = false;
109 this.rules.lyricist[0].required = false; 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,7 +188,8 @@ const Audio = {
176 const fileSaveObj = { 188 const fileSaveObj = {
177 videoId: null, 189 videoId: null,
178 190
179 - multipleCategory: 100005 + "/" + this.getCategoryText(this.form.channelId), 191 + multipleCategory:
  192 + 100005 + "/" + this.getCategoryText(this.form.channelId),
180 tag: this.getChannelText(this.form.channelId), 193 tag: this.getChannelText(this.form.channelId),
181 ts: this.getTs(), 194 ts: this.getTs(),
182 timestamp: this.getTimeStamp(), 195 timestamp: this.getTimeStamp(),
@@ -188,7 +201,8 @@ const Audio = { @@ -188,7 +201,8 @@ const Audio = {
188 fileSize: this.form.audioFile.raw.size, 201 fileSize: this.form.audioFile.raw.size,
189 ts: this.getTs(), 202 ts: this.getTs(),
190 timestamp: this.getTimeStamp(), 203 timestamp: this.getTimeStamp(),
191 - multipleCategory: 100005 + "/" + this.getCategoryText(this.form.channelId), 204 + multipleCategory:
  205 + 100005 + "/" + this.getCategoryText(this.form.channelId),
192 // masterId: all.secretUrls.masterIdDev, 206 // masterId: all.secretUrls.masterIdDev,
193 masterId: all.secretUrls.masterIdMaster, 207 masterId: all.secretUrls.masterIdMaster,
194 }; 208 };
@@ -309,7 +323,7 @@ const Audio = { @@ -309,7 +323,7 @@ const Audio = {
309 fileWholeObj.subscription = 323 fileWholeObj.subscription =
310 fileWholeObj.observable.subscribe(observer); 324 fileWholeObj.observable.subscribe(observer);
311 } else { 325 } else {
312 - this.reset() 326 + this.reset();
313 this.$message({ 327 this.$message({
314 type: "error", 328 type: "error",
315 duration: 0, 329 duration: 0,
src/js/config.js
@@ -152,6 +152,26 @@ const validatePhone = (rules, value, callback) =&gt; { @@ -152,6 +152,26 @@ const validatePhone = (rules, value, callback) =&gt; {
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 const validateName = (rules, value, callback) => { 175 const validateName = (rules, value, callback) => {
156 if (value.length < 1) { 176 if (value.length < 1) {
157 callback(new Error("请填写歌曲名称")); 177 callback(new Error("请填写歌曲名称"));
@@ -378,6 +398,7 @@ export { @@ -378,6 +398,7 @@ export {
378 validateVideoFormat, 398 validateVideoFormat,
379 validateNameLength, 399 validateNameLength,
380 validateVideoSize, 400 validateVideoSize,
  401 + validateLyric,
381 signFunction, 402 signFunction,
382 parseQueryString, 403 parseQueryString,
383 request, 404 request,
webpack.config.js
@@ -11,7 +11,7 @@ module.exports = { @@ -11,7 +11,7 @@ module.exports = {
11 entry: path.join(__dirname, "src", "/js/audios.js"), //__dirname指的是当前目录,是目录形成绝对路径 11 entry: path.join(__dirname, "src", "/js/audios.js"), //__dirname指的是当前目录,是目录形成绝对路径
12 output: { 12 output: {
13 //输入的文件名 13 //输入的文件名
14 - filename: "dada.js", 14 + filename: "cloak.js",
15 // filename: '[name].[hash:7].js', 15 // filename: '[name].[hash:7].js',
16 publicPath: "/", 16 publicPath: "/",
17 //输入的路径 webpack会自动打包生成 17 //输入的路径 webpack会自动打包生成
@@ -25,7 +25,7 @@ module.exports = { @@ -25,7 +25,7 @@ module.exports = {
25 //文件中找到的路径 25 //文件中找到的路径
26 template: path.join(__dirname, "src", "html/index.html"), 26 template: path.join(__dirname, "src", "html/index.html"),
27 //打包输出的路径 27 //打包输出的路径
28 - filename: "dada.html", 28 + filename: "cloak.html",
29 }), 29 }),
30 new CleanWebpackPlugin(), 30 new CleanWebpackPlugin(),
31 new JavaScriptObfuscator( 31 new JavaScriptObfuscator(