Commit 3139a14e by biao

1

parent e9cffd77
......@@ -40,10 +40,12 @@ if(!empty($jsCode)) {
$tmpUserMst = UserMst::getList($param,'id','desc', 0, 1);
if(empty($tmpUserMst)) {
$result["openId"] = $openId;
$result["unionId"] = $unionId;
$result["message"] = "未注册!";
responseOK($result);
} else {
$result["openId"] = $openId;
$result["unionId"] = $unionId;
$result["message"] = "已注册!";
responseNG($result);
}
......
......@@ -2,7 +2,14 @@
App({
url: 'https://www.koala-online.cn/compass/if/',
onLaunch: function () {
this.checkUser();
//调用wx用户登陆
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
this.checkUserRegisted(res.code, null);
}
})
var config = wx.getStorageSync('config');
var that = this;
//获取用户的经纬度信息
......@@ -47,41 +54,6 @@ App({
})
}
})
// 展示本地存储能力
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
// var config = wx.getStorageSync('config');
// if(!config){
// wx.login({
// success: res => {
// // 发送 res.code 到后台换取 openId, sessionKey, unionId
// this.checkUser(res.code, null);
// console.log(res,11)
// }
// })
// }else{
// this.checkUser(null, res.openId);
// console.log(res.openId,22)
// }
// wx.getStorage({
// key: 'config',
// success: function(res) {
// console.log('res')
// if(!res){
// wx.login({
// success: res => {
// // 发送 res.code 到后台换取 openId, sessionKey, unionId
// this.checkUser(res.code,null);
// }
// })
// }else{
// this.checkUser(null,res.openId);
// }
// },
// })
// 登录
// 获取用户信息
wx.getSetting({
......@@ -104,7 +76,9 @@ App({
}
})
},
checkUser:function(code,openid){
//判断用户是否已经注册
checkUserRegisted:function(code,openid){
wx.request({
url: this.url + 'ajax_check_user_registed.php',
data: {
......@@ -115,17 +89,11 @@ App({
'content-type': 'application/json' // 默认值
},
success(res) {
console.log(res, '成功调用checkUser方法')
// if(res.data.result.message=="未注册")
if (res.data.status=='OK'){
wx.showModal({
title: '提示',
content: '成功调用checkUser方法',
})
let config={
openId:res.result.openId,
unionId:res.result.unionId,
zhuce: res.data.result.message
//保存返回的openId和unionId
let config = {
openId: res.data.result.openId,
unionId: res.data.result.unionId,
};
wx.setStorage({
key: 'config',
......
src/wx/img/1.jpg

20.2 KB | W: | H:

src/wx/img/1.jpg

50 KB | W: | H:

src/wx/img/1.jpg
src/wx/img/1.jpg
src/wx/img/1.jpg
src/wx/img/1.jpg
  • 2-up
  • Swipe
  • Onion skin
src/wx/img/2.jpg

36.7 KB | W: | H:

src/wx/img/2.jpg

38.6 KB | W: | H:

src/wx/img/2.jpg
src/wx/img/2.jpg
src/wx/img/2.jpg
src/wx/img/2.jpg
  • 2-up
  • Swipe
  • Onion skin
<!--pages/jigouRegistered/jigouRegistered.wxml-->
<view class='jigouRegistered'>
<image src='../../img/1.jpg'></image>
<image src='../../img/2.jpg'></image>
<view class='formtable'>
<view>
<text>姓名:</text>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment