123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267 |
- <template>
- <!--我的-->
- <view class="my-container">
- <view class="user-info-header">
- <userAvatar></userAvatar>
- <view class="col">
- <text class="u-name">{{ userInfo.userName }}</text>
- <view class="u-office">
- <text class="department">{{ userInfo.company }}</text>
- <view class="position" v-show="userInfo.post">
- {{ userInfo.post }}
- </view>
- </view>
- </view>
- <view class="leave-box" v-if="userStatus">
- <view class="bg-box"></view>
- <view class="leave-txt">{{ userStatus }}</view>
- </view>
- <view>
- <image
- src="@/static/images/my/header-bg.png"
- class="right-icon"
- ></image>
- </view>
- </view>
- <view class="content-fun">
- <view
- class="cell"
- @click="handleClick(item)"
- :key="idx"
- v-for="(item, idx) in list"
- >
- <view class="left-title">
- <image
- class="cell-img"
- :src="require(`@/static/images/my/${item.iconName}.png`)"
- ></image>
- <text>{{ item.title }}</text>
- </view>
- <view class="right-box">
- <msgNum
- v-if="item.msgNum"
- size="12"
- :value="item.msgNum"
- ></msgNum>
- <text class="tel-text" v-if="item.tel">{{ newTel }}</text>
- <u-icon name="arrow-right"></u-icon>
- </view>
- </view>
- </view>
- <c-button
- type="primary"
- class="footer-btn"
- @click="handleConfirm"
- >
- 退出登录
- </c-button>
- <u-modal
- :show="isShow"
- showCancelButton
- @confirm="handleLogOut"
- closeOnClickOverlay
- @close="isShow = false"
- @cancel="isShow = false"
- >
- 确认退出登录吗?
- </u-modal>
- </view>
- </template>
- <script>
- import userAvatar from '@/pages/my/userAvatar.vue';
- import msgNum from '@/components/msgNum/index.vue';
- export default {
- name: 'my',
- components: {
- userAvatar,
- msgNum,
- },
- data() {
- return {
- isShow: false,
- list: [
- {
- iconName: 'my-msg',
- title: '我的消息',
- msgNum: 10,
- path: '/pages/com/msgNotification/index',
- },
- {
- iconName: 'personal-data',
- title: '个人资料',
- msgNum: 0,
- path: '/pages/my/personalData',
- },
- {
- iconName: 'update-pwd',
- title: '修改密码',
- msgNum: 0,
- path: '/pages/my/updatePwd',
- },
- {
- iconName: 'update-phoneNum',
- title: '修改手机号',
- tel: '',
- msgNum: 0,
- path: '/pages/my/checkCurrentTel',
- },
- ],
- userInfo: {},
- };
- },
- onShow() {
- this.getUserInfo();
- },
- computed: {
- userStatus() {
- // 0正常 1加班 2出差 3请假
- const types = {
- 1: '加班',
- 2: '出差',
- 3: '请假',
- };
- const status = this.userInfo?.status;
- return types[status];
- },
- newTel() {
- const { phonenumber } = this.userInfo;
- return this.$c.middleTel(phonenumber, true);
- },
- },
- methods: {
- async getUserInfo() {
- const { data } = await this.$store.dispatch('user/GetInfo');
- this.userInfo = data || {};
- },
- handleClick(item) {
- this.$u.route(item.path);
- },
- handleConfirm() {
- this.isShow = true;
- },
- async handleLogOut() {
- await this.$store.dispatch('user/LogOut');
- this.isShow = false;
- },
- },
- };
- </script>
- <style scoped lang="scss">
- .my-container {
- background-color: #f8f8f8;
- padding: 28rpx;
- height: 100%;
- .user-info-header {
- position: relative;
- display: flex;
- align-items: center;
- background-color: #fff;
- padding: 30rpx;
- border-radius: $bd-radius;
- height: 70px;
- margin-bottom: 28rpx;
- .col {
- display: flex;
- flex-direction: column;
- margin-left: 20rpx;
- .u-name {
- font-size: 13px;
- color: #000000;
- }
- .u-office {
- display: flex;
- align-items: center;
- margin-top: 20rpx;
- .department {
- font-size: 12px;
- color: #8c93a3;
- }
- .position {
- color: #ff9935;
- padding: 0px 6rpx;
- font-size: 13px;
- border: 1px solid #ff9935;
- border-radius: 10rpx;
- margin-left: 10rpx;
- background-color: rgba(239, 140, 39, 0.1);
- }
- }
- }
- .leave-box {
- .bg-box {
- position: absolute;
- right: 0;
- top: 0;
- z-index: 1;
- border-width: 20px;
- border-style: solid;
- border-color: #436ff6 #436ff6 transparent transparent;
- }
- .leave-txt {
- transform: rotateZ(45deg);
- position: absolute;
- top: 5px;
- right: 0;
- z-index: 2;
- font-size: 12px;
- color: #fff;
- }
- }
- .right-icon {
- position: absolute;
- top: 0;
- right: 0;
- width: 78px;
- height: 70px;
- }
- }
- .content-fun {
- background-color: #fff;
- border-radius: $bd-radius;
- .cell {
- display: flex;
- align-items: center;
- justify-content: space-between;
- border-bottom: 1px solid #edeeef;
- &:last-child {
- border-bottom: 0;
- }
- padding: 28rpx;
- .left-title {
- display: flex;
- align-items: center;
- }
- .right-box {
- display: flex;
- align-items: center;
- .tel-text {
- font-size: 13px;
- }
- }
- .cell-img {
- width: 34px;
- height: 34px;
- margin-right: 16rpx;
- }
- }
- }
- .footer-btn {
- margin-top: 100rpx;
- }
- }
- </style>
|