Commit 34779624ac96beeb9dff93ff82eba29de03ab28a

Authored by 杨泽宇
1 parent e4539df0

'云霄战歌'

.babelrc 0 → 100644
  1 +{ "presets": [ "es2015", "es2016" ] }
... ...
.gitignore 0 → 100644
  1 +node_modules
  2 +dist
0 3 \ No newline at end of file
... ...
jsconfig.json 0 → 100644
  1 +{
  2 + "compilerOptions": {
  3 +
  4 + },
  5 + "exclude": []
  6 +}
... ...
package.json 0 → 100644
  1 +{
  2 + "name": "songs",
  3 + "version": "1.0.0",
  4 + "description": "",
  5 + "main": "index.js",
  6 + "scripts": {
  7 + "test": "echo \"Error: no test specified\" && exit 1",
  8 + "build": "webpack",
  9 + "dev": "webpack-dev-server --hot"
  10 + },
  11 + "keywords": [],
  12 + "author": "",
  13 + "license": "ISC",
  14 + "devDependencies": {
  15 + "@webpack-cli/serve": "^1.5.2",
  16 + "babel-core": "^6.22.1",
  17 + "babel-loader": "^7.1.1",
  18 + "babel-polyfill": "^6.0.2",
  19 + "babel-preset-es2015": "^6.13.0",
  20 + "babel-preset-es2016": "^6.24.1",
  21 + "clean-webpack-plugin": "^4.0.0",
  22 + "css-loader": "^5.1.0",
  23 + "html-webpack-plugin": "^4.0.4",
  24 + "javascript-obfuscator": "^2.19.0",
  25 + "sha1": "^1.1.1",
  26 + "style-loader": "^2.0.0",
  27 + "uglifyjs-webpack-plugin": "^2.2.0",
  28 + "webpack": "^4.42.1",
  29 + "webpack-cli": "^3.3.11",
  30 + "webpack-dev-server": "^3.10.3",
  31 + "webpack-obfuscator": "^2.6.0"
  32 + },
  33 + "dependencies": {
  34 + "qs": "^6.10.1"
  35 + }
  36 +}
... ...
scripts/audios.js 0 → 100644
  1 +// Init Vue
  2 +const Audio = {
  3 + created() {
  4 + request({
  5 + url: urls.base + urls.token + "?spId=802",
  6 + method: "get"
  7 + }).then(res => {
  8 + this.token = res.data;
  9 + });
  10 + },
  11 + data() {
  12 + return {
  13 + form: {
  14 + songName: null,
  15 + lyricist: null,
  16 + songwriter: null,
  17 + channelId: 1278,
  18 + redact: null,
  19 + lyric: null,
  20 + mixing: null,
  21 + audioId: null,
  22 + audioFile: null
  23 + },
  24 + rules: {
  25 + songName: [{ required: true, trigger: "change", message: "请填写歌曲名字" }],
  26 + phone: [
  27 + {
  28 + required: true,
  29 + trigger: "change",
  30 + message: "请填写格式正确的手机号码",
  31 + validator: validatePhone
  32 + }
  33 + ],
  34 + audioFile: [{ required: true, trigger: "change", message: "请上传音频" }],
  35 + channelId: [{ required: true, trigger: "change", message: "请选择作品类型" }],
  36 + audioId: [{ required: true, trigger: "change", message: "请上传音频文件以获取音频ID" }]
  37 + },
  38 +
  39 + uploadUrl: "",
  40 + fileList: [],
  41 + token: "",
  42 + msgText: ''
  43 + };
  44 + },
  45 + methods: {
  46 + exceed(e, d) {
  47 + this.$message.error('只能上传一个文件')
  48 + },
  49 + handleRemove() {
  50 + this.$confirm('该删除过程不会取消文件上传过程?', '提示', {
  51 + confirmButtonText: '确认删除',
  52 + cancelButtonText: '取消',
  53 + type: 'warning'
  54 + }).then(r => {
  55 + this.form.audioId = null
  56 + }).catch(error =>{
  57 + console.log(error)
  58 + })
  59 + },
  60 + initMd5(fileObj) {
  61 + return new Promise((resolve, reject) => {
  62 + const fileName = fileObj.name.split(".")[0];
  63 + const fileType = fileObj.name.split(".")[1];
  64 + const fileSize = fileObj.size;
  65 + const fileModifyDate = fileObj.lastModifiedDate;
  66 + const md5Str = initVideoMd5(
  67 + [fileType, fileSize, fileModifyDate || fileName].join("_")
  68 + ).toLowerCase();
  69 + if (md5Str) {
  70 + resolve(md5Str);
  71 + } else {
  72 + reject("校验失败");
  73 + }
  74 + });
  75 + },
  76 + submit() {
  77 + this.$refs.form.validate(v => {
  78 + if (v) {
  79 + request({
  80 + url: 'http://cmstest.cnlive.com:8768/contentApi/audioSave',
  81 + method: 'post',
  82 + params: this.form,
  83 + withCredentials: true,
  84 + headers: {
  85 + "X-Requested-With": "XMLHttpRequest",
  86 + "Access-Control-Allow-Origin": "*",
  87 + "content-type": "application/json;charset=UTF-8"
  88 + }
  89 + }).then(res => {
  90 + if(res.data) {
  91 + setTimeout(() => {
  92 + window.location.href = './success.html'
  93 + }, 1000)
  94 + } else {
  95 + setTimeout(() => {
  96 + window.location.href = './failed.html'
  97 + }, 1000)
  98 + }
  99 + })
  100 + } else {
  101 + this.$message.error("请补全表单内容");
  102 + }
  103 + });
  104 + },
  105 + getTxt(e) {
  106 + this.form.txtFile = e.raw;
  107 + let file = e.raw;
  108 + (reader = new FileReader()), (that = this);
  109 + reader.onload = function(evt) {
  110 + var data = evt.target.result;
  111 + console.log(data);
  112 + console.log(String.fromCharCode.apply(null, new Uint16Array(data)));
  113 + };
  114 + reader.readAsArrayBuffer(file);
  115 + },
  116 + getMp3(file) {
  117 + this.msgText = '音频已开始上传,上传过程中请勿刷新页面。'
  118 + this.form.audioFile = file
  119 + const fileName = file.raw.name.split(".");
  120 + fileName.splice(fileName.length - 1, 1);
  121 + const that = this;
  122 + const fileBaseObj = {
  123 + videoName: fileName.join("."),
  124 + md5: null
  125 + };
  126 + const fileSaveObj = {
  127 + videoId: null,
  128 +
  129 + multipleCategory: 100005,
  130 + tag: "test",
  131 + synopsis: "test",
  132 + mmsType: 0,
  133 + videoType: 11003,
  134 + videoType: 0,
  135 + masterId: 10505921
  136 + };
  137 + const fileInitObj = {
  138 + gfmt: file.raw.name
  139 + .split(".")
  140 + .reverse()
  141 + .shift(),
  142 + fileSize: file.raw.size,
  143 + videoType: 11003,
  144 + ptpwVal: 0,
  145 + archiveStatus: 0,
  146 + multipleCategory: 100005,
  147 + uploadLine: 2,
  148 + masterId: 10505921
  149 + };
  150 + const fileWholeObj = {
  151 + file: file.raw,
  152 + uploadStatus: "ready",
  153 + proCount: 0,
  154 + fileKey: null,
  155 + observable: null,
  156 + subscription: null
  157 + };
  158 +
  159 + if (this.token == null) {
  160 + this.$message({
  161 + type: "error",
  162 + message: "获取七牛token失败,请联系管理员"
  163 + });
  164 + return false;
  165 + }
  166 +
  167 + const observer = {
  168 + next(res) {},
  169 + error(err) {
  170 + console.log(err);
  171 + },
  172 + complete(res) {
  173 + request({
  174 + url: urls.base + urls.save,
  175 + method: "get",
  176 + params: {
  177 + hash: res.hash,
  178 + key: res.key,
  179 + vid: fileSaveObj.videoId
  180 + }
  181 + })
  182 + .then(res => {
  183 + console.log(res);
  184 + })
  185 + .catch(error => {
  186 + return request({
  187 + url: urls.onlineUrl + urls.transcode,
  188 + params: {...fileBaseObj, ...fileSaveObj},
  189 + method: "get"
  190 + });
  191 + })
  192 + .then(data => {
  193 + that.form.audioId = data.data.data.obj
  194 + that.msgText = '音频上传成功'
  195 + }).catch(error => {
  196 + console.log(error)
  197 + })
  198 + }
  199 + };
  200 +
  201 + Promise.all([
  202 + validateVideoSize(fileInitObj.fileSize),
  203 + validateVideoFormat(fileInitObj.gfmt),
  204 + validateNameLength(fileBaseObj.videoName)
  205 + ])
  206 + .then(check => {
  207 + return this.initMd5(file.raw);
  208 + })
  209 + .then(n => {
  210 + fileBaseObj.md5 = n;
  211 + return request({
  212 + url: urls.onlineUrl + urls.initFileOnline,
  213 + method: "get",
  214 + params: {...fileBaseObj, ...fileInitObj}
  215 + });
  216 + })
  217 + .then(res => {
  218 + if (res && res.data) {
  219 + fileSaveObj.videoId = res.data.data.obj.vid;
  220 + fileWholeObj.fileKey = res.data.data.obj.originPath;
  221 + putExtra.params["x:name"] = fileWholeObj.fileKey;
  222 + fileWholeObj.observable = qiniu.upload(
  223 + file.raw,
  224 + fileWholeObj.fileKey,
  225 + this.token,
  226 + putExtra,
  227 + cdnConfig
  228 + );
  229 + fileWholeObj.subscription = fileWholeObj.observable.subscribe(
  230 + observer
  231 + );
  232 + } else {
  233 + this.$message({
  234 + type: "error",
  235 + duration: 0,
  236 + message: "未知错误,请联系管理员。"
  237 + });
  238 + }
  239 + })
  240 + .catch(error => {
  241 + this.$message({
  242 + type: "error",
  243 + message: error,
  244 + duration: 0
  245 + });
  246 + });
  247 + }
  248 + }
  249 +};
  250 +
  251 +Vue.createApp(Audio)
  252 + .use(ElementPlus)
  253 + .mount("#audio");
