初步编写测试次数限制
parent
b5b9ce86bc
commit
d0a13cc604
|
@ -10,6 +10,25 @@ export function apitest(email){
|
|||
}
|
||||
|
||||
|
||||
|
||||
export function reducetestcount(data){
|
||||
return request({
|
||||
url:"/market/product/reducetestcount",
|
||||
method: "POST",
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function iftest(data){
|
||||
return request({
|
||||
url:"/market/product/iftest",
|
||||
method: "POST",
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
export function sendrequest(options){
|
||||
// 确保options是一个对象,并且包含必要的属性
|
||||
if (!options || typeof options !== 'object' || !options.apiRouter || typeof options.parameter === 'undefined') {
|
||||
|
|
|
@ -47,3 +47,10 @@ export function delapi(productId){
|
|||
})
|
||||
}
|
||||
|
||||
export function getprice(productId){
|
||||
return request({
|
||||
url:"/background/apimanage/getprice/"+productId,
|
||||
method: "POST",
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -9,15 +9,14 @@ export function selectList(data){
|
|||
}
|
||||
|
||||
|
||||
export function selectTypeList(data){
|
||||
export function selectTypeList(data) {
|
||||
return request({
|
||||
url:"/market/product/typeList",
|
||||
url: "/market/product/typeList",
|
||||
method: "POST",
|
||||
data: data
|
||||
})
|
||||
|
||||
|
||||
}export function selectproductspecification(data){
|
||||
}
|
||||
export function selectproductspecification(data){
|
||||
return request({
|
||||
url:"/market/product/specification",
|
||||
method: "POST",
|
||||
|
@ -25,5 +24,13 @@ export function selectTypeList(data){
|
|||
})
|
||||
}
|
||||
|
||||
export function ifbuy(data){
|
||||
return request({
|
||||
url:"/market/product/ifbuy",
|
||||
method: "POST",
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@
|
|||
|
||||
<!--新增对话框-->
|
||||
<el-dialog
|
||||
title="提示"
|
||||
title="新增接口"
|
||||
:visible.sync="dialogVisible"
|
||||
width="60%"
|
||||
:before-close="handleClose">
|
||||
|
@ -149,8 +149,13 @@
|
|||
<el-form-item label="请求方式" prop="requestMethod" style="width: 70%">
|
||||
<el-input type="text" v-model="api.requestMethod" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="默认选择规格" prop="requestMethod" style="width: 70%">
|
||||
<el-input type="text" v-model="api.productSpecification" autocomplete="off"></el-input>
|
||||
<el-form-item label="选择默认规格" prop="requestMethod" style="width: 70%">
|
||||
<el-select v-model="api.productSpecification" placeholder="请选择默认规格">
|
||||
<el-option label="按次查询" value="按次查询"></el-option>
|
||||
<el-option label="包日" value="包日"></el-option>
|
||||
<el-option label="包月" value="包月"></el-option>
|
||||
<el-option label="包年" value="包年"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-divider></el-divider>
|
||||
<span>价格</span>
|
||||
|
@ -187,14 +192,13 @@
|
|||
//例如:import 《组件名称》 from '《组件路径》,
|
||||
import {
|
||||
addproduct,
|
||||
delapi,
|
||||
productStateLis,
|
||||
productStateList,
|
||||
delapi, getprice,
|
||||
selectapiList,
|
||||
UpdproductState
|
||||
} from "@/api/background/apimanage";
|
||||
import {resetForm} from "@/utils/muyu";
|
||||
import {add} from "lodash/math";
|
||||
import api from "js-cookie";
|
||||
|
||||
export default {
|
||||
name: "Apimanage",
|
||||
|
@ -205,6 +209,13 @@ export default {
|
|||
//这里存放数据"
|
||||
return {
|
||||
tableData:[],
|
||||
moneyData:[],
|
||||
money:{
|
||||
timemoney:'',
|
||||
daymoney:'',
|
||||
monthmoney:'',
|
||||
yearmoney:''
|
||||
},
|
||||
ruleForm:{
|
||||
pageNum:1,
|
||||
pageSize:9,
|
||||
|
@ -269,7 +280,21 @@ export default {
|
|||
},
|
||||
//修改
|
||||
handleEdit(row){
|
||||
this.$router.push({path:"/apiupdmessage/index",query:{api:row}})
|
||||
//查询中间表,获取不同规格对应的价格
|
||||
getprice(row.productId).then(response=>{
|
||||
this.moneyData=response.data
|
||||
this.money.timemoney=this.moneyData[0].middlePrice
|
||||
this.money.daymoney=this.moneyData[1].middlePrice
|
||||
this.money.monthmoney=this.moneyData[2].middlePrice
|
||||
this.money.yearmoney=this.moneyData[3].middlePrice
|
||||
row.timemoney = this.money.timemoney;
|
||||
row.daymoney = this.money.daymoney;
|
||||
row.monthmoney = this.money.monthmoney;
|
||||
row.yearmoney = this.money.yearmoney;
|
||||
this.$router.push({path:"/apiupdmessage/index",query:{api:row}})
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
//删除
|
||||
handleDelete(row){
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
<el-form-item label="接口销量" prop="productSales" style="width: 70%">
|
||||
<el-input type="text" v-model="api.productSales" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="接口价格" prop="productPrice" style="width: 70%">
|
||||
<el-input type="text" v-model="api.productPrice" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="接口来源" prop="productFrom" style="width: 70%">
|
||||
<el-input type="text" v-model="api.productFrom" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
|
@ -38,6 +35,28 @@
|
|||
<el-form-item label="请求方式" prop="requestMethod" style="width: 70%">
|
||||
<el-input type="text" v-model="api.requestMethod" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="选择默认规格" prop="requestMethod" style="width: 70%">
|
||||
<el-select v-model="api.productSpecification" placeholder="请选择默认规格">
|
||||
<el-option label="按次查询" value="按次查询"></el-option>
|
||||
<el-option label="包日" value="包日"></el-option>
|
||||
<el-option label="包月" value="包月"></el-option>
|
||||
<el-option label="包年" value="包年"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-divider></el-divider>
|
||||
<span>价格</span>
|
||||
<el-form-item label="按次查询" prop="requestMethod" style="width: 70%">
|
||||
<el-input type="text" v-model="api.timemoney" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="包日" prop="requestMethod" style="width: 70%">
|
||||
<el-input type="text" v-model="api.daymoney" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="包月" prop="requestMethod" style="width: 70%">
|
||||
<el-input type="text" v-model="api.monthmoney" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="包年" prop="requestMethod" style="width: 70%">
|
||||
<el-input type="text" v-model="api.yearmoney" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="submitForm(api)">修改</el-button>
|
||||
<el-button @click="resetForm('ruleForm')">重置</el-button>
|
||||
|
|
|
@ -19,8 +19,15 @@
|
|||
|
||||
<el-row>
|
||||
<el-col :span="24"><div class="grid-content bg-purple-dark">
|
||||
<el-button type="info" @click="test(myapi)">测试</el-button>
|
||||
<el-button type="primary" @click="apply(myapi)">立即申请</el-button>
|
||||
<span v-if="myapi.remark=='是'">
|
||||
<el-button type="info" @click="test(myapi)">立即使用</el-button>
|
||||
<el-button type="primary" @click="apply(myapi)">续约</el-button>
|
||||
</span>
|
||||
<span v-if="myapi.remark=='否'">
|
||||
<el-button type="info" @click="test(myapi)">测试</el-button>
|
||||
<el-button type="primary" @click="apply(myapi)">立即申请</el-button>
|
||||
</span>
|
||||
|
||||
</div></el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
@ -191,7 +198,7 @@
|
|||
<script>
|
||||
//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等),
|
||||
//例如:import 《组件名称》 from '《组件路径》,
|
||||
import {sendrequest, sendrequest1} from "@/api/apitest/apitest";
|
||||
import {iftest, reducetestcount, sendrequest, sendrequest1} from "@/api/apitest/apitest";
|
||||
import api from "js-cookie";
|
||||
import {companyauthentication, ifcompanyauthentication} from "@/api/authentication/authentication";
|
||||
import {selectproductspecification} from "@/api/market/product";
|
||||
|
@ -231,13 +238,21 @@ export default {
|
|||
},
|
||||
//测试
|
||||
test(myapi){
|
||||
this.dialogVisible=true
|
||||
this.ruleForm={
|
||||
productName: myapi.productName,
|
||||
apiAddress: myapi.apiAddress,
|
||||
requestMethod: myapi.requestMethod,
|
||||
apiRouter: myapi.apiRouter
|
||||
}
|
||||
//判断测试次数是否<=0
|
||||
iftest(myapi).then(response=>{
|
||||
if (response.data=='' || response.data<=0){
|
||||
alert("使用次数已到期")
|
||||
}else{
|
||||
this.dialogVisible=true
|
||||
this.ruleForm={
|
||||
productName: myapi.productName,
|
||||
apiAddress: myapi.apiAddress,
|
||||
requestMethod: myapi.requestMethod,
|
||||
apiRouter: myapi.apiRouter
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
//立即申请
|
||||
apply(myapi){
|
||||
|
@ -297,6 +312,11 @@ export default {
|
|||
// 获取<pre>元素并设置其innerHTML为格式化的JSON字符串
|
||||
document.getElementById('json-display').innerHTML = formattedJson;
|
||||
})
|
||||
|
||||
//测试次数-1
|
||||
reducetestcount(this.myapi).then(response=>{
|
||||
})
|
||||
|
||||
},
|
||||
//测试发送请求 多个参数
|
||||
newsForm(ruleForm) {
|
||||
|
@ -356,6 +376,9 @@ export default {
|
|||
container.appendChild(resultDiv);
|
||||
|
||||
});
|
||||
//测试次数-1
|
||||
reducetestcount(this.myapi).then(response=>{
|
||||
})
|
||||
}
|
||||
},
|
||||
//生命周期 - 创建完成(可以访问当前this实例)",
|
||||
|
|
|
@ -73,14 +73,13 @@
|
|||
//例如:import 《组件名称》 from '《组件路径》,
|
||||
|
||||
|
||||
import {selectList, selectTypeList} from "@/api/market/product";
|
||||
import {ifbuy, selectList, selectTypeList} from "@/api/market/product";
|
||||
|
||||
export default {
|
||||
name: 'Product',
|
||||
//import引入的组件需要注入到对象中才能使用"
|
||||
components: {},
|
||||
props: {},
|
||||
|
||||
data() {
|
||||
//这里存放数据"
|
||||
return {
|
||||
|
@ -132,6 +131,12 @@ export default {
|
|||
},
|
||||
//接口测试页面
|
||||
test(product){
|
||||
//判断是否已购买
|
||||
ifbuy(product).then(response=>{
|
||||
if (response.code!=200) {
|
||||
alert(response.msg)
|
||||
}
|
||||
})
|
||||
this.$router.push({path:"/apitest/index",query:{myapi:JSON.stringify(product)}})
|
||||
},
|
||||
// test(product) {
|
||||
|
|
Loading…
Reference in New Issue