Commit 95c88523f8f906eee330f302a4cf87a460a92daf

Authored by 杨泽宇
1 parent 5e3d1d66

fix style

src/css/test.css
1 -.page-container {  
2 - background-color: brown; 1 +.diy-reset {
  2 + margin: 0;
  3 + padding: 0
  4 +}
  5 +.diy-flex {
  6 + display: flex;
  7 + flex-wrap: wrap;
  8 +}
  9 +.diy-flex-50 {
  10 + width: 50%;
  11 +}
  12 +.diy-flex-100 {
  13 + width: 100%;
  14 +}
  15 +.diy-text-left {
  16 + text-align: left;
  17 +}
  18 +.diy-text-right {
  19 + text-align: right;
  20 +}
  21 +.diy-tip {
  22 + color: #4A90E2;
  23 + font-size: 20px;
  24 +}
  25 +.diy-danger {
  26 + color: #D11244; margin-left: 10px;
  27 +}
  28 +.el-card__header {
  29 + padding: 24px 40px;
  30 + background-color: #f9f9f9;
  31 + border-bottom: none;
  32 +}
  33 +.el-card__body {
  34 + padding: 40px;
  35 +}
  36 +.el-form-item__label {
  37 + font-size: 16px;
  38 + color: #333333;
  39 +}
  40 +.el-radio__label {
  41 + font-size: 16px;
  42 + color: #333333;
  43 +}
  44 +.title-big {
  45 + font-size: 24px;
  46 + font-weight: Semibold;
  47 + color: #666666;
  48 +}
  49 +.title-small {
  50 + font-size: 14px;
  51 + color: #999999;
  52 + margin-left: 10px;
  53 +}
  54 +.diy-button {
  55 + height: 40px;
  56 + font-size: 16px;
  57 + border-radius: 6px;
  58 +}
  59 +.width-140 {
  60 + width: 140px;
  61 +}
  62 +.width-190 {
  63 + width: 190px;
  64 +}
  65 +.bg-blue {
  66 + background-color: #4A90E2;
  67 + border-color: #4A90E2;
  68 +}
  69 +.bg-red {
  70 + background-color: #D11244;
  71 + border-color: #D11244;
  72 +}
  73 +.bg-white {
  74 + background-color: transparent;
  75 + border-color: #B4B4B4;
3 } 76 }
4 \ No newline at end of file 77 \ No newline at end of file
src/html/index.html
@@ -13,19 +13,19 @@ @@ -13,19 +13,19 @@
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 </head> 14 </head>
15 15
16 -<body id="body" style="margin: 0; padding: 0"> 16 +<body id="body" class="diy-reset">
17 <div id="audioPage" class="page-container"> 17 <div id="audioPage" class="page-container">
18 - <el-card> 18 + <el-card shadow="never">
19 <template #header> 19 <template #header>
20 <div class="card-header"> 20 <div class="card-header">
21 <!-- <h3>歌曲征集</h3> --> 21 <!-- <h3>歌曲征集</h3> -->
22 - <span style="font-size: 24px; font-weight: Semibold; color: #666666;">歌曲征集</span>  
23 - <span style="font-size: 14px; color: #999999;"> / 带*号为必填项</span> 22 + <span class="title-big">歌曲征集</span>
  23 + <span class="title-small">/ 带*号为必填项</span>
24 </div> 24 </div>
25 </template> 25 </template>
26 <div> 26 <div>
27 - <el-form ref="songs" :model="form" label-width="120px" :rules="rules" style="display: flex; flex-wrap: wrap;" >  
28 - <el-form-item label="类型" style="width: 100%" prop="channelId"> 27 + <el-form ref="songs" :model="form" label-width="120px" :rules="rules" class="diy-flex" label-position="right">
  28 + <el-form-item :label="labels.channelId" class="diy-flex-100" prop="channelId">