... ...
scripts/config.js 0 → 100644
  1 +// Forbid Backward And Forward
  2 +history.pushState(null, null, document.URL);
  3 +window.addEventListener("popstate", function() {
  4 + history.pushState(null, null, document.URL);
  5 +});
  6 +
  7 +// Rewrite Request Method
  8 +const baseUrl = "http://cmstest.cnlive.com/cms";
  9 +const request = axios.create({
  10 + timeout: 10000
  11 +});
  12 +
  13 +// QiNiu Configs
  14 +const cdnConfig = {
  15 + useCdnDomain: true,
  16 + disableStatisticsReport: true,
  17 + retryCount: 6,
  18 + region: qiniu.region.z1
  19 +};
  20 +const putExtra = {
  21 + fname: "",
  22 + params: {},
  23 + mimeType: null
  24 +};
  25 +const urls = {
  26 + base: "http://test.mam.innerapi.cnlive.com/v1/inner/",
  27 + onlineUrl: 'https://api.cnlive.com/open/api2/vod_epg/material/',
  28 + token: "material/getQNToken",
  29 + save: "material/saveQNComplete",
  30 + initFileOnline: 'uploadFileInit?appId=802_k8ho7qks68',
  31 + transcode: "pendingTranscodeTask?appId=802_k8ho7qks68",
  32 +};
  33 +
  34 +// File And Form Validate
  35 +const validateVideoSize = function(curSize) {
  36 + const sizeLimitation = 1024 * 1024 * 500; // 500M
  37 + return new Promise((resolve, reject) => {
  38 + if (parseInt(curSize) <= sizeLimitation) {
  39 + resolve("没超尺寸");
  40 + } else {
  41 + reject("文件过大");
  42 + }
  43 + });
  44 +};
  45 +
  46 +const validateNameLength = function(name) {
  47 + return new Promise((resolve, reject) => {
  48 + if (name.length < 1 || name.length > 100) {
  49 + reject("文件名称最小长度为2,上限长度为100!");
  50 + } else {
  51 + resolve("名字可以");
  52 + }
  53 + });
  54 +};
  55 +
  56 +const validateVideoFormat = function(curFormat) {
  57 + // const formats = [
  58 + // "mp3",
  59 + // "wma",
  60 + // "m4a",
  61 + // "flac",
  62 + // "aac",
  63 + // "ape",
  64 + // "wav",
  65 + // "wv",
  66 + // "dts",
  67 + // "ac3",
  68 + // "mmf",
  69 + // "amr",
  70 + // "m4r",
  71 + // "ogg",
  72 + // "mp2"
  73 + // ];
  74 + const formats = [
  75 + "mp3",
  76 + "flac",
  77 + "wav",
  78 + "ogg"
  79 + ];
  80 + return new Promise((resolve, reject) => {
  81 + if (formats.includes(curFormat)) {
  82 + resolve("格式可以");
  83 + } else {
  84 + reject("文件格式不允许");
  85 + }
  86 + });
  87 +};
  88 +
  89 +const validatePhone = (rules, value, callback) => {
  90 + const reg = /^1(3|4|5|6|7|8|9)\d{9}$/;
  91 + if (reg.test(value)) {
  92 + callback();
  93 + } else {
  94 + callback(new Error("请填写格式正确的手机号码"));
  95 + }
  96 +};
  97 +
  98 +const validateName = (rules, value, callback) => {
  99 + if (value.length < 1) {
  100 + callback(new Error("请填写歌曲名称"));
  101 + } else if (value.length > 100) {
  102 + callback(new Error("歌曲名称长度应在1~100之间(含)"));
  103 + } else {
  104 + callback();
  105 + }
  106 +};
  107 +
  108 +const initVideoMd5 = function(e) {
  109 + function i(e) {
  110 + var i = (e >>> 0).toString(16);
  111 + return "00000000".substr(0, 8 - i.length) + i;
  112 + }
  113 +
  114 + function t(e) {
  115 + for (var i = [], t = 0; t < e.length; t++) i = i.concat(c(e[t]));
  116 + return i;
  117 + }
  118 +
  119 + function r(e) {
  120 + for (var i = [], t = 0; t < 8; t++) i.push(255 & e), (e >>>= 8);
  121 + return i;
  122 + }
  123 +
  124 + function l(e, i) {
  125 + return ((e << i) & 4294967295) | (e >>> (32 - i));
  126 + }
  127 +
  128 + function n(e, i, t) {
  129 + return (e & i) | (~e & t);
  130 + }
  131 +
  132 + function o(e, i, t) {
  133 + return (t & e) | (~t & i);
  134 + }
  135 +
  136 + function a(e, i, t) {
  137 + return e ^ i ^ t;
  138 + }
  139 +
  140 + function p(e, i, t) {
  141 + return i ^ (e | ~t);
  142 + }
  143 +
  144 + function f(e, i) {
  145 + return (e[i + 3] << 24) | (e[i + 2] << 16) | (e[i + 1] << 8) | e[i];
  146 + }
  147 +
  148 + function c(e) {
  149 + for (var i = [], t = 0; t < e.length; t++)
  150 + if (e.charCodeAt(t) <= 127) i.push(e.charCodeAt(t));
  151 + else
  152 + for (
  153 + var r = encodeURIComponent(e.charAt(t))
  154 + .substr(1)
  155 + .split("%"),
  156 + l = 0;
  157 + l < r.length;
  158 + l++
  159 + )
  160 + i.push(parseInt(r[l], 16));
  161 + return i;
  162 + }
  163 +
  164 + function s() {
  165 + for (var e = "", t = 0, r = 0, l = 3; l >= 0; l--)
  166 + (r = arguments[l]),
  167 + (t = 255 & r),
  168 + (r >>>= 8),
  169 + (t <<= 8),
  170 + (t |= 255 & r),
  171 + (r >>>= 8),
  172 + (t <<= 8),
  173 + (t |= 255 & r),
  174 + (r >>>= 8),
  175 + (t <<= 8),
  176 + (t |= r),
  177 + (e += i(t));
  178 + return e;
  179 + }
  180 +
  181 + function u(e) {
  182 + for (var i = new Array(e.length), t = 0; t < e.length; t++) i[t] = e[t];
  183 + return i;
  184 + }
  185 +
  186 + function F(e, i) {
  187 + return 4294967295 & (e + i);
  188 + }
  189 +
  190 + function d() {
  191 + function e(e, i, t, r) {
  192 + var n = b;
  193 + (b = h), (h = y), (y = F(y, l(F(g, F(e, F(i, t))), r))), (g = n);
  194 + }
  195 +
  196 + var i = m.length;
  197 + m.push(128);
  198 + var t = m.length % 64;
  199 + if (t > 56) {
  200 + for (var c = 0; 64 - t > c; c++) m.push(0);
  201 + t = m.length % 64;
  202 + }
  203 + for (c = 0; 56 - t > c; c++) m.push(0);
  204 + m = m.concat(r(8 * i));
  205 + var u = 1732584193;
  206 + var d = 4023233417;
  207 + var v = 2562383102;
  208 + var O = 271733878;
  209 + var g = 0;
  210 + var y = 0;
  211 + var h = 0;
  212 + var b = 0;
  213 + for (c = 0; c < m.length / 64; c++) {
  214 + (g = u), (y = d), (h = v), (b = O);
  215 + var A = 64 * c;
  216 + e(n(y, h, b), 3614090360, f(m, A), 7),
  217 + e(n(y, h, b), 3905402710, f(m, A + 4), 12),
  218 + e(n(y, h, b), 606105819, f(m, A + 8), 17),
  219 + e(n(y, h, b), 3250441966, f(m, A + 12), 22),
  220 + e(n(y, h, b), 4118548399, f(m, A + 16), 7),
  221 + e(n(y, h, b), 1200080426, f(m, A + 20), 12),
  222 + e(n(y, h, b), 2821735955, f(m, A + 24), 17),
  223 + e(n(y, h, b), 4249261313, f(m, A + 28), 22),
  224 + e(n(y, h, b), 1770035416, f(m, A + 32), 7),
  225 + e(n(y, h, b), 2336552879, f(m, A + 36), 12),
  226 + e(n(y, h, b), 4294925233, f(m, A + 40), 17),
  227 + e(n(y, h, b), 2304563134, f(m, A + 44), 22),
  228 + e(n(y, h, b), 1804603682, f(m, A + 48), 7),
  229 + e(n(y, h, b), 4254626195, f(m, A + 52), 12),
  230 + e(n(y, h, b), 2792965006, f(m, A + 56), 17),
  231 + e(n(y, h, b), 1236535329, f(m, A + 60), 22),
  232 + e(o(y, h, b), 4129170786, f(m, A + 4), 5),
  233 + e(o(y, h, b), 3225465664, f(m, A + 24), 9),
  234 + e(o(y, h, b), 643717713, f(m, A + 44), 14),
  235 + e(o(y, h, b), 3921069994, f(m, A), 20),
  236 + e(o(y, h, b), 3593408605, f(m, A + 20), 5),
  237 + e(o(y, h, b), 38016083, f(m, A + 40), 9),
  238 + e(o(y, h, b), 3634488961, f(m, A + 60), 14),
  239 + e(o(y, h, b), 3889429448, f(m, A + 16), 20),
  240 + e(o(y, h, b), 568446438, f(m, A + 36), 5),
  241 + e(o(y, h, b), 3275163606, f(m, A + 56), 9),
  242 + e(o(y, h, b), 4107603335, f(m, A + 12), 14),
  243 + e(o(y, h, b), 1163531501, f(m, A + 32), 20),
  244 + e(o(y, h, b), 2850285829, f(m, A + 52), 5),
  245 + e(o(y, h, b), 4243563512, f(m, A + 8), 9),
  246 + e(o(y, h, b), 1735328473, f(m, A + 28), 14),
  247 + e(o(y, h, b), 2368359562, f(m, A + 48), 20),
  248 + e(a(y, h, b), 4294588738, f(m, A + 20), 4),
  249 + e(a(y, h, b), 2272392833, f(m, A + 32), 11),
  250 + e(a(y, h, b), 1839030562, f(m, A + 44), 16),
  251 + e(a(y, h, b), 4259657740, f(m, A + 56), 23),
  252 + e(a(y, h, b), 2763975236, f(m, A + 4), 4),
  253 + e(a(y, h, b), 1272893353, f(m, A + 16), 11),
  254 + e(a(y, h, b), 4139469664, f(m, A + 28), 16),
  255 + e(a(y, h, b), 3200236656, f(m, A + 40), 23),
  256 + e(a(y, h, b), 681279174, f(m, A + 52), 4),
  257 + e(a(y, h, b), 3936430074, f(m, A), 11),
  258 + e(a(y, h, b), 3572445317, f(m, A + 12), 16),
  259 + e(a(y, h, b), 76029189, f(m, A + 24), 23),
  260 + e(a(y, h, b), 3654602809, f(m, A + 36), 4),
  261 + e(a(y, h, b), 3873151461, f(m, A + 48), 11),
  262 + e(a(y, h, b), 530742520, f(m, A + 60), 16),
  263 + e(a(y, h, b), 3299628645, f(m, A + 8), 23),
  264 + e(p(y, h, b), 4096336452, f(m, A), 6),
  265 + e(p(y, h, b), 1126891415, f(m, A + 28), 10),
  266 + e(p(y, h, b), 2878612391, f(m, A + 56), 15),
  267 + e(p(y, h, b), 4237533241, f(m, A + 20), 21),
  268 + e(p(y, h, b), 1700485571, f(m, A + 48), 6),
  269 + e(p(y, h, b), 2399980690, f(m, A + 12), 10),
  270 + e(p(y, h, b), 4293915773, f(m, A + 40), 15),
  271 + e(p(y, h, b), 2240044497, f(m, A + 4), 21),
  272 + e(p(y, h, b), 1873313359, f(m, A + 32), 6),
  273 + e(p(y, h, b), 4264355552, f(m, A + 60), 10),
  274 + e(p(y, h, b), 2734768916, f(m, A + 24), 15),
  275 + e(p(y, h, b), 1309151649, f(m, A + 52), 21),
  276 + e(p(y, h, b), 4149444226, f(m, A + 16), 6),
  277 + e(p(y, h, b), 3174756917, f(m, A + 44), 10),
  278 + e(p(y, h, b), 718787259, f(m, A + 8), 15),
  279 + e(p(y, h, b), 3951481745, f(m, A + 36), 21),
  280 + (u = F(u, g)),
  281 + (d = F(d, y)),
  282 + (v = F(v, h)),
  283 + (O = F(O, b));
  284 + }
  285 + return s(O, v, d, u).toUpperCase();
  286 + }
  287 +
  288 + var m = null;
  289 + var v = null;
  290 + return (
  291 + typeof e == "string"
  292 + ? (m = c(e))
  293 + : e.constructor == Array
  294 + ? e.length === 0
  295 + ? (m = e)
  296 + : typeof e[0] == "string"
  297 + ? (m = t(e))
  298 + : typeof e[0] == "number"
  299 + ? (m = e)
  300 + : (v = typeof e[0])
  301 + : typeof ArrayBuffer != "undefined"
  302 + ? e instanceof ArrayBuffer
  303 + ? (m = u(new Uint8Array(e)))
  304 + : e instanceof Uint8Array || e instanceof Int8Array
  305 + ? (m = u(e))
  306 + : e instanceof Uint32Array ||
  307 + e instanceof Int32Array ||
  308 + e instanceof Uint16Array ||
  309 + e instanceof Int16Array ||
  310 + e instanceof Float32Array ||
  311 + e instanceof Float64Array
  312 + ? (m = u(new Uint8Array(e.buffer)))
  313 + : (v = typeof e)
  314 + : (v = typeof e),
  315 + v && alert("MD5 type mismatch, cannot process " + v),
  316 + d()
  317 + );
  318 +};
... ...
src/css/reui.css 0 → 100644
  1 +
  2 +/* vue version 2 css */
  3 +.diy-reset {
  4 + margin: 0;
  5 + padding: 0
  6 +}
  7 +.diy-flex {
  8 + display: flex;
  9 + flex-wrap: wrap;
  10 +}
  11 +.diy-flex-50 {
  12 + width: 50%;
  13 +}
  14 +.diy-flex-100 {
  15 + width: 100%;
  16 +}
  17 +.diy-text-left {
  18 + text-align: left;
  19 +}
  20 +.diy-text-right {
  21 + text-align: right;
  22 +}
  23 +.diy-tip {
  24 + color: #4A90E2;
  25 + font-size: 20px;
  26 +}
  27 +.diy-error {
  28 + color: #D11244;
  29 + font-size: 20px;
  30 +}
  31 +.diy-danger {
  32 + color: #D11244; margin-left: 10px;
  33 +}
  34 +.el-card {
  35 + border: none;
  36 +}
  37 +.el-card__header {
  38 + padding: 24px 40px;
  39 + background-color: #f9f9f9;
  40 + border-bottom: none;
  41 +}
  42 +.el-card__body {
  43 + padding: 40px;
  44 +}
  45 +.el-form-item__label {
  46 + font-size: 16px;
  47 + color: #333333;
  48 +}
  49 +.el-radio__label {
  50 + font-size: 16px;
  51 + color: #333333;
  52 +}
  53 +.title-big {
  54 + font-size: 24px;
  55 + font-weight: Semibold;
  56 + color: #666666;
  57 +}
  58 +.title-small {
  59 + font-size: 14px;
  60 + color: #999999;
  61 + margin-left: 10px;
  62 +}
  63 +.init-tooltip {
  64 + position: absolute;
  65 + top: 10px;
  66 + left: 190px;
  67 + margin-left: 10px;
  68 +}
  69 +.init-transparent-tooltip {
  70 + position: absolute;
  71 + left: -80px;
  72 + top: 6px;
  73 + opacity: 0
  74 +}
  75 +.diy-button {
  76 + height: 40px;
  77 + font-size: 16px;
  78 + border-radius: 6px;
  79 +}
  80 +.width-140 {
  81 + width: 140px;
  82 +}
  83 +.width-190 {
  84 + width: 190px;
  85 +}
  86 +.bg-blue {
  87 + background-color: #4A90E2;
  88 + border-color: #4A90E2;
  89 +}
  90 +.bg-red {
  91 + background-color: #D11244;
  92 + border-color: #D11244;
  93 +}
  94 +.bg-white {
  95 + background-color: transparent;
  96 + border-color: #B4B4B4;
  97 +}
  98 +.el-form-item.is-required:not(.is-no-asterisk) .el-form-item__label-wrap>.el-form-item__label:before, .el-form-item.is-required:not(.is-no-asterisk)>.el-form-item__label:before {
  99 + color: #FF725C;
  100 +}
  101 +/* !!!!! */
  102 +.el-input {
  103 + --el-input-placeholder-color: #b4b4b4;
  104 +}
  105 +.el-input__inner {
  106 + font-size: 16px;
  107 + color: #333333;
  108 +}
  109 +/* !!!!! */
  110 +.el-input__inner:hover {
  111 + --el-input-focus-border: #4A90E2;
  112 +}
  113 +.el-textarea__inner {
  114 + resize: none;
  115 + line-height: 22px;
  116 + font-size: 16px;
  117 + color: #333333;
  118 +}
  119 +.el-radio__inner {
  120 + width: 16px;
  121 + height: 16px;
  122 + border: 1px solid #E3E3E3;
  123 +}
  124 +.el-divider--horizontal {
  125 + margin: 30px 0;
  126 +}
  127 +.el-radio__input.is-checked+.el-radio__label {
  128 + color: #4A90E2;
  129 +}
  130 +textarea {
  131 + font-family: initial;
  132 +}
0 133 \ No newline at end of file
... ...
src/css/styles.css 0 → 100644
  1 +.card-header {
  2 + display: flex;
  3 + justify-content: space-between;
  4 + align-items: center;
  5 +}
  6 +
  7 +.text {
  8 + font-size: 14px;
  9 +}
  10 +
  11 +.item {
  12 + margin-bottom: 18px;
  13 +}
  14 +
  15 +.red {
  16 + color: red;
  17 + margin-left: 10px;
  18 +}
  19 +
  20 +.box-card {
  21 + width: 480px;
  22 +}
  23 +
  24 +.page-container {
  25 + padding: 20px;
  26 +}
  27 +
  28 +.text-container {
  29 + text-align: center;
  30 +}
... ...
src/css/test.css 0 → 100644
  1 +/* vue version 3 css */
  2 +.diy-reset {
  3 + margin: 0;
  4 + padding: 0
  5 +}
  6 +.diy-flex {
  7 + display: flex;
  8 + flex-wrap: wrap;
  9 +}
  10 +.diy-flex-50 {
  11 + width: 50%;
  12 +}
  13 +.diy-flex-100 {
  14 + width: 100%;
  15 +}
  16 +.diy-text-left {
  17 + text-align: left;
  18 +}
  19 +.diy-text-right {
  20 + text-align: right;
  21 +}
  22 +.diy-tip {
  23 + color: #4A90E2;
  24 + font-size: 20px;
  25 +}
  26 +.diy-error {
  27 + color: #D11244;
  28 + font-size: 20px;
  29 +}
  30 +.diy-danger {
  31 + color: #D11244; margin-left: 10px;
  32 +}
  33 +.el-card {
  34 + border: none;
  35 +}
  36 +.el-card__header {
  37 + padding: 24px 40px;
  38 + background-color: #f9f9f9;
  39 + border-bottom: none;
  40 +}
  41 +.el-card__body {
  42 + padding: 40px;
  43 +}
  44 +.el-form-item__label {
  45 + font-size: 16px;
  46 + color: #333333;
  47 +}
  48 +.el-radio__label {
  49 + font-size: 16px;
  50 + color: #333333;
  51 +}
  52 +.title-big {
  53 + font-size: 24px;
  54 + font-weight: Semibold;
  55 + color: #666666;
  56 +}
  57 +.title-small {
  58 + font-size: 14px;
  59 + color: #999999;
  60 + margin-left: 10px;
  61 +}
  62 +.init-tooltip {
  63 + position: absolute;
  64 + top: 10px;
  65 + left: 190px;
  66 + margin-left: 10px;
  67 +}
  68 +.diy-button {
  69 + height: 40px;
  70 + font-size: 16px;
  71 + border-radius: 6px;
  72 +}
  73 +.width-140 {
  74 + width: 140px;
  75 +}
  76 +.width-190 {
  77 + width: 190px;
  78 +}
  79 +.bg-blue {
  80 + background-color: #4A90E2;
  81 + border-color: #4A90E2;
  82 +}
  83 +.bg-red {
  84 + background-color: #D11244;
  85 + border-color: #D11244;
  86 +}
  87 +.bg-white {
  88 + background-color: transparent;
  89 + border-color: #B4B4B4;
  90 +}
  91 +.el-form-item.is-required:not(.is-no-asterisk)>.el-form-item__label-wrap>.el-form-item__label:before, .el-form-item.is-required:not(.is-no-asterisk)>.el-form-item__label:before {
  92 + color: #FF725C;
  93 +}
  94 +.el-input {
  95 + --el-input-placeholder-color: #b4b4b4;
  96 +}
  97 +.el-input__inner {
  98 + font-size: 16px;
  99 + color: #333333;
  100 +}
  101 +.el-input__inner:hover {
  102 + --el-input-focus-border: #4A90E2;
  103 +}
  104 +.el-textarea {
  105 + font-size: 16px;
  106 + color: #333333;
  107 +}
  108 +.el-textarea__inner {
  109 + resize: none;
  110 + line-height: 22px;
  111 +}
  112 +.el-radio__inner {
  113 + width: 16px;
  114 + height: 16px;
  115 + border: 1px solid #E3E3E3;
  116 +}
  117 +.el-divider--horizontal {
  118 + margin: 30px 0;
  119 +}
  120 +.el-radio__input.is-checked+.el-radio__label {
  121 + color: #4A90E2;
  122 +}
