diff --git a/config/api.js b/config/api.js
index 288327c..5a2f238 100755
--- a/config/api.js
+++ b/config/api.js
@@ -1,5 +1,6 @@
// const ApiRootUrl = 'http://localhost:8360/api/';
-const ApiRootUrl = 'https://www.hiolabs.com/api/';
+// const ApiRootUrl = 'http://192.168.0.108:8360/api/';
+const ApiRootUrl = 'https://www.guxiaoling.com:8466/api/';
module.exports = {
// 登录
diff --git a/images/icon/addr-line.png b/images/icon/addr-line.png
new file mode 100644
index 0000000..004758c
Binary files /dev/null and b/images/icon/addr-line.png differ
diff --git a/lib/wxParse/wxParse.wxml b/lib/wxParse/wxParse.wxml
index 6b41371..b6d2e2e 100644
--- a/lib/wxParse/wxParse.wxml
+++ b/lib/wxParse/wxParse.wxml
@@ -27,7 +27,7 @@
-
+
diff --git a/pages/app-auth/index.js b/pages/app-auth/index.js
index d58d3dc..0eccc28 100644
--- a/pages/app-auth/index.js
+++ b/pages/app-auth/index.js
@@ -6,10 +6,10 @@ const app = getApp()
Page({
data: {
-
+
},
onLoad: function (options) {
-
+
},
onShow: function () {
let userInfo = wx.getStorageSync('userInfo');
@@ -17,23 +17,78 @@ Page({
wx.navigateBack();
};
},
- getUserInfo: function (e) {
- app.globalData.userInfo = e.detail.userInfo
- user.loginByWeixin().then(res => {
- app.globalData.userInfo = res.data.userInfo;
- app.globalData.token = res.data.token;
- let is_new = res.data.is_new;//服务器返回的数据;
- if (is_new == 0) {
- util.showErrorToast('您已经是老用户啦!');
- wx.navigateBack();
- }
- else if (is_new == 1) {
- wx.navigateBack();
- }
+ // getUserInfo: function (e) {
+ // app.globalData.userInfo = e.detail.userInfo
+ // user.loginByWeixin().then(res => {
+ // app.globalData.userInfo = res.data.userInfo;
+ // app.globalData.token = res.data.token;
+ // let is_new = res.data.is_new;//服务器返回的数据;
+ // if (is_new == 0) {
+ // util.showErrorToast('您已经是老用户啦!');
+ // wx.navigateBack();
+ // }
+ // else if (is_new == 1) {
+ // wx.navigateBack();
+ // }
- }).catch((err) => { });
+ // }).catch((err) => { });
+ // },
+
+ getUserProfile: function () {
+ // wx.navigateTo({
+ // url: '/pages/app-auth/index',
+ // });
+ let that = this;
+ let code = '';
+ wx.login({
+ success: (res) => {
+ code = res.code;
+ },
+ });
+ // 获取用户信息
+ wx.getUserProfile({
+ lang: 'zh_CN',
+ desc: '用户登录',
+ success: (res) => {
+ let loginParams = {
+ code: code,
+ encryptedData: res.encryptedData,
+ iv: res.iv,
+ rawData: res.rawData,
+ signature: res.signature
+ };
+ console.log(loginParams);
+ that.postLogin(loginParams);
+ },
+ // 失败回调
+ fail: () => {
+ // 弹出错误
+ App.showError('已拒绝小程序获取信息');
+ }
+ });
},
- goBack:function(){
+ postLogin(info) {
+ util.request(api.AuthLoginByWeixin, {
+ info: info
+ }, 'POST').then(function (res) {
+ console.log(res);
+ if (res.errno === 0) {
+ wx.setStorageSync('userInfo', res.data.userInfo);
+ wx.setStorageSync('token', res.data.token);
+ app.globalData.userInfo = res.data.userInfo;
+ app.globalData.token = res.data.token;
+ let is_new = res.data.is_new; //服务器返回的数据;
+ console.log(is_new);
+ if (is_new == 0) {
+ util.showErrorToast('您已经是老用户啦!');
+ wx.navigateBack();
+ } else if (is_new == 1) {
+ wx.navigateBack();
+ }
+ }
+ });
+ },
+ goBack: function () {
wx.navigateBack();
}
})
\ No newline at end of file
diff --git a/pages/app-auth/index.wxml b/pages/app-auth/index.wxml
index 0d98938..41bf742 100644
--- a/pages/app-auth/index.wxml
+++ b/pages/app-auth/index.wxml
@@ -5,9 +5,14 @@
海风小店
开源微信小程序商城
请完成微信授权以继续使用
-