验证和包

master
201630126029 6 years ago
commit c7ae7bc725

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,134 @@
package yanzheng;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.URL;
import java.net.URLConnection;
import java.util.List;
import java.util.Map;
import java.util.Random;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSONObject;
@WebServlet("/Yanzheng")
public class Yanzheng extends HttpServlet {
private static final long serialVersionUID = 1L;
public Yanzheng() {
super();
// TODO Auto-generated constructor stub
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
}
public static String SendGET(String url,String param){
String result="";//访问返回结果
BufferedReader read=null;//读取访问结果
URL realurl=null;
URLConnection connection=null;
try {
//创建url
realurl=new URL(new StringBuffer(url).toString());
//打开连接
connection=realurl.openConnection();
// 设置通用的请求属性
connection.setRequestProperty("accept", "*/*");
connection.setRequestProperty("connection", "Keep-Alive");
connection.setRequestProperty("user-agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
//建立连接
connection.connect();
// 获取所有响应头字段
Map<String, List<String>> map = connection.getHeaderFields();
// 遍历所有的响应头字段获取到cookies等
for (String key : map.keySet()) {
System.out.println(key + "--->" + map.get(key));
}
// 定义 BufferedReader输入流来读取URL的响应
read = new BufferedReader(new InputStreamReader(
connection.getInputStream(),"UTF-8"));
String line;//循环读取
while ((line = read.readLine()) != null) {
result += line;
}
} catch (IOException e) {
e.printStackTrace();
}finally{
if(read!=null){//关闭流
try {
read.close();
} catch (IOException e) {
e.printStackTrace();
}
}
// if(connection != null) {
// connection.
// }
}
return result;
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setHeader("Content - Encoding","utf-8");
response.setContentType("text/json; charset=utf-8");
String code =request.getParameter("code");
StringBuffer url = new StringBuffer("https://api.weixin.qq.com/sns/jscode2session?");
url.append("appid=wxdc9f23490d56599c");
url.append("&secret=c39052978a3e80d55ff53227013384ce");
url.append("&js_code="); url.append(code);
url.append("&grant_type=authorization_code");
String finalURL = url.toString();
String res = SendGET(finalURL, "");
JSONObject json = JSONObject.parseObject(res);
System.out.println(json.toString());
int errcode = json.getIntValue("errcode");
PrintWriter out = response.getWriter();
JSONObject toxcx = new JSONObject();
if(errcode == 0) {
String openid = json.getString("openid");
String session_key = json.getString("session_key");
//插入数据库中还没做
String str="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
Random random=new Random();
StringBuffer sb=new StringBuffer();
for(int i=0;i<20;i++){
int number=random.nextInt(62);
sb.append(str.charAt(number));
}
toxcx.put("errcode","成功");
toxcx.put("verification",sb.toString());
out.println(toxcx.toString());
out.flush();
}
else if(errcode == -1) { // 系统繁忙,此时请开发者稍候再试
toxcx.put("errcode","-1 系统繁忙,请稍候再试");
out.println(toxcx.toString());
out.flush();
}
else if(errcode == 40029) { // code 无效
toxcx.put("errcode","40029 code无效");
out.println(toxcx.toString());
out.flush();
}
else if(errcode == 45011){ //频率限制每个用户每分钟100次
toxcx.put("errcode","45011 操作过于频繁");
out.println(toxcx.toString());
out.flush();
}
}
}

Binary file not shown.

@ -11,6 +11,8 @@ App({
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
var code = res.code
}
})
// 获取用户信息