0 123 \ No newline at end of file
... ...
src/html/failed.html 0 → 100644
  1 +<!DOCTYPE html>
  2 +<html>
  3 +
  4 +<head>
  5 + <meta charset="utf-8">
  6 + <meta name="viewport" content="width=device-width,initial-scale=1.0">
  7 + <title>CNLive Audio Panel</title>
  8 + <meta name=renderer content=webkit>
  9 + <meta http-equiv="Expires" CONTENT="0">
  10 + <meta http-equiv="Cache-Control" CONTENT="no-cache">
  11 + <meta http-equiv="Pragma" CONTENT="no-cache">
  12 + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  13 + <link rel="shortcut icon" href="/cms.ico" />
  14 + <link rel="bookmark" href="/cms.ico" />
  15 + <link rel="stylesheet" href="https://unpkg.com/element-plus@1.1.0-beta.12/theme-chalk/index.css">
  16 + <style>
  17 + .status-container {
  18 + margin: 0 auto;
  19 + padding-top: 40px;
  20 + width: 420px;
  21 + height: 340px;
  22 + background-color: white;
  23 + border-radius: 12px;
  24 + max-height: 340px;
  25 + }
  26 +
  27 + .status-icon {
  28 + margin: 0 auto;
  29 + width: 126px;
  30 + height: 120px;
  31 + }
  32 + /*包含以下四种的链接*/
  33 + a {
  34 + text-decoration: none;
  35 + }
  36 +
  37 + /*正常的未被访问过的链接*/
  38 + a:link {
  39 + text-decoration: none;
  40 + }
  41 +
  42 + /*已经访问过的链接*/
  43 + a:visited {
  44 + text-decoration: none;
  45 + }
  46 +
  47 + /*鼠标划过(停留)的链接*/
  48 + a:hover {
  49 + text-decoration: none;
  50 + }
  51 +
  52 + /* 正在点击的链接*/
  53 + a:active {
  54 + text-decoration: none;
  55 + }
  56 + </style>
  57 +</head>
  58 +
  59 +<body id="body">
  60 + <div id="success" class="page-container">
  61 + <div class="status-container">
  62 + <div class="status-icon"
  63 + style="background-position: center; background-repeat: no-repeat; background-size: contain; background-image: url('https://wjjtest.ys2.cnliveimg.com/802/img_new/1632289409448.png');"></div>
  64 + <!-- <div class="status-icon"
  65 + style="background-position: center; background-repeat: no-repeat; background-size: contain;"
  66 + :style="{backgroundImage:'url(' + failedIcon + ')'}"></div> -->
  67 + <div style="text-align: center; margin-top: 10px;">
  68 + <span style="font-size: 20px; color: #333333; font-weight: bold;">上传失败!</span>
  69 + </div>
  70 + <div style="text-align: center; margin-top: 10px;">
  71 + <span style="font-size: 14px; color: #999999; line-height: 20px;">很遗憾您上传的作品提交失败</span>
  72 + </div>
  73 + <div style="margin-top: 20px;">
  74 + <!-- <div style="width: 160px;
  75 + height: 42px;
  76 + margin: 0 auto;
  77 + text-align: center;
  78 + line-height: 42px;
  79 + color: #ffffff;
  80 + font-size: 16px;
  81 + background: #F5A623;
  82 + border-radius: 6px;"><a href="http://ent.china.com.cn/music_collection/index.html"
  83 + style="color: white;">我知道了</a></div> -->
  84 + <div style="width: 160px;
  85 + height: 42px;
  86 + margin: 0 auto;
  87 + text-align: center;
  88 + line-height: 42px;
  89 + cursor: pointer;
  90 + color: #ffffff;
  91 + font-size: 16px;
  92 + background: #F5A623;
  93 + border-radius: 6px;" onclick="jumpPage()">我知道了</div>
  94 + </div>
  95 + </div>
  96 + </div>
  97 + <!-- <script src="https://unpkg.com/vue@3.2.11/dist/vue.global.js"></script>
  98 + <script src="https://unpkg.com/element-plus"></script> -->
  99 + <!-- <script>
  100 + const Success = {
  101 + data() {
  102 + return {
  103 + failedIcon: 'https://wjjtest.ys2.cnliveimg.com/802/img_new/1632289409448.png',
  104 + successIcon: 'https://wjjtest.ys2.cnliveimg.com/802/img_new/1632289443434.png'
  105 + }
  106 + },
  107 + mounted() {
  108 + // 装有iframe的页面监听到内容为【数字】时要给iframe组件重写高度。
  109 + parent.postMessage(340, '*')
  110 + },
  111 + methods: {
  112 + closeMask() {
  113 + // window.close()
  114 + // 装有iframe的页面监听到内容为【true】时要执行关闭弹窗操作。
  115 + // parent.postMessage(true, '*')
  116 + }
  117 + }
  118 + }
  119 + Vue.createApp(Success).use(ElementPlus).mount("#success");
  120 + </script> -->
  121 + <script>
  122 + function jumpPage() {
  123 + top.location.href = 'http://ent.china.com.cn/music_collection/index.html'
  124 + }
  125 + </script>
  126 +</body>
  127 +
  128 +</html>
0 129 \ No newline at end of file
... ...
src/html/index.html 0 → 100644
  1 +<!DOCTYPE html>
  2 +<html>
  3 +
  4 +<head>
  5 + <meta charset="utf-8">
  6 + <meta name="viewport" content="width=device-width,initial-scale=1.0">
  7 + <title>CNLive Audio Panel</title>
  8 + <meta http-equiv="Expires" CONTENT="0">
  9 + <meta http-equiv="Cache-Control" CONTENT="no-cache">
  10 + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  11 + <meta http-equiv="Pragma" CONTENT="no-cache">
  12 + <link rel="shortcut icon" href="/cms.ico" />
  13 + <link rel="bookmark" href="/cms.ico" />
  14 + <!-- element 3 plus -->
  15 + <link rel="stylesheet" href="https://unpkg.com/element-plus@1.1.0-beta.12/theme-chalk/index.css">
  16 + <style>
  17 + [v-cloak] {
  18 + display: none;
  19 + }
  20 + </style>
  21 +</head>
  22 +
  23 +<body id="body" class="diy-reset">
  24 + <script>
  25 + parent.postMessage(1000, '*')
  26 + </script>
  27 + <!-- 别人家资源外链 3 -->
  28 + <!-- vue 3 -->
  29 + <!-- <script src="https://unpkg.com/vue@3.2.11/dist/vue.global.js"></script>
  30 + <script src="https://unpkg.com/element-plus@1.1.0-beta.12"></script>
  31 + <script src="https://unpkg.com/axios@0.17.1/dist/axios.min.js"></script>
  32 + <script src="https://unpkg.com/qiniu-js@2.5.5/dist/qiniu.min.js"></script> -->
  33 +
  34 + <!-- 本公司资源外链备份 2 -->
  35 + <!-- <script type="text/javascript">
  36 + if (typeof axios == 'undefined') {
  37 + // document.write(unescape("%3Cscript src='' type='text/javascript'%3E%3C/script%3E"));
  38 + }
  39 + if (typeof Vue == 'undefined') {
  40 + // document.write(unescape("%3Cscript src='' type='text/javascript'%3E%3C/script%3E"));
  41 + }
  42 + if (typeof ELEMENT == 'undefined') {
  43 + // document.write(unescape("%3Cscript src='' type='text/javascript'%3E%3C/script%3E"));
  44 + }
  45 + if(typeof qiniu == 'undefined') {
  46 + // document.write(unescape("%3Cscript src='' type='text/javascript'%3E%3C/script%3E"));
  47 + }
  48 + </script> -->
  49 +
  50 + <!-- 本域名资源备份 1 -->
  51 + <script type="text/javascript">
  52 + if (typeof axios == 'undefined') {
  53 + document.write(unescape("%3Cscript src='./static/jsCdn/axios.min.js' type='text/javascript'%3E%3C/script%3E"));
  54 + }
  55 + if (typeof Vue == 'undefined') {
  56 + document.write(unescape("%3Cscript src='./static/jsCdn/vue.global.js' type='text/javascript'%3E%3C/script%3E"));
  57 + }
  58 + if (typeof ElementPlus == 'undefined') {
  59 + document.write(unescape(
  60 + "%3Cscript src='./static/jsCdn/element-plus.min.js' type='text/javascript'%3E%3C/script%3E"));
  61 + }
  62 + if (typeof qiniu == 'undefined') {
  63 + document.write(unescape("%3Cscript src='./static/jsCdn/qiniu.min.js' type='text/javascript'%3E%3C/script%3E"));
  64 + }
  65 + </script>
  66 +
  67 + <script>
  68 + var UA = window.navigator.userAgent
  69 + var msie = UA.indexOf("MSIE")
  70 + if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) {
  71 + alert("为了您的数据安全,请使用Chrome内核浏览器阅览本站内容!")
  72 + location.href = 'version.html'
  73 + }
  74 + </script>
  75 +
  76 + <div id="audioPage" class="page-container" v-cloak>
  77 + <el-card shadow="never">
  78 + <template #header>
  79 + <div class="card-header">
  80 + <!-- <h3>歌曲征集</h3> -->
  81 + <span class="title-big">歌曲征集</span>
  82 + <span class="title-small">/ 带*号为必填项</span>
  83 + </div>
  84 + </template>
  85 + <div>
  86 + <el-form ref="songs" :model="form" label-width="120px" :rules="rules" class="diy-flex" label-position="right">
  87 + <el-form-item :label="labels.channelId" class="diy-flex-100" prop="channelId">
  88 + <el-radio-group v-model="form.channelId" @change="handleChange">
  89 + <el-radio :label="1278">热歌榜</el-radio>
  90 + <el-radio :label="1279">优秀作词榜</el-radio>
  91 + <el-radio :label="1280">优秀作曲榜</el-radio>
  92 + <el-radio :label="1281">其他</el-radio>
  93 + </el-radio-group>
  94 + </el-form-item>
  95 + <el-form-item :label="labels.songName" class="diy-flex-50" prop="songName">
  96 + <el-input v-model.trim="form.songName" :maxlength="100" :minlength="1" placeholder="请输入歌曲名字"></el-input>
  97 + </el-form-item>
  98 + <el-form-item :label="labels.singer" class="diy-flex-50" prop="singer">
  99 + <el-input v-model.trim="form.singer" :maxlength="15" placeholder="请输入歌手名字"></el-input>
  100 + </el-form-item>
  101 + <el-form-item :label="labels.lyricist" class="diy-flex-50" prop="lyricist">
  102 + <el-input v-model.trim="form.lyricist" :maxlength="15" placeholder="请输入作词人名字"></el-input>
  103 + </el-form-item>
  104 + <el-form-item :label="labels.songwriter" class="diy-flex-50" prop="songwriter">
  105 + <el-input v-model.trim="form.songwriter" :maxlength="15" placeholder="请输入作曲人名字"></el-input>
  106 + </el-form-item>
  107 + <el-form-item :label="labels.redact" class="diy-flex-50" prop="redact">
  108 + <el-input v-model.trim="form.redact" :maxlength="15" placeholder="请输入编曲人名字"></el-input>
  109 + </el-form-item>
  110 + <el-form-item :label="labels.mixing" class="diy-flex-50" prop="mixing">
  111 + <el-input v-model.trim="form.mixing" :maxlength="15" placeholder="请输入混音人名字"></el-input>
  112 + </el-form-item>
  113 + <el-form-item :label="labels.lyric" class="diy-flex-100" prop="lyric">
  114 + <el-input v-model="form.lyric" maxlength="2500" :minlength="20" show-word-limit type="textarea" :rows="10"
  115 + placeholder="请输入歌词"></el-input>
  116 + </el-form-item>
  117 + <el-form-item :label="labels.phone" class="diy-flex-50" prop="phone">
  118 + <el-input v-model.trim="form.phone" :maxlength="11" placeholder="请输入手机号码"></el-input>
  119 + </el-form-item>
  120 + <el-form-item :label="labels.name" class="diy-flex-50" prop="name">
  121 + <el-input v-model.trim="form.name" :maxlength="50" placeholder="请输入联系人姓名"></el-input>
  122 + </el-form-item>
  123 + <el-form-item :label="labels.audioFile" class="diy-flex-50" prop="audioFile">
  124 + <el-upload class="upload-demo" :action="uploadUrl" :auto-upload="false" :file-list="fileList"
  125 + accept=".mp3, .flac, .ogg, .wav, .mpg, .wma, .aac, .m4a" @change="getMp3" :on-exceed="exceed"
  126 + :before-remove="handleRemove" :disabled="btnDisabled" :show-file-list="false">
  127 + <el-button size="small" type="primary" :disabled="btnDisabled" class="diy-button width-190 bg-blue">选择文件
  128 + </el-button>
  129 + <!-- <el-tooltip placement="top">
  130 + <template #content>
  131 + <p>1)可上传的音频格式:mp3/flac/wav/ogg/mpg/wma/aac/acc/m4a。</p>
  132 + <p>2)音频上传过程中,请勿离开此页面或者刷新此页面,否则会导致音频上传任务失败!</p>
  133 + <p>3)音频文件大小上限:500M,数量上限:1。</p>
  134 + </template>
  135 + <el-button type="text" size="mini" class="title-small">上传须知</el-button>
  136 + </el-tooltip> -->
  137 + </el-upload>
  138 + <el-tooltip placement="top">
  139 + <template #content>
  140 + <p>1)可上传的音频格式:mp3/flac/wav/ogg/mpg/wma/aac/acc/m4a。</p>
  141 + <p>2)音频上传过程中,请勿离开此页面或者刷新此页面,否则会导致音频上传任务失败!</p>
  142 + <p>3)音频文件大小上限:500M,数量上限:1。</p>
  143 + </template>
  144 + <el-button type="text" size="mini" class="title-small init-tooltip">上传须知</el-button>
  145 + </el-tooltip>
  146 + <!-- <span class="diy-danger">{{msgText}}</span> -->
  147 + </el-form-item>
  148 + <!-- <el-form-item class="diy-flex-50" label="上传须知"> -->
  149 + <!-- <el-button class="diy-button width-140 bg-white">查看</el-button> -->
  150 + <!-- <el-tooltip placement="top">
  151 + <template #content>
  152 + <p>1)可上传的音频格式:mp3/flac/wav/ogg/mpg/wma/aac/acc/m4a。</p>
  153 + <p>2)音频上传过程中,请勿离开此页面或者刷新此页面,否则会导致音频上传任务失败!</p>
  154 + <p>3)音频文件大小上限:500M,数量上限:1。</p>
  155 + </template>
  156 + <el-button class="diy-button width-140 bg-white">查看</el-button> -->
  157 + <!-- </el-form-item> -->
  158 + <el-divider></el-divider>
  159 + <el-form-item class="diy-flex-50 diy-text-left">
  160 + <div>
  161 + <div class="diy-tip">{{form.audioFile? form.audioFile.name: ''}} </div>
  162 + <div class="diy-tip" v-if="percent > 0 && percent < 100"> 已上传{{Math.ceil(percent)}}%,请耐心等待……</div>
  163 + <div class="diy-tip" v-if="percent == 100"> 上传完成</div>
  164 + </div>
  165 + <div v-if="errorMsg">
  166 + <div class="diy-error">{{errorMsg}}</div>
  167 + </div>
  168 + </el-form-item>
  169 + <el-form-item class="diy-flex-50 diy-text-right">
  170 + <el-button @click="reset" class="diy-button width-140 bg-white" v-if="form.channelId == 1279">取消</el-button>
  171 + <el-button @click="reset" class="diy-button width-140 bg-white" v-else
  172 + :disabled="!form.audioFile || submitDisabled">取消</el-button>
  173 +
  174 + <el-button type="danger" class="diy-button width-140 bg-red" @click="submit('songs')"
  175 + v-if="form.channelId == 1279">确定上传</el-button>
  176 + <el-button type="danger" class="diy-button width-140 bg-red" @click="submit('songs')" v-else
  177 + :disabled="!form.audioFile || submitDisabled">确定上传</el-button>
  178 + </el-form-item>
  179 + </el-form>
  180 + </div>
  181 + </el-card>
  182 + </div>
  183 +</body>
  184 +
  185 +</html>
