goeasy + login

This commit is contained in:
2021-04-06 14:05:14 +08:00
parent 39e00f1811
commit 3ec8d96fff
11 changed files with 151 additions and 10 deletions

View File

@@ -47,10 +47,6 @@ Page({
// map: wx.createMapContext('map')
// })
// console.log(this.data.map)
wx.login({
success(res){
console.log(res.code)
}
})
}
})

View File

@@ -6,7 +6,7 @@ page{
width: 100%;
height: 100%;
.map{
width: 100%;
height: 100%;
width: 750rpx;
height: 100vh;
}
}

View File

@@ -9,6 +9,6 @@ page {
}
.container .map {
width: 100%;
height: 100%;
width: 750rpx;
height: 100vh;
}

View File

@@ -1,4 +1,18 @@
import {login} from "../../utils/api"
Page({
data:{
show: true
},
denglu(a){
console.log(a,123)
wx.login({
success(code){
login({code: code.code}).then((res)=>{
console.log(res)
})
}
})
},
tiaozhuan(){
wx.navigateTo({
url:"/pages/ltjm/ltjm"

View File

@@ -1,4 +1,6 @@
{
"usingComponents": {},
"usingComponents": {
"van-popup": "../../miniprogram_npm/@vant/weapp/popup/index"
},
"navigationBarTitleText": "聊天"
}

View File

@@ -33,4 +33,39 @@ page{
}
}
}
.showquan{
width: 500rpx;
height: 338rpx;
border-radius: 5rpx;
display: flex;
flex-direction: column;
align-items: center;
padding: 14rpx;
.title{
width: 100%;
font-size: 34rpx;
color: #000;
border-bottom: 2rpx solid #dadada;
line-height: 80rpx;
text-align: center;
}
.text{
font-size: 29rpx;
color: #999;
line-height: 56rpx;
width: 362rpx;
text-align: center;
margin-top: 25rpx;
}
.button{
width: 424rpx;
height: 65rpx;
border-radius: 5rpx;
background-color: #3399CC;
color: #fff;
line-height: 65rpx;
font-size: 30rpx;
margin-top: 35rpx;
}
}
}

View File

@@ -6,4 +6,12 @@
<text class="text">texttexttext</text>
</view>
</view>
<van-popup show="{{ show }}" bind:close="onClose">
<view class="showquan">
<view class="title">授权登录</view>
<view class="text">您尚未授权您的基本信息,
是否立即授权?</view>
<button type="primary" class="button" open-type="getUserInfo" bindgetuserinfo="denglu">立即授权</button>
</view>
</van-popup>
</view>

View File

@@ -36,3 +36,42 @@
font-size: 20rpx;
color: #999;
}
.box .showquan {
width: 500rpx;
height: 338rpx;
border-radius: 5rpx;
display: flex;
flex-direction: column;
align-items: center;
padding: 14rpx;
}
.box .showquan .title {
width: 100%;
font-size: 34rpx;
color: #000;
border-bottom: 2rpx solid #dadada;
line-height: 80rpx;
text-align: center;
}
.box .showquan .text {
font-size: 29rpx;
color: #999;
line-height: 56rpx;
width: 362rpx;
text-align: center;
margin-top: 25rpx;
}
.box .showquan .button {
width: 424rpx;
height: 65rpx;
border-radius: 5rpx;
background-color: #3399CC;
color: #fff;
line-height: 65rpx;
font-size: 30rpx;
margin-top: 35rpx;
}

5
utils/api.js Normal file
View File

@@ -0,0 +1,5 @@
import {get,post} from "./request"
export function login(data){
return get('/login/login',data)
}

2
utils/goeasy-1.2.1.js Normal file

File diff suppressed because one or more lines are too long

40
utils/request.js Normal file
View File

@@ -0,0 +1,40 @@
const BASEURL = "http://192.168.3.122:8080";
export function get(url,data, baseurl = BASEURL){
return new Promise((res,err)=>{
let d = "?";
for(let i in data){
d += i + '=' + data[i] + "&";
}
if(d == "?"){
d = ""
}
wx.request({
url: baseurl + url + d,
success(r){
try {
r.data.data = JSON.parse(r.data.data)
res(r)
} catch (error) {
res(r)
}
},
error(e){
err(e)
}
})
})
}
export function post(url,data, baseurl = BASEURL){
return new Promise((res,err)=>{
wx.request({
url: baseurl + url,
data,
success(r){
res(r)
},
error(e){
err(e)
}
})
})
}