123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335 |
- <template>
- <ion-page>
- <!-- <ion-header>
- <ion-toolbar color="secondary">
- <ion-title>我的</ion-title>
- </ion-toolbar>
- </ion-header>
- <ion-content :fullscreen="true">
- <ion-list>
- <ion-item @click="router.push('myInfo')"><ion-label>个人信息</ion-label></ion-item>
- <ion-item>
- <ion-button slot="end" size="default" fill="outline"
- @click="presentAlert">
- <ion-icon :icon="walkOutline" size="large" slot="start"></ion-icon>
- 退出
- </ion-button>
- </ion-item>
- </ion-list>
- </ion-content>-->
- <ion-content>
- <!-- <div class="mine-toolbar">
- <div class="mine-body">
- <div class="info-img">
- <img class="img-user" src="@/assets/icon/icon-user-2x.png" onerror="this.src='@/assets/icon/icon-user-2x.png'" />
- </div>
- <div class="info-text">
- <div class="info-text-name" style="color: #fff;">
- <h3>{{user?.name}}</h3>
- </div>
- </div>
- </div>
- </div>
- <ion-list>
- <ion-item class="item-menu" detail mode="md" style="--border-style: none;">
- <img src="@/assets/icon/grxx.png" >
- <ion-label @click="router.push('/tabs/tabUser/myInfo')">个人信息</ion-label>
- </ion-item>
- <ion-item class="item-menu" detail mode="md" style="--border-style: none;" v-if="isDev">
- <img src="@/assets/icon/tysz.png">
- <ion-label @click="router.push('/tabs/tabUser/updatePassword')">密码修改</ion-label>
- </ion-item>
- <ion-item class="item-menu" detail mode="md" style="--border-style: none;">
- <img src="@/assets/icon/gywm.png">
- <ion-label>关于我们</ion-label>
- </ion-item>
- </ion-list>
- <div class="login-out" @click="presentAlert" v-if="isDev">
- 退出登录
- </div>-->
- <div class="tab-user-content">
- <div class="user_info">
- <div class="user_img">
- <b-image v-if="loadImage" :file-ref-id="user.userID" :readonly="true" :is-single="true"></b-image>
- </div>
- <div class="user_text">
- <h2>{{user.name}}</h2>
- <p>驿站工作人员</p>
- </div>
- <div class="qr_img">
- <img :src="infoQrcodeUrl" :style="imgStyle">
- </div>
- </div>
- <div class="user_panel">
- <div class="panel_title">
- 我的设置
- </div>
- <div class="panel_list">
- <ion-item class="item-menu" detail mode="md">
- <img src="@/assets/icon/grxx.png" >
- <ion-label @click="router.push('/tabs/tabUser/myInfo')">个人信息</ion-label>
- </ion-item>
- <ion-item class="item-menu" detail mode="md" v-if="isDev">
- <img src="@/assets/icon/tysz.png">
- <ion-label @click="router.push('/tabs/tabUser/updatePassword')">密码修改</ion-label>
- </ion-item>
- <ion-item class="item-menu" detail mode="md">
- <img src="@/assets/icon/gywm.png">
- <ion-label @click="router.push('/tabs/tabUser/about')">关于我们</ion-label>
- </ion-item>
- <ion-item class="item-menu" detail mode="md">
- <img src="@/assets/icon/tc.png">
- <ion-label @click="presentAlert">退出登录</ion-label>
- </ion-item>
- </div>
- </div>
- </div>
- </ion-content>
- </ion-page>
- </template>
- <script setup lang="ts">
- import { alertController } from '@ionic/vue';
- import { useUserStore } from '@/store/modules/user';
- import router from '@/router';
- import {getCurrentInstance, onMounted, onUpdated, ref, watch} from "vue";
- import {getConfig} from "@/utils/config";
- import {getQRCodeUrlToBase64} from "@/api/wechat";
- import {base64ToBlob} from "@/utils/imageUtils";
- import BImage from "@/components/bImage.vue";
- import {useRouter} from "vue-router";
- const $router = useRouter();
- const infoQrcodeUrl = ref("");
- const { appContext : { config: { globalProperties } } } = getCurrentInstance();
- const userStore = useUserStore();
- const user = ref(userStore.getUserInfo);
- const qrCodeUrl = "/jobUserInfo/index";
- getQRCodeUrlToBase64(encodeURIComponent(qrCodeUrl), user.value.userID==undefined?"":user.value.userID).then(base64Str => {
- infoQrcodeUrl.value = URL.createObjectURL(base64ToBlob("data:image/png;base64," + base64Str));
- }, () => {
- infoQrcodeUrl.value = "";
- });
- const imgStyle = ref({
- width: '0px',
- height: '0px',
- margin: '0px 0px 0px 40px'
- });
- const loadImage = ref(true);
- const updateBrowserWidth = () => {
- const browserWidth = window.innerWidth;
- imgStyle.value.width = (browserWidth - 130) / 3 + 'px';
- imgStyle.value.height = (browserWidth - 130) / 3 + 'px';
- imgStyle.value.margin = '0px 0px 0px ' + (browserWidth - 200) / 15 + 'px';
- }
- updateBrowserWidth();
- window.addEventListener('resize', updateBrowserWidth);
- const isDev = ref(false);
- const presentAlert = async () => {
- const alert = await alertController.create({
- header: '是否退出登陆?',
- buttons: [
- {
- text: '取消',
- role: 'cancel'
- },
- {
- text: '确定',
- role: 'confirm',
- handler: () => {
- userStore.logout().then(()=>{
- globalProperties.$routeActive = false;
- router.push("/login");
- });
- },
- },
- ],
- });
- await alert.present();
- }
- watch(() => $router.currentRoute.value.path, (to, form) => {
- if (form == "/tabs/tabUser/myInfo" && to == "/tabs/tabUser") {
- loadImage.value = false;
- setTimeout(() => {
- loadImage.value = true;
- }, 500)
- }
- }, {immediate: true});
- onMounted(() => {
- getConfig().then((res: any) => {
- isDev.value = res.isDev;
- }, () => {
- isDev.value = true;
- })
- })
- </script>
- <style lang="less">
- .tab-user-content{
- background-image: url("../../assets/icon/user_bg.png");
- width: 100%;
- height: 100%;
- background-size: contain;
- background-repeat: no-repeat;
- background-color: #F7F8FC;
- background-attachment: local;
- overflow: hidden;
- .user_info{
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin: 90px 10px 10px 10px;
- padding: 10px;
- border-radius: 10px;
- background-color: rgba(255, 255, 255, 0.6);
- position: relative;
- z-index: 2;
- .user_text{
- padding-left: 20px;
- p{
- color: #899099;
- }
- }
- }
- .user_info::before{
- content: " ";
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- z-index: -1;
- backdrop-filter: blur(2px);
- border-radius: 10px;
- }
- .user_panel{
- background-color: white;
- border-radius: 10px;
- padding: 10px;
- margin: 10px;
- .panel_title{
- font-size: 18px;
- padding: 15px;
- }
- .panel_list{
- ion-item{
- --inner-border-width: 0;
- --inner-padding-end:0px;
- ion-label{
- padding-left: 10px;
- }
- }
- }
- }
- }
- .user_img {
- .img-list {
- padding: 0;
- }
- .img-item {
- width: 100%;
- }
- }
- </style>
|