|
|
|
<template>
|
|
|
|
<div class="app-container" style="margin-top: 20px;">
|
|
|
|
<el-row :gutter="20">
|
|
|
|
<el-col :span="6" :xs="24">
|
|
|
|
<el-card class="box-card">
|
|
|
|
<div slot="header">
|
|
|
|
<span>个人信息</span>
|
|
|
|
</div>
|
|
|
|
<div style="height: 460px">
|
|
|
|
<div class="text-center">
|
|
|
|
<userAvatar :user="user" />
|
|
|
|
</div>
|
|
|
|
<ul class="list-group list-group-striped">
|
|
|
|
<li class="list-group-item">
|
|
|
|
<svg-icon class="icon" icon-class="user" />用户名称
|
|
|
|
<div class="pull-right">{{ user.userName }}</div>
|
|
|
|
</li>
|
|
|
|
<li class="list-group-item">
|
|
|
|
<svg-icon class="icon" icon-class="phone" />手机号码
|
|
|
|
<div class="pull-right">{{ user.phonenumber }}</div>
|
|
|
|
</li>
|
|
|
|
<li class="list-group-item">
|
|
|
|
<svg-icon class="icon" icon-class="email" />用户邮箱
|
|
|
|
<div class="pull-right">{{ user.email }}</div>
|
|
|
|
</li>
|
|
|
|
<li class="list-group-item">
|
|
|
|
<svg-icon class="icon" icon-class="tree" />所属部门
|
|
|
|
<div class="pull-right" v-if="user.dept">{{ user.dept.deptName }} / {{ postGroup }}</div>
|
|
|
|
</li>
|
|
|
|
<li class="list-group-item">
|
|
|
|
<svg-icon class="icon" icon-class="peoples" />所属角色
|
|
|
|
<div class="pull-right">{{ roleGroup }}</div>
|
|
|
|
</li>
|
|
|
|
<li class="list-group-item">
|
|
|
|
<svg-icon class="icon" icon-class="date" />创建日期
|
|
|
|
<div class="pull-right">{{ user.createTime }}</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</el-card>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="18" :xs="24" class="box-card2">
|
|
|
|
<el-card>
|
|
|
|
<div slot="header">
|
|
|
|
<span>基本资料</span>
|
|
|
|
</div>
|
|
|
|
<el-tabs v-model="activeTab">
|
|
|
|
<el-tab-pane label="基本资料" name="userinfo">
|
|
|
|
<userInfo :user="user" />
|
|
|
|
</el-tab-pane>
|
|
|
|
<el-tab-pane label="修改密码" name="resetPwd">
|
|
|
|
<resetPwd :user="user" />
|
|
|
|
</el-tab-pane>
|
|
|
|
</el-tabs>
|
|
|
|
</el-card>
|
|
|
|
|
|
|
|
<el-card style="margin-top: 20px">
|
|
|
|
<div slot="header">
|
|
|
|
<span>个性化设置</span>
|
|
|
|
</div>
|
|
|
|
<el-form ref="form" label-width="120px">
|
|
|
|
<el-row :gutter="20">
|
|
|
|
<el-col :span="4">
|
|
|
|
<el-form-item label="通知弹窗:">
|
|
|
|
<el-switch
|
|
|
|
v-model="isNotify"
|
|
|
|
style="margin-top: -5px;"
|
|
|
|
active-color="#0BD"
|
|
|
|
inactive-color="#999"
|
|
|
|
active-value="on"
|
|
|
|
inactive-value="off"
|
|
|
|
@change="changeNotify"
|
|
|
|
>
|
|
|
|
</el-switch>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="4">
|
|
|
|
<el-form-item label="通知语音播报:">
|
|
|
|
<el-switch
|
|
|
|
v-model="isSound"
|
|
|
|
style="margin-top: -5px;"
|
|
|
|
active-color="#0BD"
|
|
|
|
inactive-color="#999"
|
|
|
|
active-value="on"
|
|
|
|
inactive-value="off"
|
|
|
|
@change="changeSound"
|
|
|
|
>
|
|
|
|
</el-switch>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="4">
|
|
|
|
<Button :loading="loading" style="width:120px;margin-top: 5px;" @click.native="speak()"><i class="el-icon-headset"></i>语音测试</Button>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
|
|
</el-form>
|
|
|
|
</el-card>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import userAvatar from "./userAvatar";
|
|
|
|
import userInfo from "./userInfo";
|
|
|
|
import resetPwd from "./resetPwd";
|
|
|
|
import { getUserProfile } from "@/api/system/user";
|
|
|
|
import Cookies from 'js-cookie'
|
|
|
|
import Button from "@screen/components/Buttons/Button.vue";
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: "Profile",
|
|
|
|
components: { userAvatar, userInfo, resetPwd,Button },
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
user: {},
|
|
|
|
roleGroup: {},
|
|
|
|
postGroup: {},
|
|
|
|
activeTab: "userinfo",
|
|
|
|
|
|
|
|
isSound: 'on',
|
|
|
|
isNotify: 'on',
|
|
|
|
loading: false
|
|
|
|
};
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
this.getUser();
|
|
|
|
},
|
|
|
|
|
|
|
|
mounted(){
|
|
|
|
this.isSound = Cookies.get('warning-sound') || 'on';
|
|
|
|
this.isNotify = Cookies.get('warning-notify') || 'on';
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
speak(){
|
|
|
|
// 判断是否开启声音
|
|
|
|
if(Cookies.get('warning-sound') === 'off'){
|
|
|
|
this.$message.waning('请开启【通知语音播报】')
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
this.$message.success('正在播报')
|
|
|
|
this.loading=true;
|
|
|
|
setTimeout(() => {
|
|
|
|
this.loading = false
|
|
|
|
}, 6000);
|
|
|
|
const text = moment().format('YYYY-MM-DD HH:mm:ss')+' 济菏高速语音播报测试'
|
|
|
|
// 创建SpeechSynthesisUtterance实例
|
|
|
|
const utterance = new SpeechSynthesisUtterance(text);
|
|
|
|
|
|
|
|
// 设置语音的语言
|
|
|
|
utterance.lang = 'zh-CN'; // 中文简体
|
|
|
|
|
|
|
|
// 设置语音的音量(0到1之间)
|
|
|
|
utterance.volume = 10;
|
|
|
|
|
|
|
|
// 设置语音的语速(1是正常语速)
|
|
|
|
utterance.rate = 1;
|
|
|
|
|
|
|
|
// 设置语音的音调(可以是"default", "female", "male")
|
|
|
|
utterance.pitch = 1;
|
|
|
|
|
|
|
|
// 使用SpeechSynthesis接口播放语音
|
|
|
|
window.speechSynthesis.speak(utterance);
|
|
|
|
},
|
|
|
|
getUser() {
|
|
|
|
getUserProfile().then(response => {
|
|
|
|
this.user = response.data;
|
|
|
|
this.roleGroup = response.roleGroup;
|
|
|
|
this.postGroup = response.postGroup;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
changeSound(){
|
|
|
|
Cookies.set('warning-sound', this.isSound)
|
|
|
|
},
|
|
|
|
changeNotify(){
|
|
|
|
Cookies.set('warning-notify', this.isNotify)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
|
|
@import "@screen/skin/blue/basic.scss";
|
|
|
|
.list-group{
|
|
|
|
.list-group-item{
|
|
|
|
color: $textMain;
|
|
|
|
border-color: $lineC03;
|
|
|
|
.icon{
|
|
|
|
margin-right: 6px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|