pplok #22

Manually merged
theluyuan merged 4 commits from pplok into master 2019-12-19 09:33:21 +08:00
26 changed files with 221 additions and 48 deletions

View File

@ -1,6 +1,7 @@
{ {
"pages": [ "pages": [
"pages/index/index", "pages/index/index",
"pages/login/login",
"pages/search/search", "pages/search/search",
"pages/shopping/shopping", "pages/shopping/shopping",
"pages/classify/classify", "pages/classify/classify",

View File

@ -1,3 +1,5 @@
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
/* Document /* Document
@ -174,7 +176,8 @@ textarea {
*/ */
button, button,
input { /* 1 */ input {
/* 1 */
overflow: visible; overflow: visible;
} }
@ -184,7 +187,8 @@ input { /* 1 */
*/ */
button, button,
select { /* 1 */ select {
/* 1 */
text-transform: none; text-transform: none;
} }
@ -349,5 +353,5 @@ template {
} }
image { image {
background-size: cover; background-size: cover;
background-image: url('http://luyuan.tk/static/images/TIM%E5%9B%BE%E7%89%8720191214113605.jpg'); background-image: url("http://luyuan.tk/static/images/TIM%E5%9B%BE%E7%89%8720191214113605.jpg");
} }

View File

@ -2,7 +2,14 @@ Component({
properties: { properties: {
}, },
data: { data: {
id:0
}, },
methods: { methods: {
select(a){
// console.log(a.target.dataset.id)
this.setData({
id:a.target.dataset.id
})
}
} }
}) })

View File

@ -1,10 +1,10 @@
<scroll-view class="navigation" scroll-y="{{true}}" > <scroll-view class="navigation" scroll-y="{{true}}" bind:tap="select" >
<view class="on">热门商品</view> <view data-id="0" class="{{id == 0?'on' : ''}}">热门商品</view>
<view>美容健身</view> <view data-id="1" class="{{id == 1?'on' : ''}}">美容健身</view>
<view>美容健身</view> <view data-id="2" class="{{id == 2?'on' : ''}}">美容健身</view>
<view>美容健身</view> <view data-id="3" class="{{id == 3?'on' : ''}}">美容健身</view>
<view>美容健身</view> <view data-id="4" class="{{id == 4?'on' : ''}}">美容健身</view>
<view>美容健身</view> <view data-id="5" class="{{id == 5?'on' : ''}}">美容健身</view>
<view>美容健身</view> <view data-id="6" class="{{id == 6?'on' : ''}}">美容健身</view>
<view>美容健身</view> <view data-id="7" class="{{id == 7?'on' : ''}}">美容健身</view>
</scroll-view> </scroll-view>

View File

@ -1,5 +1,10 @@
Component({ Component({
properties: {}, properties: {
img:String,
title:String,
id:String,
price:String
},
data: {}, data: {},
methods: { methods: {
gotodetail() { gotodetail() {

View File

@ -25,12 +25,22 @@
font-size: 26rpx; font-size: 26rpx;
color: #333; color: #333;
margin-bottom: 22rpx; margin-bottom: 22rpx;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
} }
> view { > view {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
> text:first-child { > text:first-child {
font-size: 30rpx; font-size: 30rpx;
color: #dec499; color: #dec499;
} }

View File

@ -1,10 +1,10 @@
<view class="commodity" bindtap="gotodetail"> <view class="commodity" bindtap="gotodetail">
<view class="content"> <view class="content">
<image class="imgthumb "></image> <image class="imgthumb " src="{{img}}"></image>
<view class="introduce"> <view class="introduce">
<text>产品名称产品名称产品名称产品名称产品名称产品名称产品名称</text> <text class="towline">{{title}}</text>
<view> <view>
<text>¥657</text> <text>¥{{price}}</text>
<text>加入购物车</text> <text>加入购物车</text>
</view> </view>
</view> </view>

View File

@ -1 +1 @@
.commodity{width:623rpx;height:143rpx;margin-top:32rpx;display:flex;align-items:center}.commodity .content{width:614rpx;height:100%;display:flex;align-items:center;box-shadow:0 0 24rpx 0 rgba(227,227,227,0.4)}.commodity .content .imgthumb{width:105rpx;height:105rpx;margin-left:40rpx;background-color:#333}.commodity .content .introduce{width:410rpx;margin-left:40rpx;display:flex;flex-direction:column}.commodity .content .introduce>text{font-size:26rpx;color:#333;margin-bottom:22rpx}.commodity .content .introduce>view{display:flex;align-items:center;justify-content:space-between}.commodity .content .introduce>view>text:first-child{font-size:30rpx;color:#dec499}.commodity .content .introduce>view>text:last-child{font-size:22rpx;color:#999}.commodity .decorate{width:9rpx;height:102rpx;background-color:#3fb66e} .commodity{width:623rpx;height:143rpx;margin-top:32rpx;display:flex;align-items:center}.commodity .content{width:614rpx;height:100%;display:flex;align-items:center;box-shadow:0 0 24rpx 0 rgba(227,227,227,0.4)}.commodity .content .imgthumb{width:105rpx;height:105rpx;margin-left:40rpx;background-color:#333}.commodity .content .introduce{width:410rpx;margin-left:40rpx;display:flex;flex-direction:column}.commodity .content .introduce>text{font-size:26rpx;color:#333;margin-bottom:22rpx;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.commodity .content .introduce>view{display:flex;align-items:center;justify-content:space-between}.commodity .content .introduce>view>text:first-child{font-size:30rpx;color:#dec499}.commodity .content .introduce>view>text:last-child{font-size:22rpx;color:#999}.commodity .decorate{width:9rpx;height:102rpx;background-color:#3fb66e}

View File

@ -1,5 +1,6 @@
Component({ Component({
properties: { properties: {
list:Array
}, },
data: { data: {
}, },

View File

@ -1,4 +1,4 @@
<view class="list"> <view class="list">
<text class="title">热门商品</text> <text class="title">热门商品</text>
<commodity></commodity> <commodity wx:for="{{list}}" title="{{item.goods_name}}" price="{{item.shop_price}}" img="{{item.image}}"></commodity>
</view> </view>

View File

@ -14,13 +14,28 @@ Component({
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {
num: 5
}, },
/** /**
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
rm() {
if (this.data.num == 0) {
return
} else {
this.setData({
num: this.data.num - 1
})
}
},
add() {
this.setData({
num: this.data.num + 1
})
}
} }
}) })

View File

@ -9,8 +9,8 @@
<view class="price">${{price}}</view> <view class="price">${{price}}</view>
</view> </view>
<view class="numberset"> <view class="numberset">
<view class="reverse"></view> <view class="reverse" bind:tap="rm">-</view>
<view class="num">5</view> <view class="num">{{num}}</view>
<view class="add"></view> <view class="add" bind:tap="add">+</view>
</view> </view>
</view> </view>

View File

@ -63,11 +63,13 @@
} }
.reverse { .reverse {
width: 19rpx; width: 23rpx;
height: 3rpx; height: 23rpx;
background-color: #97DFB4; /* background-color: #97DFB4; */
margin: 0 auto; margin: 0 auto;
margin-top: 25rpx; margin-top: 20rpx;
line-height: 23rpx;
font-size: 46rpx;
} }
.num { .num {
@ -79,7 +81,8 @@
.add { .add {
width: 23rpx; width: 23rpx;
height: 23rpx; height: 23rpx;
background-color: #242424; /* background-color: #242424; */
margin: 0 auto; margin: 0 auto;
margin-bottom: 17rpx; margin-bottom: 17rpx;
line-height: 23rpx;
} }

View File

@ -1,9 +1,20 @@
import {request} from "../../utils/bin"
Page({ Page({
data:{ data:{
list:[]
}, },
onLoad(){ onLoad(){
request({
url:"Goods/hotGoodsList",
data:{
page:0
}
}).then((res)=>{
console.log(res.data.result)
this.setData({
list:res.data.result
})
})
}, },
searchs(){ searchs(){
console.log(10) console.log(10)

View File

@ -1,4 +1,4 @@
<view class="box"> <view class="box">
<search bind:tap="searchs"></search> <search bind:tap="searchs"></search>
<list></list> <list list="{{list}}"></list>
</view> </view>

86
pages/login/login.js Normal file
View File

@ -0,0 +1,86 @@
// pages/login/login.js
import {request} from "../../utils/bin"
Page({
/**
* 页面的初始数据
*/
data: {
},
login(a){
console.log(a)
wx.login({
success (res) {
if (res.code) {
//发起网络请求
request({
url:"User/getopenId",
data:{
js_code:res.code
}
}).then((res)=>{
console.log(res)
})
} else {
console.log('登录失败!' + res.errMsg)
}
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

3
pages/login/login.json Normal file
View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

3
pages/login/login.wxml Normal file
View File

@ -0,0 +1,3 @@
<view>
<button open-type="getUserInfo" bindgetuserinfo="login">登录</button>
</view>

1
pages/login/login.wxss Normal file
View File

@ -0,0 +1 @@
/* pages/login/login.wxss */

View File

@ -5,14 +5,17 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
openid:"",
username:"啦啦啦"
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function(options) { onLoad: function(options) {
this.setData({
openid:wx.getStorageSync("openid")
})
}, },
toorder() { toorder() {
wx.navigateTo({ wx.navigateTo({

View File

@ -2,7 +2,7 @@
<view class="card"> <view class="card">
<view class="user"> <view class="user">
<image class="head"></image> <image class="head"></image>
<text>于于于宇于</text> <text bind:tap="login">{{openid == ""?'点击登录':username}}</text>
</view> </view>
<view class="balance"> <view class="balance">
<text>账户余额</text> <text>账户余额</text>

View File

@ -5,7 +5,7 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
list:[1,1,1]
}, },
/** /**

View File

@ -1,5 +1,8 @@
<view class="shopping"> <view class="shopping">
<view class="item"> <view class="item" wx:for="{{list}}" wx:for-index="j" wx:if = "{{item == 1}}" wx:key="{{j}}">
<shopping-item shopname="J`adore - Dior" shopdesc="30支 1.30kg" price="61.78"></shopping-item>
</view>
<!-- <view class="item">
<shopping-item shopname="J`adore - Dior" shopdesc="30支 1.30kg" price="61.78"></shopping-item> <shopping-item shopname="J`adore - Dior" shopdesc="30支 1.30kg" price="61.78"></shopping-item>
</view> </view>
<view class="item"> <view class="item">
@ -7,10 +10,7 @@
</view> </view>
<view class="item"> <view class="item">
<shopping-item shopname="J`adore - Dior" shopdesc="30支 1.30kg" price="61.78"></shopping-item> <shopping-item shopname="J`adore - Dior" shopdesc="30支 1.30kg" price="61.78"></shopping-item>
</view> </view> -->
<view class="item">
<shopping-item shopname="J`adore - Dior" shopdesc="30支 1.30kg" price="61.78"></shopping-item>
</view>
<view class="bottom"> <view class="bottom">
<view class="left"> <view class="left">
<view class="select"></view> <view class="select"></view>

View File

@ -1,3 +1,6 @@
.shopping{
padding-bottom: 128rpx;
}
.item { .item {
height: 186rpx; height: 186rpx;
margin-left: 46rpx; margin-left: 46rpx;

View File

@ -4,19 +4,27 @@
"ignore": [] "ignore": []
}, },
"setting": { "setting": {
"urlCheck": true, "urlCheck": false,
"es6": true, "es6": true,
"postcss": true, "postcss": true,
"minified": true, "minified": true,
"newFeature": true, "newFeature": true,
"autoAudits": false,
"coverView": true, "coverView": true,
"autoAudits": false,
"showShadowRootInWxmlPanel": true, "showShadowRootInWxmlPanel": true,
"scopeDataCheck": false "scopeDataCheck": false,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
}
}, },
"compileType": "miniprogram", "compileType": "miniprogram",
"libVersion": "2.9.4", "libVersion": "2.9.4",
"appid": "wx5766b7aac7c938b3", "appid": "wxb9033316008de1ce",
"projectname": "deguodaigou", "projectname": "deguodaigou",
"debugOptions": { "debugOptions": {
"hidedInDevtools": [] "hidedInDevtools": []

View File

@ -2,15 +2,24 @@
let request = function (obj){ let request = function (obj){
let { let {
url, url,
data,
method, method,
header, header,
dataType, dataType,
responseType, responseType,
complete complete
} = obj } = obj
url="http://daigou.sdbairui.com/index.php/WXAPI/" + url
if(method == "POST" || method == "post"){
if(header == undefined){
header ={}
}
header['content-type'] = "application/x-www-form-urlencoded"
}
return new Promise((res,rej)=>{ return new Promise((res,rej)=>{
Wx.request({ wx.request({
url, url,
data,
method, method,
header, header,
dataType, dataType,