123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356 |
- <template>
- <view class="mine-container" :style="{ height: `${windowHeight}px` }">
- <!--顶部个人信息栏-->
- <view class="header-section">
- <view class="flex padding justify-between">
- <view class="flex align-center">
- <view v-if="!avatar" class="cu-avatar xl round bg-white">
- <view class="iconfont icon-people text-gray icon"></view>
- </view>
- <image v-if="avatar" @click="handleToAvatar" :src="avatar" class="cu-avatar xl round" mode="widthFix"> </image>
- <view v-if="!data.name" @click="handleToLogin" class="login-tip"> 点击登录 </view>
- <view v-if="data.name" class="user-info">
- <view class="u_title"> {{ data.name }} </view>
- <view class="u_title"> {{ data.phone }} </view>
- </view>
- </view>
- <view class="flex align-center"> </view>
- </view>
- <view class="vip-card-box"> </view>
- </view>
- <view
- class="content-section"
- :style="[
- {
- transform: coverTransform,
- transition: coverTransition,
- },
- ]"
- @touchstart="coverTouchstart"
- @touchmove="coverTouchmove"
- @touchend="coverTouchend"
- >
- <image class="mine-image" src="@/static/images/mine/arc.png"></image>
- <!-- <view class="mine-actions grid col-4 text-center">
- <view class="action-item" @click="handleJiaoLiuQun">
- <view class="iconfont icon-friendfill text-pink icon"></view>
- <text class="text">客服QQ</text>
- </view>
- <view class="action-item" @click="handleBuilding">
- <view class="iconfont icon-service text-blue icon"></view>
- <text class="text">在线客服</text>
- </view>
- <view class="action-item" @click="handleBuilding">
- <view class="iconfont icon-community text-mauve icon"></view>
- <text class="text">反馈社区</text>
- </view>
- <view class="action-item" @click="handleBuilding">
- <view class="iconfont icon-dianzan text-green icon"></view>
- <text class="text">点赞我们</text>
- </view>
- </view> -->
- <view class="menu-list">
- <view class="list-cell list-cell-arrow" @click="handleToEditInfo">
- <view class="menu-item-box">
- <view class="iconfont icon-user menu-icon"></view>
- <view>个人资料</view>
- </view>
- </view>
- <view class="list-cell list-cell-arrow" @click="handleToPwd">
- <view class="menu-item-box">
- <view class="iconfont icon-password menu-icon"></view>
- <view>修改密码</view>
- </view>
- </view>
- </view>
- <view class="menu-list">
- <view class="list-cell list-cell-arrow" @click="handleAbout">
- <view class="menu-item-box">
- <view class="iconfont icon-aixin menu-icon"></view>
- <view>关于我们</view>
- </view>
- </view>
- <view class="list-cell list-cell-arrow" @click="handleHelp">
- <view class="menu-item-box">
- <view class="iconfont icon-help menu-icon"></view>
- <view>常见问题</view>
- </view>
- </view>
- <view class="list-cell list-cell-arrow" @click="handleCleanTmp">
- <view class="menu-item-box">
- <view class="iconfont icon-clean menu-icon"></view>
- <view>清理缓存</view>
- <view style="margin: 0 15px 0 auto; font-size: 14px; color: #909399">{{ settings.$state.currentSize }}</view>
- </view>
- </view>
- <view class="list-cell list-cell-arrow" @click="handleToUpgrade">
- <view class="menu-item-box">
- <view class="iconfont icon-refresh menu-icon"></view>
- <view>检查更新</view>
- </view>
- </view>
- </view>
- <view class="cu-list menu">
- <view class="cu-item item-box">
- <view class="content text-center" @click="handleLogout">
- <text class="text-black">退出登录</text>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script setup>
- import config from "@/config";
- import storage from "@/utils/storage";
- import { onLoad, onShow, onHide, onLaunch, onNavigationBarButtonTap } from "@dcloudio/uni-app";
- import { ref, reactive, computed, getCurrentInstance, toRefs, inject } from "vue";
- import useStores from "@/store/modules/user.js";
- import settingStore from "@/store/modules/setting.js";
- const useStore = useStores();
- const settings = settingStore();
- const { proxy } = getCurrentInstance();
- const avatar = computed(() => {
- return useStore.$state.avatar;
- });
- const windowHeight = computed(() => {
- return uni.getSystemInfoSync().windowHeight - 50;
- });
- const data = reactive({
- name: useStore.$state.name,
- phone: useStore.$state.phonenumber,
- version: getApp().globalData.config.appInfo.version,
- coverTransform: "translateY(0px)",
- coverTransition: "0s",
- moving: false,
- });
- const { coverTransform, coverTransition, moving } = toRefs(data);
- /**
- * @点击登录
- */
- function handleToLogin() {
- proxy.$tab.reLaunch("/pages/login");
- }
- /**
- * @点击头像
- */
- function handleToAvatar() {
- proxy.$tab.navigateTo("/pages/mine/avatar/index");
- }
- /**
- * @退出登录
- */
- function handleLogout() {
- proxy.$modal.confirm("确定注销并退出系统吗?").then(() => {
- useStore.LogOut().then(() => {
- proxy.$tab.reLaunch("/pages/index");
- });
- });
- }
- /**
- * @常见问题
- */
- function handleHelp() {
- proxy.$tab.navigateTo("/pages/mine/help/index");
- }
- /**
- * @个人资料
- */
- function handleToEditInfo() {
- proxy.$tab.navigateTo("/pages/mine/info/index");
- }
- /**
- * @修改密码
- */
- function handleToPwd() {
- proxy.$tab.navigateTo("/pages/mine/pwd/index");
- }
- /**
- * @检查更新
- */
- function handleToUpgrade() {
- proxy.$modal.showToast("模块建设中~");
- }
- /**
- * @关于我们
- */
- function handleAbout() {
- proxy.$tab.navigateTo("/pages/mine/about/index");
- }
- /**
- * @清理缓存
- */
- function handleCleanTmp() {
- // #ifdef H5
- proxy.$modal.showToast("H5暂不支持此功能");
- // #endif
- // #ifdef APP-PLUS
- proxy.$setting.clearCache();
- // #endif
- }
- let startY = 0,
- moveY = 0,
- pageAtTop = true;
- function coverTouchstart(e) {
- if (pageAtTop === false) {
- return;
- }
- coverTransition.value = "transform .1s linear";
- startY = e.touches[0].clientY;
- }
- function coverTouchmove(e) {
- moveY = e.touches[0].clientY;
- let moveDistance = moveY - startY;
- if (moveDistance < 0) {
- moving.value = false;
- return;
- }
- moving.value = true;
- if (moveDistance >= 80 && moveDistance < 100) {
- moveDistance = 80;
- }
- if (moveDistance > 0 && moveDistance <= 80) {
- coverTransform.value = `translateY(${moveDistance}px)`;
- }
- }
- function coverTouchend() {
- if (moving.value === false) {
- return;
- }
- moving.value = false;
- coverTransition.value = "transform 0.3s cubic-bezier(.21,1.93,.53,.64)";
- coverTransform.value = "translateY(0px)";
- }
- onLoad((options) => {});
- // 自定义导航事件
- onNavigationBarButtonTap((e) => {
- console.log(e);
- if (e.float == "right") {
- proxy.$tab.navigateTo("/pages/mine/setting/index");
- }
- });
- </script>
- <style lang="scss">
- .mine-container {
- width: 100%;
- height: 100%;
- .header-section {
- padding: 55px 15px 0 15px;
- background-color: #149eff;
- color: white;
- .login-tip {
- font-size: 18px;
- margin-left: 10px;
- }
- .cu-avatar {
- border: 2px solid #eaeaea;
- .icon {
- font-size: 40px;
- }
- }
- .user-info {
- margin-left: 15px;
- .u_title {
- font-size: 18px;
- line-height: 30px;
- }
- }
- .vip-card-box {
- display: flex;
- flex-direction: column;
- color: #f7d680;
- height: 132px;
- background: url("@/static/images/mine/vip-card.png");
- background-size: 100% 100%;
- border-radius: 8px 8px 0 0;
- overflow: hidden;
- position: relative;
- padding: 11px 13px;
- }
- }
- .content-section {
- position: relative;
- margin-top: -85px;
- background-color: #f8f8f8;
- .mine-image {
- position: absolute;
- left: 0;
- top: -16px;
- width: 100%;
- height: 36upx;
- }
- .mine-actions {
- margin: 0.625rem 0.625rem;
- padding: 20px 0px;
- border-radius: 8px;
- background-color: white;
- .action-item {
- .icon {
- font-size: 28px;
- }
- .text {
- display: block;
- font-size: 13px;
- margin: 8px 0px;
- }
- }
- }
- }
- }
- </style>
- <style lang="scss" scoped>
- .item-box {
- background-color: #ffffff;
- margin: 30rpx;
- display: flex;
- flex-direction: row;
- justify-content: center;
- align-items: center;
- padding: 10rpx;
- border-radius: 8rpx;
- color: #303133;
- font-size: 32rpx;
- }
- </style>
|