提交 108e1d81 作者: 毛细亚

更新 tailwindcss

上级 7e6be5e2
......@@ -32,6 +32,8 @@
"vconsole": "^3.15.1",
"vue": "^2.6.14",
"vue-router": "^3.5.1",
"autoprefixer": "^10.4.0",
"tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.17",
"vuex": "^3.6.2"
},
"devDependencies": {
......
/*
* @Author: maoxiya 937667504@qq.com
* @Date: 2025-08-30 10:58:38
* @LastEditors: maoxiya 937667504@qq.com
* @LastEditTime: 2025-08-30 10:58:43
* @FilePath: /company_app/postcss.config.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
module.exports = {
plugins: [
require('tailwindcss'),
require('autoprefixer')
]
}
\ No newline at end of file
......@@ -13,6 +13,7 @@ Vue.use(ElementUI);
// import '@/styles/element-theme-colors.css';
import '@/styles/index.scss';
import moment from 'moment'
import '@/styles/tailwind.css'
import VConsole from 'vconsole';
import uploading from '@/utils/cos-upload'
import errorHandle from '@/utils/errorHandle'
......
@tailwind base;
@tailwind components;
@tailwind utilities;
......@@ -2,21 +2,22 @@
<template>
<div class="loginContent">
<div class="loginContentContainer">
<p class="loginContentTitle">选择客服:</p>
<div class="loginContentInput rowFlex alignCenter">
<el-select v-model="cser_user_id" filterable placeholder="请选择客服">
<el-option v-for="item in userList" :key="item.zq_user_id" clearable :label="item.name" :value="item.zq_user_id">
</el-option>
</el-select>
<el-button type="primary" style="margin-left: 10px;" size="small" @click="loginConfirm">点击登录</el-button>
</div>
<p class="loginContentTitle">选择客服:</p>
<div class="loginContentInput rowFlex alignCenter">
<el-select v-model="cser_user_id" filterable placeholder="请选择客服">
<el-option v-for="item in userList" :key="item.zq_user_id" clearable :label="item.name"
:value="item.zq_user_id">
</el-option>
</el-select>
<el-button type="primary" style="margin-left: 10px;" size="small" @click="loginConfirm">点击登录</el-button>
</div>
</div>
</div>
</template>
<script>
import * as ww from '@wecom/jssdk'
import { getOrganization, getAuthUser, getSignature,getUserList,cserSelected } from '@/api/user'
import { getOrganization, getAuthUser, getSignature, getUserList, cserSelected } from '@/api/user'
import Cookies from 'js-cookie'
import { getParams } from '@/utils/index'
import { mapMutations, mapState } from 'vuex'
......@@ -62,78 +63,78 @@ export default {
if (this.token && userid) { // 已经钉钉扫码过 重新获取授权 获取签名 注册企微js-sdk
this.getUserList(userid)
await this.getSignature();
} else if(!userid) {
await this.startWeComSilentAuth();
}else if(!this.token){
} else if (!userid) {
await this.startWeComSilentAuth();
} else if (!this.token) {
this.getUserList(userid)
}
},
async getUserList(userid) {
this.urlParams = getParams();
const corp_id = Cookies.get('corp_id') || this.urlParams.corp_id
const res = await getUserList({ userid: userid,corp_id:corp_id });
this.urlParams = getParams();
const corp_id = Cookies.get('corp_id') || this.urlParams.corp_id
const res = await getUserList({ userid: userid, corp_id: corp_id });
this.userList = res.data
},
async userStartLogin(){
if(!this.cser_user_id){
this.$message.error('请选择客服人员')
return
}
const cser_user = this.userList.find(item => item.zq_user_id === this.cser_user_id)
const corp_id = Cookies.get('corp_id')
const userid = Cookies.get('userid')
this.cacheCser(cser_user.zq_user_id, cser_user.name)
try {
const res = await cserSelected({ cser_id: cser_user.zq_user_id, corp_id: corp_id,userid:userid });
console.log(res, '选择客服人员登录')
if(res.status_code === 1 && res.data.tokens ){
this.$message({
type: 'warning',
message: `当前【${cser_user.name}】已上线,下班后请记得点击下线哦~`,
duration: 3 * 1000
})
setTimeout(() => {
this.handleDingCallback(res.data.tokens )
}, 2000)
}else{
this.$message.error(res.msg)
setTimeout(() => {
window.location.href = window.location.origin + '/company_app/index.html?corp_id=' + corp_id + '&msg=cser_error'
}, 5000)
}
} catch (error) {
console.log(error, '选择客服人员登录失败')
this.$message.error(error.msg)
setTimeout(() => {
window.location.href = window.location.origin + '/company_app/index.html?corp_id=' + corp_id + '&msg=cser_error'
}, 5000)
async userStartLogin() {
if (!this.cser_user_id) {
this.$message.error('请选择客服人员')
return
}
const cser_user = this.userList.find(item => item.zq_user_id === this.cser_user_id)
const corp_id = Cookies.get('corp_id')
const userid = Cookies.get('userid')
this.cacheCser(cser_user.zq_user_id, cser_user.name)
try {
const res = await cserSelected({ cser_id: cser_user.zq_user_id, corp_id: corp_id, userid: userid });
console.log(res, '选择客服人员登录')
if (res.status_code === 1 && res.data.tokens) {
this.$message({
type: 'warning',
message: `当前【${cser_user.name}】已上线,下班后请记得点击下线哦~`,
duration: 3 * 1000
})
setTimeout(() => {
this.handleDingCallback(res.data.tokens)
}, 2000)
} else {
this.$message.error(res.msg)
setTimeout(() => {
window.location.href = window.location.origin + '/company_app/index.html?corp_id=' + corp_id + '&msg=cser_error'
}, 5000)
}
} catch (error) {
console.log(error, '选择客服人员登录失败')
this.$message.error(error.msg)
setTimeout(() => {
window.location.href = window.location.origin + '/company_app/index.html?corp_id=' + corp_id + '&msg=cser_error'
}, 5000)
}
},
loginConfirm(){
const cser_user = this.userList.find(item => item.zq_user_id === this.cser_user_id)
this.$confirm(`确认登录上线吗,上线后所有会话都会归属到客服【${cser_user.name}】`, '提示', {
loginConfirm() {
const cser_user = this.userList.find(item => item.zq_user_id === this.cser_user_id)
this.$confirm(`确认登录上线吗,上线后所有会话都会归属到客服【${cser_user.name}】`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
}).then(() => {
this.userStartLogin()
}).catch(() => {
}).catch(() => {
this.$message.info('已取消登录')
})
})
},
// 设置缓存
cacheCorp_id(corp_id) {
Cookies.set('corp_id', corp_id, { expires: 7 })
Cookies.set('corp_id', corp_id, { expires: 30 })
this.set_corp_id(corp_id)
},
cacheuserid(userid) {
Cookies.set('userid', userid, { expires: 7 })
Cookies.set('userid', userid, { expires: 30 })
this.set_userid(userid)
},
cacheCser(cser_id, cser_name) {
Cookies.set('cser_id', cser_id, { expires: 7 })
Cookies.set('cser_name', cser_name, { expires: 7 })
Cookies.set('cser_id', cser_id, { expires: 30 })
Cookies.set('cser_name', cser_name, { expires: 30 })
this.set_cser_info({
cser_id: cser_id,
cser_name: cser_name
......@@ -142,14 +143,14 @@ export default {
this.set_cser_name(cser_name)
},
cacheSignData(signData) {
Cookies.set('signData', JSON.stringify(signData), { expires: 7 })
Cookies.set('signData', JSON.stringify(signData), { expires: 30 })
this.set_signData(signData)
},
// 进入的页面地址是 https://companywx.jianshuwenhua.com/company_app/index.html?corp_id=wweaefe716636df3d1
// 1. 企微静默授权
async startWeComSilentAuth() {
this.urlParams = getParams();
const corp_id = Cookies.get('corp_id') || this.urlParams.corp_id
const corp_id = Cookies.get('corp_id') || this.urlParams.corp_id
if (!corp_id) {
this.$message.error('当前客服号信息异常,请切换会话后重试')
return
......@@ -165,10 +166,10 @@ export default {
// 用code
const res = await getAuthUser({ code: this.urlParams.code, url: window.location.href, corp_id: corp_id });
if (res.status_code === 1) {
if(res.data.userid){
if (res.data.userid) {
this.cacheuserid(res.data.userid)
this.getUserList(res.data.userid)
}else{
} else {
this.$message.error('获取用户id失败')
return
}
......@@ -202,6 +203,7 @@ export default {
if (res.err_msg === "getCurExternalContact:ok") {
console.log(res, '重新进入获取企微外部联系人')
this.set_external_userid(res.userId)
this.$cookies.set('external_userid', res.userId, { expires: 30 })
// 确保 Vuex 状态更新后再跳转
this.$nextTick(() => {
this.$router.replace('/')
......@@ -275,7 +277,7 @@ export default {
window.location.href = window.location.origin + '/company_app/index.html?corp_id=' + corp_id + '&msg=notoken'
}
},
},
}
......@@ -294,12 +296,14 @@ export default {
align-items: center;
justify-content: center;
}
.loginContentTitle{
font-size: 14px;
line-height: 32px;
margin-right: 10px;
text-align: left;
.loginContentTitle {
font-size: 14px;
line-height: 32px;
margin-right: 10px;
text-align: left;
}
.qr-contain {
margin: 0 auto;
/* margin-top: 20px; */
......
/*
* @Author: maoxiya 937667504@qq.com
* @Date: 2025-08-30 10:54:21
* @LastEditors: maoxiya 937667504@qq.com
* @LastEditTime: 2025-08-30 10:54:29
* @FilePath: /company_app/tailwind.config.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
module.exports = {
mode: 'jit', // 关键配置
purge: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'],
darkMode: false,
theme: {
extend: {}
},
variants: {
extend: {}
},
plugins: [
function({ addUtilities }) {
const newUtilities = {
'.truncate-2': {
display: '-webkit-box',
'-webkit-box-orient': 'vertical',
'-webkit-line-clamp': '2',
'overflow': 'hidden',
'text-overflow': 'ellipsis',
'word-wrap': 'break-word',
'word-break': 'break-word',
},
'.truncate-3': {
display: '-webkit-box',
'-webkit-box-orient': 'vertical',
'-webkit-line-clamp': '3',
'overflow': 'hidden',
'text-overflow': 'ellipsis',
'word-wrap': 'break-word',
'word-break': 'break-word',
}
}
addUtilities(newUtilities, ['responsive', 'hover'])
}
],
corePlugins: {
container: false // 禁用默认的 container
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论