Browse Source

11:31公司介绍接口调试完成

FANGLH 6 years ago
parent
commit
274899740c
4 changed files with 338 additions and 291 deletions
  1. 31 2
      pages/corporateInfo/corporateInfo.js
  2. 6 10
      pages/corporateInfo/corporateInfo.wxml
  3. 247 226
      pages/mine/mine.js
  4. 54 53
      utils/wxconstant.js

+ 31 - 2
pages/corporateInfo/corporateInfo.js

@@ -1,20 +1,49 @@
 // pages/corporateInfo/corporateInfo.js
+
+
+var BASEURL = require('../../utils/wxconstant.js')
+var baseUrl = BASEURL.BaseUrl()
+var netUtil = require('../../utils/network.js')
+
 Page({
 
   /**
    * 页面的初始数据
    */
   data: {
-
+    comInfoDatas:{},
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-
+    this.getInfo()
   },
 
+
+  getInfo:function(){
+    var that = this
+
+    var data = { empId: wx.getStorageSync('empId')}
+    var url = baseUrl + BASEURL.getUrl.getByEmp
+
+    netUtil.requestLoading(url, data, '正在加载数据...', 'POST', function (res) {
+      if (res.data && res.data.success && res.data.data) {
+        that.setData({
+          comInfoDatas:res.data.data
+        })
+      } else {
+      
+      }
+    }, function (res) {
+      wx.showToast({
+        title: '加载数据失败',
+        icon: 'none',
+        duration: 2000
+      })
+    })
+  },
   /**
    * 生命周期函数--监听页面初次渲染完成
    */

+ 6 - 10
pages/corporateInfo/corporateInfo.wxml

@@ -2,8 +2,9 @@
 
 <view ><image src='../../img/logo_img.png' class='logo_img_sty'></image></view>
 <view class='top_view'>
-  <view><image class='img_sty' src='../../img/common_header_boy.png'></image></view>
-  <view class='companyname_sty'>摩双子羯有限公司</view>
+  <view wx:if='{{comInfoDatas.comPhoto != null}}'>{{comInfoDatas.comPhoto}}</view>
+  <view wxLelse><image class='img_sty' src='../../img/common_header_boy.png'></image></view>
+  <view class='companyname_sty'>{{comInfoDatas.comName}}</view>
 </view>
 
 <!-- <view wx:for='{{comDataList}}'> -->
@@ -14,8 +15,7 @@
       <view class='title_sty'>概况介绍:</view>
     </view>
 
-    <view class='context_sty'>017 年 1 月 10 日, 世界权 威市场调查机构 欧睿国际 (Euromonitor)正式签署发布的 2016 年全球大型家用电器品 牌零售量数据显示: XXX 大型家用电器 2016 年品牌零售量占 全球市场的 10.3%,居全球第一,这是自 2009 年以来 XXX 第 8 次蝉联全球第一。此外,冰箱、洗衣机、酒柜、冷柜也分 别以大幅度领先第二名的品牌零售量继续蝉联全球第一
-    </view>
+    <view class='context_sty'>{{comInfoDatas.comDetails1}}</view>
 <!-- </view> -->
 
  <view class='commonhline' style='height:2rpx;'></view>
@@ -25,10 +25,7 @@
       <view class='title_sty'>企业文化:</view>
     </view>
 
-    <view class='context_sty'>017 年 1 月 10 日, 世界权 威市场调查机构 欧睿国际 (Euromonitor)正式签署发布的 2016 年全球大型家用电器品 牌零售量数据显示: XXX 大型家用电器 2016 年品牌零售量占 全球市场的 10.3%,居全球第一,这是自 2009 年以来 XXX 第 8 次蝉联全球第一。此外,冰箱、洗衣机、酒柜、冷柜也分 别以大幅度领先第二名的品牌零售量继续蝉联全球第一
-
-
-    </view>
+    <view class='context_sty'>{{comInfoDatas.comDetails2}}</view>
 
      <view class='commonhline' style='height:2rpx;'></view>
 
@@ -37,6 +34,5 @@
       <view class='title_sty'>主营范围:</view>
     </view>
 
-    <view class='context_sty'>017 年 1 月 10 日, 世界权 威市场调查机构 欧睿国际 (Euromonitor)正式签署发布的 2016 年全球大型家用电器品 牌零售量数据显示: XXX 大型家用电器 2016 年品牌零售量占 全球市场的 10.3%,居全球第一,这是自 2009 年以来 XXX 第 8 次蝉联全球第一。此外,冰箱、洗衣机、酒柜、冷柜也分 别以大幅度领先第二名的品牌零售量继续蝉联全球第一
-    </view>
+    <view class='context_sty'>{{comInfoDatas.comDetails3}}</view>
 

+ 247 - 226
pages/mine/mine.js

@@ -1,227 +1,248 @@
-// pages/mine/mine.js
-var BASEURL = require('../../utils/wxconstant.js')
-var baseUrl = BASEURL.BaseUrl()
-var baseutils = require('../../utils/baseUtils.js')
-var netUtil = require('../../utils/network.js')
-var dateutil = require('../../utils/DateTime.js')
-var isregistered 
-
-Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-   //id
-    idTypeRank:'idTypeRank',
-    isregistered:false,
-    idMyInfo:'idMyInfo',
-    idCompanyInfo: 'idCompanyInfo',
-    idAbout: 'idAbout',
-    idgoBind:'idgoBind',
-    idWxlogin:'idWxlogin',
-    pointdata:{},//本月、上月积分及排名
-
-    "curmonth_points": 0, //本月当前积分
-    "curmonth_rank": '-',//本月当前排名
-    "lastmonth_points": 0,//上月积分
-    "lastmonth_rank": '-' //上月排名
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-    
-  },
-  btnClick: function (event) {
-    var that = this
-    var id = event.currentTarget.id
-    if (id == that.data.idAbout) {
-      wx.navigateTo({
-        url: '../about/about',
-      })
-      return
-    } 
-    isregistered = wx.getStorageSync('isregistered')
-    console.log('isregistered', isregistered)
-    if (id == that.data.idWxlogin){
-      return
-    }
-    if (!wx.getStorageSync('wxnickName')) {
-      that.comToast('您当前尚未进行微信授权登录')
-      return
-    }
-    if (id == that.data.idgoBind) {
-      wx.navigateTo({
-        url: '../bindphone/bindphone',
-      })
-      return
-    }
-    if (id == that.data.idTypeRank){
-      wx.navigateTo({
-        url: '../pointRank/pointRank',
-      })
-    }
-    if (!isregistered) {
-      wx.showModal({
-        title: '提示',
-        content: '您当前尚未与企业关联绑定,是否立即去绑定?',
-        success: function (res) {
-          if (res.confirm) {
-            wx.navigateTo({
-              url: '../bindphone/bindphone',
-            })
-          } else if (res.cancel) {
-            return
-          }
-        }
-      })
-      return
-    }
-
-    if (id == that.data.idMyInfo){
-        wx.navigateTo({
-          url: '../perinfo/perinfo',
-        })
-    } else if (id == that.data.idCompanyInfo){
-      wx.navigateTo({
-        url: '../corporateInfo/corporateInfo',
-      })
-    } 
-  },
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-    var that = this
-    this.setData({
-      isregistered: wx.getStorageSync('isregistered'),
-      isLogin: wx.getStorageSync('wxnickName') ? true : false,
-      canIUse: wx.canIUse('button.open-type.getUserInfo'),
-      headerImg: wx.getStorageSync('wxavatarUrl'),
-      wxNickname: wx.getStorageSync('wxnickName'),
-    })
-    isregistered = wx.getStorageSync('isregistered')
-    if (!isregistered){
-      return
-    }
-    that.getMyRank()
-  },
-
-  getMyRank:function(){
-  var that = this
-  var data = { 
-    openid: wx.getStorageSync('openid'),
-   }
-    var url = baseUrl + BASEURL.getUrl.getRank
-    netUtil.requestLoading(url, data, '正在加载数据...', 'GET', function (res) {
-      if (res.data.success){
-        wx.setStorageSync('isregistered', res.data.data.isregistered)
-        if (res.data.data.pointdata){
-          var pointdata = res.data.data.pointdata
-          that.setData({
-            isregistered: res.data.data.isregistered,
-            pointdata: pointdata,
-            "curmonth_points": pointdata.curmonth_points == null ? '0' : pointdata.curmonth_points, //本月当前积分
-            "curmonth_rank": pointdata.curmonth_rank == null ? '0' : pointdata.curmonth_rank,//本月当前排名
-            "lastmonth_points": pointdata.lastmonth_points == null ? '0' : pointdata.lastmonth_points,//上月积分
-            "lastmonth_rank": pointdata.lastmonth_rank == null ? '-' : pointdata.lastmonth_rank //上月排名
-          })
-
-        }
-      }
-    }, function (res) {
-      wx.showToast({
-        title: '加载数据失败',
-        icon: 'none',
-        duration: 2000
-      })
-    })
-  },
-  bindGetUserInfo: function (e) {
-    var that = this
-    var userInfo = e.detail.userInfo
-    if (!userInfo) return
-    console.log('bindGetUserInfo', userInfo)
-    var nickName = userInfo.nickName
-    var avatarUrl = userInfo.avatarUrl
-    var gender = userInfo.gender //性别 0:未知、1:男、2:女
-    var province = userInfo.province
-    var city = userInfo.city
-    var country = userInfo.country
-    if (nickName && avatarUrl) {
-      baseutils.getPersonlEmp()
-      baseutils.judgeisReg()
-      that.getMyRank()
-      that.setData({
-        wxNickname: nickName,
-        wxHeader: avatarUrl,
-        isLogin: true
-      })
-      try {
-        wx.setStorageSync('wxavatarUrl', userInfo.avatarUrl)
-        wx.setStorageSync('wxnickName', userInfo.nickName)
-      } catch (e) {
-      }
-    }
-
-  },
-
-  comToast: function (title) {
-    wx.showToast({
-      title: title,
-      icon: 'none',
-      duration: 2000
-    })
-  },
-
-
-
-
-
-
-
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-
-  }
+// pages/mine/mine.js
+var BASEURL = require('../../utils/wxconstant.js')
+var baseUrl = BASEURL.BaseUrl()
+var baseutils = require('../../utils/baseUtils.js')
+var netUtil = require('../../utils/network.js')
+var dateutil = require('../../utils/DateTime.js')
+var isregistered 
+
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+   //id
+    idTypeRank:'idTypeRank',
+    isregistered:false,
+    idMyInfo:'idMyInfo',
+    idCompanyInfo: 'idCompanyInfo',
+    idAbout: 'idAbout',
+    idgoBind:'idgoBind',
+    idWxlogin:'idWxlogin',
+    pointdata:{},//本月、上月积分及排名
+
+    "curmonth_points": 0, //本月当前积分
+    "curmonth_rank": '-',//本月当前排名
+    "lastmonth_points": 0,//上月积分
+    "lastmonth_rank": '-' //上月排名
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+    
+  },
+  btnClick: function (event) {
+    var that = this
+    var id = event.currentTarget.id
+    if (id == that.data.idAbout) {
+      wx.navigateTo({
+        url: '../about/about',
+      })
+      return
+    } 
+    isregistered = wx.getStorageSync('isregistered')
+    console.log('isregistered', isregistered)
+    if (id == that.data.idWxlogin){
+      return
+    }
+    if (!wx.getStorageSync('wxnickName')) {
+      that.comToast('您当前尚未进行微信授权登录')
+      return
+    }
+    if (id == that.data.idgoBind) {
+      wx.navigateTo({
+        url: '../bindphone/bindphone',
+      })
+      return
+    }
+    if (id == that.data.idTypeRank){
+      wx.navigateTo({
+        url: '../pointRank/pointRank',
+      })
+    }
+    if (!isregistered) {
+      wx.showModal({
+        title: '提示',
+        content: '您当前尚未与企业关联绑定,是否立即去绑定?',
+        success: function (res) {
+          if (res.confirm) {
+            wx.navigateTo({
+              url: '../bindphone/bindphone',
+            })
+          } else if (res.cancel) {
+            return
+          }
+        }
+      })
+      return
+    }
+
+    if (id == that.data.idMyInfo){
+        wx.navigateTo({
+          url: '../perinfo/perinfo',
+        })
+    } else if (id == that.data.idCompanyInfo){
+      wx.navigateTo({
+        url: '../corporateInfo/corporateInfo',
+      })
+    } 
+  },
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+    var that = this
+    this.setData({
+      isregistered: wx.getStorageSync('isregistered'),
+      isLogin: wx.getStorageSync('wxnickName') ? true : false,
+      canIUse: wx.canIUse('button.open-type.getUserInfo'),
+      headerImg: wx.getStorageSync('wxavatarUrl'),
+      wxNickname: wx.getStorageSync('wxnickName'),
+    })
+    isregistered = wx.getStorageSync('isregistered')
+    if (!isregistered){
+      return
+    }
+   
+    that.getMyRank()
+    that.getEmp()
+  },
+
+  getEmp:function(){
+    var that = this
+    var data = {
+      openid: wx.getStorageSync('openid'),
+    }
+    var url = baseUrl + BASEURL.getUrl.getEmp
+    netUtil.requestLoading(url, data, '正在加载数据...', 'GET', function (res) {
+      if (res.data.success && res.data.data.empId) {
+        wx.setStorageSync('empId', res.data.data.empId)
+        console.log("empId", wx.getStorageSync('empId'))
+      }
+    }, function (res) {
+      wx.showToast({
+        title: '加载数据失败',
+        icon: 'none',
+        duration: 2000
+      })
+    })
+  },
+  getMyRank:function(){
+  var that = this
+  var data = { 
+    openid: wx.getStorageSync('openid'),
+   }
+    var url = baseUrl + BASEURL.getUrl.getRank
+    netUtil.requestLoading(url, data, '正在加载数据...', 'GET', function (res) {
+      if (res.data.success){
+        wx.setStorageSync('isregistered', res.data.data.isregistered)
+        if (res.data.data.pointdata){
+          var pointdata = res.data.data.pointdata
+          that.setData({
+            isregistered: res.data.data.isregistered,
+            pointdata: pointdata,
+            "curmonth_points": pointdata.curmonth_points == null ? '0' : pointdata.curmonth_points, //本月当前积分
+            "curmonth_rank": pointdata.curmonth_rank == null ? '0' : pointdata.curmonth_rank,//本月当前排名
+            "lastmonth_points": pointdata.lastmonth_points == null ? '0' : pointdata.lastmonth_points,//上月积分
+            "lastmonth_rank": pointdata.lastmonth_rank == null ? '-' : pointdata.lastmonth_rank //上月排名
+          })
+
+        }
+      }
+    }, function (res) {
+      wx.showToast({
+        title: '加载数据失败',
+        icon: 'none',
+        duration: 2000
+      })
+    })
+  },
+  bindGetUserInfo: function (e) {
+    var that = this
+    var userInfo = e.detail.userInfo
+    if (!userInfo) return
+    console.log('bindGetUserInfo', userInfo)
+    var nickName = userInfo.nickName
+    var avatarUrl = userInfo.avatarUrl
+    var gender = userInfo.gender //性别 0:未知、1:男、2:女
+    var province = userInfo.province
+    var city = userInfo.city
+    var country = userInfo.country
+    if (nickName && avatarUrl) {
+      baseutils.getPersonlEmp()
+      baseutils.judgeisReg()
+      that.getMyRank()
+      that.setData({
+        wxNickname: nickName,
+        wxHeader: avatarUrl,
+        isLogin: true
+      })
+      try {
+        wx.setStorageSync('wxavatarUrl', userInfo.avatarUrl)
+        wx.setStorageSync('wxnickName', userInfo.nickName)
+      } catch (e) {
+      }
+    }
+
+  },
+
+  comToast: function (title) {
+    wx.showToast({
+      title: title,
+      icon: 'none',
+      duration: 2000
+    })
+  },
+
+
+
+
+
+
+
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
 })

