Procházet zdrojové kódy

加入公司,注册公司

姜永辉 před 2 roky
rodič
revize
a8bd2dfcb3

+ 12 - 2
i18n/zh-CN.js

@@ -52,8 +52,18 @@ const home = {
   cpInfo: '商户信息',
   cpInfo: '商户信息',
   paramSetting:'参数设置',
   paramSetting:'参数设置',
   productDetail:'产品详情',
   productDetail:'产品详情',
-
-
+  homeTitle:'泛家居建陶行业云服务',
+  homeProduct:'了解产品',
+  homeFreeLogin:'免费体验',
+  homeAddCompany:'加入企业',
+  homeCreateCompany:'创建企业',
+  agreementPrivacy:'我已阅读并同意《用户协议》和《隐私条款》',
+  checkPrivacy:'请勾选用户协议和隐私条款',
+  scanQrcode:'请同事扫下方二维码',
+  requestAddCompany:'邀请你进入企业',
+  wechatScan:'使用微信扫码',
+  waitAddCom:'等待加入企业中...',
+  selectCompany:'请选择进入企业',
 }
 }
 
 
 //  基础数据
 //  基础数据

+ 20 - 5
pages/add-company/add-company.js

@@ -1,17 +1,30 @@
-const app = getApp()
-
+/*******************************************************************************
+* Copyright(c) 2022 dongke All rights reserved. / Confidential
+* 类的信息:
+*		1.程序名称:
+*		2.功能描述:同事扫码邀请页面画面
+* 编辑履历:
+*		作者				日期					版本				修改内容
+*		姜永辉		  	2022-11-22			1.00		   	新建
+*******************************************************************************/
 const api = require('@/utils/api.js');
 const api = require('@/utils/api.js');
 const config = require('@/config/config.js');
 const config = require('@/config/config.js');
 const Constants = require('@/utils/Constants.js');
 const Constants = require('@/utils/Constants.js');
 
 
