毕设期间遇到的一些问题以及解决方法

1. Module is not listed in package.json dependencies

解决方法:你没有在package.json文件中没有加入这个组件依赖,加入即可

在分离中有很多api权限的问题需要解决,包括部署后的vue router路由需要在nginx中配置rewrite规则。

2. Can’t resolve ‘sass-loader’ in…错误

解决办法:npm install sass-loader -D
npm install node-sass -D
https://blog.csdn.net/qq_24058693/article/details/80056557

3. SpringBoot跨域问题的解决

出现问题的原因是浏览器的同源策略,即协议、端口和域名都要相同,不同的话就是跨域请求

  • 解决方法有jsonp和cors。
  1. 利用 script 标签可以跨域加载的特性而创造出来的一种非正式的跨域解决方案
    2.在服务端返回时加入允许跨域的请求头,允许指定域名的跨域访问。

在后端添加

 @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")//设置允许跨域的路径
                .allowedOrigins("*")//设置允许跨域请求的域名
                .allowCredentials(true)//是否允许证书 不再默认开启
                .allowedMethods("GET", "POST", "PUT", "DELETE")//设置允许的方法
                .maxAge(3600);//跨域允许时间
    }

实现跨域请求时,每次ajax请求都是新的session,导致无法获取登录信息,所有的请求都被判定为未登陆。
axios.defaults.withCredentials =true;

axios的跨域请求方法的封装

4.岗位怎么和公司关联?

1.得先从session中获取到登录的公司信息–eName公司名称(唯一)
2.职位信息表中添加一个招聘公司名称字段,以此来查询对应公司的招聘岗位信息。

控制台报错

Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.
2019-04-28 12:40:01.482 ERROR 11664 — [ restartedMain] o.s.boot.SpringApplication : Application run failed

@GetMapping(value = “getJobListByFilter”,produces = “application/json; charset=UTF-8”)写错了application/json;

5. Result Maps collection does not contain value for com.qtu.zp.domain.JobPositionAndEnterpriseMessage

将resultMap修改成resultType

6.routerrouter和route的区别
  • $router : 是路由操作对象,只写对象
  • $route : 路由信息对象,只读对象

produces = "application/json; charset=UTF-8"少了个分号

8.使用axios.delete时后台接收不到参数

delete 和 post 、put 的参数不一样,post、put都有三个参数,分别为url、data还有config,
而delete只有两个参数,第一个是url,第二个是config

9.Parameter ‘0’ not found. Available parameters are [arg1, arg0, param1

在MyBatis3.4.4版不能直接使用#{0}要使用 #{arg0}

Invalid prop: type check failed for prop “defaultOpeneds”. Expected Array, got String with value “”.

mock.js?ccd5:8359 OPTIONS http://localhost:8082/zp/addBusinessInformation 404
send @ mock.js?ccd5:8359
dispatchXhrRequest @ xhr.js?ec6c:178
xhrAdapter @ xhr.js?ec6c:12
dispatchRequest @ dispatchRequest.js?c4bb:59
Promise.then (async)
request @ Axios.js?5e65:51
Axios.(anonymous function) @ Axios.js?5e65:71
wrap @ bind.js?24ff:9
(anonymous) @ UploadEnterpriseCertification.vue?d5d3:107
(anonymous) @ index.js?a811:1
validate @ index.js?a811:1
(anonymous) @ index.js?a811:1
validate @ index.js?a811:1
submitForm @ UploadEnterpriseCertification.vue?d5d3:98
click @ UploadEnterpriseCertification.vue?2866:220
invokeWithErrorHandling @ vue.esm.js?efeb:1856
invoker @ vue.esm.js?efeb:2178
invokeWithErrorHandling @ vue.esm.js?efeb:1856
Vue.$emit @ vue.esm.js?efeb:3850
handleClick @ index.js?a811:1
invokeWithErrorHandling @ vue.esm.js?efeb:1856
invoker @ vue.esm.js?efeb:2178
original._wrapper @ vue.esm.js?efeb:7503
uploadEnterpriseCertification:1 Access to XMLHttpRequest at ‘http://localhost:8082/zp/addBusinessInformation’ from origin ‘http://localhost:8081’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: It does not have HTTP ok status.
多了一个空格

10.Cannot delete or update a parent row: a foreign key constraint fails (zp.business_information, CONSTRAINT business_information_ibfk_1 FOREIGN KEY (eName) REFERENCES enterprise_message (emName))

The error may involve com.qtu.zp.dao.EnterpriseMapper.updateEnterprise-Inline
The error occurred while setting parameters
SQL: UPDATE enterprise_login set eName=?, ecreateTime= ?, status= ? WHERE ephone= ?
Cause: java.sql.SQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (zp.business_information, CONSTRAINT business_information_ibfk_1 FOREIGN KEY (eName) REFERENCES enterprise_message (emName))
; Cannot delete or update a parent row: a foreign key constraint fails (zp.business_information, CONSTRAINT business_information_ibfk_1 FOREIGN KEY (eName) REFERENCES enterprise_message (emName)); nested exception is java.sql.SQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (zp.business_information, CONSTRAINT business_information_ibfk_1 FOREIGN KEY (eName) REFERENCES enterprise_message (emName))] with root cause

添加级联

11后端报错

.Error:Maven Resources Compiler: Failed to copy ‘G:\dasixia\study_graduation_project\source program\zp\src\main\resources\mapper\recruitmentSituationMapper.xml’ to ‘G:\dasixia\study_graduation_project\source program\zp\target\classes\mapper\recruitmentSituationMapper.xml’: G:\dasixia\study_graduation_project\source program\zp\target\classes\mapper\recruitmentSituationMapper.xml (拒绝访问。)

id重复

12.java.lang.NullPointerException: null

List candidateResume =new ArrayList(); //=null只是在栈中有一个引用但并没有分配内存空间
如果这时我直接向orderList里添加对象就是直接向这个引用所指的内存放东西,因为没分配内存,所以会报空指针异常,所以需要把List orderList = nul;改为

List orderList = new ArrayList();就对了

13. Cannot read property ‘toFixed’ of null

折线图如果只有一个点就没办法渲染

14.访问本地资源时浏览器会报Not allowed to load local resource,后来查询得知谷歌浏览器为保护安全不允许直接访问本地资源,然后我就要解决这问题进行访问这个资源

有两个解决方案

  • 更改tomcat的server.xml文件就行虚拟地址映射,就能访问到该资源(数据库存储了图片路径,每个人的tomcat版本号名不一样导致文件名也不一样,根据这个进行修改部署比较麻烦)
    设置项目里的Server/server.xml,< Host >标签中加上一行(路径文件夹后面的’\’可以不加): < Context path=”/test/images” docBase=”c:\images” reloadable=”true”/>
    以后就可以使用 http://localhost/test/images/xxx.png 访问了
    Springboot内置tomcat设置虚拟目录
  • 像访问文件服务器一样进行资源访问(要么就把图片放进服务器 )
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章