update detail
This commit is contained in:
1 parent
668c2b3a6b
commit
fbc08db592
16 files changed
+233
-126
No files matched your search
@@ -94,7 +94,7 @@ $height: 60px;
|
||||
height: $height;
|
||||
z-index: 999;
|
||||
width: 100%;
|
||||
background: radial-gradient(circle at 0 2%, #283e63, #172337 99%);
|
||||
background: radial-gradient(circle at 0 2%, #111827, #1a125d 99%);
|
||||
.logo {
|
||||
height: $height - 5px;
|
||||
width: 250px;
|
||||
|
||||
@@ -1,38 +1,14 @@
|
||||
<template>
|
||||
<div class="authentication">
|
||||
<div class="title">
|
||||
{{ $t('api.entity.requestHeader') }}
|
||||
</div>
|
||||
<el-input v-model="apiKeyValue" placeholder="x-api-key">
|
||||
<template #prepend>x-api-key</template>
|
||||
</el-input>
|
||||
</div>
|
||||
<div class="authentication"></div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ApiTry',
|
||||
props: {
|
||||
apiKey: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
emits: ['update:api-key'],
|
||||
data() {
|
||||
return {
|
||||
apiKeyValue: this.apiKey
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
apiKeyValue: {
|
||||
handler(val) {
|
||||
this.$emit('update:api-key', val);
|
||||
}
|
||||
}
|
||||
}
|
||||
name: 'ApiCode',
|
||||
props: {},
|
||||
data() {},
|
||||
watch: {}
|
||||
});
|
||||
</script>
|
||||
@@ -12,7 +12,15 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<el-input v-model="value[itemKey.toString()]" />
|
||||
<el-select
|
||||
v-if="item.enum"
|
||||
v-model="value[itemKey.toString()]"
|
||||
clearable
|
||||
:placeholder="$t('common.title.select')"
|
||||
>
|
||||
<el-option v-for="e in item.enum" :key="e" :label="e" :value="e" />
|
||||
</el-select>
|
||||
<el-input v-else v-model="value[itemKey.toString()]" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -45,7 +53,6 @@ export default defineComponent({
|
||||
watch: {
|
||||
value: {
|
||||
handler() {
|
||||
console.log('change', this.value);
|
||||
this.$emit('update:form', { ...this.value });
|
||||
},
|
||||
deep: true
|
||||
|
||||
@@ -39,7 +39,6 @@ export default defineComponent({
|
||||
})
|
||||
.then(({ data: data }: { data: IApiListResponse }) => {
|
||||
this.apis = data.items;
|
||||
console.log('apis', this.apis);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
<div class="operation">
|
||||
<el-button class="btn-try" type="primary" @click="onTry">{{ $t('common.button.try') }}</el-button>
|
||||
</div>
|
||||
<div class="result">
|
||||
<div v-if="responseData" class="result">
|
||||
<div class="title">{{ $t('api.entity.response') }}</div>
|
||||
<code-snippet :code="responseData" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -14,9 +15,13 @@ import { IApi, IForm, IRequest } from '@/operators/api/models';
|
||||
import { defineComponent } from 'vue';
|
||||
import axios, { Method } from 'axios';
|
||||
import urlJoin from 'url-join';
|
||||
import CodeSnippet from '../common/CodeSnippet.vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ApiTry',
|
||||
components: {
|
||||
CodeSnippet
|
||||
},
|
||||
props: {
|
||||
api: {
|
||||
type: Object as () => IApi,
|
||||
@@ -29,7 +34,8 @@ export default defineComponent({
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
apiKeyValue: this.apiKey
|
||||
apiKeyValue: this.apiKey,
|
||||
responseData: ''
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
@@ -42,10 +48,17 @@ export default defineComponent({
|
||||
data: { ...this.form.body }
|
||||
};
|
||||
console.debug('config', config);
|
||||
axios(config).then((response) => {
|
||||
console.log('response', response);
|
||||
// response.data.pipe(fs.createWriteStream('ada_lovelace.jpg'));
|
||||
});
|
||||
axios(config)
|
||||
.then((response) => {
|
||||
this.responseData = JSON.stringify(response?.data, null, ' ');
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('error', error);
|
||||
console.log(error);
|
||||
console.log('error');
|
||||
console.log(error.response);
|
||||
this.responseData = JSON.stringify(error?.response?.data, null, ' ');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -54,8 +67,19 @@ export default defineComponent({
|
||||
<style lang="scss" scoped>
|
||||
.wrapper {
|
||||
padding: 15px;
|
||||
.btn-try {
|
||||
width: 100%;
|
||||
.operation {
|
||||
margin-bottom: 10px;
|
||||
.btn-try {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.result {
|
||||
margin-bottom: 10px;
|
||||
.title {
|
||||
font-size: 12px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -75,7 +75,6 @@ export default defineComponent({
|
||||
watch: {
|
||||
formValue: {
|
||||
handler(val) {
|
||||
console.log('formValue changeddd');
|
||||
this.$emit('update:form', { ...val });
|
||||
},
|
||||
deep: true
|
||||
|
||||
Reference in new issue
Block a user