0 186 \ No newline at end of file
... ...
src/html/success.html 0 → 100644
  1 +<!DOCTYPE html>
  2 +<html>
  3 +
  4 +<head>
  5 + <meta charset="utf-8">
  6 + <meta name="viewport" content="width=device-width,initial-scale=1.0">
  7 + <title>CNLive Audio Panel</title>
  8 + <meta name=renderer content=webkit>
  9 + <meta http-equiv="Expires" CONTENT="0">
  10 + <meta http-equiv="Cache-Control" CONTENT="no-cache">
  11 + <meta http-equiv="Pragma" CONTENT="no-cache">
  12 + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  13 + <link rel="shortcut icon" href="/cms.ico" />
  14 + <link rel="bookmark" href="/cms.ico" />
  15 + <link rel="stylesheet" href="https://unpkg.com/element-plus@1.1.0-beta.12/theme-chalk/index.css">
  16 + <style>
  17 + .status-container {
  18 + margin: 0 auto;
  19 + padding-top: 40px;
  20 + width: 420px;
  21 + height: 340px;
  22 + background-color: white;
  23 + border-radius: 12px;
  24 + max-height: 340px;
  25 + }
  26 +
  27 + .status-icon {
  28 + margin: 0 auto;
  29 + width: 126px;
  30 + height: 120px;
  31 + }
  32 +
  33 + /*包含以下四种的链接*/
  34 + a {
  35 + text-decoration: none;
  36 + }
  37 +
  38 + /*正常的未被访问过的链接*/
  39 + a:link {
  40 + text-decoration: none;
  41 + }
  42 +
  43 + /*已经访问过的链接*/
  44 + a:visited {
  45 + text-decoration: none;
  46 + }
  47 +
  48 + /*鼠标划过(停留)的链接*/
  49 + a:hover {
  50 + text-decoration: none;
  51 + }
  52 +
  53 + /* 正在点击的链接*/
  54 + a:active {
  55 + text-decoration: none;
  56 + }
  57 + </style>
  58 +</head>
  59 +
  60 +<body id="body">
  61 + <div id="success" class="page-container">
  62 + <div class="status-container">
  63 + <div class="status-icon"
  64 + style="background-position: center; background-repeat: no-repeat; background-size: contain; background-image: url('https://wjjtest.ys2.cnliveimg.com/802/img_new/1632289443434.png')">
  65 + </div>
  66 + <!-- <div class="status-icon"
  67 + style="background-position: center; background-repeat: no-repeat; background-size: contain;"
  68 + :style="{backgroundImage:'url(' + successIcon + ')'}">
  69 + </div> -->
  70 + <div style="text-align: center; margin-top: 10px;">
  71 + <span style="font-size: 20px; color: #333333; font-weight: bold;">恭喜您上传成功!</span>
  72 + </div>
  73 + <div style="text-align: center; margin-top: 10px;">
  74 + <span style="font-size: 14px; color: #999999; line-height: 20px;">您所上传的内容会在2个工作日之内进行审核</span>
  75 + </div>
  76 + <div style="text-align: center;">
  77 + <span style="font-size: 14px; color: #999999; line-height: 20px;">如果通过审核将在对应栏目出现!</span>
  78 + </div>
  79 + <div style="margin-top: 20px;">
  80 + <!-- <div style="width: 160px;
  81 + height: 42px;
  82 + margin: 0 auto;
  83 + text-align: center;
  84 + line-height: 42px;
  85 + color: #ffffff;
  86 + font-size: 16px;
  87 + background: #F5A623;
  88 + border-radius: 6px;"><a href="http://ent.china.com.cn/music_collection/index.html"
  89 + style="color: white;">我知道了</a></div> -->
  90 + <div style="width: 160px;
  91 + height: 42px;
  92 + margin: 0 auto;
  93 + text-align: center;
  94 + cursor: pointer;
  95 + line-height: 42px;
  96 + color: #ffffff;
  97 + font-size: 16px;
  98 + background: #F5A623;
  99 + border-radius: 6px;" onclick="jumpPage()">我知道了</div>
  100 + </div>
  101 + </div>
  102 + </div>
  103 + <!-- <script src="https://unpkg.com/vue@3.2.11/dist/vue.global.js"></script>
  104 + <script src="https://unpkg.com/element-plus"></script> -->
  105 + <!-- <script>
  106 + const Success = {
  107 + data() {
  108 + return {
  109 + failedIcon: 'https://wjjtest.ys2.cnliveimg.com/802/img_new/1632289409448.png',
  110 + successIcon: 'https://wjjtest.ys2.cnliveimg.com/802/img_new/1632289443434.png',
  111 + }
  112 + },
  113 + mounted() {
  114 + // 装有iframe的页面监听到内容为【数字】时要给iframe组件重写高度。
  115 + parent.postMessage(340, '*')
  116 + },
  117 + methods: {
  118 + closeMask() {
  119 + // window.close()
  120 + // 装有iframe的页面监听到内容为【true】时要执行关闭弹窗操作。
  121 + // parent.postMessage(true, '*')
  122 +
  123 + }
  124 + }
  125 + }
  126 + Vue.createApp(Success).use(ElementPlus).mount("#success");
  127 + </script> -->
  128 +
  129 + <script>
  130 + function jumpPage() {
  131 + top.location.href = 'http://ent.china.com.cn/music_collection/index.html'
  132 + }
  133 + </script>
  134 +
  135 +</body>
  136 +
  137 +</html>
0 138 \ No newline at end of file
... ...
src/html/test.html 0 → 100644
  1 +<!DOCTYPE html>
  2 +<html>
  3 +
  4 +<head>
  5 + <meta charset="utf-8">
  6 + <meta name="viewport" content="width=device-width,initial-scale=1.0">
  7 + <title>CNLive Audio Panel</title>
  8 + <meta http-equiv="Expires" CONTENT="0">
  9 + <meta http-equiv="Cache-Control" CONTENT="no-cache">
  10 + <meta http-equiv="Pragma" CONTENT="no-cache">
  11 + <link rel="shortcut icon" href="/cms.ico" />
  12 + <link rel="bookmark" href="/cms.ico" />
  13 + <link rel="stylesheet" href="https://unpkg.com/element-plus@1.1.0-beta.12/theme-chalk/index.css">
  14 + <style>
  15 + .status-container {
  16 + margin: 0 auto;
  17 + padding-top: 40px;
  18 + width: 420px;
  19 + height: 340px;
  20 + background-color: white;
  21 + border-radius: 12px;
  22 + max-height: 340px;
  23 + }
  24 +
  25 + .status-icon {
  26 + margin: 0 auto;
  27 + width: 126px;
  28 + height: 120px;
  29 + }
  30 + </style>
  31 +</head>
  32 +
  33 +<body id="body">
  34 + <div id="success" class="page-container">
  35 + <iframe src="file:///E:/codes/projects/cms_songs/src/html/success.html" id="tengxi" frameborder="1/0" height="1000" name="征集" scrolling="no" width="900"></iframe>
  36 + </div>
  37 + <script src="https://unpkg.com/vue@3.2.11/dist/vue.global.js"></script>
  38 + <script src="https://unpkg.com/element-plus"></script>
  39 + <script>
  40 + const Success = {
  41 + data() {
  42 + return {
  43 + failedIcon: 'https://wjjtest.ys2.cnliveimg.com/802/img_new/1632289409448.png',
  44 + successIcon: 'https://wjjtest.ys2.cnliveimg.com/802/img_new/1632289443434.png',
  45 + }
  46 + },
  47 + mounted() {
  48 + console.log('parent mounted')
  49 + window.addEventListener('message', function (e) {
  50 + console.log(e.data)
  51 + document.getElementById('tengxi').height = e.data
  52 + }, false)
  53 + },
  54 + methods: {
  55 +
  56 + }
  57 + }
  58 + Vue.createApp(Success).use(ElementPlus).mount("#success");
  59 + </script>
  60 +</body>
  61 +
  62 +</html>
0 63 \ No newline at end of file
... ...
src/html/v2.html 0 → 100644
  1 +<!DOCTYPE html>
  2 +<html>
  3 +
  4 +<head>
  5 + <meta charset="utf-8">
  6 + <meta name="viewport" content="width=device-width,initial-scale=1.0">
  7 + <title>CNLive Audio Panel</title>
  8 + <meta name=renderer content=webkit>
  9 + <meta http-equiv="X-UA-Compatible" content="IE=EDGE"/>
  10 + <meta http-equiv="Expires" CONTENT="0">
  11 + <meta http-equiv="Cache-Control" CONTENT="no-cache">
  12 + <meta http-equiv="Pragma" CONTENT="no-cache">
  13 + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  14 + <link rel="shortcut icon" href="/cms.ico" />
  15 + <link rel="bookmark" href="/cms.ico" />
  16 + <!-- element 2 -->
  17 + <link rel="stylesheet" href="https://unpkg.com/element-ui@2.15.5/lib/theme-chalk/index.css">
  18 + <style>
  19 + [v-cloak] {
  20 + display: none;
  21 + }
  22 + </style>
  23 +</head>
  24 +
  25 +<body id="body" class="diy-reset">
  26 + <script>
  27 + // parent.postMessage('好的', '*')
  28 + </script>
  29 +
  30 + <script src="https://unpkg.com/vue@2.5.2/dist/vue.min.js"></script>
  31 + <script src="https://unpkg.com/element-ui@2.15.5/lib/index.js"></script>
  32 + <script src="https://unpkg.com/axios@0.17.1/dist/axios.min.js"></script>
  33 + <script src="https://unpkg.com/qiniu-js@2.5.5/dist/qiniu.min.js"></script>
  34 +
  35 + <script type="text/javascript">
  36 + if (typeof axios == 'undefined') {
  37 + document.write(unescape("%3Cscript src='http://gongongku.cnlive.com/axios.min.js' type='text/javascript'%3E%3C/script%3E"));
  38 + }
  39 + if (typeof Vue == 'undefined') {
  40 + document.write(unescape("%3Cscript src='http://gongongku.cnlive.com/vue.min.js' type='text/javascript'%3E%3C/script%3E"));
  41 + }
  42 + if (typeof ELEMENT == 'undefined') {
  43 + document.write(unescape("%3Cscript src='https://unpkg.com/element-ui@2.15.5/lib/index.js' type='text/javascript'%3E%3C/script%3E"));
  44 + }
  45 + if(typeof qiniu == 'undefined') {
  46 + document.write(unescape("%3Cscript src='http://gongongku.cnlive.com/qiniu.min.js' type='text/javascript'%3E%3C/script%3E"));
  47 + }
  48 + </script>
  49 +
  50 + <script type="text/javascript">
  51 + if (typeof axios == 'undefined') {
  52 + document.write(unescape("%3Cscript src='./static/jsCdn/axios.min.js' type='text/javascript'%3E%3C/script%3E"));
  53 + }
  54 + if (typeof Vue == 'undefined') {
  55 + document.write(unescape("%3Cscript src='./static/jsCdn/vue.min.js' type='text/javascript'%3E%3C/script%3E"));
  56 + }
  57 + if (typeof ELEMENT == 'undefined') {
  58 + document.write(unescape(
  59 + "%3Cscript src='./static/jsCdn/element-index.min.js' type='text/javascript'%3E%3C/script%3E"));
  60 + }
  61 + if (typeof qiniu == 'undefined') {
  62 + document.write(unescape("%3Cscript src='./static/jsCdn/qiniu.min.js' type='text/javascript'%3E%3C/script%3E"));
  63 + }
  64 + </script>
  65 +
  66 + <script>
  67 + var UA = window.navigator.userAgent
  68 + var msie = UA.indexOf("MSIE")
  69 + if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) {
  70 + alert("为了您的数据安全,请使用新版本谷歌(google chrome)、火狐(Firefox)、QQ、360等浏览器阅览本站内容!")
  71 + // location.href = 'version.html'
  72 + }
  73 + </script>
  74 +
  75 + <div id="mainPage" class="page-container" v-cloak>
  76 + <el-card shadow="never">
  77 + <div slot="header" class="card-header">
  78 + <span class="title-big">歌曲征集</span>
  79 + <span class="title-small">/ 带*号为必填项</span>
  80 + </div>
  81 + <div>
  82 + <el-form ref="songs" :model="form" label-width="120px" :rules="rules" class="diy-flex" label-position="right">
  83 + <el-form-item class="diy-flex-100" prop="channelId">
  84 + <label slot="label">类&emsp;&emsp;型</label>
  85 + <el-radio-group v-model="form.channelId" @change="handleChange">
  86 + <el-radio :label="1278">热歌榜</el-radio>
  87 + <el-radio :label="1279">优秀作词榜</el-radio>
  88 + <el-radio :label="1280">优秀作曲榜</el-radio>
  89 + <el-radio :label="1281">其他</el-radio>
  90 + </el-radio-group>
  91 + </el-form-item>
  92 + <el-form-item class="diy-flex-50" prop="songName">
  93 + <label slot="label">歌曲名字</label>
  94 + <el-input v-model.trim="form.songName" :maxlength="100" :minlength="1" placeholder="请输入歌曲名字"></el-input>
  95 + </el-form-item>
  96 + <el-form-item class="diy-flex-50" prop="singer">
  97 + <label slot="label">歌&emsp;&emsp;手</label>
  98 + <el-input v-model.trim="form.singer" :maxlength="15" placeholder="请输入歌手名字"></el-input>
  99 + </el-form-item>
  100 + <el-form-item class="diy-flex-50" prop="lyricist">
  101 + <label slot="label">作&emsp;&emsp;词</label>
  102 + <el-input v-model.trim="form.lyricist" :maxlength="15" placeholder="请输入作词人名字"></el-input>
  103 + </el-form-item>
  104 + <el-form-item class="diy-flex-50" prop="songwriter">
  105 + <label slot="label">作&emsp;&emsp;曲</label>
  106 + <el-input v-model.trim="form.songwriter" :maxlength="15" placeholder="请输入作曲人名字"></el-input>
  107 + </el-form-item>
  108 + <el-form-item class="diy-flex-50" prop="redact">
  109 + <label slot="label">编&emsp;&emsp;曲</label>
  110 + <el-input v-model.trim="form.redact" :maxlength="15" placeholder="请输入编曲人名字"></el-input>
  111 + </el-form-item>
  112 + <el-form-item class="diy-flex-50" prop="mixing">
  113 + <label slot="label">混&emsp;&emsp;音</label>
  114 + <el-input v-model.trim="form.mixing" :maxlength="15" placeholder="请输入混音人名字"></el-input>
  115 + </el-form-item>
  116 + <el-form-item class="diy-flex-100" prop="lyric">
  117 + <label slot="label">歌&emsp;&emsp;词</label>
  118 + <el-input v-model="form.lyric" maxlength="2500" :minlength="20" show-word-limit type="textarea" :rows="10"
  119 + placeholder="请输入歌词"></el-input>
  120 + </el-form-item>
  121 + <el-form-item class="diy-flex-50" prop="phone">
  122 + <label slot="label">手机号码</label>
  123 + <el-input v-model.trim="form.phone" :maxlength="11" placeholder="请输入手机号码"></el-input>
  124 + </el-form-item>
  125 + <el-form-item class="diy-flex-50" prop="name">
  126 + <label slot="label">联系人姓名</label>
  127 + <el-input v-model.trim="form.name" :maxlength="50" placeholder="请输入联系人姓名"></el-input>
  128 + </el-form-item>
  129 + <el-form-item class="diy-flex-50" prop="audioFile">
  130 + <label slot="label">音&emsp;&emsp;频</label>
  131 + <el-upload class="upload-demo" :action="uploadUrl" :auto-upload="false"
  132 + accept=".mp3, .flac, .ogg, .wav, .mpg, .wma, .aac, .m4a" :before-remove="handleRemove"
  133 + :disabled="btnDisabled" :on-change="getMp3" :on-exceed="exceed" :file-list="fileList"
  134 + :show-file-list="false">
  135 + <el-button size="small" type="primary" :disabled="btnDisabled" class="diy-button width-190 bg-blue">选择文件
  136 + </el-button>
  137 + </el-upload>
  138 + <el-tooltip placement="top">
  139 + <div slot="content">
  140 + <p>1)可上传的音频格式:mp3/flac/wav/ogg/mpg/wma/aac/acc/m4a。</p>
  141 + <p>2)音频上传过程中,请勿离开此页面或者刷新此页面,否则会导致音频上传任务失败!</p>
  142 + <p>3)音频文件大小上限:500M,数量上限:1。</p>
  143 + </div>
  144 + <el-button type="text" size="mini" class="title-small init-tooltip">上传须知</el-button>
  145 + </el-tooltip>
  146 + </el-form-item>
  147 + <el-form-item class="diy-flex-50" prop="agree">
  148 + <label slot="label">作曲授权</label>
  149 + <el-checkbox-group v-model="form.agree">
  150 + <el-checkbox label="" name="type" :disabled="banAgree"></el-checkbox>
  151 + </el-checkbox-group>
  152 + <el-tooltip placement="top">
  153 + <div slot="content">
  154 + <p>征歌作品须为作者原创。</p>
  155 + <p>未以任何形式公开发表,未参加任何评奖评选,不存在版权纠纷。</p>
  156 + <p>报送参加本次征集评选,即视为授权空军拥有该作品完整版权。</p>
  157 + </div>
  158 + <el-button type="text" size="mini" class="title-small init-transparent-tooltip">作曲授权</el-button>
  159 + </el-tooltip>
  160 + </el-form-item>
  161 + <el-divider></el-divider>
  162 + <el-form-item class="diy-flex-50 diy-text-left">
  163 + <div>
  164 + <div class="diy-tip">{{form.audioFile? form.audioFile.name: ''}} </div>
  165 + <div class="diy-tip" v-if="percent > 0 && percent < 100"> 已上传{{Math.ceil(percent)}}%,请耐心等待……</div>
  166 + <div class="diy-tip" v-if="percent == 100"> 上传完成</div>
  167 + </div>
  168 + <div v-if="errorMsg">
  169 + <div class="diy-error">{{errorMsg}}</div>
  170 + </div>
  171 + </el-form-item>
  172 + <el-form-item class="diy-flex-50 diy-text-right">
  173 + <el-button @click="reset" class="diy-button width-140 bg-white" v-if="form.channelId == 1279">取消</el-button>
  174 + <el-button @click="reset" class="diy-button width-140 bg-white" v-else
  175 + :disabled="!form.audioFile || submitDisabled">取消</el-button>
  176 +
  177 + <el-button type="danger" class="diy-button width-140 bg-red" @click="submit('songs')"
  178 + v-if="form.channelId == 1279">确定上传</el-button>
  179 + <el-button type="danger" class="diy-button width-140 bg-red" @click="submit('songs')" v-else
  180 + :disabled="!form.audioFile || submitDisabled">确定上传</el-button>
  181 + </el-form-item>
  182 + </el-form>
  183 + </div>
  184 + </el-card>
  185 + </div>
  186 +</body>
  187 +
  188 +</html>
