| | |
| | | <template> |
| | | <view> |
| | | |
| | | <view class="content"> |
| | | <view class="content_head" :style="{backgroundImage: 'url(' + backgroundImg + ')'}"> |
| | | <view class="content_head_img"> |
| | | <u-icon name="account-fill" color="#999999" size="38"></u-icon> |
| | | </view> |
| | | <view class="content_head_info"> |
| | | <text>{{userInfo.realname}}</text> |
| | | <view class="content_head_company" @click="show = true"> |
| | | <text>{{userInfo.company.name}}</text> |
| | | <u-icon name="arrow-down-fill" color="#ffffff" size="16"></u-icon> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view class="content_box"> |
| | | <view class="content_box_list"> |
| | | <view class="content_box_list_item"> |
| | | <text>{{numObj.dataFirst || 0}}</text> |
| | | <text>保障中保单</text> |
| | | </view> |
| | | <view class="content_box_list_item"> |
| | | <text>{{numObj.dataSecond || 0}}</text> |
| | | <text>在保人数</text> |
| | | </view> |
| | | <view class="content_box_list_item"> |
| | | <text>{{numObj.dataThird || 0}}</text> |
| | | <text>理赔中</text> |
| | | </view> |
| | | </view> |
| | | <view class="content_box_fun"> |
| | | <view class="content_box_fun_label">我的服务</view> |
| | | <view class="fun_list"> |
| | | <view class="fun_list_item" @click="jump(8)"> |
| | | <image src="/static/icon/wode_ic_yuangong@2x.png" mode="widthFix"></image> |
| | | <text>员工管理</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view class="content_loginout"> |
| | | <u-button type="primary" shape="circle" color="#437CB3" :plain="true" text="退出登录" |
| | | @click="loginOut"></u-button> |
| | | </view> |
| | | <!-- 切换企业 --> |
| | | <u-picker :show="show" keyName="companyName" @confirm="confirmCompany" @cancel="cancel" |
| | | :columns="[userInfo.companyPermissionList || []]"></u-picker> |
| | | <MyTabbar :currentPage="currentPage" /> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | import MyTabbar from '@/components/my-tabbar/my-tabbar.vue' |
| | | import { |
| | | mapState |
| | | } from 'vuex' |
| | | export default { |
| | | components: { MyTabbar }, |
| | | computed: { |
| | | ...mapState(['userInfo', 'cookies']) |
| | | }, |
| | | data() { |
| | | return { |
| | | |
| | | }; |
| | | numObj: null, |
| | | currentPage: '/pages/mine/mine', |
| | | show: false, |
| | | companyList: [], |
| | | backgroundImg: require('@/static/background/home_bg@2x.png'), |
| | | backgroundImg1: require('@/static/background/home_ic_toubao@2x.png'), |
| | | backgroundImg2: require('@/static/background/home_ic_baodan@2x.png'), |
| | | backgroundImg3: require('@/static/background/home_ic_baoan@2x.png'), |
| | | backgroundImg4: require('@/static/background/home_ic_jiajianbao@2x.png'), |
| | | backgroundImg5: require('@/static/background/home_ic_jiajianbaojilu@2x.png'), |
| | | backgroundImg6: require('@/static/background/home_ic_huanchang@2x.png'), |
| | | backgroundImg7: require('@/static/background/home_ic_huanchangjilu@2x.png'), |
| | | backgroundImg8: require('@/static/background/home_ic_yuangong@2x.png'), |
| | | } |
| | | }, |
| | | onShow() { |
| | | this.getNum() |
| | | }, |
| | | methods: { |
| | | test() { |
| | | // 选择图片 |
| | | wx.chooseImage({ |
| | | count: 1, |
| | | success: async function(res) { |
| | | console.log(new wx.serviceMarket.CDN({ type: 'filePath', filePath: res.tempFilePaths[0] })) |
| | | try { |
| | | const invokeRes = await wx.serviceMarket.invokeService({ |
| | | service: 'wx79ac3de8be320b71', |
| | | api: 'OcrAllInOne', |
| | | data: { |
| | | // 用 CDN 方法标记要上传并转换成 HTTP URL 的文件 |
| | | img_url: new wx.serviceMarket.CDN({ |
| | | type: 'filePath', |
| | | filePath: res.tempFilePaths[0], |
| | | }), |
| | | data_type: 3, |
| | | ocr_type: 1 |
| | | }, |
| | | }) |
| | | console.log('invokeService success', invokeRes) |
| | | wx.showModal({ title: 'success', content: JSON.stringify(invokeRes) }) |
| | | } catch (err) { |
| | | console.log(JSON.stringify(err)) |
| | | wx.showModal({ title: 'fail', content: err }) |
| | | } |
| | | }, |
| | | fail: function(res) {}, |
| | | complete: function(res) {}, |
| | | }) |
| | | }, |
| | | cancel() { |
| | | this.show = false |
| | | }, |
| | | confirmCompany(e) { |
| | | if (e.value[0].companyId === this.userInfo.companyId) { |
| | | uni.showToast({ |
| | | title: '不能切换当前企业', |
| | | icon: 'none' |
| | | }) |
| | | return |
| | | } |
| | | this.$u.api.switchCompany({ |
| | | companyId: e.value[0].companyId |
| | | }) |
| | | .then(async res => { |
| | | let user = await this.$u.api.getUserInfo() |
| | | if (user.code === 200) { |
| | | this.$store.commit('setUserInfo', user.data) |
| | | this.show = false |
| | | } |
| | | }) |
| | | }, |
| | | getNum() { |
| | | this.$u.api.getCompanyMiniData() |
| | | .then(res => { |
| | | if (res.code === 200) { |
| | | console.log(res) |
| | | this.numObj = res.data |
| | | } |
| | | }) |
| | | }, |
| | | loginOut() { |
| | | this.$u.api.logout() |
| | | .then(res => { |
| | | if (res.code === 200) { |
| | | this.$store.commit('empty') |
| | | uni.navigateTo({ |
| | | url: '/pages/login/login' |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | jump(type) { |
| | | if (!this.cookies || !this.userInfo) { |
| | | uni.navigateTo({ |
| | | url: '/pages/login/login' |
| | | }) |
| | | } |
| | | switch (type) { |
| | | case 8: |
| | | uni.navigateTo({ |
| | | url: '/pages/employee_management/employee_management' |
| | | }) |
| | | break |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss"> |
| | | |
| | | <style> |
| | | page { |
| | | background-color: #F7F7F7; |
| | | } |
| | | </style> |
| | | |
| | | <style lang="scss" scoped> |
| | | .content { |
| | | width: 100%; |
| | | |
| | | .content_loginout { |
| | | width: 200rpx; |
| | | left: 50%; |
| | | transform: translate(-50%, 0); |
| | | position: fixed; |
| | | bottom: calc(env(safe-area-inset-bottom) + 110upx + 80rpx); |
| | | } |
| | | |
| | | .content_head { |
| | | width: 100%; |
| | | height: 292rpx; |
| | | padding: 40rpx; |
| | | box-sizing: border-box; |
| | | background-repeat: no-repeat; |
| | | background-size: 100% 100%; |
| | | display: flex; |
| | | position: relative; |
| | | |
| | | .content_head_img { |
| | | flex-shrink: 0; |
| | | background-color: #ffffff; |
| | | width: 104rpx; |
| | | height: 104rpx; |
| | | border-radius: 50%; |
| | | margin-right: 20rpx; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | border: 4rpx solid #FFFFFF; |
| | | } |
| | | |
| | | .content_head_info { |
| | | flex: 1; |
| | | height: 104rpx; |
| | | display: flex; |
| | | flex-direction: column; |
| | | justify-content: space-around; |
| | | .content_head_company { |
| | | width: 100%; |
| | | display: flex; |
| | | align-items: center; |
| | | |
| | | text { |
| | | font-weight: 400; |
| | | font-size: 26rpx; |
| | | color: #FFFFFF; |
| | | margin-right: 15rpx; |
| | | } |
| | | } |
| | | |
| | | text { |
| | | font-weight: 500; |
| | | font-size: 32rpx; |
| | | color: #FFFFFF; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | .content_box { |
| | | width: 100%; |
| | | padding: 0 30rpx; |
| | | box-sizing: border-box; |
| | | position: relative; |
| | | top: -100rpx; |
| | | left: 0; |
| | | |
| | | .content_box_fun { |
| | | width: 100%; |
| | | margin-top: 34rpx; |
| | | background: #FFFFFF; |
| | | padding: 30rpx; |
| | | box-sizing: border-box; |
| | | border-radius: 16rpx; |
| | | .content_box_fun_label { |
| | | font-weight: 500; |
| | | font-size: 32rpx; |
| | | color: #222222; |
| | | margin-bottom: 30rpx; |
| | | } |
| | | .fun_list { |
| | | width: 100%; |
| | | display: flex; |
| | | align-items: center; |
| | | .fun_list_item { |
| | | width: 25%; |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | justify-content: center; |
| | | image { |
| | | width: 60rpx; |
| | | height: 60rpx; |
| | | } |
| | | text { |
| | | font-weight: 400; |
| | | font-size: 26rpx; |
| | | color: #333333; |
| | | margin-top: 16rpx; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | .content_box_list { |
| | | width: 100%; |
| | | height: 172rpx; |
| | | padding: 30rpx 40rpx; |
| | | box-sizing: border-box; |
| | | background: #FFFFFF; |
| | | border-radius: 16rpx; |
| | | display: flex; |
| | | align-items: center; |
| | | |
| | | .content_box_list_item { |
| | | flex: 1; |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | justify-content: center; |
| | | text { |
| | | &:nth-child(1) { |
| | | font-weight: 600; |
| | | font-size: 48rpx; |
| | | color: #279BAA; |
| | | } |
| | | &:nth-child(2) { |
| | | font-weight: 400; |
| | | font-size: 26rpx; |
| | | color: #222222; |
| | | magrin-top: 10rpx; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </style> |