diff --git a/README.md b/README.md
index 71cd52e..e69de29 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +0,0 @@
-# groupC
-
-C端集团版
\ No newline at end of file
diff --git a/app.js b/app.js
index 876d083..987236e 100644
--- a/app.js
+++ b/app.js
@@ -24,6 +24,7 @@ App({
//登陆
userLogin(sceneAddress) {
+ console.log(sceneAddress)
let that = this;
// 登录
wx.login({
@@ -42,7 +43,7 @@ App({
.then(res => {
wx.setStorageSync('openId',res.data.openId)
wx.setStorageSync('subMalls', JSON.parse(res.data.subMalls) )
- if (res.data && res.data.score) {
+ if (res.data && res.data.score) {
if (res.data.score != 0) {
that.globalData.score = res.data.score;
}
diff --git a/app.json b/app.json
index 33f8405..04ac9f5 100644
--- a/app.json
+++ b/app.json
@@ -1,9 +1,10 @@
{
"pages": [
- "pages/users/users",
"pages/index/index",
-
- "pages/location/location"
+ "pages/users/users",
+
+ "pages/location/location",
+ "pages/getuserinfo/index"
],
"tabBar": {
"list": [
diff --git a/config/config.js b/config/config.js
index e06c5a3..847f055 100644
--- a/config/config.js
+++ b/config/config.js
@@ -14,6 +14,21 @@ var config = {
* banner
*/
bannerlist: "/wxCampaign/list",
+ /**
+ * 检查用户授权状态
+ */
+ checkUserStatus: "/user/checkUserStatus",
+ /**
+ * 授权个人信息
+ * 和授权手机号
+ * 和login页面
+ * 页面的图标
+ */
+ marketicon: '/mall/getAppIcon',
+ /**
+ * 授权后获取用户的昵称,unionId等信息
+ */
+ getUserInfo: "/user/getUserInfo",
},
};
diff --git a/pages/getuserinfo/index.js b/pages/getuserinfo/index.js
new file mode 100644
index 0000000..7db957a
--- /dev/null
+++ b/pages/getuserinfo/index.js
@@ -0,0 +1,85 @@
+const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px'
+var config = require("../../config/config.js");
+var app = getApp();
+const Http = require("../../utils/HttpBasics");
+Page({
+ data: {
+ navigationBarHeight,
+ canIUse: wx.canIUse("button.open-type.getUserInfo"),
+
+ },
+ onLoad: function(options) {
+ var that = this;
+
+ Http.get({
+ url: config.api.marketicon,
+ data: {
+ appId: config.weapp.AppId
+ }
+ }).then(res => {
+ that.setData({
+ mallImgUrl: res.data.mallImgUrl
+ });
+ wx.setNavigationBarTitle({
+ title: res.data.mallName
+ })
+ })
+ .catch(err => {
+ wx.showToast({
+ title: err.errMsg,
+ icon: 'none',
+ duration: 2000,
+ mask: false
+ });
+ })
+ },
+
+ backHome: function () {
+ wx.switchTab({
+ url: '/pages/index/index',
+ })
+ },
+
+ bindGetUserInfo: function (e) {
+ let that = this;
+ var iv = e.detail.iv;
+ var encryptedData = e.detail.encryptedData;
+ wx.getUserInfo({
+ success: function (res) {
+ Http.post({
+ url: config.api.getUserInfo,
+ data: {
+ encryptedData: encryptedData,
+ iv: iv
+ }
+ })
+ .then(
+ function (res) {
+ console.log("授权成功")
+
+ wx.switchTab({
+ url: `/pages/users/users`
+ })
+ },
+ function (error) {
+ console.log(error)
+ wx.showToast({
+ title: "请授权个人信息",
+ icon: "none"
+ });
+ }
+ )
+ .catch(err => {
+ wx.showToast({
+ title: err.errMsg,
+ icon: 'none',
+ duration: 2000,
+ mask: false
+ });
+ })
+
+
+ }
+ })
+ },
+});
diff --git a/pages/getuserinfo/index.json b/pages/getuserinfo/index.json
new file mode 100644
index 0000000..88eeb8e
--- /dev/null
+++ b/pages/getuserinfo/index.json
@@ -0,0 +1,5 @@
+{
+ "usingComponents": {
+ "navbar": "../../components/navbar/navbar"
+ }
+}
\ No newline at end of file
diff --git a/pages/getuserinfo/index.wxml b/pages/getuserinfo/index.wxml
new file mode 100644
index 0000000..96f5095
--- /dev/null
+++ b/pages/getuserinfo/index.wxml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+ Hi , 请登录~
+ 授权后,可以更好的体验我们哦~
+
+
+
+ 微信用户登录
+
+
+
\ No newline at end of file
diff --git a/pages/getuserinfo/index.wxss b/pages/getuserinfo/index.wxss
new file mode 100644
index 0000000..ef6e405
--- /dev/null
+++ b/pages/getuserinfo/index.wxss
@@ -0,0 +1,70 @@
+page{
+ background: #fbfbfb;
+}
+.login-body {
+ padding-top: 106rpx;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+}
+.backHome{
+ margin-top: 20rpx!important;
+}
+.login-logo {
+ width: 320rpx;
+ /* height: 320rpx; */
+ padding-top: 70rpx;
+}
+
+.login-logo>image {
+ display: block;
+ width: 320rpx;
+ border-radius: 16rpx;
+}
+
+.login-btn {
+ padding-top: 120rpx;
+ width: 504rpx;
+}
+
+.txt {
+ display: block;
+ width: 300rpx;
+ height: 108rpx;
+ margin-top: 5.8%;
+ font-size: 30rpx;
+ color: #999;
+ line-height: 54rpx;
+ text-align: center;
+}
+.active{
+ opacity: .6;
+}
+.login-btn .login-btn-login {
+ background: #1faf0c;
+ border-radius: 15rpx !important;
+ height: 94rpx !important;
+ line-height: 94rpx;
+ padding: 0 !important;
+ font-family: PingFangSC-Semibold !important;
+ font-size: 36rpx !important;
+ color: #FFFFFF !important;
+ letter-spacing: 0.75rpx !important;
+ text-align: center;
+}
+.title{
+ margin-top: 30rpx;
+}
+.title text{
+ display: block;
+ text-align: center;
+}
+.title text:nth-of-type(1){
+ font-size: 38rpx;
+ font-weight: bold;
+}
+.title text:nth-of-type(2){
+ font-size: 30rpx;
+ margin-top: 25rpx;
+}
\ No newline at end of file
diff --git a/pages/index/index.js b/pages/index/index.js
index 0516067..a28890e 100644
--- a/pages/index/index.js
+++ b/pages/index/index.js
@@ -22,13 +22,14 @@ Page({
* banner
*/
getBannerlist: function () {
- // Http.setToken(app.globalData.token);
+
let that = this;
Http.get({
url: config.api.bannerlist,
data: {
pageNum: 1,
- pageSize: 7
+ pageSize: 7,
+ token:app.globalData.token
}
}).then(res => {
diff --git a/pages/users/users.js b/pages/users/users.js
index 2373da3..046dac4 100644
--- a/pages/users/users.js
+++ b/pages/users/users.js
@@ -2,6 +2,7 @@
const imgurl = require("../../utils/imgurl");
const Http = require("../../utils/HttpBasics");
var config = require("../../config/config.js");
+let app = getApp();
Page({
/**
@@ -13,14 +14,33 @@ Page({
// levelName:
},
+ /* 判断是否授权*/
+ checkUserStatus() {
+ Http.get({
+
+ url: config.api.checkUserStatus,
+ data: {
+ token: app.globalData.token
+ }
+ }).then(res => {
+ // wx.navigateTo({
+ // url: '/pages/edit/edit',
+ // })
+ console.log("111")
+ }).catch(err => {
+ wx.navigateTo({
+ url: `/pages/getuserinfo/index`,
+ })
+ })
+ },
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
+ this.checkUserStatus()
},