Commit 3139a14e by biao

1

parent e9cffd77
...@@ -40,10 +40,12 @@ if(!empty($jsCode)) { ...@@ -40,10 +40,12 @@ if(!empty($jsCode)) {
$tmpUserMst = UserMst::getList($param,'id','desc', 0, 1); $tmpUserMst = UserMst::getList($param,'id','desc', 0, 1);
if(empty($tmpUserMst)) { if(empty($tmpUserMst)) {
$result["openId"] = $openId; $result["openId"] = $openId;
$result["unionId"] = $unionId;
$result["message"] = "未注册!"; $result["message"] = "未注册!";
responseOK($result); responseOK($result);
} else { } else {
$result["openId"] = $openId; $result["openId"] = $openId;
$result["unionId"] = $unionId;
$result["message"] = "已注册!"; $result["message"] = "已注册!";
responseNG($result); responseNG($result);
} }
......
...@@ -2,7 +2,14 @@ ...@@ -2,7 +2,14 @@
App({ App({
url: 'https://www.koala-online.cn/compass/if/', url: 'https://www.koala-online.cn/compass/if/',
onLaunch: function () { 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 config = wx.getStorageSync('config');
var that = this; var that = this;
//获取用户的经纬度信息 //获取用户的经纬度信息
...@@ -47,41 +54,6 @@ App({ ...@@ -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({ wx.getSetting({
...@@ -104,7 +76,9 @@ App({ ...@@ -104,7 +76,9 @@ App({
} }
}) })
}, },
checkUser:function(code,openid){
//判断用户是否已经注册
checkUserRegisted:function(code,openid){
wx.request({ wx.request({
url: this.url + 'ajax_check_user_registed.php', url: this.url + 'ajax_check_user_registed.php',
data: { data: {
...@@ -115,17 +89,11 @@ App({ ...@@ -115,17 +89,11 @@ App({
'content-type': 'application/json' // 默认值 'content-type': 'application/json' // 默认值
}, },
success(res) { success(res) {
console.log(res, '成功调用checkUser方法')
// if(res.data.result.message=="未注册")
if (res.data.status=='OK'){ if (res.data.status=='OK'){
wx.showModal({ //保存返回的openId和unionId
title: '提示', let config = {
content: '成功调用checkUser方法', openId: res.data.result.openId,
}) unionId: res.data.result.unionId,
let config={
openId:res.result.openId,
unionId:res.result.unionId,
zhuce: res.data.result.message
}; };
wx.setStorage({ wx.setStorage({
key: 'config', 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--> <!--pages/jigouRegistered/jigouRegistered.wxml-->
<view class='jigouRegistered'> <view class='jigouRegistered'>
<image src='../../img/1.jpg'></image> <image src='../../img/2.jpg'></image>
<view class='formtable'> <view class='formtable'>
<view> <view>
<text>姓名:</text> <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