@ -4,8 +4,8 @@ Page({
// banner
imgUrls: [
"/pages/index/image/suanfa.jpg"
],
'book': [],
// 商品详情介绍
@ -13,6 +13,26 @@ Page({
"/pages/index/image/suanfa.jpg"
],
},
onload:function(options){
var thats = this
wx.request({
url: "http://45.76.158.31:8080/web/GetFrontInfo.do?bookid="+options.id,
header: {
"content-type": "json"
},
success: function (res) {
console.log(res.data)
if (res.statusCode == 200) {
thats.setData({
book: res.data,
})
//wx.hideNavigationBarLoading()
}
}
})
},
//预览图片
previewImage: function (e) {
var current = e.target.dataset.src;
@ -22,8 +42,23 @@ Page({
urls: this.data.imgUrls // 需要预览的图片http链接列表
})
},
// 跳到购物车
addCar() {
var reqData="{'BookName':'','BookID':'','count':''}"
wx.request({
url: '',
data: {reqData:reqData},
header: {'Content-Type': 'application/x-www-form-urlencoded'},
method: 'POST',
dataType: 'json',
responseType: 'text',
success: function(res) {
console.log("sucess")
},
fail: function(res) {},
complete: function(res) {},
})
wx.switchTab({
url: '/pages/gouwu/gouwu'
})

@ -1,27 +1,28 @@
<!--pages/detail/detail.wxml-->
<!-- banner -->
<swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}">
<block wx:for="{{imgUrls}}">
<block wx:for="{{book}}" wx:for-item="books">
<swiper-item>
<image src="{{item}}" data-src="{{item}}" bindtap="previewImage"></image>
<image src="http://45.76.158.31:8080/web/BookImage/{{books.BookName}}.jpg" data-src="{{item}}" bindtap="previewImage"></image>
</swiper-item>
</block>
</swiper>
<scroll-view scroll-y="true">
<view class="detail">
<text class="title">算法设计</text>
<text class="price">¥20</text>
<text class="title">{{book[0].BookName}}</text>
<text class="price">¥{{book[0].Price}}</text>
</view>
<view class="separate"></view>
<!-- sku选择 -->
<text bindtap="toggleDialog">请选择购买数量</text>
<view class="separate"></view>
<text>商品评价</text>
<text>商品评价:{{book[0].Introduce}}</text>
<view class="separate"></view>
<text>商品详情</text>
<block wx:for-items="{{detailImg}}" wx:key="name">
<image class="image_detail" src="http://45.76.158.31:8080/web/BookImage/{{books.BookName}}.jpg" />
<!--<block wx:for-items="{{detailImg}}" wx:key="name">
<image class="image_detail" src="{{item}}" />
</block>
</block>-->
<view class="temp"></view>
</scroll-view>
<!-- 底部悬浮栏 -->

@ -1,113 +1,152 @@
// pages/fenlei/fenlei.js
Page({
data: {
'book':[],
cateItems: [
{
cate_id: 1,
cate_name: "小说",
cate_name: "玄幻",
ishaveChild: true,
children:
[
{
child_id: 1,
name: '福尔摩斯',
image: "/pages/index/image/xs1.jpg"
},
{
child_id: 2,
name: '莫泊桑',
image: "/pages/index/image/xs2.jpg"
},
{
child_id: 3,
name: '盗墓笔记',
image: "/pages/index/image/xs3.jpg"
},
{
child_id: 4,
name: '明朝那些事',
image: "/pages/index/image/xs4.jpg"
}
]
// children:
// [
// {
// child_id: 1,
// name: '福尔摩斯',
// image: "/pages/index/image/xs1.jpg"
// },
// {
// child_id: 2,
// name: '莫泊桑',
// image: "/pages/index/image/xs2.jpg"
// },
// {
// child_id: 3,
// name: '盗墓笔记',
// image: "/pages/index/image/xs3.jpg"
// },
// {
// child_id: 4,
// name: '明朝那些事',
// image: "/pages/index/image/xs4.jpg"
// }
// ]
},
{
cate_id: 2,
cate_name: "科学期刊",
cate_name: "魔幻",
ishaveChild: true,
children:
[
{
child_id: 1,
name: '世界百科',
image: "/pages/index/image/kxqk1.jpg"
},
{
child_id: 2,
name: '动物百科',
image: "/pages/index/image/kxqk2.jpg"
},
{
child_id: 3,
name: '趣味科学',
image: "/pages/index/image/kxqk3.jpg"
}
]
// children:
// [
// {
// child_id: 1,
// name: '世界百科',
// image: "/pages/index/image/kxqk1.jpg"
// },
// {
// child_id: 2,
// name: '动物百科',
// image: "/pages/index/image/kxqk2.jpg"
// },
// {
// child_id: 3,
// name: '趣味科学',
// image: "/pages/index/image/kxqk3.jpg"
// }
// ]
},
{
cate_id: 3,
cate_name: "儿童书籍",
cate_name: "奇幻",
ishaveChild: true,
children:
[
{
child_id: 1,
name: '父与子全集',
image: "/pages/index/image/etsj1.jpg"
},
{
child_id: 2,
name: '丁丁历险记',
image: "/pages/index/image/etsj2.jpg"
},
{
child_id: 3,
name: '美丽星空',
image: "/pages/index/image/etsj3.jpg"
},
{
child_id: 4,
name: '小虎神探队',
image: "/pages/index/image/etsj4.jpg"
}
]
// children:
// [
// {
// child_id: 1,
// name: '父与子全集',
// image: "/pages/index/image/etsj1.jpg"
// },
// {
// child_id: 2,
// name: '丁丁历险记',
// image: "/pages/index/image/etsj2.jpg"
// },
// {
// child_id: 3,
// name: '美丽星空',
// image: "/pages/index/image/etsj3.jpg"
// },
// {
// child_id: 4,
// name: '小虎神探队',
// image: "/pages/index/image/etsj4.jpg"
// }
// ]
},
{
cate_id: 4,
cate_name: "计算机",
cate_name: "都市",
ishaveChild: true,
children: [
{
child_id: 1,
name: 'Java Web',
image: "/pages/index/image/java.jpg"
},
{
child_id: 2,
name: '计算机网络',
image:"/pages/index/image/jsswl.jpg"
},
]
// children: [
// {
// child_id: 1,
// name: 'Java Web',
// image: "/pages/index/image/java.jpg"
// },
// {
// child_id: 2,
// name: '计算机网络',
// image:"/pages/index/image/jsswl.jpg"
// },
// ]
}
],
curNav: 1,
curIndex: 0
},
onload:function(){
var thats = this
wx.request({
url: "http://45.76.158.31:8080/web/GetFrontInfo.dotype=" + 1,
header: {
"content-type": "json"
},
success: function (res) {
console.log(res.data)
if (res.statusCode == 200) {
thats.setData({
book: res.data,
})
//wx.hideNavigationBarLoading()
}
}
})
},
//事件处理函数
switchRightTab: function (e) {
// 获取item项的id和数组的下标值
let id = e.target.dataset.id,
index = parseInt(e.target.dataset.index);
console.log(id)
var thats = this
wx.request({
url: "http://45.76.158.31:8080/web/GetFrontInfo.dotype="+id,
header: {
"content-type": "json"
},
success: function (res) {
console.log(res.data)
if (res.statusCode == 200) {
thats.setData({
book: res.data,
ppt: res.data
})
//wx.hideNavigationBarLoading()
}
}
})
// 把点击到的某一项设为当前index
this.setData({
curNav: id,

@ -13,12 +13,12 @@
<view class="nav_right">
<!--如果有数据,才遍历项-->
<view wx:if="{{cateItems[curIndex].ishaveChild}}">
<block wx:for="{{cateItems[curIndex].children}}">
<block wx:for="{{book}}" wx:for-item="books">
<view class="nav_right_items">
<!--界面跳转 -->
<navigator url="/pages/detail/detail">
<image src="{{item.image}}"></image>
<text>{{item.name}}</text>
<navigator url="/pages/detail/detail?id={{books.BookID}}">
<image src="http://45.76.158.31:8080/web/BookImage/{{books.BookName}}.jpg"></image>
<text>{{books.BookName}}</text>
</navigator>
</view>
</block>

@ -5,9 +5,15 @@ Page({
* 页面的初始数据
*/
data: {
<<<<<<< HEAD
'iscart':false,
'goodList': [
{
=======
'iscart': false,
'checked': [],
'goodList': [{
>>>>>>> f23362a433f70f1876587a01c643e157b7e8b3ae
'cover': '/pages/index/image/suanfa.jpg',
'isbn': '9787535482051',
'desc': '计算机算法设计',
@ -48,11 +54,12 @@ Page({
'checked': false
}
],
'bookList': [],
'checkAll': false,
'totalCount': 0,
'totalPrice': 0,
'consignee':"杨盼成",
'phone':'12345678912'
'consignee': "杨盼成",
'phone': '12345678912'
},
/**
@ -60,12 +67,12 @@ Page({
*/
deleteList(e) {
const index = e.currentTarget.dataset.index;
let goodList = this.data.goodList;
goodList.splice(index, 1);
let bookList = this.data.bookList;
bookList.splice(index, 1);
this.setData({
goodList: goodList
bookList: bookList
});
if (!goodList.length) {
if (!bookList.length) {
this.setData({
iscart: true
});
@ -77,15 +84,15 @@ Page({
/**
* 计算商品总数
*/
calculateTotal: function () {
var goodList = this.data.goodList;
calculateTotal: function() {
var bookList = this.data.bookList;
var totalCount = 0;
var totalPrice = 0;
for (var i = 0; i < goodList.length; i++) {
var good = goodList[i];
if (good.checked) {
totalCount += good.count;
totalPrice += good.count * good.price;
for (var i = 0; i < bookList.length; i++) {
var book = bookList[i];
if (book.checked) {
totalCount += book.count;
totalPrice += book.count * book.price;
}
}
totalPrice = totalPrice.toFixed(2);
@ -98,16 +105,16 @@ Page({
/**
* 用户点击商品减1
*/
subtracttap: function (e) {
subtracttap: function(e) {
var index = e.target.dataset.index;
var goodList = this.data.goodList;
var count = goodList[index].count;
var bookList = this.data.bookList;
var count = bookList[index].count;
if (count <= 1) {
return;
} else {
goodList[index].count--;
bookList[index].Count--;
this.setData({
'goodList': goodList
'bookList': bookList
});
this.calculateTotal();
}
@ -116,27 +123,27 @@ Page({
/**
* 用户点击商品加1
*/
addtap: function (e) {
addtap: function(e) {
var index = e.target.dataset.index;
var goodList = this.data.goodList;
var count = goodList[index].count;
goodList[index].count++;
var bookList = this.data.bookList;
var count = bookList[index].count;
bookList[index].Count++;
this.setData({
'goodList': goodList
'bookList': bookList
});
this.calculateTotal();
},
/**
* 用户选择购物车商品
*/
checkboxChange: function (e) {
checkboxChange: function(e) {
console.log('checkbox发生change事件携带value值为', e.detail.value);
var checkboxItems = this.data.goodList;
var checkboxItems = this.data.bookList;
var values = e.detail.value;
for (var i = 0; i < checkboxItems.length; ++i) {
checkboxItems[i].checked = false;
for (var j = 0; j < values.length; ++j) {
if (checkboxItems[i].isbn == values[j]) {
if (checkboxItems[i].BookID == values[j]) {
checkboxItems[i].checked = true;
break;
}
@ -149,7 +156,7 @@ Page({
}
this.setData({
'goodList': checkboxItems,
'bookList': checkboxItems,
'checkAll': checkAll
});
this.calculateTotal();
@ -158,7 +165,7 @@ Page({
/**
* 用户点击全选
*/
selectalltap: function (e) {
selectalltap: function(e) {
// console.log('用户点击全选携带value值为', e.detail.value);
var value = e.detail.value;
var checkAll = false;
@ -166,15 +173,15 @@ Page({
checkAll = true;
}
var goodList = this.data.goodList;
for (var i = 0; i < goodList.length; i++) {
var good = goodList[i];
good['checked'] = checkAll;
var bookList = this.data.bookList;
for (var i = 0; i < bookList.length; i++) {
var book = bookList[i];
book['checked'] = checkAll;
}
this.setData({
'checkAll': checkAll,
'goodList': goodList
'bookList': bookList
});
this.calculateTotal();
},
@ -185,61 +192,87 @@ Page({
},
todetail: function(e) {
var id = e.target.dataset.id
wx.navigateTo({
url: "/pages/detail/detail?id=" + id
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
onLoad: function(options) {
var that = this
wx.request({
url: "http://45.76.158.31:8080/web/GetFrontInfo.do",
header: {
"content-type": "json"
},
success: function(res) {
for (var i = 0; i < res.data.length; i++) {
res.data[i].checked = false;
}
console.log(res.data)
if (res.statusCode == 200) {
that.setData({
bookList: res.data,
})
//wx.hideNavigationBarLoading()
}
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
onReady: function() {
this.calculateTotal();
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
onShareAppMessage: function() {
},
<<<<<<< HEAD
newAddress: function () {
if (this.data.totalCount >0)
{wx.navigateTo({
@ -255,3 +288,33 @@ Page({
}
}
})
=======
newAddress: function() {
var checkList = [];
if (!this.data.iscart) {
var bookList = this.data.bookList
for (var i = 0; i < bookList.length; i++) {
if (bookList[i].checked) {
checkList.push(this.data.bookList[i])
}
}
}
var checkLists = JSON.stringify(checkList)
console.log(checkLists)
//if (this.data.totalCount > 0) {
wx.navigateTo({
url: '/pages/order/order?typeId=0&checkLists=' + checkLists
})
// }
// else {
// wx.showToast({
// title: '没有选择商品',
// icon: 'success',
// duration: 2000
// })
// }
}
})
>>>>>>> f23362a433f70f1876587a01c643e157b7e8b3ae

@ -1,5 +1,6 @@
<!--pages/gouwu/gouwu.wxml-->
<<<<<<< HEAD
<!-- 上部分 -->
<view class='section section-good'>
<checkbox-group bindchange="checkboxChange">
@ -37,13 +38,61 @@
</view>
</view>
=======
<!-- 上部分 -->
<view class='section section-good'>
<checkbox-group bindchange="checkboxChange">
<view class='good' wx:for='{{bookList}}' wx:for-item="book" wx:key="book.BookName">
>>>>>>> f23362a433f70f1876587a01c643e157b7e8b3ae
<!--第一个盒子 -->
<view class='good_title'>
<view class='shangjia'></view>
<view class='shanchu'>
<view class='shanchu_trash' bindtap="deleteList">
<image src='/pages/index/image/shanchu.png'></image>
</view>
</checkbox-group>
<!-- 删除 -->
</view>
</view>
<!-- 第二个盒子 -->
<view class='good_content'>
<view class='good_checkbox'>
<label class="checkbox">
<checkbox value="{{book.BookID}}" checked="{{book.checked}}" hidden='hidden' />
<icon type="circle" size="23" wx:if="{{!book.checked}}"></icon>
<icon type="success" size="23" wx:if="{{book.checked}}"></icon>
</label>
</view>
<view class='good_img'>
<image class='cover' src='http://45.76.158.31:8080/web/BookImage/{{book.BookName}}.jpg' data-id='books.BookID' bindtap='todetail'></image>
</view>
<view class='content'>
<view class='titles'>{{book.BookName}}</view>
</view>
<view class='good_footer'>
<view class='price'>¥{{book.Price}}</view>
<view class='stepper'>
<view class='subtract {{book.Count == 1 ? "disabled": ""}}' data-index='{{index}}' catchtap='subtracttap'>-</view>
<input class='count' type='number' value='{{book.Count}}'></input>
<view class='add' data-index="{{index}}" catchtap='addtap'>+</view>
</view>
<!-- 底部 -->
<view class='section-bottom'>
</view>
<<<<<<< HEAD
<view class='btn {{totalCount > 0 ? "btn-primary" : "btn-default"}}' bindtap="newAddress">去结算</view>
=======
>>>>>>> f23362a433f70f1876587a01c643e157b7e8b3ae
</view>
</view>
</checkbox-group>
</view>
<!-- 底部 -->
<view class='section-bottom'>
<checkbox-group bindchange="selectalltap">
<label class='checkbox-allcheck'>
<checkbox value="{{!checkAll}}" checked="{{checkAll}}" hidden='hidden' />
@ -62,13 +111,16 @@
</view>
<view class='btn {{totalCount > 0 ? "btn-primary" : "btn-default"}}' bindtap="newAddress">去结算</view>
</view>
<!--
<navigator wx:if="{{totalCount>0}}" url='../order/order'>
<view class='btn {{totalCount > 0 ? "btn-primary" : "btn-default"}}'>去结算</view>
</navigator>-->
</view>
<!--如果购物车内没有数据,就显示没有数据-->
<view class="cartList" hidden="{{!iscart}}">
<image src="/pages/index/image/gouwuche.jpg"/>
<image src="/pages/index/image/gouwuche.jpg" />
<view>购物车什么都没有,赶快去购物吧</view>
</view>

@ -9,10 +9,20 @@ Page({
'goodsDate': '2018-11-11',
'totalCount': 0,
'totalPrice': 0,
'address':'湖南师范大学理学院',
'address': '湖南师范大学理学院',
'consignee': "杨盼成",
<<<<<<< HEAD
'phone': '123456789',
'unpaidList': [//待付款
=======
'phone': '12345678912',
'unpaidList': [], //待付款
'dueinList': [], //待收货
'deliverList': [], //待发货
'checkList':[],
'unpaidLists': [ //待付款
>>>>>>> f23362a433f70f1876587a01c643e157b7e8b3ae
{
'cover': '../index/image/suanfa.jpg',
'isbn': '9787535482051',
@ -35,7 +45,7 @@ Page({
'count': 5
}
],
'deliverList':[//待发货
'deliverLists': [ //待发货
{
'cover': '../index/image/suanfa.jpg',
'isbn': '9787535482051',
@ -55,7 +65,7 @@ Page({
'count': 5
}
],
'dueinList': [//待收货
'dueinLists': [ //待收货
{
'cover': '../index/image/suanfa.jpg',
'isbn': '9787535482051',
@ -77,32 +87,84 @@ Page({
],
},
onLoad: function () {
var unpaidList = this.data.unpaidList;
onLoad: function(options) {
var that = this
if (options.checkLists != null) {
that.data.ccheckList = JSON.parse(options.checkLists);
//console.log(checkList[0].BookName)
} else {
wx.request({
url: "http://45.76.158.31:8080/web/GetFrontInfo.do",
header: {
"content-type": "json"
},
success: function(res) {
if (res.statusCode == 200) {
console.log(res.data)
that.setData({
checkList :res.data
})
//wx.hideNavigationBarLoading()
}
}
})
}
wx.request({
url: "http://45.76.158.31:8080/web/GetFrontInfo.do",
header: {
"content-type": "json"
},
success: function(res) {
if (res.statusCode == 200) {
console.log(res.data)
that.setData({
dueinList: res.data
})
//wx.hideNavigationBarLoading()
}
}
})
wx.request({
url: "http://45.76.158.31:8080/web/GetFrontInfo.do",
header: {
"content-type": "json"
},
success: function (res) {
if (res.statusCode == 200) {
console.log(res.data)
that.setData({
deliverList: res.data
})
//wx.hideNavigationBarLoading()
}
}
})
that.setData({
currentTap: options.typeId,
unpaidList: that.data.checkList
})
var unpaidList = that.data.unpaidList;
var totalCount = 0;
var totalPrice = 0;
for (var i = 0; i < unpaidList.length; i++) {
var good = unpaidList[i];
totalCount += good.count;
totalPrice += good.count * good.price;
for (var i = 0; i < that.data.unpaidList.l; i++) {
var book = that.data.unpaidList[i];
totalCount += book.Count;
totalPrice += book.Count * book.Price;
}
totalPrice = totalPrice.toFixed(2);
this.setData({
that.setData({
'totalCount': totalCount,
'totalPrice': totalPrice
})
},
onLoad: function (options){
var that = this
this.setData({
currentTap: options.typeId
})
},
deleteList: function (e) {
deleteList: function(e) {
this.setData({
'unpaidList':null
'unpaidList': null
});
},

@ -12,26 +12,26 @@
</view>
<view class="order_list">
<!--待付款页面-->
<view class="order_all {{currentTap ==0?'order_show':''}}" wx:if='{{unpaidList!=null}}'>
<view class="order_all {{currentTap ==0?'order_show':''}}" wx:if='{{unpaidList!=null}}' wx:for='{{unpaidList}}' wx:for-item="book" wx:key="book.BookID">
<view class="order_tlt flexRowBetween">
<view class="tlt_left">
<text>订单创建时期:</text>
<text>{{goodsDate}}</text>
<text>2018-11-11</text>
</view>
<view class="tlt_right" style="color:#21c3d4">
等待付款
</view>
</view>
<view class="same_stroe">
<view class="flexRowBetween orderlistShow" wx:for='{{unpaidList}}' wx:for-item="good" wx:key="good.name">
<view class="flexRowBetween orderlistShow">
<view class="order_left">
<image src="{{good.cover}}"></image>
<image src="http://45.76.158.31:8080/web/BookImage/{{book.BookName}}.jpg"></image>
</view>
<view class="order_name">
<view class="text1">{{good.desc}}</view>
<view class="text1">{{book.BookName}}</view>
<view class="orders flexRowBetween">
<text class="order_type">数量:{{good.count}}</text>
<text class="order_price">{{good.price*good.count}}</text>
<text class="order_type">数量:{{book.Count}}</text>
<text class="order_price">{{book.Price*book.Count}}</text>
</view>
</view>
</view>
@ -55,25 +55,25 @@
</view>
<!--待收货页面-->
<view class="order_all {{currentTap ==1?'order_show':''}}" wx:if='{{dueinList!=null}}'>
<view class="order_all {{currentTap ==1?'order_show':''}}" wx:if='{{dueinList!=null}}' wx:for='{{dueinList}}' wx:for-item="book" wx:key="book.BookID">
<view class="order_tlt flexRowBetween">
<view class="tlt_left">
<text>发货日期:</text>
<text>{{goodsDate}}</text>
<text>2018-11-11</text>
</view>
<view class="tlt_right" style="color:#21c3d4">
正在配送中
</view>
</view>
<view class="same_stroe">
<view class="flexRowBetween orderlistShow" wx:for='{{dueinList}}' wx:for-item="good" wx:key="good.name">
<view class="flexRowBetween orderlistShow">
<view class="order_left">
<image src="{{good.cover}}"></image>
<image src="http://45.76.158.31:8080/web/BookImage/{{book.BookName}}.jpg"></image>
</view>
<view class="order_name">
<view class="text1">{{good.desc}}</view>
<view class="text1">{{book.BookName}}</view>
<view class="orders flexRowBetween">
<text class="order_type">数量:{{good.count}}</text>
<text class="order_type">数量:{{book.Count}}</text>
</view>
</view>
</view>
@ -83,7 +83,7 @@
<view class="flexRowBetween">
<view class="total_money">
<text>收货地址:</text>
<text class="text2">{{address}}</text>
<text class="text2">{{book.Addresss}}</text>
</view>
</view>
</view>
@ -91,7 +91,7 @@
<view class="flexRowBetween">
<view class="total_money">
<text>收货人:</text>
<text class="text2">{{consignee}}</text>
<text class="text2">{{book.consignee}}</text>
</view>
</view>
</view>
@ -99,7 +99,7 @@
<view class="flexRowBetween">
<view class="total_money">
<text>电话:</text>
<text class="text2">{{phone}}</text>
<text class="text2">{{book.phone}}</text>
</view>
</view>
</view>
@ -113,7 +113,7 @@
</view>
</view>
<view class="order_all {{currentTap ==2?'order_show':''}}" wx:if="{{deliverList!=null}}">
<view class="order_all {{currentTap ==2?'order_show':''}}" wx:if="{{deliverList!=null}}" wx:for='{{dueinList}}' wx:for-item="book" wx:key="book.BookID">
<view class="order_tlt flexRowBetween">
<view class="tlt_left">
<text>付款日期:</text>
@ -124,14 +124,14 @@
</view>
</view>
<view class="same_stroe">
<view class="flexRowBetween orderlistShow" wx:for='{{dueinList}}' wx:for-item="good" wx:key="good.name">
<view class="flexRowBetween orderlistShow">
<view class="order_left">
<image src="{{good.cover}}"></image>
<image src="http://45.76.158.31:8080/web/BookImage/{{book.BookName}}.jpg"></image>
</view>
<view class="order_name">
<view class="text1">{{good.desc}}</view>
<view class="text1">{{book.BookName}}</view>
<view class="orders flexRowBetween">
<text class="order_type">数量:{{good.count}}</text>
<text class="order_type">数量:{{book.Count}}</text>
</view>
</view>
</view>
@ -141,7 +141,7 @@
<view class="flexRowBetween">
<view class="total_money">
<text>收货地址:</text>
<text class="text2">{{address}}</text>
<text class="text2">{{book.Address}}</text>
</view>
</view>
</view>
@ -149,7 +149,7 @@
<view class="flexRowBetween">
<view class="total_money">
<text>收货人:</text>
<text class="text2">{{consignee}}</text>
<text class="text2">{{book.consignee}}</text>
</view>
</view>
</view>
@ -157,7 +157,7 @@
<view class="flexRowBetween">
<view class="total_money">
<text>电话:</text>
<text class="text2">{{phone}}</text>
<text class="text2">{{book.phone}}</text>
</view>
</view>
</view>

@ -31,5 +31,24 @@ Page({
this.setData({
tapCurrent: current
})
<<<<<<< HEAD
}
=======
},
toWode: function () {
wx.showToast({
title: '保存成功!',
icon: 'success',
duration: 2000
})
setTimeout(function () {
//要延时执行的代码
wx.switchTab({
url: "/pages/wode/wode"
})
}, 2000)
},
>>>>>>> f23362a433f70f1876587a01c643e157b7e8b3ae
})

@ -1,5 +1,6 @@
<!--pages/shdz/shdz.wxml-->
<view id="address">
<<<<<<< HEAD
<view class="address_item flexRowBetween">
<view class="address_left">
<view class="text1">
@ -30,4 +31,46 @@
<view class="submit_info" bindtap="towode">保存
</view>
</view>
=======
<view class="address_item flexRowBetween">
<view class="address_left">
<!--<view class="text1">
李雷
</view>-->
<input type="text" placeholder="请输入收货人姓名" placeholder-class="placeholder" bindinput="inputTitle" />
<view class="person-line"></view>
<input type="text" placeholder="请输入收货人地址" placeholder-class="placeholder" bindinput="inputTitle" />
<view class="person-line"></view>
<input type="text" placeholder="请输入收货人电话" placeholder-class="placeholder" bindinput="inputTitle" />
<!--<view class="text1 text_other">
科技路高新大都荟
</view>-->
</view>
<!--
<view class="address_right">
18888888888
</view>-->
</view>
<!--
<view class="address_set flexRowBetween">
<view class="default">
<image src="/pages/index/image/select_active.jpg"></image>
<text>默认地址</text>
</view>
<view class="edit">
<image src="/pages/index/image/edit.jpg"></image>
<text>编辑</text>
</view>
<view class="edit delete">
<image src="/pages/index/image/del.jpg"></image>
<text>删除</text>
</view>
</view>-->
>>>>>>> f23362a433f70f1876587a01c643e157b7e8b3ae
<view class="submit_info" bindtap="toWode">
保存
</view>
</view>

@ -1,4 +1,5 @@
/* pages/shdz/shdz.wxss */
<<<<<<< HEAD
#address{
width:100%;
height:100%;
@ -49,4 +50,88 @@
margin-top:0rpx;
position:absolute;
bottom:120rpx;
=======
#address {
width: 100%;
height: 100%;
background: #f5f5f5;
}
.address_item {
border-bottom: solid 1px #ececec;
padding: 40rpx 25rpx;
background: #fff;
}
.address_left .text1 {
color: #262626;
font-size: 34rpx;
}
.text_other {
margin-top: 30rpx;
}
.address_right {
font-size: 30rpx;
color: #262626;
}
.address_set {
padding: 20px 25rpx;
border-bottom: solid 1px #ececec;
background: #fff;
justify-content: center;
}
.address_set text {
font-size: 24rpx;
}
.address_set .default {
color: #2c9fe1;
width: 71%;
align-items: center;
height: 30rpx;
display: flex;
align-items: center;
}
.address_set .default image {
margin-right: 15px;
width: 29rpx;
height: 29rpx;
}
.address_set .edit image {
width: 26rpx;
height: 26rpx;
margin-right: 10rpx;
}
.edit {
color: #7d7d7d;
width: 15%;
display: flex;
align-items: center;
}
.de_color {
color: #7d7d7d;
}
.submit_info {
margin-top: 0rpx;
position: absolute;
bottom: 120rpx;
}
.person-line {
width: 100%;
height: 2rpx;
background: rgb(211, 211, 211);
margin-left: 0rpx;
>>>>>>> f23362a433f70f1876587a01c643e157b7e8b3ae
}

@ -5,15 +5,14 @@ const api = require('../../utils/api.js');
Page({
data: {
motto: 'Hello World',
search_txt:'',
url: '',
userInfo: {},
hasUserInfo: false,
canIUse: wx.canIUse('button.open-type.getUserInfo'),
imgUrls: [
'../index/image/banner/banner1.jpg',
'../index/image/banner/banner2.jpg',
'../index/image/banner/banner3.jpg'
],
'ppt':[],
'book': [],
indicatorDots: true,
autoplay: true,
interval: 5000,
@ -29,84 +28,129 @@ Page({
onShow() {
},
onLoad: function () {
let that = this;
wx.getStorage({
key: 'bbsProfile',
fail: function (res) {
that.login();
}
})
this.getForum();
if (app.globalData.userInfo) {
this.setData({
userInfo: app.globalData.userInfo,
hasUserInfo: true
})
} else if (this.data.canIUse) {
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
// 所以此处加入 callback 以防止这种情况
app.userInfoReadyCallback = res => {
this.setData({
userInfo: res.userInfo,
hasUserInfo: true
})
}
} else {
// 在没有 open-type=getUserInfo 版本的兼容处理
wx.getUserInfo({
success: res => {
app.globalData.userInfo = res.userInfo
this.setData({
userInfo: res.userInfo,
hasUserInfo: true
})
}
})
}
searchSubmit:function(e){
console.log("in formSubmit: "+e.detail.value)
var thats = this
thats.setData({
search_txt: e.detail.value
},
getUserInfo: function (e) {
console.log(e)
app.globalData.userInfo = e.detail.userInfo
this.setData({
userInfo: e.detail.userInfo,
hasUserInfo: true
})
wx.request({
url: "http://45.76.158.31:8080/web/GetFrontInfo.do?bookname="+e.detail.value+"&fuzzy=true",
header: {
"content-type": "json"
},
getForum() {
let data = {
pageNo: "0",
pageSize: "5"
};
api.getForum({
data,
success: (res) => {
this.setData({
forumList: res.data.content
success: function (res) {
console.log(res.data)
if (res.statusCode == 200) {
thats.setData({
book: res.data,
})
//wx.hideNavigationBarLoading()
}
}
})
},
login() {
let data = {
"username": "3f8bbbfaafda4d3e83e06b689d785e52",
"password": "3f8bbbfaafda4d3e83e06b689d785e52"
}
api.login({
data,
success: (res) => {
wx.setStorage({
key: 'bbsProfile',
data: res.data.item
onLoad: function(options) {
var thats = this
wx.request({
url: "http://45.76.158.31:8080/web/GetFrontInfo.do",
header: {
"content-type": "json"
},
success: function(res) {
console.log(res.data)
if (res.statusCode == 200) {
thats.setData({
book: res.data,
ppt:res.data
})
//wx.hideNavigationBarLoading()
}
}
})
// let that = this;
// wx.getStorage({
// key: 'bbsProfile',
// fail: function(res) {
// that.login();
// }
// })
// // this.getForum();
// if (app.globalData.userInfo) {
// this.setData({
// userInfo: app.globalData.userInfo,
// hasUserInfo: true
// })
// } else if (this.data.canIUse) {
// // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
// // 所以此处加入 callback 以防止这种情况
// app.userInfoReadyCallback = res => {
// this.setData({
// userInfo: res.userInfo,
// hasUserInfo: true
// })
// }
// } else {
// // 在没有 open-type=getUserInfo 版本的兼容处理
// wx.getUserInfo({
// success: res => {
// app.globalData.userInfo = res.userInfo
// this.setData({
// userInfo: res.userInfo,
// hasUserInfo: true
// })
// }
// })
// }
// },
// getUserInfo: function(e) {
// console.log(e)
// app.globalData.userInfo = e.detail.userInfo
// this.setData({
// userInfo: e.detail.userInfo,
// hasUserInfo: true
// })
// },
// getForum() {
// let data = {
// pageNo: "0",
// pageSize: "5"
// };
// api.getForum({
// data,
// success: (res) => {
// this.setData({
// forumList: res.data.content
// })
// }
// })
// },
// login() {
// let data = {
// "username": "3f8bbbfaafda4d3e83e06b689d785e52",
// "password": "3f8bbbfaafda4d3e83e06b689d785e52"
// }
// api.login({
// data,
// success: (res) => {
// wx.setStorage({
// key: 'bbsProfile',
// data: res.data.item
// })
// }
// })
},
toList(e) {
wx.navigateTo({
url: '../logs/logs?id=0',
})
}
// toList(e) {
// wx.navigateTo({
// url: '../logs/logs?id=0',
// })
// }
})

@ -1,55 +1,36 @@
<view class="containers">
<!--<view class="userinfo">
<button wx:if="{{!hasUserInfo && canIUse}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo"> 获取头像昵称 </button>
<block wx:else>
<image bindtap="bindViewTap" class="userinfo-avatar" src="{{userInfo.avatarUrl}}" background-size="cover"></image>
<text class="userinfo-nickname">{{userInfo.nickName}}</text>
</block>
</view>
<view class="usermotto">
<text class="user-motto">{{motto}}</text>
</view>-->
<view class="swiper-ai">
<swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}">
<block wx:for="{{imgUrls}}">
<block wx:for="{{ppt}}" wx:for-item="ppts">
<swiper-item>
<image src="{{item}}" class="slide-image" width="355" height="240" />
<image src="http://45.76.158.31:8080/web/BookImage/{{ppts.BookName}}.jpg" class="slide-image" width="355" height="240" />
</swiper-item>
</block>
</swiper>
</view>
<!--<view>
<label class="weui-search-bar__label" hidden="{{inputShowed}}" bindtap="showInput">
<icon class="weui-icon-search" type="search" size="14"></icon>
<view class="weui-search-bar__text">搜索</view>
</label>
</view>-->
<view class="weui-search-bar__form">
<view class="weui-search-bar__box">
<icon class="weui-icon-search_in-box" type="search" size="14"></icon>
<form bindsubmit="formSubmit">
<input type="text" placeholder="搜索" placeholder-class="placeholder" bindinput="getSearch_txt'" bindconfirm="searchSubmit"/>
<!--
<form bindsubmit="formSubmit" action="">
<input type="text" bindconfirm="bindKeyFirm" class="weui-search-bar__input" placeholder="搜索" value="{{inputVal}}" focus="{{inputShowed}}" bindinput="inputTyping" />
</form>
</form>-->
</view>
</view>
<view class="weui-panel weui-panel_access" style="margin-top:0;">
<view class="weui-panel__hd">推荐模块</view>
<view class="weui-panel__bd">
<navigator wx:for="{{forumList}}" url="../logs/logs?id={{item.id}}" data-id="{{item.id}}" class="weui-media-box weui-media-box_appmsg" hover-class="weui-cell_active">
<navigator wx:for="{{book}}" wx:for-item="books" url="../detail/detail?id={{books.BookID}}" data-id="{{books.BookID}}" class="weui-media-box weui-media-box_appmsg" hover-class="weui-cell_active">
<view class="weui-media-box__hd weui-media-box__hd_in-appmsg" style="width:120px;height:80px;">
<image class="weui-media-box__thumb" src='../index/image/banner/img{{index}}.jpeg' />
<image class="weui-media-box__thumb" src="http://45.76.158.31:8080/web/BookImage/{{books.BookName}}.jpg" />
</view>
<view class="weui-media-box__bd weui-media-box__bd_in-appmsg">
<view class="weui-media-box__title">{{item.forum_name}}</view>
<view class="weui-media-box__desc">{{item.forum_description}}</view>
<view class="weui-media-box__title">{{books.BookName}}</view>
<view class="weui-media-box__desc">{{books.Introduce}}</view>
</view>
</navigator>
</view>
<view class="weui-panel__ft">
<view class="weui-cell weui-cell_access weui-cell_link">
<view class="weui-cell__bd" bindtap="toList">查看更多</view>
<view class="weui-cell__ft weui-cell__ft_in-access"></view>
</view>
</view>
</view>
</view>

@ -22,12 +22,6 @@ Page({
name: '待发货',
url: 'bill',
imageurl: '/pages/index/image/fahuo.png',
},
{
typeId: 3,
name: '待评价',
url: 'bill',
imageurl: '/pages/index/image/pingjia.png'
}
],
},

@ -17,11 +17,13 @@
<view class="separate"></view>
<view class="order" catchtap="toOrder">
<text class="myorder-text">我的订单</text>
<text class="myorderlook-text">查看全部订单</text>
<image class="next-image" src="/pages/index/image/next.png"></image>
</view>
<view class="line"></view>
<view class="navs">
@ -35,16 +37,19 @@
<view class="separate"></view>
<view class="person-list">
<view class="list-item">
<image class="item-image" src="/pages/index/image/wdshoucang.png"></image>
<text class="item-text">我的收藏</text>
</view>
<view class="person-line"></view>
<view class="list-item">
<image class="item-image" bindtap='address' src="/pages/index/image/shdz.png"></image>
<text class="item-text" bindtap='address'>收货地址</text>
</view>
<view class="person-line"></view>
<view class="list-item">
<image class="item-image" src="/pages/index/image/wddd.png" bindtap='toOrder'></image>
<text class="item-text" bindtap='toOrder'>我的订单</text>
@ -54,6 +59,7 @@
<image class="item-image" src="/pages/index/image/wdpj.png"></image>
<text class="item-text">我的评价</text>
</view>
<view class="person-line"></view>
<view class="list-item">
<image class="item-image" src="/pages/index/image/gywm.png"></image>

@ -4,7 +4,7 @@
"ignore": []
},
"setting": {
"urlCheck": true,
"urlCheck": false,
"es6": true,
"postcss": true,
"minified": true,

@ -1,18 +1,19 @@
const apiURL = 'http://47.104.244.32:8100';
const apiURL = 'http://45.76.158.31:8080';
//http://localhost:8080/webapp/BookInfo.do?bookname=%E8%B5%B6&fuzzy=true
let headerData= {
}
headerData['Content-Type']= 'application/json';
let userData ={};
wx.getStorage({
key: 'bbsProfile',
success: function(res) {
userData = res.data;
if(userData.token){
headerData['Authorization']=userData.token;
}
}
})
// wx.getStorage({
// key: 'bbsProfile',
// success: function(res) {
// userData = res.data;
// if(userData.token){
// headerData['Authorization']=userData.token;
// }
// }
// })
const wxRequest = (params, url) => {
@ -43,7 +44,9 @@ const wxRequest = (params, url) => {
};
const getForum = (params) => {
console.log(params)
wxRequest(params, `${apiURL}/forumManagement/getForum`);
};
const getQuestion = (params) => {
wxRequest(params, `${apiURL}/question/getQuestion`);

Loading…
Cancel
Save