Selaa lähdekoodia

个人中心判断登录态,岗位列表移除用户信息条件,app.js移除授权接口

ZhangWenQiang 6 vuotta sitten
vanhempi
commit
76edc6135c

+ 0 - 66
app.js

@@ -3,16 +3,6 @@ const ald = require('./libs/ald-stat.js')
 import {
   updataStorageData
 } from './utils/storage.js'
-import {
-  getWxCode,
-  hasAuth,
-  getUserInfo
-} from './utils/wx.js'
-import {
-  wxLogin,
-  saveLogin,
-  checkPhone
-} from './services/wx.js'
 var startTime = Date.now();//启动时间
 App({
   onLaunch: function (options) {
@@ -49,62 +39,6 @@ App({
         content: '当前微信版本过低,部分功能可能无法使用,请升级到最新微信版本后重试。'
       })
     }
-
-    // let sceneArr = [1007, 1008, 1044, 1011, 1012, 1013, 1047, 1048, 1049]
-    let shareToken = options.query.shareToken || null
-    getWxCode().then(code => {
-      return wxLogin({
-        code: code,
-        shareToken: shareToken
-      })
-    })
-      .then(res => {
-        console.log("dd", res)
-        this.globalData.openId = res.data.openId ? res.data.openId : '';
-        this.globalData.sessionKey = res.data.sessionKey ? res.data.sessionKey : '';
-        return hasAuth('scope.userInfo');
-      })
-      .catch(err => {
-        console.log("没用获取用户信息权限")
-        wx.navigateTo({
-          url: '/pages/login/login',
-        })
-        return
-      })
-      .then(data => {
-        return getUserInfo()
-      })
-      .then(res => {
-        console.log("ee", res)
-        if (!updataStorageData('city')) {
-          updataStorageData('city', res.userInfo.city)
-        }
-        saveLogin({
-          encryptedData: encodeURIComponent(res.encryptedData),
-          iv: encodeURIComponent(res.iv),
-          openid: this.globalData.openId,
-          session_key: this.globalData.sessionKey
-        }).then(data => {
-          console.log("ff", data)
-          this.globalData.userId = data.data.hpUser.id ? data.data.hpUser.id : '';
-          this.globalData.userToken = data.data.hpUser.userToken ? data.data.hpUser.userToken : '';
-          updataStorageData('shareToken', data.data.hpUser.userToken || '') //用户识别码
-          wx.setStorageSync("hpuser", data.data.hpUser);
-          //在获取用户信息之后,再返回userInfo,防止首页 onLoad先执行
-          this.globalData.userInfo = res.userInfo;
-          // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
-          // 所以此处加入 callback 以防止这种情况
-          if (this.userInfoReadyCallback) {
-            this.userInfoReadyCallback(res)
-          }
-        }).catch(data => {
-          console.log("gg", data)
-        })
-      })
-      .catch(err => {
-        console.log(err)
-      })
-
   },
   onShow(options) {
     console.log("rr", options)

+ 2 - 23
pages/detail/index.js

@@ -53,29 +53,8 @@ Page({
     })
   },
   onShow: function() {
-    if (app.globalData.userInfo) {
-      console.log('有info===', app.globalData)
-      this.fetchData();
-      this.fetchPtList();
-    } else if (this.data.canIUse) {
-      // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
-      // 所以此处加入 callback 以防止这种情况
-      app.userInfoReadyCallback = res => {
-        console.log('userInfoReadyCallback===', app.globalData)
-        this.fetchData()
-        this.fetchPtList();
-      }
-    } else {
-      // 在没有 open-type=getUserInfo 版本的兼容处理
-      wx.getUserInfo({
-        success: res => {
-          app.globalData.userInfo = res.userInfo
-          console.log('兼容处理===', app.globalData)
-          this.fetchData()
-          this.fetchPtList();
-        }
-      })
-    }
+    this.fetchData();
+    this.fetchPtList();
   },
 
   onShareAppMessage: function() {

+ 2 - 22
pages/fuli/index.js

@@ -55,27 +55,7 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function(options) {
-    if (app.globalData.userInfo) {
-      console.log('有info===', app.globalData)
-      this.start();
-    } else if (this.data.canIUse) {
-      // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
-      // 所以此处加入 callback 以防止这种情况
-      app.userInfoReadyCallback = res => {
-        console.log('userInfoReadyCallback===', res.userInfo)
-        app.globalData.userInfo = res.userInfo;
-        this.start();
-      }
-    } else {
-      // 在没有 open-type=getUserInfo 版本的兼容处理
-      wx.getUserInfo({
-        success: res => {
-          app.globalData.userInfo = res.userInfo
-          console.log('兼容处理===', app.globalData)
-          this.start();
-        }
-      })
-    }
+    this.start();
   },
 
   /**
@@ -98,7 +78,7 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function() {
-    
+
   },
 
   //获取福利岗位列表数据

+ 2 - 22
pages/fulltime/index.js

@@ -33,27 +33,7 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function(options) {
-    if (app.globalData.userInfo) {
-      console.log('有info===', app.globalData)
-      this.start();
-    } else if (this.data.canIUse) {
-      // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
-      // 所以此处加入 callback 以防止这种情况
-      app.userInfoReadyCallback = res => {
-        console.log('userInfoReadyCallback===', res.userInfo)
-        app.globalData.userInfo = res.userInfo;
-        this.start();
-      }
-    } else {
-      // 在没有 open-type=getUserInfo 版本的兼容处理
-      wx.getUserInfo({
-        success: res => {
-          app.globalData.userInfo = res.userInfo
-          console.log('兼容处理===', app.globalData)
-          this.start();
-        }
-      })
-    }
+    this.start();
   },
 
   /**
@@ -166,7 +146,7 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function() {
-    
+
   },
 
   /**

+ 1 - 26
pages/index/index.js

@@ -11,12 +11,7 @@ var app = getApp();
 Page({
   data: {
     //banner图
-    imgList: [
-      // imgServerUrl_new + "/uploadfiles/banner/bannermina/banner1.jpg",
-      // imgServerUrl_new + "/uploadfiles/banner/bannermina/banner2.jpg",
-      // imgServerUrl_new + "/uploadfiles/banner/bannermina/banner3.jpg",
-      // imgServerUrl_new + "/uploadfiles/banner/bannermina/banner4.jpg"
-    ],
+    imgList: [],
     activity: [{
         src: imgServerUrl + "/images/home/quanzhi.png",
         text: "全职工作"
@@ -62,27 +57,7 @@ Page({
     hasLocation1: false,
   },
   onLoad: function(options) {
-    if (app.globalData.userInfo) {
-      console.log('有info===', app.globalData)
       this.start();
-    } else if (this.data.canIUse) {
-      // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
-      // 所以此处加入 callback 以防止这种情况
-      app.userInfoReadyCallback = res => {
-        console.log('userInfoReadyCallback===', res.userInfo)
-        app.globalData.userInfo = res.userInfo;
-        this.start();
-      }
-    } else {
-      // 在没有 open-type=getUserInfo 版本的兼容处理
-      wx.getUserInfo({
-        success: res => {
-          app.globalData.userInfo = res.userInfo
-          console.log('兼容处理===', app.globalData)
-          this.start();
-        }
-      })
-    }
   },
   start() {
     let cityName = wx.getStorageSync('city') || app.globalData.userInfo.city || '无锡'

+ 4 - 24
pages/jipin/index.js

@@ -33,27 +33,7 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function(options) {
-    if (app.globalData.userInfo) {
-      console.log('有info===', app.globalData)
-      this.start();
-    } else if (this.data.canIUse) {
-      // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
-      // 所以此处加入 callback 以防止这种情况
-      app.userInfoReadyCallback = res => {
-        console.log('userInfoReadyCallback===', res.userInfo)
-        app.globalData.userInfo = res.userInfo;
-        this.start();
-      }
-    } else {
-      // 在没有 open-type=getUserInfo 版本的兼容处理
-      wx.getUserInfo({
-        success: res => {
-          app.globalData.userInfo = res.userInfo
-          console.log('兼容处理===', app.globalData)
-          this.start();
-        }
-      })
-    }
+    this.start();
   },
 
   /**
@@ -112,7 +92,7 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function() {
-    
+
   },
 
   //获取当前定位
@@ -133,7 +113,7 @@ Page({
       that.start();
     } else {
       wx.getSetting({
-        success: function (res) {
+        success: function(res) {
           if (!res.authSetting['scope.userInfo'] || !res.authSetting['scope.userLocation']) {
             wx.hideLoading();
             wx.showModal({
@@ -141,7 +121,7 @@ Page({
               content: '当前服务需要获取您的位置信息,请确认授权',
               confirmText: '去授权',
               cancelText: '暂不授权',
-              success: function (res) {
+              success: function(res) {
                 if (res.confirm) {
                   wx.openSetting();
                 } else if (res.cancel) {

+ 1 - 1
pages/login/login.js

@@ -54,7 +54,7 @@ Page({
     } else {
       //用户按了拒绝按钮
       wx.showModal({
-        title: '警告',
+        title: '提示',
         content: '您点击了拒绝授权,将无法正常使用该小程序,请授权之后再使用。',
         showCancel: false,
         confirmText: '返回授权',

+ 3 - 1
pages/login/login.json

@@ -1 +1,3 @@
-{}
+{
+  "navigationBarTitleText": "登录"
+}

+ 98 - 25
pages/mine/index.js

@@ -20,9 +20,30 @@ Page({
   data: {
     imgServerUrl: imgServerUrl,
     userInfo: {},
-    noPhone:true,
+    noPhone: true,
     canIUse: wx.canIUse('button.open-type.getUserInfo'),
-    percent: 0
+    percent: 0,
+    userId: '',
+    memberId: '',
+    isLogin: false, //默认:未登录
+    approveStatus: 0,
+  },
+  onLoad: function(options) {
+    //获取用户user_id和member_id,判断是否处于登录态
+    var userId = wx.getStorageSync("user_id");
+    var memberId = wx.getStorageSync("member_id");
+    var isLogin = false;
+    if (userId && memberId) {
+      isLogin = true;
+    } else {
+      wx.navigateTo({
+        url: '/pages/login/login',
+      })
+    }
+    this.setData({
+      phone: updataStorageData("phone"),
+      isLogin: isLogin
+    })
   },
   onShow: function() {
     if (app.globalData.userInfo) {
@@ -30,6 +51,7 @@ Page({
       this.setData({
         userInfo: app.globalData.userInfo
       })
+      this.start();
     } else if (this.data.canIUse) {
       // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
       // 所以此处加入 callback 以防止这种情况
@@ -38,6 +60,7 @@ Page({
         this.setData({
           userInfo: app.globalData.userInfo
         })
+        this.start();
       }
     } else {
       // 在没有 open-type=getUserInfo 版本的兼容处理
@@ -48,25 +71,23 @@ Page({
           this.setData({
             userInfo: useapp.globalData.userInforInfo
           })
+          this.start();
         }
       })
     }
-    this.fetchData();
-    this.getUserResume();
-    if (this.data.noPhone){
-      //检查手机号
-      checkPhone({
-        user_id: app.globalData.userId,
-        user_token: app.globalData.userToken
-      }).then(data => {
-        console.log("hh")
-      })
-    }
+
   },
-  onLoad: function (options) {
+  start() {
+    var userId = wx.getStorageSync("user_id");
+    var memberId = wx.getStorageSync("member_id");
+    var isLogin = false;
+    if (userId && memberId) {
+      isLogin = true;
+      this.fetchData();
+      this.getUserResume();
+    }
     this.setData({
-      phone: updataStorageData("phone"),
-      percent:this.data.percent
+      isLogin: isLogin
     })
   },
   //获取用户简历详情
@@ -78,14 +99,14 @@ Page({
     Object.assign(paramsObj);
     getResume(paramsObj).then(data => {
       if (data.data.userResume) {
-        var percent=0;
+        var percent = 0;
         if (data.data.userResume.phone) {
           percent = 40 + percent;
         }
-        if (data.data.userResume.expectationPosition){
+        if (data.data.userResume.expectationPosition) {
           percent = 30 + percent;
         }
-        if (data.data.userResume.hpResumeWorkExperienceList.length>0) {
+        if (data.data.userResume.hpResumeWorkExperienceList.length > 0) {
           percent = 30 + percent;
         }
         this.setData({
@@ -115,6 +136,12 @@ Page({
 
   // 简历
   tojianli() {
+    if (!this.data.isLogin) {
+      wx.navigateTo({
+        url: '/pages/login/login',
+      })
+      return;
+    }
     if (this.data.hpUserResumeId) {
       wx.navigateTo({
         url: '../jianli/index?hpUserResumeId=' + this.data.hpUserResumeId,
@@ -127,6 +154,12 @@ Page({
   },
   //去认证页面
   toAuth() {
+    if (!this.data.isLogin) {
+      wx.navigateTo({
+        url: '/pages/login/login',
+      })
+      return;
+    }
     let approveState = this.data.approveStatus
     console.log(approveState)
     if (approveState == 0) {
@@ -152,28 +185,68 @@ Page({
       })
     }
   },
-  apply(){
-     //我的申请
+  apply() {
+    if (!this.data.isLogin) {
+      wx.navigateTo({
+        url: '/pages/login/login',
+      })
+      return;
+    }
+    //我的申请
     wx.navigateTo({
       url: '../apply-list/index',
     })
   },
-  collection(){
-     //我的收藏
+  collection() {
+    if (!this.data.isLogin) {
+      wx.navigateTo({
+        url: '/pages/login/login',
+      })
+      return;
+    }
+    //我的收藏
     wx.navigateTo({
       url: '../collection-list/index',
     })
   },
-  interview(){
+  interview() {
+    if (!this.data.isLogin) {
+      wx.navigateTo({
+        url: '/pages/login/login',
+      })
+      return;
+    }
     //面试邀请
     wx.navigateTo({
       url: '../interview/index',
     })
   },
-  setup(){
+  setup() {
+    if (!this.data.isLogin) {
+      wx.navigateTo({
+        url: '/pages/login/login',
+      })
+      return;
+    }
     //设置
     wx.navigateTo({
       url: '../set/index',
     })
+  },
+  toPayRoll() {
+    if (!this.data.isLogin) {
+      wx.navigateTo({
+        url: '/pages/login/login',
+      })
+      return;
+    }
+    wx.navigateTo({
+      url: '/pages/check-iphone/index?approveState=' + this.data.approveStatus,
+    })
+  },
+  toLogin() {
+    wx.navigateTo({
+      url: '/pages/login/login',
+    })
   }
 })

+ 2 - 2
pages/mine/index.json

@@ -3,6 +3,6 @@
     "i-cell-group": "../../ui/cell-group/index",
     "i-cell": "../../ui/cell/index",
     "i-icon": "../../ui/icon/index"
-    
-  }
+  },
+  "navigationBarTitleText": "个人中心"
 }

+ 29 - 27
pages/mine/index.wxml

@@ -1,31 +1,39 @@
 <view class='panel-container'>
   <view class="panel" bindtap="toAuth">
-    <view>
-      <image class='avatar' src='{{userInfo.avatarUrl}}'></image>
-    </view>
-    <view class='person-info'>
-      <view class='name'>
-        <text class="nickName" wx:if="{{approveStatus==3}}">{{userInfo.nickName}}</text>
-        <text class="nickName" wx:if="{{approveStatus!=3}}">用户</text>
-        <text class="auth" wx:if="{{approveStatus==3}}">已认证</text>
-        <text class="unauth" wx:if="{{approveStatus!=3}}">未认证</text>
+    <block wx:if="{{isLogin}}">
+      <view>
+        <image class='avatar' src='{{userInfo.avatarUrl}}'></image>
       </view>
-      <view class="enter">{{phone?phone:userResume.phone}}</view>
-    </view>
+      <view class='person-info'>
+        <view class='name'>
+          <text class="nickName" wx:if="{{approveStatus==3}}">{{userResume.realName?userResume.realName:userInfo.nickName}}</text>
+          <text class="nickName" wx:if="{{approveStatus!=3}}">用户</text>
+          <text class="auth" wx:if="{{approveStatus==3}}">已认证</text>
+          <text class="unauth" wx:if="{{approveStatus!=3}}">未认证</text>
+        </view>
+        <view class="enter">{{phone?phone:userResume.phone}}</view>
+      </view>
+    </block>
+    <block wx:else>
+      <view class='login' bindtap='toLogin'>
+        <view class="login_btn">登录/注册</view>
+        <view class='login_more'>登录后可享受更多特权</view>
+      </view>
+    </block>
     <view class='qycode'>
-      <image src='{{imgServerUrl}}/images/happyjob/rightjt.png' bindtap="toform"></image>
+      <image src='{{imgServerUrl}}/images/happyjob/rightjt.png'></image>
     </view>
   </view>
 </view>
 
 
-<view class='notrz' wx:if="{{approveStatus!=3}}">
+<view class='notrz' wx:if="{{approveStatus!=3 && isLogin}}">
   <image src='{{imgServerUrl}}/images/happyjob/renzheng.png'></image>
   <text class='rz'>您还没有进行实名认证,</text>
   <text class='ly'>认证一下呗,可以优先录用哦~</text>
 </view>
 
-<view class='inter' >
+<view class='inter'>
   <view class='mysc' bindtap='collection'>
     <image src='{{imgServerUrl}}/images/happyjob/shoucang.png'></image>
     <text class='sc'>我的收藏</text>
@@ -40,12 +48,9 @@
   </view>
 </view>
 
-
 <view class='col'>
 </view>
 
-
-
 <view class='jianli' bindtap='tojianli'>
   <view class='jltb'>
     <image src='{{imgServerUrl}}/images/happyjob/jianli.png'></image>
@@ -57,7 +62,7 @@
     </view>
   </view>
 
-  <view class='percent' >
+  <view class='percent'>
     <text class='full' wx:if="{{percent==100}}">{{percent}}%</text>
     <text class='unfull' wx:if="{{percent!=100}}">{{percent}}%</text>
     <view class='nows' wx:if="{{percent!=100}}">
@@ -67,16 +72,13 @@
   </view>
 </view>
 
-
-<navigator url="../check-iphone/index?approveState={{approveStatus}}">
-  <view class='query'>
-    <view class='querys'>
-      <image class='moneytb' src='{{imgServerUrl}}/images/happyjob/xzcx.png'></image>
-      <text class='queryxz'>薪资查询</text>
-    </view>
-    <image class='jiantou' src='{{imgServerUrl}}/images/happyjob/rightwjt.png'></image>
+<view class='query' bindtap='toPayRoll'>
+  <view class='querys'>
+    <image class='moneytb' src='{{imgServerUrl}}/images/happyjob/xzcx.png'></image>
+    <text class='queryxz'>薪资查询</text>
   </view>
-</navigator>
+  <image class='jiantou' src='{{imgServerUrl}}/images/happyjob/rightwjt.png'></image>
+</view>
 
 <!-- <view class='query'>
   <view class='querys'>

+ 16 - 0
pages/mine/index.wxss

@@ -342,3 +342,19 @@ page {
   height: 29rpx;
   padding-right: 36rpx;
 }
+
+/* 登录 */
+
+.login {
+  padding-left: 60rpx;
+}
+
+.login_btn {
+  color: #fff;
+  font-size: 38rpx;
+}
+
+.login_more {
+  padding-top: 10rpx;
+  color: #fff;
+}

+ 3 - 23
pages/parttime/index.js

@@ -59,27 +59,7 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function(options) {
-    if (app.globalData.userInfo) {
-      console.log('有info===', app.globalData)
-      this.start();
-    } else if (this.data.canIUse) {
-      // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
-      // 所以此处加入 callback 以防止这种情况
-      app.userInfoReadyCallback = res => {
-        console.log('userInfoReadyCallback===', res.userInfo)
-        app.globalData.userInfo = res.userInfo;
-        this.start();
-      }
-    } else {
-      // 在没有 open-type=getUserInfo 版本的兼容处理
-      wx.getUserInfo({
-        success: res => {
-          app.globalData.userInfo = res.userInfo
-          console.log('兼容处理===', app.globalData)
-          this.start();
-        }
-      })
-    }
+    this.start();
   },
 
   /**
@@ -104,7 +84,7 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function() {
-    
+
   },
 
   //获取兼职列表数据
@@ -168,7 +148,7 @@ Page({
               content: '当前服务需要获取您的位置信息,请确认授权',
               confirmText: '去授权',
               cancelText: '暂不授权',
-              success: function (res) {
+              success: function(res) {
                 if (res.confirm) {
                   wx.openSetting();
                 } else if (res.cancel) {

+ 2 - 21
pages/pt/index.js

@@ -36,7 +36,7 @@ Page({
 
   },
   //下拉刷新
-  onPullDownRefresh: function () {
+  onPullDownRefresh: function() {
     this.setData({
       pageNo: 1, //当前分页
       isScroll: true, //是否可以滚动
@@ -53,26 +53,7 @@ Page({
     this.fetchList()
   },
   onShow: function() {
-    if (app.globalData.userInfo) {
-      console.log('有info===', app.globalData)
-      this.start()
-    } else if (this.data.canIUse) {
-      // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
-      // 所以此处加入 callback 以防止这种情况
-      app.userInfoReadyCallback = res => {
-        console.log('userInfoReadyCallback===', app.globalData)
-        this.start()
-      }
-    } else {
-      // 在没有 open-type=getUserInfo 版本的兼容处理
-      wx.getUserInfo({
-        success: res => {
-          app.globalData.userInfo = res.userInfo
-          console.log('兼容处理===', app.globalData)
-          this.start()
-        }
-      })
-    }
+    this.start();
   },
   start() {
     let cityName = wx.getStorageSync('city') || app.globalData.userInfo.city || '无锡'

+ 2 - 1
pages/pt/index.json

@@ -4,5 +4,6 @@
     "i-tag": "../../ui/tag/index",
     "i-count-down": "../../ui/count-down/index"
   },
-  "enablePullDownRefresh": true
+  "enablePullDownRefresh": true,
+  "navigationBarTitleText": "拼工"
 }

+ 2 - 22
pages/reward/index.js

@@ -33,27 +33,7 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function(options) {
-    if (app.globalData.userInfo) {
-      console.log('有info===', app.globalData)
-      this.start();
-    } else if (this.data.canIUse) {
-      // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
-      // 所以此处加入 callback 以防止这种情况
-      app.userInfoReadyCallback = res => {
-        console.log('userInfoReadyCallback===', res.userInfo)
-        app.globalData.userInfo = res.userInfo;
-        this.start();
-      }
-    } else {
-      // 在没有 open-type=getUserInfo 版本的兼容处理
-      wx.getUserInfo({
-        success: res => {
-          app.globalData.userInfo = res.userInfo
-          console.log('兼容处理===', app.globalData)
-          this.start();
-        }
-      })
-    }
+    this.start();
   },
 
   /**
@@ -113,7 +93,7 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function() {
-   
+
   },
 
   //获取当前定位

+ 0 - 2
pages/search-result/search-result.js

@@ -36,8 +36,6 @@ Page({
     let paramsObj = {
       pageNo: this.data.pageNo,
       searchName: this.data.keyWord,
-      user_id: app.globalData.userId,
-      user_token: app.globalData.userToken
     }
 
     getSearchList(paramsObj).then(data => {

+ 19 - 3
pages/set/index.js

@@ -16,10 +16,10 @@ Page({
   /**
    * 生命周期函数--监听页面加载
    */
-  onLoad: function (options) {
+  onLoad: function(options) {
 
   },
-  toclear(){
+  toclear() {
     wx.showModal({
       title: '清除缓存',
       content: '是否清除所有缓存内容',
@@ -38,10 +38,26 @@ Page({
       }
     })
   },
-  toabout(){
+  toabout() {
     wx.navigateTo({
       url: '../about/index',
     })
+  },
+  login_out() {
+    wx.showModal({
+      title: '提示',
+      content: '确定退出登录吗?',
+      success: function(res) {
+        if (res.confirm) {
+          //清除登录缓存
+          wx.removeStorageSync("user_id");
+          wx.removeStorageSync("member_id");
+          wx.removeStorageSync("user_token");
+        } else if (res.cancel) {
+
+        }
+      }
+    })
   }
 
 })

+ 4 - 0
pages/set/index.wxml

@@ -6,4 +6,8 @@
 <view class='about' bindtap='toabout'>
   <view class='aboutus'>关于我们</view>
   <image class='jiantou' src='{{imgServerUrl}}/images/happyjob/rightwjt.png'></image>
+</view>
+
+<view class='btn-group fixed-footer'>
+  <button class='selfBtn' bindtap='login_out'>退出登录</button>
 </view>

+ 27 - 0
pages/set/index.wxss

@@ -40,3 +40,30 @@
   color: rgba(34, 34, 34, 1);
   margin-left: 30rpx;
 }
+
+.fixed-footer {
+  position: fixed;
+  left: 0;
+  bottom: 0;
+  width: 100%;
+}
+
+.btn-group {
+  background: #fff;
+  padding: 20rpx;
+  box-sizing: border-box;
+}
+
+.selfBtn {
+  display: flex;
+  height: 88rpx;
+  line-height: 88rpx;
+  align-items: center;
+  justify-content: center;
+  background: linear-gradient(90deg, rgba(160, 164, 169, 1), rgba(199, 202, 205, 1));
+  border-radius: 42rpx;
+  font-size: 38rpx;
+  font-family: SourceHanSansCN-Normal;
+  font-weight: 400;
+  color: rgba(255, 254, 254, 1);
+}