|
|
@@ -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({
|
|
|
/**
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
- companyList: [
|
|
|
- {
|
|
|
- cpId: 1,
|
|
|
- companyName: '东科智云-标准版',
|
|
|
- },
|
|
|
-
|
|
|
- {
|
|
|
- cpId: 2,
|
|
|
- companyName: '东科智云-标准版-体验',
|
|
|
- },
|
|
|
- ],
|
|
|
-
|
|
|
+ // 加入企业的列表
|
|
|
+ companyList: [],
|
|
|
+ // 语言包
|
|
|
+ $t: app.globalData.lang,
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
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 : 点击公司进入主页
|
|
|
* @date : 2022/5/12 13:49
|
|
|
* @author : 姜永辉
|
|
|
*/
|
|
|
clickCompany(e) {
|
|
|
- console.log(e);
|
|
|
- // 调转主页
|
|
|
- wx.reLaunch({
|
|
|
- url: '../../pages/home-page/home-page',
|
|
|
- })
|
|
|
+ // 点击企业时候反写当前公司
|
|
|
+ let item = e.currentTarget.dataset.item
|
|
|
+ this.updateCompanyID(item)
|
|
|
},
|
|
|
|
|
|
})
|