Commit fc573372 authored by 黄奎's avatar 黄奎

页面修改

parent df16d6d1
...@@ -47,7 +47,7 @@ module.exports = function(ctx) { ...@@ -47,7 +47,7 @@ module.exports = function(ctx) {
vueRouterMode: 'history', // available values: 'hash', 'history' vueRouterMode: 'history', // available values: 'hash', 'history'
env: ctx.dev ? { env: ctx.dev ? {
API: 'http://localhost:5001/api', API: 'http://localhost:8300/api',
// API: 'http://192.168.10.128:8300/api', // API: 'http://192.168.10.128:8300/api',
// API: 'https://eduapi.oytour.com/api', // API: 'https://eduapi.oytour.com/api',
API_ZC: 'http://192.168.5.238:8087/api', API_ZC: 'http://192.168.5.238:8087/api',
......
...@@ -25,8 +25,8 @@ export function getFontConfig() { ...@@ -25,8 +25,8 @@ export function getFontConfig() {
export function CommonConfig() { export function CommonConfig() {
return { return {
FileConfig: { FileConfig: {
FileUrl: 'http://192.168.5.46:8130', //本地服务器文件预览地址 FileUrl: 'http://192.168.5.214:8130', //本地服务器文件预览地址
UploadUrl: 'http://192.168.5.46:8120' UploadUrl: 'http://192.168.5.214:8120'
} }
} }
} }
...@@ -296,7 +296,7 @@ export function UploadFileToALi(uploadConfig, fileFullPath, fileObj, uploadLoadd ...@@ -296,7 +296,7 @@ export function UploadFileToALi(uploadConfig, fileFullPath, fileObj, uploadLoadd
if (locationName.indexOf('localhost') !== -1) { if (locationName.indexOf('localhost') !== -1) {
uploadConfig.UploadDomain = fileConfig.FileConfig.UploadUrl; uploadConfig.UploadDomain = fileConfig.FileConfig.UploadUrl;
} }
let url = uploadConfig.UploadDomain + "/Upload/UploadToALiOSS?filePath=" + newFileName; let url = uploadConfig.UploadDomain + "/Upload/UploadToALiOSS?isDomain=1&filePath=" + newFileName;
let formData = new FormData() let formData = new FormData()
formData.append('myfile', fileObj) formData.append('myfile', fileObj)
let xhr = new XMLHttpRequest() let xhr = new XMLHttpRequest()
...@@ -332,7 +332,7 @@ export function UploadFileToTencent(uploadConfig, fileFullPath, fileObj, uploadL ...@@ -332,7 +332,7 @@ export function UploadFileToTencent(uploadConfig, fileFullPath, fileObj, uploadL
if (locationName.indexOf('localhost') !== -1) { if (locationName.indexOf('localhost') !== -1) {
uploadConfig.UploadDomain = fileConfig.FileConfig.UploadUrl; uploadConfig.UploadDomain = fileConfig.FileConfig.UploadUrl;
} }
let url = uploadConfig.UploadDomain + "/Upload/UploadToTecent?filePath=" + newFileName; let url = uploadConfig.UploadDomain + "/Upload/UploadToTecent?isDomain=1&filePath=" + newFileName;
let formData = new FormData() let formData = new FormData()
formData.append('myfile', fileObj) formData.append('myfile', fileObj)
let xhr = new XMLHttpRequest() let xhr = new XMLHttpRequest()
......
<style> <style>
.personalData { .personalData {
justify-content: space-between; justify-content: space-between;
} }
.personalData .box_l, .personalData .box_l,
.box_r { .box_r {
background: #fff; background: #fff;
border-radius: 6px; border-radius: 6px;
} }
.personalData .box_l { .personalData .box_l {
width: 380px; width: 380px;
margin-right: 30px; margin-right: 30px;
padding: 40px; padding: 40px;
} }
.personalData .box_r { .personalData .box_r {
flex: 1; flex: 1;
width: 1px; width: 1px;
padding: 20px 26px; padding: 20px 26px;
} }
.personalData .box_r2{
flex: 1; .personalData .box_r2 {
width: 1px; flex: 1;
padding: 0px 0px; width: 1px;
padding: 0px 0px;
}
}
.personalData .box_l_t {
margin-top: 28px; .personalData .box_l_t {
font-size: 14px; margin-top: 28px;
color: #999999; font-size: 14px;
} color: #999999;
}
.personalData .box_l_t_l {
color: #3F4254; .personalData .box_l_t_l {
font-weight: bold; color: #3F4254;
} font-weight: bold;
}
.personalData .box_l_title {
width: 100%; .personalData .box_l_title {
height: 50px; width: 100%;
line-height: 50px; height: 50px;
background: #2961FE; line-height: 50px;
border-radius: 4px; background: #2961FE;
font-size: 16px; border-radius: 4px;
font-weight: bold; font-size: 16px;
color: #FFFFFF; font-weight: bold;
padding-left: 39px; color: #FFFFFF;
/* margin-top: 55px; */ padding-left: 39px;
margin-top: 8px; /* margin-top: 55px; */
cursor: pointer; margin-top: 8px;
} cursor: pointer;
}
.personalData .box_l_cen {
width: 100%; .personalData .box_l_cen {
height: 50px; width: 100%;
line-height: 50px; height: 50px;
border-radius: 4px; line-height: 50px;
font-size: 16px; border-radius: 4px;
font-weight: bold; font-size: 16px;
color: #3F4254; font-weight: bold;
padding-left: 39px; color: #3F4254;
margin-top: 8px; padding-left: 39px;
cursor: pointer; margin-top: 8px;
justify-content: space-between; cursor: pointer;
} justify-content: space-between;
}
.personalData .headportrait {
width: 120px; .personalData .headportrait {
height: 120px; width: 120px;
border-radius: 20px; height: 120px;
position: relative; border-radius: 20px;
margin-top: 20px; position: relative;
} margin-top: 20px;
}
.personalData .editbianji {
position: absolute; .personalData .editbianji {
right: -10px; position: absolute;
top: -10px; right: -10px;
width: 26px; top: -10px;
height: 26px; width: 26px;
background: #FFFFFF; height: 26px;
border-radius: 50%; background: #FFFFFF;
display: flex; border-radius: 50%;
align-items: center; display: flex;
justify-content: center; align-items: center;
box-shadow: 0px 0px 10px 0px rgba(2, 44, 66, 0.15); justify-content: center;
} box-shadow: 0px 0px 10px 0px rgba(2, 44, 66, 0.15);
}
.personalData .box_r_title {
font-size: 12px; .personalData .box_r_title {
font-weight: bold; font-size: 12px;
color: #000000; font-weight: bold;
margin-top: 27px color: #000000;
} margin-top: 27px
}
.personalData .box_r_input {
width: 55%; .personalData .box_r_input {
width: 55%;
margin-top: 20px;
} margin-top: 20px;
}
</style> </style>
<template> <template>
<div class="page-body personalData row" style="background: transparent;"> <div class="page-body personalData row" style="background: transparent;">
<div class="box_l"> <div class="box_l">
<div class="q-mt-lg flex"> <div class="q-mt-lg flex">
<q-avatar size="100px" font-size="36px" rounded style="background:#C9F7F5" text-color="white"> <q-avatar size="100px" font-size="36px" rounded style="background:#C9F7F5" text-color="white">
<img :src="showObj.UserIcon" v-if="showObj.UserIcon"> <img :src="showObj.UserIcon" v-if="showObj.UserIcon">
<span v-else>{{showObj.AccountName.substring(0,1)}}</span> <span v-else>{{showObj.AccountName.substring(0,1)}}</span>
</q-avatar> </q-avatar>
<div class="col q-ml-md"> <div class="col q-ml-md">
<div class="text-weight-bold" style="font-size:18px;font-weight: 800;color: #3F4254;"> <div class="text-weight-bold" style="font-size:18px;font-weight: 800;color: #3F4254;">
{{showObj.AccountName}}</div> {{showObj.AccountName}}</div>
<div class="text-muted" style="font-size:14px;margin-top: 12px;"> <div class="text-muted" style="font-size:14px;margin-top: 12px;">
{{showObj.SchoolName}}·{{showObj.PostName}}</div> {{showObj.SchoolName}}·{{showObj.PostName}}</div>
<div class="q-mt-xs"> <div class="q-mt-xs">
<q-btn style="background: var(--q-color-negative);color: white;margin-top: 10px;" size="sm" @click="logout">退出登录</q-btn> <q-btn style="background: var(--q-color-negative);color: white;margin-top: 10px;" size="sm" @click="logout">
</div> 退出登录</q-btn>
</div> </div>
</div> </div>
<div class="box_l_t" style="margin-top: 40px;"> </div>
<span class="box_l_t_l">邮箱:</span> <div class="box_l_t" style="margin-top: 40px;">
<span>{{showObj.Email}}</span> <span class="box_l_t_l">邮箱:</span>
</div> <span>{{showObj.Email}}</span>
<div class="box_l_t"> </div>
<span class="box_l_t_l">电话:</span> <div class="box_l_t">
<span>{{showObj.UserMobile}}</span> <span class="box_l_t_l">电话:</span>
</div> <span>{{showObj.UserMobile}}</span>
<div class="box_l_t" style="margin-bottom: 55px;"> </div>
<span class="box_l_t_l">部门:</span> <div class="box_l_t" style="margin-bottom: 55px;">
<span>{{showObj.DeptName}}</span> <span class="box_l_t_l">部门:</span>
</div> <span>{{showObj.DeptName}}</span>
<div :class="rightType==0?'box_l_title':'box_l_cen'" @click='rightType=0'>概要信息</div> </div>
<!-- <div :class="rightType==3?'box_l_title':'box_l_cen'" @click='rightType=3'>预警信息</div> --> <div :class="rightType==0?'box_l_title':'box_l_cen'" @click='rightType=0'>概要信息</div>
<div :class="rightType==1?'box_l_title':'box_l_cen'" @click='rightType=1'>账户资料</div> <!-- <div :class="rightType==3?'box_l_title':'box_l_cen'" @click='rightType=3'>预警信息</div> -->
<div :class="rightType==2?'box_l_title':'box_l_cen'" @click='rightType=2'>密码修改</div> <div :class="rightType==1?'box_l_title':'box_l_cen'" @click='rightType=1'>账户资料</div>
<div :class="rightType==2?'box_l_title':'box_l_cen'" @click='rightType=2'>密码修改</div>
</div>
<!-- 个人资料 -->
<div v-if='rightType == 0' class="box_r2">
<summaryInfo></summaryInfo>
</div>
<div class="box_r" v-if='rightType !=0'>
<template v-if='rightType == 1'>
<div style="font-size: 16px;font-weight: bold;color: #000000;">账户资料</div>
<div class="box_r_title">账户资料</div>
<div class="headportrait">
<q-avatar size="120px" font-size="36px" rounded style="background:#C9F7F5" text-color="white">
<img :src="datamodify.UserIcon" v-if="datamodify.UserIcon">
<span v-else>{{showObj.AccountName.substring(0,1)}}</span>
</q-avatar>
<el-upload class="editbianji" :http-request="uploadFileBtn" :multiple="false" action=''
accept=".JPG, .PNG, .JPEG,.jpg, .png, .jpeg" :show-file-list="false">
<q-icon name="edit" />
</el-upload>
</div>
<div style="font-size: 12px;color: #999999;margin-top: 12px;">图片格式:png、jpg、jpeg</div>
<div class="box_r_title">基础资料</div>
<div class="box_r_input">
<q-input v-model="datamodify.EmployeeName" label="姓名" :rules="[val => !!val || '姓名不能为空']" lazy-rules filled
maxlength="20" />
</div>
<div class="box_r_input">
<q-select filled stack-label option-value="SId" option-label="SName" v-model="datamodify.School_Id" ref="SId"
:options="CompanyList" label="校区" :dense="false" emit-value map-options />
</div> </div>
<!-- 个人资料 --> <div class="box_r_title">联系方式</div>
<div v-if='rightType == 0' class="box_r2"> <div class="box_r_input">
<summaryInfo></summaryInfo> <q-input v-model="datamodify.EmployeeTel" label="电话" type='number' :rules="[val => !!val || '电话不能为空']"
lazy-rules filled maxlength="11" />
</div> </div>
<div class="box_r" v-if='rightType !=0'> <div class="box_r_input">
<template v-if='rightType == 1'> <q-input v-model="datamodify.Email" label="邮箱" :rules="[val => !!val || '邮箱不能为空']" lazy-rules filled
<div style="font-size: 16px;font-weight: bold;color: #000000;">账户资料</div> maxlength="20" />
<div class="box_r_title">账户资料</div>
<div class="headportrait">
<q-avatar size="120px" font-size="36px" rounded style="background:#C9F7F5" text-color="white">
<img :src="datamodify.UserIcon" v-if="datamodify.UserIcon">
<span v-else>{{showObj.AccountName.substring(0,1)}}</span>
</q-avatar>
<el-upload class="editbianji" :http-request="uploadFileBtn" :multiple="false" action=''
accept=".JPG, .PNG, .JPEG,.jpg, .png, .jpeg" :show-file-list="false">
<q-icon name="edit" />
</el-upload>
</div>
<div style="font-size: 12px;color: #999999;margin-top: 12px;">图片格式:png、jpg、jpeg</div>
<div class="box_r_title">基础资料</div>
<div class="box_r_input">
<q-input v-model="datamodify.EmployeeName" label="姓名"
:rules="[val => !!val || '姓名不能为空']" lazy-rules filled maxlength="20" />
</div>
<div class="box_r_input">
<q-select filled stack-label option-value="SId" option-label="SName" v-model="datamodify.School_Id"
ref="SId" :options="CompanyList" label="校区" :dense="false" emit-value map-options />
</div>
<div class="box_r_title">联系方式</div>
<div class="box_r_input">
<q-input v-model="datamodify.EmployeeTel" label="电话" type='number'
:rules="[val => !!val || '电话不能为空']" lazy-rules filled maxlength="11" />
</div>
<div class="box_r_input">
<q-input v-model="datamodify.Email" label="邮箱"
:rules="[val => !!val || '邮箱不能为空']" lazy-rules filled maxlength="20" />
</div>
<q-btn color="primary" style="width: 300px;margin-top: 50px;" :loading="loading1" @click='dataSubmit'>
<div class="ellipsis">
提交
</div>
</q-btn>
</template>
<template v-if='rightType == 2'>
<div style="font-size: 16px;font-weight: bold;color: #000000;">密码修改</div>
<form @submit.prevent.stop="passwordSubmit" class="q-gutter-md">
<div class="box_r_title">原密码</div>
<div class="box_r_input">
<q-input v-model="passwordMsg.OldPassWord" label="请输入旧密码" type='password' ref='OldPassWord'
:rules="[val => !!val || '请输入旧密码']" lazy-rules filled />
</div>
<div class="box_r_title">新密码</div>
<div class="box_r_input">
<q-input v-model="passwordMsg.NewPassWord" label="请输入新密码" type='password' ref='NewPassWord'
:rules="[val => !!val || '请输入新密码']" lazy-rules filled />
</div>
<div class="box_r_input">
<q-input v-model="passwordMsg.NewSurePassWord" label="请再次输入新密码" type='password' ref='NewSurePassWord'
:rules="[val => !!val || '请再次输入新密码']" lazy-rules filled />
</div>
<q-btn color="primary" style="width: 300px;margin-top: 50px;" :loading="loading2" label="确定修改" type="submit" > </q-btn>
</form>
</template>
</div> </div>
<q-btn color="primary" style="width: 300px;margin-top: 50px;" :loading="loading1" @click='dataSubmit'>
<div class="ellipsis">
提交
</div>
</q-btn>
</template>
<template v-if='rightType == 2'>
<div style="font-size: 16px;font-weight: bold;color: #000000;">密码修改</div>
<form @submit.prevent.stop="passwordSubmit" class="q-gutter-md">
<div class="box_r_title">原密码</div>
<div class="box_r_input">
<q-input v-model="passwordMsg.OldPassWord" label="请输入旧密码" type='password' ref='OldPassWord'
:rules="[val => !!val || '请输入旧密码']" lazy-rules filled />
</div>
<div class="box_r_title">新密码</div>
<div class="box_r_input">
<q-input v-model="passwordMsg.NewPassWord" label="请输入新密码" type='password' ref='NewPassWord'
:rules="[val => !!val || '请输入新密码']" lazy-rules filled />
</div>
<div class="box_r_input">
<q-input v-model="passwordMsg.NewSurePassWord" label="请再次输入新密码" type='password' ref='NewSurePassWord'
:rules="[val => !!val || '请再次输入新密码']" lazy-rules filled />
</div>
<q-btn color="primary" style="width: 300px;margin-top: 50px;" :loading="loading2" label="确定修改" type="submit">
</q-btn>
</form>
</template>
</div> </div>
</div>
</template> </template>
<script> <script>
import { import {
setEmployeeBaseInfo, setEmployeeBaseInfo,
updateUserPassword updateUserPassword
} from '../../api/users/user' } from '../../api/users/user'
import { import {
getSchoolDropdown, getSchoolDropdown,
} from '../../api/school/index' } from '../../api/school/index'
import { import {
UploadSelfFile UploadSelfFile
} from '../../api/common/common' } from '../../api/common/common'
const defaultpassword = { const defaultpassword = {
OldPassWord:'', OldPassWord: '',
NewPassWord:'', NewPassWord: '',
NewSurePassWord:'', NewSurePassWord: '',
} }
import summaryInfo from '../../components/user/summaryInfo' import summaryInfo from '../../components/user/summaryInfo'
import Lockr from 'lockr' import Lockr from 'lockr'
export default { export default {
meta: { meta: {
title: "个人资料" title: "个人资料"
}, },
components: { components: {
summaryInfo summaryInfo
}, },
data() { data() {
return { return {
loading1: false, loading1: false,
loading2:false, loading2: false,
showObj: {}, showObj: {},
rightType: 0,//右边显示类型 rightType: 0, //右边显示类型
datamodify: {}, datamodify: {},
CompanyList: [], CompanyList: [],
passwordMsg:Object.assign({},defaultpassword), passwordMsg: Object.assign({}, defaultpassword),
} }
}, },
created() { created() {
this.showObj = this.getLocalStorage(); this.showObj = this.getLocalStorage();
this.datamodify = { this.datamodify = {
EmployeeName: this.showObj.AccountName, EmployeeName: this.showObj.AccountName,
UserIcon: this.showObj.UserIcon, UserIcon: this.showObj.UserIcon,
EmployeeTel: this.showObj.UserMobile, EmployeeTel: this.showObj.UserMobile,
Email: this.showObj.Email, Email: this.showObj.Email,
School_Id: this.showObj.School_Id, School_Id: this.showObj.School_Id,
}
},
mounted() {
this.getBranchList()
},
methods: {
getBranchList() { //获取校区
getSchoolDropdown({}).then(res => {
this.CompanyList = res.Data;
}).catch(() => {
})
},
uploadFileBtn(file) { //上传
//UploadFileToTencent
//UploadSelfFile
this.UploadFileToTencent('studentIcon', file.file, x => {
if (x.Code == 1) {
this.datamodify.UserIcon = x.FileUrl
}
}, 1);
},
logout() { //退出登录
this.$store
.dispatch('LogOut')
.then(() => {
this.$router.push('/login')
})
.catch((e) => {
})
},
dataSubmit() { //资料提交
if (this.datamodify.UserIcon == null || this.datamodify.UserIcon == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `照片不能为空`
})
return
}
if (this.datamodify.EmployeeName == null || this.datamodify.EmployeeName == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `姓名不能为空`
})
return
}
if (this.datamodify.EmployeeTel == null || this.datamodify.EmployeeTel == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `电话不能为空`
})
return
}
if (this.datamodify.Email == null || this.datamodify.Email == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `邮箱不能为空`
})
return
}
setEmployeeBaseInfo(this.datamodify).then(res => {
if (res.Code == 1) {
this.$q.notify({
type: 'iconfont icon-chenggong',
color: 'accent',
position: "top",
message: res.Message
})
this.showObj.AccountName = this.datamodify.EmployeeName
this.showObj.UserIcon = this.datamodify.UserIcon
this.showObj.UserMobile = this.datamodify.EmployeeTel
this.showObj.Email = this.datamodify.Email
this.showObj.School_Id = this.datamodify.School_Id
this.CompanyList.map(x => {
if (x.SId == this.datamodify.School_Id) {
this.showObj.SchoolName = x.SName;
return
}
})
Lockr.set("loginUserInfo", this.showObj)
this.$store.dispatch("setUserUpdate", this.showObj)
// location.reload()
// this.$router.push({
// path: this.redirect || '/home'
// })
// let obj = JSON.parse(JSON.stringify(this.datamodify))
// obj.SchoolName = this.showObj.SchoolName
// setTimeout(() => {
// this.MsgBus.$emit('add',obj);
// }, 10);
}
}).catch(() => {
})
},
passwordSubmit() {
this.$refs.OldPassWord.validate()
this.$refs.NewPassWord.validate()
this.$refs.NewSurePassWord.validate()
if (this.$refs.OldPassWord.hasError || this.$refs.NewPassWord.hasError || this.$refs.NewSurePassWord.hasError) {
this.formHasError = true
} else {
// 掉接口
updateUserPassword(this.passwordMsg).then(res => {
if (res.Code == 1) {
this.$q.notify({
type: 'iconfont icon-chenggong',
color: 'accent',
position: "top",
message: res.Message
})
// this.passwordMsg = Object.assign({},defaultpassword)
this.$q.dialog({
title: '功能提示',
message: '密码修改需重新登录',
persistent: true
}).onOk(() => {
this.$store
.dispatch('LogOut')
.then(() => {
this.$router.push('/login')
})
.catch((e) => {
})
});
} }
}, }).catch(() => {
mounted() {
this.getBranchList() })
}, }
methods: { },
getBranchList() {//获取校区
getSchoolDropdown({}).then(res => {
this.CompanyList = res.Data;
}).catch(() => {
},
})
}, }
uploadFileBtn(file) { //上传
UploadSelfFile('studentIcon', file.file, x => {
if (x.Code == 1) {
this.datamodify.UserIcon = x.FileUrl
}
}, 1);
},
logout() {//退出登录
this.$store
.dispatch('LogOut')
.then(() => {
this.$router.push('/login')
})
.catch((e) => {
})
},
dataSubmit() {//资料提交
if (this.datamodify.UserIcon == null || this.datamodify.UserIcon == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `照片不能为空`
})
return
}
if (this.datamodify.EmployeeName == null || this.datamodify.EmployeeName == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `姓名不能为空`
})
return
}
if (this.datamodify.EmployeeTel == null || this.datamodify.EmployeeTel == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `电话不能为空`
})
return
}
if (this.datamodify.Email == null || this.datamodify.Email == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `邮箱不能为空`
})
return
}
setEmployeeBaseInfo(this.datamodify).then(res => {
if (res.Code == 1) {
this.$q.notify({
type: 'iconfont icon-chenggong',
color: 'accent',
position: "top",
message: res.Message
})
this.showObj.AccountName = this.datamodify.EmployeeName
this.showObj.UserIcon = this.datamodify.UserIcon
this.showObj.UserMobile = this.datamodify.EmployeeTel
this.showObj.Email = this.datamodify.Email
this.showObj.School_Id = this.datamodify.School_Id
this.CompanyList.map(x=>{
if(x.SId == this.datamodify.School_Id){
this.showObj.SchoolName = x.SName;
return
}
})
Lockr.set("loginUserInfo",this.showObj)
this.$store.dispatch("setUserUpdate",this.showObj)
// location.reload()
// this.$router.push({
// path: this.redirect || '/home'
// })
// let obj = JSON.parse(JSON.stringify(this.datamodify))
// obj.SchoolName = this.showObj.SchoolName
// setTimeout(() => {
// this.MsgBus.$emit('add',obj);
// }, 10);
}
}).catch(() => {
})
},
passwordSubmit () {
this.$refs.OldPassWord.validate()
this.$refs.NewPassWord.validate()
this.$refs.NewSurePassWord.validate()
if (this.$refs.OldPassWord.hasError || this.$refs.NewPassWord.hasError|| this.$refs.NewSurePassWord.hasError) {
this.formHasError = true
}
else {
// 掉接口
updateUserPassword(this.passwordMsg).then(res => {
if (res.Code == 1) {
this.$q.notify({
type: 'iconfont icon-chenggong',
color: 'accent',
position: "top",
message: res.Message
})
// this.passwordMsg = Object.assign({},defaultpassword)
this.$q.dialog({
title: '功能提示',
message: '密码修改需重新登录',
persistent: true
}).onOk(() => {
this.$store
.dispatch('LogOut')
.then(() => {
this.$router.push('/login')
})
.catch((e) => {
})
});
}
}).catch(() => {
})
}
},
},
}
</script> </script>
<style lang="sass"> <style lang="sass">
@import url('~assets/css/table.sass') @import url('~assets/css/table.sass')
</style>
\ No newline at end of file </style>
...@@ -11,12 +11,12 @@ export default { ...@@ -11,12 +11,12 @@ export default {
Vue.prototype.MsgBus = MsgBus; Vue.prototype.MsgBus = MsgBus;
//消息成功提示 //消息成功提示
Vue.prototype.Success = function (msg) { Vue.prototype.Success = function (msg) {
this.$message({ this.$message({
message: msg, message: msg,
duration: 2000, duration: 2000,
type: "success" type: "success"
}); });
}, },
//错误提示 //错误提示
Vue.prototype.Error = function (msg) { Vue.prototype.Error = function (msg) {
this.$message({ this.$message({
...@@ -45,10 +45,10 @@ export default { ...@@ -45,10 +45,10 @@ export default {
//Confirm //Confirm
Vue.prototype.Confirm = function (msg, callback) { Vue.prototype.Confirm = function (msg, callback) {
this.$confirm(msg, "提示", { this.$confirm(msg, "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning"
}) })
.then(() => { .then(() => {
if (typeof callback === 'function') { if (typeof callback === 'function') {
callback(); callback();
...@@ -71,21 +71,21 @@ export default { ...@@ -71,21 +71,21 @@ export default {
Vue.prototype.md5 = md5; Vue.prototype.md5 = md5;
//ERP本地缓存 //ERP本地缓存
Vue.prototype.getLocalStorage = function () { Vue.prototype.getLocalStorage = function () {
var localStorageData = window.localStorage["loginUserInfo"]; var localStorageData = window.localStorage["loginUserInfo"];
if (localStorageData !== undefined && localStorageData != 'undefined') { if (localStorageData !== undefined && localStorageData != 'undefined') {
return JSON.parse(localStorageData).data; return JSON.parse(localStorageData).data;
} else { } else {
return null; return null;
} }
}, },
//域名管理对象 //域名管理对象
Vue.prototype.domainManager = function () { Vue.prototype.domainManager = function () {
//let domainUrl = 'http://192.168.10.214'; //let domainUrl = 'http://192.168.10.214';
let domainUrl = 'http://192.168.5.34'; let domainUrl = 'http://192.168.5.34';
let viewFileUrl = 'http://192.168.5.214:8120'; let viewFileUrl = 'http://192.168.5.214:8120';
let mallUrl = "http://192.168.5.2:8088"; let mallUrl = "http://192.168.5.2:8088";
let vtUploadUrl = "http://upload.oytour.com"; let vtUploadUrl = "http://upload.oytour.com";
let vtViewUrl = "http://192.168.5.214:8130"; let vtViewUrl = "http://192.168.5.214:8130";
let locationName = window.location.hostname; let locationName = window.location.hostname;
...@@ -160,7 +160,7 @@ export default { ...@@ -160,7 +160,7 @@ export default {
document.body.appendChild(link); document.body.appendChild(link);
link.click(); link.click();
successCall(res); successCall(res);
}).catch(function (res) { }); }).catch(function (res) {});
}, },
//HTTP提交数据 //HTTP提交数据
...@@ -201,11 +201,11 @@ export default { ...@@ -201,11 +201,11 @@ export default {
"uName": uName //用户名称 "uName": uName //用户名称
} }
this.$http.post(apiurl, postData, { this.$http.post(apiurl, postData, {
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'Referer-Viitto': this.$route.path 'Referer-Viitto': this.$route.path
} }
}) })
.then(res => { .then(res => {
if (res.data.resultCode == 10000 || res.data.resultCode == 10001) { if (res.data.resultCode == 10000 || res.data.resultCode == 10001) {
this.$router.push({ this.$router.push({
...@@ -266,13 +266,13 @@ export default { ...@@ -266,13 +266,13 @@ export default {
var apiurl = this.domainManager().mallUrl + cmd; var apiurl = this.domainManager().mallUrl + cmd;
var postData = this.GetPostDataDS(cmd, msg, ""); var postData = this.GetPostDataDS(cmd, msg, "");
this.$http.post(apiurl, postData, { this.$http.post(apiurl, postData, {
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'Referer-Viitto': this.$route.path 'Referer-Viitto': this.$route.path
} }
}) })
.then(res => { .then(res => {
if (res.data.resultCode == 10000 || res.data.resultCode == 10001) { } else if (res.resultCode == 10005) { if (res.data.resultCode == 10000 || res.data.resultCode == 10001) {} else if (res.resultCode == 10005) {
this.$router.go(-1); this.$router.go(-1);
} else { } else {
successCall(res); successCall(res);
...@@ -281,23 +281,23 @@ export default { ...@@ -281,23 +281,23 @@ export default {
} }
//电商文件下载 //电商文件下载
Vue.prototype.GetLocalFileDS = function (cmd, msg, fileName, newCmd, successCall) { Vue.prototype.GetLocalFileDS = function (cmd, msg, fileName, newCmd, successCall) {
var apiurl = this.domainManager().mallUrl + cmd; var apiurl = this.domainManager().mallUrl + cmd;
var postData = this.GetPostDataDS(cmd, msg, newCmd); var postData = this.GetPostDataDS(cmd, msg, newCmd);
this.$http.post(apiurl, postData, { this.$http.post(apiurl, postData, {
responseType: 'arraybuffer' responseType: 'arraybuffer'
}).then((res) => { }).then((res) => {
let blob = new Blob([res.data], { let blob = new Blob([res.data], {
type: "application/vnd.ms-excel" type: "application/vnd.ms-excel"
}) })
let url = URL.createObjectURL(blob); let url = URL.createObjectURL(blob);
let link = document.createElement('a'); let link = document.createElement('a');
link.href = url; link.href = url;
link.setAttribute("download", fileName); link.setAttribute("download", fileName);
document.body.appendChild(link); document.body.appendChild(link);
link.click(); link.click();
successCall(res); successCall(res);
}).catch(function (res) { }); }).catch(function (res) {});
}, },
//价钱格式化,三位数逗号分隔,保留两位小数 duanjun //价钱格式化,三位数逗号分隔,保留两位小数 duanjun
Vue.prototype.moneyFormat = function (value) { Vue.prototype.moneyFormat = function (value) {
let nStr = Number(value).toFixed(2) let nStr = Number(value).toFixed(2)
...@@ -433,63 +433,71 @@ export default { ...@@ -433,63 +433,71 @@ export default {
}, },
//上传文件到云存储 //上传文件到云存储
Vue.prototype.UploadFileToTencent = function (path, fileObj, callback) { Vue.prototype.UploadFileToTencent = function (path, fileObj, callback) {
var upInfo = JSON.parse(localStorage.uploadInfo); var localCache = this.getLocalStorage();
let maxSize = 500 * 1024 if (localCache && localCache.UploadConfig) {
if ((fileObj.type == "image/png" || fileObj.type == "image/jpeg") && fileObj.size > maxSize) {
let that = this let maxSize = 500 * 1024
lrz(fileObj, { if ((fileObj.type == "image/png" || fileObj.type == "image/jpeg") && fileObj.size > maxSize) {
width: 750, let that = this
quality: 0.8 lrz(fileObj, {
}) width: 750,
.then(function (rst) { quality: 0.8
//成功时执行 })
var arr = rst.base64.split(','); .then(function (rst) {
var mime = arr[0].match(/:(.*?);/)[1]; //成功时执行
var bstr = atob(arr[1]); var arr = rst.base64.split(',');
var n = bstr.length; var mime = arr[0].match(/:(.*?);/)[1];
var u8arr = new Uint8Array(n); var bstr = atob(arr[1]);
while (n--) { var n = bstr.length;
u8arr[n] = bstr.charCodeAt(n); var u8arr = new Uint8Array(n);
} while (n--) {
var newFile = new File([u8arr], fileObj.name, { u8arr[n] = bstr.charCodeAt(n);
type: mime
});
let str = '';
str = "/2024/"
var newFileName = str + path;
let url = upInfo.UploadDomain + "/Upload/UploadToTecent?filePath=" + newFileName;
let formData = new FormData()
formData.append('myfile', newFile)
let xhr = new XMLHttpRequest()
xhr.onload = function () {
uploadLoadding.hide();
var jsonObj = JSON.parse(xhr.responseText);
if (jsonObj.StatusCode === 1 && callback) {
var uploadResult = {
resultCode: 1,
FileName: fileObj.name,
FileUrl: jsonObj.FilePath,
}
if (callback) {
callback(uploadResult);
}
} }
} var newFile = new File([u8arr], fileObj.name, {
xhr.open('post', url, true) type: mime
xhr.send(formData) });
}).catch(function (error) { this.RealFileToTencent(path,newFile,callback)
}).catch(function (error) {
}).always(function () {
//不管成功或失败,都会执行 }).always(function () {
}) //不管成功或失败,都会执行
} else { })
} else {
this.RealFileToTencent(path,fileObj,callback)
}
} }
}, },
//真实上传文件方法
//公用判断图片地址 判断是否包含http Vue.prototype.RealFileToTencent = function (path, fileObj, callback) {
Vue.prototype.getIconLink = function (url) { let str = '';
str = "/2024/"
var newFileName = str + path;
var upInfo = this.getLocalStorage().UploadConfig;
var u_url = upInfo.UploadDomain;
//u_url = "http://192.168.5.46:8120"
let url = u_url + "/Upload/UploadToTecent?isDomain=1&filePath=" + newFileName;
let formData = new FormData()
formData.append('myfile', fileObj)
let xhr = new XMLHttpRequest()
xhr.onload = function () {
var jsonObj = JSON.parse(xhr.responseText);
if (jsonObj.StatusCode === 1 && callback) {
var uploadResult = {
Code:1,
FileName: fileObj.name,
FileUrl: jsonObj.FilePath,
}
if (callback) {
callback(uploadResult);
}
}
}
xhr.open('post', url, true)
xhr.send(formData)
}
//公用判断图片地址 判断是否包含http
Vue.prototype.getIconLink = function (url) {
let str = '' let str = ''
if (url && url != '') { if (url && url != '') {
if (url.indexOf('http') != -1) { if (url.indexOf('http') != -1) {
...@@ -504,7 +512,7 @@ export default { ...@@ -504,7 +512,7 @@ export default {
Vue.prototype.isOnline = function () { Vue.prototype.isOnline = function () {
return process.env.NODE_ENV !== 'development'; return process.env.NODE_ENV !== 'development';
}, },
Vue.prototype.getAnyFileBlob = function (url) { Vue.prototype.getAnyFileBlob = function (url) {
let getBlob = new Promise(resolve => { let getBlob = new Promise(resolve => {
const xhr = new XMLHttpRequest(); const xhr = new XMLHttpRequest();
...@@ -519,13 +527,13 @@ export default { ...@@ -519,13 +527,13 @@ export default {
}); });
return getBlob return getBlob
}, },
Vue.prototype.accAdd = function (arg1, arg2) {//加法精密计算 Vue.prototype.accAdd = function (arg1, arg2) { //加法精密计算
var r1; var r1;
var r2; var r2;
var m; var m;
var c; var c;
try { try {
r1 = arg1.toString().split('.')[1].length; r1 = arg1.toString().split('.')[1].length;
} catch (e) { } catch (e) {
r1 = 0; r1 = 0;
} }
...@@ -538,13 +546,13 @@ export default { ...@@ -538,13 +546,13 @@ export default {
m = Math.pow(10, Math.max(r1, r2)); m = Math.pow(10, Math.max(r1, r2));
if (c > 0) { if (c > 0) {
var cm = Math.pow(10, c); var cm = Math.pow(10, c);
if (r1 > r2) { if (r1 > r2) {
arg1 = Number(arg1.toString().replace('.', '')); arg1 = Number(arg1.toString().replace('.', ''));
arg2 = Number(arg2.toString().replace('.', '')) * cm; arg2 = Number(arg2.toString().replace('.', '')) * cm;
} else { } else {
arg1 = Number(arg1.toString().replace('.', '')) * cm; arg1 = Number(arg1.toString().replace('.', '')) * cm;
arg2 = Number(arg2.toString().replace('.', '')); arg2 = Number(arg2.toString().replace('.', ''));
} }
} else { } else {
arg1 = Number(arg1.toString().replace('.', '')); arg1 = Number(arg1.toString().replace('.', ''));
arg2 = Number(arg2.toString().replace('.', '')); arg2 = Number(arg2.toString().replace('.', ''));
...@@ -552,19 +560,17 @@ export default { ...@@ -552,19 +560,17 @@ export default {
return (arg1 + arg2) / m; return (arg1 + arg2) / m;
}, },
// 减法 // 减法
Vue.prototype.subtr = function(arg1, arg2) { Vue.prototype.subtr = function (arg1, arg2) {
var r1, r2, m, n; var r1, r2, m, n;
try { try {
r1 = arg1.toString().split(".")[1].length; r1 = arg1.toString().split(".")[1].length;
} } catch (e) {
catch (e) { r1 = 0;
r1 = 0;
} }
try { try {
r2 = arg2.toString().split(".")[1].length; r2 = arg2.toString().split(".")[1].length;
} } catch (e) {
catch (e) { r2 = 0;
r2 = 0;
} }
m = Math.pow(10, Math.max(r1, r2)); m = Math.pow(10, Math.max(r1, r2));
//last modify by deeka //last modify by deeka
...@@ -572,21 +578,33 @@ export default { ...@@ -572,21 +578,33 @@ export default {
n = (r1 >= r2) ? r1 : r2; n = (r1 >= r2) ? r1 : r2;
return ((arg1 * m - arg2 * m) / m).toFixed(n); return ((arg1 * m - arg2 * m) / m).toFixed(n);
} }
// 乘法获取准确值 // 乘法获取准确值
Vue.prototype.accMul = function(arg1,arg2){ Vue.prototype.accMul = function (arg1, arg2) {
var m=0,s1=arg1.toString(),s2=arg2.toString(); var m = 0,
try{m+=s1.split(".")[1].length}catch(e){} s1 = arg1.toString(),
try{m+=s2.split(".")[1].length}catch(e){} s2 = arg2.toString();
return Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m) try {
} m += s1.split(".")[1].length
// 除法获取精确值 } catch (e) {}
Vue.prototype.accDiv = function(arg1, arg2) { try {
var t1 = 0, t2 = 0, r1, r2; m += s2.split(".")[1].length
try { t1 = arg1.toString().split(".")[1].length } catch (e) { } } catch (e) {}
try { t2 = arg2.toString().split(".")[1].length } catch (e) { } return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m)
Math.r1 = Number(arg1.toString().replace(".", "")) }
Math.r2 = Number(arg2.toString().replace(".", "")) // 除法获取精确值
return (Math.r1 / Math.r2) * Math.pow(10, t2 - t1); Vue.prototype.accDiv = function (arg1, arg2) {
} var t1 = 0,
t2 = 0,
r1, r2;
try {
t1 = arg1.toString().split(".")[1].length
} catch (e) {}
try {
t2 = arg2.toString().split(".")[1].length
} catch (e) {}
Math.r1 = Number(arg1.toString().replace(".", ""))
Math.r2 = Number(arg2.toString().replace(".", ""))
return (Math.r1 / Math.r2) * Math.pow(10, t2 - t1);
}
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment