app退出修改密码

master
mhsnet 2 months ago
parent 39fa16d482
commit 81aa39a1db

@ -0,0 +1,21 @@
import request from "@/utils/request";
// 获取当前用户个人资料
export function UserBaseInfo() {
return request({
url: "/api/permission/Users/Current/BaseInfo",
method: "GET",
});
}
// 账号注销
export function logoutCurrentUser(token) {
return request({
url: '/api/oauth/logoutCurrentUser',
method: 'post',
token,
header: {
'Content-Type': 'application/x-www-form-urlencoded',
}
})
}

@ -1063,7 +1063,7 @@
"text": "我的", "text": "我的",
"iconPath": "static/tabs/user_default.png", "iconPath": "static/tabs/user_default.png",
"selectedIconPath": "static/tabs/user_selected.png" "selectedIconPath": "static/tabs/user_selected.png"
}, }
// { // {
// "pagePath": "pages/index/portal", // "pagePath": "pages/index/portal",
// "text": "首页", // "text": "首页",
@ -1088,12 +1088,12 @@
// "iconPath": "static/image/tabbar/message.png", // "iconPath": "static/image/tabbar/message.png",
// "selectedIconPath": "static/image/tabbar/messageHL.png" // "selectedIconPath": "static/image/tabbar/messageHL.png"
// }, // },
{ // {
"pagePath": "pages/index/my", // "pagePath": "pages/index/my",
"text": "我", // "text": "我",
"iconPath": "static/image/tabbar/my.png", // "iconPath": "static/image/tabbar/my.png",
"selectedIconPath": "static/image/tabbar/myHL.png" // "selectedIconPath": "static/image/tabbar/myHL.png"
} // }
] ]
}, },
"globalStyle": { "globalStyle": {

@ -1,270 +1,319 @@
<template> <template>
<view class="my-v" v-if="loading"> <view class="my-v" v-if="loading">
<view class="u-flex user-box u-p-l-20 u-p-r-10 u-p-b-20"> <view class="u-flex user-box u-p-l-20 u-p-r-10 u-p-b-20">
<view class="u-m-r-10"> <view class="u-m-r-10">
<u-avatar size="140" @click='chooseAvatar' :src='avatarSrc'></u-avatar> <u-avatar size="140" @click="chooseAvatar" :src="avatarSrc"></u-avatar>
</view> </view>
<view class="u-flex-1 f-right" @click="personalPage('/pages/my/personalData/index')"> <view
<view class="u-font-18 u-m-l-16">{{baseInfo.realName}}</view> class="u-flex-1 f-right"
<view class="u-m-l-10 u-p-10"> @click="personalPage('/pages/my/personalData/index')"
<u-icon name="arrow-right" color="#969799" size="28"></u-icon> >
</view> <view class="u-font-18 u-m-l-16">{{ baseInfo.realName }}</view>
</view> <view class="u-m-l-10 u-p-10">
</view> <u-icon name="arrow-right" color="#969799" size="28"></u-icon>
<view class="u-m-t-20"> </view>
<view class="" style="background-color: #fff;"> </view>
<u-cell-group style="padding: 0 20rpx;" :border="false"> </view>
<u-cell-item title="我的组织" @click="openPage('/pages/my/business/index','Organize')" <view class="u-m-t-20">
:title-style="titleStyle"> <view class="" style="background-color: #fff">
<text class="icon-ym icon-ym-zuzhi u-m-r-16 u-font-36" slot="icon" style="color: #303133;" /> <u-cell-group style="padding: 0 20rpx" :border="false">
</u-cell-item> <u-cell-item
<u-cell-item title=" 我的岗位" @click="openPage('/pages/my/business/index','Position')" title="我的组织"
:title-style="titleStyle"> @click="openPage('/pages/my/business/index', 'Organize')"
<text class="icon-ym icon-ym-position1 u-m-r-16 u-font-36" slot="icon" :title-style="titleStyle"
style="color: #303133;" /> >
</u-cell-item> <text
<u-cell-item title="我的下属" @click="openPage('/pages/my/subordinate/index')" class="icon-ym icon-ym-zuzhi u-m-r-16 u-font-36"
:title-style="titleStyle"> slot="icon"
<text class="icon-ym icon-ym-generator-section u-m-r-16 u-font-36" slot="icon" style="color: #303133"
style="color: #303133;" /> />
</u-cell-item> </u-cell-item>
<!-- #ifndef H5 --> <u-cell-item
<u-cell-item title="扫一扫" @click="scanCode()" :title-style="titleStyle"> title=" 我的岗位"
<text class="icon-ym icon-ym-scanCode1 u-m-r-16 u-font-36" @click="openPage('/pages/my/business/index', 'Position')"
style="font-weight: bold;color: #303133;" slot="icon" /> :title-style="titleStyle"
</u-cell-item> >
<!-- #endif --> <text
<!-- #ifdef APP-PLUS --> class="icon-ym icon-ym-position1 u-m-r-16 u-font-36"
<u-cell-item title="账号安全" @click="openPage('/pages/my/accountSecurity/index')" slot="icon"
:title-style="titleStyle"> style="color: #303133"
<text class="icon-ym icon-ym-zhanghao u-m-r-16 u-font-36" slot="icon" style="color: #303133;" /> />
</u-cell-item> </u-cell-item>
<!-- #endif --> <u-cell-item
<u-cell-item title="设置" @click="openPage('/pages/my/settings/index')" :title-style="titleStyle" title="我的下属"
:border-bottom="false"> @click="openPage('/pages/my/subordinate/index')"
<text class="icon-ym icon-ym-shezhi u-m-r-16 u-font-36" slot="icon" style="color: #303133;" /> :title-style="titleStyle"
</u-cell-item> >
</u-cell-group> <text
</view> class="icon-ym icon-ym-generator-section u-m-r-16 u-font-36"
</view> slot="icon"
<view class="u-p-t-20"> style="color: #303133"
<view class="logout-cell" hover-class="u-cell-hover" @click="logout">退</view> />
</view> </u-cell-item>
</view> <!-- #ifndef H5 -->
<u-cell-item
title="扫一扫"
@click="scanCode()"
:title-style="titleStyle"
>
<text
class="icon-ym icon-ym-scanCode1 u-m-r-16 u-font-36"
style="font-weight: bold; color: #303133"
slot="icon"
/>
</u-cell-item>
<!-- #endif -->
<!-- #ifdef APP-PLUS -->
<u-cell-item
title="账号安全"
@click="openPage('/pages/my/accountSecurity/index')"
:title-style="titleStyle"
>
<text
class="icon-ym icon-ym-zhanghao u-m-r-16 u-font-36"
slot="icon"
style="color: #303133"
/>
</u-cell-item>
<!-- #endif -->
<u-cell-item
title="设置"
@click="openPage('/pages/my/settings/index')"
:title-style="titleStyle"
:border-bottom="false"
>
<text
class="icon-ym icon-ym-shezhi u-m-r-16 u-font-36"
slot="icon"
style="color: #303133"
/>
</u-cell-item>
</u-cell-group>
</view>
</view>
<view class="u-p-t-20">
<view class="logout-cell" hover-class="u-cell-hover" @click="logout"
>退出登录</view
>
</view>
</view>
</template> </template>
<script> <script>
import IndexMixin from './mixin.js' import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
import { import IndexMixin from "./mixin.js";
UpdateAvatar import { UpdateAvatar } from "@/api/common";
} from '@/api/common' import { UserSettingInfo } from "@/api/common";
import { export default {
UserSettingInfo mixins: [IndexMixin],
} from '@/api/common' data() {
export default { return {
mixins: [IndexMixin], titleStyle: {
data() { color: "#303133",
return { },
titleStyle: { avatarSrc: "",
color: '#303133' baseInfo: {},
}, loading: false,
avatarSrc: '', };
baseInfo: {}, },
loading: false computed: {
} baseURL() {
}, return this.define.comUploadUrl;
computed: { },
baseURL() { baseURL2() {
return this.define.comUploadUrl return this.define.baseURL;
}, },
baseURL2() { token() {
return this.define.baseURL return this.$store.getters.token;
}, },
token() { report() {
return this.$store.getters.token return this.define.report;
}, },
report() { },
return this.define.report onShow() {
} UserSettingInfo().then((res) => {
}, this.baseInfo = res.data || {};
onShow() { this.avatarSrc = this.baseURL2 + this.baseInfo.avatar;
UserSettingInfo().then(res => { this.loading = true;
this.baseInfo = res.data || {} });
this.avatarSrc = this.baseURL2 + this.baseInfo.avatar },
this.loading = true methods: {
}) chooseAvatar() {
}, uni.chooseImage({
methods: { count: 1,
chooseAvatar() { sizeType: ["original", "compressed"],
uni.chooseImage({ success: (res) => {
count: 1, let tempFilePaths = res.tempFilePaths[0];
sizeType: ['original', 'compressed'], uni.uploadFile({
success: (res) => { url: this.baseURL + "userAvatar",
let tempFilePaths = res.tempFilePaths[0] filePath: tempFilePaths,
uni.uploadFile({ name: "file",
url: this.baseURL + 'userAvatar', header: {
filePath: tempFilePaths, Authorization: this.token,
name: 'file', },
header: { success: (uploadFileRes) => {
'Authorization': this.token let data = JSON.parse(uploadFileRes.data);
}, UpdateAvatar(data.data.name).then((res) => {
success: (uploadFileRes) => { this.$u.toast("头像更换成功");
let data = JSON.parse(uploadFileRes.data) this.avatarSrc = this.baseURL2 + data.data.url;
UpdateAvatar(data.data.name).then(res => { });
this.$u.toast('头像更换成功') },
this.avatarSrc = this.baseURL2 + data.data.url fail: (err) => {
}) this.$u.toast("头像更换失败");
}, },
fail: (err) => { });
this.$u.toast('头像更换失败') },
} });
}); },
} openPage(path, type) {
}); if (!path) return;
}, let url = !!type ? path + "?majorType=" + type : path;
openPage(path, type) { uni.navigateTo({
if (!path) return url: url,
let url = !!type ? path + '?majorType=' + type : path });
uni.navigateTo({ },
url: url personalPage(path) {
}) if (!path) return;
}, uni.navigateTo({
personalPage(path) { url:
if (!path) return path +
uni.navigateTo({ "?baseInfo=" +
url: path + '?baseInfo=' + encodeURIComponent(JSON encodeURIComponent(JSON.stringify(this.baseInfo)),
.stringify(this.baseInfo)) });
}) },
}, isJSON(str) {
isJSON(str) { try {
try { var obj = JSON.parse(str);
var obj = JSON.parse(str); if (typeof obj == "object" && obj) {
if (typeof obj == 'object' && obj) { return true;
return true; } else {
} else { return false;
return false; }
} } catch (e) {
} catch (e) { return false;
return false; }
} },
}, logout() {
logout() { uni.showModal({
uni.showModal({ title: "提示",
title: '提示', content: "确定退出当前账号吗?",
content: '确定退出当前账号吗?', success: (res) => {
success: res => { if (res.confirm) {
if (res.confirm) { this.$store.dispatch("user/logout").then(() => {
this.$store.dispatch('user/logout').then(() => { uni.closeSocket();
uni.closeSocket() uni.reLaunch({
uni.reLaunch({ url: "/pages/login/index",
url: '/pages/login/index' });
}) });
}) }
} },
} });
}) },
}, scanCode() {
scanCode() { uni.scanCode({
uni.scanCode({ success: (res) => {
success: res => { if (this.isJSON(res.result.trim())) {
if (this.isJSON(res.result.trim())) { const result = JSON.parse(res.result.trim());
const result = JSON.parse(res.result.trim()) if (result.t === "ADP") {
if (result.t === 'ADP') { let config = {
let config = { isPreview: 1,
isPreview: 1, moduleId: result.id,
moduleId: result.id, previewType: result.previewType,
previewType: result.previewType };
} uni.navigateTo({
uni.navigateTo({ url:
url: '/pages/apply/dynamicModel/index?config=' + this.base64 "/pages/apply/dynamicModel/index?config=" +
.encode(JSON.stringify(config), "UTF-8"), this.base64.encode(JSON.stringify(config), "UTF-8"),
fail: (err) => { fail: (err) => {
this.$u.toast("暂无此页面") this.$u.toast("暂无此页面");
} },
}) });
} }
if (result.t === 'DFD') { if (result.t === "DFD") {
uni.navigateTo({ uni.navigateTo({
url: '/pages/apply/dynamicModel/scanForm?config=' + JSON.stringify( url:
result), "/pages/apply/dynamicModel/scanForm?config=" +
fail: (err) => { JSON.stringify(result),
this.$u.toast("暂无此页面") fail: (err) => {
} this.$u.toast("暂无此页面");
}) },
} });
if (result.t === 'WFP') { }
uni.navigateTo({ if (result.t === "WFP") {
url: '/pages/workFlow/scanForm/index?config=' + JSON.stringify( uni.navigateTo({
result), url:
fail: (err) => { "/pages/workFlow/scanForm/index?config=" +
this.$u.toast("暂无") JSON.stringify(result),
} fail: (err) => {
}) this.$u.toast("暂无");
} },
if (result.t === 'report') { });
let url = }
`${this.report}/preview.html?id=${result.id}&token=${this.token}&page=1&from=menu` if (result.t === "report") {
uni.navigateTo({ let url = `${this.report}/preview.html?id=${result.id}&token=${this.token}&page=1&from=menu`;
url: '/pages/apply/externalLink/index?url=' + uni.navigateTo({
encodeURIComponent( url:
url) + '&fullName= ' + result.fullName, "/pages/apply/externalLink/index?url=" +
fail: (err) => { encodeURIComponent(url) +
this.$u.toast("暂无") "&fullName= " +
} result.fullName,
}) fail: (err) => {
} this.$u.toast("暂无");
if (result.t === 'portal') { },
uni.navigateTo({ });
url: '/pages/index/scanProtal?id=' + result.id, }
fail: (err) => { if (result.t === "portal") {
this.$u.toast("暂无") uni.navigateTo({
} url: "/pages/index/scanProtal?id=" + result.id,
}) fail: (err) => {
} this.$u.toast("暂无");
} else { },
uni.navigateTo({ });
url: '/pages/my/scanResult/index?result=' + res.result, }
fail: (err) => { } else {
this.$u.toast("暂无此页面") uni.navigateTo({
} url: "/pages/my/scanResult/index?result=" + res.result,
}) fail: (err) => {
} this.$u.toast("暂无此页面");
} },
}); });
} }
} },
} });
},
},
};
</script> </script>
<style lang="scss"> <style lang="scss">
page { page {
background-color: #f0f2f6; background-color: #f0f2f6;
} }
.my-v { .my-v {
/deep/ .u-cell { /deep/ .u-cell {
height: 112rpx; height: 112rpx;
padding: 0; padding: 0;
} }
.user-box { .user-box {
background-color: #fff; background-color: #fff;
} }
.logout-cell { .logout-cell {
text-align: center; text-align: center;
font-size: 28rpx; font-size: 28rpx;
height: 112rpx; height: 112rpx;
background-color: #fff; background-color: #fff;
color: #d9001b; color: #d9001b;
line-height: 112rpx; line-height: 112rpx;
} }
.f-right { .f-right {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
text-align: center; text-align: center;
} }
} }
</style> </style>

@ -5,8 +5,50 @@
</template> </template>
<template v-else> <template v-else>
<CustomNavbar /> <CustomNavbar />
<view class="cont"> <u-row gutter="16">
</view> <u-col span="3">
<view :style="{ padding: '15px' }">
<u-avatar :src="userInfo.avatar" size="100"></u-avatar>
</view>
</u-col>
<u-col span="9">
<view>
<text>{{ userInfo.realName }}</text>
</view>
<view>
<text>{{ userInfo.account }}</text>
</view>
</u-col>
</u-row>
<u-row gutter="16">
<u-col span="12">
<view :style="{ padding: '20px 15px' }">
<image
class="icon"
src="/static/images/my-empty.png"
mode="aspectFit"
></image>
</view>
</u-col>
</u-row>
<u-row gutter="16">
<u-col span="12">
<view :style="{ padding: '15px' }">
<u-button
:custom-style="{ color: '#ffffff', backgroundColor: '#6F89DD' }"
shape="circle"
:plain="false"
@click="fnEditPwd('/pages/my/modifyPsd/index')"
>修改密码</u-button
>
</view>
</u-col>
<u-col span="12">
<view :style="{ padding: '15px' }">
<u-button shape="circle" @click="fnLoginOut">退</u-button>
</view>
</u-col>
</u-row>
</template> </template>
</view> </view>
</template> </template>
@ -14,45 +56,68 @@
<script> <script>
import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js"; import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import { getIMReply, relocation } from "@/api/message.js"; import { UserBaseInfo, logoutCurrentUser } from "@/api/yys/me.js";
import CustomNavbar from "./components/CustomNavbar"; import CustomNavbar from "./components/CustomNavbar";
export default { export default {
components: { components: {
CustomNavbar CustomNavbar,
}, },
mixins: [], mixins: [],
data() { data() {
return { return {
isLoading: false, isLoading: false,
categoryList: [ userInfo: {},
{
key: "product",
children: [
{
path: "productionReport",
name: "采购协同",
auth: true,
imgUrl: "/static/images/caigouxietong@1x.png",
defaultImgUrl: "/static/images/caigouxietong-wuquanxian@1x.png",
},
{
path: "assembleReport",
name: "报工确认",
auth: true,
imgUrl: "/static/images/baogongqueren@1x.png",
defaultImgUrl: "/static/images/baogongqueren-wuquanxian@1x.png",
},
],
},
],
}; };
}, },
watch: {}, watch: {},
computed: {}, computed: {
token() {
return this.$store.getters.token;
},
},
onLoad() { onLoad() {
console.log("onLoad");
this.fnUserBaseInfo();
}, },
onUnload() {}, onUnload() {},
methods: {}, methods: {
fnUserBaseInfo() {
UserBaseInfo()
.then((res) => {
if (res.code == 200) {
this.userInfo = { ...res.data };
}
})
.catch((err) => {
console.log(err);
});
},
fnLoginOut() {
uni.showModal({
title: "提示",
content: "确定退出当前账号吗?",
success: (res) => {
if (res.confirm) {
this.$store.dispatch("user/logout").then(() => {
uni.closeSocket();
uni.reLaunch({
url: "/pages/login/index",
});
});
console.log("用户点击确定");
} else if (res.cancel) {
console.log("用户点击取消");
}
},
});
},
fnEditPwd(path) {
if (!path) return;
uni.navigateTo({
url: path,
});
},
},
}; };
</script> </script>

@ -79,16 +79,16 @@
callback(new Error('新密码必须包含小写字母')); callback(new Error('新密码必须包含小写字母'));
} }
} }
if (this.baseForm.includeUppercaseLetters) { // if (this.baseForm.includeUppercaseLetters) {
if (!includeUppercaseLetters.test(value)) { // if (!includeUppercaseLetters.test(value)) {
callback(new Error('新密码必须包含大写字字母')); // callback(new Error(''));
} // }
} // }
if (this.baseForm.containsCharacters) { // if (this.baseForm.containsCharacters) {
if (!containsCharacters.test(value)) { // if (!containsCharacters.test(value)) {
callback(new Error('新密码必须包含字符')); // callback(new Error(''));
} // }
} // }
callback(); callback();
} else { } else {
callback(); callback();

Loading…
Cancel
Save