Commit 95c88523f8f906eee330f302a4cf87a460a92daf
1 parent
5e3d1d66
fix style
Showing
5 changed files
with
140 additions
and
43 deletions
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 | 77 | \ No newline at end of file | ... | ... |
src/html/index.html
| ... | ... | @@ -13,19 +13,19 @@ |
| 13 | 13 | <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/element-plus@1.1.0-beta.12/theme-chalk/index.css"> |
| 14 | 14 | </head> |
| 15 | 15 | |
| 16 | -<body id="body" style="margin: 0; padding: 0"> | |
| 16 | +<body id="body" class="diy-reset"> | |
| 17 | 17 | <div id="audioPage" class="page-container"> |
| 18 | - <el-card> | |
| 18 | + <el-card shadow="never"> | |
| 19 | 19 | <template #header> |
| 20 | 20 | <div class="card-header"> |
| 21 | 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 | 24 | </div> |
| 25 | 25 | </template> |
| 26 | 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 | 29 | <el-radio-group v-model="form.channelId" @change="handleChange"> |
| 30 | 30 | <el-radio :label="1278">热歌榜</el-radio> |
| 31 | 31 | <el-radio :label="1279">优秀作词榜</el-radio> |
| ... | ... | @@ -33,52 +33,53 @@ |
| 33 | 33 | <el-radio :label="1281">其他</el-radio> |
| 34 | 34 | </el-radio-group> |
| 35 | 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 | 37 | <el-input v-model.trim="form.songName" :maxlength="100" :minlength="1" placeholder="请输入歌曲名字"></el-input> |
| 38 | 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 | 40 | <el-input v-model.trim="form.singer" :maxlength="15" placeholder="请输入歌手名字"></el-input> |
| 41 | 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 | 43 | <el-input v-model.trim="form.lyricist" :maxlength="15" placeholder="请输入作词人名字"></el-input> |
| 44 | 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 | 47 | <el-input v-model.trim="form.songwriter" :maxlength="15" placeholder="请输入作曲人名字"></el-input> |
| 47 | 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 | 50 | <el-input v-model.trim="form.redact" :maxlength="15" placeholder="请输入编曲人名字"></el-input> |
| 50 | 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 | 53 | <el-input v-model.trim="form.mixing" :maxlength="15" placeholder="请输入混音人名字"></el-input> |
| 53 | 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 | 56 | <el-input v-model="form.lyric" maxlength="2500" show-word-limit type="textarea" :rows="10" placeholder="请输入歌词"></el-input> |
| 56 | 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 | 59 | <el-input v-model.trim="form.phone" :maxlength="11" placeholder="请输入手机号码"></el-input> |
| 59 | 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 | 62 | <el-input v-model.trim="form.name" :maxlength="50" placeholder="请输入联系人姓名"></el-input> |
| 62 | 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 | 65 | <el-upload class="upload-demo" :action="uploadUrl" :auto-upload="false" :file-list="fileList" accept=".mp3" |
| 65 | 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 | 69 | </el-upload> |
| 69 | 70 | </el-form-item> |
| 70 | 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 | 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 | 83 | </el-form-item> |
| 83 | 84 | </el-form> |
| 84 | 85 | </div> | ... | ... |
src/js/audios.js
| 1 | 1 | import * as all from "./config"; |
| 2 | -// require('./../css/test.css') | |
| 2 | +require('./../css/test.css') | |
| 3 | 3 | // Init Vue |
| 4 | 4 | const Audio = { |
| 5 | 5 | data() { |
| 6 | 6 | return { |
| 7 | + testLabel: '唱\xa0\xa0\xa0\xa0\xa0\xa0\xa0歌', | |
| 7 | 8 | form: { |
| 8 | 9 | channelId: null, |
| 9 | 10 | songName: null, |
| ... | ... | @@ -18,6 +19,7 @@ const Audio = { |
| 18 | 19 | audioId: null, |
| 19 | 20 | audioFile: null, |
| 20 | 21 | }, |
| 22 | + labels: all.formLabels, | |
| 21 | 23 | rules: { |
| 22 | 24 | songName: [ |
| 23 | 25 | { |
| ... | ... | @@ -145,7 +147,8 @@ const Audio = { |
| 145 | 147 | tag: "test", |
| 146 | 148 | ts: this.getTs(), |
| 147 | 149 | timestamp: this.getTimeStamp(), |
| 148 | - masterId: all.secretUrls.masterIdDev, | |
| 150 | + masterId: all.secretUrls.masterIdMaster, | |
| 151 | + // masterId: all.secretUrls.masterIdDev, | |
| 149 | 152 | }; |
| 150 | 153 | const fileInitObj = { |
| 151 | 154 | gfmt: this.form.audioFile.raw.name.split(".").reverse().shift(), |
| ... | ... | @@ -153,7 +156,8 @@ const Audio = { |
| 153 | 156 | ts: this.getTs(), |
| 154 | 157 | timestamp: this.getTimeStamp(), |
| 155 | 158 | multipleCategory: 100005, |
| 156 | - masterId: all.secretUrls.masterIdDev, | |
| 159 | + // masterId: all.secretUrls.masterIdDev, | |
| 160 | + masterId: all.secretUrls.masterIdMaster, | |
| 157 | 161 | }; |
| 158 | 162 | const fileWholeObj = { |
| 159 | 163 | file: this.form.audioFile.raw, |
| ... | ... | @@ -220,9 +224,9 @@ const Audio = { |
| 220 | 224 | return this.getToken(); |
| 221 | 225 | }) |
| 222 | 226 | .then((d) => { |
| 223 | - if (d && d.data) { | |
| 227 | + if (d && d.data && typeof d.data == 'string') { | |
| 224 | 228 | this.token = d.data; |
| 225 | - } | |
| 229 | + } | |
| 226 | 230 | return this.initMd5(this.form.audioFile.raw); |
| 227 | 231 | }) |
| 228 | 232 | .then((n) => { |
| ... | ... | @@ -338,13 +342,13 @@ const Audio = { |
| 338 | 342 | .then((res) => { |
| 339 | 343 | if (res.data) { |
| 340 | 344 | setTimeout(() => { |
| 341 | - console.log("jump"); | |
| 342 | - // window.location.replace("./success.html"); | |
| 345 | + // console.log("jump"); | |
| 346 | + window.location.replace("./success.html"); | |
| 343 | 347 | }, 1000); |
| 344 | 348 | } else { |
| 345 | 349 | setTimeout(() => { |
| 346 | - console.log("jump"); | |
| 347 | - // window.location.replace("./failed.html"); | |
| 350 | + // console.log("jump"); | |
| 351 | + window.location.replace("./failed.html"); | |
| 348 | 352 | }, 1000); |
| 349 | 353 | } |
| 350 | 354 | }) | ... | ... |
src/js/config.js
| ... | ... | @@ -12,7 +12,8 @@ const urls = { |
| 12 | 12 | }; |
| 13 | 13 | |
| 14 | 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 | 17 | auth: "/getUploadAuth", |
| 17 | 18 | init: "/uploadFileInit", |
| 18 | 19 | callback: "/uploadCallback", |
| ... | ... | @@ -38,6 +39,21 @@ const putExtra = { |
| 38 | 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 | 57 | // Rewrite Request Method |
| 42 | 58 | const request = axios.create({ |
| 43 | 59 | timeout: 10000, |
| ... | ... | @@ -48,12 +64,14 @@ const request = axios.create({ |
| 48 | 64 | const signFunction = function (api, list) { |
| 49 | 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 | 69 | arrApi = arrApi.concat(list); //对数组进行升序处理,并拼成一个字符串 |
| 53 | 70 | |
| 54 | 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 | 76 | let apiStringSign = api + "?" + stringSign + "&sign=" + signValue; |
| 59 | 77 | |
| ... | ... | @@ -368,4 +386,5 @@ export { |
| 368 | 386 | basicConfig, |
| 369 | 387 | urls, |
| 370 | 388 | secretUrls, |
| 389 | + formLabels | |
| 371 | 390 | }; | ... | ... |
webpack.config.js
| ... | ... | @@ -10,7 +10,7 @@ module.exports = { |
| 10 | 10 | entry: path.join(__dirname, "src", "/js/audios.js"), //__dirname指的是当前目录,是目录形成绝对路径 |
| 11 | 11 | output: { |
| 12 | 12 | //输入的文件名 |
| 13 | - filename: "prodtestdata.js", | |
| 13 | + filename: "bundlenew.js", | |
| 14 | 14 | // filename: '[name].[hash:7].js', |
| 15 | 15 | publicPath: "/", |
| 16 | 16 | //输入的路径 webpack会自动打包生成 |
| ... | ... | @@ -24,7 +24,7 @@ module.exports = { |
| 24 | 24 | //文件中找到的路径 |
| 25 | 25 | template: path.join(__dirname, "src", "html/index.html"), |
| 26 | 26 | //打包输出的路径 |
| 27 | - filename: "prodtestdata.html", | |
| 27 | + filename: "audio.html", | |
| 28 | 28 | }), |
| 29 | 29 | new CleanWebpackPlugin(), |
| 30 | 30 | ], | ... | ... |