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">
|
|
|
|
<u-avatar
|
|
|
|
:src="baseInfo.avatar || '/static/images/avatar.png'"
|
|
|
|
size="140"
|
|
|
|
mode="circle"
|
|
|
|
class="avatar"
|
|
|
|
></u-avatar>
|
|
|
|
</view>
|
2025-04-15 14:37:47 +08:00
|
|
|
<view class="content-name">JuLia James</view>
|
2025-04-15 11:04:10 +08:00
|
|
|
</view>
|
|
|
|
<view class="cell-list-box">
|
|
|
|
<view class="cell-list-group">
|
2025-04-15 16:46:09 +08:00
|
|
|
<view class="cell-list-item" v-for="item in cellList" @click="toPage(item.path,item)">
|
2025-04-15 11:04:10 +08:00
|
|
|
<view class="cell-list-item-left">
|
|
|
|
<image
|
|
|
|
style="width: 60rpx; height: 60rpx"
|
|
|
|
mode="aspectFit"
|
|
|
|
:src="item.icon"
|
|
|
|
></image>
|
|
|
|
<text>{{ item.title }}</text>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view class="cell-list-item-right">
|
|
|
|
<text v-if="item.content">{{ item.content }}</text>
|
|
|
|
<u-icon v-else name="arrow-right" color="#a5a7ab" size="32"></u-icon>
|
|
|
|
</view>
|
|
|
|
</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-15 11:04:10 +08:00
|
|
|
import { GetCompanyInformation } from "@/api/apiList.js";
|
|
|
|
|
|
|
|
import {
|
|
|
|
toast,
|
|
|
|
clearStorageSync,
|
|
|
|
setStorageSync,
|
|
|
|
getStorageSync,
|
|
|
|
useRouter,
|
|
|
|
} from "@/utils/utils.js";
|
|
|
|
|
2025-04-15 10:07:11 +08:00
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
2025-04-15 11:04:10 +08:00
|
|
|
baseInfo: {
|
|
|
|
avatar: "",
|
|
|
|
companyName: "南昌理工",
|
|
|
|
name: "保洁",
|
|
|
|
sex: 0, // 0 男 1 女
|
|
|
|
time: "2025/4/2-2026/4/2",
|
|
|
|
personType: "保洁员",
|
|
|
|
},
|
|
|
|
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",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
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() {
|
|
|
|
// this.getUserInfo();
|
|
|
|
// const that = this;
|
|
|
|
// uni.getSystemInfo({
|
|
|
|
// success: function (res) {
|
|
|
|
// console.log("res", res);
|
|
|
|
// that.version = res.appVersion;
|
|
|
|
// },
|
|
|
|
// });
|
|
|
|
},
|
|
|
|
onShow() {
|
|
|
|
// this.getCompanyInformation();
|
|
|
|
// uni.$on("refresh", (e) => {
|
|
|
|
// this.getUserInfo();
|
|
|
|
// uni.$off("refresh");
|
|
|
|
// });
|
|
|
|
},
|
|
|
|
|
|
|
|
// 下拉刷新
|
|
|
|
onPullDownRefresh() {
|
|
|
|
//console.log('refresh');
|
|
|
|
// this.getUserInfo();
|
|
|
|
// uni.stopPullDownRefresh(); //停止刷新
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
handleClick() {
|
|
|
|
this.clickCount++; // 每次点击增加点击次数
|
|
|
|
if (this.clickCount === 6) {
|
|
|
|
this.clickCount = 0; // 执行完函数后重置点击次数
|
|
|
|
uni.navigateTo({
|
|
|
|
url: "/pages/login/login",
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
upload_avatar() {
|
|
|
|
const _this = this;
|
|
|
|
uni.chooseImage({
|
|
|
|
count: 1,
|
|
|
|
sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
|
|
|
|
sourceType: ["album", "camera"], //从相册选择
|
|
|
|
success: function (res) {
|
|
|
|
uni.uploadFile({
|
|
|
|
url: _this.$api_url + "/api/index/upload_cos",
|
|
|
|
filePath: res.tempFilePaths[0],
|
|
|
|
name: "file",
|
|
|
|
formData: {
|
|
|
|
floder: "avatar",
|
|
|
|
},
|
|
|
|
success: (uploadFileRes) => {
|
|
|
|
//let retData = JSON.parse(uploadFileRes)
|
|
|
|
|
|
|
|
let retData = JSON.parse(uploadFileRes.data);
|
|
|
|
console.log("up:", retData);
|
|
|
|
const _data = {
|
|
|
|
avatar: retData.data.file,
|
|
|
|
};
|
|
|
|
_this.$api.baseInfoSave(_data).then((ret) => {
|
|
|
|
if (ret.code == 1) {
|
|
|
|
_this.baseInfo.avatar = retData.data.file;
|
|
|
|
} else {
|
|
|
|
toast(res.msg);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
// 获取单位信息
|
|
|
|
async getCompanyInformation() {
|
|
|
|
const res = await GetCompanyInformation();
|
|
|
|
if (res.succeed) {
|
|
|
|
this.baseInfo = res.data;
|
|
|
|
this.cellList[0].content = this.baseInfo.time;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2025-04-15 16:54:35 +08:00
|
|
|
toPage(path,item) {
|
2025-04-15 16:46:09 +08:00
|
|
|
if(item.title === '注销'){
|
|
|
|
let u = navigator.userAgent;
|
|
|
|
let isAndroid =
|
|
|
|
u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; //android
|
|
|
|
// 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-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);
|
|
|
|
// background: #f6f8fc;
|
|
|
|
.content-title {
|
|
|
|
text-align: center;
|
|
|
|
padding-top: 40rpx;
|
|
|
|
font-size: 30rpx;
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
.head {
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
flex-direction: column;
|
|
|
|
min-height: 200rpx;
|
|
|
|
padding: 70rpx 40rpx 0;
|
|
|
|
// background: linear-gradient(to bottom, #e5ebfd, #f6f8fc);
|
|
|
|
|
|
|
|
.avatar-box {
|
|
|
|
width: 140rpx;
|
|
|
|
height: 140rpx;
|
|
|
|
border-radius: 50%;
|
|
|
|
position: relative;
|
|
|
|
.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
|
|
|
}
|
|
|
|
|
|
|
|
.cell-list-box {
|
|
|
|
margin-top: 20rpx;
|
|
|
|
padding: 0 32rpx;
|
|
|
|
|
|
|
|
.cell-list-group {
|
|
|
|
.cell-list-item {
|
|
|
|
border-bottom: 1px solid #e9eaee;
|
|
|
|
padding: 0 10rpx;
|
2025-04-15 15:40:25 +08:00
|
|
|
height: 100rpx;
|
2025-04-15 11:04:10 +08:00
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
&-left {
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
text {
|
|
|
|
margin-left: 24rpx;
|
|
|
|
align-self: center;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2025-04-15 10:07:11 +08:00
|
|
|
}
|
|
|
|
</style>
|