Commit 7f2e4ed3 by 郑杰

v1.2 版本发布,代码同步后端v1.2版本

parent c6484593
{
"name": "eladmin-qt",
"version": "1.1.0",
"version": "1.2.0",
"license": "Apache License 2.0",
"description": "eladmin 前端代码",
"author": "jie <zhengjie@tom.com>",
......@@ -35,7 +35,8 @@
"@riophae/vue-treeselect": "0.0.37",
"file-saver": "1.3.8",
"sockjs-client": "1.3.0",
"stompjs": "2.3.3"
"stompjs": "2.3.3",
"wangeditor": ">=3.0.0"
},
"devDependencies": {
"autoprefixer": "8.5.0",
......
import request from '@/utils/request'
export function get() {
return request({
url: 'api/email',
method: 'get'
})
}
export function update(data) {
return request({
url: 'api/email',
data,
method: 'put'
})
}
export function send(data) {
return request({
url: 'api/email',
data,
method: 'post'
})
}
import request from '@/utils/request'
export function uoload(data) {
return request({
url: 'api/pictures',
method: 'post',
data
})
}
export function del(id) {
return request({
url: 'api/pictures/' + id,
method: 'delete'
})
}
......@@ -14,10 +14,6 @@
</template>
<script>
// const icons = [
// 'add', 'index', 'log', 'menu', 'monitor', 'user', 'system', 'sqlMonitor', 'permission',
// 'zujian', 'icon'
// ]
import icons from './requireIcons'
export default {
name: 'IconSelect',
......@@ -52,6 +48,8 @@ export default {
width: 100%;
padding: 10px;
.icon-list {
height: 200px;
overflow-y: scroll;
div {
height: 30px;
line-height: 30px;
......
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1545959978831" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="654" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M877.297288 553.796942L553.79643 877.298823c-54.370305 54.369282-126.656655 84.311221-203.547883 84.312245-76.890204-0.001023-149.177578-29.942963-203.546859-84.312245S62.389444 750.641145 62.389444 673.750941c0-76.890204 29.942963-149.177578 84.312244-203.547883l135.442762-135.441738c75.829036-75.829036 199.213157-75.829036 275.043217 0s75.830059 199.214181 0 275.043217L399.320173 767.674077c-17.620309 17.620309-46.188972 17.620309-63.809281 0-17.620309-17.621333-17.620309-46.188972 0-63.809281l157.867493-157.867494c40.645722-40.645722 40.645722-106.779955 0-147.424654-40.644699-40.645722-106.778932-40.645722-147.424654 0L210.51097 534.01234c-77.051887 77.05291-77.051887 202.423269 0 279.476179 77.051887 77.051887 202.423269 77.051887 279.475155 0l323.501882-323.501882c77.051887-77.050864 77.051887-202.423269 0-279.475156-77.05291-77.051887-202.424292-77.050864-279.476179 0-17.619286 17.620309-46.188972 17.620309-63.809281 0s-17.619286-46.189995 0-63.809281c54.369282-54.369282 126.657678-84.313268 203.546859-84.312244 76.892251 0 149.178601 29.942963 203.548906 84.312244 54.369282 54.369282 84.311221 126.656655 84.311221 203.547882 0 76.889181-29.942963 149.176554-84.312245 203.54686z" fill="" p-id="655"></path></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1545876716801" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2040" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M861.658611 876.885408 164.03803 876.885408c-56.431244 0-102.340853-45.911656-102.340853-102.345969l0-518.621814c0-56.43329 45.910633-102.345969 102.340853-102.345969L861.658611 153.571654c31.7931 0 53.361325 9.448186 64.100924 28.083615 11.435447 19.834744 7.302313 42.0937-11.340279 61.066821l-11.351536 11.55722 0.001023 0.001023c-0.045025 0.045025-0.601704 0.61296-1.64957 1.679245-0.103354 0.106424-0.205685 0.209778-0.305969 0.312108l-30.90487 31.462572c-0.024559 0.024559-0.050142 0.050142-0.073678 0.074701-27.242458 27.733645-70.074985 71.338768-123.530454 125.759215L619.241466 543.229259c-26.452465 26.931373-52.902884 53.858652-79.356372 80.785931l-6.842849 6.969739c-3.352351 3.415796-7.936763 5.339612-12.721743 5.339612-0.008186 0-0.016373 0-0.023536 0-4.79419-0.007163-9.381671-1.943258-12.729929-5.373381l-354.881566-363.519294c-6.876618-7.04444-6.740518-18.329461 0.302899-25.206078 7.04444-6.877641 18.329461-6.741541 25.206078 0.302899l342.16494 350.493629c24.486694-24.925692 48.969295-49.848315 73.448826-74.772984l295.180859-300.509215c10.350742-10.534937 7.335059-15.766079 5.885034-18.279319-3.749394-6.507204-15.85613-10.238179-33.215496-10.238179L164.03803 189.222619c-36.774555 0-66.691935 29.919427-66.691935 66.696028l0 518.621814c0 36.775578 29.91738 66.696028 66.691935 66.696028L861.658611 841.23649c36.775578 0 66.696028-29.919427 66.696028-66.696028L928.35464 324.875159c-0.01535-3.1569 0.242524-47.771003 25.434276-88.073918 5.216815-8.347109 16.21531-10.885931 24.562419-5.66707 8.347109 5.217838 10.884908 16.214287 5.66707 24.562419-19.908422 31.851429-20.016893 68.64645-20.015869 69.013817 0.001023 0.055259 0.001023 0.058328 0.001023 0.113587l0 449.715445C964.004581 830.973752 918.092925 876.885408 861.658611 876.885408z" p-id="2041"></path></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1545883026424" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2201" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M925.597853 836.903811c0.367367-2.783393 0.847298-5.528923 0.847298-8.40953L926.44515 180.091658c19.034519-11.079336 31.976272-31.470759 31.976272-55.082526 0-35.32146-28.633131-63.956637-63.953567-63.956637-23.611767 0-44.007283 12.941753-55.082526 31.980365L182.108594 93.03286c-11.076266-19.038612-31.470759-31.980365-55.082526-31.980365-35.31839 0-63.953567 28.635177-63.953567 63.956637 0 23.611767 12.9438 44.00319 31.976272 55.082526l0 648.402623c0 2.880607 0.479931 5.627161 0.851391 8.40953-19.4991 10.954493-32.827663 31.586392-32.827663 55.543014 0 35.317367 28.635177 63.953567 63.953567 63.953567 35.32146 0 63.953567-28.635177 63.953567-63.953567l639.536698 0c0 35.317367 28.631084 63.953567 63.953567 63.953567 35.319413 0 63.953567-28.635177 63.953567-63.953567C958.421422 868.490204 945.093882 847.859327 925.597853 836.903811zM862.491583 828.494281 159.00234 828.494281 159.00234 180.091658c9.596566-5.586229 17.524119-13.513782 23.110347-23.110347l657.273664 0c5.582135 9.596566 13.509688 17.524119 23.106254 23.110347L862.492606 828.494281z" p-id="2202"></path><path d="M670.62781 252.915243 350.86202 252.915243 318.885747 252.915243 286.908452 252.915243 286.908452 380.818285 350.86202 380.818285 350.86202 316.864718 478.768131 316.864718 478.768131 668.610874 414.815587 668.610874 414.815587 732.564441 606.675266 732.564441 606.675266 668.610874 542.721699 668.610874 542.721699 316.864718 670.62781 316.864718 670.62781 380.818285 734.585471 380.818285 734.585471 252.915243 702.609199 252.915243Z" p-id="2203"></path></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1545982895380" class="icon" style="" viewBox="0 0 1025 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1449" xmlns:xlink="http://www.w3.org/1999/xlink" width="200.1953125" height="200"><defs><style type="text/css"></style></defs><path d="M512.032 831.904c-19.168 0-38.304-9.92-58.144-29.76-7.808-7.808-7.808-20.48 0-28.288s20.48-7.808 28.288 0c12.192 12.224 21.984 18.144 29.856 18.144s17.664-5.92 29.856-18.144c7.808-7.808 20.48-7.808 28.288 0s7.808 20.48 0 28.288c-19.84 19.84-38.976 29.76-58.144 29.76zM0.032 525.504c0 49.888 4.256 95.136 12.8 135.68s20.544 75.744 36 105.536c15.456 29.792 35.008 55.904 58.656 78.336s49.344 40.928 77.056 55.456c27.744 14.528 59.456 26.304 95.2 35.264s72.096 15.264 109.056 18.848 77.696 5.376 122.144 5.376c44.448 0 85.248-1.792 122.4-5.376s73.6-9.856 109.344-18.848c35.744-8.96 67.552-20.736 95.456-35.264s53.792-33.024 77.6-55.456c23.808-22.432 43.456-48.544 58.944-78.336s27.552-64.96 36.256-105.536c8.704-40.576 13.056-85.792 13.056-135.68 0-89.376-27.744-166.368-83.2-230.976 3.2-8.608 5.952-18.496 8.256-29.6s4.544-26.816 6.656-47.104c2.144-20.288 1.344-43.712-2.4-70.272s-10.752-53.664-21.056-81.312l-8-1.632c-5.344-1.088-14.048-0.704-26.144 1.088s-26.208 5.024-42.4 9.696c-16.192 4.672-37.056 13.92-62.656 27.744s-52.608 31.328-81.056 52.512c-48.352-14.72-115.008-30.112-200-30.112s-151.808 15.392-200.544 30.112c-28.448-21.184-55.552-38.592-81.344-52.224s-46.4-22.976-61.856-28c-15.456-5.024-29.792-8.256-42.944-9.696s-21.6-1.888-25.344-1.344c-3.744 0.544-6.496 1.152-8.256 1.888-10.304 27.648-17.408 54.752-21.344 81.312s-4.8 49.888-2.656 69.984c2.144 20.096 4.448 35.904 6.944 47.392s5.344 21.344 8.544 29.6c-55.456 64.256-83.2 141.248-83.2 230.976zM136.576 639.392c0-58.016 21.344-110.624 64-157.856 12.8-14.4 27.648-25.312 44.544-32.704s36.096-11.616 57.6-12.608 42.048-0.8 61.6 0.608c19.552 1.408 43.744 3.296 72.544 5.696s53.696 3.616 74.656 3.616c20.96 0 45.856-1.184 74.656-3.616s52.992-4.288 72.544-5.696c19.552-1.408 40.096-1.6 61.6-0.608s40.8 5.216 57.856 12.608c17.056 7.392 32 18.304 44.8 32.704 42.656 47.232 64 99.84 64 157.856 0 34.016-3.552 64.32-10.656 90.944s-16.096 48.928-26.944 66.912c-10.848 18.016-26.048 33.216-45.6 45.632s-38.496 22.016-56.8 28.8c-18.304 6.784-41.952 12.096-70.944 15.904s-54.944 6.112-77.856 6.912c-22.944 0.8-51.808 1.216-86.656 1.216s-63.648-0.416-86.4-1.216c-22.752-0.8-48.608-3.104-77.6-6.912s-52.608-9.12-70.944-15.904c-18.304-6.816-37.248-16.416-56.8-28.8s-34.752-27.616-45.6-45.632c-10.848-18.016-19.84-40.32-26.944-66.912s-10.656-56.928-10.656-90.944zM256.032 608c0-53.024 28.64-96 64-96s64 42.976 64 96c0 53.024-28.64 96-64 96s-64-42.976-64-96zM640.032 608c0-53.024 28.64-96 64-96s64 42.976 64 96c0 53.024-28.64 96-64 96s-64-42.976-64-96z" p-id="1450"></path></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1545960873089" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1303" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M784 112H240C152 112 80 184 80 272v480c0 88 72 160 160 160h544c88 0 160-72 160-160V272c0-88-72-160-160-160z m96 640c0 52.8-43.2 96-96 96H240c-52.8 0-96-43.2-96-96V272c0-52.8 43.2-96 96-96h544c52.8 0 96 43.2 96 96v480z" fill="#4A576A" p-id="1304"></path><path d="M352 480c52.8 0 96-43.2 96-96s-43.2-96-96-96-96 43.2-96 96 43.2 96 96 96z m0-128c17.6 0 32 14.4 32 32s-14.4 32-32 32-32-14.4-32-32 14.4-32 32-32zM814.4 731.2l-3.2-3.2-177.6-177.6c-25.6-25.6-65.6-25.6-91.2 0l-80 80-36.8-36.8c-25.6-25.6-65.6-25.6-91.2 0l-134.4 134.4c-4.8 6.4-8 14.4-8 24 0 17.6 14.4 32 32 32 9.6 0 16-3.2 22.4-9.6l134.4-134.4 134.4 134.4c6.4 6.4 14.4 9.6 24 9.6 17.6 0 32-14.4 32-32 0-9.6-4.8-17.6-9.6-24l-52.8-52.8 80-80 180.8 180.8c6.4 4.8 12.8 8 20.8 8 17.6 0 32-14.4 32-32 0-8-3.2-16-8-20.8z" fill="#4A576A" p-id="1305"></path></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1545876582522" class="icon" style="" viewBox="0 0 1028 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1270" xmlns:xlink="http://www.w3.org/1999/xlink" width="200.78125" height="200"><defs><style type="text/css"></style></defs><path d="M20.746854 180.67456c-27.09504 27.136-21.31968 65.35168 0.26624 86.87616 0.86016 0.83968 87.49056 83.57888 209.3056 205.4144 3.13344 3.13344 7.22944 4.66944 11.32544 4.66944s8.192-1.57696 11.32544-4.66944c6.2464-6.2464 6.2464-16.384 0-22.6304-18.37056-18.37056-35.84-35.7376-52.40832-52.18304l50.85184-50.85184c6.2464-6.2464 6.2464-16.384 0-22.6304s-16.384-6.2464-22.6304 0l-50.97472 50.97472c-28.50816-28.16-53.63712-52.736-74.07616-72.66304l115.67104-115.67104c6.2464-6.2464 6.2464-16.384 0-22.6304s-16.384-6.2464-22.6304 0l-116.03968 116.03968c-23.552-22.81472-37.13024-35.77856-37.33504-36.00384-6.7584-6.7584-15.62624-25.76384 0-41.3696l160.01024-160.01024c6.18496-6.26688 22.6304-18.71872 40.67328-0.77824 0.79872 0.90112 81.59232 92.672 204.92288 216.00256 6.2464 6.2464 16.384 6.2464 22.6304 0s6.2464-16.384 0-22.6304c-122.55232-122.53184-202.752-213.6064-204.22656-215.26528-29.81888-29.75744-65.80224-20.82816-86.6304 0l-160.03072 160.01024zM699.392614 772.66944c-6.2464-6.2464-16.384-6.2464-22.6304 0l-50.91328 50.87232c-15.52384-15.70816-31.80544-32.1536-48.96768-49.31584-6.2464-6.2464-16.384-6.2464-22.6304 0s-6.2464 16.384 0 22.6304c118.53824 118.49728 201.3184 207.01184 202.50624 208.2816 10.97728 11.01824 26.0096 17.05984 42.33216 17.05984l0 0c16.7936 0 33.792-6.5536 44.31872-17.12128l159.92832-161.83296c20.13184-20.13184 21.27872-54.272 2.49856-73.1136l-214.58944-214.56896c-6.2464-6.2464-16.384-6.2464-22.6304 0s-6.2464 16.384 0 22.6304l214.58944 214.56896c6.41024 6.41024 5.18144 20.23424-2.51904 27.93472l-159.96928 161.83296c-3.6864 3.70688-12.04224 7.68-21.62688 7.68 0 0 0 0 0 0-5.50912 0-13.37344-1.35168-19.33312-7.33184-0.32768-0.34816-13.7216-14.66368-36.98688-39.0144l116.61312-116.61312c6.2464-6.2464 6.2464-16.384 0-22.6304s-16.384-6.2464-22.6304 0l-116.1216 116.1216c-19.968-20.76672-44.4416-46.01856-72.31488-74.42432l51.07712-51.07712c6.2464-6.20544 6.2464-16.32256 0-22.58944zM4.608614 1018.53184c3.072 3.13344 7.20896 4.79232 11.44832 4.79232 1.536 0 3.072-0.22528 4.56704-0.67584l320-95.3344c2.60096-0.77824 4.89472-2.1504 6.77888-4.05504l546.87744-550.56384c0.77824-0.77824 1.14688-1.76128 1.72032-2.62144l116.98176-117.00224c9.40032-9.44128 14.62272-21.95456 14.62272-35.28704 0-13.312-5.2224-25.82528-14.62272-35.20512l-167.5264-167.48544c-18.82112-18.82112-51.67104-18.82112-70.49216 0l-119.64416 119.64416c-0.77824 0.75776-1.18784 1.76128-1.76128 2.6624l-547.71712 547.7376c-1.80224 1.78176-3.13344 3.97312-3.91168 6.36928l-101.13024 310.8864c-1.86368 5.67296-0.4096 11.83744 3.74784 16.13824zM667.587174 168.67328l33.23904 33.23904-496.7424 498.0736-55.25504-12.53376 518.7584-518.77888zM224.072294 725.31968l499.42528-500.736 77.94688 77.94688-503.93088 497.47968-73.44128 0 0-74.69056zM860.365414 361.472l-519.80288 523.32544-18.47296-64.06144 501.98528-495.57504 36.29056 36.31104zM127.836774 715.48928l64.22528 14.58176 0 85.9136c0 8.82688 7.168 15.99488 15.99488 15.99488l83.968 0 20.29568 70.41024-271.60576 80.93696 87.1424-267.83744zM797.676134 37.72416c6.7584-6.7584 18.49344-6.7584 25.25184 0l167.5264 167.5264c3.35872 3.35872 5.2224 7.84384 5.2224 12.61568 0 4.73088-1.86368 9.25696-5.24288 12.63616l-107.86816 107.90912-192.73728-192.73728 107.86816-107.9296z" p-id="1271"></path></svg>
\ No newline at end of file
......@@ -8,6 +8,8 @@ const getters = {
name: state => state.user.name,
roles: state => state.user.roles,
permission_routers: state => state.permission.routers,
addRouters: state => state.permission.addRouters
addRouters: state => state.permission.addRouters,
socketApi: state => state.api.socketApi,
imagesUploadApi: state => state.api.imagesUploadApi
}
export default getters
import Vue from 'vue'
import Vuex from 'vuex'
import app from './modules/app'
import api from './modules/api'
import user from './modules/user'
import tagsView from './modules/tagsView'
import permission from './modules/permission'
......@@ -11,6 +12,7 @@ Vue.use(Vuex)
const store = new Vuex.Store({
modules: {
app,
api,
user,
tagsView,
permission
......
const baseUrl = process.env.BASE_API
const api = {
state: {
socketApi: baseUrl + '/websocket?token=kl',
imagesUploadApi: baseUrl + '/api/pictures'
}
}
export default api
.my-blockquote{
margin: 0px 0px 10px;
padding: 15px;
line-height: 22px;
border-left: 5px solid #409EFF;;
border-radius: 0 2px 2px 0;
background-color: #f2f2f2;
}
.my-code{
position: relative;
padding: 15px;
line-height: 20px;
border: 1px solid #ddd;
border-left-width: 6px;
color: #333;
font-family: Courier New;
font-size: 12px
}
......@@ -6,7 +6,7 @@ import { getToken } from '@/utils/auth'
// 创建axios实例
const service = axios.create({
baseURL: process.env.BASE_API, // api 的 base_url
timeout: 5000 // 请求超时时间
timeout: 10000 // 请求超时时间
})
// request拦截器
......@@ -39,7 +39,18 @@ service.interceptors.response.use(
}
},
error => {
const code = error.response.data.status
let code = 0
try {
code = error.response.data.status
} catch (e) {
if (error.toString().indexOf('timeout')) {
Notification.error({
title: '请求超时',
duration: 2500
})
return Promise.reject(error)
}
}
if (code === 403 || code === 401) {
MessageBox.confirm(
'Token 无效或已经过期,你可以取消继续留在该页面,或者重新登录',
......
......@@ -25,3 +25,13 @@ export function validatAlphabets(str) {
const reg = /^[A-Za-z]+$/
return reg.test(str)
}
/**
* 验证邮箱
* @param str
* @returns {boolean}
*/
export function validatEmail(str) {
const reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/
return reg.test(str)
}
<template>
<div>
<div ref="editor" style="text-align:left;margin: 5px;">
<h3 style="text-align: center;">欢迎使用 wangEditor 富文本编辑器!</h3>
<ul>
<li>富文本中图片上传使用的是sm.ms图床,支持上传到七牛云:<a style="color: #42b983" target="_blank" href="https://sm.ms/">sm.ms</a></li>
<li>更多帮助请查看官方文档:<a style="color: #42b983" target="_blank" href="https://www.kancloud.cn/wangfupeng/wangeditor3/332599">wangEditor</a></li>
</ul>
</div>
<div style="margin: 12px 5px;font-size: 16px;font-weight: bold;color: #696969">HTML渲染如下:</div>
<div class="editor-content" v-html="editorContent"/>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import E from 'wangeditor'
import { getToken } from '@/utils/auth'
export default {
data() {
return {
headers: {
'Authorization': 'Bearer ' + getToken()
},
editorContent:
`<h3 style="text-align: center;">欢迎使用 wangEditor 富文本编辑器!</h3>
<ul>
<li>富文本中图片上传使用的是sm.ms图床,支持上传到七牛云:<a style="color: #42b983" target="_blank" href="https://sm.ms/">sm.ms</a></li>
<li>更多帮助请查看官方文档:<a style="color: #42b983" target="_blank" href="https://www.kancloud.cn/wangfupeng/wangeditor3/332599">wangEditor</a></li>
</ul>`
}
},
computed: {
...mapGetters([
'imagesUploadApi'
])
},
mounted() {
var editor = new E(this.$refs.editor)
editor.customConfig.uploadImgShowBase64 = true // 使用 base64 保存图片
// 不可修改
editor.customConfig.uploadImgHeaders = this.headers
// 自定义文件名,不可修改,修改后会上传失败
editor.customConfig.uploadFileName = 'file'
editor.customConfig.uploadImgServer = this.imagesUploadApi // 上传图片到服务器
editor.customConfig.onchange = (html) => {
this.editorContent = html
}
editor.create()
}
}
</script>
<style scoped>
.editor-content{
padding-left: 5px;
}
</style>
<template>
<el-scrollbar wrap-class="scrollbar-wrapper">
<el-scrollbar style="z-index: 10000000" wrap-class="scrollbar-wrapper">
<el-menu
:show-timeout="200"
:default-active="$route.path"
......
......@@ -25,6 +25,7 @@
</template>
<script>
import { mapGetters } from 'vuex'
import SockJS from 'sockjs-client'
import Stomp from 'stompjs'
import { parseTime } from '@/utils/index'
......@@ -38,6 +39,11 @@ export default {
INFO: '#0000ff', WARN: '#FFFF00', ERROR: '#FF0000', DEBUG: '#DEA000'
}
},
computed: {
...mapGetters([
'socketApi'
])
},
// 监听控制滚动条
watch: {
data: {
......@@ -75,8 +81,7 @@ export default {
},
connection(_this) {
// 建立连接对象,注意部署到线上后也要修改对应的地址
// const socket = new SockJS('http://localhost:/websocket?token=kl')// 连接服务端提供的通信接口,连接以后才可以订阅广播消息和个人消息
const socket = new SockJS('http://localhost:8000/websocket?token=kl')// 连接服务端提供的通信接口,连接以后才可以订阅广播消息和个人消息
const socket = new SockJS(this.socketApi)// 连接服务端提供的通信接口,连接以后才可以订阅广播消息和个人消息
// 获取STOMP子协议的客户端对象
this.stompClient = Stomp.over(socket)
// 定义客户端的认证信息,按需求配置
......
......@@ -79,7 +79,7 @@ export default {
del(row.key).then(res => {
this.delLoading = false
row.delPopover = false
this.init(search.data().query)
this.init()
this.$notify({
title: '删除成功',
type: 'success',
......
......@@ -12,7 +12,7 @@
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="cancel">取消</el-button>
<el-button type="primary" @click="doSubmit">确认</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</div>
......@@ -22,7 +22,7 @@ import { add } from '@/api/redis'
export default {
data() {
return {
dialog: false, title: '新增缓存',
loading: false, dialog: false, title: '新增缓存',
form: { key: '', value: '' },
rules: {
key: [
......@@ -41,6 +41,7 @@ export default {
doSubmit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.loading = true
add(this.form).then(res => {
this.resetForm()
this.$notify({
......@@ -48,7 +49,11 @@ export default {
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
} else {
return false
......
......@@ -14,7 +14,7 @@
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="cancel">取消</el-button>
<el-button type="primary" @click="doSubmit">确认</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</div>
......@@ -34,7 +34,7 @@ export default {
},
data() {
return {
dialog: false, title: '编辑缓存',
loading: false, dialog: false, title: '编辑缓存',
form: { key: '', value: '' },
rules: {
key: [
......@@ -57,6 +57,7 @@ export default {
doSubmit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.loading = true
const _this = this
edit(this.form).then(res => {
this.resetForm()
......@@ -65,7 +66,11 @@ export default {
type: 'success',
duration: 2500
})
this.loading = false
_this.sup_this.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
} else {
return false
......
......@@ -8,9 +8,9 @@
<svg-icon :icon-class="scope.row.icon" />
</template>
</el-table-column>
<el-table-column prop="soft" align="center" width="100px" label="排序">
<el-table-column prop="sort" align="center" width="100px" label="排序">
<template slot-scope="scope">
<el-tag>{{ scope.row.soft }}</el-tag>
<el-tag>{{ scope.row.sort }}</el-tag>
</template>
</el-table-column>
<el-table-column :show-overflow-tooltip="true" prop="path" label="链接地址"/>
......@@ -93,7 +93,7 @@ export default {
del(row.id).then(res => {
this.delLoading = false
row.delPopover = false
this.init(search.data().query)
this.init()
this.$notify({
title: '删除成功',
type: 'success',
......
......@@ -19,8 +19,8 @@
<el-form-item label="菜单名称" prop="name">
<el-input v-model="form.name" placeholder="名称" style="width: 460px;"/>
</el-form-item>
<el-form-item label="菜单排序" prop="soft">
<el-input v-model.number="form.soft" placeholder="序号越小越靠前" style="width: 460px;"/>
<el-form-item label="菜单排序" prop="sort">
<el-input v-model.number="form.sort" placeholder="序号越小越靠前" style="width: 460px;"/>
</el-form-item>
<el-form-item label="内部菜单" prop="iframe">
<el-radio v-model="form.iframe" label="false"></el-radio>
......@@ -41,7 +41,7 @@
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="cancel">取消</el-button>
<el-button type="primary" @click="doSubmit">确认</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</div>
......@@ -65,13 +65,13 @@ export default {
},
data() {
return {
dialog: false, title: '新增菜单',
form: { name: '', soft: 999, path: '', component: '', iframe: 'false', roles: [], pid: 0, icon: '' }, roleIds: [],
loading: false, dialog: false, title: '新增菜单',
form: { name: '', sort: 999, path: '', component: '', iframe: 'false', roles: [], pid: 0, icon: '' }, roleIds: [],
rules: {
name: [
{ required: true, message: '请输入名称', trigger: 'blur' }
],
soft: [
sort: [
{ required: true, message: '请输入序号', trigger: 'blur', type: 'number' }
],
iframe: [
......@@ -87,6 +87,7 @@ export default {
doSubmit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.loading = true
this.form.roles = []
const _this = this
this.roleIds.forEach(function(data, index) {
......@@ -100,8 +101,14 @@ export default {
type: 'success',
duration: 2500
})
this.$parent.$parent.init()
this.$parent.$parent.getMenus()
this.loading = false
setTimeout(() => {
this.$parent.$parent.init()
this.$parent.$parent.getMenus()
}, 200)
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
} else {
return false
......@@ -111,7 +118,7 @@ export default {
resetForm() {
this.dialog = false
this.$refs['form'].resetFields()
this.form = { name: '', soft: 999, path: '', component: '', iframe: 'false', roles: [], pid: 0, icon: '' }
this.form = { name: '', sort: 999, path: '', component: '', iframe: 'false', roles: [], pid: 0, icon: '' }
this.roleIds = []
},
selected(name) {
......
......@@ -19,8 +19,8 @@
<el-form-item label="菜单名称" prop="name">
<el-input v-model="form.name" placeholder="名称" style="width: 460px;"/>
</el-form-item>
<el-form-item label="菜单排序" prop="soft">
<el-input v-model.number="form.soft" placeholder="序号越小越靠前" style="width: 460px;"/>
<el-form-item label="菜单排序" prop="sort">
<el-input v-model.number="form.sort" placeholder="序号越小越靠前" style="width: 460px;"/>
</el-form-item>
<el-form-item label="内部菜单" prop="iframe">
<el-radio v-model="form.iframe" label="false"></el-radio>
......@@ -41,7 +41,7 @@
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="cancel">取消</el-button>
<el-button type="primary" @click="doSubmit">确认</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</div>
......@@ -73,13 +73,13 @@ export default {
},
data() {
return {
dialog: false, title: '编辑菜单',
form: { id: '', name: '', soft: 999, path: '', component: '', iframe: 'false', roles: [], pid: 0, icon: '' }, roleIds: [],
loading: false, dialog: false, title: '编辑菜单',
form: { id: '', name: '', sort: 999, path: '', component: '', iframe: 'false', roles: [], pid: 0, icon: '' }, roleIds: [],
rules: {
name: [
{ required: true, message: '请输入名称', trigger: 'blur' }
],
soft: [
sort: [
{ required: true, message: '请输入序号', trigger: 'blur', type: 'number' }
],
iframe: [
......@@ -91,7 +91,7 @@ export default {
methods: {
to() {
const _this = this
this.form = { id: this.data.id, component: this.data.component, name: this.data.name, soft: this.data.soft, pid: this.data.pid, path: this.data.path, iframe: this.data.iframe.toString(), roles: [], icon: this.data.icon }
this.form = { id: this.data.id, component: this.data.component, name: this.data.name, sort: this.data.sort, pid: this.data.pid, path: this.data.path, iframe: this.data.iframe.toString(), roles: [], icon: this.data.icon }
this.data.roles.forEach(function(data, index) {
_this.roleIds.push(data.id)
})
......@@ -103,6 +103,7 @@ export default {
doSubmit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.loading = true
this.form.roles = []
const _this = this
this.roleIds.forEach(function(data, index) {
......@@ -116,8 +117,14 @@ export default {
type: 'success',
duration: 2500
})
_this.sup_this.init()
_this.sup_this.getMenus()
this.loading = false
setTimeout(() => {
_this.sup_this.init()
_this.sup_this.getMenus()
}, 200)
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
} else {
return false
......@@ -127,7 +134,7 @@ export default {
resetForm() {
this.dialog = false
this.$refs['form'].resetFields()
this.form = { id: '', name: '', soft: 999, path: '', component: '', iframe: 'false', roles: [], pid: 0, icon: '' }
this.form = { id: '', name: '', sort: 999, path: '', component: '', iframe: 'false', roles: [], pid: 0, icon: '' }
this.roleIds = []
},
selected(name) {
......
......@@ -78,7 +78,7 @@ export default {
del(row.id).then(res => {
this.delLoading = false
row.delPopover = false
this.init(search.data().query)
this.init()
this.$notify({
title: '删除成功',
type: 'success',
......
......@@ -15,7 +15,7 @@
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="cancel">取消</el-button>
<el-button type="primary" @click="doSubmit">确认</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</div>
......@@ -34,7 +34,7 @@ export default {
},
data() {
return {
dialog: false, title: '新增权限',
loading: false, dialog: false, title: '新增权限',
form: { name: '', alias: '', pid: 0 },
rules: {
name: [
......@@ -53,6 +53,7 @@ export default {
doSubmit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.loading = true
add(this.form).then(res => {
this.resetForm()
this.$notify({
......@@ -60,8 +61,14 @@ export default {
type: 'success',
duration: 2500
})
this.$parent.$parent.init()
this.$parent.$parent.getPermissions()
this.loading = false
setTimeout(() => {
this.$parent.$parent.init()
this.$parent.$parent.getPermissions()
}, 200)
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
} else {
return false
......
......@@ -15,7 +15,7 @@
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="cancel">取消</el-button>
<el-button type="primary" @click="doSubmit">确认</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</div>
......@@ -42,7 +42,7 @@ export default {
},
data() {
return {
dialog: false, title: '编辑权限',
loading: false, dialog: false, title: '编辑权限',
form: { id: '', name: '', alias: '', pid: 0 },
rules: {
name: [
......@@ -65,6 +65,7 @@ export default {
doSubmit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.loading = true
const _this = this
edit(this.form).then(res => {
this.resetForm()
......@@ -73,8 +74,14 @@ export default {
type: 'success',
duration: 2500
})
_this.sup_this.init()
_this.sup_this.getPermissions()
this.loading = false
setTimeout(() => {
_this.sup_this.init()
_this.sup_this.getPermissions()
}, 200)
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
} else {
return false
......
......@@ -76,7 +76,7 @@ export default {
del(row.id).then(res => {
this.delLoading = false
row.delPopover = false
this.init(search.data().query)
this.init()
this.$notify({
title: '删除成功',
type: 'success',
......
......@@ -15,7 +15,7 @@
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="cancel">取消</el-button>
<el-button type="primary" @click="doSubmit">确认</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</div>
......@@ -34,7 +34,7 @@ export default {
},
data() {
return {
dialog: false, title: '新增角色',
loading: false, dialog: false, title: '新增角色',
form: { name: '', permissions: [], remark: '' }, permissionIds: [],
rules: {
name: [
......@@ -50,6 +50,7 @@ export default {
doSubmit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.loading = true
this.form.permissions = []
const _this = this
this.permissionIds.forEach(function(data, index) {
......@@ -63,7 +64,11 @@ export default {
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
} else {
return false
......
......@@ -17,7 +17,7 @@
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="cancel">取消</el-button>
<el-button type="primary" @click="doSubmit">确认</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</div>
......@@ -44,7 +44,7 @@ export default {
},
data() {
return {
dialog: false, title: '编辑角色',
loading: false, dialog: false, title: '编辑角色',
form: { id: '', name: '', permissions: [], remark: '' }, permissionIds: [],
rules: {
name: [
......@@ -68,6 +68,7 @@ export default {
doSubmit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.loading = true
this.form.permissions = []
const _this = this
this.permissionIds.forEach(function(data, index) {
......@@ -81,7 +82,11 @@ export default {
type: 'success',
duration: 2500
})
this.loading = false
_this.sup_this.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
} else {
return false
......
......@@ -89,7 +89,7 @@ export default {
del(row.id).then(res => {
this.delLoading = false
row.delPopover = false
this.init(search.data().query)
this.init()
this.$notify({
title: '删除成功',
type: 'success',
......
......@@ -19,7 +19,7 @@
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="cancel">取消</el-button>
<el-button type="primary" @click="doSubmit">确认</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</div>
......@@ -38,7 +38,7 @@ export default {
},
data() {
return {
dialog: false, title: '新增用户',
loading: false, dialog: false, title: '新增用户',
form: { username: '', email: '', enabled: 'false', roles: [] }, roleIds: [],
rules: {
username: [
......@@ -62,6 +62,7 @@ export default {
doSubmit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.loading = true
this.form.roles = []
const _this = this
this.roleIds.forEach(function(data, index) {
......@@ -76,7 +77,11 @@ export default {
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
} else {
return false
......
......@@ -19,7 +19,7 @@
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="cancel">取消</el-button>
<el-button type="primary" @click="doSubmit">确认</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</div>
......@@ -46,7 +46,7 @@ export default {
},
data() {
return {
dialog: false, title: '编辑用户',
loading: false, dialog: false, title: '编辑用户',
form: { id: '', username: '', email: '', enabled: '', roles: [] }, roleIds: [],
rules: {
username: [
......@@ -78,6 +78,7 @@ export default {
doSubmit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.loading = true
this.form.roles = []
const _this = this
this.roleIds.forEach(function(data, index) {
......@@ -91,7 +92,11 @@ export default {
type: 'success',
duration: 2500
})
this.loading = false
_this.sup_this.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
} else {
return false
......
<template>
<el-tabs v-model="activeName" style="padding-left: 5px;" @tab-click="handleClick">
<el-tab-pane label="邮箱配置" name="first">
<Config/>
</el-tab-pane>
<el-tab-pane label="邮件测试" name="second">
<Send/>
</el-tab-pane>
<el-tab-pane label="使用说明" name="third">
<Description/>
</el-tab-pane>
</el-tabs>
</template>
<script>
import Config from './module/config'
import Send from './module/send'
import Description from './module/description'
export default {
components: { Config, Send, Description },
data() {
return {
activeName: 'first'
}
},
methods: {
handleClick(tab, event) {
console.log(tab, event)
}
}
}
</script>
<style scoped>
</style>
<template>
<el-form ref="form" :model="form" :rules="rules" style="margin-top: 6px;" size="small" label-width="100px">
<el-form-item label="发件人邮箱" prop="fromUser">
<el-input v-model="form.fromUser" style="width: 40%"/>
<span style="color: #C0C0C0;margin-left: 10px;">Sender mailbox</span>
</el-form-item>
<el-form-item label="发件用户名" prop="user">
<el-input v-model="form.user" style="width: 40%;"/>
<span style="color: #C0C0C0;margin-left: 10px;">Sender usernamex</span>
</el-form-item>
<el-form-item label="邮箱密码" prop="pass">
<el-input v-model="form.pass" type="password" style="width: 40%;"/>
<span style="color: #C0C0C0;margin-left: 10px;">email Password</span>
</el-form-item>
<el-form-item label="SMTP地址" prop="host">
<el-input v-model="form.host" style="width: 40%;"/>
<span style="color: #C0C0C0;margin-left: 10px;">SMTP address</span>
</el-form-item>
<el-form-item label="SMTP端口" prop="port">
<el-input v-model="form.port" style="width: 40%;"/>
<span style="color: #C0C0C0;margin-left: 10px;">SMTP port</span>
</el-form-item>
<el-button :loading="loading" style="margin-left:5%;" size="medium" type="success" @click="doSubmit">保存配置</el-button>
</el-form>
</template>
<script>
import { get, update } from '@/api/email'
export default {
name: 'Config',
data() {
return {
loading: false, form: { id: 1, fromUser: '', user: '', pass: '', host: '', port: '', sslEnable: '' },
rules: {
fromUser: [
{ required: true, message: '请输入发件人邮箱', trigger: 'blur' },
{ type: 'email', message: '请输入正确的邮箱地址', trigger: 'blur' }
],
user: [
{ required: true, message: '请输入发件用户名', trigger: 'blur' }
],
pass: [
{ required: true, message: '密码不能为空', trigger: 'blur' }
],
host: [
{ required: true, message: 'SMTP地址不能为空', trigger: 'blur' }
],
port: [
{ required: true, message: 'SMTP端口不能为空', trigger: 'blur' }
]
}
}
},
created() {
this.init()
},
methods: {
init() {
get().then(res => {
this.form = res
})
},
doSubmit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.loading = true
update(this.form).then(res => {
this.$notify({
title: '修改成功',
type: 'success',
duration: 2500
})
this.loading = false
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
} else {
return false
}
})
}
}
}
</script>
<style scoped>
</style>
<template>
<div>
<blockquote class="my-blockquote">注意</blockquote>
<pre class="my-code">
邮件服务器必须支持并打开SMTP协议,详细请查看相关帮助说明
配置文件的样例中提供的是我测试邮件功能注册的sina.com邮箱
帐号密码公开,供测试使用,存入数据库的密码会加密处理,请文明测试</pre>
<blockquote class="my-blockquote"> 邮件服务器配置</blockquote>
<pre class="my-code">
# 邮件服务器的SMTP地址,可选,默认为smtp
# 邮件服务器的SMTP端口,可选,默认465或者25
# 发件人(必须正确,否则发送失败)
# 用户名,默认为发件人邮箱前缀
# 密码(注意,某些邮箱需要为SMTP服务单独设置密码,如QQ和163等等)
# 是否开启ssl,默认开启</pre>
<blockquote class="my-blockquote">发送邮箱</blockquote>
<pre class="my-code">
MailAccount account = new MailAccount();
account.setHost("smtp.sina.com");
account.setPort("465");
account.setAuth(true);
account.setFrom("auaur@sina.com");
account.setUser("eladmin");
account.setPass("pass");
# 倒数第二个参数:是否为http格式
MailUtil.send(account, CollUtil.newArrayList("zhengjie@tom.com"), "测试", "邮件来自eladmin测试", true,file...);</pre>
<blockquote class="my-blockquote">更多帮助</blockquote>
<pre class="my-code">更多帮助请查看文档:<a style="color:#009688" href="http://hutool.mydoc.io/#text_319499" target="_black">hutool工具包</a></pre>
</div>
</template>
<script>
import '@/styles/description.scss'
export default {
name: 'Description'
}
</script>
<style scoped>
</style>
<template>
<div>
<el-form ref="form" :model="form" :rules="rules" style="margin-top: 6px;" size="small" label-width="100px">
<el-form-item label="邮件标题" prop="subject">
<el-input v-model="form.subject" style="width: 40%"/>
</el-form-item>
<el-form-item
v-for="(domain, index) in tos"
:label="'收件邮箱' + (index === 0 ? '': index)"
:key="domain.key">
<el-input v-model="domain.value" style="width: 31%"/>
<el-button icon="el-icon-plus" @click="addDomain" />
<el-button style="margin-left:0px;" icon="el-icon-minus" @click.prevent="removeDomain(domain)"/>
</el-form-item>
<div ref="editor" class="editor"/>
<el-button :loading="loading" style="margin-left:2%;" size="medium" type="success" @click="doSubmit">发送邮件</el-button>
</el-form>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import { getToken } from '@/utils/auth'
import { send } from '@/api/email'
import { validatEmail } from '@/utils/validate'
import E from 'wangeditor'
export default {
name: 'Index',
data() {
return {
headers: {
'Authorization': 'Bearer ' + getToken()
},
loading: false, form: { subject: '', tos: [], content: '' },
tos: [{
value: ''
}],
rules: {
subject: [
{ required: true, message: '标题不能为空', trigger: 'blur' }
]
}
}
},
computed: {
...mapGetters([
'imagesUploadApi'
])
},
mounted() {
var editor = new E(this.$refs.editor)
editor.customConfig.uploadImgShowBase64 = true // 使用 base64 保存图片
// 不可修改
editor.customConfig.uploadImgHeaders = this.headers
// 自定义文件名,不可修改,修改后会上传失败
editor.customConfig.uploadFileName = 'file'
editor.customConfig.uploadImgServer = this.imagesUploadApi // 上传图片到服务器
editor.customConfig.onchange = (html) => {
this.form.content = html
}
editor.create()
},
methods: {
removeDomain(item) {
var index = this.tos.indexOf(item)
if (index !== -1 && this.tos.length !== 1) {
this.tos.splice(index, 1)
} else {
this.$message({
message: '请至少保留一位联系人',
type: 'warning'
})
}
},
addDomain() {
this.tos.push({
value: '',
key: Date.now()
})
},
doSubmit() {
const _this = this
this.$refs['form'].validate((valid) => {
this.form.tos = []
if (valid) {
let sub = false
this.tos.forEach(function(data, index) {
if (data.value === '') {
_this.$message({
message: '收件邮箱不能为空',
type: 'warning'
})
sub = true
} else if (validatEmail(data.value)) {
_this.form.tos.push(data.value)
} else {
_this.$message({
message: '收件邮箱格式错误',
type: 'warning'
})
sub = true
}
})
if (sub) { return false }
this.loading = true
send(this.form).then(res => {
this.$notify({
title: '发送成功',
type: 'success',
duration: 2500
})
this.loading = false
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
} else {
return false
}
})
}
}
}
</script>
<style scoped>
.editor{
text-align:left;
margin: 20px;
}
</style>
<template>
<div class="app-container">
<search :query="query"/>
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" border style="width: 100%;">
<el-table-column prop="filename" label="文件名"/>
<el-table-column prop="username" label="上传者"/>
<el-table-column :show-overflow-tooltip="true" prop="url" label="链接地址">
<template slot-scope="scope">
<a :href="scope.row.url" style="color: #42b983" target="_blank">{{ scope.row.url }}</a>
</template>
</el-table-column>
<el-table-column prop="size" label="文件大小"/>
<el-table-column prop="height" label="高度"/>
<el-table-column prop="width" label="宽度"/>
<el-table-column prop="createTime" label="创建日期">
<template slot-scope="scope">
<span>{{ time(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="100px" align="center">
<template slot-scope="scope">
<el-popover
v-if="checkPermission(['ADMIN','PICTURE_ALL','PICTURE_DELETE'])"
v-model="scope.row.delPopover"
placement="top"
width="180">
<p>确定删除本条数据吗?</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="scope.row.delPopover = false">取消</el-button>
<el-button :loading="delLoading" type="primary" size="mini" @click="subDelete(scope.$index, scope.row)">确定</el-button>
</div>
<el-button slot="reference" type="danger" size="mini" @click="scope.row.delPopover = true">删除</el-button>
</el-popover>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission' // 权限判断函数
import initData from '../../../mixins/initData'
import { del } from '@/api/picture'
import { parseTime } from '@/utils/index'
import search from './module/search'
export default {
components: { search },
mixins: [initData],
data() {
return {
delLoading: false, sup_this: this
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
checkPermission,
beforeInit() {
this.url = 'api/pictures'
const sort = 'id,desc'
const query = this.query
const value = query.value
this.params = { page: this.page, size: this.size, sort: sort }
if (value) { this.params['filename'] = value }
return true
},
subDelete(index, row) {
this.delLoading = true
del(row.id).then(res => {
this.delLoading = false
row.delPopover = false
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
row.delPopover = false
console.log(err.response.data.message)
})
},
time(time) {
return parseTime(time)
}
}
}
</script>
<style scoped>
</style>
<template>
<div>
<el-button class="filter-item" size="mini" type="primary" icon="el-icon-upload" @click="dialog = true">上传图片</el-button>
<el-dialog :visible.sync="dialog" width="600px" @close="doSubmit">
<el-upload
:on-preview="handlePictureCardPreview"
:before-remove="handleBeforeRemove"
:on-success="handleSuccess"
:on-error="handleError"
:headers="headers"
:file-list="fileList"
:action="imagesUploadApi"
list-type="picture-card">
<i class="el-icon-plus"/>
</el-upload>
<el-dialog :visible.sync="dialogVisible">
<img :src="dialogImageUrl" width="100%" alt="">
</el-dialog>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import { del } from '@/api/picture'
import { getToken } from '@/utils/auth'
export default {
data() {
return {
headers: {
'Authorization': 'Bearer ' + getToken()
},
dialog: false,
dialogImageUrl: '',
dialogVisible: false,
fileList: [],
pictures: []
}
},
computed: {
...mapGetters([
'imagesUploadApi'
])
},
methods: {
handleSuccess(response, file, fileList) {
const uid = file.uid
const id = response.id
this.pictures.push({ uid, id })
},
handleBeforeRemove(file, fileList) {
for (var i = 0; i < this.pictures.length; i++) {
if (this.pictures[i].uid === file.uid) {
del(this.pictures[i].id).then(res => {})
return true
}
}
},
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url
this.dialogVisible = true
},
// 刷新列表数据
doSubmit() {
this.fileList = []
this.dialogVisible = false
this.dialogImageUrl = ''
this.dialog = false
this.$parent.$parent.init()
},
// 监听上传失败
handleError(e, file, fileList) {
const msg = JSON.parse(e.message)
this.$notify({
title: msg.message,
type: 'error',
duration: 2500
})
}
}
}
</script>
<style scoped>
div{
display: inline-block;
margin-left: 5px;
margin-right: 5px;
}
</style>
<template>
<div class="head-container">
<el-input v-model="query.value" clearable placeholder="输入文件名称搜索" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery"/>
<el-button class="filter-item" size="mini" type="primary" icon="el-icon-search" @click="toQuery">搜索</el-button>
<add v-if="checkPermission(['ADMIN','PICTURE_ALL','PICTURE_UPLOAD'])"/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission' // 权限判断函数
import add from './add'
// 查询条件
export default {
components: { add },
props: {
query: {
type: Object,
required: true
}
},
methods: {
checkPermission,
toQuery() {
console.log(this.query)
this.$parent.page = 0
this.$parent.init()
}
}
}
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment