登录
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
86
pages/login/login.js
Normal 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
3
pages/login/login.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
||||
3
pages/login/login.wxml
Normal file
3
pages/login/login.wxml
Normal file
@@ -0,0 +1,3 @@
|
||||
<view>
|
||||
<button open-type="getUserInfo" bindgetuserinfo="login">登录</button>
|
||||
</view>
|
||||
1
pages/login/login.wxss
Normal file
1
pages/login/login.wxss
Normal file
@@ -0,0 +1 @@
|
||||
/* pages/login/login.wxss */
|
||||
@@ -5,14 +5,17 @@ Page({
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
openid:"",
|
||||
username:"啦啦啦"
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function(options) {
|
||||
|
||||
this.setData({
|
||||
openid:wx.getStorageSync("openid")
|
||||
})
|
||||
},
|
||||
toorder() {
|
||||
wx.navigateTo({
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user