Commit eea5626e by xinla

修改环境配置方式,提供无打包配置方式

1 parent bcbfdd26
# 开发环境配置
ENV = 'development'
# 基础api(根据实际情况,自行配置,下为示例)
VUE_APP_DOMAIN = 'http://demo.linkwechat.cn'
VUE_APP_BASE_API = 'http://demo.linkwechat.cn/dev-api'
VUE_APP_SYSTEM_API = '/dev-api'
VUE_APP_KF_API = '/dev-kf'
# 路由基础路径
VUE_APP_BASE_URL = '/'
\ No newline at end of file \ No newline at end of file
# 生产环境配置
ENV = 'production'
# 基础api
VUE_APP_DOMAIN = 'http://demo.linkwechat.cn'
VUE_APP_BASE_API = 'http://demo.linkwechat.cn/prod-api'
VUE_APP_SYSTEM_API = '/prod-api'
VUE_APP_KF_API = '/prod-kf'
# 路由基础路径
VUE_APP_BASE_URL = '/'
\ No newline at end of file \ No newline at end of file
# 测试环境配置
# 打包环境变量
NODE_ENV = 'production'
# 运行环境变量
VUE_APP_ENV = 'test'
# 基础api
VUE_APP_DOMAIN = 'http://demo.linkwechat.cn'
VUE_APP_BASE_API = 'http://demo.linkwechat.cn/dev-api'
VUE_APP_SYSTEM_API = '/dev-api'
VUE_APP_KF_API = '/dev-kf'
# 路由基础路径
VUE_APP_BASE_URL = '/dev/'
const envs = {
development: {
DOMAIN: 'http://demo.linkwechat.cn',
BASE_URL: '/', // 路由基础路径
BASE_API: 'http://demo.linkwechat.cn/dev-api',
SYSTEM_API: '/dev-api',
KF_API: '/dev-kf',
},
test: {
DOMAIN: 'http://demo.linkwechat.cn',
BASE_URL: '/dev/', // 路由基础路径
BASE_API: 'http://demo.linkwechat.cn/dev-api',
SYSTEM_API: '/dev-api',
KF_API: '/dev-kf',
},
production: {
DOMAIN: 'http://demo.linkwechat.cn',
BASE_URL: '/', // 路由基础路径
BASE_API: 'http://demo.linkwechat.cn/prod-api',
SYSTEM_API: '/prod-api',
KF_API: '/prod-kf',
},
}
const env = envs[process.env.VUE_APP_ENV || process.env.NODE_ENV]
module.exports = env
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",
"build": "vue-cli-service build", "build": "vue-cli-service build",
"test": "vue-cli-service build --mode test", "test": "vue-cli-service build --ENV=test",
"preview": "node build/index.js --preview", "preview": "node build/index.js --preview",
"lint": "eslint --ext .js,.vue src", "lint": "eslint --ext .js,.vue src",
"test:unit": "jest --clearCache && vue-cli-service test:unit", "test:unit": "jest --clearCache && vue-cli-service test:unit",
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<title> <title>
<%= VUE_APP_TITLE %> <%= VUE_APP_TITLE %>
</title> </title>
<script src="./static/config.js"></script>
<style> <style>
html, html,
body, body,
......
// 用于无打包配置,会覆盖系统相关配置
// window.lwConfig = {
// DOMAIN: 'http://demo.linkwechat.cn',
// BASE_URL: '/', // 路由基础路径
// BASE_API: 'http://demo.linkwechat.cn/prod-api',
// SYSTEM_API: '/prod-api',
// KF_API: '/prod-kf',
// }
...@@ -7,7 +7,7 @@ export function upload(data) { ...@@ -7,7 +7,7 @@ export function upload(data) {
return request({ return request({
url: service + '/uploadFile2Cos', url: service + '/uploadFile2Cos',
method: 'POST', method: 'POST',
data data,
}) })
} }
...@@ -21,7 +21,7 @@ export function upload(data) { ...@@ -21,7 +21,7 @@ export function upload(data) {
*/ */
export function download(url, name) { export function download(url, name) {
return ( return (
process.env.VUE_APP_DOMAIN + window.lwConfig.DOMAIN +
window.CONFIG.services.system + window.CONFIG.services.system +
`/common/download/url?url=${url}&name=${name}` `/common/download/url?url=${url}&name=${name}`
) )
...@@ -43,6 +43,6 @@ export function uploadDataURL(dataURL) { ...@@ -43,6 +43,6 @@ export function uploadDataURL(dataURL) {
url: window.CONFIG.services.system + '/common/uploadFile2Cos', url: window.CONFIG.services.system + '/common/uploadFile2Cos',
method: 'post', method: 'post',
processData: false, processData: false,
data data,
}) })
} }
import request from '@/utils/request' import request from '@/utils/request'
const service = process.env.VUE_APP_KF_API const service = window.lwConfig.KF_API
// 同步客服 // 同步客服
export function setAsync () { export function setAsync() {
return request({ return request({
url: service + '/wecom/kf/list/async' url: service + '/wecom/kf/list/async',
}) })
} }
// 客服接待人员列表 // 客服接待人员列表
export function getMemeberInCustomer (data) { export function getMemeberInCustomer(data) {
return request({ return request({
url: service + '/wecom/kf/servicer/list', url: service + '/wecom/kf/servicer/list',
params: data params: data,
}) })
} }
// 客服列表 // 客服列表
export function getList (params) { export function getList(params) {
console.log(service) console.log(service)
return request({ return request({
url: service + '/wecom/kf/list', url: service + '/wecom/kf/list',
params params,
}) })
} }
// 新增客服 // 新增客服
export function addService (data) { export function addService(data) {
return request({ return request({
url: service + '/wecom/kf/add', url: service + '/wecom/kf/add',
method: 'post', method: 'post',
data: data data: data,
}) })
} }
// 客服编辑 // 客服编辑
export function editService (data) { export function editService(data) {
return request({ return request({
url: service + '/wecom/kf/edit/account', url: service + '/wecom/kf/edit/account',
method: 'post', method: 'post',
data: data data: data,
}) })
} }
// 删除客服 // 删除客服
export function remove (id) { export function remove(id) {
return request({ return request({
url: service + '/wecom/kf/delete/' + id, url: service + '/wecom/kf/delete/' + id,
method: 'delete' method: 'delete',
}) })
} }
// 客服详情 // 客服详情
export function getDetail (id) { export function getDetail(id) {
return request({ return request({
url: service + '/wecom/kf/get/' + id url: service + '/wecom/kf/get/' + id,
}) })
} }
// 批量下载场景二维码 // 批量下载场景二维码
export function downloadBatch (ids) { export function downloadBatch(ids) {
return request({ return request({
url: service + "/wecom/kf/scenes/batch/download", url: service + '/wecom/kf/scenes/batch/download',
params: { params: {
ids: ids ids: ids,
}, },
responseType: 'blob' responseType: 'blob',
}) })
} }
// 场景列表 // 场景列表
export function getSceneList (params) { export function getSceneList(params) {
return request({ return request({
url: service + '/wecom/kf/scenes/list', url: service + '/wecom/kf/scenes/list',
params params,
}) })
} }
// 新增场景 // 新增场景
export function addScene (data) { export function addScene(data) {
return request({ return request({
url: service + '/wecom/kf/scenes/add', url: service + '/wecom/kf/scenes/add',
data: data, data: data,
method: 'post' method: 'post',
}) })
} }
// 编辑场景 // 编辑场景
export function editScene (data) { export function editScene(data) {
return request({ return request({
url: service + '/wecom/kf/scenes/edit', url: service + '/wecom/kf/scenes/edit',
data: data, data: data,
method: 'put' method: 'put',
}) })
} }
// 删除场景 // 删除场景
export function deleteScene (ids) { export function deleteScene(ids) {
console.log(33333) console.log(33333)
return request({ return request({
url: service + '/wecom/kf/scenes/delete/' + ids, url: service + '/wecom/kf/scenes/delete/' + ids,
method: 'delete' method: 'delete',
}) })
} }
// 咨询记录列表 // 咨询记录列表
export function getResultList (params) { export function getResultList(params) {
return request({ return request({
url: service + '/wecom/kf/record/list', url: service + '/wecom/kf/record/list',
params params,
}) })
} }
// 咨询记录导出 // 咨询记录导出
export function exportResult (params) { export function exportResult(params) {
return request({ return request({
url: service + '/wecom/kf/record/export', url: service + '/wecom/kf/record/export',
params: params params: params,
}) })
} }
// 咨询记录详情 // 咨询记录详情
export function getResultDetail (params) { export function getResultDetail(params) {
return request({ return request({
url: service + '/wecom/kf/record/detail', url: service + '/wecom/kf/record/detail',
params: params params: params,
}) })
} }
// 场景分析 抬头数据 // 场景分析 抬头数据
export function getSceneTotal () { export function getSceneTotal() {
return request({ return request({
url: service + '/wecom/kf/statistic/scene/getAnalysis' url: service + '/wecom/kf/statistic/scene/getAnalysis',
}) })
} }
// 场景分析 数据趋势 客户总数/实时数据 // 场景分析 数据趋势 客户总数/实时数据
export function getLineChartTotal (params) { export function getLineChartTotal(params) {
return request({ return request({
url: service + '/wecom/kf/statistic/scene/getRealCnt', url: service + '/wecom/kf/statistic/scene/getRealCnt',
params params,
}) })
} }
// 场景分析 访问场景 top5 // 场景分析 访问场景 top5
export function getBarTop5Total (params) { export function getBarTop5Total(params) {
return request({ return request({
url: service + '/wecom/kf/statistic/scene/getRankCnt', url: service + '/wecom/kf/statistic/scene/getRankCnt',
params params,
}) })
} }
// 场景分析 数据报表 // 场景分析 数据报表
export function getTableTotal (params) { export function getTableTotal(params) {
return request({ return request({
url: service + '/wecom/kf/statistic/scene/getRealPageCnt', url: service + '/wecom/kf/statistic/scene/getRealPageCnt',
params params,
}) })
} }
// 场景分析 数据报表 导出 // 场景分析 数据报表 导出
export function getTableExport (params) { export function getTableExport(params) {
return request({ return request({
url: service + '/wecom/kf/statistic/scene/real/export', url: service + '/wecom/kf/statistic/scene/real/export',
params params,
}) })
} }
// 咨询分析 抬头数据 // 咨询分析 抬头数据
export function getConsultTotal () { export function getConsultTotal() {
return request({ return request({
url: service + '/wecom/kf/statistic/consult/getAnalysis' url: service + '/wecom/kf/statistic/consult/getAnalysis',
}) })
} }
// 咨询分析 数据趋势 客户总数/实时数据 // 咨询分析 数据趋势 客户总数/实时数据
export function getConsultLineChartTotal (params) { export function getConsultLineChartTotal(params) {
return request({ return request({
url: service + '/wecom/kf/statistic/consult/getRealCnt', url: service + '/wecom/kf/statistic/consult/getRealCnt',
params params,
}) })
} }
// 咨询分析 访问场景 top5 // 咨询分析 访问场景 top5
export function getConsultBarTop5Total (params) { export function getConsultBarTop5Total(params) {
return request({ return request({
url: service + '/wecom/kf/statistic/consult/getRankCnt', url: service + '/wecom/kf/statistic/consult/getRankCnt',
params params,
}) })
} }
// 咨询分析 数据报表 // 咨询分析 数据报表
export function getConsultTableTotal (params) { export function getConsultTableTotal(params) {
return request({ return request({
url: service + '/wecom/kf/statistic/consult/getRealPageCnt', url: service + '/wecom/kf/statistic/consult/getRealPageCnt',
params params,
}) })
} }
// 咨询分析 数据报表 导出 // 咨询分析 数据报表 导出
export function getConsultTableExport (params) { export function getConsultTableExport(params) {
return request({ return request({
url: service + '/wecom/kf/statistic/consult/real/export', url: service + '/wecom/kf/statistic/consult/real/export',
params params,
}) })
}
\ No newline at end of file \ No newline at end of file
}
...@@ -8,32 +8,32 @@ export default { ...@@ -8,32 +8,32 @@ export default {
props: { props: {
fileUrl: { fileUrl: {
type: String, type: String,
default: '' default: '',
}, },
fileName: { fileName: {
type: String, type: String,
default: '' default: '',
}, },
// 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file) // 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file)
type: { type: {
type: String, type: String,
default: '0' default: '0',
}, },
// 上传文件大小不能超过 maxSize MB // 上传文件大小不能超过 maxSize MB
maxSize: { maxSize: {
type: Number, type: Number,
default: 2 default: 2,
}, },
// 图片的宽高像素限制 [width(number), height(number)],默认null不限制 // 图片的宽高像素限制 [width(number), height(number)],默认null不限制
maxImgPx: { maxImgPx: {
type: Array, type: Array,
default: null // () => [100, 100] default: null, // () => [100, 100]
}, },
// 限制允许上传的文件格式 eg:["bmp", "jpg", "png", "jpeg", "gif"] // 限制允许上传的文件格式 eg:["bmp", "jpg", "png", "jpeg", "gif"]
format: { format: {
type: Array, type: Array,
default: null default: null,
} },
// beforeUpload: { // beforeUpload: {
// type: Function, // type: Function,
// default: function() { // default: function() {
...@@ -44,19 +44,19 @@ export default { ...@@ -44,19 +44,19 @@ export default {
data() { data() {
return { return {
loading: false, loading: false,
action: process.env.VUE_APP_BASE_API + '/common/uploadFile2Cos', action: window.lwConfig.BASE_API + '/common/uploadFile2Cos',
// (this.type == 0 // (this.type == 0
// ? '/wecom/material/uploadimg' // ? '/wecom/material/uploadimg'
// : '/common/uploadFile2Cos'), // : '/common/uploadFile2Cos'),
headers: window.CONFIG.headers, headers: window.CONFIG.headers,
domain: process.env.VUE_APP_BASE_API domain: window.lwConfig.BASE_API,
} }
}, },
watch: {}, watch: {},
computed: { computed: {
accept() { accept() {
return ['image/*', 'amr/*', 'video/*', '*'][this.type] return ['image/*', 'amr/*', 'video/*', '*'][this.type]
} },
}, },
created() {}, created() {},
mounted() {}, mounted() {},
...@@ -195,8 +195,8 @@ export default { ...@@ -195,8 +195,8 @@ export default {
onError(err, file, fileList) { onError(err, file, fileList) {
this.loading = false this.loading = false
this.$message.error('上传文件失败') this.$message.error('上传文件失败')
} },
} },
} }
</script> </script>
......
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
import env from '../env'
window.lwConfig = Object.assign(env, window.lwConfig || {})
window.CONFIG = { window.CONFIG = {
/** /**
* 是否系统布局配置 * 是否系统布局配置
...@@ -31,8 +32,8 @@ window.CONFIG = { ...@@ -31,8 +32,8 @@ window.CONFIG = {
services: { services: {
wecom: '/wecom', wecom: '/wecom',
kf: process.env.VUE_APP_KF_API, kf: window.lwConfig.KF_API,
system: process.env.VUE_APP_SYSTEM_API, system: window.lwConfig.SYSTEM_API,
common: '/common', common: '/common',
}, },
...@@ -54,7 +55,7 @@ document.addEventListener( ...@@ -54,7 +55,7 @@ document.addEventListener(
let target = e.target let target = e.target
let src = target.attributes.getNamedItem('src').value let src = target.attributes.getNamedItem('src').value
if (target.tagName.toUpperCase() === 'IMG' && src && !src.includes('http')) { if (target.tagName.toUpperCase() === 'IMG' && src && !src.includes('http')) {
target.src = process.env.VUE_APP_BASE_API + src target.src = window.lwConfig.BASE_API + src
} }
}, },
true true
......
...@@ -100,7 +100,7 @@ export default { ...@@ -100,7 +100,7 @@ export default {
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$store.dispatch('LogOut').then(() => { this.$store.dispatch('LogOut').then(() => {
location.href = process.env.VUE_APP_BASE_URL location.href = window.lwConfig.BASE_URL
}) })
}) })
}, },
......
...@@ -8,7 +8,7 @@ const user = { ...@@ -8,7 +8,7 @@ const user = {
companyName: '', companyName: '',
avatar: '', avatar: '',
roles: [], roles: [],
permissions: [] permissions: [],
}, },
mutations: { mutations: {
...@@ -26,7 +26,7 @@ const user = { ...@@ -26,7 +26,7 @@ const user = {
}, },
SET_PERMISSIONS: (state, permissions) => { SET_PERMISSIONS: (state, permissions) => {
state.permissions = permissions state.permissions = permissions
} },
}, },
actions: { actions: {
...@@ -58,7 +58,7 @@ const user = { ...@@ -58,7 +58,7 @@ const user = {
const avatar = const avatar =
user.avatar == '' user.avatar == ''
? require('@/assets/image/profile.jpg') ? require('@/assets/image/profile.jpg')
: process.env.VUE_APP_BASE_API + user.avatar : window.lwConfig.BASE_API + user.avatar
if (res.roles && res.roles.length > 0) { if (res.roles && res.roles.length > 0) {
// 验证返回的roles是否是一个非空数组 // 验证返回的roles是否是一个非空数组
commit('SET_ROLES', res.roles) commit('SET_ROLES', res.roles)
...@@ -101,8 +101,8 @@ const user = { ...@@ -101,8 +101,8 @@ const user = {
removeToken() removeToken()
resolve() resolve()
}) })
} },
} },
} }
export default user export default user
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* 通用js方法封装处理 * 通用js方法封装处理
*/ */
const baseURL = process.env.VUE_APP_BASE_API const baseURL = window.lwConfig.BASE_API
// 日期格式化 // 日期格式化
export function parseTime(time, pattern) { export function parseTime(time, pattern) {
...@@ -31,7 +31,7 @@ export function parseTime(time, pattern) { ...@@ -31,7 +31,7 @@ export function parseTime(time, pattern) {
h: date.getHours(), h: date.getHours(),
i: date.getMinutes(), i: date.getMinutes(),
s: date.getSeconds(), s: date.getSeconds(),
a: date.getDay() a: date.getDay(),
} }
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => { const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
let value = formatObj[key] let value = formatObj[key]
......
...@@ -8,9 +8,9 @@ axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8' ...@@ -8,9 +8,9 @@ axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
// 创建axios实例 // 创建axios实例
const service = axios.create({ const service = axios.create({
// axios中请求配置有baseURL选项,表示请求URL公共部分 // axios中请求配置有baseURL选项,表示请求URL公共部分
baseURL: process.env.NODE_ENV === 'development' ? 'api' : process.env.VUE_APP_DOMAIN, baseURL: process.env.NODE_ENV === 'development' ? 'api' : window.lwConfig.DOMAIN,
// 超时 // 超时
timeout: 10000 timeout: 10000,
}) })
// request拦截器 // request拦截器
service.interceptors.request.use( service.interceptors.request.use(
...@@ -41,10 +41,10 @@ service.interceptors.response.use( ...@@ -41,10 +41,10 @@ service.interceptors.response.use(
MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
confirmButtonText: '重新登录', confirmButtonText: '重新登录',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning',
}).then(() => { }).then(() => {
store.dispatch('LogOut').then(() => { store.dispatch('LogOut').then(() => {
location.href = process.env.VUE_APP_BASE_URL location.href = window.lwConfig.BASE_URL
}) })
}) })
} }
...@@ -61,11 +61,11 @@ service.interceptors.response.use( ...@@ -61,11 +61,11 @@ service.interceptors.response.use(
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
Message({ Message({
message: `后端错误:接口:${res.config.url},${code}错误:${msg}`, message: `后端错误:接口:${res.config.url},${code}错误:${msg}`,
type: 'error' type: 'error',
}) })
} else { } else {
Notification.error({ Notification.error({
title: msg title: msg,
}) })
} }
return Promise.reject() return Promise.reject()
...@@ -85,7 +85,7 @@ service.interceptors.response.use( ...@@ -85,7 +85,7 @@ service.interceptors.response.use(
Message({ Message({
message: `${msg}:${config.url}`, message: `${msg}:${config.url}`,
type: 'error', type: 'error',
duration: 5 * 1000 duration: 5 * 1000,
}) })
return Promise.reject() return Promise.reject()
} }
......
...@@ -3,18 +3,18 @@ import { getToken } from '@/utils/auth' ...@@ -3,18 +3,18 @@ import { getToken } from '@/utils/auth'
const mimeMap = { const mimeMap = {
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
zip: 'application/zip' zip: 'application/zip',
} }
const baseUrl = process.env.VUE_APP_BASE_API const baseUrl = window.lwConfig.BASE_API
export function downLoadZip(str, filename) { export function downLoadZip(str, filename) {
var url = baseUrl + str var url = baseUrl + str
axios({ axios({
method: 'get', method: 'get',
url: url, url: url,
responseType: 'blob', responseType: 'blob',
headers: { 'Authorization': 'Bearer ' + getToken() } headers: { Authorization: 'Bearer ' + getToken() },
}).then(res => { }).then((res) => {
resolveBlob(res, mimeMap.zip) resolveBlob(res, mimeMap.zip)
}) })
} }
......
...@@ -12,7 +12,7 @@ export default { ...@@ -12,7 +12,7 @@ export default {
SelectTag, SelectTag,
SelectPoster, SelectPoster,
TargetSelectUser: SelectUser, TargetSelectUser: SelectUser,
SelectQrCode SelectQrCode,
}, },
data() { data() {
return { return {
...@@ -20,7 +20,7 @@ export default { ...@@ -20,7 +20,7 @@ export default {
taskName: '', taskName: '',
fissInfo: '', fissInfo: '',
fissNum: '', fissNum: '',
dateRange: '' dateRange: '',
}, },
groupForm: { groupForm: {
taskFissionStaffs: [], taskFissionStaffs: [],
...@@ -35,10 +35,10 @@ export default { ...@@ -35,10 +35,10 @@ export default {
welcomeMsg: '', welcomeMsg: '',
rewardUrl: '', rewardUrl: '',
rewardImageUrl: '', rewardImageUrl: '',
rewardRule: '' rewardRule: '',
}, },
// rewardImageUrlTemp: '', // rewardImageUrlTemp: '',
action: process.env.VUE_APP_BASE_API + window.CONFIG.services.wecom + '/fission/upload', action: window.lwConfig.BASE_API + window.CONFIG.services.wecom + '/fission/upload',
headers: window.CONFIG.headers, headers: window.CONFIG.headers,
ruleForm: { ruleForm: {
taskName: [{ required: true, message: '请输入活动名称', trigger: 'blur' }], taskName: [{ required: true, message: '请输入活动名称', trigger: 'blur' }],
...@@ -47,9 +47,9 @@ export default { ...@@ -47,9 +47,9 @@ export default {
fissNum: [ fissNum: [
{ required: true, message: '请输入数量', trigger: 'blur' }, { required: true, message: '请输入数量', trigger: 'blur' },
// { pattern: /^[1-9]+$/, message: '请输入数字', trigger: 'blur' }, // { pattern: /^[1-9]+$/, message: '请输入数字', trigger: 'blur' },
{ pattern: /^[1-9]\d*$/, message: '请输入数字', trigger: 'blur' } { pattern: /^[1-9]\d*$/, message: '请输入数字', trigger: 'blur' },
], ],
dateRange: [{ required: true, message: '时间不可为空', trigger: 'blur' }] dateRange: [{ required: true, message: '时间不可为空', trigger: 'blur' }],
}, },
dialogVisibleSelectUser: false, dialogVisibleSelectUser: false,
dialogVisibleSelectTag: false, dialogVisibleSelectTag: false,
...@@ -57,7 +57,7 @@ export default { ...@@ -57,7 +57,7 @@ export default {
dialogVisibleSelectGroupCode: false, dialogVisibleSelectGroupCode: false,
selectTagType: '', selectTagType: '',
pageType: 'add', pageType: 'add',
taskDetail: {} taskDetail: {},
} }
}, },
created() { created() {
...@@ -84,7 +84,7 @@ export default { ...@@ -84,7 +84,7 @@ export default {
console.log('验证通过,提交表单') console.log('验证通过,提交表单')
let params = { let params = {
...this.query, ...this.query,
...this.groupForm ...this.groupForm,
} }
params.startTime = params.dateRange[0] params.startTime = params.dateRange[0]
params.overTime = params.dateRange[1] params.overTime = params.dateRange[1]
...@@ -95,8 +95,8 @@ export default { ...@@ -95,8 +95,8 @@ export default {
{ {
staffId: '', staffId: '',
staffName: '', staffName: '',
staffType: 3 staffType: 3,
} },
] ]
} }
delete params.sendType delete params.sendType
...@@ -124,11 +124,11 @@ export default { ...@@ -124,11 +124,11 @@ export default {
if (res.code == 200) { if (res.code == 200) {
this.$message({ this.$message({
message: '新增成功', message: '新增成功',
type: 'success' type: 'success',
}) })
// taskApi.sendFission(JSON.parse(res.msg).id) // taskApi.sendFission(JSON.parse(res.msg).id)
this.$router.push({ this.$router.push({
path: '/application/groupFission' path: '/application/groupFission',
}) })
} }
// //
...@@ -139,10 +139,10 @@ export default { ...@@ -139,10 +139,10 @@ export default {
if (res.code == 200) { if (res.code == 200) {
this.$message({ this.$message({
message: '修改成功', message: '修改成功',
type: 'success' type: 'success',
}) })
this.$router.push({ this.$router.push({
path: '/application/groupFission' path: '/application/groupFission',
}) })
// taskApi.sendFission(JSON.parse(res.msg).id) // taskApi.sendFission(JSON.parse(res.msg).id)
} }
...@@ -161,7 +161,7 @@ export default { ...@@ -161,7 +161,7 @@ export default {
taskName: res.data.taskName, taskName: res.data.taskName,
fissInfo: res.data.fissInfo, fissInfo: res.data.fissInfo,
fissNum: res.data.fissNum, fissNum: res.data.fissNum,
dateRange: [res.data.startTime + ' 00:00:00', res.data.overTime + ' 00:00:00'] dateRange: [res.data.startTime + ' 00:00:00', res.data.overTime + ' 00:00:00'],
} }
this.query = query this.query = query
this.groupForm = { this.groupForm = {
...@@ -179,7 +179,7 @@ export default { ...@@ -179,7 +179,7 @@ export default {
welcomeMsg: res.data.welcomeMsg, welcomeMsg: res.data.welcomeMsg,
rewardUrl: res.data.rewardUrl, rewardUrl: res.data.rewardUrl,
rewardImageUrl: res.data.rewardImageUrl, rewardImageUrl: res.data.rewardImageUrl,
rewardRule: res.data.rewardRule rewardRule: res.data.rewardRule,
} }
}) })
}, },
...@@ -191,13 +191,13 @@ export default { ...@@ -191,13 +191,13 @@ export default {
selectParam = { selectParam = {
staffId: item.userId, staffId: item.userId,
staffName: item.name, staffName: item.name,
staffType: 2 staffType: 2,
} }
} else { } else {
selectParam = { selectParam = {
staffId: item.id, staffId: item.id,
staffName: item.name, staffName: item.name,
staffType: 1 staffType: 1,
} }
} }
return selectParam return selectParam
...@@ -238,13 +238,13 @@ export default { ...@@ -238,13 +238,13 @@ export default {
} }
return isJPG || isPNG return isJPG || isPNG
} },
}, },
computed: { computed: {
arrayTarget() { arrayTarget() {
return [].concat({ id: this.groupForm.fissionTargetId }) return [].concat({ id: this.groupForm.fissionTargetId })
} },
} },
} }
</script> </script>
...@@ -415,7 +415,7 @@ export default { ...@@ -415,7 +415,7 @@ export default {
<el-form-item label="兑奖规则" prop="rewardRule"> <el-form-item label="兑奖规则" prop="rewardRule">
<el-input <el-input
type="textarea" type="textarea"
style="border:none;resize:none;width:364px" style="border: none; resize: none; width: 364px"
v-model="groupForm.rewardRule" v-model="groupForm.rewardRule"
maxlength="100" maxlength="100"
> >
......
...@@ -10,7 +10,7 @@ export default { ...@@ -10,7 +10,7 @@ export default {
SelectUser, SelectUser,
SelectTag, SelectTag,
SelectPoster, SelectPoster,
TargetSelectUser: SelectUser TargetSelectUser: SelectUser,
}, },
data() { data() {
return { return {
...@@ -18,7 +18,7 @@ export default { ...@@ -18,7 +18,7 @@ export default {
taskName: '', taskName: '',
fissInfo: '', fissInfo: '',
fissNum: '', fissNum: '',
dateRange: '' dateRange: '',
}, },
groupForm: { groupForm: {
taskFissionStaffs: [], taskFissionStaffs: [],
...@@ -33,9 +33,9 @@ export default { ...@@ -33,9 +33,9 @@ export default {
welcomeMsg: '', welcomeMsg: '',
rewardUrl: '', rewardUrl: '',
rewardImageUrl: '', rewardImageUrl: '',
rewardRule: '' rewardRule: '',
}, },
action: process.env.VUE_APP_BASE_API + window.CONFIG.services.wecom + '/fission/upload', action: window.lwConfig.BASE_API + window.CONFIG.services.wecom + '/fission/upload',
headers: window.CONFIG.headers, headers: window.CONFIG.headers,
ruleForm: { ruleForm: {
taskName: [{ required: true, message: '请输入活动名称', trigger: 'blur' }], taskName: [{ required: true, message: '请输入活动名称', trigger: 'blur' }],
...@@ -43,9 +43,9 @@ export default { ...@@ -43,9 +43,9 @@ export default {
fissionTargetId: [{ required: true, message: '请选择员工', trigger: 'blur' }], fissionTargetId: [{ required: true, message: '请选择员工', trigger: 'blur' }],
fissNum: [ fissNum: [
{ required: true, message: '请输入数量', trigger: 'blur' }, { required: true, message: '请输入数量', trigger: 'blur' },
{ pattern: /^[1-9]\d*$/, message: '请输入数字', trigger: 'blur' } { pattern: /^[1-9]\d*$/, message: '请输入数字', trigger: 'blur' },
], ],
dateRange: [{ required: true, message: '时间不可为空', trigger: 'blur' }] dateRange: [{ required: true, message: '时间不可为空', trigger: 'blur' }],
}, },
dialogVisibleSelectUser: false, dialogVisibleSelectUser: false,
dialogVisibleSelectTag: false, dialogVisibleSelectTag: false,
...@@ -53,7 +53,7 @@ export default { ...@@ -53,7 +53,7 @@ export default {
dialogVisibleTargetStff: false, dialogVisibleTargetStff: false,
selectTagType: '', selectTagType: '',
pageType: 'add', pageType: 'add',
taskDetail: {} taskDetail: {},
} }
}, },
created() { created() {
...@@ -80,7 +80,7 @@ export default { ...@@ -80,7 +80,7 @@ export default {
console.log('验证通过,提交表单') console.log('验证通过,提交表单')
let params = { let params = {
...this.query, ...this.query,
...this.groupForm ...this.groupForm,
} }
params.startTime = params.dateRange[0] params.startTime = params.dateRange[0]
params.overTime = params.dateRange[1] params.overTime = params.dateRange[1]
...@@ -91,8 +91,8 @@ export default { ...@@ -91,8 +91,8 @@ export default {
{ {
staffId: '', staffId: '',
staffName: '', staffName: '',
staffType: 3 staffType: 3,
} },
] ]
} }
delete params.sendType delete params.sendType
...@@ -121,11 +121,11 @@ export default { ...@@ -121,11 +121,11 @@ export default {
if (res.code == 200) { if (res.code == 200) {
this.$message({ this.$message({
message: '新增成功', message: '新增成功',
type: 'success' type: 'success',
}) })
// taskApi.sendFission(JSON.parse(res.msg).id) // taskApi.sendFission(JSON.parse(res.msg).id)
this.$router.push({ this.$router.push({
path: 'taskGroup' path: 'taskGroup',
}) })
} }
// //
...@@ -136,10 +136,10 @@ export default { ...@@ -136,10 +136,10 @@ export default {
if (res.code == 200) { if (res.code == 200) {
this.$message({ this.$message({
message: '修改成功', message: '修改成功',
type: 'success' type: 'success',
}) })
this.$router.push({ this.$router.push({
path: 'taskGroup' path: 'taskGroup',
}) })
// taskApi.sendFission(JSON.parse(res.msg).id) // taskApi.sendFission(JSON.parse(res.msg).id)
} }
...@@ -158,7 +158,7 @@ export default { ...@@ -158,7 +158,7 @@ export default {
taskName: res.data.taskName, taskName: res.data.taskName,
fissInfo: res.data.fissInfo, fissInfo: res.data.fissInfo,
fissNum: res.data.fissNum, fissNum: res.data.fissNum,
dateRange: [res.data.startTime + ' 00:00:00', res.data.overTime + ' 00:00:00'] dateRange: [res.data.startTime + ' 00:00:00', res.data.overTime + ' 00:00:00'],
} }
this.query = query this.query = query
this.groupForm = { this.groupForm = {
...@@ -176,7 +176,7 @@ export default { ...@@ -176,7 +176,7 @@ export default {
welcomeMsg: res.data.welcomeMsg, welcomeMsg: res.data.welcomeMsg,
rewardUrl: res.data.rewardUrl, rewardUrl: res.data.rewardUrl,
rewardImageUrl: res.data.rewardImageUrl, rewardImageUrl: res.data.rewardImageUrl,
rewardRule: res.data.rewardRule rewardRule: res.data.rewardRule,
} }
}) })
}, },
...@@ -188,13 +188,13 @@ export default { ...@@ -188,13 +188,13 @@ export default {
selectParam = { selectParam = {
staffId: item.userId, staffId: item.userId,
staffName: item.name, staffName: item.name,
staffType: 2 staffType: 2,
} }
} else { } else {
selectParam = { selectParam = {
staffId: item.id, staffId: item.id,
staffName: item.name, staffName: item.name,
staffType: 1 staffType: 1,
} }
} }
return selectParam return selectParam
...@@ -235,8 +235,8 @@ export default { ...@@ -235,8 +235,8 @@ export default {
} }
return isJPG || isPNG return isJPG || isPNG
} },
} },
} }
</script> </script>
...@@ -408,7 +408,7 @@ export default { ...@@ -408,7 +408,7 @@ export default {
<el-form-item label="兑奖规则" prop="rewardRule"> <el-form-item label="兑奖规则" prop="rewardRule">
<el-input <el-input
type="textarea" type="textarea"
style="border:none;resize:none;width:364px" style="border: none; resize: none; width: 364px"
v-model="groupForm.rewardRule" v-model="groupForm.rewardRule"
maxlength="100" maxlength="100"
> >
......
...@@ -212,7 +212,7 @@ export default { ...@@ -212,7 +212,7 @@ export default {
this.$store this.$store
.dispatch('Login', this.loginForm) .dispatch('Login', this.loginForm)
.then(() => { .then(() => {
this.$router.push({ path: this.redirect || process.env.VUE_APP_BASE_URL }) this.$router.push({ path: this.redirect || window.lwConfig.BASE_URL })
}) })
.catch(() => { .catch(() => {
this.loading = false this.loading = false
......
...@@ -54,7 +54,8 @@ ...@@ -54,7 +54,8 @@
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
>添加分类</el-button> >添加分类</el-button
>
</el-popover> </el-popover>
</div> </div>
<div class="head-container"> <div class="head-container">
...@@ -75,8 +76,11 @@ ...@@ -75,8 +76,11 @@
:indeterminate="isIndeterminate" :indeterminate="isIndeterminate"
v-model="checkAll" v-model="checkAll"
@change="handleCheckAllChange" @change="handleCheckAllChange"
>全选</el-checkbox> >全选</el-checkbox
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd">添加</el-button> >
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd"
>添加</el-button
>
<el-popover placement="top" width="160" v-model="visible"> <el-popover placement="top" width="160" v-model="visible">
<div>选择分组</div> <div>选择分组</div>
<el-select v-model="model" size="small" placeholder> <el-select v-model="model" size="small" placeholder>
...@@ -93,13 +97,18 @@ ...@@ -93,13 +97,18 @@
</div> </div>
<el-button slot="reference">移动分组</el-button> <el-button slot="reference">移动分组</el-button>
</el-popover> </el-popover>
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd">删除</el-button> <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd"
>删除</el-button
>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="6" style="margin-top: 24px;" v-for="(item, index) in 10" :key="index"> <el-col :span="6" style="margin-top: 24px" v-for="(item, index) in 10" :key="index">
<el-card shadow="hover" body-style="padding: 0px;"> <el-card shadow="hover" body-style="padding: 0px;">
<div class="img-wrap"> <div class="img-wrap">
<el-image :src="require('@/assets/image/profile.jpg')" :preview-src-list="srcList"></el-image> <el-image
:src="require('@/assets/image/profile.jpg')"
:preview-src-list="srcList"
></el-image>
<div class="el-upload-list__item-actions"> <div class="el-upload-list__item-actions">
<span class="el-upload-list__item-preview" @click="edit(file)"> <span class="el-upload-list__item-preview" @click="edit(file)">
<i class="el-icon-edit"></i> <i class="el-icon-edit"></i>
...@@ -109,7 +118,7 @@ ...@@ -109,7 +118,7 @@
</span> </span>
</div> </div>
</div> </div>
<div style="padding: 14px;"> <div style="padding: 14px">
<el-checkbox v-model="kl">sdghwery阿瑟他五色土</el-checkbox> <el-checkbox v-model="kl">sdghwery阿瑟他五色土</el-checkbox>
<div>sdghwery阿瑟他五色土</div> <div>sdghwery阿瑟他五色土</div>
</div> </div>
...@@ -118,7 +127,7 @@ ...@@ -118,7 +127,7 @@
</el-row> </el-row>
<pagination <pagination
v-show="total>0" v-show="total > 0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
...@@ -134,14 +143,27 @@ ...@@ -134,14 +143,27 @@
<el-input v-model="sd" placeholder="请输入小程序标题"></el-input> <el-input v-model="sd" placeholder="请输入小程序标题"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="小程序appid"> <el-form-item label="小程序appid">
<el-input style="width: 90%;margin-right: 10px" v-model="sd" placeholder="请输入小程序appid"></el-input> <el-input
style="width: 90%; margin-right: 10px"
v-model="sd"
placeholder="请输入小程序appid"
></el-input>
<el-tooltip class="item" effect="dark" content="必须是关联到企业的小程序" placement="top"> <el-tooltip class="item" effect="dark" content="必须是关联到企业的小程序" placement="top">
<i class="el-icon-warning-outline"></i> <i class="el-icon-warning-outline"></i>
</el-tooltip> </el-tooltip>
</el-form-item> </el-form-item>
<el-form-item label="小程序路径"> <el-form-item label="小程序路径">
<el-input style="width: 90%;margin-right: 10px" v-model="sd" placeholder="请输入小程序page路径"></el-input> <el-input
<el-tooltip class="item" effect="dark" content="登录小程序管理后台,在数据分析中,可以查看主要的页面访问路径" placement="top"> style="width: 90%; margin-right: 10px"
v-model="sd"
placeholder="请输入小程序page路径"
></el-input>
<el-tooltip
class="item"
effect="dark"
content="登录小程序管理后台,在数据分析中,可以查看主要的页面访问路径"
placement="top"
>
<i class="el-icon-warning-outline"></i> <i class="el-icon-warning-outline"></i>
</el-tooltip> </el-tooltip>
</el-form-item> </el-form-item>
...@@ -172,7 +194,7 @@ ...@@ -172,7 +194,7 @@
</template> </template>
<script> <script>
import Editor from "@/components/Editor"; import Editor from '@/components/Editor'
export default { export default {
components: { components: {
...@@ -182,8 +204,8 @@ export default { ...@@ -182,8 +204,8 @@ export default {
return { return {
model: 0, model: 0,
srcList: [ srcList: [
"https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg", 'https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg',
"https://fuss10.elemecdn.com/1/8e/aeffeb4de74e2fde4bd74fc7b4486jpeg.jpeg", 'https://fuss10.elemecdn.com/1/8e/aeffeb4de74e2fde4bd74fc7b4486jpeg.jpeg',
], ],
// 遮罩层 // 遮罩层
loading: true, loading: true,
...@@ -200,7 +222,7 @@ export default { ...@@ -200,7 +222,7 @@ export default {
// 用户表格数据 // 用户表格数据
userList: null, userList: null,
// 弹出层标题 // 弹出层标题
title: "", title: '',
// 部门树选项 // 部门树选项
deptOptions: undefined, deptOptions: undefined,
// 是否显示弹出层 // 是否显示弹出层
...@@ -222,23 +244,23 @@ export default { ...@@ -222,23 +244,23 @@ export default {
// 表单参数 // 表单参数
form: {}, form: {},
defaultProps: { defaultProps: {
children: "children", children: 'children',
label: "label", label: 'label',
}, },
// 用户导入参数 // 用户导入参数
upload: { upload: {
// 是否显示弹出层(用户导入) // 是否显示弹出层(用户导入)
open: false, open: false,
// 弹出层标题(用户导入) // 弹出层标题(用户导入)
title: "", title: '',
// 是否禁用上传 // 是否禁用上传
isUploading: false, isUploading: false,
// 是否更新已经存在的用户数据 // 是否更新已经存在的用户数据
updateSupport: 0, updateSupport: 0,
// 设置上传的请求头部 // 设置上传的请求头部
headers: { Authorization: "Bearer " + getToken() }, headers: { Authorization: 'Bearer ' + getToken() },
// 上传的地址 // 上传的地址
url: process.env.VUE_APP_BASE_API + "/system/user/importData", url: window.lwConfig.BASE_API + '/system/user/importData',
}, },
// 查询参数 // 查询参数
queryParams: { queryParams: {
...@@ -251,110 +273,96 @@ export default { ...@@ -251,110 +273,96 @@ export default {
}, },
// 表单校验 // 表单校验
rules: { rules: {
userName: [ userName: [{ required: true, message: '用户名称不能为空', trigger: 'blur' }],
{ required: true, message: "用户名称不能为空", trigger: "blur" }, nickName: [{ required: true, message: '用户昵称不能为空', trigger: 'blur' }],
], deptId: [{ required: true, message: '归属部门不能为空', trigger: 'blur' }],
nickName: [ password: [{ required: true, message: '用户密码不能为空', trigger: 'blur' }],
{ required: true, message: "用户昵称不能为空", trigger: "blur" },
],
deptId: [
{ required: true, message: "归属部门不能为空", trigger: "blur" },
],
password: [
{ required: true, message: "用户密码不能为空", trigger: "blur" },
],
email: [ email: [
{ required: true, message: "邮箱地址不能为空", trigger: "blur" }, { required: true, message: '邮箱地址不能为空', trigger: 'blur' },
{ {
type: "email", type: 'email',
message: "'请输入正确的邮箱地址", message: "'请输入正确的邮箱地址",
trigger: ["blur", "change"], trigger: ['blur', 'change'],
}, },
], ],
phonenumber: [ phonenumber: [
{ required: true, message: "手机号码不能为空", trigger: "blur" }, { required: true, message: '手机号码不能为空', trigger: 'blur' },
{ {
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
message: "请输入正确的手机号码", message: '请输入正确的手机号码',
trigger: "blur", trigger: 'blur',
}, },
], ],
}, },
}; }
}, },
watch: { watch: {
// 根据名称筛选部门树 // 根据名称筛选部门树
deptName(val) { deptName(val) {
this.$refs.tree.filter(val); this.$refs.tree.filter(val)
}, },
}, },
created() { created() {
this.getList(); this.getList()
this.getTreeselect(); this.getTreeselect()
this.getDicts("sys_normal_disable").then((response) => { this.getDicts('sys_normal_disable').then((response) => {
this.statusOptions = response.data; this.statusOptions = response.data
}); })
this.getDicts("sys_user_sex").then((response) => { this.getDicts('sys_user_sex').then((response) => {
this.sexOptions = response.data; this.sexOptions = response.data
}); })
this.getConfigKey("sys.user.initPassword").then((response) => { this.getConfigKey('sys.user.initPassword').then((response) => {
this.initPassword = response.msg; this.initPassword = response.msg
}); })
}, },
methods: { methods: {
/** 查询用户列表 */ /** 查询用户列表 */
getList() { getList() {
this.loading = true; this.loading = true
listUser(this.addDateRange(this.queryParams, this.dateRange)).then( listUser(this.addDateRange(this.queryParams, this.dateRange)).then((response) => {
(response) => { this.userList = response.rows
this.userList = response.rows; this.total = response.total
this.total = response.total; this.loading = false
this.loading = false; })
}
);
}, },
/** 查询部门下拉树结构 */ /** 查询部门下拉树结构 */
getTreeselect() { getTreeselect() {
treeselect().then((response) => { treeselect().then((response) => {
this.deptOptions = response.data; this.deptOptions = response.data
}); })
}, },
// 筛选节点 // 筛选节点
filterNode(value, data) { filterNode(value, data) {
if (!value) return true; if (!value) return true
return data.label.indexOf(value) !== -1; return data.label.indexOf(value) !== -1
}, },
// 节点单击事件 // 节点单击事件
handleNodeClick(data) { handleNodeClick(data) {
this.queryParams.deptId = data.id; this.queryParams.deptId = data.id
this.getList(); this.getList()
}, },
// 用户状态修改 // 用户状态修改
handleStatusChange(row) { handleStatusChange(row) {
let text = row.status === "0" ? "启用" : "停用"; let text = row.status === '0' ? '启用' : '停用'
this.$confirm( this.$confirm('确认要"' + text + '""' + row.userName + '"用户吗?', '警告', {
'确认要"' + text + '""' + row.userName + '"用户吗?', confirmButtonText: '确定',
"警告", cancelButtonText: '取消',
{ type: 'warning',
confirmButtonText: "确定", })
cancelButtonText: "取消",
type: "warning",
}
)
.then(function () { .then(function () {
return changeUserStatus(row.userId, row.status); return changeUserStatus(row.userId, row.status)
}) })
.then(() => { .then(() => {
this.msgSuccess(text + "成功"); this.msgSuccess(text + '成功')
}) })
.catch(function () { .catch(function () {
row.status = row.status === "0" ? "1" : "0"; row.status = row.status === '0' ? '1' : '0'
}); })
}, },
// 取消按钮 // 取消按钮
cancel() { cancel() {
this.open = false; this.open = false
this.reset(); this.reset()
}, },
// 表单重置 // 表单重置
reset() { reset() {
...@@ -367,164 +375,160 @@ export default { ...@@ -367,164 +375,160 @@ export default {
phonenumber: undefined, phonenumber: undefined,
email: undefined, email: undefined,
sex: undefined, sex: undefined,
status: "0", status: '0',
remark: undefined, remark: undefined,
postIds: [], postIds: [],
roleIds: [], roleIds: [],
}; }
this.resetForm("form"); this.resetForm('form')
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.page = 1; this.queryParams.page = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.dateRange = []; this.dateRange = []
this.resetForm("queryForm"); this.resetForm('queryForm')
this.handleQuery(); this.handleQuery()
}, },
// 多选框选中数据 // 多选框选中数据
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map((item) => item.userId); this.ids = selection.map((item) => item.userId)
this.single = selection.length != 1; this.single = selection.length != 1
this.multiple = !selection.length; this.multiple = !selection.length
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset()
this.getTreeselect(); this.getTreeselect()
getUser().then((response) => { getUser().then((response) => {
this.postOptions = response.posts; this.postOptions = response.posts
this.roleOptions = response.roles; this.roleOptions = response.roles
this.open = true; this.open = true
this.title = "添加用户"; this.title = '添加用户'
this.form.password = this.initPassword; this.form.password = this.initPassword
}); })
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset()
this.getTreeselect(); this.getTreeselect()
const userId = row.userId || this.ids; const userId = row.userId || this.ids
getUser(userId).then((response) => { getUser(userId).then((response) => {
this.form = response.data; this.form = response.data
this.postOptions = response.posts; this.postOptions = response.posts
this.roleOptions = response.roles; this.roleOptions = response.roles
this.form.postIds = response.postIds; this.form.postIds = response.postIds
this.form.roleIds = response.roleIds; this.form.roleIds = response.roleIds
this.open = true; this.open = true
this.title = "修改用户"; this.title = '修改用户'
this.form.password = ""; this.form.password = ''
}); })
}, },
/** 重置密码按钮操作 */ /** 重置密码按钮操作 */
handleResetPwd(row) { handleResetPwd(row) {
this.$prompt('请输入"' + row.userName + '"的新密码', "提示", { this.$prompt('请输入"' + row.userName + '"的新密码', '提示', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
}) })
.then(({ value }) => { .then(({ value }) => {
resetUserPwd(row.userId, value).then((response) => { resetUserPwd(row.userId, value).then((response) => {
if (response.code === 200) { if (response.code === 200) {
this.msgSuccess("修改成功,新密码是:" + value); this.msgSuccess('修改成功,新密码是:' + value)
} }
}); })
}) })
.catch(() => {}); .catch(() => {})
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function () { submitForm: function () {
this.$refs["form"].validate((valid) => { this.$refs['form'].validate((valid) => {
if (valid) { if (valid) {
if (this.form.userId != undefined) { if (this.form.userId != undefined) {
updateUser(this.form).then((response) => { updateUser(this.form).then((response) => {
if (response.code === 200) { if (response.code === 200) {
this.msgSuccess("修改成功"); this.msgSuccess('修改成功')
this.open = false; this.open = false
this.getList(); this.getList()
} }
}); })
} else { } else {
addUser(this.form).then((response) => { addUser(this.form).then((response) => {
if (response.code === 200) { if (response.code === 200) {
this.msgSuccess("新增成功"); this.msgSuccess('新增成功')
this.open = false; this.open = false
this.getList(); this.getList()
} }
}); })
} }
} }
}); })
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const userIds = row.userId || this.ids; const userIds = row.userId || this.ids
this.$confirm( this.$confirm('是否确认删除用户编号为"' + userIds + '"的数据项?', '警告', {
'是否确认删除用户编号为"' + userIds + '"的数据项?', confirmButtonText: '确定',
"警告", cancelButtonText: '取消',
{ type: 'warning',
confirmButtonText: "确定", })
cancelButtonText: "取消",
type: "warning",
}
)
.then(function () { .then(function () {
return delUser(userIds); return delUser(userIds)
}) })
.then(() => { .then(() => {
this.getList(); this.getList()
this.msgSuccess("删除成功"); this.msgSuccess('删除成功')
}) })
.catch(function () {}); .catch(function () {})
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
const queryParams = this.queryParams; const queryParams = this.queryParams
this.$confirm("是否确认导出所有用户数据项?", "警告", { this.$confirm('是否确认导出所有用户数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning", type: 'warning',
}) })
.then(function () { .then(function () {
return exportUser(queryParams); return exportUser(queryParams)
}) })
.then((response) => { .then((response) => {
this.download(response.msg); this.download(response.msg)
}) })
.catch(function () {}); .catch(function () {})
}, },
/** 导入按钮操作 */ /** 导入按钮操作 */
handleImport() { handleImport() {
this.upload.title = "用户导入"; this.upload.title = '用户导入'
this.upload.open = true; this.upload.open = true
}, },
/** 下载模板操作 */ /** 下载模板操作 */
importTemplate() { importTemplate() {
importTemplate().then((response) => { importTemplate().then((response) => {
this.download(response.msg); this.download(response.msg)
}); })
}, },
// 文件上传中处理 // 文件上传中处理
handleFileUploadProgress(event, file, fileList) { handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true; this.upload.isUploading = true
}, },
// 文件上传成功处理 // 文件上传成功处理
handleFileSuccess(response, file, fileList) { handleFileSuccess(response, file, fileList) {
this.upload.open = false; this.upload.open = false
this.upload.isUploading = false; this.upload.isUploading = false
this.$refs.upload.clearFiles(); this.$refs.upload.clearFiles()
this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true }); this.$alert(response.msg, '导入结果', { dangerouslyUseHTMLString: true })
this.getList(); this.getList()
}, },
// 提交上传文件 // 提交上传文件
submitFileForm() { submitFileForm() {
this.$refs.upload.submit(); this.$refs.upload.submit()
}, },
edit() { edit() {
this.open = true; this.open = true
}, },
}, },
};
</script>
\ No newline at end of file \ No newline at end of file
}
</script>
...@@ -54,7 +54,8 @@ ...@@ -54,7 +54,8 @@
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
>添加分类</el-button> >添加分类</el-button
>
</el-popover> </el-popover>
</div> </div>
<div class="head-container"> <div class="head-container">
...@@ -75,8 +76,11 @@ ...@@ -75,8 +76,11 @@
:indeterminate="isIndeterminate" :indeterminate="isIndeterminate"
v-model="checkAll" v-model="checkAll"
@change="handleCheckAllChange" @change="handleCheckAllChange"
>全选</el-checkbox> >全选</el-checkbox
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd">添加网页</el-button> >
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd"
>添加网页</el-button
>
<el-popover placement="top" width="160" v-model="visible"> <el-popover placement="top" width="160" v-model="visible">
<div>选择分组</div> <div>选择分组</div>
<el-select v-model="model" size="small" placeholder> <el-select v-model="model" size="small" placeholder>
...@@ -93,13 +97,18 @@ ...@@ -93,13 +97,18 @@
</div> </div>
<el-button slot="reference">移动分组</el-button> <el-button slot="reference">移动分组</el-button>
</el-popover> </el-popover>
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd">删除</el-button> <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd"
>删除</el-button
>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="6" style="margin-top: 24px;" v-for="(item, index) in 10" :key="index"> <el-col :span="6" style="margin-top: 24px" v-for="(item, index) in 10" :key="index">
<el-card shadow="hover" body-style="padding: 0px;"> <el-card shadow="hover" body-style="padding: 0px;">
<div class="img-wrap"> <div class="img-wrap">
<el-image :src="require('@/assets/image/profile.jpg')" :preview-src-list="srcList"></el-image> <el-image
:src="require('@/assets/image/profile.jpg')"
:preview-src-list="srcList"
></el-image>
<div class="el-upload-list__item-actions"> <div class="el-upload-list__item-actions">
<span class="el-upload-list__item-preview" @click="edit(file)"> <span class="el-upload-list__item-preview" @click="edit(file)">
<i class="el-icon-edit"></i> <i class="el-icon-edit"></i>
...@@ -109,7 +118,7 @@ ...@@ -109,7 +118,7 @@
</span> </span>
</div> </div>
</div> </div>
<div style="padding: 14px;"> <div style="padding: 14px">
<el-checkbox v-model="kl">sdghwery阿瑟他五色土</el-checkbox> <el-checkbox v-model="kl">sdghwery阿瑟他五色土</el-checkbox>
<div>sdghwery阿瑟他五色土</div> <div>sdghwery阿瑟他五色土</div>
</div> </div>
...@@ -118,7 +127,7 @@ ...@@ -118,7 +127,7 @@
</el-row> </el-row>
<pagination <pagination
v-show="total>0" v-show="total > 0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
...@@ -145,7 +154,8 @@ ...@@ -145,7 +154,8 @@
v-for="item in options" v-for="item in options"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value"> :value="item.value"
>
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -157,10 +167,14 @@ ...@@ -157,10 +167,14 @@
<div>建议尺寸:1068*455</div> <div>建议尺寸:1068*455</div>
</el-form-item> </el-form-item>
<el-form-item label="摘要"> <el-form-item label="摘要">
<el-input v-model="form.remark" type="textarea" placeholder="非必填,限120字,如不填会自动抓取正文前54个字"></el-input> <el-input
v-model="form.remark"
type="textarea"
placeholder="非必填,限120字,如不填会自动抓取正文前54个字"
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="正文"> <el-form-item label="正文">
<editor v-model="form.noticeContent" :min-height="192"/> <editor v-model="form.noticeContent" :min-height="192" />
</el-form-item> </el-form-item>
<el-form-item label="外链"> <el-form-item label="外链">
<el-input v-model="sd" placeholder="请填写带http或https协议头的合法URL"></el-input> <el-input v-model="sd" placeholder="请填写带http或https协议头的合法URL"></el-input>
...@@ -175,18 +189,18 @@ ...@@ -175,18 +189,18 @@
</template> </template>
<script> <script>
import Editor from '@/components/Editor'; import Editor from '@/components/Editor'
export default { export default {
components: { components: {
Editor Editor,
}, },
data() { data() {
return { return {
model: 0, model: 0,
srcList: [ srcList: [
"https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg", 'https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg',
"https://fuss10.elemecdn.com/1/8e/aeffeb4de74e2fde4bd74fc7b4486jpeg.jpeg", 'https://fuss10.elemecdn.com/1/8e/aeffeb4de74e2fde4bd74fc7b4486jpeg.jpeg',
], ],
// 遮罩层 // 遮罩层
loading: true, loading: true,
...@@ -203,7 +217,7 @@ export default { ...@@ -203,7 +217,7 @@ export default {
// 用户表格数据 // 用户表格数据
userList: null, userList: null,
// 弹出层标题 // 弹出层标题
title: "", title: '',
// 部门树选项 // 部门树选项
deptOptions: undefined, deptOptions: undefined,
// 是否显示弹出层 // 是否显示弹出层
...@@ -225,23 +239,23 @@ export default { ...@@ -225,23 +239,23 @@ export default {
// 表单参数 // 表单参数
form: {}, form: {},
defaultProps: { defaultProps: {
children: "children", children: 'children',
label: "label", label: 'label',
}, },
// 用户导入参数 // 用户导入参数
upload: { upload: {
// 是否显示弹出层(用户导入) // 是否显示弹出层(用户导入)
open: false, open: false,
// 弹出层标题(用户导入) // 弹出层标题(用户导入)
title: "", title: '',
// 是否禁用上传 // 是否禁用上传
isUploading: false, isUploading: false,
// 是否更新已经存在的用户数据 // 是否更新已经存在的用户数据
updateSupport: 0, updateSupport: 0,
// 设置上传的请求头部 // 设置上传的请求头部
headers: { Authorization: "Bearer " + getToken() }, headers: { Authorization: 'Bearer ' + getToken() },
// 上传的地址 // 上传的地址
url: process.env.VUE_APP_BASE_API + "/system/user/importData", url: window.lwConfig.BASE_API + '/system/user/importData',
}, },
// 查询参数 // 查询参数
queryParams: { queryParams: {
...@@ -254,110 +268,96 @@ export default { ...@@ -254,110 +268,96 @@ export default {
}, },
// 表单校验 // 表单校验
rules: { rules: {
userName: [ userName: [{ required: true, message: '用户名称不能为空', trigger: 'blur' }],
{ required: true, message: "用户名称不能为空", trigger: "blur" }, nickName: [{ required: true, message: '用户昵称不能为空', trigger: 'blur' }],
], deptId: [{ required: true, message: '归属部门不能为空', trigger: 'blur' }],
nickName: [ password: [{ required: true, message: '用户密码不能为空', trigger: 'blur' }],
{ required: true, message: "用户昵称不能为空", trigger: "blur" },
],
deptId: [
{ required: true, message: "归属部门不能为空", trigger: "blur" },
],
password: [
{ required: true, message: "用户密码不能为空", trigger: "blur" },
],
email: [ email: [
{ required: true, message: "邮箱地址不能为空", trigger: "blur" }, { required: true, message: '邮箱地址不能为空', trigger: 'blur' },
{ {
type: "email", type: 'email',
message: "'请输入正确的邮箱地址", message: "'请输入正确的邮箱地址",
trigger: ["blur", "change"], trigger: ['blur', 'change'],
}, },
], ],
phonenumber: [ phonenumber: [
{ required: true, message: "手机号码不能为空", trigger: "blur" }, { required: true, message: '手机号码不能为空', trigger: 'blur' },
{ {
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
message: "请输入正确的手机号码", message: '请输入正确的手机号码',
trigger: "blur", trigger: 'blur',
}, },
], ],
}, },
}; }
}, },
watch: { watch: {
// 根据名称筛选部门树 // 根据名称筛选部门树
deptName(val) { deptName(val) {
this.$refs.tree.filter(val); this.$refs.tree.filter(val)
}, },
}, },
created() { created() {
this.getList(); this.getList()
this.getTreeselect(); this.getTreeselect()
this.getDicts("sys_normal_disable").then((response) => { this.getDicts('sys_normal_disable').then((response) => {
this.statusOptions = response.data; this.statusOptions = response.data
}); })
this.getDicts("sys_user_sex").then((response) => { this.getDicts('sys_user_sex').then((response) => {
this.sexOptions = response.data; this.sexOptions = response.data
}); })
this.getConfigKey("sys.user.initPassword").then((response) => { this.getConfigKey('sys.user.initPassword').then((response) => {
this.initPassword = response.msg; this.initPassword = response.msg
}); })
}, },
methods: { methods: {
/** 查询用户列表 */ /** 查询用户列表 */
getList() { getList() {
this.loading = true; this.loading = true
listUser(this.addDateRange(this.queryParams, this.dateRange)).then( listUser(this.addDateRange(this.queryParams, this.dateRange)).then((response) => {
(response) => { this.userList = response.rows
this.userList = response.rows; this.total = response.total
this.total = response.total; this.loading = false
this.loading = false; })
}
);
}, },
/** 查询部门下拉树结构 */ /** 查询部门下拉树结构 */
getTreeselect() { getTreeselect() {
treeselect().then((response) => { treeselect().then((response) => {
this.deptOptions = response.data; this.deptOptions = response.data
}); })
}, },
// 筛选节点 // 筛选节点
filterNode(value, data) { filterNode(value, data) {
if (!value) return true; if (!value) return true
return data.label.indexOf(value) !== -1; return data.label.indexOf(value) !== -1
}, },
// 节点单击事件 // 节点单击事件
handleNodeClick(data) { handleNodeClick(data) {
this.queryParams.deptId = data.id; this.queryParams.deptId = data.id
this.getList(); this.getList()
}, },
// 用户状态修改 // 用户状态修改
handleStatusChange(row) { handleStatusChange(row) {
let text = row.status === "0" ? "启用" : "停用"; let text = row.status === '0' ? '启用' : '停用'
this.$confirm( this.$confirm('确认要"' + text + '""' + row.userName + '"用户吗?', '警告', {
'确认要"' + text + '""' + row.userName + '"用户吗?', confirmButtonText: '确定',
"警告", cancelButtonText: '取消',
{ type: 'warning',
confirmButtonText: "确定", })
cancelButtonText: "取消",
type: "warning",
}
)
.then(function () { .then(function () {
return changeUserStatus(row.userId, row.status); return changeUserStatus(row.userId, row.status)
}) })
.then(() => { .then(() => {
this.msgSuccess(text + "成功"); this.msgSuccess(text + '成功')
}) })
.catch(function () { .catch(function () {
row.status = row.status === "0" ? "1" : "0"; row.status = row.status === '0' ? '1' : '0'
}); })
}, },
// 取消按钮 // 取消按钮
cancel() { cancel() {
this.open = false; this.open = false
this.reset(); this.reset()
}, },
// 表单重置 // 表单重置
reset() { reset() {
...@@ -370,164 +370,160 @@ export default { ...@@ -370,164 +370,160 @@ export default {
phonenumber: undefined, phonenumber: undefined,
email: undefined, email: undefined,
sex: undefined, sex: undefined,
status: "0", status: '0',
remark: undefined, remark: undefined,
postIds: [], postIds: [],
roleIds: [], roleIds: [],
}; }
this.resetForm("form"); this.resetForm('form')
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.page = 1; this.queryParams.page = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.dateRange = []; this.dateRange = []
this.resetForm("queryForm"); this.resetForm('queryForm')
this.handleQuery(); this.handleQuery()
}, },
// 多选框选中数据 // 多选框选中数据
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map((item) => item.userId); this.ids = selection.map((item) => item.userId)
this.single = selection.length != 1; this.single = selection.length != 1
this.multiple = !selection.length; this.multiple = !selection.length
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset()
this.getTreeselect(); this.getTreeselect()
getUser().then((response) => { getUser().then((response) => {
this.postOptions = response.posts; this.postOptions = response.posts
this.roleOptions = response.roles; this.roleOptions = response.roles
this.open = true; this.open = true
this.title = "添加用户"; this.title = '添加用户'
this.form.password = this.initPassword; this.form.password = this.initPassword
}); })
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset()
this.getTreeselect(); this.getTreeselect()
const userId = row.userId || this.ids; const userId = row.userId || this.ids
getUser(userId).then((response) => { getUser(userId).then((response) => {
this.form = response.data; this.form = response.data
this.postOptions = response.posts; this.postOptions = response.posts
this.roleOptions = response.roles; this.roleOptions = response.roles
this.form.postIds = response.postIds; this.form.postIds = response.postIds
this.form.roleIds = response.roleIds; this.form.roleIds = response.roleIds
this.open = true; this.open = true
this.title = "修改用户"; this.title = '修改用户'
this.form.password = ""; this.form.password = ''
}); })
}, },
/** 重置密码按钮操作 */ /** 重置密码按钮操作 */
handleResetPwd(row) { handleResetPwd(row) {
this.$prompt('请输入"' + row.userName + '"的新密码', "提示", { this.$prompt('请输入"' + row.userName + '"的新密码', '提示', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
}) })
.then(({ value }) => { .then(({ value }) => {
resetUserPwd(row.userId, value).then((response) => { resetUserPwd(row.userId, value).then((response) => {
if (response.code === 200) { if (response.code === 200) {
this.msgSuccess("修改成功,新密码是:" + value); this.msgSuccess('修改成功,新密码是:' + value)
} }
}); })
}) })
.catch(() => {}); .catch(() => {})
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function () { submitForm: function () {
this.$refs["form"].validate((valid) => { this.$refs['form'].validate((valid) => {
if (valid) { if (valid) {
if (this.form.userId != undefined) { if (this.form.userId != undefined) {
updateUser(this.form).then((response) => { updateUser(this.form).then((response) => {
if (response.code === 200) { if (response.code === 200) {
this.msgSuccess("修改成功"); this.msgSuccess('修改成功')
this.open = false; this.open = false
this.getList(); this.getList()
} }
}); })
} else { } else {
addUser(this.form).then((response) => { addUser(this.form).then((response) => {
if (response.code === 200) { if (response.code === 200) {
this.msgSuccess("新增成功"); this.msgSuccess('新增成功')
this.open = false; this.open = false
this.getList(); this.getList()
} }
}); })
} }
} }
}); })
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const userIds = row.userId || this.ids; const userIds = row.userId || this.ids
this.$confirm( this.$confirm('是否确认删除用户编号为"' + userIds + '"的数据项?', '警告', {
'是否确认删除用户编号为"' + userIds + '"的数据项?', confirmButtonText: '确定',
"警告", cancelButtonText: '取消',
{ type: 'warning',
confirmButtonText: "确定", })
cancelButtonText: "取消",
type: "warning",
}
)
.then(function () { .then(function () {
return delUser(userIds); return delUser(userIds)
}) })
.then(() => { .then(() => {
this.getList(); this.getList()
this.msgSuccess("删除成功"); this.msgSuccess('删除成功')
}) })
.catch(function () {}); .catch(function () {})
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
const queryParams = this.queryParams; const queryParams = this.queryParams
this.$confirm("是否确认导出所有用户数据项?", "警告", { this.$confirm('是否确认导出所有用户数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning", type: 'warning',
}) })
.then(function () { .then(function () {
return exportUser(queryParams); return exportUser(queryParams)
}) })
.then((response) => { .then((response) => {
this.download(response.msg); this.download(response.msg)
}) })
.catch(function () {}); .catch(function () {})
}, },
/** 导入按钮操作 */ /** 导入按钮操作 */
handleImport() { handleImport() {
this.upload.title = "用户导入"; this.upload.title = '用户导入'
this.upload.open = true; this.upload.open = true
}, },
/** 下载模板操作 */ /** 下载模板操作 */
importTemplate() { importTemplate() {
importTemplate().then((response) => { importTemplate().then((response) => {
this.download(response.msg); this.download(response.msg)
}); })
}, },
// 文件上传中处理 // 文件上传中处理
handleFileUploadProgress(event, file, fileList) { handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true; this.upload.isUploading = true
}, },
// 文件上传成功处理 // 文件上传成功处理
handleFileSuccess(response, file, fileList) { handleFileSuccess(response, file, fileList) {
this.upload.open = false; this.upload.open = false
this.upload.isUploading = false; this.upload.isUploading = false
this.$refs.upload.clearFiles(); this.$refs.upload.clearFiles()
this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true }); this.$alert(response.msg, '导入结果', { dangerouslyUseHTMLString: true })
this.getList(); this.getList()
}, },
// 提交上传文件 // 提交上传文件
submitFileForm() { submitFileForm() {
this.$refs.upload.submit(); this.$refs.upload.submit()
}, },
edit() { edit() {
this.open = true; this.open = true
}, },
}, },
};
</script>
\ No newline at end of file \ No newline at end of file
}
</script>
...@@ -8,7 +8,7 @@ export default { ...@@ -8,7 +8,7 @@ export default {
name: 'Poster', name: 'Poster',
components: { components: {
MaPage, MaPage,
SelectMaterial SelectMaterial,
}, },
data() { data() {
return { return {
...@@ -17,7 +17,7 @@ export default { ...@@ -17,7 +17,7 @@ export default {
dialogVisibleSelectMaterial: false, dialogVisibleSelectMaterial: false,
dialog: { dialog: {
preview: false, // 预览弹出显示隐藏 preview: false, // 预览弹出显示隐藏
edit: false // 编辑弹出显示隐藏 edit: false, // 编辑弹出显示隐藏
}, },
rangeErrorMsg: '', rangeErrorMsg: '',
form: {}, form: {},
...@@ -25,32 +25,32 @@ export default { ...@@ -25,32 +25,32 @@ export default {
title: { title: {
required: true, required: true,
message: '请输入海报名称', message: '请输入海报名称',
trigger: 'blur' trigger: 'blur',
}, },
categoryId: { categoryId: {
required: true, required: true,
message: '请选择分类' message: '请选择分类',
}, },
type: { type: {
required: true, required: true,
message: '请选择海报类型' message: '请选择海报类型',
}, },
status: { status: {
required: true, required: true,
message: '请选择是否启用' message: '请选择是否启用',
} },
}, },
srcList: [], srcList: [],
ids: [], // 选中数组 ids: [], // 选中数组
previewImg: '', // 预览图片地址 previewImg: '', // 预览图片地址
activeObject: {}, activeObject: {},
fontColor: '' fontColor: '',
} }
}, },
watch: { watch: {
fontColor(hex) { fontColor(hex) {
this.setAttr('fill', hex) this.setAttr('fill', hex)
} },
}, },
created() {}, created() {},
mounted() {}, mounted() {},
...@@ -76,7 +76,7 @@ export default { ...@@ -76,7 +76,7 @@ export default {
type: data.type, type: data.type,
status: data.status, status: data.status,
backgroundImgPath: data.backgroundImgPath, backgroundImgPath: data.backgroundImgPath,
posterJSON: JSON.parse(data.otherField) posterJSON: JSON.parse(data.otherField),
} }
this.posterSubassemblyList = data.posterSubassemblyList || [] this.posterSubassemblyList = data.posterSubassemblyList || []
} else { } else {
...@@ -87,7 +87,7 @@ export default { ...@@ -87,7 +87,7 @@ export default {
type: '1', // 海报类型 type: '1', // 海报类型
status: 0, // 是否启用 0 启用 1 不启用 status: 0, // 是否启用 0 启用 1 不启用
backgroundImgPath: '', // 图片url backgroundImgPath: '', // 图片url
mediaId: '' // 图片id mediaId: '', // 图片id
} }
this.posterSubassemblyList = [] this.posterSubassemblyList = []
} }
...@@ -121,16 +121,16 @@ export default { ...@@ -121,16 +121,16 @@ export default {
deleteBtn.style.display = 'block' deleteBtn.style.display = 'block'
} }
canvas.on('selection:created', function(e) { canvas.on('selection:created', function (e) {
addDeleteBtn(e.target.lineCoords.tr.x, e.target.lineCoords.tr.y) addDeleteBtn(e.target.lineCoords.tr.x, e.target.lineCoords.tr.y)
}) })
canvas.on('selection:updated', function(e) { canvas.on('selection:updated', function (e) {
addDeleteBtn(e.target.lineCoords.tr.x, e.target.lineCoords.tr.y) addDeleteBtn(e.target.lineCoords.tr.x, e.target.lineCoords.tr.y)
}) })
//通用事件另外写法 //通用事件另外写法
canvas.on({ canvas.on({
'mouse:down': function(e) { 'mouse:down': function (e) {
if (e.target != undefined) { if (e.target != undefined) {
var ob = canvas.getActiveObject() var ob = canvas.getActiveObject()
if (ob) { if (ob) {
...@@ -150,11 +150,11 @@ export default { ...@@ -150,11 +150,11 @@ export default {
borderDashArray: [3, 3], borderDashArray: [3, 3],
snapAngle: 45, //在45度时自动保持到45的倍数 snapAngle: 45, //在45度时自动保持到45的倍数
snapThreshold: 5, snapThreshold: 5,
centeredRotation: true centeredRotation: true,
}) })
} }
} }
} },
}) })
//是否拖动 //是否拖动
...@@ -186,19 +186,19 @@ export default { ...@@ -186,19 +186,19 @@ export default {
// } // }
// }) // })
canvas.on('object:modified', function(e) { canvas.on('object:modified', function (e) {
addDeleteBtn(e.target.lineCoords.tr.x, e.target.lineCoords.tr.y) addDeleteBtn(e.target.lineCoords.tr.x, e.target.lineCoords.tr.y)
}) })
canvas.on('object:scaling', function(e) { canvas.on('object:scaling', function (e) {
deleteBtn.style.display = 'none' deleteBtn.style.display = 'none'
}) })
canvas.on('object:moving', function(e) { canvas.on('object:moving', function (e) {
deleteBtn.style.display = 'none' deleteBtn.style.display = 'none'
}) })
canvas.on('object:rotating', function(e) { canvas.on('object:rotating', function (e) {
deleteBtn.style.display = 'none' deleteBtn.style.display = 'none'
}) })
canvas.on('mouse:wheel', function(e) { canvas.on('mouse:wheel', function (e) {
deleteBtn.style.display = 'none' deleteBtn.style.display = 'none'
}) })
...@@ -220,7 +220,7 @@ export default { ...@@ -220,7 +220,7 @@ export default {
let activeObject = canvas.getActiveObject() let activeObject = canvas.getActiveObject()
if (activeObject) { if (activeObject) {
this.$confirm('是否确认删除吗?', '警告', { this.$confirm('是否确认删除吗?', '警告', {
type: 'warning' type: 'warning',
}).then(() => { }).then(() => {
canvas.remove(activeObject) canvas.remove(activeObject)
this.activeObject = null this.activeObject = null
...@@ -262,7 +262,7 @@ export default { ...@@ -262,7 +262,7 @@ export default {
left: 100, left: 100,
top: 100, top: 100,
borderDashArray: [3, 3], borderDashArray: [3, 3],
customType: { text: 1, image: 2, qrcode: 3 }[type] // 自定义类型 1 固定文本 2 固定图片 3 二维码图片 customType: { text: 1, image: 2, qrcode: 3 }[type], // 自定义类型 1 固定文本 2 固定图片 3 二维码图片
} }
switch (type) { switch (type) {
case 'text': case 'text':
...@@ -277,7 +277,7 @@ export default { ...@@ -277,7 +277,7 @@ export default {
case 'image': case 'image':
case 'qrcode': case 'qrcode':
new fabric.Image.fromURL( new fabric.Image.fromURL(
type == 'image' ? obj : 'http://demo.linkwechat.cn/lib/qrCode.png', type == 'image' ? obj : 'http://scrm.xxzhtc.cn/lib/qrCode.png',
(img) => { (img) => {
img.set(options) img.set(options)
// img.scale(this.canvas.width / img.width / 2) // img.scale(this.canvas.width / img.width / 2)
...@@ -300,9 +300,9 @@ export default { ...@@ -300,9 +300,9 @@ export default {
}, },
remove(id) { remove(id) {
this.$confirm('是否确认删除吗?', '警告', { this.$confirm('是否确认删除吗?', '警告', {
type: 'warning' type: 'warning',
}) })
.then(function() { .then(function () {
return removePoster(id) return removePoster(id)
}) })
.then(() => { .then(() => {
...@@ -370,7 +370,7 @@ export default { ...@@ -370,7 +370,7 @@ export default {
rotate: vo.angle, rotate: vo.angle,
order: i, // 层级 order: i, // 层级
// categoryId: 0, // 分类ID (不需要传了) // categoryId: 0, // 分类ID (不需要传了)
verticalType: 2 // 居中方式后端让写死2 verticalType: 2, // 居中方式后端让写死2
} }
posterSubList.push(posData) posterSubList.push(posData)
i++ i++
...@@ -379,7 +379,7 @@ export default { ...@@ -379,7 +379,7 @@ export default {
;(form.id ? updatePoster : addPoster)( ;(form.id ? updatePoster : addPoster)(
Object.assign( Object.assign(
{ {
posterSubassemblyList: posterSubList posterSubassemblyList: posterSubList,
}, },
form form
) )
...@@ -397,8 +397,8 @@ export default { ...@@ -397,8 +397,8 @@ export default {
}) })
} }
}) })
} },
} },
} }
</script> </script>
...@@ -461,7 +461,7 @@ export default { ...@@ -461,7 +461,7 @@ export default {
:close-on-click-modal="false" :close-on-click-modal="false"
> >
<div class="poster-edit-dialog fxbw"> <div class="poster-edit-dialog fxbw">
<div style="width: 30%;"> <div style="width: 30%">
<el-form ref="form" :rules="rules" :model="form" label-width="120px"> <el-form ref="form" :rules="rules" :model="form" label-width="120px">
<el-form-item label="海报名称" prop="title"> <el-form-item label="海报名称" prop="title">
<el-input v-model="form.title" maxlength="10" show-word-limit></el-input> <el-input v-model="form.title" maxlength="10" show-word-limit></el-input>
...@@ -472,7 +472,7 @@ export default { ...@@ -472,7 +472,7 @@ export default {
v-model="form.categoryId" v-model="form.categoryId"
:options="$refs.page.treeData[0].children" :options="$refs.page.treeData[0].children"
:props="$refs.page.groupProps" :props="$refs.page.groupProps"
style="width: 100%;" style="width: 100%"
></el-cascader> ></el-cascader>
<!-- <el-select <!-- <el-select
v-model="form.categoryId" v-model="form.categoryId"
...@@ -527,7 +527,7 @@ export default { ...@@ -527,7 +527,7 @@ export default {
<el-form-item label="背景图片" :required="true" :error="rangeErrorMsg"> <el-form-item label="背景图片" :required="true" :error="rangeErrorMsg">
<div v-if="form.backgroundImgPath"> <div v-if="form.backgroundImgPath">
<el-image <el-image
style="width: 100px; height: 100px; cursor: pointer;border-radius: 6px;" style="width: 100px; height: 100px; cursor: pointer; border-radius: 6px"
:src="form.backgroundImgPath" :src="form.backgroundImgPath"
fit="fit" fit="fit"
> >
...@@ -549,8 +549,7 @@ export default { ...@@ -549,8 +549,7 @@ export default {
<div style=""> <div style="">
<div id="canvas-wrap"> <div id="canvas-wrap">
<i class="el-icon-error" id="deleteBtn"></i> <i class="el-icon-error" id="deleteBtn"></i>
<canvas id="canvas" width="300" height="500" style="border: 1px solid #ddd;"> <canvas id="canvas" width="300" height="500" style="border: 1px solid #ddd"> </canvas>
</canvas>
</div> </div>
<div id="tbody-containerui-image-editor-controls"> <div id="tbody-containerui-image-editor-controls">
<ul class="menu"> <ul class="menu">
......
<template> <template>
<div v-loading="loading" :style="'height:'+ height"> <div v-loading="loading" :style="'height:' + height">
<iframe :src="src" frameborder="no" style="width: 100%;height: 100%" scrolling="auto" /> <iframe :src="src" frameborder="no" style="width: 100%; height: 100%" scrolling="auto" />
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name: "Druid", name: 'Druid',
data() { data() {
return { return {
src: process.env.VUE_APP_BASE_API + "/druid/index.html", src: window.lwConfig.BASE_API + '/druid/index.html',
height: document.documentElement.clientHeight - 94.5 + "px;", height: document.documentElement.clientHeight - 94.5 + 'px;',
loading: true loading: true,
}; }
}, },
mounted: function() { mounted: function () {
setTimeout(() => { setTimeout(() => {
this.loading = false; this.loading = false
}, 230); }, 230)
const that = this; const that = this
window.onresize = function temp() { window.onresize = function temp() {
that.height = document.documentElement.clientHeight - 94.5 + "px;"; that.height = document.documentElement.clientHeight - 94.5 + 'px;'
}; }
} },
}; }
</script> </script>
...@@ -83,16 +83,10 @@ ...@@ -83,16 +83,10 @@
></el-date-picker> ></el-date-picker>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery"
type="cyan"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button >搜索</el-button
> >
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery" <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
>重置</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -149,17 +143,10 @@ ...@@ -149,17 +143,10 @@
>导出</el-button >导出</el-button
> >
</el-col> </el-col>
<right-toolbar <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row> </el-row>
<el-table <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
v-loading="loading"
:data="userList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="50" align="center" /> <el-table-column type="selection" width="50" align="center" />
<el-table-column label="用户编号" align="center" prop="userId" /> <el-table-column label="用户编号" align="center" prop="userId" />
<el-table-column <el-table-column
...@@ -180,12 +167,7 @@ ...@@ -180,12 +167,7 @@
prop="dept.deptName" prop="dept.deptName"
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
/> />
<el-table-column <el-table-column label="手机号码" align="center" prop="phonenumber" width="120" />
label="手机号码"
align="center"
prop="phonenumber"
width="120"
/>
<el-table-column label="状态" align="center"> <el-table-column label="状态" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch <el-switch
...@@ -196,12 +178,7 @@ ...@@ -196,12 +178,7 @@
></el-switch> ></el-switch>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column label="创建时间" align="center" prop="createTime" width="160">
label="创建时间"
align="center"
prop="createTime"
width="160"
>
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
</template> </template>
...@@ -276,44 +253,24 @@ ...@@ -276,44 +253,24 @@
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="手机号码" prop="phonenumber"> <el-form-item label="手机号码" prop="phonenumber">
<el-input <el-input v-model="form.phonenumber" placeholder="请输入手机号码" maxlength="11" />
v-model="form.phonenumber"
placeholder="请输入手机号码"
maxlength="11"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="邮箱" prop="email"> <el-form-item label="邮箱" prop="email">
<el-input <el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" />
v-model="form.email"
placeholder="请输入邮箱"
maxlength="50"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item <el-form-item v-if="form.userId == undefined" label="用户名称" prop="userName">
v-if="form.userId == undefined"
label="用户名称"
prop="userName"
>
<el-input v-model="form.userName" placeholder="请输入用户名称" /> <el-input v-model="form.userName" placeholder="请输入用户名称" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item <el-form-item v-if="form.userId == undefined" label="用户密码" prop="password">
v-if="form.userId == undefined" <el-input v-model="form.password" placeholder="请输入用户密码" type="password" />
label="用户密码"
prop="password"
>
<el-input
v-model="form.password"
placeholder="请输入用户密码"
type="password"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
...@@ -374,11 +331,7 @@ ...@@ -374,11 +331,7 @@
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="备注"> <el-form-item label="备注">
<el-input <el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
v-model="form.remark"
type="textarea"
placeholder="请输入内容"
></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
...@@ -390,12 +343,7 @@ ...@@ -390,12 +343,7 @@
</el-dialog> </el-dialog>
<!-- 用户导入对话框 --> <!-- 用户导入对话框 -->
<el-dialog <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
:title="upload.title"
:visible.sync="upload.open"
width="400px"
append-to-body
>
<el-upload <el-upload
ref="upload" ref="upload"
:limit="1" :limit="1"
...@@ -414,14 +362,10 @@ ...@@ -414,14 +362,10 @@
<em>点击上传</em> <em>点击上传</em>
</div> </div>
<div class="el-upload__tip" slot="tip"> <div class="el-upload__tip" slot="tip">
<el-checkbox <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
v-model="upload.updateSupport" <el-link type="info" style="font-size: 12px" @click="importTemplate">下载模板</el-link>
/>是否更新已经存在的用户数据
<el-link type="info" style="font-size:12px" @click="importTemplate"
>下载模板</el-link
>
</div> </div>
<div class="el-upload__tip" style="color:red" slot="tip"> <div class="el-upload__tip" style="color: red" slot="tip">
提示:仅允许导入“xls”或“xlsx”格式文件! 提示:仅允许导入“xls”或“xlsx”格式文件!
</div> </div>
</el-upload> </el-upload>
...@@ -443,7 +387,7 @@ import { ...@@ -443,7 +387,7 @@ import {
exportUser, exportUser,
resetUserPwd, resetUserPwd,
changeUserStatus, changeUserStatus,
importTemplate importTemplate,
} from '@/api/system/user' } from '@/api/system/user'
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
import { treeselect } from '@/api/system/dept' import { treeselect } from '@/api/system/dept'
...@@ -493,7 +437,7 @@ export default { ...@@ -493,7 +437,7 @@ export default {
form: {}, form: {},
defaultProps: { defaultProps: {
children: 'children', children: 'children',
label: 'label' label: 'label',
}, },
// 用户导入参数 // 用户导入参数
upload: { upload: {
...@@ -508,7 +452,7 @@ export default { ...@@ -508,7 +452,7 @@ export default {
// 设置上传的请求头部 // 设置上传的请求头部
headers: { Authorization: 'Bearer ' + getToken() }, headers: { Authorization: 'Bearer ' + getToken() },
// 上传的地址 // 上传的地址
url: process.env.VUE_APP_BASE_API + '/system/user/importData' url: window.lwConfig.BASE_API + '/system/user/importData',
}, },
// 查询参数 // 查询参数
queryParams: { queryParams: {
...@@ -517,46 +461,38 @@ export default { ...@@ -517,46 +461,38 @@ export default {
userName: undefined, userName: undefined,
phonenumber: undefined, phonenumber: undefined,
status: undefined, status: undefined,
deptId: undefined deptId: undefined,
}, },
// 表单校验 // 表单校验
rules: { rules: {
userName: [ userName: [{ required: true, message: '用户名称不能为空', trigger: 'blur' }],
{ required: true, message: '用户名称不能为空', trigger: 'blur' } nickName: [{ required: true, message: '用户昵称不能为空', trigger: 'blur' }],
], deptId: [{ required: true, message: '归属部门不能为空', trigger: 'blur' }],
nickName: [ password: [{ required: true, message: '用户密码不能为空', trigger: 'blur' }],
{ required: true, message: '用户昵称不能为空', trigger: 'blur' }
],
deptId: [
{ required: true, message: '归属部门不能为空', trigger: 'blur' }
],
password: [
{ required: true, message: '用户密码不能为空', trigger: 'blur' }
],
email: [ email: [
{ required: true, message: '邮箱地址不能为空', trigger: 'blur' }, { required: true, message: '邮箱地址不能为空', trigger: 'blur' },
{ {
type: 'email', type: 'email',
message: "'请输入正确的邮箱地址", message: "'请输入正确的邮箱地址",
trigger: ['blur', 'change'] trigger: ['blur', 'change'],
} },
], ],
phonenumber: [ phonenumber: [
{ required: true, message: '手机号码不能为空', trigger: 'blur' }, { required: true, message: '手机号码不能为空', trigger: 'blur' },
{ {
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
message: '请输入正确的手机号码', message: '请输入正确的手机号码',
trigger: 'blur' trigger: 'blur',
} },
] ],
} },
} }
}, },
watch: { watch: {
// 根据名称筛选部门树 // 根据名称筛选部门树
deptName(val) { deptName(val) {
this.$refs.tree.filter(val) this.$refs.tree.filter(val)
} },
}, },
created() { created() {
this.getList() this.getList()
...@@ -575,13 +511,11 @@ export default { ...@@ -575,13 +511,11 @@ export default {
/** 查询用户列表 */ /** 查询用户列表 */
getList() { getList() {
this.loading = true this.loading = true
listUser(this.addDateRange(this.queryParams, this.dateRange)).then( listUser(this.addDateRange(this.queryParams, this.dateRange)).then((response) => {
(response) => { this.userList = response.rows
this.userList = response.rows this.total = response.total
this.total = response.total this.loading = false
this.loading = false })
}
)
}, },
/** 查询部门下拉树结构 */ /** 查询部门下拉树结构 */
getTreeselect() { getTreeselect() {
...@@ -602,22 +536,18 @@ export default { ...@@ -602,22 +536,18 @@ export default {
// 用户状态修改 // 用户状态修改
handleStatusChange(row) { handleStatusChange(row) {
let text = row.status === '0' ? '启用' : '停用' let text = row.status === '0' ? '启用' : '停用'
this.$confirm( this.$confirm('确认要"' + text + '""' + row.userName + '"用户吗?', '警告', {
'确认要"' + text + '""' + row.userName + '"用户吗?', confirmButtonText: '确定',
'警告', cancelButtonText: '取消',
{ type: 'warning',
confirmButtonText: '确定', })
cancelButtonText: '取消', .then(function () {
type: 'warning'
}
)
.then(function() {
return changeUserStatus(row.userId, row.status) return changeUserStatus(row.userId, row.status)
}) })
.then(() => { .then(() => {
this.msgSuccess(text + '成功') this.msgSuccess(text + '成功')
}) })
.catch(function() { .catch(function () {
row.status = row.status === '0' ? '1' : '0' row.status = row.status === '0' ? '1' : '0'
}) })
}, },
...@@ -640,7 +570,7 @@ export default { ...@@ -640,7 +570,7 @@ export default {
status: '0', status: '0',
remark: undefined, remark: undefined,
postIds: [], postIds: [],
roleIds: [] roleIds: [],
} }
this.resetForm('form') this.resetForm('form')
}, },
...@@ -693,7 +623,7 @@ export default { ...@@ -693,7 +623,7 @@ export default {
handleResetPwd(row) { handleResetPwd(row) {
this.$prompt('请输入"' + row.userName + '"的新密码', '提示', { this.$prompt('请输入"' + row.userName + '"的新密码', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消' cancelButtonText: '取消',
}) })
.then(({ value }) => { .then(({ value }) => {
resetUserPwd(row.userId, value).then((response) => { resetUserPwd(row.userId, value).then((response) => {
...@@ -705,7 +635,7 @@ export default { ...@@ -705,7 +635,7 @@ export default {
.catch(() => {}) .catch(() => {})
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function() { submitForm: function () {
this.$refs['form'].validate((valid) => { this.$refs['form'].validate((valid) => {
if (valid) { if (valid) {
if (this.form.userId != undefined) { if (this.form.userId != undefined) {
...@@ -731,23 +661,19 @@ export default { ...@@ -731,23 +661,19 @@ export default {
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const userIds = row.userId || this.ids const userIds = row.userId || this.ids
this.$confirm( this.$confirm('是否确认删除用户编号为"' + userIds + '"的数据项?', '警告', {
'是否确认删除用户编号为"' + userIds + '"的数据项?', confirmButtonText: '确定',
'警告', cancelButtonText: '取消',
{ type: 'warning',
confirmButtonText: '确定', })
cancelButtonText: '取消', .then(function () {
type: 'warning'
}
)
.then(function() {
return delUser(userIds) return delUser(userIds)
}) })
.then(() => { .then(() => {
this.getList() this.getList()
this.msgSuccess('删除成功') this.msgSuccess('删除成功')
}) })
.catch(function() {}) .catch(function () {})
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
...@@ -755,15 +681,15 @@ export default { ...@@ -755,15 +681,15 @@ export default {
this.$confirm('是否确认导出所有用户数据项?', '警告', { this.$confirm('是否确认导出所有用户数据项?', '警告', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning',
}) })
.then(function() { .then(function () {
return exportUser(queryParams) return exportUser(queryParams)
}) })
.then((response) => { .then((response) => {
this.download(response.msg) this.download(response.msg)
}) })
.catch(function() {}) .catch(function () {})
}, },
/** 导入按钮操作 */ /** 导入按钮操作 */
handleImport() { handleImport() {
...@@ -791,7 +717,7 @@ export default { ...@@ -791,7 +717,7 @@ export default {
// 提交上传文件 // 提交上传文件
submitFileForm() { submitFileForm() {
this.$refs.upload.submit() this.$refs.upload.submit()
} },
} },
} }
</script> </script>
<template> <template>
<div> <div>
<img v-bind:src="options.img" @click="editCropper()" title="点击上传头像" class="img-circle img-lg" /> <img
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body @opened="modalOpened"> v-bind:src="options.img"
@click="editCropper()"
title="点击上传头像"
class="img-circle img-lg"
/>
<el-dialog
:title="title"
:visible.sync="open"
width="800px"
append-to-body
@opened="modalOpened"
>
<el-row> <el-row>
<el-col :xs="24" :md="12" :style="{height: '350px'}"> <el-col :xs="24" :md="12" :style="{ height: '350px' }">
<vue-cropper <vue-cropper
ref="cropper" ref="cropper"
:img="options.img" :img="options.img"
...@@ -16,7 +27,7 @@ ...@@ -16,7 +27,7 @@
v-if="visible" v-if="visible"
/> />
</el-col> </el-col>
<el-col :xs="24" :md="12" :style="{height: '350px'}"> <el-col :xs="24" :md="12" :style="{ height: '350px' }">
<div class="avatar-upload-preview"> <div class="avatar-upload-preview">
<img :src="previews.url" :style="previews.img" /> <img :src="previews.url" :style="previews.img" />
</div> </div>
...@@ -25,26 +36,31 @@ ...@@ -25,26 +36,31 @@
<br /> <br />
<el-row> <el-row>
<el-col :lg="2" :md="2"> <el-col :lg="2" :md="2">
<el-upload action="#" :http-request="requestUpload" :show-file-list="false" :before-upload="beforeUpload"> <el-upload
action="#"
:http-request="requestUpload"
:show-file-list="false"
:before-upload="beforeUpload"
>
<el-button size="small"> <el-button size="small">
上传 上传
<i class="el-icon-upload el-icon--right"></i> <i class="el-icon-upload el-icon--right"></i>
</el-button> </el-button>
</el-upload> </el-upload>
</el-col> </el-col>
<el-col :lg="{span: 1, offset: 2}" :md="2"> <el-col :lg="{ span: 1, offset: 2 }" :md="2">
<el-button icon="el-icon-plus" size="small" @click="changeScale(1)"></el-button> <el-button icon="el-icon-plus" size="small" @click="changeScale(1)"></el-button>
</el-col> </el-col>
<el-col :lg="{span: 1, offset: 1}" :md="2"> <el-col :lg="{ span: 1, offset: 1 }" :md="2">
<el-button icon="el-icon-minus" size="small" @click="changeScale(-1)"></el-button> <el-button icon="el-icon-minus" size="small" @click="changeScale(-1)"></el-button>
</el-col> </el-col>
<el-col :lg="{span: 1, offset: 1}" :md="2"> <el-col :lg="{ span: 1, offset: 1 }" :md="2">
<el-button icon="el-icon-refresh-left" size="small" @click="rotateLeft()"></el-button> <el-button icon="el-icon-refresh-left" size="small" @click="rotateLeft()"></el-button>
</el-col> </el-col>
<el-col :lg="{span: 1, offset: 1}" :md="2"> <el-col :lg="{ span: 1, offset: 1 }" :md="2">
<el-button icon="el-icon-refresh-right" size="small" @click="rotateRight()"></el-button> <el-button icon="el-icon-refresh-right" size="small" @click="rotateRight()"></el-button>
</el-col> </el-col>
<el-col :lg="{span: 2, offset: 6}" :md="2"> <el-col :lg="{ span: 2, offset: 6 }" :md="2">
<el-button type="primary" size="small" @click="uploadImg()">提 交</el-button> <el-button type="primary" size="small" @click="uploadImg()">提 交</el-button>
</el-col> </el-col>
</el-row> </el-row>
...@@ -53,16 +69,16 @@ ...@@ -53,16 +69,16 @@
</template> </template>
<script> <script>
import store from "@/store"; import store from '@/store'
import { VueCropper } from "vue-cropper"; import { VueCropper } from 'vue-cropper'
import { uploadAvatar } from "@/api/system/user"; import { uploadAvatar } from '@/api/system/user'
export default { export default {
components: { VueCropper }, components: { VueCropper },
props: { props: {
user: { user: {
type: Object type: Object,
} },
}, },
data() { data() {
return { return {
...@@ -71,74 +87,73 @@ export default { ...@@ -71,74 +87,73 @@ export default {
// 是否显示cropper // 是否显示cropper
visible: false, visible: false,
// 弹出层标题 // 弹出层标题
title: "修改头像", title: '修改头像',
options: { options: {
img: store.getters.avatar, //裁剪图片的地址 img: store.getters.avatar, //裁剪图片的地址
autoCrop: true, // 是否默认生成截图框 autoCrop: true, // 是否默认生成截图框
autoCropWidth: 200, // 默认生成截图框宽度 autoCropWidth: 200, // 默认生成截图框宽度
autoCropHeight: 200, // 默认生成截图框高度 autoCropHeight: 200, // 默认生成截图框高度
fixedBox: true // 固定截图框大小 不允许改变 fixedBox: true, // 固定截图框大小 不允许改变
}, },
previews: {} previews: {},
}; }
}, },
methods: { methods: {
// 编辑头像 // 编辑头像
editCropper() { editCropper() {
this.open = true; this.open = true
}, },
// 打开弹出层结束时的回调 // 打开弹出层结束时的回调
modalOpened() { modalOpened() {
this.visible = true; this.visible = true
}, },
// 覆盖默认的上传行为 // 覆盖默认的上传行为
requestUpload() { requestUpload() {},
},
// 向左旋转 // 向左旋转
rotateLeft() { rotateLeft() {
this.$refs.cropper.rotateLeft(); this.$refs.cropper.rotateLeft()
}, },
// 向右旋转 // 向右旋转
rotateRight() { rotateRight() {
this.$refs.cropper.rotateRight(); this.$refs.cropper.rotateRight()
}, },
// 图片缩放 // 图片缩放
changeScale(num) { changeScale(num) {
num = num || 1; num = num || 1
this.$refs.cropper.changeScale(num); this.$refs.cropper.changeScale(num)
}, },
// 上传预处理 // 上传预处理
beforeUpload(file) { beforeUpload(file) {
if (file.type.indexOf("image/") == -1) { if (file.type.indexOf('image/') == -1) {
this.msgError("文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件。"); this.msgError('文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件。')
} else { } else {
const reader = new FileReader(); const reader = new FileReader()
reader.readAsDataURL(file); reader.readAsDataURL(file)
reader.onload = () => { reader.onload = () => {
this.options.img = reader.result; this.options.img = reader.result
}; }
} }
}, },
// 上传图片 // 上传图片
uploadImg() { uploadImg() {
this.$refs.cropper.getCropBlob(data => { this.$refs.cropper.getCropBlob((data) => {
let formData = new FormData(); let formData = new FormData()
formData.append("avatarfile", data); formData.append('avatarfile', data)
uploadAvatar(formData).then(response => { uploadAvatar(formData).then((response) => {
if (response.code === 200) { if (response.code === 200) {
this.open = false; this.open = false
this.options.img = process.env.VUE_APP_BASE_API + response.imgUrl; this.options.img = window.lwConfig.BASE_API + response.imgUrl
store.commit('SET_AVATAR', this.options.img); store.commit('SET_AVATAR', this.options.img)
this.msgSuccess("修改成功"); this.msgSuccess('修改成功')
} }
this.visible = false; this.visible = false
}); })
}); })
}, },
// 实时预览 // 实时预览
realTime(data) { realTime(data) {
this.previews = data;
}
}
};
</script>
\ No newline at end of file \ No newline at end of file
this.previews = data
},
},
}
</script>
<template> <template>
<div v-loading="loading" :style="'height:'+ height"> <div v-loading="loading" :style="'height:' + height">
<iframe :src="src" frameborder="no" style="width: 100%;height: 100%" scrolling="auto" /> <iframe :src="src" frameborder="no" style="width: 100%; height: 100%" scrolling="auto" />
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name: "Swagger", name: 'Swagger',
data() { data() {
return { return {
src: process.env.VUE_APP_BASE_API + "/swagger-ui.html", src: window.lwConfig.BASE_API + '/swagger-ui.html',
height: document.documentElement.clientHeight - 94.5 + "px;", height: document.documentElement.clientHeight - 94.5 + 'px;',
loading: true loading: true,
}; }
}, },
mounted: function() { mounted: function () {
setTimeout(() => { setTimeout(() => {
this.loading = false; this.loading = false
}, 230); }, 230)
const that = this; const that = this
window.onresize = function temp() { window.onresize = function temp() {
that.height = document.documentElement.clientHeight - 94.5 + "px;"; that.height = document.documentElement.clientHeight - 94.5 + 'px;'
}; }
} },
}; }
</script> </script>
'use strict' 'use strict'
const path = require('path') const path = require('path')
function resolve(dir) { function resolve(dir) {
return path.join(__dirname, dir) return path.join(__dirname, dir)
} }
//读取npm指令 process.argv 获取⾃定义参数
let argvs = process.argv.filter((e) => e.includes('='))
for (const iterator of argvs) {
let diyArg = iterator.split('=')
process.env['VUE_APP_' + diyArg[0].slice(2)] = diyArg[1]
}
const env = require('./env')
process.env.VUE_APP_TITLE = require('./package.json').description process.env.VUE_APP_TITLE = require('./package.json').description
// vue.config.js 配置说明 // vue.config.js 配置说明
//官方vue.config.js 参考文档 https://cli.vuejs.org/zh/config/#css-loaderoptions //官方vue.config.js 参考文档 https://cli.vuejs.org/zh/config/#css-loaderoptions
...@@ -13,11 +20,11 @@ module.exports = { ...@@ -13,11 +20,11 @@ module.exports = {
// 部署生产环境和开发环境下的URL。 // 部署生产环境和开发环境下的URL。
// 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上 // 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上
// 例如 https://www.xx.cn/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.xx.cn/admin/,则设置 baseUrl 为 /admin/。 // 例如 https://www.xx.cn/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.xx.cn/admin/,则设置 baseUrl 为 /admin/。
publicPath: process.env.VUE_APP_BASE_URL || '/', publicPath: env.BASE_URL || '/',
// 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist) // 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist)
outputDir: 'dist', outputDir: 'dist',
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下) // 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)
assetsDir: 'static', // assetsDir: 'static',
// 是否开启eslint保存检测,有效值:ture | false | 'error' // 是否开启eslint保存检测,有效值:ture | false | 'error'
lintOnSave: process.env.NODE_ENV === 'development', lintOnSave: process.env.NODE_ENV === 'development',
// 如果你不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。 // 如果你不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。
...@@ -31,30 +38,30 @@ module.exports = { ...@@ -31,30 +38,30 @@ module.exports = {
proxy: { proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy // detail: https://cli.vuejs.org/config/#devserver-proxy
['/api']: { ['/api']: {
target: process.env.VUE_APP_DOMAIN, target: env.DOMAIN,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
['^/api']: '' ['^/api']: '',
} },
} },
}, },
disableHostCheck: true disableHostCheck: true,
// https: true, // https: true,
}, },
css: { css: {
loaderOptions: { loaderOptions: {
sass: { sass: {
//依次导入的公用的scss变量,公用的scss混入,共用的默认样式 //依次导入的公用的scss变量,公用的scss混入,共用的默认样式
prependData: `@import "./src/styles/variables.scss";` prependData: `@import "./src/styles/variables.scss";`,
} },
} },
}, },
configureWebpack: { configureWebpack: {
resolve: { resolve: {
alias: { alias: {
'@': resolve('src') '@': resolve('src'),
} },
} },
}, },
chainWebpack(config) { chainWebpack(config) {
// 修复HMR // 修复HMR
...@@ -69,7 +76,7 @@ module.exports = { ...@@ -69,7 +76,7 @@ module.exports = {
.use('svg-sprite-loader') .use('svg-sprite-loader')
.loader('svg-sprite-loader') .loader('svg-sprite-loader')
.options({ .options({
symbolId: 'icon-[name]' symbolId: 'icon-[name]',
}) })
.end() .end()
...@@ -78,8 +85,8 @@ module.exports = { ...@@ -78,8 +85,8 @@ module.exports = {
rel: 'preload', rel: 'preload',
// to ignore runtime.js // to ignore runtime.js
fileBlacklist: [/\.map$/, /hot-update\.js$/, /runtime\..*\.js$/], fileBlacklist: [/\.map$/, /hot-update\.js$/, /runtime\..*\.js$/],
include: 'initial' include: 'initial',
} },
]) ])
// when there are many pages, it will cause too many meaningless requests // when there are many pages, it will cause too many meaningless requests
...@@ -92,8 +99,8 @@ module.exports = { ...@@ -92,8 +99,8 @@ module.exports = {
.use('script-ext-html-webpack-plugin', [ .use('script-ext-html-webpack-plugin', [
{ {
// `runtime` must same as runtimeChunk name. default is `runtime` // `runtime` must same as runtimeChunk name. default is `runtime`
inline: /runtime\..*\.js$/ inline: /runtime\..*\.js$/,
} },
]) ])
.end() .end()
...@@ -110,27 +117,27 @@ module.exports = { ...@@ -110,27 +117,27 @@ module.exports = {
name: 'chunk-libs', name: 'chunk-libs',
test: /[\\/]node_modules[\\/]/, test: /[\\/]node_modules[\\/]/,
priority: 10, priority: 10,
chunks: 'initial' // only package third parties that are initially dependent chunks: 'initial', // only package third parties that are initially dependent
}, },
elementUI: { elementUI: {
name: 'chunk-elementUI', // split elementUI into a single package name: 'chunk-elementUI', // split elementUI into a single package
priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm test: /[\\/]node_modules[\\/]_?element-ui(.*)/, // in order to adapt to cnpm
}, },
commons: { commons: {
name: 'chunk-commons', name: 'chunk-commons',
test: resolve('src/components'), // can customize your rules test: resolve('src/components'), // can customize your rules
minChunks: 3, // minimum common number minChunks: 3, // minimum common number
priority: 5, priority: 5,
reuseExistingChunk: true reuseExistingChunk: true,
} },
} },
}) })
config.optimization.runtimeChunk('single'), config.optimization.runtimeChunk('single'),
{ {
from: path.resolve(__dirname, './public/robots.txt'), //防爬虫文件 from: path.resolve(__dirname, './public/robots.txt'), //防爬虫文件
to: './' //到根目录下 to: './', //到根目录下
} }
}) })
} },
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!