+ 54 - 53
utils/wxconstant.js

@@ -1,54 +1,55 @@
-function BaseUrl(){
-  // var baseUrl = 'http://192.168.253.130:8080'
-  var baseUrl = 'https://ss.ceduizixun.com'
-  return baseUrl
-}
-function getTXMapApiKay(){
-  return 'HPYBZ-IFY2J-E5KFY-K24IF-Q3UMS-GJFBV'
-}
-function isTest(){
-  var isTest = true  //判断是否是测试版本,是则打印日志
-  return isTest
-}
-
-function comLog(key,value){
-  if (isTest()){
-    console.log(key, value)
-  }
-}
-const getUrl = {
-  getOpenid:'/integral/inte/employee/getOpenid/', //获取Openid
-  Binding: '/integral/inte/employee/binding/', //关联用户
-  sendCode: '/integral/inte/employee/sendCode/', //获取验证码
-  getAd: '/integral/inte/ad/getAd/', //获取首页轮播图等
-  getRank: '/integral/inte/score/getRank/', //根据当前总积分取月排名
-  regist: '/integral/inte/employee/regist/', //员工注册
-  getDept: '/integral/inte/department/getDept/',  //获取公司部门列表
-  getCotegory: '/integral/inte/category/getCotegory/', //获得分类列表
-  getNorm: '/integral/inte/norm/getNorm/', //获取相应的规章制度详情
-  getAllApproval: '/integral/inte/invoices/getAllApproval/', //获取审批相关(待审批,已审批,发起)
-  saveMinusInvoices: '/integral/inte/invoices/saveMinusInvoices/', //保存扣积分
-  getAllRank: '/integral/inte/invoices/getAllRank/', //获取所有排名及加减分记录
-
-  getAllEmp: '/integral/inte/employee/getAllEmp/', //获取所有员工
-  getEmp: '/integral/inte/employee/getEmp/', //保存扣积分
-  getAllRank: '/integral/inte/invoices/getAllRank/', //获取所有排名及加减分记录
-  saveAddInvoices: '/integral/inte/invoices/saveAddInvoices/', //保存加积分
-  saveMinusInvoices: '/integral/inte/invoices/saveMinusInvoices/', //保存扣积分 
-  getNormByCategoryId: '/integral/inte/norm/getNormByCategoryId/', //获取分类下相应的规章制度
-  getInvoices: '/integral/inte/invoices/getInvoices/', //获取提交的单据详情  
-  withdrawInvoices: '/integral/inte/invoices/withdrawInvoices/', //撤回未审批的  
-  approval: '/integral/inte/invoices/approval/', //审批  
-  regist:'/integral/inte/employee/regist/',//员工注册
-  getByNormRank: '/integral/inte/invoices/getByNormRank/',//根据类别排序
-  getByNormIdRank: '/integral/inte/invoices/getByNormIdRank/',//规范明细排名
-  getAccessToken:'/integral/wx/getAccessToken/',
-  sendMessage: '/integral/wx/sendMessage/',//发送信息
-}
-module.exports = {
-  BaseUrl: BaseUrl,
-  getTXMapApiKay: getTXMapApiKay,
-  getUrl: getUrl,
-  comLog: comLog,
-  isTest: isTest
+function BaseUrl(){
+  // var baseUrl = 'http://10.1.80.188:8080'
+  var baseUrl = 'https://ss.ceduizixun.com'
+  return baseUrl
+}
+function getTXMapApiKay(){
+  return 'HPYBZ-IFY2J-E5KFY-K24IF-Q3UMS-GJFBV'
+}
+function isTest(){
+  var isTest = true  //判断是否是测试版本,是则打印日志
+  return isTest
+}
+
+function comLog(key,value){
+  if (isTest()){
+    console.log(key, value)
+  }
+}
+const getUrl = {
+  getOpenid:'/integral/inte/employee/getOpenid/', //获取Openid
+  Binding: '/integral/inte/employee/binding/', //关联用户
+  sendCode: '/integral/inte/employee/sendCode/', //获取验证码
+  getAd: '/integral/inte/ad/getAd/', //获取首页轮播图等
+  getRank: '/integral/inte/score/getRank/', //根据当前总积分取月排名
+  regist: '/integral/inte/employee/regist/', //员工注册
+  getDept: '/integral/inte/department/getDept/',  //获取公司部门列表
+  getCotegory: '/integral/inte/category/getCotegory/', //获得分类列表
+  getNorm: '/integral/inte/norm/getNorm/', //获取相应的规章制度详情
+  getAllApproval: '/integral/inte/invoices/getAllApproval/', //获取审批相关(待审批,已审批,发起)
+  saveMinusInvoices: '/integral/inte/invoices/saveMinusInvoices/', //保存扣积分
+  getAllRank: '/integral/inte/invoices/getAllRank/', //获取所有排名及加减分记录
+
+  getAllEmp: '/integral/inte/employee/getAllEmp/', //获取所有员工
+  getEmp: '/integral/inte/employee/getEmp/', //保存扣积分
+  getAllRank: '/integral/inte/invoices/getAllRank/', //获取所有排名及加减分记录
+  saveAddInvoices: '/integral/inte/invoices/saveAddInvoices/', //保存加积分
+  saveMinusInvoices: '/integral/inte/invoices/saveMinusInvoices/', //保存扣积分 
+  getNormByCategoryId: '/integral/inte/norm/getNormByCategoryId/', //获取分类下相应的规章制度
+  getInvoices: '/integral/inte/invoices/getInvoices/', //获取提交的单据详情  
+  withdrawInvoices: '/integral/inte/invoices/withdrawInvoices/', //撤回未审批的  
+  approval: '/integral/inte/invoices/approval/', //审批  
+  regist:'/integral/inte/employee/regist/',//员工注册
+  getByNormRank: '/integral/inte/invoices/getByNormRank/',//根据类别排序
+  getByNormIdRank: '/integral/inte/invoices/getByNormIdRank/',//规范明细排名
+  getAccessToken:'/integral/wx/getAccessToken/',
+  sendMessage: '/integral/wx/sendMessage/',//发送信息
+  getByEmp: '/integral/inte/company/getByEmp/',
+}
+module.exports = {
+  BaseUrl: BaseUrl,
+  getTXMapApiKay: getTXMapApiKay,
+  getUrl: getUrl,
+  comLog: comLog,
+  isTest: isTest
 }