feat: 设置页面
This commit is contained in:
parent
15693fbc16
commit
70ac9afc9b
31
pages.json
31
pages.json
|
@ -145,6 +145,31 @@
|
||||||
"navigationBarTitleText": "忘记密码",
|
"navigationBarTitleText": "忘记密码",
|
||||||
"enablePullDownRefresh": false
|
"enablePullDownRefresh": false
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/user/index",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "",
|
||||||
|
"navigationBarBackgroundColor": "#e5ebfd",
|
||||||
|
"navigationBarTextStyle": "white",
|
||||||
|
"enablePullDownRefresh": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/user/unitInfo/index",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "单位信息",
|
||||||
|
"navigationBarBackgroundColor": "white",
|
||||||
|
"navigationBarTextStyle": "black"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/user/versionInfo/index",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "版本信息",
|
||||||
|
"navigationBarBackgroundColor": "white",
|
||||||
|
"navigationBarTextStyle": "black"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
//分包加载配置,此配置为小程序的分包加载机制。
|
//分包加载配置,此配置为小程序的分包加载机制。
|
||||||
|
@ -190,6 +215,12 @@
|
||||||
"iconPath": "static/tab/my.png",
|
"iconPath": "static/tab/my.png",
|
||||||
"selectedIconPath": "static/tab/my_cur.png",
|
"selectedIconPath": "static/tab/my_cur.png",
|
||||||
"text": "我的"
|
"text": "我的"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pagePath": "pages/user/index",
|
||||||
|
"iconPath": "static/tab/my.png",
|
||||||
|
"selectedIconPath": "static/tab/my_cur.png",
|
||||||
|
"text": "设置"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,224 @@
|
||||||
|
<template>
|
||||||
|
<view class="content">
|
||||||
|
<!-- 设置 -->
|
||||||
|
<view class="head">
|
||||||
|
<view class="personInfo">
|
||||||
|
<view>登录/注册</view>
|
||||||
|
<view class="account">点击登录 获取更多信息</view>
|
||||||
|
</view>
|
||||||
|
<u-avatar
|
||||||
|
:src="baseInfo.avatar"
|
||||||
|
size="140"
|
||||||
|
mode="circle"
|
||||||
|
class="avatar"
|
||||||
|
:show-level="true"
|
||||||
|
level-icon="camera"
|
||||||
|
@click="upload_avatar"
|
||||||
|
></u-avatar>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="cell-list-box">
|
||||||
|
<view class="cell-list-group">
|
||||||
|
<view
|
||||||
|
class="cell-list-item"
|
||||||
|
v-for="item in cellList"
|
||||||
|
@click="toPage(item.path)"
|
||||||
|
>
|
||||||
|
<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">
|
||||||
|
<u-icon name="arrow-right" color="#eeeeee" size="32"></u-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
toast,
|
||||||
|
clearStorageSync,
|
||||||
|
setStorageSync,
|
||||||
|
getStorageSync,
|
||||||
|
useRouter,
|
||||||
|
} from "@/utils/utils.js";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
baseInfo: {
|
||||||
|
name: "",
|
||||||
|
phone: "",
|
||||||
|
avatar: "",
|
||||||
|
company_name: "",
|
||||||
|
registerDate: "",
|
||||||
|
login_code: "",
|
||||||
|
auth: 0,
|
||||||
|
},
|
||||||
|
version: "",
|
||||||
|
|
||||||
|
cellList: [
|
||||||
|
{
|
||||||
|
title: "单位信息",
|
||||||
|
icon: "/static/images/pos-icon.png",
|
||||||
|
path: "/pages/user/unitInfo/index",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "版本信息",
|
||||||
|
icon: "/static/images/pos-icon.png",
|
||||||
|
path: "/pages/user/versionInfo/index",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "注销",
|
||||||
|
icon: "/static/images/pos-icon.png",
|
||||||
|
path: "",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
this.getUserInfo();
|
||||||
|
const that = this;
|
||||||
|
uni.getSystemInfo({
|
||||||
|
success: function (res) {
|
||||||
|
console.log("res", res);
|
||||||
|
that.version = res.appVersion;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
uni.$on("refresh", (e) => {
|
||||||
|
this.getUserInfo();
|
||||||
|
uni.$off("refresh");
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// 下拉刷新
|
||||||
|
onPullDownRefresh() {
|
||||||
|
//console.log('refresh');
|
||||||
|
this.getUserInfo();
|
||||||
|
uni.stopPullDownRefresh(); //停止刷新
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getUserInfo() {
|
||||||
|
this.$api.baseInfo().then((res) => {
|
||||||
|
//console.log(res)
|
||||||
|
this.baseInfo = res.data;
|
||||||
|
this.avatar_src = res.data.avatar;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
service_center() {
|
||||||
|
toast("未设置跳转,请自行定义");
|
||||||
|
},
|
||||||
|
|
||||||
|
setting() {
|
||||||
|
useRouter("/pages/my/account/setting", {}, "navigateTo");
|
||||||
|
},
|
||||||
|
|
||||||
|
toPage(path) {
|
||||||
|
if (!path) return;
|
||||||
|
console.log("path", path);
|
||||||
|
|
||||||
|
useRouter(path, {}, "navigateTo");
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.content {
|
||||||
|
.head {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
background: linear-gradient(to bottom, #e5ebfd, #ffffff);
|
||||||
|
min-height: 300rpx;
|
||||||
|
padding: 70rpx 40rpx 0;
|
||||||
|
|
||||||
|
.personInfo {
|
||||||
|
color: #333;
|
||||||
|
margin-top: 25rpx;
|
||||||
|
font-size: 40rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-left: 30rpx;
|
||||||
|
line-height: 50rpx;
|
||||||
|
.account {
|
||||||
|
color: #999;
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: normal;
|
||||||
|
margin-top: 10rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.avatar {
|
||||||
|
margin-left: 50rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.cell-list-box {
|
||||||
|
padding: 0 32rpx;
|
||||||
|
|
||||||
|
.cell-list-group {
|
||||||
|
.cell-list-item {
|
||||||
|
border-bottom: 1px solid #e9eaee;
|
||||||
|
padding: 0 10rpx;
|
||||||
|
height: 120rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
&-left {
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
text {
|
||||||
|
margin-left: 24rpx;
|
||||||
|
align-self: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,99 @@
|
||||||
|
<template>
|
||||||
|
<view class="content">
|
||||||
|
<u-cell-group :border="false">
|
||||||
|
<u-cell-item
|
||||||
|
title="头像"
|
||||||
|
hover-class="none"
|
||||||
|
:arrow="false"
|
||||||
|
:title-style="{ color: '#333' }"
|
||||||
|
>
|
||||||
|
<template slot="right-icon">
|
||||||
|
<image
|
||||||
|
style="width: 60rpx; height: 60rpx; border-radius: 30rpx"
|
||||||
|
mode="aspectFit"
|
||||||
|
:src="baseInfo.avatar"
|
||||||
|
></image>
|
||||||
|
</template>
|
||||||
|
</u-cell-item>
|
||||||
|
<u-cell-item
|
||||||
|
title="姓名"
|
||||||
|
hover-class="none"
|
||||||
|
:value="baseInfo.name"
|
||||||
|
:arrow="false"
|
||||||
|
:title-style="{ color: '#333' }"
|
||||||
|
></u-cell-item>
|
||||||
|
<u-cell-item
|
||||||
|
title="性别"
|
||||||
|
hover-class="none"
|
||||||
|
:value="baseInfo.gender ? '男' : '女'"
|
||||||
|
:arrow="false"
|
||||||
|
:title-style="{ color: '#333' }"
|
||||||
|
></u-cell-item>
|
||||||
|
<u-cell-item
|
||||||
|
title="任职周期"
|
||||||
|
hover-class="none"
|
||||||
|
:value="baseInfo.cycleTime"
|
||||||
|
:arrow="false"
|
||||||
|
:title-style="{ color: '#333' }"
|
||||||
|
></u-cell-item>
|
||||||
|
<u-cell-item
|
||||||
|
title="人员类型"
|
||||||
|
hover-class="none"
|
||||||
|
:value="baseInfo.personnelType"
|
||||||
|
:arrow="false"
|
||||||
|
:title-style="{ color: '#333' }"
|
||||||
|
></u-cell-item>
|
||||||
|
</u-cell-group>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
toast,
|
||||||
|
clearStorageSync,
|
||||||
|
setStorageSync,
|
||||||
|
getStorageSync,
|
||||||
|
useRouter,
|
||||||
|
} from "@/utils/utils.js";
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
activeTab: "completed", // 默认选中已完成计划
|
||||||
|
baseInfo: {
|
||||||
|
name: "张三",
|
||||||
|
avatar: "/static/images/pos-icon.png",
|
||||||
|
gender: "0",
|
||||||
|
cycleTime: "2017.11.11~2021.11.11",
|
||||||
|
personnelType: "勤工岗",
|
||||||
|
},
|
||||||
|
auth_txt: "未实名",
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onLoad(op) {
|
||||||
|
//this.id = op.id
|
||||||
|
},
|
||||||
|
onShow() {},
|
||||||
|
onReady() {
|
||||||
|
// this.getUserInfo();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
switchTab(tab) {
|
||||||
|
this.activeTab = tab;
|
||||||
|
// 这里可以添加切换逻辑,如加载不同数据等
|
||||||
|
},
|
||||||
|
getUserInfo() {
|
||||||
|
this.$api.baseInfo().then((res) => {
|
||||||
|
this.baseInfo = res.data;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
page {
|
||||||
|
background: #f6f8fc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
padding-top: 32rpx;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,63 @@
|
||||||
|
<template>
|
||||||
|
<view class="content">
|
||||||
|
<view class="version-box">
|
||||||
|
<image
|
||||||
|
style="width: 200rpx; height: 200rpx"
|
||||||
|
mode="aspectFit"
|
||||||
|
:src="logo"
|
||||||
|
></image>
|
||||||
|
|
||||||
|
<text> {{ version }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
toast,
|
||||||
|
clearStorageSync,
|
||||||
|
setStorageSync,
|
||||||
|
getStorageSync,
|
||||||
|
useRouter,
|
||||||
|
} from "@/utils/utils.js";
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
logo: "/static/images/logo.png",
|
||||||
|
version: "v1.0.2",
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onLoad(op) {
|
||||||
|
//this.id = op.id
|
||||||
|
},
|
||||||
|
onShow() {},
|
||||||
|
onReady() {
|
||||||
|
// this.getUserInfo();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getUserInfo() {
|
||||||
|
this.$api.baseInfo().then((res) => {
|
||||||
|
this.baseInfo = res.data;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
page {
|
||||||
|
background: #f6f8fc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
padding-top: 100rpx;
|
||||||
|
.version-box {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
text {
|
||||||
|
color: #999;
|
||||||
|
margin-top: 32rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
Loading…
Reference in New Issue