diff --git a/chazhao/chazhao.js b/chazhao/chazhao.js index 6efbc98..4ce6c4e 100644 --- a/chazhao/chazhao.js +++ b/chazhao/chazhao.js @@ -1,17 +1,37 @@ Page({ shujichzhao: function (e) { + var that = this wx.request({ url: 'http://localhost:9527/zxbook/find1', data: { 'search': e.detail.value.search, }, header: { - "Content-Type": "application/x-www-form-urlencoded" + "Content-Type": "pplication/json" }, methods: { method: "POST", + }, + success: function (res) { + if(res.data=='zhaobudao'){ + wx.showModal({ + title: '书籍查询', + content: '未找到该书籍', + confirmColor: "rgba(253, 153, 65, 1)" + }) + } + + else{ + var book=res.data + let bookstr = JSON.stringify(book); + console.log(book); + wx.navigateTo({ + url: '../shuji/shuji?bookstr=' + bookstr, + }) + } } }) } + }) \ No newline at end of file diff --git a/shuji/shuji.js b/shuji/shuji.js index d2ac78e..68e78b0 100644 --- a/shuji/shuji.js +++ b/shuji/shuji.js @@ -1,37 +1,21 @@ -/*onLoad: function () { - wx.request({ - url: 'https://zhenxiang.xuanjis.com', //服务器地址 - data: { - name: 'book_id'//请求参数 - }, - header: { - 'content-type': 'application/json' - }, - success: function (res) { - console.log(res.data) - } - }) -} -*/ -Component({ - /** - * 组件的属性列表 - */ - properties: { - - }, - - /** - * 组件的初始数据 - */ - data: { +Page({ + onLoad:function(options){ + console.log(options); + let book = JSON.parse(options.bookstr); + console.log(book); + var that=this + that.setData({ + bookid:book.bookid, + bookname:book.bookname, + bookauthor: book.bookauthor, + booksort: book.booksort, + booknum: book.booknum + - }, - - /** - * 组件的方法列表 - */ - methods: { + }) + console.log(this.data.bookid) + + + } - } }) \ No newline at end of file diff --git a/shuji/shuji.wxml b/shuji/shuji.wxml index cf18ca0..196d9d8 100644 --- a/shuji/shuji.wxml +++ b/shuji/shuji.wxml @@ -1,4 +1,7 @@ 书名: +{{bookname}} 书号: -作者: \ No newline at end of file +{{bookid}} +作者: +{{bookauthor}} diff --git a/后端的都放着里面/zxbook/.classpath b/后端的都放着里面/zxbook/.classpath new file mode 100644 index 0000000..fdf020c --- /dev/null +++ b/后端的都放着里面/zxbook/.classpath @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/后端的都放着里面/zxbook/.project b/后端的都放着里面/zxbook/.project new file mode 100644 index 0000000..b870815 --- /dev/null +++ b/后端的都放着里面/zxbook/.project @@ -0,0 +1,48 @@ + + + zxbook + + + + + + org.eclipse.wst.jsdt.core.javascriptValidator + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + + org.springframework.ide.eclipse.core.springnature + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.wst.jsdt.core.jsNature + + diff --git a/后端的都放着里面/zxbook/.settings/.jsdtscope b/后端的都放着里面/zxbook/.settings/.jsdtscope new file mode 100644 index 0000000..585c967 --- /dev/null +++ b/后端的都放着里面/zxbook/.settings/.jsdtscope @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/后端的都放着里面/zxbook/.settings/org.eclipse.core.resources.prefs b/后端的都放着里面/zxbook/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..5dae1fa --- /dev/null +++ b/后端的都放着里面/zxbook/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF8 +encoding//src/main/resources=UTF-8 +encoding/=UTF-8 diff --git a/后端的都放着里面/zxbook/.settings/org.eclipse.jdt.core.prefs b/后端的都放着里面/zxbook/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..1ab2bb5 --- /dev/null +++ b/后端的都放着里面/zxbook/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/后端的都放着里面/zxbook/.settings/org.eclipse.m2e.core.prefs b/后端的都放着里面/zxbook/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..14b697b --- /dev/null +++ b/后端的都放着里面/zxbook/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/后端的都放着里面/zxbook/.settings/org.eclipse.wst.common.component b/后端的都放着里面/zxbook/.settings/org.eclipse.wst.common.component new file mode 100644 index 0000000..d587b36 --- /dev/null +++ b/后端的都放着里面/zxbook/.settings/org.eclipse.wst.common.component @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/后端的都放着里面/zxbook/.settings/org.eclipse.wst.common.project.facet.core.xml b/后端的都放着里面/zxbook/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..5e67641 --- /dev/null +++ b/后端的都放着里面/zxbook/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/后端的都放着里面/zxbook/.settings/org.eclipse.wst.jsdt.ui.superType.container b/后端的都放着里面/zxbook/.settings/org.eclipse.wst.jsdt.ui.superType.container new file mode 100644 index 0000000..3bd5d0a --- /dev/null +++ b/后端的都放着里面/zxbook/.settings/org.eclipse.wst.jsdt.ui.superType.container @@ -0,0 +1 @@ +org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/后端的都放着里面/zxbook/.settings/org.eclipse.wst.jsdt.ui.superType.name b/后端的都放着里面/zxbook/.settings/org.eclipse.wst.jsdt.ui.superType.name new file mode 100644 index 0000000..05bd71b --- /dev/null +++ b/后端的都放着里面/zxbook/.settings/org.eclipse.wst.jsdt.ui.superType.name @@ -0,0 +1 @@ +Window \ No newline at end of file diff --git a/后端的都放着里面/zxbook/.settings/org.eclipse.wst.validation.prefs b/后端的都放着里面/zxbook/.settings/org.eclipse.wst.validation.prefs new file mode 100644 index 0000000..6f1cba6 --- /dev/null +++ b/后端的都放着里面/zxbook/.settings/org.eclipse.wst.validation.prefs @@ -0,0 +1,2 @@ +disabled=06target +eclipse.preferences.version=1 diff --git a/后端的都放着里面/zxbook/pom.xml b/后端的都放着里面/zxbook/pom.xml new file mode 100644 index 0000000..2b15f6b --- /dev/null +++ b/后端的都放着里面/zxbook/pom.xml @@ -0,0 +1,164 @@ + + 4.0.0 + zxtsglxt + zxbook + war + 0.0.1-SNAPSHOT + zxbook Maven Webapp + http://maven.apache.org + + + UTF-8 + UTF-8 + + 4.3.10.RELEASE + + + + com.alibaba + fastjson + 1.2.44 + + + + com.google.code.gson + gson + 2.8.2 + + + junit + junit + 3.8.1 + test + + + + mysql + mysql-connector-java + 5.1.46 + + + + + + org.mybatis.generator + mybatis-generator-core + 1.3.5 + + + + + org.springframework + spring-core + ${spring.version} + + + + org.springframework + spring-beans + ${spring.version} + + + + org.springframework + spring-context + ${spring.version} + + + + org.springframework + spring-jdbc + ${spring.version} + + + + org.springframework + spring-tx + ${spring.version} + + + + org.springframework + spring-web + ${spring.version} + + + + org.springframework + spring-webmvc + ${spring.version} + + + + org.springframework + spring-test + ${spring.version} + test + + + + org.mybatis + mybatis + 3.4.2 + + + org.mybatis + mybatis-spring + 1.3.1 + + + + c3p0 + c3p0 + 0.9.1.2 + + + commons-dbcp + commons-dbcp + 1.4 + + + + + javax.servlet + javax.servlet-api + 3.1.0 + provided + + + javax.servlet + jstl + 1.2 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + UTF8 + true + + + + org.mybatis.generator + mybatis-generator-maven-plugin + 1.3.5 + + + ${basedir}/src/main/resources/generatorConfig.xml + true + + + + zxbook + + diff --git a/后端的都放着里面/zxbook/src/main/java/controller/BookController.java b/后端的都放着里面/zxbook/src/main/java/controller/BookController.java new file mode 100644 index 0000000..a57f5ee --- /dev/null +++ b/后端的都放着里面/zxbook/src/main/java/controller/BookController.java @@ -0,0 +1,52 @@ +package controller; + +import java.io.IOException; +import java.io.PrintWriter; +import java.io.Writer; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +import com.google.gson.Gson; + +import domain.BookPO; +import service.BookService; + +@Controller +public class BookController { + @Autowired@Qualifier("BookServiceImpl") + private BookService bookService; + @RequestMapping("find1") + public void find1(String search,HttpServletRequest request, HttpServletResponse response) throws IOException { + response.setContentType("text/html;charset=utf-8"); + /* 设置响应头允许ajax跨域访问 */ + response.setHeader("Access-Control-Allow-Origin", "*"); + /* 星号表示所有的异域请求都可以接受, */ + response.setHeader("Access-Control-Allow-Methods", "GET,POST"); + BookPO bookPO=this.bookService.FindByBookidOrname(search); + if(bookPO!=null) { + String ss = new Gson().toJson(bookPO); + System.out.println(ss); + response.setContentType("text/html;charset=UTF-8"); + PrintWriter out = response.getWriter(); + out.print(ss); + out.flush(); + out.close(); + + } + else + { + System.out.println("书籍不存在"); + Writer out = response.getWriter(); + out.write("zhaobudao"); + out.flush(); + } + + } + +} diff --git a/后端的都放着里面/zxbook/src/main/java/domain/BookPO.java b/后端的都放着里面/zxbook/src/main/java/domain/BookPO.java new file mode 100644 index 0000000..6a10d47 --- /dev/null +++ b/后端的都放着里面/zxbook/src/main/java/domain/BookPO.java @@ -0,0 +1,41 @@ +package domain; + +import java.io.Serializable; + +public class BookPO implements Serializable{ + private long bookid; + private String bookname; + private String bookauthor; + private String booksort; + private int booknum; + public long getBookid() { + return bookid; + } + public void setBookid(long bookid) { + this.bookid = bookid; + } + public String getBookname() { + return bookname; + } + public void setBookname(String bookname) { + this.bookname = bookname; + } + public String getBookauthor() { + return bookauthor; + } + public void setBookauthor(String bookauthor) { + this.bookauthor = bookauthor; + } + public String getBooksort() { + return booksort; + } + public void setBooksort(String booksort) { + this.booksort = booksort; + } + public int getBooknum() { + return booknum; + } + public void setBooknum(int booknum) { + this.booknum = booknum; + } +} diff --git a/后端的都放着里面/zxbook/src/main/java/mapperDAO/BookDAO.java b/后端的都放着里面/zxbook/src/main/java/mapperDAO/BookDAO.java new file mode 100644 index 0000000..d08b3e6 --- /dev/null +++ b/后端的都放着里面/zxbook/src/main/java/mapperDAO/BookDAO.java @@ -0,0 +1,14 @@ +package mapperDAO; + +import org.springframework.stereotype.Repository; + +import domain.BookPO; + + + +@Repository("BookDAO") +public interface BookDAO { + public BookPO FindByBookidOrname(String search ); + public BookPO FindByBooksort(String search); + +} diff --git a/后端的都放着里面/zxbook/src/main/java/service/BookService.java b/后端的都放着里面/zxbook/src/main/java/service/BookService.java new file mode 100644 index 0000000..3fd4b93 --- /dev/null +++ b/后端的都放着里面/zxbook/src/main/java/service/BookService.java @@ -0,0 +1,10 @@ +package service; + +import domain.BookPO; + +public interface BookService { + public BookPO FindByBookidOrname(String search ); + public BookPO FindByBooksort(String search); + + +} diff --git a/后端的都放着里面/zxbook/src/main/java/serviceimpl/BookServiceImpl.java b/后端的都放着里面/zxbook/src/main/java/serviceimpl/BookServiceImpl.java new file mode 100644 index 0000000..b6dc4cd --- /dev/null +++ b/后端的都放着里面/zxbook/src/main/java/serviceimpl/BookServiceImpl.java @@ -0,0 +1,31 @@ +package serviceimpl; + +import mapperDAO.BookDAO; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Component; + +import domain.BookPO; +import service.BookService; + +@Component("BookServiceImpl") +public class BookServiceImpl implements BookService{ + @Autowired@Qualifier("BookDAO") + + private BookDAO bookDAO; + + @Override + public BookPO FindByBookidOrname(String search) { + return this.bookDAO.FindByBookidOrname(search); + } + + @Override + public BookPO FindByBooksort(String search) { + // TODO Auto-generated method stub + return this.bookDAO.FindByBookidOrname(search); + } + + + +} diff --git a/后端的都放着里面/zxbook/src/main/resources/generatorConfig.xml b/后端的都放着里面/zxbook/src/main/resources/generatorConfig.xml new file mode 100644 index 0000000..6a98719 --- /dev/null +++ b/后端的都放着里面/zxbook/src/main/resources/generatorConfig.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
\ No newline at end of file diff --git a/后端的都放着里面/zxbook/src/main/resources/mapper/BookMapper.xml b/后端的都放着里面/zxbook/src/main/resources/mapper/BookMapper.xml new file mode 100644 index 0000000..51a580c --- /dev/null +++ b/后端的都放着里面/zxbook/src/main/resources/mapper/BookMapper.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/后端的都放着里面/zxbook/src/main/resources/mybatis.xml b/后端的都放着里面/zxbook/src/main/resources/mybatis.xml new file mode 100644 index 0000000..27b1f5e --- /dev/null +++ b/后端的都放着里面/zxbook/src/main/resources/mybatis.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/后端的都放着里面/zxbook/src/main/resources/spring-context.xml b/后端的都放着里面/zxbook/src/main/resources/spring-context.xml new file mode 100644 index 0000000..b674982 --- /dev/null +++ b/后端的都放着里面/zxbook/src/main/resources/spring-context.xml @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git a/后端的都放着里面/zxbook/src/main/resources/spring-mvc.xml b/后端的都放着里面/zxbook/src/main/resources/spring-mvc.xml new file mode 100644 index 0000000..5cc5ecd --- /dev/null +++ b/后端的都放着里面/zxbook/src/main/resources/spring-mvc.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + diff --git a/后端的都放着里面/zxbook/src/main/resources/spring-mybatis.xml b/后端的都放着里面/zxbook/src/main/resources/spring-mybatis.xml new file mode 100644 index 0000000..c27408c --- /dev/null +++ b/后端的都放着里面/zxbook/src/main/resources/spring-mybatis.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/后端的都放着里面/zxbook/src/main/webapp/WEB-INF/web.xml b/后端的都放着里面/zxbook/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..eddd9a8 --- /dev/null +++ b/后端的都放着里面/zxbook/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,20 @@ + + + Archetype Created Web Application + + + appServlet + org.springframework.web.servlet.DispatcherServlet + + contextConfigLocation + classpath:spring-*.xml + + 1 + + + appServlet + / + + \ No newline at end of file diff --git a/后端的都放着里面/zxbook/target/classes/.gitignore b/后端的都放着里面/zxbook/target/classes/.gitignore new file mode 100644 index 0000000..4e7e508 --- /dev/null +++ b/后端的都放着里面/zxbook/target/classes/.gitignore @@ -0,0 +1 @@ +/controller/ diff --git a/后端的都放着里面/zxbook/target/classes/domain/BookPO.class b/后端的都放着里面/zxbook/target/classes/domain/BookPO.class new file mode 100644 index 0000000..81fa70a Binary files /dev/null and b/后端的都放着里面/zxbook/target/classes/domain/BookPO.class differ diff --git a/后端的都放着里面/zxbook/target/classes/generatorConfig.xml b/后端的都放着里面/zxbook/target/classes/generatorConfig.xml new file mode 100644 index 0000000..6a98719 --- /dev/null +++ b/后端的都放着里面/zxbook/target/classes/generatorConfig.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
\ No newline at end of file diff --git a/后端的都放着里面/zxbook/target/classes/mapper/BookMapper.xml b/后端的都放着里面/zxbook/target/classes/mapper/BookMapper.xml new file mode 100644 index 0000000..51a580c --- /dev/null +++ b/后端的都放着里面/zxbook/target/classes/mapper/BookMapper.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/后端的都放着里面/zxbook/target/classes/mapperDAO/BookDAO.class b/后端的都放着里面/zxbook/target/classes/mapperDAO/BookDAO.class new file mode 100644 index 0000000..35fe298 Binary files /dev/null and b/后端的都放着里面/zxbook/target/classes/mapperDAO/BookDAO.class differ diff --git a/后端的都放着里面/zxbook/target/classes/mybatis.xml b/后端的都放着里面/zxbook/target/classes/mybatis.xml new file mode 100644 index 0000000..27b1f5e --- /dev/null +++ b/后端的都放着里面/zxbook/target/classes/mybatis.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/后端的都放着里面/zxbook/target/classes/service/BookService.class b/后端的都放着里面/zxbook/target/classes/service/BookService.class new file mode 100644 index 0000000..99cfb81 Binary files /dev/null and b/后端的都放着里面/zxbook/target/classes/service/BookService.class differ diff --git a/后端的都放着里面/zxbook/target/classes/serviceimpl/BookServiceImpl.class b/后端的都放着里面/zxbook/target/classes/serviceimpl/BookServiceImpl.class new file mode 100644 index 0000000..9f59cc6 Binary files /dev/null and b/后端的都放着里面/zxbook/target/classes/serviceimpl/BookServiceImpl.class differ diff --git a/后端的都放着里面/zxbook/target/classes/spring-context.xml b/后端的都放着里面/zxbook/target/classes/spring-context.xml new file mode 100644 index 0000000..b674982 --- /dev/null +++ b/后端的都放着里面/zxbook/target/classes/spring-context.xml @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git a/后端的都放着里面/zxbook/target/classes/spring-mvc.xml b/后端的都放着里面/zxbook/target/classes/spring-mvc.xml new file mode 100644 index 0000000..5cc5ecd --- /dev/null +++ b/后端的都放着里面/zxbook/target/classes/spring-mvc.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + diff --git a/后端的都放着里面/zxbook/target/classes/spring-mybatis.xml b/后端的都放着里面/zxbook/target/classes/spring-mybatis.xml new file mode 100644 index 0000000..c27408c --- /dev/null +++ b/后端的都放着里面/zxbook/target/classes/spring-mybatis.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/后端的都放着里面/zxbook/target/m2e-wtp/web-resources/.gitignore b/后端的都放着里面/zxbook/target/m2e-wtp/web-resources/.gitignore new file mode 100644 index 0000000..3385916 --- /dev/null +++ b/后端的都放着里面/zxbook/target/m2e-wtp/web-resources/.gitignore @@ -0,0 +1 @@ +/META-INF/