From f26f29d84e0a68831a6af14dab3eec5500496d2e Mon Sep 17 00:00:00 2001 From: spring <2396852758@qq.com> Date: 星期三, 28 五月 2025 16:48:52 +0800 Subject: [PATCH] 初始化项目 --- pages/sys/user/index.vue | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 100 insertions(+), 0 deletions(-) diff --git a/pages/sys/user/index.vue b/pages/sys/user/index.vue new file mode 100644 index 0000000..8400653 --- /dev/null +++ b/pages/sys/user/index.vue @@ -0,0 +1,100 @@ +<template> + <view class="my"> + <view class="my-head"> + <u-navbar title="鎴戠殑" :border-bottom="false" :background="background" :title-bold="true" title-color="#fff" + :is-back="false" /> + <view class="my-head-content" @click="navTo('info')"> + <u-avatar :src="image" size="240"></u-avatar> + <p style="font-weight: bold; +font-size: 34rpx; +color: #333333;margin-bottom: 12rpx;">{{ + vuex_username || $t("login.noLogin") + }}</p> + <!-- TODO 瀵规帴閮ㄩ棬 --> + <p style="font-weight: 500; +font-size: 28rpx; +color: #666666;">鐢熶骇閮ㄩ棬涓�</p> + </view> + </view> + <u-button type="primary" style="margin: 30rpx;" :loading="loading" @click="logout" :custom-style="{ + backgroundColor: '#214DED', + height: '80rpx' + }" class="btn">{{ $t("login.logoutButton") }}</u-button> + </view> +</template> + +<script> +import config from "../../../common/config"; +export default { + data() { + return { + background: { + background: 'transparent' + }, + loading: false, + image: undefined, + } + }, + onLoad() { + this.image = config.baseUrl + this.vuex_user.avatar; + }, + methods: { + logout() { + this.$u.api.logout().then((res) => { + this.$u.toast(res.message); + + //娓呯┖瀛樺偍淇℃伅 + this.$u.vuex("vuex_token", ""); + this.$u.vuex("vuex_refresh_token", ""); + this.$u.vuex("vuex_username", ""); + this.$u.vuex("vuex_userId", ""); + this.$u.vuex("vuex_client_id", ""); + this.$u.vuex("vuex_user", {}); + + setTimeout(() => { + uni.reLaunch({ + url: "/pages/sys/login/index", + }); + }, 500); + }); + }, + navTo(url) { + // uni.navigateTo({ + // url: url, + // }); + }, + } +} +</script> + +<style lang="scss" scoped> +.my { + height: calc(100vh - 100rpx); + background: linear-gradient(to bottom, #E5F0FF, #F6F9FF); + + .my-head { + height: 320rpx; + background-image: url('~@/static/custom/user/bg2.png'); + background-size: 100% auto; + background-repeat: no-repeat; + position: relative; + + .my-head-content { + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; + position: absolute; + left: 50%; + transform: translate(-50%, 0); + bottom: -220rpx; + } + } + + .btn { + position: fixed; + bottom: 160rpx; + width: calc(100% - 60rpx); + } +} +</style> \ No newline at end of file -- Gitblit v1.9.3