提交 7c587846 作者: Hao

add

父级 3ed4e7f7
NODE_ENV=development NODE_ENV=development
VITE_USER_APP_API_URL=192.168.31.112 VITE_USER_APP_API_URL=192.168.31.120
\ No newline at end of file
...@@ -5,5 +5,6 @@ ...@@ -5,5 +5,6 @@
// Generated by unplugin-auto-import // Generated by unplugin-auto-import
export {} export {}
declare global { declare global {
const ElLoading: typeof import('element-plus/es')['ElLoading']
const ElMessage: typeof import('element-plus/es')['ElMessage'] const ElMessage: typeof import('element-plus/es')['ElMessage']
} }
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
console.log(scaleRatio,fontSize, 'scaleRatio') console.log(scaleRatio,fontSize, 'scaleRatio')
// 4.开始缩放网页 // 4.开始缩放网页
console.log(scaleRatio,'scaleRatio') console.log(scaleRatio,'scaleRatio')
document.body.style = `zoom:${scaleRatio}`; // document.body.style = `zoom:${scaleRatio}`;
console.log(document.body, ' document.body') console.log(document.body, ' document.body')
} }
</script> </script>
......
...@@ -6,7 +6,6 @@ const instance = axios.create({ ...@@ -6,7 +6,6 @@ const instance = axios.create({
// baseURL:'/api', // baseURL:'/api',
timeout: 1000, // 设置请求超时时间 timeout: 1000, // 设置请求超时时间
}); });
console.log(import.meta.env, "import.meta.env");
instance.interceptors.request.use( instance.interceptors.request.use(
(config: any) => { (config: any) => {
// 在发送请求之前做些什么,例如添加 token // 在发送请求之前做些什么,例如添加 token
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
ref="elAutocomplete" ref="elAutocomplete"
placeholder="输入信息" placeholder="输入信息"
contenteditable="true" contenteditable="true"
style="outline: none; " style="outline: none;"
@paste.prevent="handlePaste" @paste.prevent="handlePaste"
@focus="removeDefaultContent" @focus="removeDefaultContent"
@input="handleSelect" @input="handleSelect"
...@@ -71,6 +71,7 @@ const imgShowWidth = ref<number>(50) ...@@ -71,6 +71,7 @@ const imgShowWidth = ref<number>(50)
const imgShowHeight = ref<number>(50) const imgShowHeight = ref<number>(50)
const showEmotion = ref<boolean>(false) const showEmotion = ref<boolean>(false)
const handleEmotion = (i: any) => { const handleEmotion = (i: any) => {
console.log(i, '打印')
elAutocomplete.value.innerHTML += i elAutocomplete.value.innerHTML += i
inputVal.value = elAutocomplete.value.innerHTML inputVal.value = elAutocomplete.value.innerHTML
showEmotion.value = false showEmotion.value = false
...@@ -83,15 +84,7 @@ const upfile = () => { ...@@ -83,15 +84,7 @@ const upfile = () => {
const fileImgChange = async () => { const fileImgChange = async () => {
var e: any = window.event || event var e: any = window.event || event
var oFile = e.target.files[0] var oFile = e.target.files[0]
console.log(oFile.type) await setfileEvent(oFile)
if (oFile.type == 'image/png') {
await setfileEvent(e.target)
} else {
upLoadFilesHander(oFile).then((ress) => {
const { success, result }: any = ress;
console.log(result,)
})
}
const loading: any = ElLoading?.service({ const loading: any = ElLoading?.service({
lock: true, lock: true,
text: '上传中...', text: '上传中...',
...@@ -99,29 +92,37 @@ const fileImgChange = async () => { ...@@ -99,29 +92,37 @@ const fileImgChange = async () => {
}) })
loading.close() loading.close()
} }
const setfileEvent = async (clipboardData: any) => { const setfileEvent = async (file: any) => {
const img = getPasteImageFile(clipboardData.files) var html = ''
if (!img) { const { result }: any = await upLoadFilesHander(file)
return const uploadRes = result
} if (!uploadRes) return
const uploadRes = await fileToBase64(img) if (file.type.includes('image')) {
if (!uploadRes) { html = await getImageObject(
return uploadRes,
imgShowWidth.value,
imgShowHeight.value,
)
} else {
html = await getFileObject(uploadRes, file)
} }
const oImage = await getImageObject( console.log(html, 'html打印')
uploadRes, elAutocomplete.value.innerHTML += html.outerHTML
imgShowWidth.value, inputVal.value += html.outerHTML
imgShowHeight.value,
)
console.log(oImage, 'oImage')
elAutocomplete.value.innerHTML += oImage.outerHTML
inputVal.value = oImage.outerHTML
elAutocomplete.value.focus() elAutocomplete.value.focus()
} }
const handleSelect = (value: any) => { const handleSelect = (value: any) => {
inputVal.value = value.target.innerHTML inputVal.value = value.target.innerHTML
} }
const getFileObject = (url: any, oFile: any) => {
var aTag = document.createElement('a')
aTag.href = url
aTag.download = oFile.name
aTag.target = 'view_window'
aTag.textContent = oFile.name
return aTag
}
const emit = defineEmits(['updateState']) const emit = defineEmits(['updateState'])
watch(inputVal, async (newValue) => { watch(inputVal, async (newValue) => {
if (!newValue) elAutocomplete.value.innerHTML = '' if (!newValue) elAutocomplete.value.innerHTML = ''
...@@ -172,13 +173,11 @@ const handlePasteImageFile = async (clipboardData: any) => { ...@@ -172,13 +173,11 @@ const handlePasteImageFile = async (clipboardData: any) => {
) )
cursorInsert(oImage) cursorInsert(oImage)
inputVal.value = elAutocomplete.value.innerHTML inputVal.value = elAutocomplete.value.innerHTML
// elAutocomplete.value.innerHTML = inputVal.value;
} }
// 获取一个 image object // 获取一个 image object
const getImageObject = (uploadRes: any, showWidth: any, showHeight: any) => { const getImageObject = (uploadRes: any, showWidth: any, showHeight: any) => {
const oImage = new Image(showWidth, showHeight) const oImage = new Image(showWidth, showHeight)
const datasetFields = ['width', 'height'] const datasetFields = ['width', 'height']
const datasetSizes: any = { const datasetSizes: any = {
width: '200', width: '200',
...@@ -273,8 +272,9 @@ defineExpose({ ...@@ -273,8 +272,9 @@ defineExpose({
.el-autocomplete { .el-autocomplete {
width: 100%; width: 100%;
max-width: 100%; max-width: 100%;
height: calc(100vh - 732px); height: calc(100vh - 60vh - 130px);
overflow: auto; overflow: auto;
font-size: 14px;
} }
.el-autocomplete img { .el-autocomplete img {
max-width: 100%; /* 设置图片最大宽度为容器宽度 */ max-width: 100%; /* 设置图片最大宽度为容器宽度 */
......
...@@ -117,7 +117,6 @@ export const upLoadHander = async (obj: any) => { ...@@ -117,7 +117,6 @@ export const upLoadHander = async (obj: any) => {
if (resResult) { if (resResult) {
const query = {}; const query = {};
// const res: any = await getUploadConfigInfo(query); // const res: any = await getUploadConfigInfo(query);
const result: any = uploadMixin.upLoadMixinResult; const result: any = uploadMixin.upLoadMixinResult;
if (uploadMixin.uploadMixinType === "txcos") { if (uploadMixin.uploadMixinType === "txcos") {
//走对象存储 //走对象存储
...@@ -172,18 +171,21 @@ export const upLoadHander = async (obj: any) => { ...@@ -172,18 +171,21 @@ export const upLoadHander = async (obj: any) => {
async: false, async: false,
} }
); );
if (uploadRes.success && uploadRes.message) { let data = uploadRes.data;
console.log(data,'uploadRes')
if (data.success && data.message) {
//保存绝对路径,不然小程序会有问题 //保存绝对路径,不然小程序会有问题
let url = uploadRes.message; let url = data.message;
url = uploadRes.message.replaceAll("//", "/"); // console.log(url,'url')
const pre = url.startsWith("/") ? "" : "/"; // url = data.message.replaceAll("//", "/");
url = `http://${VUE_APP_API_URL}/sys/common/static` + pre + url; // const pre = url.startsWith("/") ? "" : "/";
console.log(url, "图片上传失败"); // url = `http://${VUE_APP_API_URL}/sys/common/static` + pre + url;
// console.log(url, "图片上传成功");
obj.onSuccess({ success: true, message: url }); obj.onSuccess({ success: true, message: url });
} else { } else {
obj.onError({ obj.onError({
success: false, success: false,
message: uploadRes.message || "图片上传失败", message: data.message || "图片上传失败",
}); });
} }
} }
......
...@@ -3,7 +3,7 @@ const routes: Array<RouteRecordRaw> = [ ...@@ -3,7 +3,7 @@ const routes: Array<RouteRecordRaw> = [
{ {
path: "/", path: "/",
name: "home", name: "home",
component: () => import(/* @vite-ignore */ `@/views/HomeView.vue`), component: () => import(/* @vite-ignore */ `@/views/homeView.vue`),
}, },
{ {
path: "/loging", path: "/loging",
......
...@@ -24,6 +24,7 @@ export const useUserStore = defineStore("user", { ...@@ -24,6 +24,7 @@ export const useUserStore = defineStore("user", {
this.customerInfo = res; this.customerInfo = res;
}, },
setUserInfo(res: any) { setUserInfo(res: any) {
console.log(res,'res')
this.userInfo = res; this.userInfo = res;
}, },
setUserListMessages(res: any) { setUserListMessages(res: any) {
......
interface aaa{
name:string
}
interface aaa{
age:number;
}
\ No newline at end of file
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
<div class="we-connecting"> <div class="we-connecting">
We are connecting you to online customer service We are connecting you to online customer service
</div> </div>
<!-- 推荐商品 --> <!-- 推荐商品 -->
<div <div
class="message-container message-container-right" class="message-container message-container-right"
...@@ -183,7 +182,7 @@ ...@@ -183,7 +182,7 @@
</div> </div>
<div class="design-requirements"> <div class="design-requirements">
<div>{{ message.content.flieName }}</div> <div>{{ message.content.flieName }}</div>
<div class="img"> <div class="img" @click="downLoad(message)" >
<img :src="require('../assets/icon_download.png')" /> <img :src="require('../assets/icon_download.png')" />
</div> </div>
</div> </div>
...@@ -192,15 +191,6 @@ ...@@ -192,15 +191,6 @@
</div> </div>
</el-main> </el-main>
<el-footer class="el-footer" :style="{ border: '1px solid #E9ECF1' }"> <el-footer class="el-footer" :style="{ border: '1px solid #E9ECF1' }">
<!-- <div class="static-box">
<div
v-for="(item, index) in staticList"
:key="index"
class="staticList"
>
<div>{{ item }}</div>
</div>
</div> -->
<AutomaticPrompt <AutomaticPrompt
@keydown.enter="handleButtonClick" @keydown.enter="handleButtonClick"
@updateState="getState" @updateState="getState"
...@@ -232,11 +222,11 @@ ...@@ -232,11 +222,11 @@
class="shirnk-aside" class="shirnk-aside"
v-shrink="{ isShrink, width: '0px' }" v-shrink="{ isShrink, width: '0px' }"
:style="{ :style="{
height: 'calc(100vh - 60px)', height: 'calc( 100vh - 60px )',
}" }"
> >
<div class="shrink-text" @click="changeiShrink"> <div class="shrink-text" @click="changeiShrink">
<el-icon size="30"> <el-icon size="15">
<DArrowLeft v-if="isShrink" /> <DArrowLeft v-if="isShrink" />
<DArrowRight v-if="!isShrink" /> <DArrowRight v-if="!isShrink" />
</el-icon> </el-icon>
...@@ -331,22 +321,43 @@ ...@@ -331,22 +321,43 @@
/> />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<div class="requirements-box" v-if="!isUpload"> <!-- <input
class="requirements-box"
v-if="!isUpload"
type="file"
@change="fileImgChange"
/> -->
<input
type="file"
ref="requireFile"
style="display: none;"
accept="image/bmp,image/jpeg,image/jpg,image/png"
@change="fileImgChange"
/>
<div
class="requirements-box"
v-if="!ruleForm.flieUrl"
@click="requireFileOk"
>
<el-button icon="UploadFilled" class="uploadInfo" /> <el-button icon="UploadFilled" class="uploadInfo" />
<div class="upload"> <div class="upload">
<div class="upload-name">Click to upload</div> <div class="click-to-upload">
<div>or drag and drap</div> Click to upload
</div>
<div class="or-drag-and-drap">or drag and drap</div>
</div> </div>
</div> </div>
<div class="requirements-box1" v-if="isUpload"> <div class="requirements-box1" v-if="ruleForm.flieUrl">
<div class="box"> <div class="box">
<div class="upload-name">{{ ruleForm.flieName }}</div> <div class="upload-name">{{ ruleForm.flieName }}</div>
<div class="upload-info"> <div class="upload-info">
<el-icon color="green"><CircleCheck /></el-icon> <el-icon color="green"><CircleCheck /></el-icon>
<span>200KB</span> <span>{{ ruleForm.flieSize }}KB</span>
</div> </div>
</div> </div>
<el-icon :size="20"><Delete /></el-icon> <el-icon :size="20" @click="deleteFlieName(ruleForm)">
<Delete />
</el-icon>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item prop="EmailAddress" label="Email Address"> <el-form-item prop="EmailAddress" label="Email Address">
...@@ -382,16 +393,20 @@ import '@luohc92/vue3-image-viewer/dist/style.css' ...@@ -382,16 +393,20 @@ import '@luohc92/vue3-image-viewer/dist/style.css'
import { checkMesssages } from '../axios/model/user' import { checkMesssages } from '../axios/model/user'
import { require } from '@/utils/index' import { require } from '@/utils/index'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { upLoadFilesHander } from '../minxins/UploadMixin'
const route = useRoute() const route = useRoute()
const routeParams = route.query const routeParams = route.query
const pageType = routeParams.type || 1 const pageType = routeParams.type || 1
const requireFile = ref<any>(null)
const ruleForm = ref({ const ruleForm = ref({
ProductName: 'Product Name', ProductName: 'Product Name',
Email: '1143572217@qq.com', Email: '1143572217@qq.com',
purchaseQuantity: 'Product Category', purchaseQuantity: 'Product Category',
China: '', China: '',
price: 5000, price: 5000,
flieName: 'Tech design requirements.pdf', flieName: '',
flieSize:0,
flieUrl: '',
otherRequirements: otherRequirements:
'Other requirements explanation Other requirements explanation Other requirements explanation Other requirements explanation Other requirements explanation', 'Other requirements explanation Other requirements explanation Other requirements explanation Other requirements explanation Other requirements explanation',
EmailAddress: 'from china', EmailAddress: 'from china',
...@@ -399,13 +414,11 @@ const ruleForm = ref({ ...@@ -399,13 +414,11 @@ const ruleForm = ref({
let isShrink = ref('') let isShrink = ref('')
const changeiShrink = () => { const changeiShrink = () => {
console.log(isShrink.value, 'value')
isShrink.value = !isShrink.value isShrink.value = !isShrink.value
} }
//收缩 //收缩
const vShrink: Directive<HTMLElement, boolean | Props> = { const vShrink: Directive<HTMLElement, boolean | Props> = {
mounted(el, binding) { mounted(el, binding) {
console.log(el, binding, '打印')
let { option } = formatCOlorOption(binding.value) let { option } = formatCOlorOption(binding.value)
option.isUpdate && renderStyle(el, option) option.isUpdate && renderStyle(el, option)
}, },
...@@ -414,17 +427,12 @@ const vShrink: Directive<HTMLElement, boolean | Props> = { ...@@ -414,17 +427,12 @@ const vShrink: Directive<HTMLElement, boolean | Props> = {
let { option } = formatCOlorOption(binding.value) let { option } = formatCOlorOption(binding.value)
if (option.isShrink) { if (option.isShrink) {
renderStyle(el, option) renderStyle(el, option)
//此时此刻还需要添加一个p对象
// renderAddNodes(el, option)
} else { } else {
let obj = { let obj = {
...option, ...option,
width: '292px', width: '292px',
} }
// for (let key in option) obj[key] = ''
renderStyle(el, obj) renderStyle(el, obj)
//此时此刻需要清空对象p
// renderAddNodes(el, option)
} }
}, },
} }
...@@ -432,6 +440,27 @@ const vShrink: Directive<HTMLElement, boolean | Props> = { ...@@ -432,6 +440,27 @@ const vShrink: Directive<HTMLElement, boolean | Props> = {
function renderStyle(el, option) { function renderStyle(el, option) {
for (let key in option) el.style[key] = option[key] for (let key in option) el.style[key] = option[key]
} }
function fileImgChange() {
var e: any = window.event || event
var oFile = e.target.files[0]
upLoadFilesHander(oFile).then((ress) => {
const { success, result }: any = ress
if (success) {
console.log(oFile, 'oFile')
ruleForm.value.flieUrl = result
ruleForm.value.flieName = oFile.name
ruleForm.value.flieSize = oFile.size
console.log(ruleForm,'ruleForm')
}
})
const loading: any = ElLoading?.service({
lock: true,
text: '上传中...',
spinner: 'el-icon-loading',
})
loading.close()
}
//合并指令传递的数据和默认配置的数据 //合并指令传递的数据和默认配置的数据
function formatCOlorOption(val: string | Props) { function formatCOlorOption(val: string | Props) {
const option = const option =
...@@ -445,12 +474,21 @@ function formatCOlorOption(val: string | Props) { ...@@ -445,12 +474,21 @@ function formatCOlorOption(val: string | Props) {
option, option,
} }
} }
//登录 const deleteFlieName = (val: any) => {
console.log(isUpload.value, '打印', 'val')
ruleForm.value.flieUrl = ''
}
//过渡
const defaultStyle: { const defaultStyle: {
transition?: string transition?: string
} = { } = {
transition: 'all 0.6s linear', transition: 'all 0.6s linear',
} }
const requireFileOk = () => {
console.log(requireFile.value, 'value')
requireFile.value.click()
}
const rules = reactive({ const rules = reactive({
ProductName: [ ProductName: [
{ {
...@@ -491,7 +529,7 @@ const rules = reactive({ ...@@ -491,7 +529,7 @@ const rules = reactive({
const ruleFormRef = ref<FormInstance>() const ruleFormRef = ref<FormInstance>()
const customerInfo = ref({}) const customerInfo = ref({})
const messages = ref([]) const messages = ref([])
const isUpload = true const isUpload = ref<Boolean>(true)
const productInfo = ref({ const productInfo = ref({
productImg: require('../assets/shop.jpg'), productImg: require('../assets/shop.jpg'),
productName: 'The secret to looking glowup nowadays', productName: 'The secret to looking glowup nowadays',
...@@ -538,6 +576,8 @@ const connectMsg = () => { ...@@ -538,6 +576,8 @@ const connectMsg = () => {
}) })
let VUE_APP_API_URL = import.meta.env.VITE_USER_APP_API_URL let VUE_APP_API_URL = import.meta.env.VITE_USER_APP_API_URL
const toIp = `ws://${VUE_APP_API_URL}:8081?type=yk&code=${useUser.userInfo.username}&kf=${store.customerInfo.username}` const toIp = `ws://${VUE_APP_API_URL}:8081?type=yk&code=${useUser.userInfo.username}&kf=${store.customerInfo.username}`
console.log(toIp, 'toIpWS')
console.log(toIp, 'toIpWS001')
useUser.connect() useUser.connect()
initWebSocket(toIp) initWebSocket(toIp)
setTimeout(() => { setTimeout(() => {
...@@ -630,16 +670,14 @@ const submitForm = (e) => { ...@@ -630,16 +670,14 @@ const submitForm = (e) => {
messages.value?.push(data) messages.value?.push(data)
sendWebSocket(data) sendWebSocket(data)
} }
const openWindow = (event: any) => {
urlDownload(event)
}
const handleMessageClick = (event: any) => { const handleMessageClick = (event: any) => {
const target = event.target const target = event.target
console.log(target, 'target')
if (target.tagName === 'A') { if (target.tagName === 'A') {
if (target.innerHTML === '解决') { openWindow(target.href)
alert('感谢您的使用')
} else if (target.innerHTML === '未解决') {
alert('很抱歉未能解决你的问题')
} else {
handleLinkClick(target.innerHTML)
}
} else if (target.tagName === 'IMG') { } else if (target.tagName === 'IMG') {
// 点击的图片进行放大操作 // 点击的图片进行放大操作
ImageViewer({ ImageViewer({
...@@ -654,16 +692,22 @@ const handleMessageClick = (event: any) => { ...@@ -654,16 +692,22 @@ const handleMessageClick = (event: any) => {
}) })
} }
} }
const downLoad = (message: any) => {
urlDownload(message.content.flieUrl)
}
//查看消息将其改为已读 const urlDownload = (url, fileName = '下载文件') => {
const getCheckMesssages = async (res: any) => { // 创建隐藏的可下载链接
try { let eleLink = document.createElement('a')
const { success, result, message }: any = await checkMesssages({ eleLink.download = fileName
username: res.username, eleLink.style.display = 'none'
}) eleLink.href = url
} catch (error) { // 触发点击
console.log(error) document.body.appendChild(eleLink)
} eleLink.click()
// 然后移除
console.log(url, '下载url')
document.body.removeChild(eleLink)
} }
const handleLinkClick = (msg: string) => { const handleLinkClick = (msg: string) => {
...@@ -688,7 +732,6 @@ const toSendLink = (e: any) => { ...@@ -688,7 +732,6 @@ const toSendLink = (e: any) => {
to: customerInfo.value.username, to: customerInfo.value.username,
form: store.userInfo.username, form: store.userInfo.username,
} }
messages.value?.push(data) messages.value?.push(data)
sendWebSocket(data) sendWebSocket(data)
} }
...@@ -696,15 +739,21 @@ const toSendLink = (e: any) => { ...@@ -696,15 +739,21 @@ const toSendLink = (e: any) => {
<style lang="scss" scoped> <style lang="scss" scoped>
.shirnk-aside { .shirnk-aside {
position: relative; position: relative;
overflow: hidden; overflow-y: scroll;
overflow: initial; overflow: inherit;
.shrink-text { .shrink-text {
position: absolute; position: absolute;
top: 50%; top: 50%;
transform: translate(-50%); transform: translate(-50%);
width: 20px; line-height: 15px;
height: 20px; height: 15px;
left: -20px; text-align: center;
display: flex;
justify-content: center;
align-items: center;
width: 15px;
left: -12px;
font-size: 10px; font-size: 10px;
} }
} }
...@@ -1512,9 +1561,36 @@ const toSendLink = (e: any) => { ...@@ -1512,9 +1561,36 @@ const toSendLink = (e: any) => {
} }
} }
} }
.click-to-upload {
color: #073a3d;
font-family: 'Inter';
font-size: 14px;
font-style: normal;
font-weight: 600;
margin-bottom: 4px;
}
.or-drag-and-drap {
color: #475467;
font-family: 'Inter';
font-size: 14px;
font-style: normal;
font-weight: 400;
}
.recently-input-box { .recently-input-box {
padding: 12px; padding: 12px;
} }
.requirements-box {
position: relative;
z-index: 0;
}
input {
position: absolute;
top: 0px;
left: 0px;
height: 100%;
width: 100%;
background: transparent;
}
.requirements-box, .requirements-box,
.requirements-box1 { .requirements-box1 {
.box { .box {
...@@ -1562,6 +1638,12 @@ const toSendLink = (e: any) => { ...@@ -1562,6 +1638,12 @@ const toSendLink = (e: any) => {
border: 1px solid #eaecf0; border: 1px solid #eaecf0;
padding: 12px 58px 12px 14px; padding: 12px 58px 12px 14px;
} }
.click-to-upload {
line-height: 20px;
}
.or-drag-and-drap {
line-height: 20px;
}
.requirements-box1 { .requirements-box1 {
background: #f6f9fcff; background: #f6f9fcff;
} }
......
...@@ -48,5 +48,6 @@ export default defineConfig({ ...@@ -48,5 +48,6 @@ export default defineConfig({
host: "0.0.0.0", host: "0.0.0.0",
port: 8082, port: 8082,
open: false, open: false,
overlay:true,
}, },
}); });
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论