mirror of
https://github.com/any86/any-rule.git
synced 2025-07-14 15:38:58 +08:00
wip
This commit is contained in:
parent
9142b75c64
commit
ecd2bfe089
@ -311,6 +311,7 @@
|
|||||||
"@types/vscode": "^1.12.0",
|
"@types/vscode": "^1.12.0",
|
||||||
"glob": "^7.1.4",
|
"glob": "^7.1.4",
|
||||||
"mocha": "^6.1.4",
|
"mocha": "^6.1.4",
|
||||||
|
"qiniu-js": "^2.5.5",
|
||||||
"ts-loader": "^6.2.1",
|
"ts-loader": "^6.2.1",
|
||||||
"tslint": "^5.12.1",
|
"tslint": "^5.12.1",
|
||||||
"typescript": "^3.3.1",
|
"typescript": "^3.3.1",
|
||||||
@ -323,4 +324,4 @@
|
|||||||
"axios": "^0.19.2",
|
"axios": "^0.19.2",
|
||||||
"transliteration": "^2.1.8"
|
"transliteration": "^2.1.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"clipboard": "^2.0.4",
|
"clipboard": "^2.0.4",
|
||||||
"core-js": "^2.6.5",
|
"core-js": "^2.6.5",
|
||||||
|
"crypto-js": "^4.0.0",
|
||||||
"lodash": "^4.17.13",
|
"lodash": "^4.17.13",
|
||||||
"node-sass": "^4.12.0",
|
"node-sass": "^4.12.0",
|
||||||
"sass-loader": "^7.1.0",
|
"sass-loader": "^7.1.0",
|
||||||
|
@ -57,6 +57,8 @@
|
|||||||
</header>
|
</header>
|
||||||
|
|
||||||
<article>
|
<article>
|
||||||
|
<h1>123</h1>
|
||||||
|
<label><input type="file" @change="onFileChange"/></label>
|
||||||
<ul v-if="0 < rules.length" class="list">
|
<ul v-if="0 < rules.length" class="list">
|
||||||
<li
|
<li
|
||||||
@mouseenter="mouseenterHandler(index)"
|
@mouseenter="mouseenterHandler(index)"
|
||||||
@ -119,6 +121,9 @@
|
|||||||
<script>
|
<script>
|
||||||
import RULES from '@/RULES';
|
import RULES from '@/RULES';
|
||||||
import ClipboardJS from 'clipboard';
|
import ClipboardJS from 'clipboard';
|
||||||
|
import axios from 'axios'
|
||||||
|
const CryptoJS = require('crypto-js')
|
||||||
|
|
||||||
// import throttle from 'lodash/throttle';
|
// import throttle from 'lodash/throttle';
|
||||||
export default {
|
export default {
|
||||||
name: 'app',
|
name: 'app',
|
||||||
@ -129,6 +134,7 @@ export default {
|
|||||||
Object.freeze(RULES);
|
Object.freeze(RULES);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
token:'',
|
||||||
timer: null,
|
timer: null,
|
||||||
keyword: '',
|
keyword: '',
|
||||||
rules: RULES,
|
rules: RULES,
|
||||||
@ -144,6 +150,10 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
|
this.token = this.getToken();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// this.$nextTick(() => {
|
// this.$nextTick(() => {
|
||||||
// // 高亮
|
// // 高亮
|
||||||
// this.$refs.code.forEach((block) => {
|
// this.$refs.code.forEach((block) => {
|
||||||
@ -173,6 +183,35 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
|
getToken(){
|
||||||
|
const AccessKey = 'rM1vf31ZmX54Y5CjW1T_PLU6dnyGSAVIi230FbZx';
|
||||||
|
const SecretKey = 'FJ93nk_P7fTp6rTNA4sCqNvzRf257cYoDk1VWIz6';
|
||||||
|
let timestamp = new Date().getTime() // 当前的时间戳
|
||||||
|
timestamp = parseInt(timestamp / 1000) + 36000
|
||||||
|
let putPolicy = {'scope': 'image9999', 'deadline': timestamp}
|
||||||
|
let encodedPutPolicy = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(JSON.stringify(putPolicy)))
|
||||||
|
let encodedSign = CryptoJS.enc.Base64.stringify(CryptoJS.HmacSHA1(encodedPutPolicy, SecretKey)) // 第一个参数为加密字符串,第二个参数为公共秘钥
|
||||||
|
return AccessKey + ':' + encodedSign + ':' + encodedPutPolicy
|
||||||
|
},
|
||||||
|
|
||||||
|
async onFileChange(ev){
|
||||||
|
// const {code, data} = await axios.get('http://service.soas.top/qiniu/token?nsukey=dSnyoF2fHP%2FVex4MAKEOVDUq4th5W69CrZCh6CrDNWtWRKOoKrBYXwQDgUcMg%2FS31kufpGgmkkyF0Lek5C9FCAxuTYqnMzvqFwti7JWcgc6HFjM9Cg%2FxF6o%2FCZaBrS7PLDGSP5in%2F%2FOIeTI5StrGtcRpWxV9XBTAz7iltnZ6im4mIP%2BrkwkAwXuGW8etxo1z2QDsnzrDHUnbWpZzzEeMPQ%3D%3D');
|
||||||
|
// console.log(data)
|
||||||
|
// if(1 == code){
|
||||||
|
const token = this.token;
|
||||||
|
const file = ev.target.files[0];
|
||||||
|
const formData = new FormData()
|
||||||
|
formData.append('file', file);
|
||||||
|
formData.append('token', token);
|
||||||
|
const {code, data} = await axios.post('http://upload.qiniup.com', formData,{
|
||||||
|
headers:{'Content-Type':'multipart/form-data'}
|
||||||
|
});
|
||||||
|
console.log(code, data);
|
||||||
|
// }
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
parseExample(examples, counterExamples){
|
parseExample(examples, counterExamples){
|
||||||
let arr = [`例如: ${examples.join(', ')}`];
|
let arr = [`例如: ${examples.join(', ')}`];
|
||||||
if(undefined !== counterExamples) {
|
if(undefined !== counterExamples) {
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -2719,6 +2719,11 @@ punycode@^2.1.0:
|
|||||||
resolved "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
|
resolved "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
|
||||||
integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==
|
integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==
|
||||||
|
|
||||||
|
qiniu-js@^2.5.5:
|
||||||
|
version "2.5.5"
|
||||||
|
resolved "https://registry.npmjs.org/qiniu-js/-/qiniu-js-2.5.5.tgz#77d295f222620f9377d6148f3f757d189a1e4977"
|
||||||
|
integrity sha512-cJcdZMCfU4OJirjCzKJwPXSgrXF0INB2qtqA6ImNBe2PJFqi8kWE7rp3qr1RKH0H4OTtPOXyBC2FVSl/zM7ERg==
|
||||||
|
|
||||||
querystring-es3@^0.2.0:
|
querystring-es3@^0.2.0:
|
||||||
version "0.2.1"
|
version "0.2.1"
|
||||||
resolved "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73"
|
resolved "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user