+const app = getApp()
+
 Page({
 Page({
 
 
     /**
     /**
      * 页面的初始数据
      * 页面的初始数据
      */
      */
     data: {
     data: {
-        img: '',
+        // 返回邀请码的地址
+        imgQrcode: '',
+        // 每隔3秒执行一次 看是否 已经被邀请成功
         interval: null,
         interval: null,
+        // 语言包
+        $t: app.globalData.lang,
     },
     },
 
 
     /**
     /**
@@ -19,7 +32,9 @@ Page({
      */
      */
     onLoad(options) {
     onLoad(options) {
         let that = this
         let that = this
+        // 获取二维码
         that.loadQrCodeData()
         that.loadQrCodeData()
+        // 每隔3秒执行一次 看是否 已经被邀请成功
         let interval = setInterval(function () {
         let interval = setInterval(function () {
             that.gettoken()
             that.gettoken()
         }, 3000)
         }, 3000)
@@ -35,7 +50,7 @@ Page({
         clearInterval(this.data.interval)
         clearInterval(this.data.interval)
     },
     },
 
 
-    /**
+   /**
    * @desc : 获取二维码
    * @desc : 获取二维码
    * @date : 2022/5/12 13:49
    * @date : 2022/5/12 13:49
    * @author : 姜永辉
    * @author : 姜永辉
@@ -49,7 +64,7 @@ Page({
             console.log("getQrCode", res);
             console.log("getQrCode", res);
             if (res.data.code == Constants.SUCESS_CODE) {
             if (res.data.code == Constants.SUCESS_CODE) {
                 this.setData({
                 this.setData({
-                    img: config.server_add + ':' + config.server_port + res.data.data
+                    imgQrcode: config.server_add + ':' + config.server_port + res.data.data
                 })
                 })
             }
             }
         })
         })

+ 5 - 5
pages/add-company/add-company.wxml

@@ -1,10 +1,10 @@
 <view class="card-view">
 <view class="card-view">
-	<view class="card-view-title">请同事扫下方二维码</view>
-	<view class="card-view-sub-title">邀请你进入企业</view>
+	<view class="card-view-title">{{$t['scanQrcode']}}</view>
+	<view class="card-view-sub-title">{{$t['requestAddCompany']}}</view>
 	<view class="card-view-sub-title-line"></view>
 	<view class="card-view-sub-title-line"></view>
-	<view class="card-view-sub-title">使用微信扫码</view>
+	<view class="card-view-sub-title">{{$t['wechatScan']}}</view>
 	<view class="card-view-sub-title">
 	<view class="card-view-sub-title">
-		<image src="{{img}}" mode="aspectFit" />
+		<image src="{{imgQrcode}}" mode="aspectFit" />
 	</view>	
 	</view>	
 </view>
 </view>
-<view class="card-view"  style="text-align: center;">等待加入企业中。。。</view>
+<view class="card-view"  style="text-align: center;">{{$t['waitAddCom']}}</view>

+ 12 - 14
pages/add-company/add-company.wxss

@@ -7,31 +7,29 @@
 	padding: 24rpx;
 	padding: 24rpx;
 	margin-top: 30rpx;
 	margin-top: 30rpx;
 	z-index: 2;
 	z-index: 2;
-  }
+}
 
 
-  
-  .card-view-title {
+
+.card-view-title {
 	font-style: normal;
 	font-style: normal;
 	font-weight: 500;
 	font-weight: 500;
 	font-size: 20px;
 	font-size: 20px;
 	text-align: center;
 	text-align: center;
 	font-family: 'PingFang SC';
 	font-family: 'PingFang SC';
-  }
+}
 
 
-  .card-view-sub-title{
-	  margin-top: 40rpx;
+.card-view-sub-title {
+	margin-top: 40rpx;
 	font-style: normal;
 	font-style: normal;
 	font-weight: 500;
 	font-weight: 500;
 	font-size: 14px;
 	font-size: 14px;
 	text-align: center;
 	text-align: center;
 	font-family: 'PingFang SC';
 	font-family: 'PingFang SC';
-  }
+}
 
 
-  .card-view-sub-title-line{
+.card-view-sub-title-line {
 	margin-top: 40rpx;
 	margin-top: 40rpx;
-	  width: 100%;
-	  height: 1rpx;
-	  border-bottom: 1px solid rgb(189, 185, 185);
-  }
-
-  
+	width: 100%;
+	height: 1rpx;
+	border-bottom: 1px solid rgb(189, 185, 185);
+}

+ 61 - 21
pages/company/company.js

@@ -1,48 +1,88 @@
+/*******************************************************************************
+* Copyright(c) 2022 dongke All rights reserved. / Confidential
+* 类的信息:
+*		1.程序名称:
+*		2.功能描述:企业选择画面
+* 编辑履历:
+*		作者				日期					版本				修改内容
+*		姜永辉		  	2022-11-22			1.00		   	新建
+*******************************************************************************/
+const api = require('@/utils/api.js');
+const config = require('@/config/config.js');
+const Constants = require('@/utils/Constants.js');
+
+const app = getApp()
 Page({
 Page({
     /**
     /**
      * 页面的初始数据
      * 页面的初始数据
      */
      */
     data: {
     data: {
-        companyList: [
-            {
-                cpId: 1,
-                companyName: '东科智云-标准版',
-            },
-           
-            {
-                cpId: 2,
-                companyName: '东科智云-标准版-体验',
-            },
-        ],
-
+        // 加入企业的列表
+        companyList: [],
+        // 语言包
+        $t: app.globalData.lang,
     },
     },
 
 
     /**
     /**
      * 生命周期函数--监听页面加载
      * 生命周期函数--监听页面加载
      */
      */
     onLoad(options) {
     onLoad(options) {
-
+        let that = this
+        // 获取二维码
+        that.loadCompanyData()
     },
     },
 
 
+    /**
+   * @desc : 获取当前用户所有的公司
+   * @date : 2022/5/12 13:49
+   * @author : 姜永辉
+   */
+    loadCompanyData() {
+        let _this = this
+        let param = {
+            openid: app.globalData.openid
+        }
+        api.request(Constants.SYS_OPENID_API + 'oauth/wx/select_company', 'POST', param).then(res => {
+            if (res.data.code == Constants.SUCESS_CODE) {
+                this.setData({
+                    companyList: res.data.list
+                })
+
+            }
+        })
+    },
 
 
     /**
     /**
-     * 生命周期函数--监听页面显示
+     * @desc : 更新当前用户所在的公司id
+     * @date : 2022/5/12 13:49
+     * @author : 姜永辉
      */
      */
-    onShow() {
-
+    updateCompanyID(item) {
+        let _this = this
+        let param = {
+            openid: app.globalData.openid,
+            cpId: item.cpId
+        }
+        api.request(Constants.SYS_OPENID_API + 'oauth/wx/update_cpid', 'POST', param).then(res => {
+            if (res.data.code == Constants.SUCESS_CODE) {
+                // 调转主页
+                wx.reLaunch({
+                    url: '../../pages/welcome/welcome',
+                })
+            }
+        })
     },
     },
 
 
+
     /**
     /**
     * @desc : 点击公司进入主页
     * @desc : 点击公司进入主页
     * @date : 2022/5/12 13:49
     * @date : 2022/5/12 13:49
     * @author : 姜永辉
     * @author : 姜永辉
     */
     */
     clickCompany(e) {
     clickCompany(e) {
-        console.log(e);
-        // 调转主页
-        wx.reLaunch({
-            url: '../../pages/home-page/home-page',
-        })
+        // 点击企业时候反写当前公司
+        let item = e.currentTarget.dataset.item
+        this.updateCompanyID(item)
     },
     },
 
 
 })
 })

+ 1 - 1
pages/company/company.wxml

@@ -1,6 +1,6 @@
 <view style="background-color: white;width: 100%; height: 100%;">
 <view style="background-color: white;width: 100%; height: 100%;">
 	<view style="font-size: 26px;margin-bottom: 10rpx;padding-top: 100rpx;padding-left: 20rpx;">
 	<view style="font-size: 26px;margin-bottom: 10rpx;padding-top: 100rpx;padding-left: 20rpx;">
-		请选择进入企业
+		{{$t['selectCompany']}}
 	</view>
 	</view>
 	<view wx:for="{{companyList}}" wx:key="index" data-item="{{item}}" data-index="{{index}}" catch:tap="clickCompany">
 	<view wx:for="{{companyList}}" wx:key="index" data-item="{{item}}" data-index="{{index}}" catch:tap="clickCompany">
 		<van-cell  title-class="title-class" title="{{item.companyName}}" is-link />
 		<van-cell  title-class="title-class" title="{{item.companyName}}" is-link />

+ 8 - 3
pages/login/login.js

@@ -17,16 +17,21 @@ Page({
    * 页面的初始数据
    * 页面的初始数据
    */
    */
   data: {
   data: {
-    backgroud: '/static/img/login.png',
-    flgCompany: null, //创建企业 加入企业
+    //创建企业 加入企业
+    flgCompany: null,
+    // 隐私
     agreementPrivacy: false,
     agreementPrivacy: false,
+    // 电话授权标识
     openType: '-',
     openType: '-',
+    // 语言包
+    $t: app.globalData.lang,
   },
   },
 
 
   /**
   /**
    * 生命周期函数--监听页面加载
    * 生命周期函数--监听页面加载
    */
    */
   onLoad: function (options) {
   onLoad: function (options) {
+    console.log("app.global", app.globalData);
   },
   },
 
 
   /**
   /**
@@ -75,7 +80,7 @@ Page({
   addCompany(e) {
   addCompany(e) {
     if (!this.data.agreementPrivacy) {
     if (!this.data.agreementPrivacy) {
       wx.showToast({
       wx.showToast({
-        title: '请勾选用户协议和隐私条款',
+        title: this.data.$t['checkPrivacy'],
         duration: 1000
         duration: 1000
       })
       })
     }
     }

+ 7 - 7
pages/login/login.wxml

@@ -2,23 +2,23 @@
 <view style="height: 100vh;width:100%;">
 <view style="height: 100vh;width:100%;">
   <image style=" height: 100%;width:100%;" mode="scaleToFill" src="../../static/img/login.png" />
   <image style=" height: 100%;width:100%;" mode="scaleToFill" src="../../static/img/login.png" />
   <view class="base-absolute">
   <view class="base-absolute">
-    <view style="font-size: 24px;margin-top: 60rpx;">
-      泛家居建陶行业云服务
+    <view style="font-size: 24px;margin-top: 60rpx;"> 
+      {{$t['homeTitle']}}
     </view>
     </view>
     <view style="margin-top: 190rpx; display: flex;">
     <view style="margin-top: 190rpx; display: flex;">
-      <van-button custom-style="border-radius: 30rpx;  height:60rpx;width:180rpx; " size="small" color="#1B365D" type="default" bindtap="freeClick">免费体验</van-button>
-      <van-button custom-style="border-radius: 30rpx; margin-left:30rpx;height:60rpx;width:180rpx; " size="small" color="#1B365D" type="default" bindtap="productClick">了解产品</van-button>
+      <van-button custom-style="border-radius: 30rpx;  height:60rpx;width:180rpx; " size="small" color="#1B365D" type="default" bindtap="freeClick"> {{$t['homeFreeLogin']}}</van-button>
+      <van-button custom-style="border-radius: 30rpx; margin-left:30rpx;height:60rpx;width:180rpx; " size="small" color="#1B365D" type="default" bindtap="productClick">{{$t['homeProduct']}}</van-button>
 
 
     </view>
     </view>
 
 
     <view style="margin-top: 60rpx; display: flex;">
     <view style="margin-top: 60rpx; display: flex;">
-      <van-button size="small" custom-style="border-radius: 30rpx; margin-left:10rpx;height:60rpx;width:180rpx; " type="default" data-company='add' bind:click="addCompany" open-type="{{openType}}" bindgetphonenumber="handleGetPhoneNumber">加入企业</van-button>
-      <van-button size="small" open-type="{{openType}}" data-company='create' bind:click="addCompany" bindgetphonenumber="handleGetPhoneNumber" custom-style="border-radius: 30rpx;margin-left:30rpx ;height:60rpx;width:180rpx; " type="default">创建企业</van-button>
+      <van-button size="small" custom-style="border-radius: 30rpx; margin-left:10rpx;height:60rpx;width:180rpx; " type="default" data-company='add' bind:click="addCompany" open-type="{{openType}}" bindgetphonenumber="handleGetPhoneNumber">{{$t['homeAddCompany']}}</van-button>
+      <van-button size="small" open-type="{{openType}}" data-company='create' bind:click="addCompany" bindgetphonenumber="handleGetPhoneNumber" custom-style="border-radius: 30rpx;margin-left:30rpx ;height:60rpx;width:180rpx; " type="default"> {{$t['homeCreateCompany']}}</van-button>
     </view>
     </view>
 
 
     <view class="foot-agreement-privacy">
     <view class="foot-agreement-privacy">
       <van-checkbox value="{{agreementPrivacy}}" bind:change="onCheckboxChange" />
       <van-checkbox value="{{agreementPrivacy}}" bind:change="onCheckboxChange" />
-      <view style="padding-left: 10rpx;">我已阅读并同意《用户协议》和《隐私条款》</view>
+      <view style="padding-left: 10rpx;"> {{$t['agreementPrivacy']}}</view>
     </view>
     </view>
   </view>
   </view>
 </view>
 </view>

+ 0 - 42
pages/mine/mine-report-params.js

@@ -1,42 +0,0 @@
-const util = require('../../utils/util.js')
-const app = getApp()
-
-
-const getDateQuery = (type) => {
-  let date = new Date()
-  switch (type) {
-    case 'today':
-      return { beginDate: util.formatDayTimeApple(date), endDate: util.formatDayTimeApple(date) };
-    case 'yesterday':
-      return { beginDate: util.formatDayTimeApple(new Date(util.getobjDateApple(date.getTime() - (1000 * 60 * 60 * 24)))), endDate: util.formatDayTimeApple(new Date(util.getobjDateApple(date.getTime() - (1000 * 60 * 60 * 24)))) };
-    case 'nearly30days':
-      return { beginDate: util.formatDayTimeApple(new Date(util.getobjDateApple(date.getTime() - (1000 * 60 * 60 * 24 * 30)))), endDate: util.formatDayTimeApple(date) };
-    case 'nearly7days':
-      return { beginDate: util.formatDayTimeApple(new Date(util.getobjDateApple(date.getTime() - (1000 * 60 * 60 * 24 * 7)))), endDate: util.formatDayTimeApple(date) };
-    default:
-      return {};  
-  }
-}
-
-const getQueryData = (type) => {
-  switch (type) {
-    case 'storeHelper':
-      return { cpId: app.globalData.user.cpId, orgId: app.globalData.user.orgId, type: 'f_my_sale_info' }
-    case 'staffHelper':
-      return { cpId: app.globalData.user.cpId, orgId: app.globalData.user.orgId, userId: app.globalData.user.userId, type: 'f_my_sale_info' }
-    case 'storeOrderRate':
-    case 'storeRepayRate':  
-      return { cpId: app.globalData.user.cpId, orgId: app.globalData.user.orgId,rateDate: util.formatDayTime(new Date()) }
-    case 'staffOrderRate':
-    case 'staffRepayRate':  
-      return { cpId: app.globalData.user.cpId, orgId: app.globalData.user.orgId, userId: app.globalData.user.userId,rateDate: util.formatDayTime(new Date()) } 
-  }
-}
-
-
-const getReportQuery = (reportType, dateType) => {
-  return Object.assign(getQueryData(reportType), getDateQuery(dateType));
-}
-
-
-module.exports = { getReportQuery,getDateQuery };

+ 19 - 7
pages/welcome/welcome.js

@@ -2,10 +2,10 @@
 * Copyright(c) 2022 dongke All rights reserved. / Confidential
 * Copyright(c) 2022 dongke All rights reserved. / Confidential
 * 类的信息:
 * 类的信息:
 *		1.程序名称:
 *		1.程序名称:
-*		2.功能描述:登录画面
+*		2.功能描述:欢迎页面画面
 * 编辑履历:
 * 编辑履历:
 *		作者				日期					版本				修改内容
 *		作者				日期					版本				修改内容
-*		admin		  	2022-11-22			1.00		   	新建
+*		姜永辉		  	2022-11-22			1.00		   	新建
 *******************************************************************************/
 *******************************************************************************/
 const app = getApp()
 const app = getApp()
 
 
@@ -17,14 +17,14 @@ Page({
      * 页面的初始数据
      * 页面的初始数据
      */
      */
     data: {
     data: {
-        backgroud: '/static/img/login.png'
+        
     },
     },
 
 
     /**
     /**
      * 生命周期函数--监听页面加载
      * 生命周期函数--监听页面加载
      */
      */
     onLoad: function (options) {
     onLoad: function (options) {
-        console.log("welcome",options); 
+        console.log("welcome", options);
         // options 中的 scene 需要使用 decodeURIComponent 才能获取到生成二维码时传入的 scene
         // options 中的 scene 需要使用 decodeURIComponent 才能获取到生成二维码时传入的 scene
         if (options.scene) {
         if (options.scene) {
             var scene = decodeURIComponent(options.scene)
             var scene = decodeURIComponent(options.scene)
@@ -58,6 +58,7 @@ Page({
     onShow: function () {
     onShow: function () {
         // 登录 code
         // 登录 code
         this.wx_login()
         this.wx_login()
+        console.log("app.global", app.globalData);
     },
     },
 
 
     /**
     /**
@@ -123,8 +124,8 @@ Page({
             app.globalData.user = res.data.data
             app.globalData.user = res.data.data
             app.globalData.token = res.data.data.accessToken
             app.globalData.token = res.data.data.accessToken
             wx.reLaunch({
             wx.reLaunch({
-                // url: '../../pages/home-page/home-page'  ,
-                url: '../../pages/home-page/home-page' ,
+                url: '../../pages/login/login'  ,
+                // url: '../../pages/home-page/home-page',
             })
             })
 
 
             // if (res.data.code === Constants.SUCESS_CODE) {
             // if (res.data.code === Constants.SUCESS_CODE) {
@@ -172,6 +173,17 @@ Page({
         })
         })
     },
     },
 
 
-
+    /**
+     * @desc : 获取语言的方法
+     * @author : 周兴
+     * @date : 2024/1/19
+     */
+    $t(name) {
+        if (this.data.$t[name]) {
+            return this.data.$t[name];
+        } else {
+            return name;
+        }
+    },
 
 
 })
 })

+ 0 - 77
pages/welcome/welcome.wxss

@@ -1,77 +0,0 @@
-page {
-	overflow: hidden;
-  }
-
-  .button-login{
-	width: 100%;
-	position: absolute;
-	left: 0rpx;
-	bottom: 210rpx; 
-  }
-
-  .pf-btn-auth,
-.pf-btn-save {
-	opacity: 1;
-	border-radius: 4px;
-	width: 500rpx;
-	color: rgb(94, 62, 235);
-	text-align: center;
-	font-size: 14px;
-	height: 30px;
-	line-height: 30px;
-}
-  
-  .out-view {
-	background-color: #fff;
-  }
-  
-  .login-btn {
-	float: left;
-	width: 90% !important;
-	margin-left: 5%;
-  }
-  
-  .form-item {
-	width: 90%;
-	margin-left: 5%;
-	margin-bottom: 20rpx;
-  }
-  
-  .form-item input {
-	background-color: #f2f2f2;
-	font-size: 30rpx;
-	border: 2rpx solid #f2f2f2;
-	height: 62rpx;
-	line-height: 62rpx;
-	border-radius: 10rpx;
-	text-align: center;
-  }
-  
-  .pop-class {
-	width: 92%;
-	text-align: center;
-  }
-  
-  .van-popup-box {
-	width: 100vw;
-	height: 100vw;
-	display: flex;
-	align-content: center;
-	justify-items: center;
-  }
-  
-  .logo-image{
-	margin-top: 50%;opacity: 0;
-  }
-  
-  .logo-image-active{
-	margin-top: 30%;opacity: 1;
-  }
-
-  .base-absolute{
-	width: 100%; 
-	position: absolute;
-	left: 60rpx;
-	top: 200rpx;
-	color: #17319c;
-  }