InspectionCleaning/pages/adminMy/index.vue

278 lines
7.0 KiB
Vue
Raw Normal View History

2025-04-15 10:07:11 +08:00
<template>
<view class="content">
2025-04-15 11:04:10 +08:00
<view class="content-title">我的</view>
<view class="head">
<view class="avatar-box">
2025-04-24 15:03:07 +08:00
<u-avatar :src="'/static/images/avatar.png'" size="140" mode="circle" class="avatar"></u-avatar>
2025-04-15 11:04:10 +08:00
</view>
2025-04-24 15:03:07 +08:00
<view class="content-name">{{ userName }}</view>
2025-04-15 11:04:10 +08:00
</view>
<view class="cell-list-box">
2025-04-24 15:03:07 +08:00
<view class="cell-list-item" v-for="item in cellList" @click="toPage(item.path, item)">
2025-04-16 09:42:57 +08:00
<view class="cell-list-item-left">
2025-04-24 15:03:07 +08:00
<image style="width: 60rpx; height: 60rpx" mode="aspectFit" :src="item.icon"></image>
2025-04-16 09:42:57 +08:00
<text>{{ item.title }}</text>
</view>
2025-04-15 11:04:10 +08:00
2025-04-16 09:42:57 +08:00
<view class="cell-list-item-right">
<text>{{ item.content }}</text>
<!-- <u-icon v-else name="arrow-right" color="#a5a7ab" size="32"></u-icon> -->
</view>
</view>
</view>
<view class="empty-box"></view>
<view class="cell-list-box2">
2025-04-24 15:03:07 +08:00
<view class="cell-list-item" v-for="item in cellList2" @click="toPage(item.path, item)">
2025-04-16 09:42:57 +08:00
<view class="cell-list-item-left">
2025-04-24 15:03:07 +08:00
<image style="width: 60rpx; height: 60rpx" mode="aspectFit" :src="item.icon"></image>
2025-04-16 09:42:57 +08:00
<text>{{ item.title }}</text>
</view>
<view class="cell-list-item-right">
<u-icon name="arrow-right" color="#cccccc" size="32"></u-icon>
2025-04-15 11:04:10 +08:00
</view>
</view>
</view>
2025-04-15 10:07:11 +08:00
<u-tabbar :list="vuex_tabbar"></u-tabbar>
</view>
</template>
2025-04-15 11:04:10 +08:00
2025-04-15 10:07:11 +08:00
<script>
2025-04-24 15:03:07 +08:00
import { GetUserDataApi } from "@/api/apiAdmin.js";
2025-04-15 11:04:10 +08:00
import {
toast,
clearStorageSync,
setStorageSync,
getStorageSync,
useRouter,
} from "@/utils/utils.js";
2025-04-15 10:07:11 +08:00
export default {
data() {
return {
2025-04-24 15:03:07 +08:00
form: {
"id": "08dd80a7-f2fa-46df-8374-4e132418512e",
"name": "计算机学院教学大楼12栋",
"description": "12栋",
"companyId": "4b2d9662-a768-08f2-a0c8-762b8c76da2a",
"departmentId": "08dd6dcf-ffc9-4000-89b2-b53ea1d5acfb",
"department": null,
"userId": "21645b80-8aff-3cf2-b1f3-2ba9d485fecd",
"areas": [],
"createTime": "2025-04-21T15:41:36.897423",
"isDeleted": false
2025-04-15 11:04:10 +08:00
},
2025-04-24 15:03:07 +08:00
// 用户姓名
userName: '',
// 人员类型
userType: '',
2025-04-15 11:04:10 +08:00
clickCount: 0, // 用于记录点击次数
version: "",
cellList: [
{
title: "性别",
2025-04-15 14:37:47 +08:00
icon: "/static/adminImg/item1.png",
2025-04-15 11:04:10 +08:00
path: "",
content: "男",
},
{
title: "人员类型",
2025-04-15 14:37:47 +08:00
icon: "/static/adminImg/item2.png",
2025-04-15 11:04:10 +08:00
path: "/pages/user/versionInfo/index",
content: "区域管理员",
},
{
title: "所属区域",
2025-04-15 14:37:47 +08:00
icon: "/static/adminImg/item3.png",
2025-04-15 11:04:10 +08:00
path: "",
content: "区域111",
},
2025-04-16 09:42:57 +08:00
],
cellList2: [
2025-04-15 11:04:10 +08:00
{
title: "版本信息",
2025-04-15 14:37:47 +08:00
icon: "/static/adminImg/item4.png",
2025-04-15 11:04:10 +08:00
path: "/pages/user/versionInfo/index",
},
{
title: "注销",
2025-04-15 14:37:47 +08:00
icon: "/static/adminImg/item5.png",
2025-04-15 11:04:10 +08:00
path: "",
},
],
2025-04-15 10:07:11 +08:00
};
},
2025-04-15 11:04:10 +08:00
onLoad() {
},
onShow() {
2025-04-24 15:03:07 +08:00
this.getDataFn();
2025-04-15 11:04:10 +08:00
},
methods: {
2025-04-24 15:03:07 +08:00
async getDataFn() {
const res = await GetUserDataApi();
console.log(res, "用户数据");
Object.assign(this.form, res.data.userRegion);
// 用户名称
this.userName = res.data.userName
// 人员类型
this.userType = res.data.userType
this.cellList[1].content = res.data.userType
// 所属区域
this.cellList[2].content = res.data.userRegion.name
},
2025-04-15 11:04:10 +08:00
handleClick() {
this.clickCount++; // 每次点击增加点击次数
if (this.clickCount === 6) {
this.clickCount = 0; // 执行完函数后重置点击次数
uni.navigateTo({
url: "/pages/login/login",
});
}
},
2025-04-16 09:42:57 +08:00
toPage(path, item) {
if (item.title === "注销") {
2025-04-18 13:51:49 +08:00
uni.showModal({
title: "提示",
content: "确定注销吗?",
showCancel: true,
success: function (res) {
2025-04-24 15:03:07 +08:00
if (!res.confirm) { return }
console.log(res, 'res--')
2025-04-18 13:51:49 +08:00
// 确定退出
let u = navigator.userAgent;
let isAndroid =
2025-04-24 15:03:07 +08:00
u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; //android
2025-04-18 13:51:49 +08:00
// let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios
try {
if (isAndroid && AndroidJs) {
console.log("%c%s", "color:red", "安卓--调用返回方法");
const reqRow = {
name: "logout",
data: "",
};
AndroidJs.func(JSON.stringify(reqRow)); // 给安卓传参
} else {
console.log("%c%s", "color:red", "苹果--调用返回方法");
const reqRow = {
name: "back-iphone",
data: "",
};
window.webkit.messageHandlers.func.postMessage(
JSON.stringify(reqRow)
); // 给ios 传参
}
} catch (e) {
console.log(e, "e-----判断安卓苹果类型出错");
}
return
},
});
2025-04-16 09:42:57 +08:00
return;
2025-04-15 16:46:09 +08:00
}
2025-04-15 11:04:10 +08:00
if (!path) return;
useRouter(path, {}, "navigateTo");
},
2025-04-15 10:07:11 +08:00
},
};
</script>
2025-04-15 11:04:10 +08:00
2025-04-15 10:07:11 +08:00
<style lang="scss" scoped>
.content {
2025-04-15 11:04:10 +08:00
height: calc(100vh - 100rpx);
2025-04-24 15:03:07 +08:00
2025-04-15 11:04:10 +08:00
// background: #f6f8fc;
.content-title {
2025-04-16 09:42:57 +08:00
background: #fff;
2025-04-15 11:04:10 +08:00
text-align: center;
padding-top: 40rpx;
font-size: 30rpx;
font-weight: bold;
}
2025-04-24 15:03:07 +08:00
2025-04-15 11:04:10 +08:00
.head {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
min-height: 200rpx;
2025-04-16 09:42:57 +08:00
padding: 70rpx 40rpx 32rpx;
2025-04-15 11:04:10 +08:00
// background: linear-gradient(to bottom, #e5ebfd, #f6f8fc);
2025-04-16 09:42:57 +08:00
background-color: #fff;
2025-04-15 11:04:10 +08:00
.avatar-box {
width: 140rpx;
height: 140rpx;
border-radius: 50%;
position: relative;
2025-04-24 15:03:07 +08:00
2025-04-15 11:04:10 +08:00
.avatar {
width: 100%;
}
}
}
.content-name {
margin-top: 20rpx;
2025-04-15 14:37:47 +08:00
font-weight: bold;
2025-04-15 11:04:10 +08:00
}
2025-04-16 09:42:57 +08:00
.empty-box {
height: 20rpx;
background-color: #f6f8fc;
}
2025-04-15 11:04:10 +08:00
.cell-list-box {
2025-04-16 09:42:57 +08:00
// margin-top: 20rpx;
2025-04-15 11:04:10 +08:00
padding: 0 32rpx;
2025-04-16 09:42:57 +08:00
background-color: #fff;
2025-04-15 11:04:10 +08:00
2025-04-16 09:42:57 +08:00
.cell-list-item {
border-bottom: 1px solid #f4f4f4;
padding: 0 10rpx;
height: 100rpx;
display: flex;
justify-content: space-between;
align-items: center;
&-left {
2025-04-15 11:04:10 +08:00
display: flex;
2025-04-16 09:42:57 +08:00
text {
margin-left: 24rpx;
align-self: center;
}
}
2025-04-24 15:03:07 +08:00
2025-04-16 09:42:57 +08:00
&-right {
color: #999;
}
}
}
2025-04-15 11:04:10 +08:00
2025-04-16 09:42:57 +08:00
.cell-list-box2 {
margin-top: 20rpx;
padding: 0 32rpx;
background-color: #fff;
.cell-list-item {
border-bottom: 1px solid #f4f4f4;
padding: 0 10rpx;
height: 100rpx;
display: flex;
justify-content: space-between;
align-items: center;
&-left {
display: flex;
text {
margin-left: 24rpx;
align-self: center;
2025-04-15 11:04:10 +08:00
}
}
}
}
2025-04-15 10:07:11 +08:00
}
</style>