commit f3ddfcb253059306fd996b518acf7fa8c504f086 Author: zhaobenzhi <1185490104@qq.com> Date: Thu Dec 26 00:14:54 2024 +0800 修改1 diff --git a/admin/src/utils/api.js b/admin/src/utils/api.js new file mode 100644 index 0000000..5e963fd --- /dev/null +++ b/admin/src/utils/api.js @@ -0,0 +1,17 @@ +const api = { + // 积分订单 + orderpage: 'orders/page', + orderdelete: 'orders/delete', + orderinfo: 'orders/info/', + ordersave: 'orders/save', + orderupdate: 'orders/update', + // 配置 + configpage: 'config/page', + configdelete: 'config/delete', + configinfo: 'config/info/', + configsave: 'config/save', + configupdate: 'config/update' + +} + +export default api diff --git a/admin/src/utils/base.js b/admin/src/utils/base.js new file mode 100644 index 0000000..c8a9b04 --- /dev/null +++ b/admin/src/utils/base.js @@ -0,0 +1,16 @@ +const base = { + get() { + return { + url : "http://localhost:8080/shuiguozaixianxiaoshou/", + name: "shuiguozaixianxiaoshou", + // 退出到首页链接 + indexUrl: 'http://localhost:8080/shuiguozaixianxiaoshou/front/index.html' + }; + }, + getProjectName(){ + return { + projectName: "精品水果线上销售网站" + } + } +} +export default base diff --git a/admin/src/utils/http.js b/admin/src/utils/http.js new file mode 100644 index 0000000..3648dd5 --- /dev/null +++ b/admin/src/utils/http.js @@ -0,0 +1,29 @@ +import axios from 'axios' +import router from '@/router/router-static' +import storage from '@/utils/storage' + +const http = axios.create({ + timeout: 1000 * 86400, + withCredentials: true, + baseURL: '/shuiguozaixianxiaoshou', + headers: { + 'Content-Type': 'application/json; charset=utf-8' + } +}) +// 请求拦截 +http.interceptors.request.use(config => { + config.headers['Token'] = storage.get('Token') // 请求头带上token + return config +}, error => { + return Promise.reject(error) +}) +// 响应拦截 +http.interceptors.response.use(response => { + if (response.data && response.data.code === 401) { // 401, token失效 + router.push({ name: 'login' }) + } + return response +}, error => { + return Promise.reject(error) +}) +export default http \ No newline at end of file diff --git a/admin/src/utils/i18n.js b/admin/src/utils/i18n.js new file mode 100644 index 0000000..76be5a4 --- /dev/null +++ b/admin/src/utils/i18n.js @@ -0,0 +1,12 @@ +// translate router.meta.title, be used in breadcrumb sidebar tagsview +export function generateTitle(title) { + const hasKey = this.$te('route.' + title) + + if (hasKey) { + // $t :this method from vue-i18n, inject in @/lang/index.js + const translatedTitle = this.$t('route.' + title) + + return translatedTitle + } + return title +} diff --git a/admin/src/utils/menu.js b/admin/src/utils/menu.js new file mode 100644 index 0000000..9a0595b --- /dev/null +++ b/admin/src/utils/menu.js @@ -0,0 +1,306 @@ +const menu = { + list() { + return [ + { + "backMenu":[ + { + "child":[ + { + "buttons":[ + "查看", + "新增", + "删除", + "修改" + ], + "menu":"公告类型管理", + "menuJump":"列表", + "tableName":"dictionaryGonggao" + } + , + { + "buttons":[ + "查看", + "新增", + "删除", + "修改" + ], + "menu":"商家信用类型管理", + "menuJump":"列表", + "tableName":"dictionaryShangjiaXingji" + } + , + { + "buttons":[ + "查看", + "新增", + "删除", + "修改" + ], + "menu":"一级分类管理", + "menuJump":"列表", + "tableName":"dictionaryShuiguo" + } + ], + "menu":"基础数据管理" + } + ,{ + "child":[ + { + "buttons":[ + "查看", + "新增", + "修改", + "删除" + ], + "menu":"公告管理", + "menuJump":"列表", + "tableName":"gonggao" + } + ], + "menu":"公告管理" + } + ,{ + "child":[ + { + "buttons":[ + "查看", + "新增", + "修改", + "删除" + ], + "menu":"水果管理", + "menuJump":"列表", + "tableName":"shuiguo" + } + , + { + "buttons":[ + "查看", + "修改", + "删除" + ], + "menu":"水果评价管理", + "menuJump":"列表", + "tableName":"shuiguoCommentback" + } + , + { + "buttons":[ + "查看", + "删除" + ], + "menu":"水果收藏管理", + "menuJump":"列表", + "tableName":"shuiguoCollection" + } + , + { + "buttons":[ + "订单", + "查看", + "删除" + ], + "menu":"水果订单管理", + "menuJump":"列表", + "tableName":"shuiguoOrder" + } + ], + "menu":"水果管理" + } + ,{ + "child":[ + { + "buttons":[ + "查看", + "新增", + "修改", + "删除" + ], + "menu":"单页数据管理", + "menuJump":"列表", + "tableName":"singleSeach" + } + ], + "menu":"单页数据管理" + } + ,{ + "child":[ + { + "buttons":[ + "查看", + "新增", + "修改", + "删除" + ], + "menu":"用户管理", + "menuJump":"列表", + "tableName":"yonghu" + } + ], + "menu":"用户管理" + } + ,{ + "child":[ + { + "buttons":[ + "查看", + "新增", + "审核", + "修改", + "删除" + ], + "menu":"商家管理", + "menuJump":"列表", + "tableName":"shangjia" + } + ], + "menu":"商家管理" + } + ,{ + "child":[ + { + "buttons":[ + "查看", + "新增", + "修改", + "删除" + ], + "menu":"轮播图管理", + "menuJump":"列表", + "tableName":"config" + } + ], + "menu":"轮播图信息" + } + ], + "frontMenu":[], + "hasBackLogin":"是", + "hasBackRegister":"否", + "hasFrontLogin":"否", + "hasFrontRegister":"否", + "roleName":"管理员", + "tableName":"users" + } + , + { + "backMenu":[ + { + "child":[ + { + "buttons":[ + "查看" + ], + "menu":"公告管理", + "menuJump":"列表", + "tableName":"gonggao" + } + ], + "menu":"公告管理" + } + ,{ + "child":[ + { + "buttons":[ + "查看", + "新增", + "修改", + "删除" + ], + "menu":"水果管理", + "menuJump":"列表", + "tableName":"shuiguo" + } + , + { + "buttons":[ + "查看", + "修改" + ], + "menu":"水果评价管理", + "menuJump":"列表", + "tableName":"shuiguoCommentback" + } + , + { + "buttons":[ + "订单", + "查看" + ], + "menu":"水果订单管理", + "menuJump":"列表", + "tableName":"shuiguoOrder" + } + ], + "menu":"水果管理" + } + ], + "frontMenu":[], + "hasBackLogin":"是", + "hasBackRegister":"否", + "hasFrontLogin":"否", + "hasFrontRegister":"否", + "roleName":"商家", + "tableName":"shangjia" + } + , + { + "backMenu":[ + { + "child":[ + { + "buttons":[ + "查看" + ], + "menu":"公告管理", + "menuJump":"列表", + "tableName":"gonggao" + } + ], + "menu":"公告管理" + } + ,{ + "child":[ + { + "buttons":[ + "查看" + ], + "menu":"水果评价管理", + "menuJump":"列表", + "tableName":"shuiguoCommentback" + } + , + { + "buttons":[ + "查看", + "删除" + ], + "menu":"水果收藏管理", + "menuJump":"列表", + "tableName":"shuiguoCollection" + } + , + { + "buttons":[ + "订单", + "查看" + ], + "menu":"水果订单管理", + "menuJump":"列表", + "tableName":"shuiguoOrder" + } + ], + "menu":"水果管理" + } + ], + "frontMenu":[], + "hasBackLogin":"是", + "hasBackRegister":"否", + "hasFrontLogin":"否", + "hasFrontRegister":"否", + "roleName":"用户", + "tableName":"yonghu" + } +] + } +} +export default menu; diff --git a/admin/src/utils/storage.js b/admin/src/utils/storage.js new file mode 100644 index 0000000..32295e1 --- /dev/null +++ b/admin/src/utils/storage.js @@ -0,0 +1,18 @@ +const storage = { + set(key, value) { + localStorage.setItem(key, JSON.stringify(value)); + }, + get(key) { + return localStorage.getItem(key)?localStorage.getItem(key).replace('"','').replace('"',''):""; + }, + getObj(key) { + return localStorage.getItem(key)?JSON.parse(localStorage.getItem(key)):null; + }, + remove(key) { + localStorage.removeItem(key); + }, + clear() { + localStorage.clear(); + } +} +export default storage; diff --git a/admin/src/utils/style.css b/admin/src/utils/style.css new file mode 100644 index 0000000..6a6fd12 --- /dev/null +++ b/admin/src/utils/style.css @@ -0,0 +1,94 @@ +/* 全局list页面按钮样式 */ +.slt { + margin: 0 !important; + display: flex; +} + +.ad { + margin: 0 !important; + display: flex; +} + +.pages { +& /deep/ el-pagination__sizes{ +& /deep/ el-input__inner { + height: 22px; + line-height: 22px; + } +} +} + + +.el-button+.el-button { + margin:0; +} + +.tables { +& /deep/ .el-button--success { + height: 36px; + color: rgba(40, 167, 69, 1); + font-size: 10px; + border-width: 0px; + border-style: solid; + border-color: #DCDFE6; + border-radius: 0px; + background-color: rgba(255, 255, 255, 1); + } + +& /deep/ .el-button--primary { + height: 36px; + color: rgba(255, 193, 7, 1); + font-size: 10px; + border-width: 0px; + border-style: solid; + border-color: #DCDFE6; + border-radius: 0px; + background-color: #fff; + } + +& /deep/ .el-button--danger { + height: 36px; + color: rgba(220, 53, 69, 1); + font-size: 10px; + border-width: 0px; + border-style: solid; + border-color: #DCDFE6; + border-radius: 0px; + background-color: #fff; + } + +& /deep/ .el-button { + margin: 4px; + } +} + +/* 全局add-or-update页面按钮样式 */ +.editor{ + height: 500px; + +& /deep/ .ql-container { + height: 310px; + } +} +.amap-wrapper { + width: 100%; + height: 500px; +} +.search-box { + position: absolute; +} +.addEdit-block { + margin: -10px; +} +.detail-form-content { + padding: 12px; +} +.btn .el-button { + padding: 0; +} +/*IndexMain.vue页面 list页面样式 + //背景颜色 + .el-main + //list页面的边框颜色 + .router-view +*/ \ No newline at end of file diff --git a/admin/src/utils/style.js b/admin/src/utils/style.js new file mode 100644 index 0000000..2ece2c4 --- /dev/null +++ b/admin/src/utils/style.js @@ -0,0 +1,9 @@ +const style = { + listStyle(){ + return {"searchBtnFontColor":"rgba(106, 0, 138, 1)","pagePosition":"1","inputFontSize":"14px","inputBorderRadius":"0px","tableBtnDelFontColor":"rgba(88, 179, 81, 1)","tableBtnIconPosition":"1","searchBtnHeight":"40px","inputIconColor":"rgba(88, 179, 81, 1)","searchBtnBorderRadius":"4px","tableStripe":true,"btnAdAllWarnFontColor":"rgba(88, 179, 81, 1)","tableBtnDelBgColor":"#fff","searchBtnIcon":"1","tableSize":"mini","searchBtnBorderStyle":"solid","tableSelection":false,"searchBtnBorderWidth":"2px","tableContentFontSize":"14px","searchBtnBgColor":"#fff","inputTitleSize":"14px","btnAdAllBorderColor":"rgba(88, 179, 81, 1)","pageJumper":true,"btnAdAllIconPosition":"1","searchBoxPosition":"3","tableBtnDetailFontColor":"rgba(88, 179, 81, 1)","tableBtnHeight":"30px","pagePager":true,"searchBtnBorderColor":"rgba(88, 179, 81, 1)","tableHeaderFontColor":"rgba(255, 255, 255, 1)","inputTitle":"1","tableBtnBorderRadius":"0px","btnAdAllFont":"1","btnAdAllDelFontColor":"rgba(88, 179, 81, 1)","tableBtnIcon":"1","btnAdAllHeight":"40px","btnAdAllWarnBgColor":"#fff","btnAdAllBorderWidth":"2px","tableStripeFontColor":"#606266","tableBtnBorderStyle":"none none solid none","inputHeight":"40px","btnAdAllBorderRadius":"4px","btnAdAllDelBgColor":"#fff","pagePrevNext":true,"btnAdAllAddBgColor":"rgba(250, 212, 0, 1)","searchBtnFont":"1","tableIndex":true,"btnAdAllIcon":"1","tableSortable":false,"pageSizes":true,"tableFit":true,"pageBtnBG":true,"searchBtnFontSize":"14px","tableBtnEditBgColor":"#fff","inputBorderWidth":"1px","inputFontPosition":"1","inputFontColor":"rgba(88, 179, 81, 1)","pageEachNum":10,"tableHeaderBgColor":"rgba(88, 179, 81, 1)","inputTitleColor":"rgba(88, 179, 81, 1)","btnAdAllBoxPosition":"1","tableBtnDetailBgColor":"#fff","inputIcon":"1","searchBtnIconPosition":"1","btnAdAllFontSize":"10px","inputBorderStyle":"none none solid none ","inputBgColor":"#fff","pageStyle":false,"pageTotal":true,"btnAdAllAddFontColor":"rgba(88, 179, 81, 1)","tableBtnFont":"1","tableContentFontColor":"#606266","inputBorderColor":"rgba(88, 179, 81, 1)","tableShowHeader":true,"tableBtnFontSize":"12px","tableBtnBorderColor":"rgba(88, 179, 81, 1)","inputIconPosition":"2","tableBorder":true,"btnAdAllBorderStyle":"solid","tableBtnBorderWidth":"1px","tableStripeBgColor":"rgba(227, 225, 225, 1)","tableBtnEditFontColor":"rgba(88, 179, 81, 1)","tableAlign":"left"} + }, + addStyle(){ + return {"btnSaveFontColor":"#fff","selectFontSize":"14px","btnCancelBorderColor":"#DCDFE6","inputBorderRadius":"4px","inputFontSize":"14px","textareaBgColor":"#fff","btnSaveFontSize":"14px","textareaBorderRadius":"4px","uploadBgColor":"#fff","textareaBorderStyle":"solid","btnCancelWidth":"88px","textareaHeight":"120px","dateBgColor":"#fff","btnSaveBorderRadius":"4px","uploadLableFontSize":"14px","textareaBorderWidth":"1px","inputLableColor":"rgba(199, 21, 133, 1)","addEditBoxColor":"rgba(242, 241, 242, 1)","dateIconFontSize":"14px","btnSaveBgColor":"rgba(199, 21, 133, 1)","uploadIconFontColor":"#8c939d","textareaBorderColor":"#DCDFE6","btnCancelBgColor":"rgba(253, 252, 254, 1)","selectLableColor":"rgba(199, 21, 133, 1)","btnSaveBorderStyle":"solid","dateBorderWidth":"1px","dateLableFontSize":"14px","dateBorderRadius":"4px","btnCancelBorderStyle":"solid","selectLableFontSize":"14px","selectBorderStyle":"solid","selectIconFontColor":"#C0C4CC","btnCancelHeight":"44px","inputHeight":"40px","btnCancelFontColor":"rgba(106, 0, 138, 1)","dateBorderColor":"#DCDFE6","dateIconFontColor":"#C0C4CC","uploadBorderStyle":"solid","dateBorderStyle":"solid","dateLableColor":"rgba(199, 21, 133, 1)","dateFontSize":"14px","inputBorderWidth":"1px","uploadIconFontSize":"28px","selectHeight":"40px","inputFontColor":"#606266","uploadHeight":"148px","textareaLableColor":"rgba(199, 21, 133, 1)","textareaLableFontSize":"14px","btnCancelFontSize":"14px","inputBorderStyle":"solid","btnCancelBorderRadius":"4px","inputBgColor":"#fff","inputLableFontSize":"14px","uploadLableColor":"rgba(199, 21, 133, 1)","uploadBorderRadius":"4px","btnSaveHeight":"44px","selectBgColor":"rgba(255, 255, 255, 1)","btnSaveWidth":"88px","selectIconFontSize":"14px","dateHeight":"40px","selectBorderColor":"#DCDFE6","inputBorderColor":"#DCDFE6","uploadBorderColor":"#DCDFE6","textareaFontColor":"#606266","selectBorderWidth":"1px","dateFontColor":"#606266","btnCancelBorderWidth":"1px","uploadBorderWidth":"1px","textareaFontSize":"14px","selectBorderRadius":"4px","selectFontColor":"rgba(10, 10, 10, 1)","btnSaveBorderColor":"#409EFF","btnSaveBorderWidth":"0px"} + } +} +export default style; \ No newline at end of file diff --git a/admin/src/utils/utils.js b/admin/src/utils/utils.js new file mode 100644 index 0000000..73c6b92 --- /dev/null +++ b/admin/src/utils/utils.js @@ -0,0 +1,61 @@ +import storage from './storage'; +import menu from './menu'; +/** + * 是否有权限 + * @param {*} key + */ +export function isAuth(tableName,key) { + let role = storage.get("role"); + if(!role){ + role = '管理员'; + } + let menus = menu.list(); + for(let i=0;i