0 189 \ No newline at end of file
... ...
src/html/version.html 0 → 100644
  1 +<!DOCTYPE html>
  2 +<html>
  3 +
  4 +<head>
  5 + <meta charset="utf-8">
  6 + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  7 + <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  8 + <link rel="icon" href="cms.ico">
  9 + <title>CNLive Audio Panel</title>
  10 + <style>
  11 + .version-page {
  12 + text-align: center;
  13 + }
  14 +
  15 + .b-container {
  16 + width: 60%;
  17 + margin: 0 auto;
  18 + margin-top: 200px;
  19 + }
  20 + </style>
  21 +</head>
  22 +
  23 +<body>
  24 + <div class="version-page">
  25 + <div class="b-container">
  26 + <h2>为了您的数据安全,请使用chrome内核的浏览器阅览本站内容。</h2>
  27 + <h3>推荐浏览器:</h3>
  28 + <div style="margin: 10px 0;"><a href="https://www.google.cn/chrome/" target="_blank">Chrome 谷歌浏览器</a></div>
  29 + <div style="margin: 10px 0;"><a href="http://www.firefox.com.cn/" target="_blank">FireFox 火狐浏览器</a></div>
  30 + <div style="margin: 10px 0;"><a href="http://browser.360.cn/" target="_blank">360浏览器【极速】模式</a></div>
  31 + <h5 style="color: red;">请避免使用360浏览器【兼容】模式</h5>
  32 + </div>
  33 + </div>
  34 + <noscript>
  35 + <strong>We're sorry but it doesn't work properly without JavaScript enabled. Please enable it
  36 + to continue.</strong>
  37 + </noscript>
  38 + <!-- built files will be auto injected -->
  39 +</body>
  40 +
  41 +</html>
0 42 \ No newline at end of file
... ...
src/js/audio.js 0 → 100644
  1 +import 'babel-polyfill'
  2 +import * as all from "./config";
  3 +import './../css/reui.css';
  4 +var Main = {
  5 + data() {
  6 + return {
  7 + form: {
  8 + channelId: null,
  9 + songName: null,
  10 + singer: null,
  11 + lyricist: null,
  12 + songwriter: null,
  13 + redact: null,
  14 + mixing: null,
  15 + lyric: null,
  16 + phone: null,
  17 + name: null,
  18 + audioId: null,
  19 + audioFile: null,
  20 + agree: []
  21 + },
  22 + labels: all.formLabels,
  23 + rules: {
  24 + songName: [
  25 + {
  26 + required: true,
  27 + trigger: "change",
  28 + message: "请填写歌曲名字",
  29 + },
  30 + ],
  31 + name: [
  32 + { required: true, trigger: "change", message: "请填写联系人姓名" },
  33 + ],
  34 + agree: [
  35 + { required: true, trigger: "change", message: "请进行作曲授权" },
  36 + ],
  37 + phone: [
  38 + {
  39 + required: true,
  40 + trigger: "change",
  41 + message: "请填写格式正确的手机号码",
  42 + validator: all.validatePhone,
  43 + },
  44 + ],
  45 + audioFile: [
  46 + { required: true, trigger: "change", message: "请上传音频" },
  47 + ],
  48 + channelId: [
  49 + { required: true, trigger: "change", message: "请选择作品类型" },
  50 + ],
  51 + audioId: [
  52 + {
  53 + required: true,
  54 + trigger: "change",
  55 + message: "请上传音频文件以获取音频ID",
  56 + },
  57 + ],
  58 + singer: [
  59 + { required: false, trigger: "change", message: "请输入歌手名字" },
  60 + ],
  61 + lyricist: [
  62 + { required: false, trigger: "change", message: "请输入作词人名字" },
  63 + ],
  64 + songwriter: [
  65 + { required: false, trigger: "change", message: "请输入作曲人名字" },
  66 + ],
  67 + lyric: [
  68 + {
  69 + required: false,
  70 + trigger: "change",
  71 + message: "请输入符合要求的歌词,至少20个字,最多不能超过2500个字",
  72 + validator: all.validateLyric,
  73 + },
  74 + ],
  75 + },
  76 +
  77 + uploadUrl: "",
  78 + fileList: [],
  79 + token: "",
  80 + btnDisabled: false,
  81 + submitDisabled: false,
  82 + msgText:
  83 + "只能上传一个mp3/flac/wav/ogg/mpg/wma/aac/acc/m4a格式的音频文件,且不超过500mb。上传过程中请勿刷新页面。",
  84 + percent: 0,
  85 + curFile: "",
  86 + errorMsg: "",
  87 + banAgree: false
  88 + };
  89 + },
  90 + methods: {
  91 + // 作品类型为【词】的时候可以不上传文件
  92 + handleChange(data) {
  93 + if (data == 1279) {
  94 + // 优秀作词榜
  95 + this.rules.audioFile[0].required = false;
  96 + this.rules.audioId[0].required = false;
  97 + this.rules.singer[0].required = false;
  98 + this.rules.songwriter[0].required = false;
  99 + this.rules.lyricist[0].required = true;
  100 + this.rules.lyric[0].required = true;
  101 + } else if (data == 1278) {
  102 + // 成品
  103 + this.rules.singer[0].required = true;
  104 + this.rules.audioFile[0].required = true;
  105 + this.rules.audioId[0].required = true;
  106 + this.rules.lyricist[0].required = false;
  107 + this.rules.songwriter[0].required = false;
  108 + this.rules.lyric[0].required = false;
  109 + } else if (data == 1280) {
  110 + // 作曲
  111 + this.rules.songwriter[0].required = true;
  112 + this.rules.audioFile[0].required = true;
  113 + this.rules.audioId[0].required = true;
  114 + this.rules.singer[0].required = false;
  115 + this.rules.lyricist[0].required = false;
  116 + this.rules.lyric[0].required = false;
  117 + } else if (data == 1281) {
  118 + // 其他
  119 + this.rules.songwriter[0].required = false;
  120 + this.rules.audioFile[0].required = true;
  121 + this.rules.audioId[0].required = true;
  122 + this.rules.singer[0].required = false;
  123 + this.rules.lyricist[0].required = false;
  124 + this.rules.lyric[0].required = false;
  125 + }
  126 + },
  127 + // 文件数量超上限响应
  128 + exceed(e, d) {
  129 + this.$message.error("只能上传一个文件");
  130 + this.errorMsg = "只能上传一个文件";
  131 + },
  132 + // 表单重置按钮响应
  133 + reset() {
  134 + for (let i in this.form) {
  135 + this.form[i] = null;
  136 + }
  137 + this.percent = 0;
  138 + this.btnDisabled = false;
  139 + this.submitDisabled = false;
  140 + },
  141 + // 文件移除响应,暂未启用
  142 + handleRemove(file, list) {
  143 + if (this.percent < 100) {
  144 + this.errorMsg = "上传中的文件不可删除";
  145 + this.$message({
  146 + type: "error",
  147 + duration: 5000,
  148 + message: "上传中的文件不可被删除",
  149 + });
  150 + return false;
  151 + } else {
  152 + this.form.audioId = null;
  153 + this.percent = 0;
  154 + }
  155 + },
  156 + // 校验Md5
  157 + initMd5(fileObj) {
  158 + return new Promise((resolve, reject) => {
  159 + const fileName = fileObj.name.split(".")[0];
  160 + const fileType = fileObj.name.split(".")[1];
  161 + const fileSize = fileObj.size;
  162 + const fileModifyDate = fileObj.lastModifiedDate;
  163 + const md5Str = all
  164 + .initVideoMd5(
  165 + [fileType, fileSize, fileModifyDate || fileName].join("_")
  166 + )
  167 + .toLowerCase();
  168 + if (md5Str) {
  169 + resolve(md5Str);
  170 + } else {
  171 + reject("校验失败");
  172 + }
  173 + });
  174 + },
  175 + // 确认提交按钮响应,上传视频到七牛
  176 + submit(formName) {
  177 + this.$refs[formName].validate((valid) => {
  178 + if (valid) {
  179 + this.errorMsg = ''
  180 + this.banAgree = true
  181 + this.submitDisabled = true;
  182 + this.btnDisabled = true;
  183 + if (this.form.channelId == 1279) {
  184 + this.postCms();
  185 + } else {
  186 + const fileName = this.form.audioFile.raw.name.split(".");
  187 + fileName.splice(fileName.length - 1, 1);
  188 + this.curFile = this.form.audioFile.name;
  189 + this.form.audioId = null;
  190 + const that = this;
  191 + const fileBaseObj = {
  192 + videoName: fileName.join("."),
  193 + md5: null,
  194 + };
  195 + const fileSaveObj = {
  196 + videoId: null,
  197 +
  198 + multipleCategory:
  199 + 100005 + "/" + this.getCategoryText(this.form.channelId),
  200 + tag: this.getChannelText(this.form.channelId),
  201 + ts: this.getTs(),
  202 + timestamp: this.getTimeStamp(),
  203 + masterId: all.secretUrls.masterIdMaster,
  204 + // masterId: all.secretUrls.masterIdDev,
  205 + };
  206 + const fileInitObj = {
  207 + gfmt: this.form.audioFile.raw.name.split(".").reverse().shift(),
  208 + fileSize: this.form.audioFile.raw.size,
  209 + ts: this.getTs(),
  210 + timestamp: this.getTimeStamp(),
  211 + multipleCategory:
  212 + 100005 + "/" + this.getCategoryText(this.form.channelId),
  213 + // masterId: all.secretUrls.masterIdDev,
  214 + masterId: all.secretUrls.masterIdMaster,
  215 + };
  216 + const fileWholeObj = {
  217 + file: this.form.audioFile.raw,
  218 + uploadStatus: "ready",
  219 + proCount: 0,
  220 + fileKey: null,
  221 + observable: null,
  222 + subscription: null,
  223 + };
  224 +
  225 + const observer = {
  226 + next(res) {
  227 + if (res.total.percent >= 99) {
  228 + that.percent = 99;
  229 + } else {
  230 + that.percent = Math.ceil(res.total.percent);
  231 + }
  232 + },
  233 + error(err) {
  234 + console.log(err);
  235 + },
  236 + complete(res) {
  237 + let apiDone = all.secretUrls.base + all.secretUrls.finish;
  238 + let apiStringSignDone = all.signFunction(
  239 + apiDone,
  240 + that.getParamsList({
  241 + hash: res.hash,
  242 + key: res.key,
  243 + vid: fileSaveObj.videoId,
  244 + timestamp: that.getTimeStamp(),
  245 + })
  246 + );
  247 + all
  248 + .request({
  249 + url: apiDone,
  250 + method: "get",
  251 + params: all.parseQueryString(apiStringSignDone),
  252 + })
  253 + .then((res) => {
  254 + if (
  255 + res &&
  256 + res.data &&
  257 + res.data.errorCode &&
  258 + res.data.errorCode != 0
  259 + ) {
  260 + that.errorMsg = "系统错误,请联系管理员";
  261 + // that.reset();
  262 + this.submitDisabled = false;
  263 + this.btnDisabled = false;
  264 + this.banAgree = false
  265 + return false;
  266 + } else {
  267 + let apiComplete =
  268 + all.secretUrls.base + all.secretUrls.callback;
  269 + let apiStringSignComplete = all.signFunction(
  270 + apiComplete,
  271 + // that.getParamsList({
  272 + // ...fileBaseObj,
  273 + // ...fileSaveObj,
  274 + // ...{ timestamp: that.getTimeStamp() },
  275 + // })
  276 + that.getParamsList(Object.assign(fileBaseObj, fileSaveObj, {timestamp: that.getTimeStamp()}))
  277 + );
  278 + return all.request({
  279 + url: apiComplete,
  280 + method: "get",
  281 + params: all.parseQueryString(apiStringSignComplete),
  282 + });
  283 + }
  284 + })
  285 + .then((data) => {
  286 + if (
  287 + data &&
  288 + data.data &&
  289 + data.data.data &&
  290 + data.data.data.obj
  291 + ) {
  292 + that.form.audioId = data.data.data.obj;
  293 + that.percent = 100;
  294 + that.postCms();
  295 + } else {
  296 + that.errorMsg = "系统错误,请联系管理员";
  297 + // that.reset()
  298 + this.submitDisabled = false;
  299 + this.btnDisabled = false;
  300 + this.banAgree = false
  301 + }
  302 + })
  303 + .catch((error) => {
  304 + that.errorMsg = error ? error : "系统错误,请联系管理员";
  305 + // that.reset();
  306 + this.submitDisabled = false;
  307 + this.btnDisabled = false;
  308 + this.banAgree = false
  309 + });
  310 + },
  311 + };
  312 +
  313 + Promise.all([
  314 + all.validateVideoSize(fileInitObj.fileSize),
  315 + all.validateVideoFormat(fileInitObj.gfmt),
  316 + all.validateNameLength(fileBaseObj.videoName),
  317 + ])
  318 + .then((check) => {
  319 + return this.getToken();
  320 + })
  321 + .then((d) => {
  322 + if (d && d.data && typeof d.data == "string") {
  323 + this.token = d.data;
  324 + }
  325 + return this.initMd5(this.form.audioFile.raw);
  326 + })
  327 + .then((n) => {
  328 + if (!this.token) {
  329 + // this.$message({
  330 + // type: "error",
  331 + // message: "鉴权失败",
  332 + // duration: 5000,
  333 + // });
  334 + this.errorMsg = "鉴权失败";
  335 + // this.reset();
  336 + this.submitDisabled = false;
  337 + this.btnDisabled = false;
  338 + this.banAgree = false
  339 + return false;
  340 + }
  341 + fileBaseObj.md5 = n;
  342 + let apiInit = all.secretUrls.base + all.secretUrls.init;
  343 + let apiStringSignInit = all.signFunction(
  344 + apiInit,
  345 + // this.getParamsList({ ...fileBaseObj, ...fileInitObj })
  346 + this.getParamsList(Object.assign(fileBaseObj, fileInitObj))
  347 + );
  348 + return all.request({
  349 + url: all.secretUrls.base + all.secretUrls.init,
  350 + method: "get",
  351 + params: all.parseQueryString(apiStringSignInit),
  352 + });
  353 + })
  354 + .then((res) => {
  355 + if (
  356 + res &&
  357 + res.data &&
  358 + res.data.data &&
  359 + res.data.data.code == 0
  360 + ) {
  361 + fileSaveObj.videoId = res.data.data.obj.vid;
  362 + fileWholeObj.fileKey = res.data.data.obj.originPath;
  363 + all.putExtra.params["x:name"] = fileWholeObj.fileKey;
  364 + fileWholeObj.observable = qiniu.upload(
  365 + this.form.audioFile.raw,
  366 + fileWholeObj.fileKey,
  367 + this.token,
  368 + all.putExtra,
  369 + all.cdnConfig
  370 + );
  371 + fileWholeObj.subscription =
  372 + fileWholeObj.observable.subscribe(observer);
  373 + } else {
  374 + if (
  375 + res &&
  376 + res.data &&
  377 + res.data.errorCode &&
  378 + res.data.errorCode != 0
  379 + ) {
  380 + this.errorMsg = "系统错误,请联系管理员";
  381 + // this.reset();
  382 + this.submitDisabled = false;
  383 + this.btnDisabled = false;
  384 + this.banAgree = false
  385 + }
  386 + }
  387 + })
  388 + .catch((error) => {
  389 + this.errorMsg = error ? error : "系统错误,请联系管理员";
  390 + // this.reset()
  391 + this.submitDisabled = false;
  392 + this.btnDisabled = false;
  393 + this.banAgree = false
  394 + });
  395 + }
  396 + } else {
  397 + // this.$message.error("请检查表单内容");
  398 + this.errorMsg = '请检查表单内容'
  399 + this.submitDisabled = false;
  400 + this.btnDisabled = false;
  401 + this.banAgree = false
  402 + return false;
  403 + }
  404 + });
  405 + },
  406 + // 对象参数转数组格式
  407 + getParamsList(params) {
  408 + let list = [];
  409 + for (let i in params) {
  410 + if (i == "hash" || i == "key" || i == "x:name") {
  411 + list.push(`${i}=${encodeURI(params[i])}`);
  412 + } else {
  413 + list.push(`${i}=${params[i]}`);
  414 + }
  415 + }
  416 + return list;
  417 + },
  418 + // 获取时间戳
  419 + getTimeStamp() {
  420 + return Math.round(new Date().getTime() / 1000);
  421 + },
  422 + // 获取时间戳加四位随机数
  423 + getTs() {
  424 + return (
  425 + this.getTimeStamp().toString() +
  426 + Math.floor(Math.random() * 10000).toString()
  427 + );
  428 + },
  429 + // 通过作品类型id获取作品分类,用于上传视频的??参数
  430 + getCategoryText(id) {
  431 + if (id == 1278) {
  432 + return "533";
  433 + }
  434 + if (id == 1280) {
  435 + return "534";
  436 + }
  437 + if (id == 1281) {
  438 + return "532";
  439 + }
  440 + },
  441 + // 通过作品类型id获取作品类型,用于上传视频的tag
  442 + getChannelText(id) {
  443 + if (id == 1278) {
  444 + return "热歌榜";
  445 + }
  446 + if (id == 1279) {
  447 + return "优秀作词榜";
  448 + }
  449 + if (id == 1280) {
  450 + return "优秀作曲榜";
  451 + }
  452 + if (id == 1281) {
  453 + return "其他";
  454 + }
  455 + },
  456 + // 获取认证token
  457 + getToken() {
  458 + let api = all.secretUrls.base + all.secretUrls.auth;
  459 + let apiStringSign = all.signFunction(api, [
  460 + "ts=" + this.getTs(),
  461 + "timestamp=" + this.getTimeStamp(),
  462 + ]);
  463 + return all.request({
  464 + url: all.secretUrls.base + all.secretUrls.auth,
  465 + method: "get",
  466 + params: all.parseQueryString(apiStringSign),
  467 + });
  468 + },
  469 + // cms接口提交videoId和表单内容
  470 + postCms() {
  471 + all
  472 + .request({
  473 + // url: "http://cmstest.cnlive.com:8768/contentApi/audioSave",
  474 + url: "https://cms.cnlive.com/api/contentApi/audioSave",
  475 + method: "post",
  476 + params: {
  477 + channelId: this.form.channelId,
  478 + songName: this.form.songName,
  479 + singer: this.form.singer,
  480 + lyric: this.addBr(this.form.lyric),
  481 + phone: this.form.phone,
  482 + name: this.form.name,
  483 + audioId: this.form.audioId,
  484 + lyricist: this.form.lyricist,
  485 + songwriter: this.form.songwriter,
  486 + redact: this.form.redact,
  487 + mixing: this.form.mixing,
  488 + },
  489 + withCredentials: true,
  490 + headers: {
  491 + "X-Requested-With": "XMLHttpRequest",
  492 + "Access-Control-Allow-Origin": "*",
  493 + "content-type": "application/json;charset=UTF-8",
  494 + },
  495 + })
  496 + .then((res) => {
  497 + if (res.data) {
  498 + setTimeout(() => {
  499 + // console.log("jump success");
  500 + window.location.replace("./success.html");
  501 + }, 1000);
  502 + } else {
  503 + setTimeout(() => {
  504 + // console.log("jump");
  505 + window.location.replace("./failed.html");
  506 + }, 1000);
  507 + }
  508 + })
  509 + .catch((error) => {
  510 + console.log(error);
  511 + setTimeout(() => {
  512 + // console.log("jump");
  513 + window.location.replace("./failed.html");
  514 + }, 1000);
  515 + })
  516 + .finally(() => {
  517 + setTimeout(() => {
  518 + this.btnDisabled = false;
  519 + this.submitDisabled = false;
  520 + this.banAgree = false
  521 + }, 1000);
  522 + });
  523 + },
  524 + // 获取txt文件内容,暂未启用
  525 + getTxt(e) {
  526 + this.form.txtFile = e.raw;
  527 + let file = e.raw;
  528 + (reader = new FileReader()), (that = this);
  529 + reader.onload = function (evt) {
  530 + var data = evt.target.result;
  531 + console.log(data);
  532 + console.log(String.fromCharCode.apply(null, new Uint16Array(data)));
  533 + };
  534 + reader.readAsArrayBuffer(file);
  535 + },
  536 + // 选择上传文件
  537 + getMp3(file) {
  538 + console.log(file)
  539 + this.form.audioFile = file;
  540 + this.errorMsg = "";
  541 + },
  542 + // textarea换行转br
  543 + addBr(str) {
  544 + var reg = new RegExp("\r\n","g");
  545 + var regr = new RegExp("\r","g");
  546 + var regn = new RegExp("\n","g");
  547 + if(str) {
  548 + str = str.trim()
  549 + str = str.replace(regr,"<br/>")
  550 + str = str.replace(regn,"<br/>")
  551 + str = str.replace(reg,"<br/>")
  552 + } else {
  553 + str = ''
  554 + }
  555 + return str
  556 + }
  557 + },
  558 +}
  559 +var Ctor = Vue.extend(Main)
  560 +new Ctor().$mount('#mainPage')
