| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485 |
- <template>
- <div class="messageCom" @click.stop="closeDialog()">
- <el-dialog :close-on-press-escape="false" :close-on-click-modal="false" width="70%" v-model="show"
- @close="closeShow" :draggable="true" destroy-on-close align-center center>
- <template #header>
- <div class="my-header flex align-center" v-if="userType==1">
- <div class="my-header-title" style="font-weight: bold;">
- {{title}}
- </div>
- <el-divider direction="vertical" />
- <div class="my-header-name">
- {{postPushInfo.stationName}}
- </div>
- <div class="my-header-price">
- {{postPushInfo.salaryRange}}
- </div>
- <div class="my-header-yq">
- {{postPushInfo.education}}
- </div>
- </div>
- <div class="my-header flex align-center" v-else>
- <div class="my-header-title" style="font-weight: bold;">
- {{resumesInfo.userName}}
- </div>
- <el-divider direction="vertical" />
- <div class="my-header-name">
- {{resumesInfo.intentionRuleClassifyName}}
- </div>
- <div class="my-header-price">
- {{resumesInfo.intentionSalaryRange}}
- </div>
- <div class="my-header-yq">
- {{ resumesInfo.resumesWorkExperience || '0' }}年
- </div>
- </div>
- </template>
- <div class="message">
- <div ref="messageBox" class="message-box">
- <div class="message-box-item" v-for="(item,index) in megList" :key="index">
- <!-- 对方的消息 -->
- <div class="message-boxs message-box-l flex flex-wrap" v-if="item.userId != userId">
- <img class="message-boxs-avatar" :src="item.avatar?item.avatar:'/default.jpg'" alt="" />
- <div class="message-box-l-con" v-if="item.messageType==1 || item.messageType==10">
- {{item.content}}
- </div>
- <div class="message-box-l-con flex align-center" v-if="item.messageType==20">
- 视频通话
- <img src="/public/images/message/historyVideo_black.png"
- style="width: 25px;height: 25px;margin-left: 10px;" mode=""></img>
- </div>
- <div class="message-box-l-con flex align-center" v-if="item.messageType==21">
- 语音通话
- <img src="/public/images/message/historyAudio_black.png"
- style="width: 25px;height: 25px;margin-left: 10px;" mode=""></img>
- </div>
- <div class="message-box-l-con flex algin-center" style="cursor: pointer;"
- @click="jumpToTencentMap(item.content.latitude,item.content.longitude,item.content.address)"
- v-if="item.messageType==18">
- {{item.content.address}}
- <el-icon style="margin-left: 10px;" :size="20" color="#00DD9A">
- <MapLocation />
- </el-icon>
- </div>
- <!-- 图片 -->
- <div class="message-box-l-con" style="background-color: #ffffff;"
- v-if="item.messageType==2">
- <el-image style="width: 100px;height: 100px;border-radius: 4px;" :src="item.content"
- fit="cover" :zoom-rate="1.2" :max-scale="7" :min-scale="0.2"
- :preview-src-list="[item.content]" :initial-index="4" />
- </div>
- <!-- 语音消息 -->
- <div class="message-box-l-con" v-if="item.messageType==3">
- 语音消息,请前往APP或小程序查看
- </div>
- <!-- 表情 -->
- <div class="message-box-l-con" style="background-color: #ffffff;"
- v-if="item.messageType==4">
- <img :src="emjSrc+item.content" alt="" />
- </div>
- <!-- 交换手机号请求 -->
- <div class="message-box-l-phone" v-if="item.messageType==5 && item.content=='手机号请求'">
- 我想跟你交换手机号,是否同意?
- <div class="message-box-l-phone-btn flex align-center">
- <el-button plain size="small"
- @click.stop="refuseFun(item.chatContentId)">拒绝</el-button>
- <el-button type="primary" size="small"
- @click.stop="tongyi(item.messageType,item.chatContentId)">同意</el-button>
- </div>
- </div>
- <!-- 交换手机号请求同意 -->
- <div class="message-box-l-con" v-if="item.messageType === 5 && item.content!='手机号请求'">
- 已同意交换手机号
- </div>
- <!-- 交换微信号请求 -->
- <div class="message-box-l-phone" v-if="item.messageType==6 && item.content=='微信号请求'">
- 我想跟你交换微信号,是否同意?
- <div class="message-box-l-phone-btn flex align-center">
- <el-button plain size="small"
- @click.stop="refuseFun(item.chatContentId)">拒绝</el-button>
- <el-button type="primary" size="small"
- @click.stop="tongyi(item.messageType,item.chatContentId)">同意</el-button>
- </div>
- </div>
- <!-- 交换微信号请求同意 -->
- <div class="message-box-l-con" v-if="item.messageType === 6 && item.content!='微信号请求'">
- 已同意交换微信号
- </div>
- <div class="message-box-l-con" v-if="item.messageType==7">
- <div class="" v-if="item.userType==1">
- 我的手机号为:{{JSON.parse(item.content).userPhone}}
- </div>
- <div v-else>
- 我的手机号为:{{JSON.parse(item.content).companyPhone}}
- </div>
- </div>
- <div class="message-box-l-con" v-if="item.messageType==8">
- <div class="" v-if="item.userType==1">
- 我的微信号为:{{JSON.parse(item.content).userWx}}
- </div>
- <div v-else>
- 我的微信号为:{{JSON.parse(item.content).companyWx}}
- </div>
- </div>
- <!-- 交换手机号请求拒绝 -->
- <div class="message-box-l-con" v-if="item.messageType==12">
- {{item.content}}已拒绝
- </div>
- <!-- 简历请求 -->
- <div class="message-box-l-phone" v-if="item.messageType==9 && item.content=='简历请求'">
- 我想要你的一份简历,是否同意?
- <div class="message-box-l-phone-btn flex align-center">
- <el-button plain size="small"
- @click.stop="refuseFun(item.chatContentId)">拒绝</el-button>
- <el-button type="primary" size="small" @click.stop="resumesTy()">同意</el-button>
- </div>
- </div>
- <!-- 简历请求已同意 -->
- <div class="message-box-l-con"
- v-if="item.content && item.messageType === 9 && item.content!='简历请求'">
- {{item.content}}
- </div>
- <!-- 面试邀约消息 -->
- <div class="message-box-l-con inv-style" v-if="item.content && item.messageType === 99">
- 您收到了{{ item.content }}</div>
- <!-- 面试拒绝或同意 -->
- <div class="message-box-l-con inv-style"
- v-if="item.content && (item.messageType === 96 || item.messageType === 97)">{{item.content }}</div>
- <div style="width: 100%;color: #999999;font-size: 12px;padding-left: 50px;margin-top: 4px;">
- {{item.createTime}}
- </div>
- </div>
- <!-- 我发的消息 -->
- <div class="message-boxs message-box-r flex flex-wrap" v-else>
- <!-- 文字消息 -->
- <div class="message-box-r-con" v-if="item.messageType==1 || item.messageType==10">
- {{item.content}}
- </div>
- <div class="message-box-r-con flex align-center" v-if="item.messageType==20">
- 视频通话
- <img src="/public/images/message/historyVideo_white.png"
- style="width: 25px;height: 25px;margin-left: 10px;" mode=""></img>
- </div>
- <div class="message-box-r-con flex align-center" v-if="item.messageType==21">
- 语音通话
- <img src="/public/images/message/historyAudio_white.png"
- style="width: 25px;height: 25px;margin-left: 10px;" mode=""></img>
- </div>
- <div class="message-box-r-con flex algin-center" style="cursor: pointer;"
- @click="jumpToTencentMap(item.content.latitude,item.content.longitude,item.content.address)"
- v-if="item.messageType==18">
- {{item.content.address}}
- <el-icon style="margin-left: 10px;" :size="20" color="#ffffff">
- <MapLocation />
- </el-icon>
- </div>
- <!-- 简历请求 -->
- <div class="message-box-r-con" v-if="item.messageType==9">
- 简历请求已发送,等待对方同意
- </div>
- <!-- 图片 -->
- <div class="message-box-r-con" style="background-color: #ffffff;"
- v-if="item.messageType==2">
- <el-image style="width: 100px;height: 100px;border-radius: 4px;" :src="item.content"
- fit="cover" :zoom-rate="1.2" :max-scale="7" :min-scale="0.2"
- :preview-src-list="[item.content]" :initial-index="4" />
- </div>
- <!-- 语音消息 -->
- <div class="message-box-r-con" v-if="item.messageType==3">
- 语音消息,请前往APP或小程序查看
- </div>
- <!-- 表情消息 -->
- <div class="message-box-r-con" style="background-color: #ffffff;"
- v-if="item.messageType==4">
- <img :src="emjSrc+item.content" alt="" />
- </div>
- <!-- 交换手机号请求 -->
- <div class="message-box-r-con" v-if="item.messageType==5">
- 交换手机号请求已发送,等待对方同意
- </div>
- <div class="message-box-r-con" v-if="item.messageType==7">
- <div class="" v-if="item.userType==1">
- 我的手机号为:{{JSON.parse(item.content).userPhone}}
- </div>
- <div v-else>
- 我的手机号为:{{JSON.parse(item.content).companyPhone}}
- </div>
- </div>
- <!-- 交换微信号请求 -->
- <div class="message-box-r-con" v-if="item.messageType==6">
- 交换微信号请求已发送,等待对方同意
- </div>
- <div class="message-box-r-con" v-if="item.messageType==8">
- <div class="" v-if="item.userType==1">
- 我的微信号为:{{JSON.parse(item.content).userWx}}
- </div>
- <div v-else>
- 我的微信号为:{{JSON.parse(item.content).userWx}}
- </div>
- </div>
- <!-- 交换手机号请求拒绝 -->
- <div class="message-box-r-con" v-if="item.messageType==12">
- {{item.content}}已拒绝
- </div>
- <!-- 面试邀约消息 -->
- <div class="message-box-r-con invitation" v-if="item.content && item.messageType === 99">
- 您发送了{{ item.content }}</div>
- <!-- 面试拒绝或同意 -->
- <div class="message-box-r-con invitation"
- v-if="item.content && (item.messageType === 96 || item.messageType === 97)">{{
- item.content }}</div>
- <img class="message-boxs-avatar" :src="avatar?avatar:'/default.jpg'" alt="" />
- <div
- style="width: 100%;color: #999999;font-size: 12px;padding-right: 50px;margin-top: 4px;text-align: right;">
- {{item.createTime}}
- </div>
- </div>
- </div>
- </div>
- <div class="message-btom flex align-center justify-center">
- <div class="messageCon">
- <div class="message-btom-content">
- <el-input @keyup.enter.prevent="sendMessage(1)" style="margin-top: 10px;" resize="none"
- :input-style="inputStyles" v-model="content" :autosize="{ minRows: 4, maxRows: 4 }"
- type="textarea" placeholder="请输入内容" />
- </div>
- <div class="message-btom-btn flex align-center justify-between">
- <div class="message-btom-btn-l flex align-center">
- <div @click.stop="czlist(index)" @mouseover="changeImageSrc(index)"
- @mouseout="resetImageSrc(index)" class="message-btom-btn-l-item flex align-center"
- v-for="(item,index) in czList" :key="index">
- <div v-if="index == 1" class="flex align-center">
- <el-upload class="flex align-center" :action="action" :show-file-list="false"
- :on-success="handleAvatarSuccess">
- <img :src="czIndex==index?item.srcS:item.src" alt="" srcset="" />
- </el-upload>
- </div>
- <div v-else class="flex align-center">
- <img :src="czIndex==index?item.srcS:item.src" alt="" srcset="" />
- {{item.name}}
- </div>
- </div>
- <div v-if="isShowEmoj" class="message-btom-btn-l-emj flex align-center justify-center">
- <div class="message-btom-btn-l-emj-box">
- <img @click="sendMessage(4,item.url)" v-for="(item,index) in emojList"
- :key="index" :src="emjSrc+item.url" :alt="item.alt" srcset="" />
- </div>
- </div>
- <div v-if="isShowEmoj" class="message-btom-btn-l-emjs"></div>
- <!-- 常用语 -->
- <div v-if="isShowCommon"
- class="message-btom-btn-l-emj flex align-center justify-center">
- <ul class="message-btom-btn-l-emj-box sentence-panel">
- <li class="message-text" v-for="item in changYongList" :key="item.id"
- @click="selConfirm(item.label)">{{ item.label }}</li>
- </ul>
- </div>
- </div>
- <el-button type="primary" @click="sendMessage(1)">发送</el-button>
- </div>
- </div>
- </div>
- </div>
- <el-dialog v-model="dialogms" title="面试邀请" @close="closeMs" width="30%" :destroy-on-close="true">
- <div style="padding: 20px;">
- <el-form label-position="right" ref="formms" :model="miamshi" class="">
- <el-form-item prop="position"
- :rules="[{ required: true, message: '请选择面试岗位', trigger: 'blur', },]" label="面试岗位">
- <el-select v-model="miamshi.position" placeholder="请选择面试岗位" filterable clearable>
- <el-option v-for="item in jobList" :key="item.id" :label="item.ruleClassifyName"
- :value="item.ruleClassifyId" />
- </el-select>
- </el-form-item>
- <el-form-item prop="interviewDateTime"
- :rules="[{ required: true, message: '请选择面试时间', trigger: 'blur', },]" label="面试时间">
- <el-date-picker style="width: 100%;" v-model="miamshi.interviewDateTime" type="datetime"
- placeholder="请选择面试时间" format="YYYY-MM-DD HH:mm" date-format="MMM DD, YYYY"
- time-format="HH:mm" />
- </el-form-item>
- <el-form-item prop="address" :rules="[{ required: true, message: '请选择面试地点', trigger: 'blur', },]"
- label="面试地点">
- <el-autocomplete style="width: 100%;" v-model="miamshi.address"
- :fetch-suggestions="querySearchAsync" placeholder="请输入面试地点" @select="handleSelect" />
- </el-form-item>
- <el-form-item prop="detailedAddress"
- :rules="[{ required: true, message: '请输入详细地址', trigger: 'blur', },]" label="详细地址">
- <el-input v-model="miamshi.detailedAddress" placeholder="请输入详细地址" clearable />
- </el-form-item>
- <el-form-item prop="hrName"
- :rules="[{ required: true, message: '请输入联系人名称', trigger: 'blur', },]" label="联系姓名">
- <el-input v-model="miamshi.hrName" placeholder="请输入联系人" clearable />
- </el-form-item>
- <el-form-item prop="hrPhone" :rules="[{ required: true, message: '请输入手机号', trigger: 'blur', },]"
- label="手机号码">
- <el-input v-model="miamshi.hrPhone" placeholder="请输入手机号" clearable />
- </el-form-item>
- <el-form-item prop="remarks" :rules="[{ required: true, message: '请输入备注', trigger: 'blur', },]"
- label="面试备注">
- <el-input v-model="miamshi.remarks" placeholder="请输入备注" clearable />
- </el-form-item>
- </el-form>
- </div>
- <template #footer>
- <span class="dialog-footer flex align-center justify-end" style="padding-right: 20px;padding-bottom: 20px;">
- <el-button @click="dialogms = false">取消</el-button>
- <el-button type="primary" @click="submitMs()">
- 确认
- </el-button>
- </span>
- </template>
- </el-dialog>
- </el-dialog>
- <!-- 附件列表 -->
- <AttachmentSelectDialog @closePostPush="closePostPush" @select="selectItem" v-if="showDialog" :showDialog="showDialog" />
- </div>
- </template>
- <script>
- import {
- ROOTPATH,
- ROOTPATH2,
- ROOTPATH3
- } from '../../../comment/httpUrl.js'
- //引入表情的json
- import emoj from './emoj.json'
- import {
- ElMessageBox,
- ElMessage,
- } from 'element-plus'
- import axios from 'axios';
- import jsonp from 'axios-jsonp'
- import AttachmentSelectDialog from '../AttachmentSelectDialog/AttachmentSelectDialog.vue'
- export default {
- components: { AttachmentSelectDialog },
- props: {
- // 显示弹窗
- showMeg: {
- type: Boolean,
- default: false
- },
- byUserId: {
- type: Number,
- default: -1
- },
- //聊天室id
- chatConversationId: {
- type: Number,
- default: -1
- },
- //岗位id
- postPushId: {
- type: Number,
- default: -1
- },
- //简历id
- resumesId: {
- type: Number,
- default: -1
- },
- //聊天类型:1用户 2企业
- userType: {
- type: Number,
- default: 1
- }
- },
- data() {
- return {
- showDialog: false,
- miamshi: {
- hrPhone: '', //手机号
- hrName: '', //联系人
- position: '', //面试岗位
- interviewDateTime: '', //面试时间
- companyId: '', //公司id
- remarks: '', //面试备注
- userId: '', //面试者id
- postPushId: '', //岗位id
- province: '', //省
- city: '', //市
- county: '', //区
- lng: '', //经度
- lat: '', //纬度
- address: '', //地址
- detailedAddress: '', //详细地址
- },
- dialogms: false, //面试邀请弹窗
- isSendWx: false, //是否交换微信
- isSendPhone: false, //是否交换电话
- action: ROOTPATH + '/alioss/upload', //上传图片地址
- screenHeight: 0, //屏幕高度
- emjSrc: ROOTPATH3,
- isShowEmoj: false, //是否显示表情弹窗
- show: false,
- webSco: null,
- webSocketState: false, //scoket是否连接状态
- userId: '',
- page: 1,
- limit: 100,
- title: '',
- postPushInfo: {}, //岗位信息
- resumesInfo: {}, //简历信息
- megList: [], //聊天消息
- content: '', //消息内容
- emojList: emoj.emojList, //表情
- czIndex: -1,
- czList: [{
- name: '',
- src: '/images/postimg/emij.png',
- srcS: '/images/postimg/emij_s.png',
- },
- {
- name: '',
- src: '/images/postimg/photo.png',
- srcS: '/images/postimg/photo_s.png',
- },
- {
- name: '',
- src: '/images/postimg/cyy.png',
- srcS: '/images/postimg/cyy_s.png',
- },
- {
- name: '发简历',
- src: '/images/postimg/jl.png',
- srcS: '/images/postimg/jl_s.png',
- },
- {
- name: '换电话',
- src: '/images/postimg/phone.png',
- srcS: '/images/postimg/phone_s.png',
- },
- {
- name: '换微信',
- src: '/images/postimg/weichat.png',
- srcS: '/images/postimg/weichat_s.png',
- }
- ], //操作图片
- jobList: [],
- isShowCommon: false, //是否显示常用语
- changYongList: []
- }
- },
- computed: {
- //获取我的头像
- avatar() {
- return this.$store.state.avatar;
- },
- },
- mounted() {
- this.screenHeight = window.innerHeight
- this.userId = localStorage.getItem('userId')
- this.show = this.showMeg
- if (this.chatConversationId) {
- //获取聊天记录
- this.getCHarList();
- }
- if (this.userType == 1) {
- this.czList[3].name = '发简历'
- //获取岗位信息
- this.getPostPushInfo(this.postPushId)
- } else {
- this.czList[3].name = '求简历'
- this.czList.push({
- name: '约面试',
- src: '/images/postimg/yms.png',
- srcS: '/images/postimg/yms_.png',
- })
- this.getPostPushInfo(this.postPushId)
- }
- //建立webscoket连接
- this.initScoket()
- this.getStatusInfo();
- setTimeout(() => {
- this.getChangYong();
- }, 1000);
- },
- methods: {
- getChangYong() {
- let state = 0
- if (this.userType == 1) {
- state = 70
- } else {
- state = 80
- }
- this.$Request.get(`/app/message/selectMessageByType?page=1&limit=100&state=${state}`)
- .then(res => {
- if (res.code == 0) {
- this.changYongList = [{ label: '你好啊,可以聊一聊~', id: 0 }];
- res.data.list.forEach(d => {
- let data = {
- label: d.content,
- id: d.id
- }
- this.changYongList.push(data);
- });
- }
- });
- },
- selConfirm(val) {
- this.content = val;
- this.isShowCommon = false;
- },
- closePostPush() {
- this.showDialog = false
- },
- // 选择附件简历的数据
- selectItem(item) {
- if (item.resumesAttachmentId) {
- this.sendResumesSave(item.resumesAttachmentId);
- }
- },
- //关闭面试邀请回掉
- closeMs() {
- //清楚输入的值
- this.miamshi.detailedAddress = '';
- this.miamshi.interviewDateTime = '';
- this.miamshi.address = '';
- this.miamshi.remarks = '';
- this.miamshi.userId = '';
- this.miamshi.hrPhone = ''; //手机号
- this.miamshi.hrName = ''; //联系人
- this.miamshi.position = ''; //面试岗位
- },
- jumpToTencentMap(latitude, longitude, name) {
- var url = 'https://apis.map.qq.com/uri/v1/search?keyword=' + name + '¢er=' + latitude + ',' +
- longitude + '&radius=100&referer=OB4BZ-D4W3U-B7VVO-4PJWW-6TKDJ-WPB77';
- window.open(url)
- },
- formatDate(dates, type) {
- let date = new Date(dates)
- let year = date.getFullYear()
- let month = ("0" + (date.getMonth() + 1)).slice(-2)
- let day = ("0" + date.getDate()).slice(-2)
- let hour = date.getHours()
- let minute = ("0" + date.getMinutes()).slice(-2)
- // 处理 12小时制
- let ampm = hour >= 12 ? 'PM' : 'AM'
- hour = hour % 12
- hour = hour ? hour : 12 // 0点转成12
- hour = ("0" + hour).slice(-2)
- if (type == 1) {
- // 返回完整日期 + 固定时间
- return `${year}-${month}-${day} 00:00:00`
- } else {
- // 返回 12小时制时间 + AM/PM
- return `${hour}:${minute} ${ampm}`
- }
- },
- submitMs() {
- let obj = JSON.parse(JSON.stringify(this.miamshi))
- let Time = this.formatDate(obj.interviewDateTime, 1);
- obj.detailTime = this.formatDate(obj.interviewDateTime, 2);
- let formms = this.$refs.formms
- formms.validate((valid) => {
- if (valid) {
- if (!obj.lng || !obj.lat) {
- ElMessage({
- message: '请选择搜索出来的地址',
- type: 'info',
- duration: 1500,
- offset: this.screenHeight / 2
- })
- return
- }
- let dataInfo = {
- address: obj.address,
- companyId: obj.companyId,
- detailTime: obj.detailTime,
- detailedAddress: obj.detailedAddress,
- hrName: obj.hrName,
- hrPhone: obj.hrPhone,
- interviewDateTime: Time,
- interviewerId: obj.userId,
- lat: obj.lat,
- lng: obj.lng,
- onlineMsg: '',
- onlineType: '',
- postPushId: obj.postPushId,
- recordId: '',//发送的这份面试的id,为空,代表添加,如果有值的话代表修改
- remarks: obj.remarks,
- resumesId: this.resumesId,
- type: 0
- }
- this.$Request.post("/app/interviewRecord/saveInterview", dataInfo, {
- type: 'json'
- }).then(res => {
- if (res.code == 0) {
- ElMessage({
- message: '面试邀请已发送',
- type: 'success',
- duration: 1500,
- offset: this.screenHeight / 2
- })
- this.sendMessage(99)
- this.dialogms = false
- }
- // else {
- // ElMessage({
- // message: res.msg,
- // type: 'error',
- // duration: 1500,
- // offset: this.screenHeight / 2
- // })
- // }
- })
- }
- })
- },
- //选择地址
- handleSelect(item) {
- this.miamshi.companyId = localStorage.getItem('companyId')
- this.miamshi.userId = this.byUserId
- this.miamshi.postPushId = this.postPushId
- this.miamshi.province = item.province
- this.miamshi.city = item.city
- this.miamshi.county = item.district
- this.miamshi.lng = item.location.lng
- this.miamshi.lat = item.location.lat
- },
- //地址搜索
- querySearchAsync(queryString, cd) {
- if (!queryString) {
- cd([])
- return
- }
- let data = {
- key: "ZBABZ-ZWECU-UQTVV-4LYDR-COK3F-5SF75", //申请的密钥
- keyword: queryString, //搜索内容
- output: 'jsonp',
- };
- let url =
- "https://apis.map.qq.com/ws/place/v1/suggestion"
- axios.get(url, {
- params: data,
- adapter: jsonp
- }).then(res => {
- if (res.data.status == 0) {
- let arr = res.data.data
- arr.map(item => {
- item.value = item.title
- })
- cd(arr)
- }
- }).catch(err => {
- console.log(err)
- })
- },
- //获取简历数据
- getResumesInfo(id) {
- let data = {
- userId: localStorage.getItem('userId'),
- resumesId: id,
- companyId: localStorage.getItem('companyId')
- }
- this.$Request.get("/app/resumes/selectResumesByResumesId", {
- params: data
- }).then(res => {
- if (res.code == 0) {
- res.data.intentionRuleClassifyName = this.postPushInfo.ruleClassifyName
- res.data.intentionSalaryRange = this.postPushInfo.salaryRange
- // res.data.intentionExprence = []
- res.data.intentionList.forEach(item=>{
- if (item.ruleClassifyName == this.postPushInfo.ruleClassifyName) {
- res.data.intentionRuleClassifyName = item.ruleClassifyName
- res.data.intentionSalaryRange = item.salaryRange
- // res.data.intentionExprence = item.industry && item.industry.split('/') || []
- }
- })
- this.resumesInfo = res.data
-
- }
- })
- },
- // 同意简历请求并发送简历
- sendResumesSave(resumesAttachmentId) {
- let that = this
- let data = {
- to: this.byUserId, //接收人的userId
- postPushId: this.postPushId, //岗位id
- resumesAttachmentId
- }
- this.$Request.post("/app/resumes/sendResumes", data).then(res => {
- if (res.code == 0) {
- ElMessage({
- message: '简历已发送',
- type: 'success',
- duration: 1500,
- offset: this.screenHeight / 2
- })
- this.sendMessage(24)
- this.getCHarList()
- this.getStatusInfo()
- }
- })
- },
- //同意简历请求
- resumesTy() {
- ElMessageBox.confirm(
- '确定发送简历给对方?',
- '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- }
- )
- .then(() => {
- this.showDialog = true;
- }).catch(() => {
- })
- },
- //同意交换手机号/微信
- tongyi(messageType, chatContentId) {
- if (messageType == 6 && !this.$store.state.weChatNum) {
- ElMessageBox.confirm(
- '请点击右上角头像的个人信息完善微信号后操作',
- '提示', {
- confirmButtonText: '去完善',
- cancelButtonText: '取消',
- type: 'warning',
- }
- )
- .then(() => {
- }).catch(() => {
- })
- return
- }
- let that = this
- ElMessageBox.confirm(
- messageType == 5 ? '同意后将交换手机号,是否同意?' : '同意后将交换微信号,是否同意?',
- '提示', {
- confirmButtonText: '同意',
- cancelButtonText: '取消',
- type: 'warning',
- }
- )
- .then(() => {
- let data = {
- messageType: messageType,
- chatContentId: chatContentId
- }
- that.$Request.post("/app/chat/sendPhoneOrWx", data).then(res => {
- if (res.code == 0) {
- this.sendMessage(24)
- this.getCHarList()
- that.getStatusInfo()
- }
- })
- }).catch(() => {
- })
- },
- //请求拒绝
- refuseFun(id) {
- ElMessageBox.confirm(
- '确定拒绝吗?',
- '提示', {
- confirmButtonText: '确认',
- cancelButtonText: '取消',
- type: 'warning',
- }
- )
- .then(() => {
- let data = {
- chatContentId: id
- }
- this.$Request.get("/app/chat/refuseReqs", {
- params: data
- }).then(res => {
- if (res.code == 0) {
- ElMessage({
- message: '已拒绝',
- type: 'success',
- duration: 1500,
- offset: this.screenHeight / 2
- })
- this.sendMessage(24)
- this.getCHarList()
- this.getStatusInfo()
- } else {
- ElMessage({
- message: res.msg,
- type: 'error',
- duration: 1500,
- offset: this.screenHeight / 2
- })
- }
- })
- }).catch(() => {
- })
- },
- //发送图片
- handleAvatarSuccess(res) {
- let data = {
- userId: this.byUserId, //id
- content: res.data, //消息内容
- messageType: 2, //消息类型
- chatConversationId: this.chatConversationId //聊天室id
- }
- //把要发送的消息转换为json字符串
- data = JSON.stringify(data);
- //如果scoket是连接状态,那么就直接发送消息
- if (this.webSocketState) {
- // 发送消息
- this.webSco.send(data)
- setTimeout(() => {
- //发送消息后晴空输入框
- this.content = ''
- //获取聊天记录
- this.getCHarList()
- }, 50)
- } else { //如果不是,那么就重新连接
- this.initScoket()
- }
- },
- // 发送消息 type:1:文字 2:图片 3:语音 4:表情
- sendMessage(type, url) {
- let data = {
- userId: this.byUserId, //id
- content: this.content.replace(/\n/g, ''), //消息内容
- messageType: type, //消息类型
- chatConversationId: this.chatConversationId //聊天室id
- }
- if (type == 1 && !data.content) { //文字
- ElMessage({
- message: '请输入聊天内容',
- type: 'error',
- duration: 1500,
- offset: this.screenHeight / 2
- })
- this.content = ''
- return
- }
- if (type == 4) { //发送表情
- data.content = url
- }
- if (type == 5) { //交换手机号请求
- data.content = '手机号请求';
- }
- if (type == 6) { //交换微信号请求
- data.content = '微信号请求';
- }
- if (type == 9) { //简历请求
- data.content = '简历请求';
- }
- if (type == 24) { //刷新
- data.content = '刷新';
- }
- if (type == 99) { //面试邀约
- data.content = '一份面试邀约';
- }
- //把要发送的消息转换为json字符串
- data = JSON.stringify(data);
- //如果scoket是连接状态,那么就直接发送消息
- if (this.webSocketState) {
- // 发送消息
- this.webSco.send(data)
- setTimeout(() => {
- //发送消息后晴空输入框
- this.content = ''
- //获取聊天记录
- this.getCHarList()
- }, 50)
- } else { //如果不是,那么就重新连接
- this.initScoket()
- }
- },
- //发简历
- sendResumes() {
- let that = this
- ElMessageBox.confirm(
- '是否将简历发送给对方?',
- '提示', {
- confirmButtonText: '发送',
- cancelButtonText: '取消',
- type: 'warning',
- }
- )
- .then(() => {
- this.showDialog = true;
- }).catch(() => {
- })
- },
- //交换手机号弹窗
- currentPhone() {
- let that = this
- if (this.isSendPhone == false) {
- ElMessageBox.confirm(
- '确定后,电话交换请求将发送给对方,对方同意后将会看到彼此的手机号',
- '确定与对方交换电话吗?', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- }
- )
- .then(() => {
- that.sendMessage(5)
- }).catch(() => {
- })
- } else {
- ElMessage({
- message: '已交换过手机号,请查看聊天记录',
- type: 'error',
- duration: 1500,
- offset: this.screenHeight / 2
- })
- }
- },
- //交换微信号弹窗
- currentWchat() {
- let that = this
- if (!this.$store.state.weChatNum) {
- ElMessageBox.confirm(
- '请点击右上角头像的个人信息完善微信号后操作',
- '提示', {
- confirmButtonText: '去完善',
- cancelButtonText: '取消',
- type: 'warning',
- }
- )
- .then(() => {
- }).catch(() => {
- })
- return
- }
- if (this.isSendWx == false) {
- ElMessageBox.confirm(
- '确定后,微信交换请求将发送给对方,对方同意后将会看到彼此的微信号',
- '确定与对方交换微信吗?', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- }
- )
- .then(() => {
- that.sendMessage(6)
- }).catch(() => {
- })
- } else {
- ElMessage({
- message: '已交换过微信号,请查看聊天记录',
- type: 'error',
- duration: 1500,
- offset: this.screenHeight / 2
- })
- }
- },
- //求简历
- giveSendResumes() {
- ElMessageBox.confirm(
- '是否将简历请求发送给对方?',
- '确定获取对方简历吗?', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- }
- )
- .then(() => {
- this.sendMessage(9)
- }).catch(() => {
- })
- },
- //操作
- czlist(index) {
- switch (index) {
- case 0: //显示表情
- this.isShowEmoj = true
- break;
- case 2: //显示常用语
- this.isShowCommon = true
- break;
- case 3:
- if (this.userType == 1) { //发简历
- this.sendResumes()
- } else { //求简历
- this.giveSendResumes()
- }
- break;
- case 4: //换电话
- this.currentPhone()
- break;
- case 5: //换微信
- this.currentWchat()
- break;
- case 6: //约面试
- this.openDialog();
- break;
- default:
- break;
- }
- },
- // 赋值地址和联系人数据
- openDialog() {
- const addressInfo = localStorage.getItem('companyAddressInfo')
- ? JSON.parse(localStorage.getItem('companyAddressInfo'))
- : {};
- this.miamshi = {
- hrPhone: this.$store.state.phone || '',
- hrName: this.$store.state.nickName || '',
- position: '',
- interviewDateTime: '',
- companyId: localStorage.getItem('companyId') || '',
- remarks: '',
- userId: this.byUserId || '',
- postPushId: this.postPushId || '',
- province: addressInfo.province || '',
- city: addressInfo.city || '',
- county: addressInfo.county || '',
- lng: addressInfo.lng || '',
- lat: addressInfo.lat || '',
- address: addressInfo.address || '',
- detailedAddress: addressInfo.detailedAddress || '',
- }
- this.dialogms = true;
- },
- //获取交换状态
- getStatusInfo() {
- let data = {
- chatConversationId: this.chatConversationId
- }
- this.$Request.get("/app/chat/getConversationInfo", {
- params: data
- }).then(res => {
- if (res.code == 0) {
- if (res.data.isSendWx) { //是否交换微信
- this.isSendWx = true
- } else {
- this.isSendWx = false
- }
- if (res.data.isSendPhone) { //是否交换电话
- this.isSendPhone = true
- } else {
- this.isSendPhone = false
- }
- }
- })
- },
- //关闭弹窗
- closeDialog() {
- this.isShowEmoj = false
- this.isShowCommon = false
- },
- //还原图片
- resetImageSrc(index) {
- this.czIndex = -1
- },
- //显示图片
- changeImageSrc(index) {
- this.czIndex = index
- },
- //获取岗位数据
- getPostPushInfo(id) {
- let data = {
- userId: this.userId,
- postPushId: id
- }
- this.$Request.get("/app/postPush/selectPostPushDetails", {
- params: data
- }).then(res => {
- if (res.code == 0) {
- // 选择的岗位列表
- this.jobList = [{
- ...res.data
- }];
- this.title = res.data.company.companyName
- this.postPushInfo = res.data
- // this.postPushInfo.positionWelfare = this.postPushInfo.positionWelfare && this.postPushInfo.positionWelfare.split(',') || []
- if(this.userType != 1){
- //获取简历信息
- this.getResumesInfo(this.resumesId)
- }
- }
- })
- },
- //获取聊天记录
- getCHarList() {
- let data = {
- page: this.page,
- limit: this.limit,
- chatConversationId: this.chatConversationId,
- userId: this.userId
- }
- this.$Request.get('/app/chat/selectChatContent', {
- params: data
- }).then(res => {
- if (res.code == 0) {
- res.data.list.map(item => {
- if (item.messageType == 18) {
- item.content = JSON.parse(item.content)
- }
- })
- this.megList = res.data.list
- this.megList.reverse();
- //等数据更新后滚动到最底下
- this.$nextTick(() => {
- this.$refs.messageBox.scrollTop = this.$refs.messageBox.scrollHeight
- })
- }
- })
- },
- //初始化并链接webscoket
- initScoket() {
- this.webSco = this.$socket.getSocket();
- // 如果 WebSocket 已经连接,直接把状态标记为 true
- if (this.webSco.readyState === WebSocket.OPEN) {
- this.webSocketState = true
- // console.log('✅ WebSocket 已经连接,状态直接标记为 true')
- } else {
- // 还未连接,绑定 onopen
- this.webSco.onopen = this.websocketonopen.bind(this)
- }
- // 绑定其他回调
- this.webSco.onmessage = this.websocketonmessage.bind(this)
- this.webSco.onerror = this.websocketonerror.bind(this)
- this.webSco.onclose = this.websocketclose.bind(this)
- },
- //监听接收到消息的回调
- websocketonmessage(event) {
- this.webSocketState = true
- // console.log(event, '收到消息')
- //收到消息后再获取聊天记录
- this.getCHarList()
- },
- //监听错误的回调
- websocketonerror(event) {
- //连接错误后把连接状态设为false
- this.webSocketState = false
- // console.log(event, '连接错误')
- },
- //监听链接打开的回调
- websocketonopen(event) {
- this.webSocketState = true
- // console.log(event, '连接已打开')
- },
- //监听关闭的回调
- websocketclose(event) {
- // 关闭连接后把状态设为false
- this.webSocketState = false
- // console.log(event, '连接已关闭')
- },
- //关闭弹窗的回调
- closeShow() {
- // if (this.webSco) {
- // this.webSco.close()
- // }
- //给父组件传递值关闭该组件
- this.show = false
- this.$emit('closeMeg', this.show)
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- :deep(.el-dialog) {
- border-radius: 14px !important;
- }
- :deep(.el-dialog__body) {
- padding: 0 !important;
- padding-top: 10px !important;
- }
- :deep(.el-dialog__header) {
- background: linear-gradient(45deg, #f2fffa, #FFFFFF);
- border-radius: 14px 14px 0 0;
- }
- .messageCom {
- .el-textarea {
- --el-input-focus-border: none;
- --el-input-focus-border-color: none;
- }
- .el-textarea__inner {
- box-shadow: none;
- }
- .el-textarea__inner:hover {
- box-shadow: none;
- .is-focus {
- box-shadow: none;
- }
- }
- }
- .my-header-name {
- font-weight: bold;
- font-size: 14px;
- }
- .my-header-price {
- margin: 0 10px;
- color: red;
- font-size: 14px;
- font-weight: bold;
- }
- .my-header-yq {
- color: #999999;
- font-size: 14px;
- // font-weight: bold;
- }
- .message {
- width: 100%;
- height: 600px;
- .message-box {
- width: calc(100% - 40px);
- height: 70%;
- overflow: hidden;
- overflow-y: scroll;
- padding: 0 20px;
- }
- .message-box::-webkit-scrollbar {
- /* Chrome, Safari, Opera */
- width: 0px;
- }
- .message-box::-webkit-scrollbar-thumb {
- background-color: #ffffff;
- /* 滚动条颜色 */
- }
- .message-box::-webkit-scrollbar-track {
- background-color: #ffffff;
- /* 轨道颜色 */
- }
- .message-box-item {
- width: 100%;
- margin-bottom: 20px;
- }
- .message-boxs {
- width: 100%;
- .message-boxs-avatar {
- width: 40px;
- height: 40px;
- border-radius: 50%;
- }
- }
- .message-box-l {
- img {
- margin-right: 10px;
- }
- .message-box-l-con {
- max-width: 40%;
- padding: 10px;
- border-radius: 13px 13px 13px 0;
- background-color: #F8F8F8;
- color: #333333;
- }
- .message-box-l-phone {
- background: linear-gradient(to bottom, #D9FEED, #ffffff);
- // background-color: red;
- padding: 10px;
- border-radius: 13px 13px 13px 0;
- }
- .message-box-l-phone-btn {
- justify-content: flex-end;
- margin-top: 10px;
- }
- }
- .message-box-r {
- justify-content: flex-end;
- img {
- margin-left: 10px;
- }
- .message-box-r-con {
- max-width: 40%;
- padding: 10px;
- border-radius: 13px 13px 0 13px;
- background-color: #00DD9A;
- color: #FFFFFF;
- }
- .invitation {
- background: linear-gradient(rgb(217, 254, 237), rgb(255, 255, 255));
- border: 0.5px solid rgb(198, 254, 231);
- color: #000;
- }
- }
- .inv-style {
- background: linear-gradient(rgb(217, 254, 237), rgb(255, 255, 255));
- border: 0.5px solid rgb(198, 254, 231);
- color: #000;
- }
- .message-btom {
- width: 100%;
- height: 30%;
- border-top: 1px solid #E6E6E6;
- .messageCon {
- width: calc(100% - 40px);
- height: calc(100% - 40px);
- }
- .message-btom-content {
- width: 100%;
- height: 70%;
- }
- .message-btom-btn {
- width: 100%;
- height: 30%;
- }
- .message-btom-btn-l {
- position: relative;
- .message-btom-btn-l-emj {
- width: 490px;
- height: 300px;
- background-color: #ffffff;
- border-radius: 10px 10px 10px 0;
- position: absolute;
- bottom: 30px;
- border: 1px solid #f2f5fa;
- box-shadow: 0 0 14px rgba(0, 0, 0, .11);
- }
- .message-btom-btn-l-emj-box {
- width: calc(100% - 40px);
- height: calc(100% - 40px);
- overflow: hidden;
- overflow-y: scroll;
- img {
- width: 30px;
- height: 30px;
- padding: 5px;
- cursor: pointer;
- }
- }
- .message-btom-btn-l-emj-box::-webkit-scrollbar {
- /* Chrome, Safari, Opera */
- width: 0px;
- }
- .message-btom-btn-l-emj-box::-webkit-scrollbar-thumb {
- background-color: #ffffff;
- /* 滚动条颜色 */
- }
- .message-btom-btn-l-emj-box::-webkit-scrollbar-track {
- background-color: #ffffff;
- /* 轨道颜色 */
- }
- .message-btom-btn-l-emjs {
- position: absolute;
- bottom: 22px;
- width: 0;
- height: 0;
- border-left: 10px solid transparent;
- /* 根据需要设置边框宽度 */
- border-right: 10px solid transparent;
- /* 根据需要设置边框宽度 */
- border-top: 10px solid #ffffff;
- /* 根据需要设置边框颜色 */
- }
- .message-btom-btn-l-item {
- margin-right: 15px;
- cursor: pointer;
- color: #666666;
- font-size: 14px;
- img {
- width: 20px;
- height: 20px;
- margin-right: 2px;
- }
- }
- .message-btom-btn-l-item:hover {
- color: #00DD9A;
- }
- .message-btom-btn-l-item:nth-of-type(1):hover {
- img {
- src: '/images/postimg/emij_s.png'
- }
- }
- }
- }
- }
- .sentence-panel {
- margin: 0 !important;
- padding: 0 !important;
- }
- .message-text {
- height: 34px;
- line-height: 34px;
- border-radius: 4px;
- z-index: 1;
- overflow: hidden;
- cursor: pointer;
- white-space: nowrap;
- text-overflow: ellipsis;
- padding: 0 12px 0 24px;
- font-size: 13px;
- font-weight: 400;
- color: #333;
- border: none;
- position: relative;
- }
- .message-text:hover {
- background-color: #f8f8f8;
- }
- .message-text:before {
- content: "";
- position: absolute;
- top: 14px;
- left: 10px;
- width: 6px;
- height: 6px;
- border-radius: 50%;
- background: #d9d9d9;
- }
- </style>
|