diff --git a/.env.development b/.env.development index 682dfda..cde91fe 100644 --- a/.env.development +++ b/.env.development @@ -3,8 +3,8 @@ VITE_NOW_TYPE = 'dist' # Base API # VITE_APP_BASE_URL='http://192.168.1.13:8546' -# VITE_PUSH_URL = 'ws://192.168.1.22:8787' -# VITE_APP_BASE_URL = 'http://192.168.1.22:8546' +VITE_PUSH_URL = 'ws://192.168.1.22:8787' +VITE_APP_BASE_URL = 'http://192.168.1.22:8546' -VITE_PUSH_URL ='wss://erp.lihaink.cn/pull' -VITE_APP_BASE_URL='https://erp.lihaink.cn' +# VITE_PUSH_URL ='wss://erp.lihaink.cn/pull' +# VITE_APP_BASE_URL='https://erp.lihaink.cn' diff --git a/src/api/quote.ts b/src/api/quote.ts new file mode 100644 index 0000000..9e6e26c --- /dev/null +++ b/src/api/quote.ts @@ -0,0 +1,23 @@ +import request from "@/utils/request"; + +/** + * @description 供应商报价日期列表 + */ +export function opurchaseGoodsOfferDateListsApi(params: any) { + return request.get({ url: "/operation/OpurchaseGoodsOffer/date_lists", params }); +} + +/** + * @description 供应商报价列表 + */ +export function opurchaseGoodsOfferListsApi(params: any) { + return request.get({ url: "/operation/OpurchaseGoodsOffer/lists", params }); +} + +/** + * @description 提交报价 + */ +export function opurchaseGoodsOfferOfferApi(params: any) { + return request.post({ url: "/operation/OpurchaseGoodsOffer/offer", params }); + +} diff --git a/src/enums/pageEnum.ts b/src/enums/pageEnum.ts index 1509ff5..f51a3b2 100644 --- a/src/enums/pageEnum.ts +++ b/src/enums/pageEnum.ts @@ -1,6 +1,7 @@ export enum PageEnum { //登录页面 LOGIN = '/login', + ADMIN_LOGIN = '/admin_login', //无权限页面 ERROR_403 = '/403', INDEX = '/' diff --git a/src/enums/requestEnums.ts b/src/enums/requestEnums.ts index 7ee2107..698a7e0 100644 --- a/src/enums/requestEnums.ts +++ b/src/enums/requestEnums.ts @@ -13,6 +13,7 @@ export enum RequestMethodsEnum { export enum RequestCodeEnum { SUCCESS = 1, FAIL = 0, + SERVER_ERROR = 500, LOGIN_FAILURE = -1, OPEN_NEW_PAGE = 2 } diff --git a/src/layout/default/index.vue b/src/layout/default/index.vue index c0fbf03..8dfa0a6 100644 --- a/src/layout/default/index.vue +++ b/src/layout/default/index.vue @@ -20,6 +20,7 @@ import LayoutMain from './components/main.vue' import LayoutSidebar from './components/sidebar/index.vue' import LayoutHeader from './components/header/index.vue' import { Push } from "@/common/push.js"; +import { print } from "@/utils/print"; const connection = new Push({ url: import.meta.env.VITE_PUSH_URL, // websocket地址 @@ -30,11 +31,63 @@ const connection = new Push({ const user_channel = connection.subscribe(`platform_1`); // const user_channel = connection.subscribe(`store_merchant_${1}`); +// setTimeout(()=>{ + +// print( +// { +// id: 405, +// merchant: 501, +// real_name: '阿哈', +// user_phone: '19330904744', +// user_address: '里海三楼', +// uid: '9', +// number: 'PF171617436315965155', +// total: '0.02', +// actual: '0.02', +// create_time: '2024-05-20 11:06:03', +// mer_name: '莲花农贸市场', +// mer_phone: '15566669999', +// mer_nickname: '小明', +// mer_user_mobile: '', +// nickname: '用户1532345', +// user_moblie: '19330904747', +// info: [ +// { +// goods: 317, +// nums: '1.00', +// price: '0.02', +// total: '0.02', +// unit_name: '斤', +// goods_name: '西瓜' +// }, +// { +// goods: 317, +// nums: '1.56', +// price: '1.98', +// total: '3.09', +// unit_name: '斤', +// goods_name: '苹果' +// }, +// { +// goods: 317, +// nums: '2.58', +// price: '3.68', +// total: '9.49', +// unit_name: '斤', +// goods_name: '香蕉' +// } +// ] +// } +// ) +// }, 1000) + // 当user-2频道有message事件的消息时 -user_channel.on('message', function (data) { +user_channel.on('message', function (data: any) { console.log("收到消息--",data); if(data.event=='platform_print'){ console.log('收到打印消息'); + if(typeof data.data != 'object' || !data.data?.info?.length) return ElMessage.error('收到订单,但打印数据不合法,请联系管理员'); + else print(data.data); } }); // 断线事件 diff --git a/src/permission.ts b/src/permission.ts index decf89b..f7101c4 100644 --- a/src/permission.ts +++ b/src/permission.ts @@ -12,20 +12,24 @@ import { PageEnum } from './enums/pageEnum' import useTabsStore from './stores/modules/multipleTabs' import { clearAuthInfo } from './utils/auth' import config from './config' +import cache from '@/utils/cache' // NProgress配置 NProgress.configure({ showSpinner: false }) const loginPath = PageEnum.LOGIN +const adminLoginPath = PageEnum.ADMIN_LOGIN const defaultPath = PageEnum.INDEX // 免登录白名单 -const whiteList: string[] = [PageEnum.LOGIN, PageEnum.ERROR_403] +const whiteList: string[] = [PageEnum.LOGIN, PageEnum.ERROR_403, PageEnum.ADMIN_LOGIN] router.beforeEach(async (to, from, next) => { // 开始 Progress Bar NProgress.start() document.title = to.meta.title ?? config.title const userStore = useUserStore() const tabsStore = useTabsStore() + const is_admin = cache.get('is_admin') + if (whiteList.includes(to.path)) { // 在免登录白名单,直接进入 next() @@ -33,7 +37,7 @@ router.beforeEach(async (to, from, next) => { // 获取用户信息 const hasGetUserInfo = Object.keys(userStore.userInfo).length !== 0 if (hasGetUserInfo) { - if (to.path === loginPath) { + if (to.path === loginPath || to.path === adminLoginPath) { next({ path: defaultPath }) } else { next() @@ -70,11 +74,15 @@ router.beforeEach(async (to, from, next) => { next({ ...to, replace: true }) } catch (err) { clearAuthInfo() - next({ path: loginPath, query: { redirect: to.fullPath } }) + if (is_admin==1) { + next({ path: adminLoginPath, query: { redirect: to.fullPath } }) + } else next({ path: loginPath, query: { redirect: to.fullPath } }) } } } else { - next({ path: loginPath, query: { redirect: to.fullPath } }) + if (is_admin==1) { + next({ path: adminLoginPath, query: { redirect: to.fullPath } }) + } else next({ path: loginPath, query: { redirect: to.fullPath } }) } }) diff --git a/src/router/routes.ts b/src/router/routes.ts index a3603cb..f727d0e 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -34,6 +34,10 @@ export const constantRoutes: Array = [ path: PageEnum.LOGIN, component: () => import('@/views/account/login.vue') }, + { + path: PageEnum.ADMIN_LOGIN, + component: () => import('@/views/account/admin_login.vue') + }, { path: '/user', component: LAYOUT, diff --git a/src/stores/modules/user.ts b/src/stores/modules/user.ts index 27b4ebc..d10e5e2 100644 --- a/src/stores/modules/user.ts +++ b/src/stores/modules/user.ts @@ -32,15 +32,17 @@ const useUserStore = defineStore({ this.perms = [] }, login(playload: any) { - const { account, password } = playload + const { account, password, is_admin } = playload return new Promise((resolve, reject) => { login({ account: account.trim(), - password: password + password: password, + is_admin: is_admin }) .then((data) => { this.token = data.token cache.set(TOKEN_KEY, data.token) + cache.set('is_admin', is_admin) resolve(data) }) .catch((error) => { @@ -53,7 +55,8 @@ const useUserStore = defineStore({ logout() .then(async (data) => { this.token = '' - await router.push(PageEnum.LOGIN) + const is_admin = cache.get('is_admin') + await router.push(is_admin==1 ? PageEnum.ADMIN_LOGIN : PageEnum.LOGIN) clearAuthInfo() resolve(data) }) diff --git a/src/utils/print.ts b/src/utils/print.ts index 550ca85..51f2b40 100644 --- a/src/utils/print.ts +++ b/src/utils/print.ts @@ -16,50 +16,188 @@ export const print = (data: any) => { const list = hiprint.hiwebSocket.getPrinterList(); console.log(list); + let nowHeight = 0; + let textHeight = 10; + // 下列方法都是没有拖拽设计页面的, 相当于代码模式, 使用代码设计页面 // 想要实现拖拽设计页面,请往下看 '自定义设计' var hiprintTemplate = new hiprint.PrintTemplate(); + // 纸张高度 固定为 130 pt + 商品数量高度 + let oneHeight = 120 + Math.ceil((data.info.length * 2 * 10) / 2.84); + // 模板宽度单位是mm ( 1mm ~= 2.84pt ) 其他的宽高单位是pt var panel = hiprintTemplate.addPrintPanel({ - width: WIDTH, // 58mm = 164pt - height: 58, + width: 58, // 58mm = 164pt + height: oneHeight, paperNumberDisabled: true, - topOffset: -1, }); - //文本 - panel.addPrintText({ - options: { + let options = (e: any) => { + nowHeight += textHeight; + let opt = { width: T_WIDTH, - height: 10, - top: 10, + height: textHeight, + top: nowHeight, left: T_LEFT, - title: "hiprint插件手动添加text", + title: "", + }; + if (typeof e === "string") opt.title = e; + else opt = Object.assign(opt, e); + return { + options: opt, + }; + }; + + let lineTitle = () => { + nowHeight += textHeight; + let left = Math.floor(T_WIDTH / 3); + panel.addPrintText({ + options: { + width: left, + height: 10, + top: nowHeight, + left: 0, + title: "单价", + textAlign: "center", + }, + }); + panel.addPrintText({ + options: { + width: left, + height: textHeight, + top: nowHeight, + left: left, + title: "数量", + textAlign: "center", + }, + }); + panel.addPrintText({ + options: { + width: left, + height: textHeight, + top: nowHeight, + left: left * 2, + title: "小计", + textAlign: "center", + }, + }); + }; + + let lineOptions = (text1: any, text2: any, text3: any) => { + nowHeight += textHeight; + let left = Math.floor(T_WIDTH / 3); + panel.addPrintText({ + options: { + width: left, + height: 10, + top: nowHeight, + left: 0, + title: text1 + "", + textAlign: "center", + }, + }); + panel.addPrintText({ + options: { + width: left, + height: textHeight, + top: nowHeight, + left: left, + title: text2 + "", + textAlign: "center", + }, + }); + panel.addPrintText({ + options: { + width: left, + height: textHeight, + top: nowHeight, + left: left * 2, + title: text3 + "", + textAlign: "center", + }, + }); + }; + + //文本 *1 + panel.addPrintText( + options({ + title: "泸优采-采购单", textAlign: "center", - }, + }) + ); + + //文本 *6 + panel.addPrintText(options("单号: " + data.number)); + panel.addPrintText(options("配送时间: " + data.create_time)); + panel.addPrintText(options("配送员: " + data.mer_nickname)); + panel.addPrintText(options("配送电话: " + data.mer_phone)); + panel.addPrintText(options("======================")); + panel.addPrintText(options("商品信息: ")); + + //格式化 *1 + x * y + lineTitle(); + data.info.forEach((item: any) => { + panel.addPrintText(options(item.goods_name)); + if(item.nums==Math.floor(+item.nums)) item.nums = Number(item.nums).toFixed(0); + lineOptions( + `${item.price}元`, + `${item.nums}${item.unit_name}`, + `${item.total}元` + ); }); - //长文本 - panel.addPrintLongText({ + + //文本 *5 + panel.addPrintText(options("======================")); + panel.addPrintText(options(`合计: ${data.total}元`)); + panel.addPrintText(options("提货点: " + data.mer_name)); + panel.addPrintText(options("提货点电话: " + data.mer_phone)); + panel.addPrintText(options("提货点负责人签字:")); + // https://lihai001.oss-cn-chengdu.aliyuncs.com/def/db264202405221455038529.png //无字 + // https://lihai001.oss-cn-chengdu.aliyuncs.com/def/54705202405221504133485.png //有字 + // panel.addPrintRect({ options: { width: T_WIDTH, height:30,top: nowHeight + 15, left: T_LEFT,borderColor:'',borderWidth:0.75 } }); + // nowHeight+=40; + + // 文本 *6 + panel.addPrintImage({ options: { width: T_WIDTH, - height: 35, - top: 30, + height: 50, + top: nowHeight + 15, left: T_LEFT, - title: "长文本:hiprint是一个很好的webjs打印,浏览器在的地方他都可以运行", + title: "", + src: "https://lihai001.oss-cn-chengdu.aliyuncs.com/def/db264202405221455038529.png", }, }); - //长文本 - panel.addPrintLongText({ + nowHeight += 60; + // 文本 *4 + panel.addPrintText(options("收货人: " + data.real_name)); + panel.addPrintText(options("收货地址: " + data.user_address)); + panel.addPrintText(options("联系电话: " + data.user_phone)); + panel.addPrintText(options("收货人签字:")); + // panel.addPrintRect({ options: { width: T_WIDTH, height:30,top: nowHeight+15, left: T_LEFT,borderColor:'',borderWidth:0.75 } }); + + // 文本 *6 + panel.addPrintImage({ options: { width: T_WIDTH, - height: 35, - top: 80, + height: 50, + top: nowHeight + 15, left: T_LEFT, - title: - "长文本:直接打印,需要安装客户端, 直接打印,需要安装客户端, 直接打印,需要安装客户端, 直接打印,需要安装客户端", + title: "", + src: "https://lihai001.oss-cn-chengdu.aliyuncs.com/def/db264202405221455038529.png", }, }); + nowHeight += 60; + + // 文本 *4 + panel.addPrintText(options("")); + panel.addPrintText(options("")); + panel.addPrintText(options("")); + panel.addPrintText(options("======================")); + + // 合计高度 23 + length * 2 + //打印 hiprintTemplate.print({}); //直接打印,需要安装客户端 @@ -94,25 +232,25 @@ export const testPrint = () => { paperNumberDisabled: true, }); - let options = (e: any)=>{ - nowHeight+=textHeight; + let options = (e: any) => { + nowHeight += textHeight; let opt = { width: T_WIDTH, height: textHeight, top: nowHeight, left: T_LEFT, - title: '', - } - if(typeof e === 'string') opt.title = e; + title: "", + }; + if (typeof e === "string") opt.title = e; else opt = Object.assign(opt, e); return { - options: opt - } - } + options: opt, + }; + }; - let lineTitle = ()=>{ - nowHeight+=textHeight; - let left = Math.floor(T_WIDTH/3) ; + let lineTitle = () => { + nowHeight += textHeight; + let left = Math.floor(T_WIDTH / 3); panel.addPrintText({ options: { width: left, @@ -143,18 +281,18 @@ export const testPrint = () => { textAlign: "center", }, }); - } + }; - let lineOptions = (text1: any, text2: any, text3: any)=>{ - nowHeight+=textHeight; - let left = Math.floor(T_WIDTH/3) ; + let lineOptions = (text1: any, text2: any, text3: any) => { + nowHeight += textHeight; + let left = Math.floor(T_WIDTH / 3); panel.addPrintText({ options: { width: left, height: 10, top: nowHeight, left: 0, - title: text1+"", + title: text1 + "", textAlign: "center", }, }); @@ -164,7 +302,7 @@ export const testPrint = () => { height: textHeight, top: nowHeight, left: left, - title: text2+"", + title: text2 + "", textAlign: "center", }, }); @@ -174,17 +312,19 @@ export const testPrint = () => { height: textHeight, top: nowHeight, left: left * 2, - title: text3+"", + title: text3 + "", textAlign: "center", }, }); - } + }; //文本 *1 - panel.addPrintText(options({ - title: '泸优采-小票0', - textAlign: "center", - })); + panel.addPrintText( + options({ + title: "泸优采-小票0", + textAlign: "center", + }) + ); //文本 *6 panel.addPrintText(options("单号: PF171617436315965155")); @@ -205,11 +345,11 @@ export const testPrint = () => { //文本 *13 panel.addPrintText(options("======================")); - panel.addPrintText(options('合计: 0.75元')); - - panel.addPrintText(options('提货点: 莲花农贸市场')); - panel.addPrintText(options('提货点电话: 19330904744')); - panel.addPrintText(options('提货点负责人签字:')); + panel.addPrintText(options("合计: 0.75元")); + + panel.addPrintText(options("提货点: 莲花农贸市场")); + panel.addPrintText(options("提货点电话: 19330904744")); + panel.addPrintText(options("提货点负责人签字:")); // https://lihai001.oss-cn-chengdu.aliyuncs.com/def/db264202405221455038529.png //无字 // https://lihai001.oss-cn-chengdu.aliyuncs.com/def/54705202405221504133485.png //有字 // panel.addPrintRect({ options: { width: T_WIDTH, height:30,top: nowHeight + 15, left: T_LEFT,borderColor:'',borderWidth:0.75 } }); @@ -217,38 +357,37 @@ export const testPrint = () => { panel.addPrintImage({ options: { width: T_WIDTH, - height:50, - top: nowHeight + 15, - left: T_LEFT, - title: '', - src: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/db264202405221455038529.png' - } - }) - nowHeight+=60; - panel.addPrintText(options('收货人: 阿哈')); - panel.addPrintText(options('收货地址: 里海科技')); - panel.addPrintText(options('联系电话: 17685151643')); - panel.addPrintText(options('收货人签字:')); + height: 50, + top: nowHeight + 15, + left: T_LEFT, + title: "", + src: "https://lihai001.oss-cn-chengdu.aliyuncs.com/def/db264202405221455038529.png", + }, + }); + nowHeight += 60; + panel.addPrintText(options("收货人: 阿哈")); + panel.addPrintText(options("收货地址: 里海科技")); + panel.addPrintText(options("联系电话: 17685151643")); + panel.addPrintText(options("收货人签字:")); // panel.addPrintRect({ options: { width: T_WIDTH, height:30,top: nowHeight+15, left: T_LEFT,borderColor:'',borderWidth:0.75 } }); panel.addPrintImage({ options: { width: T_WIDTH, height: 50, - top: nowHeight + 15, - left: T_LEFT, - title: '', - src: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/db264202405221455038529.png' - } - }) - nowHeight+=60; + top: nowHeight + 15, + left: T_LEFT, + title: "", + src: "https://lihai001.oss-cn-chengdu.aliyuncs.com/def/db264202405221455038529.png", + }, + }); + nowHeight += 60; panel.addPrintText(options("")); panel.addPrintText(options("")); panel.addPrintText(options("")); panel.addPrintText(options("======================")); - // 合计高度 23 + length * 2 - + // 合计高度 23 + length * 2 //打印 // hiprintTemplate.print({}); @@ -258,22 +397,24 @@ export const testPrint = () => { // 发送任务到打印机成功 hiprintTemplate.on("printSuccess", (e: any) => { console.log("printSuccess", e); + ElMessage.success('订单已加入打印队列'); }); // 发送任务到打印机失败 hiprintTemplate.on("printError", (e: any) => { console.log("printError", e); + ElMessage.error('打印失败,请检查是否正确连接打印机!'); }); }; -export const printerList = ()=>{ - try{ +export const printerList = () => { + try { const list = hiprint.hiwebSocket.getPrinterList(); return list; - }catch{ - ElMessage.error("请先安装打印机客户端") + } catch { + ElMessage.error("请先安装打印机客户端"); return []; } -} +}; // 计算字符串长度 function calculateStringLength(str: string) { diff --git a/src/utils/request/index.ts b/src/utils/request/index.ts index e66915d..6c5f649 100644 --- a/src/utils/request/index.ts +++ b/src/utils/request/index.ts @@ -1,123 +1,133 @@ -import { merge } from 'lodash' -import configs from '@/config' -import { Axios } from './axios' -import { ContentTypeEnum, RequestCodeEnum, RequestMethodsEnum } from '@/enums/requestEnums' -import type { AxiosHooks } from './type' -import { clearAuthInfo, getToken } from '../auth' -import feedback from '../feedback' -import NProgress from 'nprogress' -import { AxiosError, type AxiosRequestConfig } from 'axios' -import router from '@/router' -import { PageEnum } from '@/enums/pageEnum' +import { merge } from "lodash"; +import configs from "@/config"; +import { Axios } from "./axios"; +import { + ContentTypeEnum, + RequestCodeEnum, + RequestMethodsEnum, +} from "@/enums/requestEnums"; +import type { AxiosHooks } from "./type"; +import { clearAuthInfo, getToken } from "../auth"; +import feedback from "../feedback"; +import NProgress from "nprogress"; +import { AxiosError, type AxiosRequestConfig } from "axios"; +import router from "@/router"; +import { PageEnum } from "@/enums/pageEnum"; // 处理axios的钩子函数 const axiosHooks: AxiosHooks = { - requestInterceptorsHook(config) { - NProgress.start() - const { withToken, isParamsToData } = config.requestOptions - const params = config.params || {} - const headers = config.headers || {} + requestInterceptorsHook(config) { + NProgress.start(); + const { withToken, isParamsToData } = config.requestOptions; + const params = config.params || {}; + const headers = config.headers || {}; - // 添加token - if (withToken) { - const token = getToken() - headers.token = token - } - // POST请求下如果无data,则将params视为data - if ( - isParamsToData && - !Reflect.has(config, 'data') && - config.method?.toUpperCase() === RequestMethodsEnum.POST - ) { - config.data = params - config.params = {} - } - config.headers = headers - return config - }, - requestInterceptorsCatchHook(err) { - NProgress.done() - return err - }, - async responseInterceptorsHook(response) { - NProgress.done() - const { isTransformResponse, isReturnDefaultResponse } = response.config.requestOptions - - //返回默认响应,当需要获取响应头及其他数据时可使用 - if (isReturnDefaultResponse) { - return response - } - // 是否需要对数据进行处理 - if (!isTransformResponse) { - return response.data - } - const { code, data, show, msg } = response.data - switch (code) { - case RequestCodeEnum.SUCCESS: - if (show) { - msg && feedback.msgSuccess(msg) - } - return data - case RequestCodeEnum.FAIL: - if (show) { - msg && feedback.msgError(msg) - } - return Promise.reject(data) - case RequestCodeEnum.LOGIN_FAILURE: - clearAuthInfo() - router.push(PageEnum.LOGIN) - return Promise.reject() - case RequestCodeEnum.OPEN_NEW_PAGE: - window.location.href = data.url - return data - default: - return data - } - }, - responseInterceptorsCatchHook(error) { - NProgress.done() - if (error.code !== AxiosError.ERR_CANCELED) { - error.message && feedback.msgError(error.message) - } - return Promise.reject(error) + // 添加token + if (withToken) { + const token = getToken(); + headers.token = token; } -} + // POST请求下如果无data,则将params视为data + if ( + isParamsToData && + !Reflect.has(config, "data") && + config.method?.toUpperCase() === RequestMethodsEnum.POST + ) { + config.data = params; + config.params = {}; + } + config.headers = headers; + return config; + }, + requestInterceptorsCatchHook(err) { + NProgress.done(); + return err; + }, + async responseInterceptorsHook(response) { + NProgress.done(); + const { isTransformResponse, isReturnDefaultResponse } = + response.config.requestOptions; + + //返回默认响应,当需要获取响应头及其他数据时可使用 + if (isReturnDefaultResponse) { + return response; + } + // 是否需要对数据进行处理 + if (!isTransformResponse) { + return response.data; + } + const { code, data, show, msg } = response.data; + switch (code) { + case RequestCodeEnum.SUCCESS: + if (show) { + msg && feedback.msgSuccess(msg); + } + return data; + case RequestCodeEnum.FAIL: + if (show) { + msg && feedback.msgError(msg); + } + return Promise.reject(data); + case RequestCodeEnum.SERVER_ERROR: + if (show) { + msg && feedback.msgError(msg); + } + return Promise.reject(data); + case RequestCodeEnum.LOGIN_FAILURE: + clearAuthInfo(); + router.push(PageEnum.LOGIN); + return Promise.reject(); + case RequestCodeEnum.OPEN_NEW_PAGE: + window.location.href = data.url; + return data; + default: + return data; + } + }, + responseInterceptorsCatchHook(error) { + NProgress.done(); + if (error.code !== AxiosError.ERR_CANCELED) { + error.message && feedback.msgError(error.message); + } + return Promise.reject(error); + }, +}; const defaultOptions: AxiosRequestConfig = { - //接口超时时间 - timeout: configs.timeout, - // 基础接口地址 - baseURL: configs.baseUrl, - //请求头 - headers: { 'Content-Type': ContentTypeEnum.JSON, version: configs.version }, - // 处理 axios的钩子函数 - axiosHooks: axiosHooks, - // 每个接口可以单独配置 - requestOptions: { - // 是否将params视为data参数,仅限post请求 - isParamsToData: true, - //是否返回默认的响应 - isReturnDefaultResponse: false, - // 需要对返回数据进行处理 - isTransformResponse: true, - // 接口拼接地址 - urlPrefix: configs.urlPrefix, - // 忽略重复请求 - ignoreCancelToken: false, - // 是否携带token - withToken: true, - // 开启请求超时重新发起请求请求机制 - isOpenRetry: true, - // 重新请求次数 - retryCount: 2 - } -} + //接口超时时间 + timeout: configs.timeout, + // 基础接口地址 + baseURL: configs.baseUrl, + //请求头 + headers: { "Content-Type": ContentTypeEnum.JSON, version: configs.version }, + // 处理 axios的钩子函数 + axiosHooks: axiosHooks, + // 每个接口可以单独配置 + requestOptions: { + // 是否将params视为data参数,仅限post请求 + isParamsToData: true, + //是否返回默认的响应 + isReturnDefaultResponse: false, + // 需要对返回数据进行处理 + isTransformResponse: true, + // 接口拼接地址 + urlPrefix: configs.urlPrefix, + // 忽略重复请求 + ignoreCancelToken: false, + // 是否携带token + withToken: true, + // 开启请求超时重新发起请求请求机制 + isOpenRetry: true, + // 重新请求次数 + retryCount: 2, + }, +}; function createAxios(opt?: Partial) { - return new Axios( - // 深度合并 - merge(defaultOptions, opt || {}) - ) + return new Axios( + // 深度合并 + merge(defaultOptions, opt || {}) + ); } -const request = createAxios() -export default request +const request = createAxios(); +export default request; diff --git a/src/views/account/admin_login.vue b/src/views/account/admin_login.vue new file mode 100644 index 0000000..5c33fba --- /dev/null +++ b/src/views/account/admin_login.vue @@ -0,0 +1,131 @@ + + + + + diff --git a/src/views/account/login.vue b/src/views/account/login.vue index 74b1aeb..ddc1837 100644 --- a/src/views/account/login.vue +++ b/src/views/account/login.vue @@ -68,7 +68,8 @@ const remAccount = ref(false) const config = computed(() => appStore.config) const formData = reactive({ account: '', - password: '' + password: '', + is_admin: 0 //1管理员, 0是供应链 }) const rules = { account: [ diff --git a/src/views/data/merchant/audit/index.vue b/src/views/data/merchant/audit/index.vue index 31c7f8e..22dce02 100644 --- a/src/views/data/merchant/audit/index.vue +++ b/src/views/data/merchant/audit/index.vue @@ -281,7 +281,7 @@ 审核 审核 - + 重新审核 diff --git a/src/views/data/supplier/supplier/index.vue b/src/views/data/supplier/supplier/index.vue index 884c62e..40363ea 100644 --- a/src/views/data/supplier/supplier/index.vue +++ b/src/views/data/supplier/supplier/index.vue @@ -5,23 +5,43 @@ - - + + - - + + - + @@ -34,13 +54,21 @@ - + 新增 - + 删除
@@ -59,14 +87,33 @@ /> --> - + - - - + + + - + - - + + 打印 - + -->
- +