提交 f2f9a1e6 作者: Hao

add

父级 1710f157
......@@ -9,7 +9,6 @@ declare module 'vue' {
export interface GlobalComponents {
AutomaticPrompt: typeof import('./src/components/AutomaticPrompt.vue')['default']
ElAside: typeof import('element-plus/es')['ElAside']
ElAutocomplete: typeof import('element-plus/es')['ElAutocomplete']
ElButton: typeof import('element-plus/es')['ElButton']
ElContainer: typeof import('element-plus/es')['ElContainer']
ElFooter: typeof import('element-plus/es')['ElFooter']
......@@ -20,8 +19,6 @@ declare module 'vue' {
ElInput: typeof import('element-plus/es')['ElInput']
ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
ElMain: typeof import('element-plus/es')['ElMain']
ElMenu: typeof import('element-plus/es')['ElMenu']
ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
EmotionComponent: typeof import('./src/components/EmotionComponent.vue')['default']
IndexComponent: typeof import('./src/components/IndexComponent.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
......
......@@ -12,6 +12,7 @@
"@luohc92/vue3-image-viewer": "^1.0.0",
"axios": "^1.6.7",
"core-js": "^3.8.3",
"cos-js-sdk-v5": "^1.7.0",
"cos-wx-sdk-v5": "^1.6.0",
"element-plus": "^2.6.1",
"emoji.json": "^15.1.0",
......
// axios.js
import axios from 'axios';
import axios from "axios";
const instance = axios.create({
baseURL: '/api', // 设置基础 URL
timeout: 1000, // 设置请求超时时间
baseURL: "/api", // 设置基础 URL
timeout: 1000, // 设置请求超时时间
});
instance.interceptors.request.use(
(config:any) => {
// 在发送请求之前做些什么,例如添加 token
const token = localStorage.getItem('token');
if (token) {
config.headers.Authorization = `Bearer ${token}`;
}
return config;
},
(error:any) => {
return Promise.reject(error);
(config: any) => {
// 在发送请求之前做些什么,例如添加 token
const token = localStorage.getItem("token");
if (token) {
config.headers.Authorization = `Bearer ${token}`;
}
return config;
},
(error: any) => {
return Promise.reject(error);
}
);
instance.interceptors.response.use(
(response:any) => {
// 对响应数据做点什么
return response.data;
},
(error:any) => {
// 对响应错误做点什么
return Promise.reject(error);
}
(response: any) => {
// 对响应数据做点什么
return response.data;
},
(error: any) => {
// 对响应错误做点什么
return Promise.reject(error);
}
);
export default instance;
import http from "../index";
//登录
const Login = (query: any) => {
return http({
url: `/login`,
......@@ -6,4 +7,61 @@ const Login = (query: any) => {
data: query,
});
};
export { Login };
//新增询价单
const InquiryAdd = (query: any) => {
return http({
url: `/inquiryAdd`,
method: "get",
data: query,
});
};
//快捷回复
const Kjiehuifu = (query: any) => {
return http({
url: "/Kjiehuifu",
method: "get",
data: query,
});
};
//获取用户列表
const getUserList = (query: any) => {
return http({
url: "/getUserList",
method: "get",
data: query,
});
};
//查看未读消息
const checkMesssages = (query: any) => {
return http({
url: "/checkMesssages",
method: "get",
data: query,
});
};
//上传接口
const getUploadConfigInfo = (query: any) => {
return http({
url: "/getUploadConfigInfo",
method: "get",
data: query,
});
};
//系统上传
const upload = (query: any) => {
return http({
url: "/sys/common/upload",
method: "get",
data: query,
});
};
export {
Login,
InquiryAdd,
Kjiehuifu,
getUserList,
checkMesssages,
upload,
getUploadConfigInfo,
};
......@@ -44,7 +44,7 @@
v-model="state"
ref="automaticPromptRef"
class="el-autocomplete"
placeholder="请输入问题"
placeholder="输入信息"
type="textarea"
resize="none"
@change="handleSelect"
......@@ -71,6 +71,7 @@
import Emotion from './IndexComponent.vue'
import { ElLoading } from 'element-plus'
import { ref, watch, defineEmits, defineExpose } from 'vue'
import { upLoadFilesHander } from '../minxins/UploadMixin'
import axios from 'axios'
const state = ref('')
const file = ref(null)
......@@ -78,6 +79,7 @@ interface LinkItem {
value: string
link: string
}
// uploadMixin()
const showEmotion = ref<boolean>(false)
const automaticPromptRef = ref(null)
const links = ref<LinkItem[]>([])
......@@ -92,7 +94,10 @@ const upfile = () => {
const fileChange = () => {
var e = window.event || event
var oFile = e.target.files[0]
console.log(oFile)
upLoadFilesHander(oFile).then((ress) => {
const { success, result } = ress
console.log(result)
})
const loading = ElLoading.service({
lock: true,
text: '上传中...',
......@@ -164,7 +169,7 @@ defineExpose({
.el-input {
width: 100%;
}
:deep(.el-textarea__inner ){
:deep(.el-textarea__inner) {
width: 100%;
align-items: start;
box-shadow: none;
......
const COS = require('cos-wx-sdk-v5');
import { ElMessage } from 'element-plus'
const uploadMixin = {
data() {
return {
......@@ -22,11 +23,11 @@ const uploadMixin = {
uploadObj[i] = message;
if (!success) {
uploadObj[i] = '';
wx.showToast({
title: `[${i+1}]上传失败,请重新上传!`,
icon: 'none',
duration: 2000
});
ElMessage({
message: `[${i+1}]上传失败,请重新上传!`,
type: 'none',
})
}
if (uploadNum == 0) {
const arr = Array.from(uploadObj);
......
......@@ -6,7 +6,7 @@ Mock.mock("/api/login", "get", () => {
message: '',
result: {
userName: "admin",
token:'admin'
token: 'admin'
},
};
});
......@@ -15,10 +15,99 @@ Mock.mock("/api/inquiryAdd", "get", () => {
return {
code: "200",
success: true,
message: '',
message: '操作成功!',
result: {
userName: "admin",
token:'admin'
token: 'admin'
},
};
});
//快捷回复
Mock.mock("/api/kjiehuifu", 'get', () => {
return {
code: '200',
success: true,
message: '',
result: [
{
message: '感谢您的咨询,我们会尽快回复您',
}, {
message: '感谢您的耐心等待,您的问题已经收到,将尽快给您答复。'
}, {
messag: '谢谢你的来信,我会尽快回复。'
}, {
messag: '谢谢你的信息,我会尽快做出回复。'
}
]
}
})
//列表
Mock.mock("/api/getUserList", 'get', () => {
return {
code: '200',
success: true,
message: '',
result: [{
userId: '11fb824c0deb4e8b947275e1e7c4f7a2',
userName: '1710323861524',
userImg: 'https://cdn.lirimall.com//lirigo/filetempImage/新鲜水果_1661668973048.png',
messages: []
}, {
userId: '4f99b6dc32d84a288d88e7d9635521a3',
userName: '1710317951930',
userImg: 'https://cdn.lirimall.com//lirigo/filetempImage/新鲜水果_1661668973048.png',
messages: []
}]
}
})
//查看未读消息
Mock.mock("/api/checkMesssages", 'get', () => {
return {
code: '200',
success: true,
message: '',
result: []
}
})
Mock.mock("/api/getUploadConfigInfo", 'get', () => {
return {
code: '200',
success: true,
message: '',
result: {
bucketName: "",
regionid: "",
upLoadPath: "",
uploadType: "",
staticDomain: "",
startTime: "",
expiredTime: "",
credentials: {
tmpSecretId: "",
tmpSecretKey: "",
sessionToken: "",
},
}
}
})
Mock.mock("/api/upload", 'get', () => {
return {
code: '200',
success: true,
message: '',
result: {
bucketName: "",
regionid: "",
upLoadPath: "",
uploadType: "",
staticDomain: "",
startTime: "",
expiredTime: "",
credentials: {
tmpSecretId: "",
tmpSecretKey: "",
sessionToken: "",
},
},
}
})
\ No newline at end of file
......@@ -4,3 +4,4 @@ declare module '*.vue' {
const component: DefineComponent<{}, {}, any>
export default component
}
declare module 'cos-wx-sdk-v5';
\ No newline at end of file
......@@ -23,6 +23,10 @@ export const useUserStore = defineStore("user", {
setUserInfo(res: any) {
this.userInfo = res;
},
setUserList(res: any) {
console.log(res,'数据呢')
this.userList = res;
},
setUserListMessages(res: any) {
const userList: any = this.userList || [];
const obj = {
......
......@@ -33,7 +33,7 @@
"src/**/*.vue",
"tests/**/*.ts",
"tests/**/*.tsx"
, "src/minxins/minxin.js" ],
],
"exclude": [
"node_modules"
]
......
......@@ -2795,6 +2795,13 @@ core-util-is@~1.0.0:
resolved "https://registry.npmmirror.com/core-util-is/-/core-util-is-1.0.3.tgz"
integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==
cos-js-sdk-v5@^1.7.0:
version "1.7.0"
resolved "https://registry.npmmirror.com/cos-js-sdk-v5/-/cos-js-sdk-v5-1.7.0.tgz#88166b2bfb8c01120011f25f5ee7d5c196941671"
integrity sha512-/xiR86tOcJ448nXPkJq0lhsP/Kg4LmvcRO+C5LwrAvmTMTZE75ESjMHi7qbQVAxNPBroOvVyYR0YOin9UN8yHQ==
dependencies:
"@xmldom/xmldom" "^0.8.6"
cos-wx-sdk-v5@^1.6.0:
version "1.6.0"
resolved "https://registry.npmmirror.com/cos-wx-sdk-v5/-/cos-wx-sdk-v5-1.6.0.tgz#dfdf1724863177e39c2ca9e20ae5507a71570bb3"
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论