29 <el-radio-group v-model="form.channelId" @change="handleChange"> 29 <el-radio-group v-model="form.channelId" @change="handleChange">
30 <el-radio :label="1278">热歌榜</el-radio> 30 <el-radio :label="1278">热歌榜</el-radio>
31 <el-radio :label="1279">优秀作词榜</el-radio> 31 <el-radio :label="1279">优秀作词榜</el-radio>
@@ -33,52 +33,53 @@ @@ -33,52 +33,53 @@
33 <el-radio :label="1281">其他</el-radio> 33 <el-radio :label="1281">其他</el-radio>
34 </el-radio-group> 34 </el-radio-group>
35 </el-form-item> 35 </el-form-item>
36 - <el-form-item label="歌曲名字" style="width: 50%" prop="songName"> 36 + <el-form-item :label="labels.songName" class="diy-flex-50" prop="songName">
37 <el-input v-model.trim="form.songName" :maxlength="100" :minlength="1" placeholder="请输入歌曲名字"></el-input> 37 <el-input v-model.trim="form.songName" :maxlength="100" :minlength="1" placeholder="请输入歌曲名字"></el-input>
38 </el-form-item> 38 </el-form-item>
39 - <el-form-item label="歌手" style="width: 50%" prop="singer"> 39 + <el-form-item :label="labels.singer" class="diy-flex-50" prop="singer">
40 <el-input v-model.trim="form.singer" :maxlength="15" placeholder="请输入歌手名字"></el-input> 40 <el-input v-model.trim="form.singer" :maxlength="15" placeholder="请输入歌手名字"></el-input>
41 </el-form-item> 41 </el-form-item>
42 - <el-form-item label="作词" style="width: 50%" prop="lyricist"> 42 + <el-form-item :label="labels.lyricist" class="diy-flex-50" prop="lyricist">
43 <el-input v-model.trim="form.lyricist" :maxlength="15" placeholder="请输入作词人名字"></el-input> 43 <el-input v-model.trim="form.lyricist" :maxlength="15" placeholder="请输入作词人名字"></el-input>
44 </el-form-item> 44 </el-form-item>
45 - <el-form-item label="作曲" style="width: 50%;" prop="songwriter"> 45 + <el-form-item :label="labels.songwriter" class="diy-flex-50" prop="songwriter">
  46 + <!-- <label slot="label" class="el-form-item__label" style="width: 120px;">首重</label> -->
46 <el-input v-model.trim="form.songwriter" :maxlength="15" placeholder="请输入作曲人名字"></el-input> 47 <el-input v-model.trim="form.songwriter" :maxlength="15" placeholder="请输入作曲人名字"></el-input>
47 </el-form-item> 48 </el-form-item>
48 - <el-form-item label="编曲" style="width: 50%" prop="redact"> 49 + <el-form-item :label="labels.redact" class="diy-flex-50" prop="redact">
49 <el-input v-model.trim="form.redact" :maxlength="15" placeholder="请输入编曲人名字"></el-input> 50 <el-input v-model.trim="form.redact" :maxlength="15" placeholder="请输入编曲人名字"></el-input>
50 </el-form-item> 51 </el-form-item>
51 - <el-form-item label="混音" style="width: 50%" prop="mixing"> 52 + <el-form-item :label="labels.mixing" class="diy-flex-50" prop="mixing">
52 <el-input v-model.trim="form.mixing" :maxlength="15" placeholder="请输入混音人名字"></el-input> 53 <el-input v-model.trim="form.mixing" :maxlength="15" placeholder="请输入混音人名字"></el-input>
53 </el-form-item> 54 </el-form-item>
54 - <el-form-item label="歌词" style="width: 100%" prop="lyric"> 55 + <el-form-item :label="labels.lyric" class="diy-flex-100" prop="lyric">
55 <el-input v-model="form.lyric" maxlength="2500" show-word-limit type="textarea" :rows="10" placeholder="请输入歌词"></el-input> 56 <el-input v-model="form.lyric" maxlength="2500" show-word-limit type="textarea" :rows="10" placeholder="请输入歌词"></el-input>
56 </el-form-item> 57 </el-form-item>
57 - <el-form-item label="手机号码" style="width: 50%" prop="phone"> 58 + <el-form-item :label="labels.phone" class="diy-flex-50" prop="phone">
58 <el-input v-model.trim="form.phone" :maxlength="11" placeholder="请输入手机号码"></el-input> 59 <el-input v-model.trim="form.phone" :maxlength="11" placeholder="请输入手机号码"></el-input>
59 </el-form-item> 60 </el-form-item>
60 - <el-form-item label="联系人姓名" style="width: 50%" prop="name"> 61 + <el-form-item :label="labels.name" class="diy-flex-50" prop="name">
61 <el-input v-model.trim="form.name" :maxlength="50" placeholder="请输入联系人姓名"></el-input> 62 <el-input v-model.trim="form.name" :maxlength="50" placeholder="请输入联系人姓名"></el-input>
62 </el-form-item> 63 </el-form-item>
63 - <el-form-item label="音频" style="width: 100%" prop="audioFile"> 64 + <el-form-item :label="labels.audioFile" class="diy-flex-100" prop="audioFile">
64 <el-upload class="upload-demo" :action="uploadUrl" :auto-upload="false" :file-list="fileList" accept=".mp3" 65 <el-upload class="upload-demo" :action="uploadUrl" :auto-upload="false" :file-list="fileList" accept=".mp3"
65 @change="getMp3" :on-exceed="exceed" :before-remove="handleRemove" :disabled="btnDisabled" :show-file-list="false"> 66 @change="getMp3" :on-exceed="exceed" :before-remove="handleRemove" :disabled="btnDisabled" :show-file-list="false">
66 - <el-button size="small" type="primary" :disabled="btnDisabled">选择文件</el-button>  
67 - <span style="color: red; margin-left: 10px;">{{msgText}}</span> 67 + <el-button size="small" type="primary" :disabled="btnDisabled" class="diy-button width-190 bg-blue">选择文件</el-button>
  68 + <span class="diy-danger">{{msgText}}</span>