... ...
src/js/audios.js 0 → 100644
  1 +import 'babel-polyfill'
  2 +import * as all from "./config";
  3 +require("./../css/test.css");
  4 +// Init Vue
  5 +const Audio = {
  6 + created() {
  7 + // parent.postMessage(1000, "*");
  8 + },
  9 + data() {
  10 + return {
  11 + form: {
  12 + channelId: null,
  13 + songName: null,
  14 + singer: null,
  15 + lyricist: null,
  16 + songwriter: null,
  17 + redact: null,
  18 + mixing: null,
  19 + lyric: null,
  20 + phone: null,
  21 + name: null,
  22 + audioId: null,
  23 + audioFile: null,
  24 + },
  25 + labels: all.formLabels,
  26 + rules: {
  27 + songName: [
  28 + {
  29 + required: true,
  30 + trigger: "change",
  31 + message: "请填写歌曲名字",
  32 + },
  33 + ],
  34 + name: [
  35 + { required: true, trigger: "change", message: "请填写联系人姓名" },
  36 + ],
  37 + phone: [
  38 + {
  39 + required: true,
  40 + trigger: "change",
  41 + message: "请填写格式正确的手机号码",
  42 + validator: all.validatePhone,
  43 + },
  44 + ],
  45 + audioFile: [
  46 + { required: true, trigger: "change", message: "请上传音频" },
  47 + ],
  48 + channelId: [
  49 + { required: true, trigger: "change", message: "请选择作品类型" },
  50 + ],
  51 + audioId: [
  52 + {
  53 + required: true,
  54 + trigger: "change",
  55 + message: "请上传音频文件以获取音频ID",
  56 + },
  57 + ],
  58 + singer: [
  59 + { required: false, trigger: "change", message: "请输入歌手名字" },
  60 + ],
  61 + lyricist: [
  62 + { required: false, trigger: "change", message: "请输入作词人名字" },
  63 + ],
  64 + songwriter: [
  65 + { required: false, trigger: "change", message: "请输入作曲人名字" },
  66 + ],
  67 + lyric: [
  68 + {
  69 + required: false,
  70 + trigger: "change",
  71 + message: "请输入符合要求的歌词,至少20个字,最多不能超过2500个字",
  72 + validator: all.validateLyric,
  73 + },
  74 + ],
  75 + },
  76 +
  77 + uploadUrl: "",
  78 + fileList: [],
  79 + token: "",
  80 + btnDisabled: false,
  81 + submitDisabled: false,
  82 + msgText:
  83 + "只能上传一个mp3/flac/wav/ogg/mpg/wma/aac/acc/m4a格式的音频文件,且不超过500mb。上传过程中请勿刷新页面。",
  84 + percent: 0,
  85 + curFile: "",
  86 + errorMsg: "",
  87 + };
  88 + },
  89 + methods: {
  90 + // 作品类型为【词】的时候可以不上传文件
  91 + handleChange(data) {
  92 + if (data == 1279) {
  93 + // 优秀作词榜
  94 + this.rules.audioFile[0].required = false;
  95 + this.rules.audioId[0].required = false;
  96 + this.rules.singer[0].required = false;
  97 + this.rules.songwriter[0].required = false;
  98 + this.rules.lyricist[0].required = true;
  99 + this.rules.lyric[0].required = true;
  100 + } else if (data == 1278) {
  101 + // 成品
  102 + this.rules.singer[0].required = true;
  103 + this.rules.audioFile[0].required = true;
  104 + this.rules.audioId[0].required = true;
  105 + this.rules.lyricist[0].required = false;
  106 + this.rules.songwriter[0].required = false;
  107 + this.rules.lyric[0].required = false;
  108 + } else if (data == 1280) {
  109 + // 作曲
  110 + this.rules.songwriter[0].required = true;
  111 + this.rules.audioFile[0].required = true;
  112 + this.rules.audioId[0].required = true;
  113 + this.rules.singer[0].required = false;
  114 + this.rules.lyricist[0].required = false;
  115 + this.rules.lyric[0].required = false;
  116 + } else if (data == 1281) {
  117 + // 其他
  118 + this.rules.songwriter[0].required = false;
  119 + this.rules.audioFile[0].required = true;
  120 + this.rules.audioId[0].required = true;
  121 + this.rules.singer[0].required = false;
  122 + this.rules.lyricist[0].required = false;
  123 + this.rules.lyric[0].required = false;
  124 + }
  125 + },
  126 + // 文件数量超上限响应
  127 + exceed(e, d) {
  128 + this.$message.error("只能上传一个文件");
  129 + this.errorMsg = "只能上传一个文件";
  130 + },
  131 + // 表单重置按钮响应
  132 + reset() {
  133 + for (let i in this.form) {
  134 + this.form[i] = null;
  135 + }
  136 + this.percent = 0;
  137 + this.btnDisabled = false;
  138 + this.submitDisabled = false;
  139 + },
  140 + // 文件移除响应,暂未启用
  141 + handleRemove(file, list) {
  142 + if (this.percent < 100) {
  143 + this.errorMsg = "上传中的文件不可删除";
  144 + this.$message({
  145 + type: "error",
  146 + duration: 5000,
  147 + message: "上传中的文件不可被删除",
  148 + });
  149 + return false;
  150 + } else {
  151 + this.form.audioId = null;
  152 + this.percent = 0;
  153 + }
  154 + },
  155 + // 校验Md5
  156 + initMd5(fileObj) {
  157 + return new Promise((resolve, reject) => {
  158 + const fileName = fileObj.name.split(".")[0];
  159 + const fileType = fileObj.name.split(".")[1];
  160 + const fileSize = fileObj.size;
  161 + const fileModifyDate = fileObj.lastModifiedDate;
  162 + const md5Str = all
  163 + .initVideoMd5(
  164 + [fileType, fileSize, fileModifyDate || fileName].join("_")
  165 + )
  166 + .toLowerCase();
  167 + if (md5Str) {
  168 + resolve(md5Str);
  169 + } else {
  170 + reject("校验失败");
  171 + }
  172 + });
  173 + },
  174 + // 确认提交按钮响应,上传视频到七牛
  175 + submit(formName) {
  176 + this.$refs[formName].validate((valid) => {
  177 + if (valid) {
  178 + this.submitDisabled = true;
  179 + this.btnDisabled = true;
  180 + if (this.form.channelId == 1279) {
  181 + this.postCms();
  182 + } else {
  183 + const fileName = this.form.audioFile.raw.name.split(".");
  184 + fileName.splice(fileName.length - 1, 1);
  185 + this.curFile = this.form.audioFile.name;
  186 + this.form.audioId = null;
  187 + const that = this;
  188 + const fileBaseObj = {
  189 + videoName: fileName.join("."),
  190 + md5: null,
  191 + };
  192 + const fileSaveObj = {
  193 + videoId: null,
  194 +
  195 + multipleCategory:
  196 + 100005 + "/" + this.getCategoryText(this.form.channelId),
  197 + tag: this.getChannelText(this.form.channelId),
  198 + ts: this.getTs(),
  199 + timestamp: this.getTimeStamp(),
  200 + masterId: all.secretUrls.masterIdMaster,
  201 + // masterId: all.secretUrls.masterIdDev,
  202 + };
  203 + const fileInitObj = {
  204 + gfmt: this.form.audioFile.raw.name.split(".").reverse().shift(),
  205 + fileSize: this.form.audioFile.raw.size,
  206 + ts: this.getTs(),
  207 + timestamp: this.getTimeStamp(),
  208 + multipleCategory:
  209 + 100005 + "/" + this.getCategoryText(this.form.channelId),
  210 + // masterId: all.secretUrls.masterIdDev,
  211 + masterId: all.secretUrls.masterIdMaster,
  212 + };
  213 + const fileWholeObj = {
  214 + file: this.form.audioFile.raw,
  215 + uploadStatus: "ready",
  216 + proCount: 0,
  217 + fileKey: null,
  218 + observable: null,
  219 + subscription: null,
  220 + };
  221 +
  222 + const observer = {
  223 + next(res) {
  224 + if (res.total.percent >= 99) {
  225 + that.percent = 99;
  226 + } else {
  227 + that.percent = Math.ceil(res.total.percent);
  228 + }
  229 + },
  230 + error(err) {
  231 + console.log(err);
  232 + },
  233 + complete(res) {
  234 + let apiDone = all.secretUrls.base + all.secretUrls.finish;
  235 + let apiStringSignDone = all.signFunction(
  236 + apiDone,
  237 + that.getParamsList({
  238 + hash: res.hash,
  239 + key: res.key,
  240 + vid: fileSaveObj.videoId,
  241 + timestamp: that.getTimeStamp(),
  242 + })
  243 + );
  244 + all
  245 + .request({
  246 + url: apiDone,
  247 + method: "get",
  248 + params: all.parseQueryString(apiStringSignDone),
  249 + })
  250 + .then((res) => {
  251 + if (
  252 + res &&
  253 + res.data &&
  254 + res.data.errorCode &&
  255 + res.data.errorCode != 0
  256 + ) {
  257 + that.errorMsg = "系统错误,请联系管理员";
  258 + // that.reset();
  259 + this.submitDisabled = false;
  260 + this.btnDisabled = false;
  261 + return false;
  262 + } else {
  263 + let apiComplete =
  264 + all.secretUrls.base + all.secretUrls.callback;
  265 + let apiStringSignComplete = all.signFunction(
  266 + apiComplete,
  267 + // that.getParamsList({
  268 + // ...fileBaseObj,
  269 + // ...fileSaveObj,
  270 + // ...{ timestamp: that.getTimeStamp() },
  271 + // })
  272 + that.getParamsList(Object.assign(fileBaseObj, fileSaveObj, {timestamp: that.getTimeStamp()}))
  273 + );
  274 + return all.request({
  275 + url: apiComplete,
  276 + method: "get",
  277 + params: all.parseQueryString(apiStringSignComplete),
  278 + });
  279 + }
  280 + })
  281 + .then((data) => {
  282 + if (
  283 + data &&
  284 + data.data &&
  285 + data.data.data &&
  286 + data.data.data.obj
  287 + ) {
  288 + that.form.audioId = data.data.data.obj;
  289 + that.percent = 100;
  290 + that.postCms();
  291 + } else {
  292 + that.errorMsg = "系统错误,请联系管理员";
  293 + // that.reset()
  294 + this.submitDisabled = false;
  295 + this.btnDisabled = false;
  296 + }
  297 + })
  298 + .catch((error) => {
  299 + that.errorMsg = error ? error : "系统错误,请联系管理员";
  300 + // that.reset();
  301 + this.submitDisabled = false;
  302 + this.btnDisabled = false;
  303 + });
  304 + },
  305 + };
  306 +
  307 + Promise.all([
  308 + all.validateVideoSize(fileInitObj.fileSize),
  309 + all.validateVideoFormat(fileInitObj.gfmt),
  310 + all.validateNameLength(fileBaseObj.videoName),
  311 + ])
  312 + .then((check) => {
  313 + return this.getToken();
  314 + })
  315 + .then((d) => {
  316 + if (d && d.data && typeof d.data == "string") {
  317 + this.token = d.data;
  318 + }
  319 + return this.initMd5(this.form.audioFile.raw);
  320 + })
  321 + .then((n) => {
  322 + if (!this.token) {
  323 + // this.$message({
  324 + // type: "error",
  325 + // message: "鉴权失败",
  326 + // duration: 5000,
  327 + // });
  328 + this.errorMsg = "鉴权失败";
  329 + // this.reset();
  330 + this.submitDisabled = false;
  331 + this.btnDisabled = false;
  332 + return false;
  333 + }
  334 + fileBaseObj.md5 = n;
  335 + let apiInit = all.secretUrls.base + all.secretUrls.init;
  336 + let apiStringSignInit = all.signFunction(
  337 + apiInit,
  338 + // this.getParamsList({ ...fileBaseObj, ...fileInitObj })
  339 + this.getParamsList(Object.assign(fileBaseObj, fileInitObj))
  340 + );
  341 + return all.request({
  342 + url: all.secretUrls.base + all.secretUrls.init,
  343 + method: "get",
  344 + params: all.parseQueryString(apiStringSignInit),
  345 + });
  346 + })
  347 + .then((res) => {
  348 + if (
  349 + res &&
  350 + res.data &&
  351 + res.data.data &&
  352 + res.data.data.code == 0
  353 + ) {
  354 + fileSaveObj.videoId = res.data.data.obj.vid;
  355 + fileWholeObj.fileKey = res.data.data.obj.originPath;
  356 + all.putExtra.params["x:name"] = fileWholeObj.fileKey;
  357 + fileWholeObj.observable = qiniu.upload(
  358 + this.form.audioFile.raw,
  359 + fileWholeObj.fileKey,
  360 + this.token,
  361 + all.putExtra,
  362 + all.cdnConfig
  363 + );
  364 + fileWholeObj.subscription =
  365 + fileWholeObj.observable.subscribe(observer);
  366 + } else {
  367 + if (
  368 + res &&
  369 + res.data &&
  370 + res.data.errorCode &&
  371 + res.data.errorCode != 0
  372 + ) {
  373 + this.errorMsg = "系统错误,请联系管理员";
  374 + // this.reset();
  375 + this.submitDisabled = false;
  376 + this.btnDisabled = false;
  377 + }
  378 + }
  379 + })
  380 + .catch((error) => {
  381 + this.errorMsg = error ? error : "系统错误,请联系管理员";
  382 + // this.reset()
  383 + this.submitDisabled = false;
  384 + this.btnDisabled = false;
  385 + });
  386 + }
  387 + } else {
  388 + // this.$message.error("请检查表单内容");
  389 + this.errorMsg = '请检查表单内容'
  390 + this.submitDisabled = false;
  391 + this.btnDisabled = false;
  392 + return false;
  393 + }
  394 + });
  395 + },
  396 + // 对象参数转数组格式
  397 + getParamsList(params) {
  398 + let list = [];
  399 + for (let i in params) {
  400 + if (i == "hash" || i == "key" || i == "x:name") {
  401 + list.push(`${i}=${encodeURI(params[i])}`);
  402 + } else {
  403 + list.push(`${i}=${params[i]}`);
  404 + }
  405 + }
  406 + return list;
  407 + },
  408 + // 获取时间戳
  409 + getTimeStamp() {
  410 + return Math.round(new Date().getTime() / 1000);
  411 + },
  412 + // 获取时间戳加四位随机数
  413 + getTs() {
  414 + return (
  415 + this.getTimeStamp().toString() +
  416 + Math.floor(Math.random() * 10000).toString()
  417 + );
  418 + },
  419 + // 通过作品类型id获取作品分类,用于上传视频的??参数
  420 + getCategoryText(id) {
  421 + if (id == 1278) {
  422 + return "533";
  423 + }
  424 + if (id == 1280) {
  425 + return "534";
  426 + }
  427 + if (id == 1281) {
  428 + return "532";
  429 + }
  430 + },
  431 + // 通过作品类型id获取作品类型,用于上传视频的tag
  432 + getChannelText(id) {
  433 + if (id == 1278) {
  434 + return "热歌榜";
  435 + }
  436 + if (id == 1279) {
  437 + return "优秀作词榜";
  438 + }
  439 + if (id == 1280) {
  440 + return "优秀作曲榜";
  441 + }
  442 + if (id == 1281) {
  443 + return "其他";
  444 + }
  445 + },
  446 + // 获取认证token
  447 + getToken() {
  448 + let api = all.secretUrls.base + all.secretUrls.auth;
  449 + let apiStringSign = all.signFunction(api, [
  450 + "ts=" + this.getTs(),
  451 + "timestamp=" + this.getTimeStamp(),
  452 + ]);
  453 + return all.request({
  454 + url: all.secretUrls.base + all.secretUrls.auth,
  455 + method: "get",
  456 + params: all.parseQueryString(apiStringSign),
  457 + });
  458 + },
  459 + // cms接口提交videoId和表单内容
  460 + postCms() {
  461 + this.form.lyric = this.addBr(this.form.lyric)
  462 + all
  463 + .request({
  464 + // url: "http://cmstest.cnlive.com:8768/contentApi/audioSave",
  465 + url: "https://cms.cnlive.com/api/contentApi/audioSave",
  466 + method: "post",
  467 + params: this.form,
  468 + withCredentials: true,
  469 + headers: {
  470 + "X-Requested-With": "XMLHttpRequest",
  471 + "Access-Control-Allow-Origin": "*",
  472 + "content-type": "application/json;charset=UTF-8",
  473 + },
  474 + })
  475 + .then((res) => {
  476 + if (res.data) {
  477 + setTimeout(() => {
  478 + // console.log("jump success");
  479 + window.location.replace("./success.html");
  480 + }, 1000);
  481 + } else {
  482 + setTimeout(() => {
  483 + // console.log("jump");
  484 + window.location.replace("./failed.html");
  485 + }, 1000);
  486 + }
  487 + })
  488 + .catch((error) => {
  489 + console.log(error);
  490 + setTimeout(() => {
  491 + // console.log("jump");
  492 + window.location.replace("./failed.html");
  493 + }, 1000);
  494 + })
  495 + .finally(() => {
  496 + this.btnDisabled = false;
  497 + this.submitDisabled = false;
  498 + });
  499 + },
  500 + // 获取txt文件内容,暂未启用
  501 + getTxt(e) {
  502 + this.form.txtFile = e.raw;
  503 + let file = e.raw;
  504 + (reader = new FileReader()), (that = this);
  505 + reader.onload = function (evt) {
  506 + var data = evt.target.result;
  507 + console.log(data);
  508 + console.log(String.fromCharCode.apply(null, new Uint16Array(data)));
  509 + };
  510 + reader.readAsArrayBuffer(file);
  511 + },
  512 + // 选择上传文件
  513 + getMp3(file) {
  514 + this.form.audioFile = file;
  515 + this.errorMsg = "";
  516 + },
  517 + // textarea换行转br
  518 + addBr(str) {
  519 + var reg = new RegExp("\r\n","g");
  520 + var regr = new RegExp("\r","g");
  521 + var regn = new RegExp("\n","g");
  522 + if(str) {
  523 + str = str.trim()
  524 + str = str.replace(regr,"<br/>")
  525 + str = str.replace(regn,"<br/>")
  526 + str = str.replace(reg,"<br/>")
  527 + } else {
  528 + str = ''
  529 + }
  530 + return str
  531 + }
  532 + },
  533 +};
  534 +
  535 +Vue.createApp(Audio).use(ElementPlus).mount("#audioPage");
