first commit

This commit is contained in:
编码猿
2024-09-27 02:06:13 +08:00
commit 852d94fbb9
36760 changed files with 3274413 additions and 0 deletions

View File

@@ -0,0 +1 @@
0b0eb353-ca66-4c0e-b7aa-82522c699341

View File

@@ -0,0 +1,17 @@
<template>
<div id="app">
<router-view/>
</div>
</template>
<script>
export default {
name: 'App'
}
</script>
<style>
.el-popover--plain {
word-break: break-all;
}
</style>

View File

@@ -0,0 +1 @@
e58c65b9-7d94-4aaa-96d2-cd2a216140b6

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -0,0 +1 @@
259317bf-d637-4bf2-9d83-e465fa50ed5c

View File

@@ -0,0 +1,132 @@
<template>
<div class="index" v-loading.fullscreen.lock="getLoading">
<div class="header-center">
电商App接口调试工具
</div>
<el-form ref="form" label-width="80px">
<el-form-item label="接口地址">
<el-input v-model="url" placeholder="接口地址,例如:/utils/updateVersion.ys" clearable>
<template slot="prepend">http://127.0.0.1:9090</template>
</el-input>
</el-form-item>
<el-form-item label="接口参数">
<el-popover
ref="popover"
placement="bottom"
title="RSA公钥加密后"
width="500"
trigger="focus"
:content="popover">
</el-popover>
<el-input type="textarea"
v-popover:popover
v-model="params"
placeholder='接口参数,例如:{"version": "1.5.6"}'
@input="EncryptionParams()"
autosize></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit" :loading="getLoading">发送请求</el-button>
</el-form-item>
</el-form>
<el-form ref="form" label-width="80px">
<el-form-item label="返回数据">
<el-input type="textarea" autosize v-model="httpData" placeholder="后端返回的未解密数据">
</el-input>
</el-form-item>
<el-form-item label="解密数据">
<el-input type="textarea" autosize v-model="DecryptData" placeholder="解密result后的真实数据">
</el-input>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
data () {
return {
url: '/user/login',
params: '{"name": "lb", "pwd":"1234567890"}',
httpData: null,
DecryptData: null,
getLoading: false,
popover: null
}
},
created() {
this.EncryptionParams()
},
methods: {
EncryptionParams() {
this.popover = this.$utils.PublicKeyEncryption(JSON.parse(this.params))
},
onSubmit() {
this.getLoading = true
if(this.url == null || this.params == null || this.url == "" || this.params == "") {
this.$notify.error({
title: '参数缺失',
message: '接口地址 & 接口参数不能为空'
});
this.getLoading = false
}else {
try {
let params = JSON.parse(this.params)
this.$http({
method: 'post',
url: this.url,
headers: {
'data': this.$utils.PublicKeyEncryption(params),
'token': localStorage.getItem("token")
}
}).then(success => {
this.httpData = JSON.stringify(success.data)
this.DecryptData = this.$utils.PublicKeyDecrypt(success.data.result)
// 如果有token本地保存token方便请求接口时候使用
var datas = JSON.parse(this.DecryptData)
if(datas.hasOwnProperty("token")) {
this.$notify.success({
title: 'Token 提示',
message: 'Token已经缓存到本地可以直接调用其他接口'
});
localStorage.setItem("token", datas.token)
}
this.getLoading = false
}).catch(error => {
this.$notify.error({
title: '网络请求错误',
message: 'Ajax 请求失败,请检查参数是否正确!'
});
this.getLoading = false
})
} catch (e) {
this.$notify.error({
title: '接口参数错误',
message: '接口参数格式不正确,请仔细检查!'
});
this.getLoading = false
}
}
}
}
}
</script>
<style scoped>
.header-center {
padding: 40px 10px;
text-align: center;
font-size: 24px;
letter-spacing: 2px;
}
.index {
width: 800px;
margin: 0 auto;
}
</style>

View File

@@ -0,0 +1,27 @@
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import { Lib } from './utils/index.js'
import axios from 'axios'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
axios.defaults.baseURL = 'http://127.0.0.1:9090';
Vue.prototype.$http = axios
Vue.prototype.$utils = new Lib()
Vue.use(ElementUI);
Vue.config.productionTip = false
new Vue({
el: '#app',
router,
components: { App },
template: '<App/>'
})

View File

@@ -0,0 +1 @@
c00f9b38-7fcf-4d43-8eb5-01eb89d6b831

View File

@@ -0,0 +1,15 @@
import Vue from 'vue'
import Router from 'vue-router'
import Index from '@/components/index'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/',
name: 'Index',
component: Index
}
]
})

View File

@@ -0,0 +1 @@
03f5e35d-0bd5-4f22-b3c9-b9a288d06a57

View File

@@ -0,0 +1,58 @@
import NodeRSA from 'node-rsa'
import querystring from "querystring";
let publicKey = `-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC9eo8WIbWS5Yql06imlhrW0ZXh
faivPavdULvYLIxIKyUaOwMPFrPuHqqBNGnYOpiPHAKL+zxk2j4u+6jhB6VK1SOD
ccSLxIRxd0HmSDS+hBzYRf4vKc8BLlhMrYhnLmcxCc+PJIIa4DfCZnu8FfQlu/5L
ljjpYN9kHOpHAT+xpQIDAQAB
-----END PUBLIC KEY-----`;
export class Lib {
constructor() {
this.publicKey = publicKey
}
/**
* 前端: 使用RSA的公钥进行加密 publicKey
* @param {*string} text 需要加密的字符串
*/
PublicKeyEncryption (NeedEncryptionMessage) {
return (new NodeRSA(this.publicKey)).encrypt(JSON.stringify(NeedEncryptionMessage), 'base64')
}
/**
* 前端 公钥解密数据
* @param NeedDecryptMessage
* @constructor
*/
PublicKeyDecrypt (NeedDecryptMessage) {
return (new NodeRSA(this.publicKey)).decryptPublic(NeedDecryptMessage, 'utf8')
}
/**
* 获取本地数据
* @param {*string} name 名称
*/
GetLocalstorage(name) {
try {
const value = uni.getStorageSync(name);
if (value) {
return value;
}
} catch (e) {
console.log(e.message);
}
}
/**
* 写入本地数据
* @param {*string} name 名称
*/
SetLocalstorage(name, key) {
uni.setStorage({
key: name,
data: key,
success: function () {
console.log(`${name} save success`);
}
});
}
}