فهرست منبع

Merge branch 'master' of http://39.106.8.246:3003/sagacloud/sagacloud-sagacare-weChat

zhaojing 1 سال پیش
والد
کامیت
6adc2fdd3a

+ 6 - 1
project.config.json

@@ -44,7 +44,12 @@
     "tabSize": 2
   },
   "packOptions": {
-    "ignore": [],
+    "ignore": [
+      {
+        "value": "static",
+        "type": "folder"
+      }
+    ],
     "include": []
   },
   "appid": "wxda2ef261ac3cca32"

+ 48 - 1
src/api/user.js

@@ -1,4 +1,5 @@
 import $http from '@/common/request.js';
+import config from '@/config';
 function getCompmayUsers() {
   return $http({
     url: `/user/companyUsers`,
@@ -6,6 +7,7 @@ function getCompmayUsers() {
   });
 }
 
+// 获取用户信息
 function getUserInfo(params) {
   return $http({
     url: '/user/info',
@@ -23,11 +25,56 @@ function setWxAuthUserInfo(params) {
   // return Promise.resolve()
 }
 
+function login(params) {
+  return $http({
+    url: `${config.duoduoenvService}userNew/wechat/login`,
+    method: 'POST',
+    data: JSON.stringify(params)
+  })
+}
+
+// duoduo-service/duoduoenv-service/userNew/wechat/register
+// 注册
+function register(params) {
+  return $http({
+    url: `${config.duoduoenvService}userNew/wechat/register`,
+    method: 'POST',
+    isComParams:true,
+    data: JSON.stringify(params)
+  })
+}
+
+// 根据手机号获取租户数据
+function getCompanyByPhone(params) {
+  return $http({
+    url: `${config.duoduoenvService}userNew/company?phone=${params.phone}`,
+    method: 'get'
+  })
+}
 
+// 根据code获取手机号
+function getPhoneNumber(code) {
+  return $http({
+    url: `${config.duoduoenvService}userNew/wechat/getPhoneNumber?code=${code}`,
+    method: 'get'
+  })
+}
 
+// 续约
+function refreshToken(refreshToken) {
+  return $http({
+    url: `${config.duoduoenvService}userNew/wechat/refreshToken?refreshToken=${refreshToken}`,
+    method: 'get'
+  })
+}
 
 
 export {
   getCompmayUsers,
-  getUserInfo
+  getUserInfo,
+  getPhoneNumber,
+  getCompanyByPhone,
+  register,
+  login,
+  refreshToken
 }

+ 11 - 8
src/app.wpy

@@ -10,11 +10,11 @@
 </style>
 
 <script>
-import wepy from '@wepy/core'
-import eventHub from './common/eventHub'
-import vuex from '@wepy/x'
+import wepy from '@wepy/core';
+import eventHub from './common/eventHub';
+import vuex from '@wepy/x';
 
-wepy.use(vuex)
+wepy.use(vuex);
 
 wepy.app({
   hooks: {
@@ -22,7 +22,7 @@ wepy.app({
     // 同时存在 Page hook 和 App hook 时,优先执行 Page hook,返回值再交由 App hook 处
     'before-setData': function(dirty) {
       //   console.log('setData dirty: ', dirty);
-      return dirty
+      return dirty;
     }
   },
   globalData: {
@@ -38,12 +38,13 @@ wepy.app({
   },
 
   methods: {}
-})
+});
 </script>
 <config>
 {
     pages: [
       'pages/index',
+      'pages/auth/index',
       'pages/bindTenant/index',
     ],
     "subpackages":[
@@ -58,7 +59,6 @@ wepy.app({
           'pages/officehome/detail',
           'pages/officehome/demo',
           'pages/portrait/home',
-          'pages/portrait/visitor',
           'pages/portrait/meeting',
           'pages/portrait/energy',
           'pages/portrait/energyPoint',
@@ -67,7 +67,10 @@ wepy.app({
           'pages/portrait/pointRanking',
           'pages/portrait/ajustRecord',
           'pages/portrait/carbonEnterprise',
-          'pages/personalCenter/index'
+          'pages/personalCenter/index',
+          'pages/personalCenter/personalInfo',
+          'pages/personalCenter/operating',
+          'pages/personalCenter/xiaosa',
         ]
       },
     ],

+ 24 - 17
src/common/request.js

@@ -1,6 +1,7 @@
 /* eslint-disable prefer-promise-reject-errors */
 import config from '@/config';
 import store from '@/store';
+import { checkTokenIsValid } from '@/service/user'
 import errorRequest from './errorRequest.js';
 // get参数反序列化
 const setQueryConfig = function (queryConfig) {
@@ -18,18 +19,27 @@ function storeUser() {
   return store.state.user.userInfo;
 }
 
-function getProjectId() {
-  return (
-    store.state.company.companyConfig &&
-    store.state.company.companyConfig.sagacareProjectId
-  );
+function storeToken() {
+  return store.state.user.token;
 }
 
 // 通用参数携带
 function commonParams() {
-  return `openid=${storeUser().userId}&pubname=${config.brsgServer.pubname
-    }&projectId=${getProjectId()}&userName=${storeUser().userName}&userPhone=${storeUser().phone
-    }&userId=${storeUser().userId}`;
+  // openid=${storeUser().openId}&
+  let url = `pubname=${config.brsgServer.pubname}`
+  if (storeUser().projectId) {
+    url = url + `&projectId=${storeUser().projectId}`
+  }
+  if (storeUser().userName) {
+    url = url + `&userName=${storeUser().userName}`
+  }
+  if (storeUser().userId) {
+    url = url + `&userId=${storeUser().userId}`
+  }
+  if (storeToken()) {
+    url = url + `&saga_token=${storeToken()}`
+  }
+  return url;
 }
 
 export default function (info) {
@@ -51,14 +61,13 @@ export default function (info) {
     } else {
       info.url = `${info.url}?${commonParams()}`
     }
-
   }
 
   const token = store.state.user.token;
   if (token) {
-    info.header = Object.assign({
-      token
-    }, info.header)
+    info.header = Object.assign(
+      { 'saga_token': token }
+      , info.header)
   }
 
   info.timeout = info.timeout || 10 * 1000; // 默认超时为10s
@@ -85,11 +94,9 @@ export default function (info) {
           console.error(error);
         }
         if (res.statusCode === 401) {
-          if (store.state.user.tokenIsValid) {
-            // 刷新首页
-            store.commit('setTokenIsValid', false);
-            store.commit('setToken', '');
-            wx.redirectTo({ url: '/pages/homev2' });
+          if (checkTokenIsValid() == 2) { // 登录过期后重新从首页刷新进入
+            // store.commit('clearToken','');
+            wx.redirectTo({ url: '/packagesEnv/pages/home/index' });
           }
         } else if (res.statusCode >= 400) {
           reject(res.errMsg);

+ 1 - 1
src/config/base.js

@@ -2,7 +2,7 @@
 const brsgServer = {
   duoduoUrl: 'https://duoduoenv.sagacloud.cn',
   projectId: 'Pj1101080259',
-  pubname: 'sagacareAndtenantslink',
+  pubname: 'sagacareWeChat',
   openid: 'sagacareAndtenantslinkTest'
 }
 

+ 61 - 0
src/packagesEnv/pages/personalCenter/footer.wpy

@@ -0,0 +1,61 @@
+<style lang='less' scoped>
+    .footer {
+        position: absolute;
+        bottom: 68rpx;
+        left: 50%;
+        transform: translate(-50%);
+        .footer-content {
+            display: flex;
+            justify-content: center;
+            align-items: center;
+        }
+        .text {
+            font-family: PingFang SC;
+            font-size: 28rpx;
+            font-weight: 400;
+            line-height: 44rpx;
+            color: #8b949e;
+            padding: 0 16rpx;
+        }
+        .footer-line {
+            width: 40rpx;
+            border: 2rpx;
+            border: 2rpx solid #c4c9cf;
+        }
+    }
+</style>
+<!-- 个人中心 -->
+<template>
+        <div class="footer">
+            <div class="footer-content">
+                <div class="footer-line"></div>
+                <div class="text">小飒智控</div>
+                <div class="footer-line"></div>
+            </div>
+        </div>
+</template>
+
+<script>
+
+import wepy from '@wepy/core'
+// import config from '@/config';
+wepy.component({
+  name: 'Footer',
+  props: {},
+  data: {
+
+  },
+  computed: {},
+  methods: {
+
+  },
+// 生命周期 - 创建完成(可以访问当前this实例)
+  created() {
+
+  },
+// 生命周期 - 挂载完成(可以访问DOM元素)
+  mounted() {
+
+  }
+})
+</script>

+ 219 - 11
src/packagesEnv/pages/personalCenter/index.wpy

@@ -1,36 +1,244 @@
+<style lang='less'>
+page {
+    height: 100%;
+    background: #ebf5fa;
+}
+.percsonal-center {
+    width: 100%;
+    height: 100%;
+    overflow: hidden;
+    box-sizing: border-box;
+    position: relative;
+
+    .imgst {
+        width: 100%;
+        height: 784rpx;
+        background-color: #ebf5fa;
+        position: absolute;
+        top: 0;
+        left: 0;
+        z-index: 0;
+    }
+    .contain {
+        padding-top: 240rpx;
+        position: relative;
+        z-index: 1;
+        .head {
+            display: flex;
+            align-items: center;
+            .imgHead {
+                margin-left: 56rpx;
+                margin-right: 20rpx;
+                width: 128rpx;
+                height: 128rpx;
+            }
+            .p-name {
+                margin-right: 8rpx;
+                font-family: PingFang SC;
+                font-size: 44rpx;
+                font-weight: 600;
+                line-height: 64rpx;
+                color: #1b2129;
+            }
+            .p-comp {
+                padding-top: 8rpx;
+                font-family: PingFang SC;
+                font-size: 28rpx;
+                font-weight: 400;
+                line-height: 44rpx;
+                color: #626c78;
+            }
+        }
+        .content {
+            padding: 40rpx;
+            padding-top: 64rpx;
+            .card-box {
+                display: flex;
+                justify-content: space-between;
+                padding-bottom: 20rpx;
+                .little-card {
+                    text-align: center;
+                    width: 326rpx;
+                    height: 200rpx;
+                    padding-top: 36rpx;
+                    border-radius: 40rpx;
+                    box-sizing: border-box;
+                    background: #ffffff;
+                    .little-imgst {
+                        width: 64rpx;
+                        height: 64rpx;
+                    }
+                    .text {
+                        padding-top: 8rpx;
+                        font-family: PingFang SC;
+                        font-size: 32rpx;
+                        font-weight: 400;
+                        line-height: 48rpx;
+                        color: #1b2129;
+                    }
+                }
+                .hover-st {
+                    background: #f1f4f6;
+                }
+            }
+            .big-card {
+                width: 670rpx;
+                height: 288rpx;
+                padding: 24rpx 0px 24rpx 0px;
+                border-radius: 40rpx;
+                box-sizing: border-box;
+                background: #ffffff;
+                .each-row {
+                    width: 100%;
+                    height: 120rpx;
+                    padding-left: 40rpx;
+                    display: flex;
+                    align-items: center;
+                    .each-row-imgst {
+                        width: 48rpx;
+                        height: 48rpx;
+                        margin-right: 24rpx;
+                    }
+                    .each-row-text {
+                        font-family: PingFang SC;
+                        font-size: 32rpx;
+                        font-weight: 400;
+                        line-height: 48rpx;
+                        color: #1b2129;
+                    }
+                }
+                .hover-st {
+                    background: #f1f4f6;
+                }
+            }
+        }
+    }
+}
+</style>
 <!-- 个人中心 -->
 <template>
-<div class=''>
-    个人中心
-</div>
+    <div class="percsonal-center">
+        <page-top-bar icon="{{h5Static+'/page-top-bar/return-icon.svg'}}"></page-top-bar>
+        <image
+            class="imgst"
+            src="{{h5StaticPath}}/bg-personal.png"
+            mode="widthFix"
+            alt
+        />
+        <div class="contain">
+            <div class="head">
+                <image
+                    class="imgHead"
+                    src="{{h5StaticPath}}/no-person.png"
+                />
+                <div @click="goToPersonalInfo">
+                    <div>
+                        <span class="p-name">纳兰词</span>
+                        <image
+                            style="width: 24rpx;height: 24rpx;"
+                            src="{{h5StaticPath}}/icon-arrow-right.svg"
+                        />
+                    </div>
+                    <div class="p-comp">上格云智能技术有限公司</div>
+                </div>
+            </div>
+            <div class="content">
+                <div class="card-box">
+                    <div
+                        hover-class="hover-st"
+                        hover-style-time="100"
+                        class="little-card"
+                    >
+                        <image
+                            class="little-imgst"
+                            src="{{h5StaticPath}}/icon-leaf.png"
+                        />
+                        <div class="text">我的习惯</div>
+                    </div>
+                    <div
+                        hover-class="hover-st"
+                        hover-style-time="100"
+                        class="little-card"
+                        @click="handleAdd"
+                    >
+                        <image
+                            class="little-imgst"
+                            src="{{h5StaticPath}}/icon-to-desk.png"
+                        />
+                        <div class="text">添加到桌面</div>
+                    </div>
+                </div>
+                <div class="big-card">
+                    <div
+                        hover-class="hover-st"
+                        hover-style-time="100"
+                        v-for="item in arr"
+                        :key="item.icon"
+                        class="each-row"
+                        @click="toPage(item.url)"
+                    >
+                        <image
+                            class="each-row-imgst"
+                            src="{{h5StaticPath}}/{{item.icon}}"
+                        />
+                        <span class="each-row-text">{{item.name}}</span>
+                    </div>
+                </div>
+
+            </div>
+        </div>
+        <footer></footer>
+    </div>
 </template>
 
 <script>
 import wepy from '@wepy/core'
-import store from '@/store'
 import config from '@/config'
 wepy.page({
-// import引入的组件需要注入到对象中才能使用
   components: {},
   props: {},
   data: {
-
+    h5StaticPath: config.h5StaticPath + '/page-personalCenter',
+    h5Static: config.h5StaticPath,
+    arr: [
+            // { name: '问题反馈', icon: 'icon-message.svg', url: '' },
+            { name: '操作指引', icon: 'icon-guid.svg', url: '/packagesEnv/pages/personalCenter/operating' },
+            { name: '关于小飒指控', icon: 'icon-tip.svg', url: '/packagesEnv/pages/personalCenter/xiaosa' }
+    ]
   },
   computed: {},
   methods: {
+    toPage(url) {
+      wx.navigateTo({
+        url: url
+      })
+    },
+    goToPersonalInfo() {
+      wx.navigateTo({
+        url: '/packagesEnv/pages/personalCenter/personalInfo'
+      })
+    }
 
   },
-// 生命周期 - 创建完成(可以访问当前this实例)
+    // 生命周期 - 创建完成(可以访问当前this实例)
   created() {
 
   },
-// 生命周期 - 挂载完成(可以访问DOM元素)
+    // 生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
 
   }
 })
 </script>
-<style lang='less' scoped>
-//@import url(); 引入公共css类
+<config>
+{
+    'navigationBarTitleText': '',
+    navigationStyle:"custom",
+    backgroundColor: '#EBF5FA',
+    usingComponents: {
+        'page-top-bar': '~@/components/common/page-top-bar', 
+        'footer':'./footer'     
+    },
 
-</style>
+}
+</config>

+ 122 - 0
src/packagesEnv/pages/personalCenter/operating.wpy

@@ -0,0 +1,122 @@
+<style lang='less' scoped>
+page {
+    height: 100%;
+    background: #ebf5fa;
+}
+.operating {
+    padding-top: 244rpx;
+    padding-left: 56rpx;
+    padding-right: 56rpx;
+    height: 600rpx;
+    background: linear-gradient(
+        180deg,
+        rgba(61, 203, 204, 0.2) 0%,
+        rgba(61, 203, 204, 0) 100.34%
+    );
+    .each-row {
+        display: flex;
+        justify-content: space-between;
+        align-items: center;
+        .each-box {
+            .title {
+                font-family: PingFang SC;
+                font-size: 36rpx;
+                font-weight: 600;
+                line-height: 56rpx;
+                color: #1b2129;
+            }
+            .text {
+                width: 416rpx;
+                overflow: hidden;
+                text-overflow: ellipsis;
+                white-space: nowrap;
+                font-family: PingFang SC;
+                font-size: 26rpx;
+                font-weight: 400;
+                line-height: 40rpx;
+                color: #626c78;
+            }
+        }
+        .each-img {
+            width: 94px;
+            height: 78px;
+            border-radius: 12px;
+        }
+    }
+    .divider {
+        border-top: 1px solid #c4c9cf4d;
+        margin-top: 48rpx;
+        margin-bottom: 48rpx;
+    }
+}
+</style>
+<!-- 操作指引 -->
+<template>
+    <page-top-bar
+        title="操作指引"
+        titleColor="#1B2129"
+        icon="{{h5Static+'/page-top-bar/return-icon.svg'}}"
+    ></page-top-bar>
+    <div class="operating">
+        <div
+            v-for="(item,idx) in arr"
+            :key="item.title"
+        >
+            <div  class="each-row">
+                <div class="each-box">
+                    <div class="title">{{item.title}}</div>
+                    <div class="text">{{item.text}}</div>
+                </div>
+                <image
+                    class="each-img"
+                    src="{{h5StaticPath}}/{{ item.img }}"
+                />
+            </div>
+
+            <div class="divider" v-if="idx != arr.length-1"> </div>
+
+        </div>
+    </div>
+</template>
+
+<script>
+
+import wepy from '@wepy/core'
+import config from '@/config'
+wepy.page({
+  props: {},
+  data: {
+    h5Static: config.h5StaticPath,
+    h5StaticPath: config.h5StaticPath + '/page-personalCenter',
+    arr: [
+            { title: '如何置常驻工区?', text: '设定后将在首页置顶显示,方便调节', img: 'operation-work.png', url: '' },
+            { title: '如何获取碳积分?', text: '这是一句解释,这是一句解释', img: 'operation-carbon.png', url: '' },
+            { title: '如何预约加时?', text: '这是一句解释,这是一句解释', img: 'operation-time.png', url: '' }
+    ]
+
+  },
+  computed: {},
+  methods: {
+
+  },
+    // 生命周期 - 创建完成(可以访问当前this实例)
+  created() {
+
+  },
+    // 生命周期 - 挂载完成(可以访问DOM元素)
+  mounted() {
+
+  }
+})
+</script>
+<config>
+    {
+        navigationStyle:"custom",
+        backgroundColor: '#EBF5FA',
+        usingComponents: {
+            'page-top-bar': '~@/components/common/page-top-bar', 
+            'footer':'./footer'     
+        }
+    }
+
+</config>

+ 118 - 0
src/packagesEnv/pages/personalCenter/personalInfo.wpy

@@ -0,0 +1,118 @@
+<style lang='less' scoped>
+page{
+    height:100%;
+    background: #EBF5FA;
+}
+.personal-info{
+    padding-top: 40rpx;
+    padding-left: 24rpx;
+    padding-right: 22rpx;
+    .top-box{
+        width: 100%;
+        border-radius: 32rpx;
+        box-sizing: border-box;
+        background: #FFFFFF;
+        .top-item{
+            height:112rpx;
+            border-bottom: 2px solid #C4C9CF4D;
+            display: flex;
+            justify-content: space-between;
+            align-items: center;
+            padding: 0 40rpx;
+
+            .name{
+                font-family: PingFang SC;
+                font-size: 32rpx;
+                font-weight: 400;
+                line-height: 48rpx;
+                color: #1B2129;
+            }
+            .text{
+                font-family: PingFang SC;
+                font-size: 32rpx;
+                font-weight: 400;
+                line-height: 48rpx;
+                color: #626C78;
+            }
+            .imgst{
+                width: 96rpx;
+                height: 96rpx;
+                border: 2px;
+                background: #FFFFFF99;
+                border: 4rpx solid #FFFFFF99;
+            }
+        }
+        .top-item:first-child{
+            height:152rpx;
+        }
+        .top-item:last-child{
+            border-bottom: 0px;
+        }
+
+
+    }
+    .top-box:last-child{
+        margin-top:24rpx;
+    }
+
+}
+</style>
+<!-- 个人信息 -->
+<template>
+    <div class="personal-info">
+        <div class="top-box">
+            <div  v-for="item in  topArr" :key="item.name" class="top-item">
+                <div  class="name">{{item.name}}</div>
+                <image v-if="item.text == ''" src="{{h5StaticPath}}/{{ item.url }}" class="imgst" />
+                <div v-else  class="text">{{item.text}}</div>
+            </div>
+        </div>
+        <div class="top-box" >
+            <div  v-for="item in  nextArr" :key="item.name" class="top-item" style="height: 112rpx;">
+                <div class="name">{{item.name}}</div>
+                <div class="text">{{item.text}}</div>
+            </div>
+        </div>
+    </div>
+</template>
+
+<script>
+
+import wepy from '@wepy/core'
+import config from '@/config'
+wepy.page({
+  props: {},
+  data: {
+    h5StaticPath: config.h5StaticPath + '/page-personalCenter',
+    topArr: [
+        {name: '头像', text: '', url: 'no-person.png'},
+        {name: '姓名', text: '尹亚琼', url: ''},
+        {name: '手机号', text: '186909090', url: ''}
+    ],
+    nextArr: [
+        {name: '岗位', text: 'UX设计师'},
+        {name: '所属', text: '上格云智能技术有限公司'}
+    ]
+  },
+  computed: {},
+  methods: {
+
+  },
+    // 生命周期 - 创建完成(可以访问当前this实例)
+  created() {
+
+  },
+    // 生命周期 - 挂载完成(可以访问DOM元素)
+  mounted() {
+
+  }
+})
+</script>
+<config>
+    {
+        'navigationBarBackgroundColor': '#EBF5FA',
+        backgroundColor: '#EBF5FA',
+        'navigationBarTitleText': '排行榜',
+    }
+
+</config>

+ 329 - 0
src/packagesEnv/pages/personalCenter/xiaosa.wpy

@@ -0,0 +1,329 @@
+<style lang='less' scoped>
+page {
+    height: 100%;
+    background: #ebf5fa;
+}
+.operating {
+    width: 654rpx;
+    padding-top: 244rpx;
+    padding-left: 56rpx;
+    padding-right: 56rpx;
+    padding-bottom: 66rpx;
+    height: 600rpx;
+    background: linear-gradient(
+        180deg,
+        rgba(61, 203, 204, 0.2) 0%,
+        rgba(61, 203, 204, 0) 100.34%
+    );
+    .title {
+        padding-bottom: 72rpx;
+        font-family: PingFang SC;
+        font-size: 48rpx;
+        font-weight: 600;
+        line-height: 68rpx;
+        color: rgba(27, 33, 41, 1);
+    }
+    .each-box {
+        .img-box {
+            width: 100%;
+            height: 360rpx;
+            margin-bottom: 64rpx;
+        }
+        .each-title {
+            margin-bottom: 64rpx;
+            height: 208rpx;
+            background: linear-gradient(
+                90deg,
+                rgba(61, 203, 204, 0.3) 0%,
+                rgba(61, 203, 204, 0) 100%
+            );
+            border-left: 3px solid #3dcbcc;
+            padding-left: 32rpx;
+            padding-top: 24rpx;
+            box-sizing: border-box;
+            .big-id {
+                font-family: Persagy2.0;
+                font-size: 44rpx;
+                font-weight: 600;
+                line-height: 64rpx;
+                color: #1b2129;
+            }
+            .big-title {
+                font-family: PingFang SC;
+                font-size: 16px;
+                font-weight: 600;
+                line-height: 24px;
+                color: #1b2129;
+            }
+            .titletop {
+                margin-bottom: 64rpx;
+                font-family: PingFang SC;
+                font-size: 16px;
+                font-weight: 600;
+                line-height: 28px;
+                color: #1b2129;
+            }
+        }
+        .each-child {
+            .child-title {
+                margin-top: 64rpx;
+                margin-bottom: 16rpx;
+                font-family: PingFang SC;
+                font-size: 32rpx;
+                font-weight: 600;
+                line-height: 56rpx;
+                color: #1b2129;
+            }
+            .child-text {
+                margin-bottom: 64rpx;
+                font-family: PingFang SC;
+                font-size: 32rpx;
+                font-weight: 400;
+                line-height: 56rpx;
+                color: #626c78;
+            }
+        }
+    }
+    .info {
+        height: 460rpx;
+        padding: 48rpx 40rpx 48rpx 40rpx;
+        box-sizing: border-box;
+        border-radius: 32rpx;
+        background: rgba(61, 203, 204, 0.2);
+        .info-title {
+            font-family: PingFang SC;
+            font-size: 32rpx;
+            font-weight: 600;
+            line-height: 48rpx;
+            color: rgba(27, 33, 41, 1);
+        }
+        .content {
+            margin-top: 48rpx;
+            margin-bottom: 48rpx;
+        }
+        .info-text {
+            font-family: PingFang SC;
+            font-size: 28rpx;
+            font-weight: 400;
+            line-height: 44rpx;
+            color: rgba(98, 108, 120, 1);
+            .highlight {
+                color: #1db1b2;
+            }
+        }
+    }
+    .pop {
+        .up-box {
+            text-align: center;
+            height: 100rpx;
+            padding: 13px 16px 13px 16px;
+            border-bottom: 16rpx solid #f1f4f6;
+            font-family: PingFang SC;
+            font-size: 32rpx;
+            font-weight: 400;
+            line-height: 100rpx;
+            color: #1db1b2;
+        }
+        .down-box {
+            text-align: center;
+            height: 180rpx;
+            padding-bottom: 80rpx;
+            font-family: PingFang SC;
+            font-size: 32rpx;
+            font-weight: 400;
+            line-height: 100rpx;
+            color: #8b949e;
+        }
+    }
+}
+</style>
+<!-- 操作指引 -->
+<template>
+    <page-top-bar icon="{{h5Static+'/page-top-bar/return-icon.svg'}}"></page-top-bar>
+    <div class="operating">
+        <div class="title">关心环境,更关心你</div>
+        <div
+            class="each-box"
+            v-for="item in arr"
+            :key="item.id"
+        >
+            <image
+                class="img-box"
+                src="{{h5StaticPath }}/{{item.img}}"
+            />
+            <div class="each-title">
+                <div class="big-id">{{item.id}}</div>
+                <div class="big-title">{{item.title }}</div>
+            </div>
+            <div
+                v-if="item.titletop"
+                class="titletop"
+            >{{ item.titletop }}</div>
+            <div
+                v-for="child in  item.content"
+                :key="child.title"
+                class="each-child"
+            >
+                <div
+                    class="child-title"
+                    v-if="child.title"
+                >{{ child.title }}</div>
+                <div class="child-text">{{ child.text }}</div>
+            </div>
+        </div>
+        <div>
+            <!-- 视频 -->
+        </div>
+        <div class="info">
+            <div class="info-title">
+                SagaCare – Care about you
+            </div>
+            <div class="content">
+                <div class="info-text">更多智慧办公解决方案请详询:</div>
+                <div
+                    class="info-text"
+                    @click="openPop(true)"
+                >电话: <span class="highlight">{{ phoneNum }}</span></div>
+                <div class="info-text">邮箱:{{ mailbox }} <span
+                        class="highlight"
+                        @click="handleCopy"
+                    >复制</span></div>
+            </div>
+            <div class="info-text">各版块解决方案内容均包含硬件实施、软件配置、定制化咨询服务</div>
+        </div>
+        <van-popup
+            custom-style="height: 20%"
+            round
+            :show="visibale"
+            position="bottom"
+            @close="visibale = false"
+        >
+            <div class="pop">
+                <div
+                    class="up-box"
+                    @click="handleCall"
+                >呼叫 {{ phoneNum }}</div>
+                <div
+                    class="down-box"
+                    @click="openPop(false)"
+                >取消</div>
+            </div>
+        </van-popup>
+    </div>
+</template>
+
+<script>
+
+import wepy from '@wepy/core'
+import config from '@/config'
+wepy.page({
+  props: {},
+  data: {
+    h5Static: config.h5StaticPath,
+    h5StaticPath: config.h5StaticPath + '/page-xiaosa',
+    mailbox: 'sagacloud@sagacloud.cn',
+    phoneNum: '16601113547',
+    // phoneNum: '010 - 62668202',
+    visibale: false,
+    arr: [
+      {
+        id: '01',
+        title: '痛!大的开放办公区,员工量大,冷热不均,过度用电',
+        img: 'xiaosa-01.png',
+        content: [
+                    { title: '您是否还在用传统的空调面板?', text: '空调面板一排排,随便调节后,不清楚调节的是什么位置的空调;调节后没有效果。' },
+                    { title: '您是否经常听到有员工说办公室太热了;而有员工又说办公室太冷了?', text: '每个员工的体感温度不同,所需要的温度也是不一样的,无法照顾到每一个人,总是有员工不满意。' },
+                    { title: '您是否经常发现办公区无人,照明仍然亮着?', text: '在阳光充足的情况下;午休的时间;下班后等,不需要照明,灯仍然亮着,能源浪费着。' }
+        ]
+      },
+      {
+        id: '02',
+        title: '痛!会议室管理不合理',
+        img: 'xiaosa-02.png',
+        content: [
+                    { title: '没有预约机制', text: '经常有员工反馈,要么空出来好多会议室,要么没有可使用的会议室。' },
+                    { title: '有预约机制', text: '有部分员工不做预约,直接使用,使用过程中,被赶出来;有部分员工预约时间比较久,实际开会时间很短,设备全开,无人使用。' }
+        ]
+      },
+      {
+        id: '03',
+        title: '难!老板间,要特殊关注',
+        img: 'xiaosa-03.png',
+        content: [
+                    { title: '无法做到单独对老板间管理', text: '相关设备智能开关,根据老板个人情况智能控制,提前做好准备,让老板无感且舒适。' }
+        ]
+      },
+      {
+        id: '04',
+        title: '难!节能减排、双碳、ESG、企业可持续发展',
+        img: 'xiaosa-04.png',
+        content: [
+                    { title: '', text: '低碳节能离不开全员的参与,而行为节能往往最不可控;' },
+                    { title: '', text: '碳排放源不管是直接排放、能源间接排放还是其他间接排放,很难实现自身企业运营过程中的减碳。' }
+        ]
+      },
+      {
+        id: '05',
+        title: '您所担忧的问题,我们都能解决',
+        img: 'xiaosa-05.png',
+        titletop: 'SagaCare智慧办公整体解决方案:',
+        content: [
+                    { title: '热舒适解决方案', text: '环境监测、空调个性化调节、空气质量管理等' },
+                    { title: '光环境解决方案', text: '照明、遮阳、光感控制,节能管理等' },
+                    { title: '智能会议室解决方案', text: '会议室预约、场景化控制、在室监测等' },
+                    { title: '无感通行解决方案', text: '人脸识别门禁、访客管理等' },
+                    { title: '…', text: '' }
+        ]
+      }
+    ]
+
+  },
+  computed: {},
+  methods: {
+    openPop(val) {
+      this.visibale = val
+    },
+    handleCall() {
+      let _this = this
+      wx.makePhoneCall({
+        phoneNumber: this.phoneNum,
+        complete() {
+          _this.openPop(false)
+        }
+      })
+    },
+    handleCopy() {
+      wx.setClipboardData({
+        data: this.mailbox,
+        success(res) {
+          wx.getClipboardData({
+            success(res) {
+              console.log(res.data) // data
+              wx.showToast({ title: '已复制', icon: 'none', duration: 1000 })
+            }
+          })
+        }
+      })
+    }
+  },
+    // 生命周期 - 创建完成(可以访问当前this实例)
+  created() {
+
+  },
+    // 生命周期 - 挂载完成(可以访问DOM元素)
+  mounted() {
+
+  }
+})
+</script>
+<config>
+    {
+        navigationStyle:"custom",
+        backgroundColor: '#EBF5FA',
+        usingComponents: {
+            'page-top-bar': '~@/components/common/page-top-bar', 
+            "van-popup": "module:@vant/weapp/dist/popup"
+        }
+    }
+
+</config>

+ 2 - 1
src/packagesEnv/pages/portrait/home.wpy

@@ -125,7 +125,7 @@ page {
 <template>
     <div class="page-container">
         <page-top-bar
-            icon="{{h5StaticPath+'/topBar/return-icon.svg'}}"
+            icon="{{h5Static+'/page-top-bar/return-icon.svg'}}"
         ></page-top-bar>
         <image
             class="bg"
@@ -204,6 +204,7 @@ wepy.page({
     carbonCreditText: '',
     pageTopBarTop: 0,
     h5StaticPath: config.h5StaticPath + '/page-portrait',
+    h5Static: config.h5StaticPath,
     totalPoints: 0,
 
     arr: [

+ 165 - 0
src/pages/auth/index.wpy

@@ -0,0 +1,165 @@
+<style lang="less">
+.login-box {
+  padding-top: 40px;
+  .avatar-wrapper {
+    padding: 0px;
+    width: 196rpx;
+    height: 196rpx;
+    border-radius: 50%;
+    image {
+      width: 196rpx;
+      height: 196rpx;
+      border-radius: 50%;
+    }
+  }
+  .avatar-tip {
+    text-align: center;
+    font-family: PingFang SC;
+    font-size: 28rpx;
+    font-weight: 400;
+    line-height: 44rpx;
+    text-align: center;
+  }
+
+  .bind-btn-box {
+    position: fixed;
+    bottom: 228rpx;
+    left: 50%;
+    transform: translateX(-50%);
+    .bind-btn {
+      width: 548rpx;
+      height: 100rpx;
+      line-height: 100rpx;
+      border-radius: 56rpx;
+      background: rgba(61, 203, 204, 1);
+      border: none;
+      font-family: PingFang SC;
+      font-size: 32rpx;
+      font-weight: 400;
+      letter-spacing: 0px;
+      text-align: center;
+      color: #fff;
+    }
+    .bind-btn-tip {
+      //styleName: 14/常规;
+      font-family: PingFang SC;
+      padding-top: 32rpx;
+      font-size: 28rpx;
+      font-weight: 400;
+      line-height: 44rpx;
+      text-align: center;
+      color: rgba(139, 148, 158, 1);
+    }
+  }
+
+  .home-btn {
+    margin-top: 240rpx;
+    width: 548rpx;
+    height: 100rpx;
+    line-height: 100rpx;
+    border-radius: 56rpx;
+    border: 1px solid rgba(61, 203, 204, 1);
+  }
+}
+</style>
+<template>
+ <div class="login-box">
+  <button class="avatar-wrapper"
+    v-if="canIUseGetUserProfile"
+    open-type="chooseAvatar" 
+    bind:chooseavatar="onChooseAvatar">
+    <image class="avatar" src="{{avatarUrl}}"/>
+  </button>  
+  <div class="avatar-tip" v-if="canIUseGetUserProfile">可点击获取头像</div>
+  <div class="bind-btn-box">
+   <button class="bind-btn"
+   open-type="getPhoneNumber"
+   bindgetphonenumber="phonenumberAuth"
+   >微信手机号认证</button>
+   <!-- @click="goBindTenant" -->
+   <!-- bindgetphonenumber="phonenumberAuth" -->
+   <div class="bind-btn-tip">确保是入职公司使用的手机号</div>
+  </div>
+  <button class="home-btn" @click="goHome">首页</button>
+ </div>
+</template>
+
+<script>
+import wepy from '@wepy/core';
+import { mapState } from '@wepy/x';
+import store from '@/store';
+import config from '@/config';
+import { setAvatar, setUserInfoByAuth } from '@/service/user';
+import { getCompanyByPhone } from '@/api/user';
+let defaultAvatarUrl =
+  config.h5StaticPath + '/page-bind-tenant/default_avatar.svg';
+wepy.page({
+  store,
+  config: {
+    navigationBarTitleText: 'test'
+  },
+  data: {
+    nicknameValue: '',
+    avatarUrl: defaultAvatarUrl,
+    msg: '测试数据',
+    canIUseGetUserProfile: false,
+    userInformation: wx.getStorageSync('userInformation')
+  },
+  onLoad() {
+    if (wx.getUserProfile) {
+      this.canIUseGetUserProfile = true;
+    }
+  },
+  onShow() {},
+  methods: {
+    // 绑定租户
+    bindTenant() {},
+    onChooseAvatar(e) {
+      this.avatarUrl = e.$wx.detail.avatarUrl;
+      let avatarUrl = this.avatarUrl;
+      let that = this;
+      wx.getFileSystemManager().readFile({
+        filePath: avatarUrl,
+        encoding: 'base64',
+        success: function(res) {
+          console.log(res.data);
+          that.avatarUrl = 'data:image/png;base64,' + res.data;
+          setAvatar(that.avatarUrl);
+        }
+      });
+    },
+    getPageCompanyByPhone() {},
+    goHome() {
+      wx.navigateTo({
+        url: '/packagesEnv/pages/home/index'
+      });
+    },
+    // 手机号认证
+    phonenumberAuth(e) {
+      console.log(e);
+      // this.goBindTenant();
+      let detail = e.$wx.detail;
+      let code = detail.code;
+      let errMsg = detail.errMsg;
+      console.log(detail);
+      store.commit('setUserPhone', 15321277745);
+      // wx.setStorage('userPhone', 15321277745);
+      wx.navigateTo({
+        url: '/pages/bindTenant/index'
+      });
+    },
+    goBindTenant() {
+      console.log('被点击了');
+      wx.navigateTo({
+        url: '/pages/bindTenant/index'
+      });
+    }
+  },
+  created() {}
+});
+</script>
+<config>
+{
+navigationBarTitleText: '首页',
+}
+</config>

+ 108 - 24
src/pages/bindTenant/index.wpy

@@ -94,33 +94,24 @@ page {
   <page-top-bar title="公司身份选择" 
   titleColor="#1B2129" 
   bgColor="#EBF5FA"></page-top-bar>
-   <div class="bind-item check-item">
-      <div class="tenant-name">禹数科技有限公司</div>
+   <div class="bind-item" 
+     @click="changeTent(item)"
+     :class="{'check-item':selecItem.id==item.id}"
+     :key="index+'tent'"
+      v-for="(item,index) in tenantData">
+      <div class="tenant-name">{{ item.name }}</div>
       <div class="tenant-identity">
         <div class="info">正式员工</div>
-        <image class="logo-icon" src="{{h5StaticPath+'/page-bind-tenant/logo_icon.svg'}}"/>
+        <image class="logo-icon" v-if="item.logo" src="{{h5StaticPath+'/page-bind-tenant/logo_icon.svg'}}"/>
       </div>
-      <image class="checked-icon" src="{{h5StaticPath+'/page-bind-tenant/checked.svg'}}"/>
-   </div>
-   <div class="bind-item">
-      <div class="tenant-name">禹数科技有限公司</div>
-      <div class="tenant-identity">
-        <div class="info">正式员工</div>
-        <image class="logo-icon" src="{{h5StaticPath+'/page-bind-tenant/logo_icon.svg'}}"/>
-      </div>
-      <image class="checked-icon" src="{{h5StaticPath+'/page-bind-tenant/checked.svg'}}"/>
-   </div>
-   <div class="bind-item" :key="key" v-for="(item,key) in 20">
-      <div class="tenant-name">禹数科技有限公司</div>
-      <div class="tenant-identity">
-        <div class="info">正式员工</div>
-        <image class="logo-icon" src="{{h5StaticPath+'/page-bind-tenant/logo_icon.svg'}}"/>
-      </div>
-      <image class="checked-icon" src="{{h5StaticPath+'/page-bind-tenant/checked.svg'}}"/>
+      <image class="checked-icon" 
+       v-if="selecItem.id==item.id"
+      src="{{h5StaticPath+'/page-bind-tenant/checked.svg'}}"/>
    </div>
+   
 
    <div class="bind-btn-box">
-    <button @click="goEnv">确认</button>
+    <button @click.stop="bindTent">确认</button>
    </div>
  </div>
 </template>
@@ -130,7 +121,15 @@ import wepy from '@wepy/core';
 import { mapState } from '@wepy/x';
 import store from '@/store';
 import config from '@/config';
-import { setUserInfoByAuth } from '@/service/user';
+import {
+  setUserInfoByAuth,
+  getCompanyDataByPhone,
+  getAvatar,
+  wxLogin,
+  checkLoginNew,
+  checkTokenIsValid
+} from '@/service/user';
+import { register } from '@/api/user';
 
 wepy.page({
   store,
@@ -144,13 +143,98 @@ wepy.page({
         name: '科技公司1'
       }
     ],
+    selecItem: {},
     h5StaticPath: config.h5StaticPath
   },
-  onLoad() {},
+  computed: {
+    ...mapState({
+      userPhone: state => state.user.userPhone,
+      token: state => state.user.token
+    })
+  },
+  onLoad() {
+    this.getPageCompanyByPhone();
+  },
   onShow() {
-    // this.checkAuthCamra();
+    if (checkTokenIsValid() !== 3) {
+      checkLoginNew();
+    }
   },
   methods: {
+    changeTent(item) {
+      this.initTentData();
+      item.isChecked = true;
+      this.selecItem = item;
+    },
+    // 直接注册
+    registerTent(params) {
+      register(params)
+        .then(res => {
+          if (res.result == 'success') {
+            wxLogin().then(res => {
+              this.goHome();
+            });
+          } else {
+            this.returnLogin();
+          }
+        })
+        .catch(error => {
+          this.returnLogin();
+        });
+    },
+    // 注册
+    bindTent() {
+      let params = {
+        phone: this.userPhone,
+        defaultCompanyId: this.selecItem.id,
+        headImage: getAvatar()
+      };
+      if (checkTokenIsValid() == 3) {
+        // 未过期直接注册
+        this.registerTent(params);
+      } else {
+        checkLoginNew();
+      }
+    },
+    // 初始化租户
+    initTentData() {
+      this.tenantData.map(item => {
+        item.isChecked = false;
+      });
+    },
+    // 获取租户数据
+    getPageCompanyByPhone() {
+      getCompanyDataByPhone().then(res => {
+        console.log(res);
+        let data = res;
+        if (data && data.length) {
+          this.tenantData = data;
+          this.initTentData();
+          this.selecItem = this.tenantData[0];
+        } else {
+          wx.showToast({
+            title: '未获得公司服务权限!',
+            duration: 5000,
+            icon: 'none'
+          });
+          this.goHome();
+        }
+      });
+    },
+    getUserPhone() {
+      let phone = wx.getStorageSync('userPhone');
+      console.log(`phone==${phone}`);
+    },
+    goHome() {
+      wx.navigateTo({
+        url: '/packagesEnv/pages/home/index'
+      });
+    },
+    returnLogin() {
+      wx.navigateTo({
+        url: 'pages/index'
+      });
+    },
     goEnv() {
       wx.navigateTo({
         url:

+ 81 - 105
src/pages/index.wpy

@@ -1,34 +1,30 @@
 <style lang="less">
+page {
+  width: 100%;
+  height: 100%;
+}
 .login-box {
-  padding-top: 40px;
-  .avatar-wrapper {
-    padding: 0px;
-    width: 160rpx;
-    height: 160rpx;
-    border-radius: 50%;
-    image {
-      width: 160rpx;
-      width: 160rpx;
-      border-radius: 50%;
-    }
-  }
-  .avatar {
-    width: 160rpx;
-    height: 160rpx;
-  }
-
-  .weui-input {
-    margin: 0 auto;
-    margin-top: 40rpx;
-    padding: 0 20rpx;
-    width: 548rpx;
-    height: 100rpx;
-    line-height: 100rpx;
-    border-radius: 5px;
-    border: 1px solid rgba(61, 203, 204, 1);
+  box-sizing: border-box;
+  width: 100%;
+  height: 100%;
+}
+.login {
+  width: 100%;
+  height: 100%;
+  background: rgba(0, 0, 0.2);
+  image {
+    position: relative;
+    width: 384rpx;
+    height: 144rpx;
+    top: 336rpx;
+    left: 50%;
+    transform: translateX(-50%);
   }
   .bind-btn {
-    margin-top: 100rpx;
+    position: fixed;
+    bottom: 200rpx;
+    left: 50%;
+    transform: translateX(-50%);
     width: 548rpx;
     height: 100rpx;
     line-height: 100rpx;
@@ -42,108 +38,84 @@
     text-align: center;
     color: #fff;
   }
-  .phone-tip {
-    padding-top: 32rpx;
-    font-family: PingFang SC;
-    font-size: 28rpx;
-    font-weight: 400;
-    line-height: 44rpx;
-    letter-spacing: 0px;
-    text-align: center;
-    color: rgba(139, 148, 158, 1);
-    text-align: center;
-  }
-  .home-btn {
-    margin-top: 240rpx;
-    width: 548rpx;
-    height: 100rpx;
-    line-height: 100rpx;
-    border-radius: 56rpx;
-    border: 1px solid rgba(61, 203, 204, 1);
-  }
 }
 </style>
 <template>
- <div class="login-box">
-  <button class="avatar-wrapper"
-    open-type="chooseAvatar" 
-    bind:chooseavatar="onChooseAvatar">
-    <image class="avatar" src="{{avatarUrl}}"/>
-  </button> 
-  <form bindsubmit="submit">
-    <input type="nickname" 
-    value="{{nicknameValue}}"
-     class="weui-input" 
-    placeholder="请输入昵称"/>
-  </form>  
-  <button class="bind-btn"
-  open-type="getPhoneNumber"
-  @click="goBindTenant">微信手机号认证</button>
-
-   <!-- bindgetphonenumber="phonenumberAuth" -->
-  <div class="phone-tip">确保是入职公司使用的手机号</div>
-  <button class="home-btn" @click="goHome">首页</button>
- </div>
+  <div class="login-box">
+    <page-top-bar title="" 
+  titleColor="#1B2129"></page-top-bar>
+   <div class="login">
+       <image src="{{h5StaticPath +'/page-bind-tenant/logo_title.png'}}" alt=""/>
+       <button class="bind-btn"
+        @click="goBindTenant">登录</button>
+   </div>
+  </div>
 </template>
 
 <script>
 import wepy from '@wepy/core';
 import { mapState } from '@wepy/x';
 import store from '@/store';
-import { setUserInfoByAuth } from '@/service/user';
-let defaultAvatarUrl = '';
+import config from '@/config';
+import { wxLogin } from '@/service/user';
 wepy.page({
   store,
-  config: {
-    navigationBarTitleText: 'test'
-  },
   data: {
-    nicknameValue: '',
-    avatarUrl: defaultAvatarUrl,
-    msg: '测试数据',
-    userInformation: wx.getStorageSync('userInformation')
+    h5StaticPath: config.h5StaticPath,
+    isActivated: 0
   },
-  onLoad() {
-    if (wx.getUserProfile) {
-      this.canIUseGetUserProfile = true;
-    }
+  computed: {
+    ...mapState({ token: state => state.user.token }),
+    ...mapState({ isActivated: state => state.user.isActivated })
   },
+  onLoad() {},
   onShow() {
-    // this.checkAuthCamra();
+    // this.checkTenantRegist();
+    if (this.isActivated && this.isActivated == 1) {
+      this.goHome();
+    } else {
+      this.checkTenantRegist();
+    }
   },
   methods: {
-    // 绑定租户
-    bindTenant() {},
-    onChooseAvatar(e) {
-      // console.log('被点击了');
-      // console.log('被点击了',e)
-      console.log('avatarUrl', e.$wx.detail.avatarUrl);
-      console.log(e.$wx);
-      this.avatarUrl = e.$wx.detail.avatarUrl;
-      let avatarUrl = this.avatarUrl;
-      let baseImg = [];
-      let key = e.$wx.timeStamp;
-      let that = this;
-      wx.getFileSystemManager().readFile({
-        filePath: avatarUrl,
-        encoding: 'base64',
-        success: function(res) {
-          console.log(res.data);
-          that.avatarUrl = 'data:image/png;base64,' + res.data;
-        }
-      });
+    goBindTenant() {
+      this.goAuth();
+    },
+    checkTenantRegist() {
+      wxLogin(1)
+        .then(res => {
+          this.isActivated = res.isActivated;
+          let tokenInfo = {
+            expireTime: res.expireTime,
+            startTime: res.startTime,
+            refreshTokenExpireTime: res.refreshTokenExpireTime,
+            refreshToken: res.refreshToken
+          };
+          store.commit('setToken', res.token);
+          store.commit('setActivated', res.isActivated);
+          store.commit('setTokenInfo', tokenInfo);
+          if (this.isActivated && this.isActivated == 1) {
+            // 已经激活
+            store.commit('setTokenInfo', res.tokenUser);
+            this.goHome();
+          } else if (this.isActivated == 0) {
+            // 未激活
+            // this.goAuth();
+          } else {
+            // 作废
+          }
+        })
+        .catch(error => {});
     },
     goHome() {
       wx.navigateTo({
         url: '/packagesEnv/pages/home/index'
       });
     },
-    // 手机号认证
-    phonenumberAuth(e) {},
-    goBindTenant() {
+    goAuth() {
       console.log('被点击了');
       wx.navigateTo({
-        url: '/pages/bindTenant/index'
+        url: '/pages/auth/index'
       });
     }
   },
@@ -152,6 +124,10 @@ wepy.page({
 </script>
 <config>
 {
-navigationBarTitleText: '首页',
+navigationBarTitleText: '登录',
+navigationStyle:"custom",
+usingComponents: {
+    'page-top-bar': '~@/components/common/page-top-bar',      
+  },
 }
 </config>

+ 244 - 102
src/service/user.js

@@ -1,123 +1,265 @@
 import { getUserInfo, setWxAuthUserInfo, getThirdInfo, createAccount, changePhone } from '@/api/user.js';
 import store from '@/store';
 import config from '@/config';
-
-// 获取用户数据
-function getUserData() {
-    return new Promise((resolve, reject) => {
-        Promise.all([getUserInfo(), getThirdInfo()]).then(([userInfoRes, thirdInfores]) => {
-            let userInfo = userInfoRes.data || {};
-            let thirdInfo = thirdInfores.data || {};
-            let cachedInfo = wx.getStorageSync('UserInfo');
-            userInfo = { ...cachedInfo, ...userInfo, ...thirdInfo };
-            userInfo.userName = userInfo.userName || '';
-            // test 用户身份
-            // userInfo.roles = ['tenant.admin', 'operator', 'owner'];
-            // userInfo.phone = '';wxLogin
-            // userInfo.nickName = '';
-            // userInfo.userName = ''
-            userInfo = addRolesInfoToUserInfo(userInfo);
-            if (!userInfo.userName) {
-                userInfo.defaultUserName = 'Hello';
-            }
-            // todo 模拟银泰配置 接口增加buildingLogo
-            if (config.projectName === 'yintai') {
-                userInfo.buildingLogo = `${config.h5StaticPath}/page-yintai/project-logo.png`;
-            }
-            //   userInfo.companyId = 'c68dcccd57984277ab7736f2d257cd0c'
-            store.commit('setUserInfo', userInfo);
-            resolve(userInfo);
-        }).catch((res) => {
-            reject(res);
-        })
-    })
-}
+import { login, getCompanyByPhone, refreshToken } from '@/api/user.js';
+import { getAppId, getTimeStamp } from '@/utils/index';
 
 // 检查登录
 function checkLogin(needGetetUserInfo = true) {
-    let token = store.state.user.token;
-    if (!token) {
-        return wxLogin(needGetetUserInfo);
-    } else {
-        return Promise.resolve();
-    }
+  let token = store.state.user.token;
+  if (!token) {
+    return wxLogin(needGetetUserInfo);
+  } else {
+    return Promise.resolve();
+  }
 }
 
 //  检查用户信息
 function checkHasUserInfo() {
-    let userInfo = store.state.user.userInfo;
-    if (userInfo && JSON.stringify(userInfo) !== '{}') {
-        return Promise.resolve(userInfo);
-    } else {
-        return checkLogin(false).then(() => {
-            return getUserData();
-        })
-    }
+  let userInfo = store.state.user.userInfo;
+  if (userInfo && JSON.stringify(userInfo) !== '{}') {
+    return Promise.resolve(userInfo);
+  } else {
+    // return checkLogin(false).then(() => {
+    //   return getUserData();
+    // })
+    wxLogin();
+  }
 }
 
 function setUserInfoByAuth() {
-    return new Promise((resolve, reject) => {
-      // if (ing) {
-      //   return;
-      // }
-      // ing = true;
-      // let { userInfo = {} } = store.state.user;
-      // // 如果已经保存过了
-      // let nickName = userInfo.nickName;
-      // if (nickName) {
-      //   ing = false;
-      //   resolve();
-      //   return;
-      // }
-      wx.getUserProfile({
-        desc: '用于完善用户信息',
-        success: res => {
-          let detail = res;
-          wx.login({
-            success: loginRes => {
-              // ing = false;
-              // if (loginRes.code) {
-              //   let params = {
-              //     encryptedData: detail.encryptedData,
-              //     iv: detail.iv,
-              //     jsCode: loginRes.code
-              //   };
-              //   setWxAuthUserInfo(params).then(res => {
-              //     let userInfo = JSON.parse(detail.rawData);
-              //     let cachedInfo = wx.getStorageSync('UserInfo');
-              //     userInfo = {
-              //       ...cachedInfo,
-              //       ...userInfo,
-              //       headImgUrl: userInfo.avatarUrl
-              //     };
-              //     delete userInfo.avatarUrl;
-              //     store.commit('setUserInfo', {
-              //       ...userInfo
-              //     });
-              //     wx.setStorageSync('UserInfo', { ...userInfo });
-              //     resolve(res.data);
-              //   });
-              // }
-            },
-            fail: res => {
-              // ing = false;
-              // reject(res);
+  return new Promise((resolve, reject) => {
+    // if (ing) {
+    //   return;
+    // }
+    // ing = true;
+    // let { userInfo = {} } = store.state.user;
+    // // 如果已经保存过了
+    // let nickName = userInfo.nickName;
+    // if (nickName) {
+    //   ing = false;
+    //   resolve();
+    //   return;
+    // }
+    wx.getUserProfile({
+      desc: '用于完善用户信息',
+      success: res => {
+        let detail = res;
+        wx.login({
+          success: loginRes => {
+            // ing = false;
+            // if (loginRes.code) {
+            //   let params = {
+            //     encryptedData: detail.encryptedData,
+            //     iv: detail.iv,
+            //     jsCode: loginRes.code
+            //   };
+            //   setWxAuthUserInfo(params).then(res => {
+            //     let userInfo = JSON.parse(detail.rawData);
+            //     let cachedInfo = wx.getStorageSync('UserInfo');
+            //     userInfo = {
+            //       ...cachedInfo,
+            //       ...userInfo,
+            //       headImgUrl: userInfo.avatarUrl
+            //     };
+            //     delete userInfo.avatarUrl;
+            //     store.commit('setUserInfo', {
+            //       ...userInfo
+            //     });
+            //     wx.setStorageSync('UserInfo', { ...userInfo });
+            //     resolve(res.data);
+            //   });
+            // }
+          },
+          fail: res => {
+            // ing = false;
+            // reject(res);
+          }
+        });
+      },
+      fail: res => {
+        // ing = false;
+        // wx.showToast({
+        //   icon: 'none',
+        //   title: '授权用户公开信息后方可进入下一步操作'
+        // });
+        // reject();
+      }
+    });
+  });
+}
+
+// 登录
+function wxLogin(type) {
+  // type=1 如果type未激活和作废不需要跳转到登录页面
+  return new Promise((resolve, reject) => {
+    wx.login({
+      success(wxLoginRes) {
+        const jsCode = wxLoginRes.code;
+        const appId = getAppId();
+        if (jsCode) {
+          let params = {
+            "appId": appId,
+            "wxCode": jsCode
+          }
+          login(params).then(res => {
+            if (res.result == 'success') {
+              let data = res.data || []
+              let tokenInfo = {
+                expireTime: data.expireTime,
+                startTime: data.startTime,
+                refreshTokenExpireTime: data.refreshTokenExpireTime,
+                refreshToken: data.refreshToken
+              };
+              store.commit('setToken', data.token);
+              store.commit('setActivated', data.isActivated);
+              store.commit('setTokenInfo', tokenInfo);
+              if (data.isActivated && data.isActivated == 1) {
+                store.commit('setUserInfo', data.tokenUser);
+                store.commit('setProjectId', data.tokenUser.projectId);
+              } else {
+                if (!type) {
+                  wx.redirectTo({ url: '/pages/index' });
+                }
+                store.commit('setUserInfo', {});
+              }
+              resolve(data)
+            } else {
+              reject('login接口返回fail');
             }
+          })
+        } else {
+          wx.showToast({
+            title: `网络异常, 请稍后重试`,
+            icon: 'none',
+            duration: 5e3
           });
-        },
-        fail: res => {
-          // ing = false;
-          // wx.showToast({
-          //   icon: 'none',
-          //   title: '授权用户公开信息后方可进入下一步操作'
-          // });
-          // reject();
+          reject('wx.login接口返回code为空');
         }
-      });
+      },
+      fail(res) {
+        reject(res);
+        wx.showToast({
+          title: `网络异常, 请稍后重试`,
+          icon: 'none',
+          duration: 5e3
+        });
+      }
     });
+  });
+}
+
+// 获取租户信息
+function getCompanyDataByPhone() {
+  return new Promise((resolve, reject) => {
+    let userPhone = wx.getStorageSync('userPhone');
+    let params = {
+      phone: userPhone
+    }
+    if (userPhone) {
+      getCompanyByPhone(params).then(res => {
+        let data = res.data || []
+        resolve(data)
+      }).catch(() => {
+        reject({
+          mesg: '获取租户数据异常'
+        })
+      })
+    } else {
+      reject({
+        mesg: '无法获取手机号信息,跳转到首页'
+      })
+    }
+
+  });
+}
+
+// 登录续约
+function refreshTokenPage() {
+  refreshToken().then(res => {
+    if (res.result == 'success') {
+      let data = res.data || []
+      let tokenInfo = {
+        expireTime: data.expireTime,
+        startTime: data.startTime,
+        refreshTokenExpireTime: data.refreshTokenExpireTime,
+        refreshToken: data.refreshToken
+      };
+      store.commit('setToken', data.token);
+      store.commit('setActivated', data.isActivated);
+      store.commit('setTokenInfo', tokenInfo);
+      if (data.isActivated && data.isActivated == 1) {
+        store.commit('setUserInfo', data.tokenUser);
+      } else {
+        wx.redirectTo({ url: '/pages/index' });
+        store.commit('setUserInfo', {});
+      }
+    }
+  }).catch(() => {
+    wxLogin()
+  })
+}
+// 检查是否登录过以及过期
+function checkLoginNew() {
+  let token = store.state.user.token;
+  if (!token) {
+    return wxLogin();
+  } else {
+    let flag = checkTokenIsValid()
+    if (flag == 1) {
+      refreshTokenPage(); // 续约
+    } else if (flag == 2) { // 重新登录
+      wxLogin();
+    } else if (flag == 3) {  // 后续补定时器定时续约逻辑
+
+    }
+    return Promise.resolve();
+  }
+}
+
+// 判断token是否过期
+function checkTokenIsValid() {
+  let flag = 1
+  let tokenInfo = store.state.user.tokenInfo;
+  let expireTime = tokenInfo.expireTime;
+  let refreshToken = tokenInfo.refreshToken;
+  let nowtime = getTimeStamp();
+  if (expireTime && expireTime < nowtime && refreshToken >= nowtime) {  // 过期可续约
+    flag = 1
+  } else if (expireTime && expireTime >= nowtime) { // 没过期
+    flag = 3
+  }
+  else { // 需要重新登录
+    flag = 2
   }
+  return flag;
+}
+
+
+
+
+// 本地保存用户头像
+function setAvatar(avatar) {
+  wx.setStorageSync('avatarBase64', avatar);
+}
+// 获取头像
+function getAvatar() {
+  return wx.getStorageSync('avatarBase64');
+}
+
+// 清楚数据
+function clearAvatar() {
+  wx.removeStorage('avatarBase64');
+}
+
 
 export {
-    checkHasUserInfo,
-    setUserInfoByAuth
+  checkHasUserInfo,
+  wxLogin,
+  setAvatar,
+  getAvatar,
+  checkLoginNew,
+  checkTokenIsValid,
+  getCompanyDataByPhone,
+  setUserInfoByAuth
 }

+ 0 - 38
src/store/carport.js

@@ -1,38 +0,0 @@
-export default {
-  state: {
-    // 企业车位
-    companyCarportList: [],
-    // 个人车位
-    personalCarportList: [],
-    // 我的常用车辆
-    myCarList: []
-  },
-  mutations: {
-    addCompanyCarport(state, companyCarport) {
-      state.companyCarportList.push(companyCarport);
-    },
-    addPersonalCarport(state, personalCarport) {
-      state.personalCarportList.push(personalCarport);
-    },
-    addMyCar(state, carObj) {
-      state.myCarList.push(carObj);
-    },
-    deleteMyCar(state, carNumber) {
-      state.myCarList.find((item, index) => {
-        if (item.number === carNumber) {
-          state.myCarList.splice(index, 1)
-          return true;
-        }
-        return false;
-      })
-    }
-  },
-  actions: {
-    addMyCar({ commit }, carObj) {
-      commit('addMyCar', carObj);
-    },
-    deleteMyCar({ commit }, carNumber) {
-      commit('deleteMyCar', carNumber);
-    }
-  }
-}

+ 0 - 37
src/store/home.js

@@ -1,37 +0,0 @@
-export default {
-  state: {
-    subscribeMessageTemplates: {},
-    spaceCardInfo: {
-      imgUrl: '',
-      roomName: '',
-      envData: {
-        temperature: '',
-        humidity: '',
-        pm25: '',
-        co2: '',
-        hcho: '',
-        tvoc: '',
-        pmIndicator: '优'
-      },
-
-      spaceId: '',
-      roomType: '' // private_room-房间,public_room-开发空间
-    }
-  },
-  mutations: {
-    setSubscribeMessageTemplates(state, subscribeMessageTemplates) {
-      state.subscribeMessageTemplates = subscribeMessageTemplates
-    },
-    setspaceCardInfo(state, spaceCardInfo) {
-      state.spaceCardInfo = {...spaceCardInfo}
-    }
-  },
-  actions: {
-    setSubscribeMessageTemplates({ commit }, data) {
-      commit('setSubscribeMessageTemplates', data);
-    },
-    setspaceCardInfo({commit}, data) {
-      commit('setspaceCardInfo', data);
-    }
-  }
-}

+ 0 - 36
src/store/index 2.js

@@ -1,36 +0,0 @@
-import wepy from '@wepy/core';
-import Vuex from '@wepy/x';
-import user from '@/store/user.js'
-import task from '@/store/task.js'
-import carport from '@/store/carport.js'
-import restaurant from '@/store/restaurant.js'
-import wifi from '@/store/wifi.js'
-import home from '@/store/home.js'
-import meetingroom from '@/store/meetingroom.js'
-import company from '@/store/company'
-import portrait from '@/store/portrait'
-import officehome from '@/store/officehome'
-import previewImage from '@/store/previewImage'
-import location from '@/store/location'
-wepy.use(Vuex);
-
-export default new Vuex.Store({
-  modules: {
-    user,
-    task,
-    carport,
-    restaurant,
-    wifi,
-    location,
-    home,
-    meetingroom,
-    company,
-    portrait,
-    officehome,
-    previewImage
-  },
-  state: {},
-  mutations: {},
-  actions: {},
-  getters: {}
-});

+ 1 - 15
src/store/index.js

@@ -1,33 +1,19 @@
 import wepy from '@wepy/core';
 import Vuex from '@wepy/x';
 import user from '@/store/user.js'
-// import task from '@/store/task.js'
-// import carport from '@/store/carport.js'
-// import restaurant from '@/store/restaurant.js'
-// import wifi from '@/store/wifi.js'
-// import home from '@/store/home.js'
-// import meetingroom from '@/store/meetingroom.js'
 // import company from '@/store/company'
 import portrait from '@/store/portrait'
 import officehome from '@/store/officehome'
-// import previewImage from '@/store/previewImage'
 import location from '@/store/location'
 wepy.use(Vuex);
 
 export default new Vuex.Store({
   modules: {
     user,
-    // task,
-    // carport,
-    // restaurant,
-    // wifi,
     location,
-    // home,
-    // meetingroom,
-    // company,
     portrait,
     officehome,
-    // previewImage
+
   },
   state: {},
   mutations: {},

+ 0 - 15
src/store/meetingroom.js

@@ -1,15 +0,0 @@
-export default {
-  state: {
-    choosedColleaguList: []
-  },
-  mutations: {
-    setChoosedColleaguList(state, list) {
-      state.choosedColleaguList = list
-    }
-  },
-  actions: {
-    setChoosedColleaguList({ commit }, data) {
-      commit('setChoosedColleaguList', data);
-    }
-  }
-}

+ 0 - 22
src/store/previewImage.js

@@ -1,22 +0,0 @@
-export default {
-  state: {
-    imageList: [],
-    currentIndex: 1
-  },
-  mutations: {
-    setImageList(state, imageList) {
-      state.imageList = [...imageList];
-    },
-    setImageIndex(state, index) {
-      state.currentIndex = index;
-    }
-  },
-  actions: {
-    setImageList({ commit }, data) {
-      commit('setImageList', data);
-    },
-    setImageIndex({ commit }, data) {
-      commit(setImageIndex, data);
-    },
-  },
-};

+ 0 - 29
src/store/restaurant.js

@@ -1,29 +0,0 @@
-export default {
-  state: {
-    // 是否营业中
-    isOpen: true,
-    dishInfo: {}
-  },
-  mutations: {
-    openRestaurant(state) {
-      state.isOpen = true;
-    },
-    closeRestaurant(state) {
-      state.isOpen = false;
-    },
-    updateDishInfo(state, dish) {
-      console.log('----------------')
-      console.log(state)
-      console.log(dish)
-      state.dishInfo = dish
-    }
-  },
-  actions: {
-    openRestaurant({ commit }) {
-      commit('openRestaurant');
-    },
-    closeRestaurant({ commit }) {
-      commit('closeRestaurant');
-    }
-  }
-}

+ 0 - 93
src/store/task.js

@@ -1,93 +0,0 @@
-import config from '@/config';
-import { getCompanyApplyPendingList } from '@/api/companyApply.js';
-
-let taskList = [
-  {
-    name: '访客指引',
-    remarks: 'Wi-Fi、洗手间使用等信息',
-    icon: config.h5StaticPath + '/test-data/home/task/visitor-guidance.png',
-    belongRoleList: [4],
-    navigationUrl:
-      '/h5/pages/common/h5?url=/visitor-guide-tenantslink&pageTitle=访客指引&navigationBarBgColor=#ffffff',
-  },
-  {
-    name: '全面塑形瑜伽',
-    remarks: '下午 06:15',
-    icon: config.h5StaticPath + '/test-data/home/task/sport.png',
-    belongRoleList: [1, 2, 3],
-    navigationUrl:
-      'fitness/homeDetail?isReserved=1&title=' +
-      encodeURIComponent('全面塑形瑜伽训练'),
-  },
-  {
-    name: '京东快递未领取',
-    remarks: '33号储物柜',
-    belongRoleList: [1, 2, 3],
-    icon: config.h5StaticPath + '/test-data/home/task/jingdong.png',
-  },
-];
-
-export default {
-  state: {
-    taskList: taskList,
-  },
-  mutations: {
-    addEnergyTask(state, data) {
-      let energyTask = {
-        type: 'energy',
-        name: '能量站食品待领取',
-        remarks: '约 ' + data.recevieTime,
-        icon: config.h5StaticPath + '/test-data/home/task/energy.png',
-        navigationUrl: 'energy/order-detail',
-        shoppingList: data.shoppingList,
-        recevieTime: data.recevieTime,
-      };
-      state.taskList.unshift(energyTask);
-    },
-    addMeetingRoomTask(state, data) {
-      let energyTask = {
-        type: 'meetingRoom',
-        name: data.roomName + '会议室预约',
-        remarks: data.reserveTimeDesc,
-        icon: config.h5StaticPath + '/test-data/home/task/meeting.png',
-        navigationUrl: '/meetingroom/pages/detail?roomName=' + data.roomName,
-        ...data,
-      };
-      state.taskList.unshift(energyTask);
-    },
-    initCompanyApplyTask(state) {
-      initCompanyApplyTask(state.taskList);
-    },
-  },
-  actions: {
-    addEnergyTask({ commit }, data) {
-      commit('addEnergyTask', data);
-    },
-    addMeetingRoomTask({ commit }, data) {
-      commit('addMeetingRoomTask', data);
-    },
-    initCompanyApplyTask({ commit }) {
-      commit('initCompanyApplyTask');
-    },
-  },
-};
-
-function initCompanyApplyTask(taskList) {
-  let filteredList = taskList.filter((item) => {
-    return item.type != 'apply';
-  });
-  getCompanyApplyPendingList().then((res) => {
-    let list = res.data || [];
-    list.forEach((item) => {
-      filteredList.unshift({
-        type: 'apply',
-        name: '加入企业申请',
-        remarks: item.companyName,
-        belongRoleList: [1, 2, 3, 4],
-        statusText: item.statusText,
-        navigationUrl: `/account/pages/company-apply?applyId=${item.id}`,
-      });
-    });
-    taskList.splice(0, taskList.length, ...filteredList);
-  });
-}

+ 33 - 40
src/store/user.js

@@ -1,69 +1,65 @@
 export default {
   state: {
-    // status用户状态说明:
-    // 0-未入驻:没有通过手机号绑定到企业或者运营方账户
-    // 10-审核中:绑定的手机号,申请加入企业还未审批通过
-    // 已入驻:绑定的手机号,在企业行政列表中可见,又细分下列几种情况:
-    //   2-激活:正常状态的账户
-    //   3-待激活:企业行政按照手机号批量倒入员工信息,员工未使用对应手机号进行登陆,则为未激活状态
-    //   4-冻结:1)由于长期不使用小程序等触发条件,暂时冻结账户,需要用户手动登陆一次以激活。2)部署到新的大楼或企业时,如果原来有其他系统的用户信息,倒入到tenantslink,也作为冻结状态
-    //   (比如企办的账户数据)
-    //   5-作废:只作为历史记录,不能重新激活。同一手机号再次加入,也算是另一个账户
     status: null,
-    token: '',
+    token: wx.getStorageSync('token'),
     projectId: '',
     refreshToken: '',
-    userInfo: {
-      userId: '602ef709beb64a1f9a4b6af2196d0af7',
-      userPhone: 15321277745,
-      userName: '陈珍',
-      projectId: 'Pj1101080259'
-    },
+    userInfo: wx.getStorageSync('userInfo'),
+    userPhone: wx.getStorageSync('userPhone'),
     // 申请id
     applyId: '',
+    tokenInfo: wx.getStorageSync('tokenInfo'),
     hasClearToken: false,
-    tokenIsValid: true
+    tokenIsValid: true,
+    isActivated: wx.getStorageSync('isActivated')
   },
   mutations: {
     setToken(state, token) {
+      wx.setStorageSync('token', token);
       state.token = token;
     },
-    setRefreshToken(state, refreshToken) {
-      state.refreshToken = refreshToken;
+    setActivated(state, isActivated) {
+      wx.setStorageSync('isActivated', isActivated);
+      state.isActivated = isActivated
+    },
+    setTokenInfo(state, tokenInfo) {
+      wx.setStorageSync('tokenInfo', tokenInfo);
+      state.tokenInfo = tokenInfo;
     },
     setStatus(state, status) {
       state.status = status;
     },
     setUserInfo(state, userInfo) {
-      // state.userInfo = { ...state.userInfo, ...userInfo };
-      state.userInfo = {
-        userId: '602ef709beb64a1f9a4b6af2196d0af7',
-        userPhone: 15321277745,
-        userName: '陈珍',
-        projectId: 'Pj1101080259'
-      }
+      state.userInfo = { ...state.userInfo, ...userInfo };
+      wx.setStorageSync('userInfo', userInfo);
+      state.userInfo = userInfo;
     },
-    setApplyId(state, applyId) {
-      state.applyId = applyId
+    clearToken(state) {
+      wx.removeStorageSync('token');
+      state.token = ''
+    },
+    clearTokenInfo(state) {
+      wx.removeStorageSync('tokenInfo')
+      state.tokenInfo = {};
     },
     clearUserInfo(state) {
-      // state.userInfo = {};
-      state.userInfo = {
-        userId: '602ef709beb64a1f9a4b6af2196d0af7',
-        userPhone: 15321277745,
-        userName: '陈珍',
-        projectId: 'Pj1101080259'
-      }
+      wx.removeStorageSync('userInfo')
+      state.userInfo = {};
     },
-    hasClearToken(state, data) {
-      state.hasClearToken = data
+    setApplyId(state, applyId) {
+      state.applyId = applyId
     },
     setTokenIsValid(state, data) {
       state.tokenIsValid = data
     },
     setProjectId(state, data) {
       state.projectId = data
+    },
+    setUserPhone(state, data) {
+      wx.setStorageSync('userPhone', data);
+      state.userPhone = data
     }
+
   },
   actions: {
     setToken({ commit }, data) {
@@ -87,9 +83,6 @@ export default {
     hasClearToken({ commit }, data) {
       commit('hasClearToken', data);
     },
-    setTokenIsValid({ commit }, data) {
-      commit('setTokenIsValid', data);
-    },
     setProjectId({ commit }, data) {
       commit('setProjectId', data);
     }

+ 0 - 34
src/store/wifi.js

@@ -1,34 +0,0 @@
-export default {
-  state: {
-    wifiInfo: {
-      ssid: '',
-      password: ''
-    },
-    isConnected: false
-  },
-  mutations: {
-    setWifiInfo(state, wifiInfo) {
-      state.wifiInfo = wifiInfo
-    },
-    changeConnectStatus(state, isConnected) {
-      state.isConnected = isConnected
-    },
-    resetWifiInfo(state) {
-      state.wifiInfo = {
-        ssid: '',
-        password: ''
-      }
-    }
-  },
-  actions: {
-    setWifiInfo({ commit }, data) {
-      commit('setWifiInfo', data);
-    },
-    resetWifiInfo({ commit }) {
-      commit('resetWifiInfo');
-    },
-    changeConnectStatus({ commit }, data) {
-      commit('changeConnectStatus', data);
-    }
-  }
-}

+ 30 - 0
src/utils/index.js

@@ -0,0 +1,30 @@
+
+function getMiniProgram() {
+    const miniProgram = wx.getAccountInfoSync();
+    return miniProgram;
+    // this.version = miniProgram.miniProgram.version;
+}
+function getAppId() {
+    const miniProgram = wx.getAccountInfoSync();
+    return miniProgram && miniProgram.miniProgram && miniProgram.miniProgram.appId || 'wxda2ef261ac3cca32';
+}
+
+// 正式版本上能获取,体验和开发版本无法获取到版本号
+function getVersion() {
+    const miniProgram = wx.getAccountInfoSync();
+    return miniProgram && miniProgram.miniProgram && miniProgram.miniProgram.version;
+}
+
+// 获取时间戳
+function getTimeStamp() {
+    let timeStamp = Date.parse(new Date());
+    return timeStamp;
+}
+
+
+export {
+    getAppId,
+    getVersion,
+    getTimeStamp,
+    getMiniProgram
+}

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 9 - 0
static/page-bind-tenant/default_avatar.svg


BIN
static/page-bind-tenant/logo_title.png