... ...
src/js/config.js 0 → 100644
  1 +const basicConfig = {
  2 + baseUrl: "http://cmstest.cnlive.com/cms",
  3 +};
  4 +
  5 +const urls = {
  6 + base: "http://test.mam.innerapi.cnlive.com/v1/inner/",
  7 + onlineUrl: "https://api.cnlive.com/open/api2/vod_epg/material/",
  8 + token: "material/getQNToken",
  9 + save: "material/saveQNComplete",
  10 + initFileOnline: "uploadFileInit?appId=1423_kbrrnni803",
  11 + transcode: "pendingTranscodeTask?appId=1423_kbrrnni803",
  12 +};
  13 +
  14 +const secretUrls = {
  15 + base: "https://api.cnlive.com/open/api2/vod_epg/videoPgc",
  16 + // base: "http://test.open.cnlive.com/openapi/api2/vod_epg/videoPgc",
  17 + auth: "/getUploadAuth",
  18 + init: "/uploadFileInit",
  19 + callback: "/uploadCallback",
  20 + finish: "/uploadSuccess",
  21 + masterIdDev: 10505921,
  22 + masterIdMaster: 10494974,
  23 + appIdDev: "802_ji9ojo9w63",
  24 + appIdMaster: "1423_kbrrnni803",
  25 + appKeyDev: '06138c3527f48e7020261b9225660792d0a45d76b1cd4d',
  26 + appKeyMaster: '459d0881107ea2ddff78fb1ab31b1f134cc331982807a7'
  27 +};
  28 +
  29 +const cdnConfig = {
  30 + useCdnDomain: true,
  31 + disableStatisticsReport: true,
  32 + retryCount: 6,
  33 + region: qiniu.region.z1,
  34 +};
  35 +
  36 +const putExtra = {
  37 + fname: "",
  38 + params: {},
  39 + mimeType: null,
  40 +};
  41 +
  42 +const formLabels = {
  43 + channelId: '类&nbsp;型',
  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 +
  57 +// Rewrite Request Method
  58 +const request = axios.create({
  59 + timeout: 10000,
  60 +});
  61 +
  62 +
  63 +// Init signature
  64 +const signFunction = function (api, list) {
  65 + let sha1 = require('sha1')
  66 + //数组合并
  67 + let arrApi = ["appId=" + secretUrls.appIdMaster];
  68 + // let arrApi = ["appId=" + secretUrls.appIdDev];
  69 + arrApi = arrApi.concat(list); //对数组进行升序处理,并拼成一个字符串
  70 +
  71 + let stringSign = arrApi.sort().join("&"); //key要放在字符串最后,对字符串进行sha1加密处理,并转换为大写
  72 +
  73 + let signValue = sha1(stringSign + "&key=" + secretUrls.appKeyMaster).toUpperCase(); //生成最终的请求参数
  74 + // let signValue = sha1(stringSign + "&key=" + secretUrls.appKeyDev).toUpperCase(); //生成最终的请求参数
  75 +
  76 + let apiStringSign = api + "?" + stringSign + "&sign=" + signValue;
  77 +
  78 + return apiStringSign;
  79 +};
  80 +
  81 +const parseQueryString = function (url) {
  82 + var reg_url = /^[^\?]+\?([\w\W]+)$/,
  83 + reg_para = /([^&=]+)=([\w\W]*?)(&|$|#)/g,
  84 + arr_url = reg_url.exec(url),
  85 + ret = {};
  86 + if (arr_url && arr_url[1]) {
  87 + var str_para = arr_url[1],
  88 + result;
  89 + while ((result = reg_para.exec(str_para)) != null) {
  90 + ret[result[1]] = result[2];
  91 + }
  92 + }
  93 + return ret;
  94 +};
  95 +
  96 +// File And Form Validate
  97 +const validateVideoSize = function (curSize) {
  98 + const sizeLimitation = 1024 * 1024 * 500; // 500M
  99 + return new Promise((resolve, reject) => {
  100 + if (parseInt(curSize) <= sizeLimitation) {
  101 + resolve("没超尺寸");
  102 + } else {
  103 + reject("文件过大");
  104 + }
  105 + });
  106 +};
  107 +
  108 +const validateNameLength = function (name) {
  109 + return new Promise((resolve, reject) => {
  110 + if (name.length < 1 || name.length > 100) {
  111 + reject("文件名称最小长度为1,上限长度为100!");
  112 + } else {
  113 + resolve("名字可以");
  114 + }
  115 + });
  116 +};
  117 +
  118 +const validateVideoFormat = function (curFormat) {
  119 + // const formats = [
  120 + // "mp3",
  121 + // "wma",
  122 + // "m4a",
  123 + // "flac",
  124 + // "aac",
  125 + // "ape",
  126 + // "wav",
  127 + // "wv",
  128 + // "dts",
  129 + // "ac3",
  130 + // "mmf",
  131 + // "amr",
  132 + // "m4r",
  133 + // "ogg",
  134 + // "mp2"
  135 + // ];
  136 + const formats = ["mp3", "flac", "wav", "ogg", "mpg", "wma", "aac", "m4a"];
  137 + return new Promise((resolve, reject) => {
  138 + if (formats.includes(curFormat)) {
  139 + resolve("格式可以");
  140 + } else {
  141 + reject("文件格式不允许");
  142 + }
  143 + });
  144 +};
  145 +
  146 +const validatePhone = (rules, value, callback) => {
  147 + const reg = /^1(3|4|5|6|7|8|9)\d{9}$/;
  148 + if (reg.test(value)) {
  149 + callback();
  150 + } else {
  151 + callback(new Error("请填写格式正确的手机号码"));
  152 + }
  153 +};
  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 +
  175 +const validateName = (rules, value, callback) => {
  176 + if (value.length < 1) {
  177 + callback(new Error("请填写歌曲名称"));
  178 + } else if (value.length > 100) {
  179 + callback(new Error("歌曲名称长度应在1~100之间(含)"));
  180 + } else {
  181 + callback();
  182 + }
  183 +};
  184 +
  185 +const initVideoMd5 = function (e) {
  186 + function i(e) {
  187 + var i = (e >>> 0).toString(16);
  188 + return "00000000".substr(0, 8 - i.length) + i;
  189 + }
  190 +
  191 + function t(e) {
  192 + for (var i = [], t = 0; t < e.length; t++) i = i.concat(c(e[t]));
  193 + return i;
  194 + }
  195 +
  196 + function r(e) {
  197 + for (var i = [], t = 0; t < 8; t++) i.push(255 & e), (e >>>= 8);
  198 + return i;
  199 + }
  200 +
  201 + function l(e, i) {
  202 + return ((e << i) & 4294967295) | (e >>> (32 - i));
  203 + }
  204 +
  205 + function n(e, i, t) {
  206 + return (e & i) | (~e & t);
  207 + }
  208 +
  209 + function o(e, i, t) {
  210 + return (t & e) | (~t & i);
  211 + }
  212 +
  213 + function a(e, i, t) {
  214 + return e ^ i ^ t;
  215 + }
  216 +
  217 + function p(e, i, t) {
  218 + return i ^ (e | ~t);
  219 + }
  220 +
  221 + function f(e, i) {
  222 + return (e[i + 3] << 24) | (e[i + 2] << 16) | (e[i + 1] << 8) | e[i];
  223 + }
  224 +
  225 + function c(e) {
  226 + for (var i = [], t = 0; t < e.length; t++)
  227 + if (e.charCodeAt(t) <= 127) i.push(e.charCodeAt(t));
  228 + else
  229 + for (
  230 + var r = encodeURIComponent(e.charAt(t)).substr(1).split("%"), l = 0;
  231 + l < r.length;
  232 + l++
  233 + )
  234 + i.push(parseInt(r[l], 16));
  235 + return i;
  236 + }
  237 +
  238 + function s() {
  239 + for (var e = "", t = 0, r = 0, l = 3; l >= 0; l--)
  240 + (r = arguments[l]),
  241 + (t = 255 & r),
  242 + (r >>>= 8),
  243 + (t <<= 8),
  244 + (t |= 255 & r),
  245 + (r >>>= 8),
  246 + (t <<= 8),
  247 + (t |= 255 & r),
  248 + (r >>>= 8),
  249 + (t <<= 8),
  250 + (t |= r),
  251 + (e += i(t));
  252 + return e;
  253 + }
  254 +
  255 + function u(e) {
  256 + for (var i = new Array(e.length), t = 0; t < e.length; t++) i[t] = e[t];
  257 + return i;
  258 + }
  259 +
  260 + function F(e, i) {
  261 + return 4294967295 & (e + i);
  262 + }
  263 +
  264 + function d() {
  265 + function e(e, i, t, r) {
  266 + var n = b;
  267 + (b = h), (h = y), (y = F(y, l(F(g, F(e, F(i, t))), r))), (g = n);
  268 + }
  269 +
  270 + var i = m.length;
  271 + m.push(128);
  272 + var t = m.length % 64;
  273 + if (t > 56) {
  274 + for (var c = 0; 64 - t > c; c++) m.push(0);
  275 + t = m.length % 64;
  276 + }
  277 + for (c = 0; 56 - t > c; c++) m.push(0);
  278 + m = m.concat(r(8 * i));
  279 + var u = 1732584193;
  280 + var d = 4023233417;
  281 + var v = 2562383102;
  282 + var O = 271733878;
  283 + var g = 0;
  284 + var y = 0;
  285 + var h = 0;
  286 + var b = 0;
  287 + for (c = 0; c < m.length / 64; c++) {
  288 + (g = u), (y = d), (h = v), (b = O);
  289 + var A = 64 * c;
  290 + e(n(y, h, b), 3614090360, f(m, A), 7),
  291 + e(n(y, h, b), 3905402710, f(m, A + 4), 12),
  292 + e(n(y, h, b), 606105819, f(m, A + 8), 17),
  293 + e(n(y, h, b), 3250441966, f(m, A + 12), 22),
  294 + e(n(y, h, b), 4118548399, f(m, A + 16), 7),
  295 + e(n(y, h, b), 1200080426, f(m, A + 20), 12),
  296 + e(n(y, h, b), 2821735955, f(m, A + 24), 17),
  297 + e(n(y, h, b), 4249261313, f(m, A + 28), 22),
  298 + e(n(y, h, b), 1770035416, f(m, A + 32), 7),
  299 + e(n(y, h, b), 2336552879, f(m, A + 36), 12),
  300 + e(n(y, h, b), 4294925233, f(m, A + 40), 17),
  301 + e(n(y, h, b), 2304563134, f(m, A + 44), 22),
  302 + e(n(y, h, b), 1804603682, f(m, A + 48), 7),
  303 + e(n(y, h, b), 4254626195, f(m, A + 52), 12),
  304 + e(n(y, h, b), 2792965006, f(m, A + 56), 17),
  305 + e(n(y, h, b), 1236535329, f(m, A + 60), 22),
  306 + e(o(y, h, b), 4129170786, f(m, A + 4), 5),
  307 + e(o(y, h, b), 3225465664, f(m, A + 24), 9),
  308 + e(o(y, h, b), 643717713, f(m, A + 44), 14),
  309 + e(o(y, h, b), 3921069994, f(m, A), 20),
  310 + e(o(y, h, b), 3593408605, f(m, A + 20), 5),
  311 + e(o(y, h, b), 38016083, f(m, A + 40), 9),
  312 + e(o(y, h, b), 3634488961, f(m, A + 60), 14),
  313 + e(o(y, h, b), 3889429448, f(m, A + 16), 20),
  314 + e(o(y, h, b), 568446438, f(m, A + 36), 5),
  315 + e(o(y, h, b), 3275163606, f(m, A + 56), 9),
  316 + e(o(y, h, b), 4107603335, f(m, A + 12), 14),
  317 + e(o(y, h, b), 1163531501, f(m, A + 32), 20),
  318 + e(o(y, h, b), 2850285829, f(m, A + 52), 5),
  319 + e(o(y, h, b), 4243563512, f(m, A + 8), 9),
  320 + e(o(y, h, b), 1735328473, f(m, A + 28), 14),
  321 + e(o(y, h, b), 2368359562, f(m, A + 48), 20),
  322 + e(a(y, h, b), 4294588738, f(m, A + 20), 4),
  323 + e(a(y, h, b), 2272392833, f(m, A + 32), 11),
  324 + e(a(y, h, b), 1839030562, f(m, A + 44), 16),
  325 + e(a(y, h, b), 4259657740, f(m, A + 56), 23),
  326 + e(a(y, h, b), 2763975236, f(m, A + 4), 4),
  327 + e(a(y, h, b), 1272893353, f(m, A + 16), 11),
  328 + e(a(y, h, b), 4139469664, f(m, A + 28), 16),
  329 + e(a(y, h, b), 3200236656, f(m, A + 40), 23),
  330 + e(a(y, h, b), 681279174, f(m, A + 52), 4),
  331 + e(a(y, h, b), 3936430074, f(m, A), 11),
  332 + e(a(y, h, b), 3572445317, f(m, A + 12), 16),
  333 + e(a(y, h, b), 76029189, f(m, A + 24), 23),
  334 + e(a(y, h, b), 3654602809, f(m, A + 36), 4),
  335 + e(a(y, h, b), 3873151461, f(m, A + 48), 11),
  336 + e(a(y, h, b), 530742520, f(m, A + 60), 16),
  337 + e(a(y, h, b), 3299628645, f(m, A + 8), 23),
  338 + e(p(y, h, b), 4096336452, f(m, A), 6),
  339 + e(p(y, h, b), 1126891415, f(m, A + 28), 10),
  340 + e(p(y, h, b), 2878612391, f(m, A + 56), 15),
  341 + e(p(y, h, b), 4237533241, f(m, A + 20), 21),
  342 + e(p(y, h, b), 1700485571, f(m, A + 48), 6),
  343 + e(p(y, h, b), 2399980690, f(m, A + 12), 10),
  344 + e(p(y, h, b), 4293915773, f(m, A + 40), 15),
  345 + e(p(y, h, b), 2240044497, f(m, A + 4), 21),
  346 + e(p(y, h, b), 1873313359, f(m, A + 32), 6),
  347 + e(p(y, h, b), 4264355552, f(m, A + 60), 10),
  348 + e(p(y, h, b), 2734768916, f(m, A + 24), 15),
  349 + e(p(y, h, b), 1309151649, f(m, A + 52), 21),
  350 + e(p(y, h, b), 4149444226, f(m, A + 16), 6),
  351 + e(p(y, h, b), 3174756917, f(m, A + 44), 10),
  352 + e(p(y, h, b), 718787259, f(m, A + 8), 15),
  353 + e(p(y, h, b), 3951481745, f(m, A + 36), 21),
  354 + (u = F(u, g)),
  355 + (d = F(d, y)),
  356 + (v = F(v, h)),
  357 + (O = F(O, b));
  358 + }
  359 + return s(O, v, d, u).toUpperCase();
  360 + }
  361 +
  362 + var m = null;
  363 + var v = null;
  364 + return (
  365 + typeof e == "string"
  366 + ? (m = c(e))
  367 + : e.constructor == Array
  368 + ? e.length === 0
  369 + ? (m = e)
  370 + : typeof e[0] == "string"
  371 + ? (m = t(e))
  372 + : typeof e[0] == "number"
  373 + ? (m = e)
  374 + : (v = typeof e[0])
  375 + : typeof ArrayBuffer != "undefined"
  376 + ? e instanceof ArrayBuffer
  377 + ? (m = u(new Uint8Array(e)))
  378 + : e instanceof Uint8Array || e instanceof Int8Array
  379 + ? (m = u(e))
  380 + : e instanceof Uint32Array ||
  381 + e instanceof Int32Array ||
  382 + e instanceof Uint16Array ||
  383 + e instanceof Int16Array ||
  384 + e instanceof Float32Array ||
  385 + e instanceof Float64Array
  386 + ? (m = u(new Uint8Array(e.buffer)))
  387 + : (v = typeof e)
  388 + : (v = typeof e),
  389 + v && alert("MD5 type mismatch, cannot process " + v),
  390 + d()
  391 + );
  392 +};
  393 +
  394 +export {
  395 + initVideoMd5,
  396 + validateName,
  397 + validatePhone,
  398 + validateVideoFormat,
  399 + validateNameLength,
  400 + validateVideoSize,
  401 + validateLyric,
  402 + signFunction,
  403 + parseQueryString,
  404 + request,
  405 + putExtra,
  406 + cdnConfig,
  407 + basicConfig,
  408 + urls,
  409 + secretUrls,
  410 + formLabels
  411 +};
... ...
src/js/index.js 0 → 100644
  1 +import * as all from './config.js'
  2 +console.log('this is index js')
  3 +console.log(all)
  4 +// import test from './settins.js'
... ...
styles/audio.css 0 → 100644
  1 +.card-header {
  2 + display: flex;
  3 + justify-content: space-between;
  4 + align-items: center;
  5 +}
  6 +
  7 +.text {
  8 + font-size: 14px;
  9 +}
  10 +
  11 +.item {
  12 + margin-bottom: 18px;
  13 +}
  14 +
  15 +.red {
  16 + color: red;
  17 + margin-left: 10px;
  18 +}
  19 +
  20 +.box-card {
  21 + width: 480px;
  22 +}
  23 +
  24 +.page-container {
  25 + padding: 20px;
  26 +}
  27 +
  28 +.text-container {
  29 + text-align: center;
  30 +}
... ...
version.html 0 → 100644
  1 +<!DOCTYPE html>
  2 +<html>
  3 + <head>
  4 + <meta charset="utf-8">
  5 + <meta name="viewport" content="width=device-width,initial-scale=1.0">
  6 + <title>CNLive Control Panel</title>
  7 + <style>
  8 + .container {
  9 + padding-top:200px;
  10 + text-align: center;
  11 + }
  12 + .title {
  13 + font-size: 32px;
  14 + }
  15 + .google-download-button {
  16 + margin-top: 20px;
  17 + }
  18 + .google-download-button button {
  19 + width: 138px;
  20 + height: 38px;
  21 + border: none;
  22 + line-height: 38px;
  23 + color: white;
  24 + border-radius: 6px;
  25 + background-color: #188ae2;
  26 + }
  27 + .qihu-tip {
  28 + margin-top: 20px;
  29 + }
  30 + .qihu-picture {
  31 + margin-top: 20px;
  32 + }
  33 + .qihu-picture img {
  34 + width: auto;
  35 + height: 300px;
  36 + }
  37 + </style>
  38 + </head>
  39 + <body>
  40 + <div class="container">
  41 + <div class="google-tip title">
  42 + 推荐使用谷歌浏览器
  43 + </div>
  44 + <div class="google-download-button">
  45 + <button id="google-download">前往下载</button>
  46 + </div>
  47 + <div class="qihu-tip title">
  48 + 或者使用360浏览器极速模式
  49 + </div>
  50 + <div class="qihu-picture">
  51 + <img src="https://wjj.ys2.cnliveimg.com/1545983165685.png" alt="">
  52 + </div>
  53 + </div>
  54 + <script>
  55 + var btn = document.getElementById('google-download')
  56 + btn.onclick = function () {
  57 + window.open('https://www.google.cn/chrome')
  58 + }
  59 + </script>
  60 + </body>
  61 +</html>
... ...
vue.config.js 0 → 100644
  1 +module.exports = {
  2 +
  3 + // 在exports中添加,这里很关键,不配置不行
  4 + transpileDependencies: ['element-plus'],
  5 +
  6 +
  7 + chainWebpack(config) {
  8 + // 在chainWebpack中添加下面的代码
  9 + config.entry('audios').add('babel-polyfill') // audios是入口js文件
  10 + }
  11 +
  12 +}
... ...
webpack.config.js 0 → 100644
  1 +//引入path 是用的nodejs的一个path模块,path模块就是寻找当前目录的一个模块
  2 +const path = require("path");
  3 +const HtmlWebpackPlugin = require("html-webpack-plugin");
  4 +const { CleanWebpackPlugin } = require("clean-webpack-plugin");
  5 +const JavaScriptObfuscator = require("webpack-obfuscator");
  6 +
  7 +module.exports = {
  8 + //模式:开发环境
  9 + mode: "development", //production 不写的话默认为生产模式
  10 + //入口文件 程序从这里开始执行,webpack开始打包
  11 + // vue3版本用audios.js,vue2版本用audio.js
  12 + entry: path.join(__dirname, "src", "/js/audio.js"), //__dirname指的是当前目录,是目录形成绝对路径
  13 + output: {
  14 + //输入的文件名
  15 + filename: "version21.js",
  16 + // filename: '[name].[hash:7].js',
  17 + publicPath: "/",
  18 + //输入的路径 webpack会自动打包生成
  19 + path: path.join(__dirname, "dist"),
  20 + },
  21 + resolve: {
  22 + extensions: [".js", ".css"],
  23 + },
  24 + plugins: [
  25 + new HtmlWebpackPlugin({
  26 + //文件中找到的路径
  27 + // vue3版本用index.html,vue2版本用v2.html
  28 + template: path.join(__dirname, "src", "html/v2.html"),
  29 + //打包输出的路径
  30 + filename: "version21.html",
  31 + }),
  32 + new CleanWebpackPlugin(),
  33 + new JavaScriptObfuscator(
  34 + {
  35 + compact: true, //压缩代码
  36 + controlFlowFlattening: true, //是否启用控制流扁平化(降低1.5倍的运行速度)
  37 + controlFlowFlatteningThreshold: 1, //应用概率;在较大的代码库中,建议降低此值,因为大量的控制流转换可能会增加代码的大小并降低代码的速度。
  38 + // deadCodeInjection: true, //随机的死代码块(增加了混淆代码的大小)
  39 + // debugProtection: true, //此选项几乎不可能使用开发者工具的控制台选项卡
  40 + // debugProtectionInterval: true, //如果选中,则会在“控制台”选项卡上使用间隔强制调试模式,从而更难使用“开发人员工具”的其他功能。
  41 + // disableConsoleOutput: true, //通过用空函数替换它们来禁用console.log,console.info,console.error和console.warn。这使得调试器的使用更加困难。
  42 + // renameGlobals: true, //是否启用全局变量和函数名称的混淆
  43 + // rotateStringArray: true, //通过固定和随机(在代码混淆时生成)的位置移动数组。这使得将删除的字符串的顺序与其原始位置相匹配变得更加困难。如果原始源代码不小,建议使用此选项,因为辅助函数可以引起注意。
  44 + // selfDefending: true, //混淆后的代码,不能使用代码美化,同时需要配置 cpmpat:true;
  45 + // cpmpat:true,
  46 + // stringArray: true, //删除字符串文字并将它们放在一个特殊的数组中
  47 + // transformObjectKeys: true,
  48 + // unicodeEscapeSequence: false,
  49 + },
  50 + []
  51 + ),
  52 + ],
  53 + devServer: {
  54 + //端口
  55 + port: 3000,
  56 + compress: true,
  57 + overlay: true,
  58 + contentBase: "/html/index.html",
  59 + },
  60 + module: {
  61 + rules: [
  62 + //引入css插件 npm install --save-dev css-loader
  63 + {
  64 + test: /\.css$/,
  65 + // use: ['style-loader', 'css-loader'],
  66 + use: [
  67 + {
  68 + loader: "style-loader",
  69 + },
  70 + {
  71 + loader: "css-loader",
  72 + },
  73 + ],
  74 + },
  75 + {
  76 + test: /\.js$/,
  77 + exclude: /node_modules/,
  78 + loader: 'babel-loader'
  79 + }
  80 + ],
  81 + },
  82 +};
... ...