一、前台
1、data.js
import axios from '@/libs/api.request'
//ajax请求 根据id查询企业
export const getTest = info => {
return axios.request({
url: '/analyze/test',
data:info,
method: 'post'
})
}
2、statistics.vue
handleSubmit(data) {
// 行业分类
var industryType=document.evaluate("//*[@id='app']/div/div[2]/div[2]/div/div[2]/div[1]/div[1]/form/div[1]/div/div/div/div[1]/div/span",document).iterateNext().textContent;
//大类
var bigType=document.evaluate("//*[@id='app']/div/div[2]/div[2]/div/div[2]/div[1]/div[1]/form/div[2]/div/div/div/div[1]/div/span",document).iterateNext().textContent;
//门类
var smallType=document.evaluate("//*[@id='app']/div/div[2]/div[2]/div/div[2]/div[1]/div[1]/form/div[3]/div/div/div/div[1]/div/span",document).iterateNext().textContent;
console.log(industryType)
console.log(bigType)
console.log(smallType)
getTest({"industryType":industryType,"bigType":bigType,"smallType":smallType}).then(data => {
console.log("success");
})
}
二、后台
1、controller类
@RestController
@RequestMapping("/analyze")
public class AnalyzeController {
@PostMapping("test")
public void Test(@RequestBody Test test){
System.out.println(test.getBigType());
System.out.println(test.getIndustryType());
System.out.println(test.getSmallType());
}
}
2、实体类
public class Test {
private String industryType;
private String bigType;
private String smallType;
public String getIndustryType() {
return industryType;
}
public void setIndustryType(String industryType) {
this.industryType = industryType;
}
public String getBigType() {
return bigType;
}
public void setBigType(String bigType) {
this.bigType = bigType;
}
public String getSmallType() {
return smallType;
}
public void setSmallType(String smallType) {
this.smallType = smallType;
}
}