pplok #22

Manually merged
theluyuan merged 4 commits from pplok into master 2019-12-19 09:33:21 +08:00
16 changed files with 166 additions and 21 deletions
Showing only changes of commit 3166463ac4 - Show all commits

View File

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

View File

@ -1,3 +1,15 @@
.towline {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
/*! 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
@ -8,7 +20,7 @@
* 2. Prevent adjustments of font size after orientation changes in iOS. * 2. Prevent adjustments of font size after orientation changes in iOS.
*/ */
html { html {
line-height: 1; /* 1 */ line-height: 1; /* 1 */
-webkit-text-size-adjust: 100%; /* 2 */ -webkit-text-size-adjust: 100%; /* 2 */
} }
@ -174,7 +186,8 @@ textarea {
*/ */
button, button,
input { /* 1 */ input {
/* 1 */
overflow: visible; overflow: visible;
} }
@ -184,7 +197,8 @@ input { /* 1 */
*/ */
button, button,
select { /* 1 */ select {
/* 1 */
text-transform: none; text-transform: none;
} }
@ -347,7 +361,7 @@ template {
[hidden] { [hidden] {
display: none; display: none;
} }
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

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

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,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

@ -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

@ -4,15 +4,23 @@
"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",

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,