From 0d748876433b6e7232d76ea30e753e0acd93ba99 Mon Sep 17 00:00:00 2001
From: GL <954534408@qq.com>
Date: Mon, 17 Aug 2020 16:12:31 +0800
Subject: [PATCH] =?UTF-8?q?C=E7=AB=AF=E9=9B=86=E5=9B=A2=E7=89=88=E6=8F=90?=
=?UTF-8?q?=E6=B5=8Bv-1.0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 0
app.json | 6 +--
config/config.js | 12 +++++
pages/getphoneInfo/getphoneInfo.js | 71 ++++++++++++++++++++++++++++
pages/getphoneInfo/getphoneInfo.json | 5 ++
pages/getphoneInfo/getphoneInfo.wxml | 15 ++++++
pages/getphoneInfo/getphoneInfo.wxss | 60 +++++++++++++++++++++++
pages/getuserinfo/index.js | 2 +-
pages/index/index.js | 2 +-
pages/users/users.js | 58 +++++++++++++++++++----
pages/users/users.wxml | 20 ++++----
utils/bgColor.js | 37 +++++++++++++++
12 files changed, 265 insertions(+), 23 deletions(-)
delete mode 100644 README.md
create mode 100644 pages/getphoneInfo/getphoneInfo.js
create mode 100644 pages/getphoneInfo/getphoneInfo.json
create mode 100644 pages/getphoneInfo/getphoneInfo.wxml
create mode 100644 pages/getphoneInfo/getphoneInfo.wxss
create mode 100644 utils/bgColor.js
diff --git a/README.md b/README.md
deleted file mode 100644
index e69de29..0000000
diff --git a/app.json b/app.json
index 04ac9f5..cd7a6eb 100644
--- a/app.json
+++ b/app.json
@@ -2,9 +2,9 @@
"pages": [
"pages/index/index",
"pages/users/users",
-
"pages/location/location",
- "pages/getuserinfo/index"
+ "pages/getuserinfo/index",
+ "pages/getphoneInfo/getphoneInfo"
],
"tabBar": {
"list": [
@@ -17,7 +17,7 @@
{
"pagePath": "pages/users/users",
"text": "我的",
- "iconPath": "assets/images/park.png",
+ "iconPath": "assets/images/user.png",
"selectedIconPath": "assets/images/user-a.png"
}
],
diff --git a/config/config.js b/config/config.js
index 847f055..89da84c 100644
--- a/config/config.js
+++ b/config/config.js
@@ -29,6 +29,18 @@ var config = {
* 授权后获取用户的昵称,unionId等信息
*/
getUserInfo: "/user/getUserInfo",
+ /**
+ * 获得成长值
+ */
+ getScore: '/user/userinfo',
+ /**
+ * 接口用途:授权后获取用户的手机号
+ */
+ getUserPhone: "/user/getUserPhone",
+ /**
+ * 检查用户手机授权状态
+ */
+ checkPhoneStatus: "/user/checkPhoneStatus",
},
};
diff --git a/pages/getphoneInfo/getphoneInfo.js b/pages/getphoneInfo/getphoneInfo.js
new file mode 100644
index 0000000..ee74aed
--- /dev/null
+++ b/pages/getphoneInfo/getphoneInfo.js
@@ -0,0 +1,71 @@
+const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px'
+var config = require("../../config/config.js");
+const Http = require("../../utils/HttpBasics");
+var app = getApp();
+Page({
+ data: {
+ navigationBarHeight,
+ canIUse: wx.canIUse("button.open-type.getPhoneNumber"),
+
+
+ },
+ 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',
+ })
+ },
+
+
+ getPhoneNumber: function (e) {
+ var that = this;
+ var iv = e.detail.iv;
+ var encryptedData = e.detail.encryptedData;
+ Http.post({
+ url: config.api.getUserPhone,
+ data: {
+ encryptedData: encryptedData,
+ iv: iv
+ }
+ }).then(res=>{
+ console.log("成功授权手机号")
+ wx.setStorageSync("phone", res.data.phone)
+
+ wx.switchTab({
+ url: '/pages/users/users',
+ })
+ })
+ .catch(err => {
+ wx.showToast({
+ title: "请授权手机号",
+ icon: 'none',
+ duration: 2000,
+ mask: false
+ });
+ })
+ }
+});
\ No newline at end of file
diff --git a/pages/getphoneInfo/getphoneInfo.json b/pages/getphoneInfo/getphoneInfo.json
new file mode 100644
index 0000000..88eeb8e
--- /dev/null
+++ b/pages/getphoneInfo/getphoneInfo.json
@@ -0,0 +1,5 @@
+{
+ "usingComponents": {
+ "navbar": "../../components/navbar/navbar"
+ }
+}
\ No newline at end of file
diff --git a/pages/getphoneInfo/getphoneInfo.wxml b/pages/getphoneInfo/getphoneInfo.wxml
new file mode 100644
index 0000000..1b0935f
--- /dev/null
+++ b/pages/getphoneInfo/getphoneInfo.wxml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+ Hi , 请登录~
+ 授权后,可以更好的体验我们哦~
+
+
+
+ 请升级微信版本
+
+
+
\ No newline at end of file
diff --git a/pages/getphoneInfo/getphoneInfo.wxss b/pages/getphoneInfo/getphoneInfo.wxss
new file mode 100644
index 0000000..8493d60
--- /dev/null
+++ b/pages/getphoneInfo/getphoneInfo.wxss
@@ -0,0 +1,60 @@
+page{
+ background: #fbfbfb;
+}
+.login-body {
+ padding-top: 200rpx;
+ 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 {
+ width: 100%;
+ height: 100%;
+ border-radius: 16rpx;
+}
+
+.login-btn {
+ padding-top: 120rpx;
+ width: 600rpx;
+}
+.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/getuserinfo/index.js b/pages/getuserinfo/index.js
index 7db957a..459655e 100644
--- a/pages/getuserinfo/index.js
+++ b/pages/getuserinfo/index.js
@@ -6,7 +6,7 @@ Page({
data: {
navigationBarHeight,
canIUse: wx.canIUse("button.open-type.getUserInfo"),
-
+ curPhone:'',
},
onLoad: function(options) {
var that = this;
diff --git a/pages/index/index.js b/pages/index/index.js
index a28890e..2f5f4ce 100644
--- a/pages/index/index.js
+++ b/pages/index/index.js
@@ -57,6 +57,7 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
+
if (app.globalData.token) {
this.getBannerlist()
this.gitSquareLis()
@@ -74,7 +75,6 @@ Page({
获取集团下面的广场
*/
gitSquareLis(){
-
const tempData = wx.getStorageSync("subMalls");
console.log(wx.getStorageSync("subMalls"))
this.setData({
diff --git a/pages/users/users.js b/pages/users/users.js
index 046dac4..0d16106 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");
+const bgColor = require("../../utils/bgColor.js")
let app = getApp();
Page({
@@ -11,28 +12,66 @@ Page({
data: {
aboutUs: imgurl.aboutUs.url,
banneColor: "linear-gradient(180deg,rgba(253,131,45,1) 0%,rgba(254,74,22,1) 100%)",
- // levelName:
+ levelName: "",
+ levelBg: bgColor.colorFirst.user.levelBg,
+ score: '0',
+ curPhone: '',
+ },
+//授权手机号
+ gotoPhoneInfo() {
+ // let that = this;
+ // Http.get({
+ // url: config.api.checkPhoneStatus,
+ // data: {}
+ // }).then(res => {
+ // return
+ // }).catch(err => {
+ // wx.redirectTo({
+ // url: `/pages/getphoneInfo/getphoneInfo`
+ // });
+ // })
+ wx.redirectTo({
+ url: `/pages/getphoneInfo/getphoneInfo`
+ });
+
},
/* 判断是否授权*/
checkUserStatus() {
Http.get({
-
url: config.api.checkUserStatus,
data: {
token: app.globalData.token
}
}).then(res => {
- // wx.navigateTo({
- // url: '/pages/edit/edit',
- // })
- console.log("111")
+ this.getUserInfo()
}).catch(err => {
wx.navigateTo({
url: `/pages/getuserinfo/index`,
})
})
+ // wx.navigateTo({
+ // url: '/pages/getuserinfo/index',
+ // })
+ },
+ //获取当前登录用户信息
+ getUserInfo: function () {
+ let that = this;
+ // 获取用户信息
+ Http.get({
+ url: config.api.getScore,
+ })
+ .then(res => {
+ const { code, data } = res
+ if (code == 200) {
+ that.setData({
+ levelName: data.levelName,
+ getScore: data.getScore,
+
+ })
+ }
+ })
},
@@ -40,7 +79,7 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
- this.checkUserStatus()
+
},
@@ -56,7 +95,10 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+ this.checkUserStatus()
+ this.setData({
+ curPhone: wx.getStorageSync('phone')
+ })
},
/**
diff --git a/pages/users/users.wxml b/pages/users/users.wxml
index 88cafb4..a73326a 100644
--- a/pages/users/users.wxml
+++ b/pages/users/users.wxml
@@ -5,27 +5,27 @@
-
+
关于我们
-
+
-
-
-
+
+
+
{{levelName}}
我的手机号:
- {{curPhone}}
- [微信授权手机号]
+ {{curPhone}}
+
获取微信授权手机号
@@ -33,12 +33,12 @@
我的
- 成长值{{score}}
+ 成长值{{score}}
|
更多成长值
-
-
+
+
diff --git a/utils/bgColor.js b/utils/bgColor.js
new file mode 100644
index 0000000..e25d99d
--- /dev/null
+++ b/utils/bgColor.js
@@ -0,0 +1,37 @@
+module.exports = {
+ colorFirst:{
+ // 我的
+ "user": {
+ "banneColor": "linear-gradient(180deg,rgba(253,131,45,1) 0%,rgba(254,74,22,1) 100%)",
+ "levelBg":"linear-gradient(127deg,rgba(252,177,74,1) 0%,rgba(254,70,20,1) 100%)",
+ "view":"#FD832D"
+ },
+ //首页
+ "main": {
+ "chengzhangBox":"linear-gradient(127deg,rgba(252,177,74,1) 0%,rgba(254,70,20,1) 100%)",
+ "activeColor":"#FC8B37",
+ "qg":"#FD782D",
+ "sql":"linear-gradient(127deg,rgba(252,177,74,1) 0%,rgba(254,70,20,1) 100%)",
+ "txt": "#2C8DFF",
+ },
+
+ },
+ colorSecond:{
+ // 我的
+ "user": {
+ "banneColor": "linear-gradient(180deg,rgba(50,177,252,1) 0%,rgba(47,108,255,1) 100%)",
+ "levelBg": "linear-gradient(180deg,rgba(50,177,252,1) 0%,rgba(47,108,255,1) 100%)",
+ "view": "#FF1D30"
+ },
+ //首页
+ "main": {
+ "chengzhangBox": "linear-gradient(130deg,rgba(50,177,252,1) 0%,rgba(47,108,255,1) 100%)",
+ "activeColor": "#2C8DFF",
+ "qg": "#31A5FC",
+ "sql": "linear-gradient(127deg,rgba(119,192,254,1) 0%,rgba(48,120,255,1) 100%)",
+ "txt":"#FF1D30",
+ },
+ }
+
+
+}
\ No newline at end of file