This commit is contained in:
闫晓茹 2023-09-20 16:20:23 +08:00
parent 373857292b
commit 4d29b79be1
31 changed files with 1375 additions and 500 deletions

View File

@ -1,5 +1,5 @@
import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/xinelu";
import { parseStrEmpty } from "@/utils/xinyilu";
// 查询用户列表
export function listUser(query) {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 121 KiB

View File

@ -9,10 +9,10 @@
:show-file-list="false"
:headers="headers"
style="display: none"
:data="filetype"
ref="upload"
v-if="this.type == 'url'"
>
</el-upload>
></el-upload>
<div class="editor" ref="editor" :style="styles"></div>
</div>
</template>
@ -56,13 +56,21 @@ export default {
type: {
type: String,
default: "url",
}
},
url: {
type: String,
default: "/common/richTextPictureUrl",
},
// filetypes: {
// type: String,
// default: "",
// },
},
data() {
return {
uploadUrl: process.env.VUE_APP_BASE_API + "/common/upload", //
uploadUrl: process.env.VUE_APP_BASE_API, //
headers: {
Authorization: "Bearer " + getToken()
Authorization: "Bearer " + getToken(),
},
Quill: null,
currentValue: "",
@ -73,23 +81,31 @@ export default {
modules: {
//
toolbar: [
["bold", "italic", "underline", "strike"], // 线 线
["blockquote", "code-block"], //
[{ list: "ordered" }, { list: "bullet" }], //
[{ indent: "-1" }, { indent: "+1" }], //
[{ size: ["small", false, "large", "huge"] }], //
[{ header: [1, 2, 3, 4, 5, 6, false] }], //
[{ color: [] }, { background: [] }], //
[{ align: [] }], //
["clean"], //
["link", "image", "video"] //
["bold", "italic", "underline", "strike"], // 线 线
["blockquote", "code-block"], //
[{ list: "ordered" }, { list: "bullet" }], //
[{ indent: "-1" }, { indent: "+1" }], //
[{ size: ["small", false, "large", "huge"] }], //
[{ header: [1, 2, 3, 4, 5, 6, false] }], //
[{ color: [] }, { background: [] }], //
[{ align: [] }], //
["clean"], //
["link", "image"], //
],
},
placeholder: "请输入内容",
readOnly: this.readOnly,
},
filetype: {
type: "",
},
};
},
created() {
this.uploadUrl = process.env.VUE_APP_BASE_API + this.url;
// console.log(this.url)
// this.filetype.type = this.filetypes;
},
computed: {
styles() {
let style = {};
@ -126,7 +142,7 @@ export default {
const editor = this.$refs.editor;
this.Quill = new Quill(editor, this.options);
//
if (this.type == 'url') {
if (this.type == "url") {
let toolbar = this.Quill.getModule("toolbar");
toolbar.addHandler("image", (value) => {
this.uploadType = "image";
@ -176,7 +192,13 @@ export default {
//
let length = quill.getSelection().index;
// res.url
quill.insertEmbed(length, "image", process.env.VUE_APP_BASE_API + res.fileName);
quill.insertEmbed(
length,
"image",
process.env.VUE_APP_BASE_API + res.fileName
);
console.log(res);
this.$emit("imgs", res.fileName);
//
quill.setSelection(length + 1);
} else {
@ -191,7 +213,8 @@ export default {
</script>
<style>
.editor, .ql-toolbar {
.editor,
.ql-toolbar {
white-space: pre-wrap !important;
line-height: normal !important;
}

View File

@ -1,6 +1,6 @@
/**
* v-dialogDrag 弹窗拖拽
* Copyright (c) 2019 xinelu
* Copyright (c) 2019 xinyilu
*/
export default {

View File

@ -1,6 +1,6 @@
/**
* v-dialogDragWidth 可拖动弹窗高度右下角
* Copyright (c) 2019 xinelu
* Copyright (c) 2019 xinyilu
*/
export default {

View File

@ -1,6 +1,6 @@
/**
* v-dialogDragWidth 可拖动弹窗宽度右侧边
* Copyright (c) 2019 xinelu
* Copyright (c) 2019 xinyilu
*/
export default {

View File

@ -1,6 +1,6 @@
/**
* v-clipboard 文字复制剪贴
* Copyright (c) 2021 xinelu
* Copyright (c) 2021 xinyilu
*/
import Clipboard from 'clipboard'

View File

@ -1,6 +1,6 @@
/**
* v-hasPermi 操作权限处理
* Copyright (c) 2019 xinelu
* Copyright (c) 2019 xinyilu
*/
import store from '@/store'

View File

@ -1,6 +1,6 @@
/**
* v-hasRole 角色权限处理
* Copyright (c) 2019 xinelu
* Copyright (c) 2019 xinyilu
*/
import store from '@/store'

View File

@ -9,13 +9,13 @@
<template v-if="device!=='mobile'">
<search id="header-search" class="right-menu-item" />
<el-tooltip content="源码地址" effect="dark" placement="bottom">
<ruo-yi-git id="xinelu-git" class="right-menu-item hover-effect" />
<!-- <el-tooltip content="源码地址" effect="dark" placement="bottom">
<ruo-yi-git id="xinyilu-git" class="right-menu-item hover-effect" />
</el-tooltip>
<el-tooltip content="文档地址" effect="dark" placement="bottom">
<ruo-yi-doc id="xinelu-doc" class="right-menu-item hover-effect" />
</el-tooltip>
<ruo-yi-doc id="xinyilu-doc" class="right-menu-item hover-effect" />
</el-tooltip> -->
<screenfull id="screenfull" class="right-menu-item hover-effect" />
@ -54,8 +54,8 @@ import Hamburger from '@/components/Hamburger'
import Screenfull from '@/components/Screenfull'
import SizeSelect from '@/components/SizeSelect'
import Search from '@/components/HeaderSearch'
import xineluGit from '@/components/xinelu/Git'
import xineluDoc from '@/components/xinelu/Doc'
import xinyiluGit from '@/components/xinyilu/Git'
import xinyiluDoc from '@/components/xinyilu/Doc'
export default {
components: {
@ -65,8 +65,8 @@ export default {
Screenfull,
SizeSelect,
Search,
xineluGit,
xineluDoc
xinyiluGit,
xinyiluDoc
},
computed: {
...mapGetters([

View File

@ -14,7 +14,7 @@
</template>
<script>
import logoImg from '@/assets/logo/logo.png'
import logoImg from '@/assets/logo/lg.png'
import variables from '@/assets/styles/variables.scss'
export default {
@ -35,7 +35,7 @@ export default {
},
data() {
return {
title: '新版小程序管理系统',
title: '泉医到家运营管理平台',
logo: logoImg
}
}

View File

@ -3,6 +3,7 @@
<div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside"/>
<sidebar v-if="!sidebar.hide" class="sidebar-container" />
<div :class="{hasTagsView:needTagsView,sidebarHide:sidebar.hide}" class="main-container">
<div :class="show ? 'bj' : ''">
<div :class="{'fixed-header':fixedHeader}">
<navbar />
<tags-view v-if="needTagsView" />
@ -11,6 +12,7 @@
<right-panel>
<settings />
</right-panel>
</div>
</div>
</div>
</template>
@ -31,6 +33,11 @@ export default {
Settings,
Sidebar,
TagsView
},
data() {
return {
show: true,
};
},
mixins: [ResizeMixin],
computed: {
@ -53,8 +60,27 @@ export default {
variables() {
return variables;
}
},
created() {
this.info();
},
watch: {
$route(to, from) {
if (to.path != "/index") {
this.show = false;
} else {
this.show = true;
}
},
},
methods: {
info() {
if (this.$route.path != "/index") {
this.show = false;
} else {
this.show = true;
}
},
handleClickOutside() {
this.$store.dispatch('app/closeSideBar', { withoutAnimation: false })
}
@ -65,7 +91,11 @@ export default {
<style lang="scss" scoped>
@import "~@/assets/styles/mixin.scss";
@import "~@/assets/styles/variables.scss";
.bj {
// background-image: url("../assets/images/body.png");
-moz-background-size: 100% 100%;
background-size: 100% 100%;
}
.app-wrapper {
@include clearfix;
position: relative;

View File

@ -6,7 +6,7 @@ import Element from 'element-ui'
import './assets/styles/element-variables.scss'
import '@/assets/styles/index.scss' // global css
import '@/assets/styles/xinelu.scss' // xinelu css
import '@/assets/styles/xinyilu.scss' // xinyilu css
import App from './App'
import store from './store'
import router from './router'
@ -18,7 +18,7 @@ import './assets/icons' // icon
import './permission' // permission control
import { getDicts } from "@/api/system/dict/data";
import { getConfigKey } from "@/api/system/config";
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/xinelu";
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/xinyilu";
// 分页组件
import Pagination from "@/components/Pagination";
// 自定义表格工具组件
@ -38,6 +38,7 @@ import VueMeta from 'vue-meta'
// 字典数据组件
import DictData from '@/components/DictData'
// 全局方法挂载
Vue.prototype.getDicts = getDicts
Vue.prototype.getConfigKey = getConfigKey
@ -73,14 +74,14 @@ DictData.install()
*/
Vue.use(Element, {
size: Cookies.get('size') || 'medium' // set element-ui default size
size: Cookies.get('size') || 'medium' // set element-ui default size
})
Vue.config.productionTip = false
new Vue({
el: '#app',
router,
store,
render: h => h(App)
el: '#app',
router,
store,
render: h => h(App)
})

View File

@ -11,46 +11,46 @@ NProgress.configure({ showSpinner: false })
const whiteList = ['/login', '/auth-redirect', '/bind', '/register']
router.beforeEach((to, from, next) => {
NProgress.start()
if (getToken()) {
to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
/* has token*/
if (to.path === '/login') {
next({ path: '/' })
NProgress.done()
NProgress.start()
if (getToken()) {
to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
/* has token*/
if (to.path === '/login') {
next({ path: '/' })
NProgress.done()
} else {
if (store.getters.roles.length === 0) {
isRelogin.show = true
// 判断当前用户是否已拉取完user_info信息
store.dispatch('GetInfo').then(() => {
isRelogin.show = false
store.dispatch('GenerateRoutes').then(accessRoutes => {
// 根据roles权限生成可访问的路由表
router.addRoutes(accessRoutes) // 动态添加可访问路由表
next({...to, replace: true }) // hack方法 确保addRoutes已完成
})
}).catch(err => {
store.dispatch('LogOut').then(() => {
Message.error(err)
next({ path: '/' })
})
})
} else {
next()
}
}
} else {
if (store.getters.roles.length === 0) {
isRelogin.show = true
// 判断当前用户是否已拉取完user_info信息
store.dispatch('GetInfo').then(() => {
isRelogin.show = false
store.dispatch('GenerateRoutes').then(accessRoutes => {
// 根据roles权限生成可访问的路由表
router.addRoutes(accessRoutes) // 动态添加可访问路由表
next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
})
}).catch(err => {
store.dispatch('LogOut').then(() => {
Message.error(err)
next({ path: '/' })
})
})
} else {
next()
}
// 没有token
if (whiteList.indexOf(to.path) !== -1) {
// 在免登录白名单,直接进入
next()
} else {
next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
NProgress.done()
}
}
} else {
// 没有token
if (whiteList.indexOf(to.path) !== -1) {
// 在免登录白名单,直接进入
next()
} else {
next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
NProgress.done()
}
}
})
router.afterEach(() => {
NProgress.done()
NProgress.done()
})

View File

@ -3,7 +3,7 @@ import { Message } from 'element-ui'
import { saveAs } from 'file-saver'
import { getToken } from '@/utils/auth'
import errorCode from '@/utils/errorCode'
import { blobValidate } from "@/utils/xinelu";
import { blobValidate } from "@/utils/xinyilu";
const baseURL = process.env.VUE_APP_BASE_API

View File

@ -2,95 +2,95 @@ import { login, logout, getInfo } from '@/api/login'
import { getToken, setToken, removeToken } from '@/utils/auth'
const user = {
state: {
token: getToken(),
name: '',
avatar: '',
roles: [],
permissions: []
},
state: {
token: getToken(),
name: '',
avatar: '',
roles: [],
permissions: []
},
mutations: {
SET_TOKEN: (state, token) => {
state.token = token
mutations: {
SET_TOKEN: (state, token) => {
state.token = token
},
SET_NAME: (state, name) => {
state.name = name
},
SET_AVATAR: (state, avatar) => {
state.avatar = avatar
},
SET_ROLES: (state, roles) => {
state.roles = roles
},
SET_PERMISSIONS: (state, permissions) => {
state.permissions = permissions
}
},
SET_NAME: (state, name) => {
state.name = name
},
SET_AVATAR: (state, avatar) => {
state.avatar = avatar
},
SET_ROLES: (state, roles) => {
state.roles = roles
},
SET_PERMISSIONS: (state, permissions) => {
state.permissions = permissions
actions: {
// 登录
Login({ commit }, userInfo) {
const username = userInfo.username.trim()
const password = userInfo.password
const code = userInfo.code
const uuid = userInfo.uuid
return new Promise((resolve, reject) => {
login(username, password, code, uuid).then(res => {
setToken(res.token)
commit('SET_TOKEN', res.token)
resolve()
}).catch(error => {
reject(error)
})
})
},
// 获取用户信息
GetInfo({ commit, state }) {
return new Promise((resolve, reject) => {
getInfo().then(res => {
const user = res.user
const avatar = (user.avatar == "" || user.avatar == null) ? require("@/assets/images/profile.jpg") : process.env.VUE_APP_BASE_API + user.avatar;
if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组
commit('SET_ROLES', res.roles)
commit('SET_PERMISSIONS', res.permissions)
} else {
commit('SET_ROLES', ['ROLE_DEFAULT'])
}
commit('SET_NAME', user.userName)
commit('SET_AVATAR', avatar)
resolve(res)
}).catch(error => {
reject(error)
})
})
},
// 退出系统
LogOut({ commit, state }) {
return new Promise((resolve, reject) => {
logout(state.token).then(() => {
commit('SET_TOKEN', '')
commit('SET_ROLES', [])
commit('SET_PERMISSIONS', [])
removeToken()
resolve()
}).catch(error => {
reject(error)
})
})
},
// 前端 登出
FedLogOut({ commit }) {
return new Promise(resolve => {
commit('SET_TOKEN', '')
removeToken()
resolve()
})
}
}
},
actions: {
// 登录
Login({ commit }, userInfo) {
const username = userInfo.username.trim()
const password = userInfo.password
const code = userInfo.code
const uuid = userInfo.uuid
return new Promise((resolve, reject) => {
login(username, password, code, uuid).then(res => {
setToken(res.token)
commit('SET_TOKEN', res.token)
resolve()
}).catch(error => {
reject(error)
})
})
},
// 获取用户信息
GetInfo({ commit, state }) {
return new Promise((resolve, reject) => {
getInfo().then(res => {
const user = res.user
const avatar = (user.avatar == "" || user.avatar == null) ? require("@/assets/images/profile.jpg") : process.env.VUE_APP_BASE_API + user.avatar;
if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组
commit('SET_ROLES', res.roles)
commit('SET_PERMISSIONS', res.permissions)
} else {
commit('SET_ROLES', ['ROLE_DEFAULT'])
}
commit('SET_NAME', user.userName)
commit('SET_AVATAR', avatar)
resolve(res)
}).catch(error => {
reject(error)
})
})
},
// 退出系统
LogOut({ commit, state }) {
return new Promise((resolve, reject) => {
logout(state.token).then(() => {
commit('SET_TOKEN', '')
commit('SET_ROLES', [])
commit('SET_PERMISSIONS', [])
removeToken()
resolve()
}).catch(error => {
reject(error)
})
})
},
// 前端 登出
FedLogOut({ commit }) {
return new Promise(resolve => {
commit('SET_TOKEN', '')
removeToken()
resolve()
})
}
}
}
export default user
export default user

View File

@ -1,5 +1,5 @@
import Vue from 'vue'
import { mergeRecursive } from "@/utils/xinelu";
import { mergeRecursive } from "@/utils/xinyilu";
import DictMeta from './DictMeta'
import DictData from './DictData'

View File

@ -1,4 +1,4 @@
import { mergeRecursive } from "@/utils/xinelu";
import { mergeRecursive } from "@/utils/xinyilu";
import DictOptions from './DictOptions'
/**

View File

@ -1,32 +1,32 @@
import { mergeRecursive } from "@/utils/xinelu";
import { mergeRecursive } from "@/utils/xinyilu";
import dictConverter from './DictConverter'
export const options = {
metas: {
'*': {
/**
* 字典请求方法签名为function(dictMeta: DictMeta): Promise
*/
request: (dictMeta) => {
console.log(`load dict ${dictMeta.type}`)
return Promise.resolve([])
},
/**
* 字典响应数据转换器方法签名为function(response: Object, dictMeta: DictMeta): DictData
*/
responseConverter,
labelField: 'label',
valueField: 'value',
metas: {
'*': {
/**
* 字典请求方法签名为function(dictMeta: DictMeta): Promise
*/
request: (dictMeta) => {
console.log(`load dict ${dictMeta.type}`)
return Promise.resolve([])
},
/**
* 字典响应数据转换器方法签名为function(response: Object, dictMeta: DictMeta): DictData
*/
responseConverter,
labelField: 'label',
valueField: 'value',
},
},
},
/**
* 默认标签字段
*/
DEFAULT_LABEL_FIELDS: ['label', 'name', 'title'],
/**
* 默认值字段
*/
DEFAULT_VALUE_FIELDS: ['value', 'id', 'uid', 'key'],
/**
* 默认标签字段
*/
DEFAULT_LABEL_FIELDS: ['label', 'name', 'title'],
/**
* 默认值字段
*/
DEFAULT_VALUE_FIELDS: ['value', 'id', 'uid', 'key'],
}
/**
@ -36,16 +36,16 @@ export const options = {
* @returns {DictData}
*/
function responseConverter(response, dictMeta) {
const dicts = response.content instanceof Array ? response.content : response
if (dicts === undefined) {
console.warn(`no dict data of "${dictMeta.type}" found in the response`)
return []
}
return dicts.map(d => dictConverter(d, dictMeta))
const dicts = response.content instanceof Array ? response.content : response
if (dicts === undefined) {
console.warn(`no dict data of "${dictMeta.type}" found in the response`)
return []
}
return dicts.map(d => dictConverter(d, dictMeta))
}
export function mergeOptions(src) {
mergeRecursive(options, src)
mergeRecursive(options, src)
}
export default options
export default options

View File

@ -1,4 +1,4 @@
import { parseTime } from './xinelu'
import { parseTime } from './xinyilu'
/**
* 表格时间格式化

View File

@ -3,7 +3,7 @@ import { Notification, MessageBox, Message, Loading } from 'element-ui'
import store from '@/store'
import { getToken } from '@/utils/auth'
import errorCode from '@/utils/errorCode'
import { tansParams, blobValidate } from "@/utils/xinelu";
import { tansParams, blobValidate } from "@/utils/xinyilu";
import cache from '@/plugins/cache'
import { saveAs } from 'file-saver'
@ -14,52 +14,52 @@ export let isRelogin = { show: false };
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
// 创建axios实例
const service = axios.create({
// axios中请求配置有baseURL选项表示请求URL公共部分
baseURL: process.env.VUE_APP_BASE_API,
// 超时
timeout: 10000
// axios中请求配置有baseURL选项表示请求URL公共部分
baseURL: process.env.VUE_APP_BASE_API,
// 超时
timeout: 10000
})
// request拦截器
service.interceptors.request.use(config => {
// 是否需要设置 token
const isToken = (config.headers || {}).isToken === false
// 是否需要防止数据重复提交
const isRepeatSubmit = (config.headers || {}).repeatSubmit === false
if (getToken() && !isToken) {
config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
}
// get请求映射params参数
if (config.method === 'get' && config.params) {
let url = config.url + '?' + tansParams(config.params);
url = url.slice(0, -1);
config.params = {};
config.url = url;
}
if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) {
const requestObj = {
url: config.url,
data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data,
time: new Date().getTime()
// 是否需要设置 token
const isToken = (config.headers || {}).isToken === false
// 是否需要防止数据重复提交
const isRepeatSubmit = (config.headers || {}).repeatSubmit === false
if (getToken() && !isToken) {
config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
}
const sessionObj = cache.session.getJSON('sessionObj')
if (sessionObj === undefined || sessionObj === null || sessionObj === '') {
cache.session.setJSON('sessionObj', requestObj)
} else {
const s_url = sessionObj.url; // 请求地址
const s_data = sessionObj.data; // 请求数据
const s_time = sessionObj.time; // 请求时间
const interval = 1000; // 间隔时间(ms),小于此时间视为重复提交
if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) {
const message = '数据正在处理,请勿重复提交';
console.warn(`[${s_url}]: ` + message)
return Promise.reject(new Error(message))
} else {
cache.session.setJSON('sessionObj', requestObj)
}
// get请求映射params参数
if (config.method === 'get' && config.params) {
let url = config.url + '?' + tansParams(config.params);
url = url.slice(0, -1);
config.params = {};
config.url = url;
}
}
return config
if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) {
const requestObj = {
url: config.url,
data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data,
time: new Date().getTime()
}
const sessionObj = cache.session.getJSON('sessionObj')
if (sessionObj === undefined || sessionObj === null || sessionObj === '') {
cache.session.setJSON('sessionObj', requestObj)
} else {
const s_url = sessionObj.url; // 请求地址
const s_data = sessionObj.data; // 请求数据
const s_time = sessionObj.time; // 请求时间
const interval = 1000; // 间隔时间(ms),小于此时间视为重复提交
if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) {
const message = '数据正在处理,请勿重复提交';
console.warn(`[${s_url}]: ` + message)
return Promise.reject(new Error(message))
} else {
cache.session.setJSON('sessionObj', requestObj)
}
}
}
return config
}, error => {
console.log(error)
Promise.reject(error)
@ -72,87 +72,86 @@ service.interceptors.response.use(res => {
// 获取错误信息
const msg = errorCode[code] || res.data.msg || errorCode['default']
// 二进制数据则直接返回
if(res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer'){
return res.data
if (res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer') {
return res.data
}
if (code === 401) {
if (!isRelogin.show) {
isRelogin.show = true;
MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
confirmButtonText: '重新登录',
cancelButtonText: '取消',
type: 'warning'
if (!isRelogin.show) {
isRelogin.show = true;
MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
confirmButtonText: '重新登录',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
isRelogin.show = false;
store.dispatch('LogOut').then(() => {
location.href = '/index';
})
}).catch(() => {
isRelogin.show = false;
});
}
).then(() => {
isRelogin.show = false;
store.dispatch('LogOut').then(() => {
location.href = '/index';
})
}).catch(() => {
isRelogin.show = false;
});
}
return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
} else if (code === 500) {
Message({
message: msg,
type: 'error'
})
return Promise.reject(new Error(msg))
Message({
message: msg,
type: 'error'
})
return res.data & Promise.reject(new Error(msg))
} else if (code === 600) {
return Promise.reject(new Error(msg))
} else if (code !== 200) {
Notification.error({
title: msg
})
return Promise.reject('error')
Notification.error({
title: msg
})
return Promise.reject('error')
} else {
return res.data
return res.data
}
},
error => {
console.log('err' + error)
let { message } = error;
if (message == "Network Error") {
message = "后端接口连接异常";
},
error => {
console.log('err' + error)
let { message } = error;
if (message == "Network Error") {
message = "后端接口连接异常";
} else if (message.includes("timeout")) {
message = "系统接口请求超时";
} else if (message.includes("Request failed with status code")) {
message = "系统接口" + message.substr(message.length - 3) + "异常";
}
Message({
message: message,
type: 'error',
duration: 5 * 1000
})
return Promise.reject(error)
}
else if (message.includes("timeout")) {
message = "系统接口请求超时";
}
else if (message.includes("Request failed with status code")) {
message = "系统接口" + message.substr(message.length - 3) + "异常";
}
Message({
message: message,
type: 'error',
duration: 5 * 1000
})
return Promise.reject(error)
}
)
// 通用下载方法
export function download(url, params, filename) {
downloadLoadingInstance = Loading.service({ text: "正在下载数据,请稍候", spinner: "el-icon-loading", background: "rgba(0, 0, 0, 0.7)", })
return service.post(url, params, {
transformRequest: [(params) => { return tansParams(params) }],
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
responseType: 'blob'
}).then(async (data) => {
const isLogin = await blobValidate(data);
if (isLogin) {
const blob = new Blob([data])
saveAs(blob, filename)
} else {
const resText = await data.text();
const rspObj = JSON.parse(resText);
const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
Message.error(errMsg);
}
downloadLoadingInstance.close();
}).catch((r) => {
console.error(r)
Message.error('下载文件出现错误,请联系管理员!')
downloadLoadingInstance.close();
})
downloadLoadingInstance = Loading.service({ text: "正在下载数据,请稍候", spinner: "el-icon-loading", background: "rgba(0, 0, 0, 0.7)", })
return service.post(url, params, {
transformRequest: [(params) => { return tansParams(params) }],
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
responseType: 'blob'
}).then(async (data) => {
const isLogin = await blobValidate(data);
if (isLogin) {
const blob = new Blob([data])
saveAs(blob, filename)
} else {
const resText = await data.text();
const rspObj = JSON.parse(resText);
const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
Message.error(errMsg);
}
downloadLoadingInstance.close();
}).catch((r) => {
console.error(r)
Message.error('下载文件出现错误,请联系管理员!')
downloadLoadingInstance.close();
})
}
export default service
export default service

View File

@ -1,30 +1,497 @@
<template>
<div class="app-container home">
<el-row :gutter="20">
<el-col :sm="24" :lg="12" style="padding-left: 20px">
<h2>新医路新版小程序管理系统</h2>
<p>
</p>
<p>
</p>
</el-col>
<el-col :sm="24" :lg="12" style="padding-left: 50px">
<el-row>
</el-row>
</el-col>
<div class="homes">
<div class="count" @click="goodsCount">
<div class="el-icon-picture-outline icons"></div>
<div class="counts">{{ List.goodsCount }}</div>
<div class="total">商品总数量</div>
</div>
<div class="count member" @click="patientCount">
<div class="el-icon-user-solid icons"></div>
<div class="counts">{{ List.patientCount }}</div>
<div class="total">会员总数量</div>
</div>
<div class="count order" @click="appointmentOrderCount">
<div class="el-icon-shopping-cart-2 icons"></div>
<div class="counts">{{ List.appointmentOrderCount }}</div>
<div class="total">预约订单总数量</div>
</div>
<div class="count shop" @click="goodsOrderCount">
<div class="el-icon-s-data icons"></div>
<div class="counts">{{ List.goodsOrderCount }}</div>
<div class="total">商品订单总数量</div>
</div>
</div>
<div class="today">
<!-- 今日概括 -->
<div class="todayitem">
<div class="el-icon-sell icon"></div>
<div class="goodsinfo">今日上架商品数量</div>
<div class="totals">{{ summaryTodayList.goodsCount }}</div>
</div>
<div class="todayitem">
<div class="el-icon-user icon"></div>
<div class="goodsinfo">今日新增会员数</div>
<div class="totals">{{ summaryTodayList.patientCount }}</div>
</div>
<div class="todayitem">
<div class="el-icon-shopping-cart-full icon"></div>
<div class="goodsinfo">今日订单数</div>
<div class="totals">{{ summaryTodayList.orderCount }}</div>
</div>
<div class="todayitem">
<div class="el-icon-money icon"></div>
<div class="goodsinfo">今日交易额</div>
<div class="totals">{{ summaryTodayList.totalPrice }}</div>
</div>
</div>
<div class="main2" id="main2" style="width: 1200px; height: 500px"></div>
<div class="main" id="main" style="width: 1200px; height: 500px"></div>
<el-row>
<div class="title">热卖商品TOP10</div>
<el-table :data="list" style="width: 96%; margin: 0 auto">
<el-table-column label="排名" type="index" width="130" align="center" />
<el-table-column label="商品名称" align="center" prop="goodsName" />
<el-table-column label="价格" align="center" prop="sumTotalPrice" />
<el-table-column
label="销量"
align="center"
width="130"
prop="sumGoodsCount"
/>
</el-table>
</el-row>
<el-divider />
</div>
</template>
<script>
import { informationStatistics, summaryToday } from "@/api/system/index";
import * as echarts from "echarts";
import {
getWeekGoodsTradeTrend,
getWeekTradeAppointmentTrend,
selectHotGoodsList,
} from "@/api/system/homepage.js";
export default {
name: "index",
data() {
return {
queryParams: {
goodsCount: null,
patientCount: null,
orderCount: null,
storeCount: null,
},
//
List: [],
//
summaryTodayList: [],
//
version: "0.0.1",
list: [],
};
},
mounted() {
this.info();
},
created() {
this.getList();
this.tableinfo();
},
methods: {
tableinfo() {
selectHotGoodsList().then((res) => {
this.list = res.data;
});
},
info() {
getWeekTradeAppointmentTrend().then((res) => {
if (res.code == 200) {
var timedata = [];
res.data.forEach((e) => {
timedata.push(e.clickDate);
});
var totalPricedata = [];
res.data.forEach((e) => {
totalPricedata.push(e.totalPrice);
});
var numberdata = [];
res.data.forEach((e) => {
numberdata.push(e.count);
});
var chartDom = document.getElementById("main2");
var myChart = echarts.init(chartDom);
var option;
option = {
title: {
text: "预约订单交易走势",
left: "50%",
textAlign: "center",
},
tooltip: {
trigger: "axis",
axisPointer: {
lineStyle: {
color: "#ddd",
},
},
backgroundColor: "rgba(255,255,255,1)",
padding: [5, 10],
textStyle: {
color: "#7588E4",
},
extraCssText: "box-shadow: 0 0 5px rgba(0,0,0,0.3)",
},
legend: {
right: 20,
orient: "vertical",
x: "left",
y: "top",
data: ["订单数量", "订单金额"],
},
xAxis: {
type: "category",
data: timedata,
boundaryGap: false,
splitLine: {
show: true,
interval: "auto",
lineStyle: {
color: ["#ffffff"],
},
},
axisTick: {
show: false,
},
axisLine: {
lineStyle: {
color: "#609ee9",
},
},
axisLabel: {
margin: 10,
textStyle: {
fontSize: 14,
},
},
},
yAxis: {
type: "value",
splitLine: {
lineStyle: {
color: ["#f0f0f0"],
},
},
axisTick: {
show: false,
},
axisLine: {
lineStyle: {
color: "#609ee9",
},
},
axisLabel: {
margin: 10,
textStyle: {
fontSize: 14,
},
},
},
series: [
{
name: "订单数量",
type: "line",
smooth: true,
showSymbol: false,
symbol: "circle",
symbolSize: 6,
data: numberdata,
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(
0,
0,
0,
1,
[
{
offset: 0,
color: "#d6e3fd",
},
{
offset: 1,
color: "#d6e3fd",
},
],
false
),
},
},
itemStyle: {
normal: {
color: "#87B1F7",
},
},
lineStyle: {
normal: {
width: 3,
},
},
},
{
name: "订单金额",
type: "line",
smooth: true,
showSymbol: false,
symbol: "circle",
symbolSize: 6,
data: totalPricedata,
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(
0,
0,
0,
1,
[
{
offset: 0,
color: "#D6F5E9",
},
{
offset: 1,
color: "#D6F5E9",
},
],
false
),
},
},
itemStyle: {
normal: {
color: "#57D1A0",
},
},
lineStyle: {
normal: {
width: 3,
},
},
},
],
};
option && myChart.setOption(option);
} else {
}
});
getWeekGoodsTradeTrend().then((res) => {
if (res.code == 200) {
var timedata = [];
res.data.forEach((e) => {
timedata.push(e.clickDate);
});
var numberdata = [];
res.data.forEach((e) => {
numberdata.push(e.count);
});
var totalPricedata = [];
res.data.forEach((e) => {
totalPricedata.push(e.totalPrice);
});
var moneydata = [];
res.data.forEach((e) => {
numberdata.push(e.count);
});
var chartDom = document.getElementById("main");
var myChart = echarts.init(chartDom);
var option;
option = {
title: {
text: "商品订单交易走势",
left: "50%",
textAlign: "center",
},
tooltip: {
trigger: "axis",
axisPointer: {
lineStyle: {
color: "#ddd",
},
},
backgroundColor: "rgba(255,255,255,1)",
padding: [5, 10],
textStyle: {
color: "#7588E4",
},
extraCssText: "box-shadow: 0 0 5px rgba(0,0,0,0.3)",
},
legend: {
right: 20,
orient: "vertical",
x: "left",
y: "top",
data: ["订单数量", "订单金额"],
},
xAxis: {
type: "category",
data: timedata,
boundaryGap: false,
splitLine: {
show: true,
interval: "auto",
lineStyle: {
color: ["#ffffff"],
},
},
axisTick: {
show: false,
},
axisLine: {
lineStyle: {
color: "#609ee9",
},
},
axisLabel: {
margin: 10,
textStyle: {
fontSize: 14,
},
},
},
yAxis: {
type: "value",
splitLine: {
lineStyle: {
color: ["#D4DFF5"],
},
},
axisTick: {
show: false,
},
axisLine: {
lineStyle: {
color: "#609ee9",
},
},
axisLabel: {
margin: 10,
textStyle: {
fontSize: 14,
},
},
},
series: [
{
name: "订单数量",
type: "line",
smooth: true,
showSymbol: false,
symbol: "circle",
symbolSize: 6,
data: numberdata,
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(
0,
0,
0,
1,
[
{
offset: 0,
color: "#d6e3fd",
},
{
offset: 1,
color: "#d6e3fd",
},
],
false
),
},
},
itemStyle: {
normal: {
color: "#87B1F7",
},
},
lineStyle: {
normal: {
width: 3,
},
},
},
{
name: "订单金额",
type: "line",
smooth: true,
showSymbol: false,
symbol: "circle",
symbolSize: 6,
data: totalPricedata,
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(
0,
0,
0,
1,
[
{
offset: 0,
color: "#D6F5E9",
},
{
offset: 1,
color: "#D6F5E9",
},
],
false
),
},
},
itemStyle: {
normal: {
color: "#57D1A0",
},
},
lineStyle: {
normal: {
width: 3,
},
},
},
],
};
option && myChart.setOption(option);
} else {
}
});
},
goodsCount() {
this.$router.push("/Shopping/operateGoodsInfo");
},
patientCount() {
this.$router.push("/patient/patientArchives");
},
appointmentOrderCount() {
this.$router.push("/order/order");
},
goodsOrderCount() {
this.$router.push("/order/goodsOrder");
},
getList() {
informationStatistics(this.queryParams).then((response) => {
this.List = response.data;
});
summaryToday(this.queryParams).then((response) => {
this.summaryTodayList = response.data;
});
},
goTarget(href) {
window.open(href, "_blank");
},
@ -33,66 +500,128 @@ export default {
</script>
<style scoped lang="scss">
.home {
blockquote {
padding: 10px 20px;
margin: 0 0 20px;
font-size: 17.5px;
border-left: 5px solid #eee;
}
hr {
margin-top: 20px;
margin-bottom: 20px;
border: 0;
border-top: 1px solid #eee;
}
.col-item {
margin-bottom: 20px;
}
ul {
padding: 0;
margin: 0;
}
font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
.main2 {
margin: 0 auto;
}
.main {
margin: 0 auto;
}
.title {
margin: 20px 0 20px 2%;
font-size: 18px;
font-weight: 600;
}
.count {
color: white;
width: 30%;
background-image: linear-gradient(
109.6deg,
rgba(111, 167, 183, 0.6) 11.2%,
#b3e9d8 100.2%
);
transition: 0.35s;
-webkit-box-shadow: 1px 3px 12px rgb(255 113 113 / 30%);
height: 84px;
border-radius: 0.4em;
font-weight: 700;
margin-right: 20px;
}
.count:hover {
cursor: pointer;
-webkit-transform: translateY(-10px);
transform: translateY(-10px);
z-index: 99;
}
.member {
background-image: linear-gradient(
109.6deg,
rgba(161, 191, 239, 0.6) 11.2%,
#86c5e2 100.2%
);
-webkit-box-shadow: 1px 3px 12px rgb(255 170 113 / 30%);
box-shadow: 1px 3px 12px rgb(255 170 113 / 30%);
}
.order {
background-image: linear-gradient(
109.6deg,
rgba(161, 191, 214, 0.6) 11.2%,
#688eab 100.2%
);
-webkit-box-shadow: 1px 3px 12px rgb(147 181 225 / 30%);
box-shadow: 1px 3px 12px rgb(147 181 225 / 30%);
}
.shop {
background-image: linear-gradient(
109.6deg,
rgba(138, 203, 158, 0.6) 11.2%,
#81c195 100.2%
);
-webkit-box-shadow: 1px 3px 12px rgb(132 140 207 / 30%);
box-shadow: 1px 3px 12px rgb(132 140 207 / 30%);
}
.counts {
margin-top: 20px;
margin-left: 35%;
line-height: 1;
font-size: 21px;
}
.total {
margin-top: 5px;
margin-left: 35%;
font-size: 13px;
color: #676a6c;
overflow-x: hidden;
ul {
list-style-type: none;
}
.icon {
margin-top: 10px;
margin-left: 16px;
font-size: 31px;
position: absolute;
}
.icons {
margin-top: 30px;
margin-left: 35px;
position: absolute;
font-size: 31px;
}
.today {
width: 100%;
display: flex;
margin-top: 10px;
margin-left: -10px;
}
.todayitem {
transition: 0.35s;
margin: 10px;
width: 30%;
height: 100px;
margin-bottom: 20px;
border-radius: 0.4em;
font-weight: 700;
background: hsla(0, 0%, 92.2%, 0.5333333333333333);
padding: 20px;
.goodsinfo {
margin-top: 5px;
margin-left: 32%;
}
h4 {
margin-top: 0px;
}
h2 {
margin-top: 10px;
font-size: 26px;
font-weight: 100;
}
p {
margin-top: 10px;
b {
font-weight: 700;
}
}
.update-log {
ol {
display: block;
list-style-type: decimal;
margin-block-start: 1em;
margin-block-end: 1em;
margin-inline-start: 0;
margin-inline-end: 0;
padding-inline-start: 40px;
}
.totals {
color: #ff5c58;
margin-left: 32%;
margin-top: 5px;
font-size: 21px;
}
}
.todayitem:hover {
cursor: pointer;
-webkit-transform: translateY(-10px);
transform: translateY(-10px);
z-index: 99;
}
.home {
height: 100%;
width: 100%;
background-size: cover;
}
.homes {
display: flex;
}
</style>

View File

@ -1,15 +1,25 @@
<template>
<div class="login">
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
<h3 class="title">若依后台管理系统</h3>
<el-form
ref="loginForm"
:model="loginForm"
:rules="loginRules"
class="login-form"
>
<h3 class="title">泉医到家运营管理平台</h3>
<el-form-item prop="username">
<el-input
v-model="loginForm.username"
type="text"
auto-complete="off"
placeholder="账号"
style="width: 310px"
>
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
<svg-icon
slot="prefix"
icon-class="user"
class="el-input__icon input-icon"
/>
</el-input>
</el-form-item>
<el-form-item prop="password">
@ -19,8 +29,13 @@
auto-complete="off"
placeholder="密码"
@keyup.enter.native="handleLogin"
style="width: 310px"
>
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
<svg-icon
slot="prefix"
icon-class="password"
class="el-input__icon input-icon"
/>
</el-input>
</el-form-item>
<el-form-item prop="code" v-if="captchaOnOff">
@ -28,35 +43,59 @@
v-model="loginForm.code"
auto-complete="off"
placeholder="验证码"
style="width: 63%"
style="width: 200px"
@keyup.enter.native="handleLogin"
>
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
<svg-icon
slot="prefix"
icon-class="validCode"
class="el-input__icon input-icon"
/>
</el-input>
<div class="login-code">
<img :src="codeUrl" @click="getCode" class="login-code-img"/>
<img :src="codeUrl" @click="getCode" class="login-code-img" />
</div>
</el-form-item>
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
<el-form-item style="width:100%;">
<el-checkbox
v-model="loginForm.rememberMe"
style="margin: 0px 0px 25px 0px"
>记住密码</el-checkbox
>
<el-form-item style="width: 100%">
<el-button
:loading="loading"
size="medium"
type="primary"
style="width:100%;"
style="
width: 300px;
height: 50px;
background-image: linear-gradient(to right, #01a4ff, #1259ee);
border-radius: -33px;
border: none;
color: #ffffff;
border-radius: 20px;
"
@click.native.prevent="handleLogin"
>
<span v-if="!loading"> </span>
<span v-else> 中...</span>
</el-button>
<div style="float: right;" v-if="register">
<router-link class="link-type" :to="'/register'">立即注册</router-link>
<div style="float: right" v-if="register">
<router-link class="link-type" :to="'/register'"
>立即注册</router-link
>
</div>
</el-form-item>
</el-form>
<div class="bg" style="border-radius: 0 6px 6px 0; padding: 0">
<img
src="../assets/images/bg3.png"
alt=""
style="width: 1400px; height: 700px; border-radius: 0 6px 6px 0"
/>
</div>
<!-- 底部 -->
<div class="el-login-footer">
<span>Copyright © 2018-2022 xinelu.vip All Rights Reserved.</span>
<!-- <span>Copyright © 2018-2022 xinyilu.vip All Rights Reserved.</span> -->
</div>
</div>
</template>
@ -64,7 +103,7 @@
<script>
import { getCodeImg } from "@/api/login";
import Cookies from "js-cookie";
import { encrypt, decrypt } from '@/utils/jsencrypt'
import { encrypt, decrypt } from "@/utils/jsencrypt";
export default {
name: "Login",
@ -76,32 +115,32 @@ export default {
password: "",
rememberMe: false,
code: "",
uuid: ""
uuid: "",
},
loginRules: {
username: [
{ required: true, trigger: "blur", message: "请输入您的账号" }
{ required: true, trigger: "blur", message: "请输入您的账号" },
],
password: [
{ required: true, trigger: "blur", message: "请输入您的密码" }
{ required: true, trigger: "blur", message: "请输入您的密码" },
],
code: [{ required: true, trigger: "change", message: "请输入验证码" }]
code: [{ required: true, trigger: "change", message: "请输入验证码" }],
},
loading: false,
//
captchaOnOff: true,
//
register: false,
redirect: undefined
redirect: undefined,
};
},
watch: {
$route: {
handler: function(route) {
handler: function (route) {
this.redirect = route.query && route.query.redirect;
},
immediate: true
}
immediate: true,
},
},
created() {
this.getCode();
@ -109,8 +148,9 @@ export default {
},
methods: {
getCode() {
getCodeImg().then(res => {
this.captchaOnOff = res.captchaOnOff === undefined ? true : res.captchaOnOff;
getCodeImg().then((res) => {
this.captchaOnOff =
res.captchaOnOff === undefined ? true : res.captchaOnOff;
if (this.captchaOnOff) {
this.codeUrl = "data:image/gif;base64," + res.img;
this.loginForm.uuid = res.uuid;
@ -120,61 +160,93 @@ export default {
getCookie() {
const username = Cookies.get("username");
const password = Cookies.get("password");
const rememberMe = Cookies.get('rememberMe')
const rememberMe = Cookies.get("rememberMe");
this.loginForm = {
username: username === undefined ? this.loginForm.username : username,
password: password === undefined ? this.loginForm.password : decrypt(password),
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
password:
password === undefined ? this.loginForm.password : decrypt(password),
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe),
};
},
handleLogin() {
this.$refs.loginForm.validate(valid => {
this.$refs.loginForm.validate((valid) => {
if (valid) {
this.loading = true;
if (this.loginForm.rememberMe) {
Cookies.set("username", this.loginForm.username, { expires: 30 });
Cookies.set("password", encrypt(this.loginForm.password), { expires: 30 });
Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 });
Cookies.set("password", encrypt(this.loginForm.password), {
expires: 30,
});
Cookies.set("rememberMe", this.loginForm.rememberMe, {
expires: 30,
});
} else {
Cookies.remove("username");
Cookies.remove("password");
Cookies.remove('rememberMe');
Cookies.remove("rememberMe");
}
this.$store.dispatch("Login", this.loginForm).then(() => {
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
}).catch(() => {
this.loading = false;
if (this.captchaOnOff) {
this.getCode();
}
});
this.$store
.dispatch("Login", this.loginForm)
.then(() => {
this.$router.push({ path: this.redirect || "/" }).catch(() => {});
setTimeout(() => {
this.loading = false;
}, 1500);
})
.catch(() => {
this.loading = false;
if (this.captchaOnOff) {
this.getCode();
}
});
}
});
}
}
},
},
};
</script>
<style rel="stylesheet/scss" lang="scss">
<style rel="stylesheet/scss" lang="scss" scoped>
.bg {
position: absolute;
}
// .el-input el-input--medium el-input--prefix{
// height: 50px;
// line-height: 36px;
// background-color: red;
// border: none;
// border-radius: 10px;
// }
.el-input--medium ::v-deep .el-input__inner {
height: 50px;
line-height: 36px;
// background-color: red;
border: none;
border: 1px solid #e5e5e5;
border-radius: 36px;
}
.login {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
background-image: url("../assets/images/login-background.jpg");
background-image: url("../assets/images/bg2.png");
background-size: cover;
}
.title {
margin: 0px auto 30px auto;
margin: 0px 40px 30px auto;
text-align: center;
color: #707070;
}
.login-form {
margin-left: 20%;
border-radius: 6px;
background: #ffffff;
width: 400px;
padding: 25px 25px 5px 25px;
z-index: 999;
margin-right: 50%;
.el-input {
height: 38px;
input {
@ -184,7 +256,8 @@ export default {
.input-icon {
height: 39px;
width: 14px;
margin-left: 2px;
margin-left: 5px;
margin-top: 5px;
}
}
.login-tip {
@ -196,6 +269,7 @@ export default {
width: 33%;
height: 38px;
float: right;
margin-right: 30px;
img {
cursor: pointer;
vertical-align: middle;
@ -215,5 +289,20 @@ export default {
}
.login-code-img {
height: 38px;
margin-top: 5px;
}
// .el-button{
// background-image: linear-gradient(to right , #90C8DF, #4CA8CD);
// border-radius: -33px;
// border: none;
// height: 50px;
// color: #FFFFFF;
// border-radius: 20px;
// }
// .el-button--primary {
// color: #FFFFFF;
// // background-color: #1890ff;
// // border-color: #1890ff;
// }
</style>

View File

@ -1,7 +1,7 @@
<template>
<div class="register">
<el-form ref="registerForm" :model="registerForm" :rules="registerRules" class="register-form">
<h3 class="title">若依后台管理系统</h3>
<h3 class="title">泉医到家护理站管理平台</h3>
<el-form-item prop="username">
<el-input v-model="registerForm.username" type="text" auto-complete="off" placeholder="账号">
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
@ -61,7 +61,7 @@
</el-form>
<!-- 底部 -->
<div class="el-register-footer">
<span>Copyright © 2018-2022 xinelu.vip All Rights Reserved.</span>
<span>Copyright © 2018-2022 xinyilu.vip All Rights Reserved.</span>
</div>
</div>
</template>
@ -151,7 +151,7 @@ export default {
justify-content: center;
align-items: center;
height: 100%;
background-image: url("../assets/images/login-background.jpg");
background-image: url("../assets/images/bg.png");
background-size: cover;
}
.title {

View File

@ -302,15 +302,19 @@ export default {
if (valid) {
if (this.form.configId != undefined) {
updateConfig(this.form).then(response => {
if (response.code == 200) {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
}
});
} else {
addConfig(this.form).then(response => {
if (response.code == 200) {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
}
});
}
}

View File

@ -308,15 +308,19 @@ export default {
if (valid) {
if (this.form.deptId != undefined) {
updateDept(this.form).then(response => {
if (response.code == 200) {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
}
});
} else {
addDept(this.form).then(response => {
if (response.code == 200) {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
}
});
}
}

View File

@ -425,15 +425,19 @@ export default {
if (valid) {
if (this.form.menuId != undefined) {
updateMenu(this.form).then(response => {
if (response.code == 200) {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
}
});
} else {
addMenu(this.form).then(response => {
if (response.code == 200) {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
}
});
}
}

View File

@ -283,15 +283,19 @@ export default {
if (valid) {
if (this.form.noticeId != undefined) {
updateNotice(this.form).then(response => {
if (response.code == 200) {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
}
});
} else {
addNotice(this.form).then(response => {
if (response.code == 200) {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
}
});
}
}

View File

@ -2,7 +2,7 @@
<div class="app-container">
<el-row :gutter="20">
<!--部门数据-->
<el-col :span="4" :xs="24">
<!-- <el-col :span="4" :xs="24">
<div class="head-container">
<el-input
v-model="deptName"
@ -25,10 +25,17 @@
@node-click="handleNodeClick"
/>
</div>
</el-col>
</el-col>-->
<!--用户数据-->
<el-col :span="20" :xs="24">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-col :span="24" :xs="24">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="用户名称" prop="userName">
<el-input
v-model="queryParams.userName"
@ -112,7 +119,7 @@
v-hasPermi="['system:user:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<!-- <el-col :span="1.5">
<el-button
type="info"
plain
@ -131,17 +138,44 @@
@click="handleExport"
v-hasPermi="['system:user:export']"
>导出</el-button>
</el-col>
</el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns[0].visible" />
<el-table-column label="用户名称" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
<el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" />
<el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" />
<el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns[4].visible" width="120" />
<el-table-column
label="用户编号"
align="center"
key="userId"
prop="userId"
v-if="columns[0].visible"
/>
<el-table-column
label="用户名称"
align="center"
key="userName"
prop="userName"
v-if="columns[1].visible"
:show-overflow-tooltip="true"
/>
<el-table-column
label="用户昵称"
align="center"
key="nickName"
prop="nickName"
v-if="columns[2].visible"
:show-overflow-tooltip="true"
/>
<!-- <el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" /> -->
<el-table-column
label="手机号码"
align="center"
key="phonenumber"
prop="phonenumber"
v-if="columns[4].visible"
width="120"
/>
<el-table-column label="状态" align="center" key="status" v-if="columns[5].visible">
<template slot-scope="scope">
<el-switch
@ -152,7 +186,13 @@
></el-switch>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[6].visible" width="160">
<el-table-column
label="创建时间"
align="center"
prop="createTime"
v-if="columns[6].visible"
width="160"
>
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
@ -178,15 +218,25 @@
@click="handleDelete(scope.row)"
v-hasPermi="['system:user:remove']"
>删除</el-button>
<el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['system:user:resetPwd', 'system:user:edit']">
<el-dropdown
size="mini"
@command="(command) => handleCommand(command, scope.row)"
v-hasPermi="['system:user:resetPwd', 'system:user:edit']"
>
<span class="el-dropdown-link">
<i class="el-icon-d-arrow-right el-icon--right"></i>更多
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="handleResetPwd" icon="el-icon-key"
v-hasPermi="['system:user:resetPwd']">重置密码</el-dropdown-item>
<el-dropdown-item command="handleAuthRole" icon="el-icon-circle-check"
v-hasPermi="['system:user:edit']">分配角色</el-dropdown-item>
<el-dropdown-item
command="handleResetPwd"
icon="el-icon-key"
v-hasPermi="['system:user:resetPwd']"
>重置密码</el-dropdown-item>
<el-dropdown-item
command="handleAuthRole"
icon="el-icon-circle-check"
v-hasPermi="['system:user:edit']"
>分配角色</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
@ -194,7 +244,7 @@
</el-table>
<pagination
v-show="total>0"
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@ -202,7 +252,6 @@
/>
</el-col>
</el-row>
<!-- 添加或修改用户配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
@ -213,10 +262,22 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="用户性别">
<el-select v-model="form.sex" placeholder="请选择性别">
<el-option
v-for="dict in dict.type.sys_user_sex"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
<!-- <el-col :span="12">
<el-form-item label="归属部门" prop="deptId">
<treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />
</el-form-item>
</el-col>
</el-col>-->
</el-row>
<el-row>
<el-col :span="12">
@ -238,19 +299,25 @@
</el-col>
<el-col :span="12">
<el-form-item v-if="form.userId == undefined" label="用户密码" prop="password">
<el-input v-model="form.password" placeholder="请输入用户密码" type="password" maxlength="20" show-password/>
<el-input
v-model="form.password"
placeholder="请输入用户密码"
type="password"
maxlength="20"
show-password
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="用户性别">
<el-select v-model="form.sex" placeholder="请选择性别">
<el-form-item label="护理站" prop="nurseStationIds">
<el-select v-model="form.nurseStationIdstwo" placeholder="请选择护理站" multiple>
<el-option
v-for="dict in dict.type.sys_user_sex"
:key="dict.value"
:label="dict.label"
:value="dict.value"
v-for="item in nurseStationlist"
:key="item.id"
:label="item.nurseStationName"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
@ -262,13 +329,13 @@
v-for="dict in dict.type.sys_normal_disable"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
>{{ dict.label }}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<!-- <el-col :span="12">
<el-form-item label="岗位">
<el-select v-model="form.postIds" multiple placeholder="请选择岗位">
<el-option
@ -280,7 +347,7 @@
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-col>-->
<el-col :span="12">
<el-form-item label="角色">
<el-select v-model="form.roleIds" multiple placeholder="请选择角色">
@ -308,7 +375,6 @@
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 用户导入对话框 -->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-upload
@ -324,13 +390,21 @@
drag
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__text">
将文件拖到此处
<em>点击上传</em>
</div>
<div class="el-upload__tip text-center" slot="tip">
<div class="el-upload__tip" slot="tip">
<el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的用户数据
<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
</div>
<span>仅允许导入xlsxlsx格式文件</span>
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link>
<el-link
type="primary"
:underline="false"
style="font-size: 12px; vertical-align: baseline"
@click="importTemplate"
>下载模板</el-link>
</div>
</el-upload>
<div slot="footer" class="dialog-footer">
@ -340,17 +414,24 @@
</el-dialog>
</div>
</template>
<script>
import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus } from "@/api/system/user";
import {
listUser,
getUser,
delUser,
addUser,
updateUser,
resetUserPwd,
changeUserStatus
} from "@/api/system/user";
import { getToken } from "@/utils/auth";
import { treeselect } from "@/api/system/dept";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import { list } from "@/api/system/stationConsumable";
export default {
name: "User",
dicts: ['sys_normal_disable', 'sys_user_sex'],
dicts: ["sys_normal_disable", "sys_user_sex"],
components: { Treeselect },
data() {
return {
@ -366,6 +447,8 @@ export default {
showSearch: true,
//
total: 0,
total2: 0,
nurseStationlist: [],
//
userList: null,
//
@ -414,6 +497,26 @@ export default {
status: undefined,
deptId: undefined
},
//
nurseStationqueryParams: {
pageNum: 1,
pageSize: 999,
areaCode: null,
userId: null,
nurseStationCode: null,
nurseStationName: null,
nurseStationType: null,
agencyIntroduce: null,
nurseStationDescription: null,
longitude: null,
latitude: null,
phone: null,
address: null,
dutyPerson: null,
dutyPhone: null,
stationPictureUrl: null,
sort: null
},
//
columns: [
{ key: 0, label: `用户编号`, visible: true },
@ -428,14 +531,27 @@ export default {
rules: {
userName: [
{ required: true, message: "用户名称不能为空", trigger: "blur" },
{ min: 2, max: 20, message: '用户名称长度必须介于 2 和 20 之间', trigger: 'blur' }
{
min: 2,
max: 20,
message: "用户名称长度必须介于 2 和 20 之间",
trigger: "blur"
}
],
// nurseStationIds: [
// { required: true, message: "", trigger: "blur" },
// ],
nickName: [
{ required: true, message: "用户昵称不能为空", trigger: "blur" }
],
password: [
{ required: true, message: "用户密码不能为空", trigger: "blur" },
{ min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' }
{
min: 5,
max: 20,
message: "用户密码长度必须介于 5 和 20 之间",
trigger: "blur"
}
],
email: [
{
@ -463,15 +579,23 @@ export default {
created() {
this.getList();
this.getTreeselect();
this.listinfo();
this.getConfigKey("sys.user.initPassword").then(response => {
this.initPassword = response.msg;
});
},
methods: {
listinfo() {
list(this.nurseStationqueryParams).then(res => {
this.nurseStationlist = res.rows;
this.total2 = res.total;
});
},
/** 查询用户列表 */
getList() {
this.loading = true;
listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
listUser(this.addDateRange(this.queryParams, this.dateRange)).then(
response => {
this.userList = response.rows;
this.total = response.total;
this.loading = false;
@ -497,13 +621,17 @@ export default {
//
handleStatusChange(row) {
let text = row.status === "0" ? "启用" : "停用";
this.$modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗?').then(function() {
return changeUserStatus(row.userId, row.status);
}).then(() => {
this.$modal.msgSuccess(text + "成功");
}).catch(function() {
row.status = row.status === "0" ? "1" : "0";
});
this.$modal
.confirm('确认要"' + text + '""' + row.userName + '"用户吗?')
.then(function() {
return changeUserStatus(row.userId, row.status);
})
.then(() => {
this.$modal.msgSuccess(text + "成功");
})
.catch(function() {
row.status = row.status === "0" ? "1" : "0";
});
},
//
cancel() {
@ -524,7 +652,9 @@ export default {
status: "0",
remark: undefined,
postIds: [],
roleIds: []
roleIds: [],
nurseStationIdstwo: null,
nurseStationIds: null
};
this.resetForm("form");
},
@ -576,7 +706,28 @@ export default {
this.getTreeselect();
const userId = row.userId || this.ids;
getUser(userId).then(response => {
response.data.nurseStationIdstwo = JSON.parse(
JSON.stringify(response.data.nurseStationIds)
);
this.form = response.data;
if (this.form.nurseStationIds) {
this.form.nurseStationIdstwo = this.form.nurseStationIdstwo.split(
","
);
this.form.nurseStationIdstwo = this.form.nurseStationIdstwo.map(e => {
return (e = Number(e));
});
// this.form.nurseStationIds = [];
} else {
// this.form.nurseStationIds = Number(this.form.nurseStationIds);
}
// if (
// !this.form.nurseStationIds ||
// this.form.nurseStationIds == null ||
// this.form.nurseStationIds.length == 0
// ) {getList
// } else {
// }
this.postOptions = response.posts;
this.roleOptions = response.roles;
this.form.postIds = response.postIds;
@ -594,11 +745,13 @@ export default {
closeOnClickModal: false,
inputPattern: /^.{5,20}$/,
inputErrorMessage: "用户密码长度必须介于 5 和 20 之间"
}).then(({ value }) => {
})
.then(({ value }) => {
resetUserPwd(row.userId, value).then(response => {
this.$modal.msgSuccess("修改成功,新密码是:" + value);
});
}).catch(() => {});
})
.catch(() => {});
},
/** 分配角色操作 */
handleAuthRole: function(row) {
@ -609,13 +762,31 @@ export default {
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
// this.form.nurseStationIds = JSON.stringify(this.form.nurseStationIds);
// var obj = [];
// obj.push(this.form.nurseStationIds);
// this.form.nurseStationIds = obj;
if (this.form.userId != undefined) {
if (!this.form.nurseStationIdstwo) {
this.form.nurseStationIds = null;
} else {
this.form.nurseStationIds = this.form.nurseStationIdstwo.join(
","
);
}
updateUser(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
if (this.form.nurseStationIdstwo) {
this.form.nurseStationIds = this.form.nurseStationIdstwo.join(
","
);
} else {
this.form.nurseStationIds = null;
}
addUser(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
@ -628,18 +799,26 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const userIds = row.userId || this.ids;
this.$modal.confirm('是否确认删除用户编号为"' + userIds + '"的数据项?').then(function() {
return delUser(userIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
this.$modal
.confirm("是否确认删除此用户?")
.then(function() {
return delUser(userIds);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/user/export', {
...this.queryParams
}, `user_${new Date().getTime()}.xlsx`)
this.download(
"system/user/export",
{
...this.queryParams
},
`user_${new Date().getTime()}.xlsx`
);
},
/** 导入按钮操作 */
handleImport() {
@ -648,8 +827,11 @@ export default {
},
/** 下载模板操作 */
importTemplate() {
this.download('system/user/importTemplate', {
}, `user_template_${new Date().getTime()}.xlsx`)
this.download(
"system/user/importTemplate",
{},
`user_template_${new Date().getTime()}.xlsx`
);
},
//
handleFileUploadProgress(event, file, fileList) {
@ -660,7 +842,13 @@ export default {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
this.$alert(
"<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
response.msg +
"</div>",
"导入结果",
{ dangerouslyUseHTMLString: true }
);
this.getList();
},
//
@ -669,4 +857,4 @@ export default {
}
}
};
</script>
</script>

View File

@ -15,7 +15,7 @@
<el-form-item prop="packageName">
<span slot="label">
生成包路径
<el-tooltip content="生成在哪个java包下例如 com.xinelu.system" placement="top">
<el-tooltip content="生成在哪个java包下例如 com.xinyilu.system" placement="top">
<i class="el-icon-question"></i>
</el-tooltip>
</span>

View File

@ -267,7 +267,7 @@ export default {
this.$modal.msgSuccess("成功生成到自定义路径:" + row.genPath);
});
} else {
this.$download.zip("/tool/gen/batchGenCode?tables=" + tableNames, "xinelu");
this.$download.zip("/tool/gen/batchGenCode?tables=" + tableNames, "xinyilu");
}
},
/** 同步数据库操作 */