Explorar el Código

gxx

tags/2.2.4
batman hace 6 años
padre
commit
cc9f240c6b
Se han modificado 15 ficheros con 282 adiciones y 278 borrados
  1. +35
    -8
      app.js
  2. +4
    -4
      app.json
  3. +6
    -5
      components/coupons/index.js
  4. +6
    -6
      components/coupons/index.wxml
  5. +13
    -61
      pages/coupons/details/index.js
  6. +5
    -1
      pages/coupons/details/index.wxml
  7. +12
    -0
      pages/index/coupons/index.js
  8. +0
    -65
      pages/index/index.js
  9. +7
    -61
      pages/login/index.js
  10. +51
    -61
      pages/market/index.js
  11. +4
    -2
      pages/market/index.json
  12. +33
    -1
      pages/market/index.wxml
  13. +33
    -0
      pages/market/index.wxss
  14. +3
    -3
      project.config.json
  15. +70
    -0
      utils/http.js

+ 35
- 8
app.js Ver fichero

@@ -1,11 +1,34 @@
//app.js


App({
onLaunch: function () {
data: {
appId: ''
},
onLaunch: function() {
// 登录
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
console.log("login", res);
wx.request({
url: 'https://ciformall.youlane.cn/C/api/user/login',
header: {
"content-type": "application/json;charset=UTF-8"
},
data: {
appId: "wx649b3be73c1afe47",
code: res.code
},
method: 'POST',
success: function(result) {
console.log(result)
}
})
// Http.postResquest('/api/user/login', '登录中', {
// appId: "wx649b3be73c1afe47",
// code: result.code
// }, (res) => {
// console.log(res)
// })
}
})
// 获取用户信息
@@ -38,13 +61,13 @@ App({
/**
* 获取地址位置信息
*/
getLocation:function (){
getLocation: function() {
wx.getLocation({
type: 'wgs84',
success: function (res) {
success: function(res) {
console.log("getLocation", res);
},
fail:error=>{
fail: error => {
console.log(error);
}
})
@@ -53,8 +76,12 @@ App({
// 当前用户信息
userInfo: null,
// 当前商场信息
market:{
name:"陕西大悦城"
market: {
name: "陕西大悦城"
}
},
getAppid() {
let appId = "wx649b3be73c1afe47"
return appId
}
})

+ 4
- 4
app.json Ver fichero

@@ -1,8 +1,9 @@
{
"pages": [
"pages/login/index",
"pages/index/index",
"pages/market/index",
"pages/user/index",
"pages/index/index",
"pages/login/index",
"pages/coupons/index/index",
"pages/coupons/details/index",
"pages/order/index/index",
@@ -10,8 +11,7 @@
"pages/rushToBuy/index",
"pages/shop/index/index",
"pages/shop/details/index",
"pages/success/index",
"pages/market/index"
"pages/success/index"
],
"tabBar": {
"color":"#9F9F9F",


+ 6
- 5
components/coupons/index.js Ver fichero

@@ -16,11 +16,12 @@ Component({
data: {

},

/**
* 组件的方法列表
*/
methods: {

onLogin(e){
let { id } = e.currentTarget.dataset.date;
wx.navigateTo({
url: `../../pages/coupons/details/index?id=${id}`,
})
}
}
})

+ 6
- 6
components/coupons/index.wxml Ver fichero

@@ -1,21 +1,21 @@
<view class="coupons">
<view class="coupons-img">
<image src="{{data.img}}"></image>
<image src="{{data.coverImg}}"></image>
</view>
<view class="coupons-info">
<view class="coupons-info-name">{{data.name}}</view>
<view class="coupons-info-price">
<text class="coupons-info-price-p">¥{{data.pPrice}}</text>
<text class="coupons-info-price-o">¥{{data.oPrice}}</text>
<text class="coupons-info-price-p">¥{{data.price}}</text>
<text class="coupons-info-price-o">¥{{data.salePrice}}</text>
</view>
<view class="coupons-info-distance">
<text class="iconfont icon-dingweib"></text>
{{data.distance}}
{{data.salePrice}}
</view>
<view class="coupons-info-address">{{data.address}}</view>
<view class="coupons-info-address">{{data.salePrice}}</view>
</view>
<view class="coupons-btn">
<i-button i-class="coupons-btn-gm" bind:click="onLogin">购买</i-button>
<i-button i-class="coupons-btn-gm" bind:click="onLogin" data-date='{{data}}'>购买</i-button>
</view>
<view class="coupons-border"></view>
</view>

+ 13
- 61
pages/coupons/details/index.js Ver fichero

@@ -1,65 +1,17 @@
Page({
let Http = require('../../../utils/http.js')

/**
* 页面的初始数据
*/
Page({
data: {
},

/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},

/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},

/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},

/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},

/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},

/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},

/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},

/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
list:{}
},
onLoad(e) {
console.log(this.data)
Http.getResquest('/wxCoupon/findById','加载中',{
id: e.id
},(res)=>{
this.setData({
list: res.data
})
})
}
})

+ 5
- 1
pages/coupons/details/index.wxml Ver fichero

@@ -1 +1,5 @@
<text>pages/t/index.wxml</text>
<view class='coupons'>
<image src='{{list.coverImg}}'></image>
<text>{{list.subTitle}}</text>
<text>{{list.title}}</text>
</view>

+ 12
- 0
pages/index/coupons/index.js Ver fichero

@@ -1,4 +1,6 @@
// pages/index/sw/index.js

let Http = require('../../../utils/http.js')
Component({
/**
* 组件的属性列表
@@ -99,5 +101,15 @@ Component({
current_scroll: detail.key
});
},
},
ready(){
Http.getResquest("/wxCoupon/list",'加载中',{
"pageNum":1,
"pageSize":10
},(res)=>{
this.setData({
list:res.data.list
})
})
}
})

+ 0
- 65
pages/index/index.js Ver fichero

@@ -14,76 +14,11 @@ Page({
'http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg'
],
swiperCurrent: 0,
scrollTop: 0
},

swiperChange: function (e) {
this.setData({
swiperCurrent: e.detail.current
})
},
//页面滚动执行方式
onPageScroll(event) {
// console.log(event.scrollTop);
// this.setData({
// scrollTop: event.scrollTop
// })
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {

},

/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {

},

/**
* 生命周期函数--监听页面显示
*/
onShow: function () {

},

/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {

},

/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {

},

/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {

},

/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {

},

/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {

}
})

+ 7
- 61
pages/login/index.js Ver fichero

@@ -1,68 +1,14 @@
Page({

/**
* 页面的初始数据
*/
data: {

},

/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {

},

/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {

},

/**
* 生命周期函数--监听页面显示
*/
onShow: function () {

},

/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {

},

/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {

},

/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {

},

/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
let app = getApp()

Page({
data: {
appId: app.getAppid()
},

/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {

onLoad() {
},
onLogin: function () {
onLogin: function() {
console.log("登陆");
}
})

+ 51
- 61
pages/market/index.js Ver fichero

@@ -1,65 +1,55 @@
Page({

/**
* 页面的初始数据
*/
data: {
tabs: [{
key: 1,
name: "全部"
},
{
key: 2,
name: "待付款"
},
{
key: 3,
name: "已完成"
}
],
list:[
{
key:'1',
data:[
{
name:'111'
}
]
},
{
key: '2',
data: [
{
name: '222'
}
]
},
{
key: '3',
data: [
{
name: '333'
}
]
}
],
current:'',
current_scroll:'1'
},
handleChange({detail}) {
this.setData({
current: detail.key
});
},
handleChangeScroll({detail}) {
this.setData({
current_scroll: detail.key
});
},

/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},

/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},

/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},

/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},

/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},

/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},

/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},

/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

+ 4
- 2
pages/market/index.json Ver fichero

@@ -1,6 +1,8 @@
{
"usingComponents": {
"i-tab": "../../dist/tab/index",
"i-tabs": "../../dist/tabs/index",
"c-coupons": "../../components/coupons/index"
},
"navigationBarTitleText": "商场列表"
"navigationBarTitleText": "我的订单"
}

+ 33
- 1
pages/market/index.wxml Ver fichero

@@ -1 +1,33 @@
<text>pages/t/index.wxml</text>
<view class="market">
<i-tabs class='tabs' current="{{ current_scroll }}" scroll bindchange="handleChangeScroll">
<i-tab class='i-tab' wx:for="{{tabs}}" wx:key="unique" key="{{item.key}}" title="{{item.name}}"></i-tab>
</i-tabs>
<view class='section'>
<view class='detail_msg'>
<view>
<view>
<image src='http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg'></image>
</view>
<view>
<view>
<text>黑椒牛排</text>
<text>等待付款</text>
</view>
<view>
<text>购买数量:<text>1件</text></text>
</view>
<view>
<text>下单时间:<text>2018-07-10 11:30</text></text>
</view>
</view>
</view>
<view>
<text>¥1.00 <text>¥59.90</text></text>
<text>支付</text>
</view>
</view>
<!-- <view wx:for='{{list}}' wx:key='{{index}}' wx:if='{{current_scroll==item.key}}'>
<text wx:for='{{item.data}}' wx:key='{{index}}'>{{item.name}}</text>
</view> -->
</view>
</view>

+ 33
- 0
pages/market/index.wxss Ver fichero

@@ -0,0 +1,33 @@
.market{
width: 100%;
}
.tabs{
width: 100%!important;
height: 88rpx;
text-align: center;
}
.i-tab{
width: 30%!important;
display: inline-block;
}
.detail_msg{
width: 100%;
height: 416rpx!important;
background: #fff;
margin-top: 2%;
display: flex;
flex-direction: column;
}
.detail_msg>view:nth-child(1) {
width: 100%;
height: 244rpx;
}
.detail_msg>view:nth-child(1) view:nth-child(1) {
width: 248rpx;
height: 184rpx;
}
.detail_msg>view:nth-child(1)>view:nth-child(1) image{
width: 100%;
height: 100%;
margin: 13.2% 0 0 13%;
}

+ 3
- 3
project.config.json Ver fichero

@@ -4,7 +4,7 @@
"ignore": []
},
"setting": {
"urlCheck": true,
"urlCheck": false,
"es6": true,
"postcss": true,
"minified": true,
@@ -12,8 +12,8 @@
},
"compileType": "miniprogram",
"libVersion": "2.2.2",
"appid": "wxff8123ffb9235426",
"projectname": "wx_luxuriant",
"appid": "wx649b3be73c1afe47",
"projectname": "C",
"isGameTourist": false,
"condition": {
"search": {


+ 70
- 0
utils/http.js Ver fichero

@@ -0,0 +1,70 @@
let host = 'https://cinformall.youlane.cn/C';
let openId="12313213";
const postResquest = (url, message, postData, doSuccess, doFail) => {
let body={...postData};
body["openid"] = openId;
if (message != "") {
wx.showLoading({
title: message,
})
}
wx.request({
//项目的真正接口,通过字符串拼接方式实现
url: host + url,
header: {
"content-type": "application/json;charset=UTF-8"
},
data: body,
method: 'POST',
success: function (res) {
//参数值为res.data,直接将返回的数据传入
if (message != "") {
wx.hideLoading()
};
doSuccess(res.data);
},
fail: function (res) {
if (message != "") {
wx.hideLoading()
};
wx.showToast({
title: '网络错误',
})
},
})
}
const getResquest = (url, message, getData, doSuccess, doFail) => {
let body = { ...getData };
body["openid"] = openId;
if (message != "") {
wx.showLoading({
title: message,
})
}
wx.request({
url: host + url,
header: {
"content-type": "application/json;charset=UTF-8"
},
data: body,
method: 'GET',
success: function (res) {
if (message != "") {
wx.hideLoading()
};
doSuccess(res.data);
},
fail: function (res) {
if (message != "") {
wx.hideLoading()
};
wx.showToast({
title: '网络错误',
})
},
})
}
module.exports = {
postResquest: postResquest,
getResquest: getResquest
}

Cargando…
Cancelar
Guardar