68 </el-upload> 69 </el-upload>
69 </el-form-item> 70 </el-form-item>
70 <el-divider></el-divider> 71 <el-divider></el-divider>
71 - <el-form-item style="width: 50%; text-align: left;">  
72 - <span style="color: #4A90E2; font-size: 20px">{{form.audioFile?.name}} </span>  
73 - <span style="color: #4A90E2; font-size: 20px" v-if="percent > 0 && percent < 100"> 已上传{{Math.ceil(percent)}}%,请耐心等待……</span>  
74 - <span style="color: #4A90E2; font-size: 20px" v-if="percent == 100"> 上传完成</span> 72 + <el-form-item class="diy-flex-50 diy-text-left">
  73 + <span class="diy-tip">{{form.audioFile?.name}} </span>
  74 + <span class="diy-tip" v-if="percent > 0 && percent < 100"> 已上传{{Math.ceil(percent)}}%,请耐心等待……</span>
  75 + <span class="diy-tip" v-if="percent == 100"> 上传完成</span>
75 </el-form-item> 76 </el-form-item>
76 - <el-form-item style="width: 50%; text-align: right;">  
77 - <el-button @click="reset" v-if="form.channelId == 1279">取消</el-button>  
78 - <el-button @click="reset" v-else :disabled="!form.audioFile || submitDisabled">取消</el-button> 77 + <el-form-item class="diy-flex-50 diy-text-right">
  78 + <el-button @click="reset" class="diy-button width-140 bg-white" v-if="form.channelId == 1279">取消</el-button>
  79 + <el-button @click="reset" class="diy-button width-140 bg-white" v-else :disabled="!form.audioFile || submitDisabled">取消</el-button>
79 80
80 - <el-button type="danger" @click="submit('songs')" v-if="form.channelId == 1279">确定上传</el-button>  
81 - <el-button type="danger" @click="submit('songs')" v-else :disabled="!form.audioFile || submitDisabled">确定上传</el-button> 81 + <el-button type="danger" class="diy-button width-140 bg-red" @click="submit('songs')" v-if="form.channelId == 1279">确定上传</el-button>
  82 + <el-button type="danger" class="diy-button width-140 bg-red" @click="submit('songs')" v-else :disabled="!form.audioFile || submitDisabled">确定上传</el-button>
