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/login/login",
"pages/index/index",
"pages/search/search",
"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 */
/* Document
@ -174,7 +186,8 @@ textarea {
*/
button,
input { /* 1 */
input {
/* 1 */
overflow: visible;
}
@ -184,7 +197,8 @@ input { /* 1 */
*/
button,
select { /* 1 */
select {
/* 1 */
text-transform: none;
}
@ -349,5 +363,5 @@ template {
}
image {
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({
properties: {},
properties: {
img:String,
title:String,
id:String,
price:String
},
data: {},
methods: {
gotodetail() {

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,4 @@
<view class="box">
<search bind:tap="searchs"></search>
<list></list>
<list list="{{list}}"></list>
</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: {
openid:"",
username:"啦啦啦"
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
this.setData({
openid:wx.getStorageSync("openid")
})
},
toorder() {
wx.navigateTo({

View File

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

View File

@ -4,15 +4,23 @@
"ignore": []
},
"setting": {
"urlCheck": true,
"urlCheck": false,
"es6": true,
"postcss": true,
"minified": true,
"newFeature": true,
"autoAudits": false,
"coverView": true,
"autoAudits": false,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false
"scopeDataCheck": false,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
}
},
"compileType": "miniprogram",
"libVersion": "2.9.4",

View File

@ -2,15 +2,24 @@
let request = function (obj){
let {
url,
data,
method,
header,
dataType,
responseType,
complete
} = 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)=>{
Wx.request({
wx.request({
url,
data,
method,
header,
dataType,