82 </el-form-item> 83 </el-form-item>
83 </el-form> 84 </el-form>
84 </div> 85 </div>
src/js/audios.js
1 import * as all from "./config"; 1 import * as all from "./config";
2 -// require('./../css/test.css') 2 +require('./../css/test.css')
3 // Init Vue 3 // Init Vue
4 const Audio = { 4 const Audio = {
5 data() { 5 data() {
6 return { 6 return {
  7 + testLabel: '唱\xa0\xa0\xa0\xa0\xa0\xa0\xa0歌',
7 form: { 8 form: {
8 channelId: null, 9 channelId: null,
9 songName: null, 10 songName: null,
@@ -18,6 +19,7 @@ const Audio = { @@ -18,6 +19,7 @@ const Audio = {
18 audioId: null, 19 audioId: null,
19 audioFile: null, 20 audioFile: null,
20 }, 21 },
  22 + labels: all.formLabels,
21 rules: { 23 rules: {
22 songName: [ 24 songName: [
23 { 25 {
@@ -145,7 +147,8 @@ const Audio = { @@ -145,7 +147,8 @@ const Audio = {
145 tag: "test", 147 tag: "test",
146 ts: this.getTs(), 148 ts: this.getTs(),
147 timestamp: this.getTimeStamp(), 149 timestamp: this.getTimeStamp(),
148 - masterId: all.secretUrls.masterIdDev, 150 + masterId: all.secretUrls.masterIdMaster,
  151 + // masterId: all.secretUrls.masterIdDev,
149 }; 152 };
150 const fileInitObj = { 153 const fileInitObj = {
151 gfmt: this.form.audioFile.raw.name.split(".").reverse().shift(), 154 gfmt: this.form.audioFile.raw.name.split(".").reverse().shift(),
@@ -153,7 +156,8 @@ const Audio = { @@ -153,7 +156,8 @@ const Audio = {
153 ts: this.getTs(), 156 ts: this.getTs(),
154 timestamp: this.getTimeStamp(), 157 timestamp: this.getTimeStamp(),
155 multipleCategory: 100005, 158 multipleCategory: 100005,
156 - masterId: all.secretUrls.masterIdDev, 159 + // masterId: all.secretUrls.masterIdDev,
  160 + masterId: all.secretUrls.masterIdMaster,
157 }; 161 };
158 const fileWholeObj = { 162 const fileWholeObj = {
159 file: this.form.audioFile.raw, 163 file: this.form.audioFile.raw,
@@ -220,9 +224,9 @@ const Audio = { @@ -220,9 +224,9 @@ const Audio = {
220 return this.getToken(); 224 return this.getToken();
221 }) 225 })
222 .then((d) => { 226 .then((d) => {
223 - if (d && d.data) { 227 + if (d && d.data && typeof d.data == 'string') {
224 this.token = d.data; 228 this.token = d.data;
225 - } 229 + }
226 return this.initMd5(this.form.audioFile.raw); 230 return this.initMd5(this.form.audioFile.raw);
227 }) 231 })
228 .then((n) => { 232 .then((n) => {
@@ -338,13 +342,13 @@ const Audio = { @@ -338,13 +342,13 @@ const Audio = {
338 .then((res) => { 342 .then((res) => {
339 if (res.data) { 343 if (res.data) {
340 setTimeout(() => { 344 setTimeout(() => {
341 - console.log("jump");  
342 - // window.location.replace("./success.html"); 345 + // console.log("jump");
  346 + window.location.replace("./success.html");
343 }, 1000); 347 }, 1000);
344 } else { 348 } else {
345 setTimeout(() => { 349 setTimeout(() => {
346 - console.log("jump");  
347 - // window.location.replace("./failed.html"); 350 + // console.log("jump");
  351 + window.location.replace("./failed.html");
348 }, 1000); 352 }, 1000);
349 } 353 }
350 }) 354 })
src/js/config.js
@@ -12,7 +12,8 @@ const urls = { @@ -12,7 +12,8 @@ const urls = {
12 }; 12 };
13 13
14 const secretUrls = { 14 const secretUrls = {
15 - base: "https://api.cnlive.com/open/api2/vod_epg/videoPgc", 15 + // base: "https://api.cnlive.com/open/api2/vod_epg/videoPgc",
  16 + base: "http://test.open.cnlive.com/openapi/api2/vod_epg/videoPgc",
16 auth: "/getUploadAuth", 17 auth: "/getUploadAuth",
17 init: "/uploadFileInit", 18 init: "/uploadFileInit",
18 callback: "/uploadCallback", 19 callback: "/uploadCallback",
@@ -38,6 +39,21 @@ const putExtra = { @@ -38,6 +39,21 @@ const putExtra = {
38 mimeType: null, 39 mimeType: null,
39 }; 40 };
40 41
  42 +const formLabels = {
  43 + channelId: '类\xa0\xa0\xa0\xa0\xa0\xa0\xa0型',
  44 + songName: '歌曲名字',
  45 + singer: '歌\xa0\xa0\xa0\xa0\xa0\xa0\xa0手',
  46 + lyricist: '作\xa0\xa0\xa0\xa0\xa0\xa0\xa0词',
  47 + songwriter: '作\xa0\xa0\xa0\xa0\xa0\xa0\xa0曲',
  48 + redact: '编\xa0\xa0\xa0\xa0\xa0\xa0\xa0曲',
  49 + mixing: '混\xa0\xa0\xa0\xa0\xa0\xa0\xa0音',
  50 + lyric: '歌\xa0\xa0\xa0\xa0\xa0\xa0\xa0词',
  51 + phone: '手机号码',
  52 + name: '联系人姓名',
  53 + audioId: '音\xa0\xa0\xa0\xa0\xa0\xa0\xa0频',
  54 + audioFile: '音\xa0\xa0\xa0\xa0\xa0\xa0\xa0频',
  55 +}
  56 +
41 // Rewrite Request Method 57 // Rewrite Request Method
42 const request = axios.create({ 58 const request = axios.create({
43 timeout: 10000, 59 timeout: 10000,
@@ -48,12 +64,14 @@ const request = axios.create({ @@ -48,12 +64,14 @@ const request = axios.create({
48 const signFunction = function (api, list) { 64 const signFunction = function (api, list) {
49 let sha1 = require('sha1') 65 let sha1 = require('sha1')
50 //数组合并 66 //数组合并
51 - let arrApi = ["appId=" + secretUrls.appIdDev]; 67 + let arrApi = ["appId=" + secretUrls.appIdMaster];
  68 + // let arrApi = ["appId=" + secretUrls.appIdDev];
52 arrApi = arrApi.concat(list); //对数组进行升序处理,并拼成一个字符串 69 arrApi = arrApi.concat(list); //对数组进行升序处理,并拼成一个字符串
53 70
54 let stringSign = arrApi.sort().join("&"); //key要放在字符串最后,对字符串进行sha1加密处理,并转换为大写 71 let stringSign = arrApi.sort().join("&"); //key要放在字符串最后,对字符串进行sha1加密处理,并转换为大写
55 72
56 - let signValue = sha1(stringSign + "&key=" + secretUrls.appKeyDev).toUpperCase(); //生成最终的请求参数 73 + let signValue = sha1(stringSign + "&key=" + secretUrls.appKeyMaster).toUpperCase(); //生成最终的请求参数
  74 + // let signValue = sha1(stringSign + "&key=" + secretUrls.appKeyDev).toUpperCase(); //生成最终的请求参数
57 75
58 let apiStringSign = api + "?" + stringSign + "&sign=" + signValue; 76 let apiStringSign = api + "?" + stringSign + "&sign=" + signValue;
59 77
@@ -368,4 +386,5 @@ export { @@ -368,4 +386,5 @@ export {
368 basicConfig, 386 basicConfig,
369 urls, 387 urls,
370 secretUrls, 388 secretUrls,
  389 + formLabels
371 }; 390 };
webpack.config.js
@@ -10,7 +10,7 @@ module.exports = { @@ -10,7 +10,7 @@ module.exports = {
10 entry: path.join(__dirname, "src", "/js/audios.js"), //__dirname指的是当前目录,是目录形成绝对路径 10 entry: path.join(__dirname, "src", "/js/audios.js"), //__dirname指的是当前目录,是目录形成绝对路径
11 output: { 11 output: {
12 //输入的文件名 12 //输入的文件名
13 - filename: "prodtestdata.js", 13 + filename: "bundlenew.js",
14 // filename: '[name].[hash:7].js', 14 // filename: '[name].[hash:7].js',
15 publicPath: "/", 15 publicPath: "/",
16 //输入的路径 webpack会自动打包生成 16 //输入的路径 webpack会自动打包生成
@@ -24,7 +24,7 @@ module.exports = { @@ -24,7 +24,7 @@ module.exports = {
24 //文件中找到的路径 24 //文件中找到的路径
25 template: path.join(__dirname, "src", "html/index.html"), 25 template: path.join(__dirname, "src", "html/index.html"),
26 //打包输出的路径 26 //打包输出的路径
27 - filename: "prodtestdata.html", 27 + filename: "audio.html",
28 }), 28 }),
29 new CleanWebpackPlugin(), 29 new CleanWebpackPlugin(),
30 ], 30 ],