Commit 5acd95c0 by 胡悦

提交一客一群

1 parent 6d1f54ff
......@@ -8,10 +8,60 @@
*/
import { http } from '@/main'
const URL = '/rop-scrm-entmicro/router'
const PATH = 'org.ore.api.one.'
const PATH = 'org.ore.api.one.template.'
const templateList = params => {
params.method = `${PATH}template.list`
params.method = `${PATH}list`
return http({
url: URL,
method: 'GET',
data: params,
sign: true
})
}
const insert = params => {
params.method = `${PATH}insert`
return http({
url: URL,
method: 'POST',
data: params,
sign: true
})
}
const update = params => {
params.method = `${PATH}update`
return http({
url: URL,
method: 'POST',
data: params,
sign: true
})
}
const detail = params => {
params.method = `${PATH}detail`
return http({
url: URL,
method: 'GET',
data: params,
sign: true
})
}
const status = params => {
params.method = `${PATH}status`
return http({
url: URL,
method: 'GET',
data: params,
sign: true
})
}
const listDepartmentTree = params => {
params.method = 'cn.com.glsx.entmicro.department.listDepartmentTree'
return http({
url: URL,
method: 'GET',
......@@ -21,5 +71,10 @@ const templateList = params => {
}
export default {
templateList
templateList,
insert,
detail,
status,
update,
listDepartmentTree
}
......@@ -23,7 +23,7 @@ module.exports = {
*/
request: {
// baseURL: 'http://scrm.test.glsx.com.cn', // 测试
baseURL: 'http://192.168.1.65:8064',
baseURL: 'http://192.168.2.42:8064',
// 设置超时时间
timeout: 180000,
// 携带凭证
......
......@@ -25,11 +25,11 @@ VueRouter.prototype.push = function push(location) {
// }
function getRoutes(routesData) {
return routesData.reduce((routes, route) => {
routes.push({ ...route, component: () => import('@/views' + route.path + '.vue') })
return routes
routes.push({ ...route, component: () => import('@/views' + route.compath + '.vue') })
return routes
}, [])
}
export {
export {
VueRouter,
routes,
getRoutes
......
......@@ -10,15 +10,16 @@
import Vue from 'vue'
import { message } from '@/plugins/element.js'
import { fetchConfig } from '@/config'
import { GLButton,GLTable } from 'glsx-components' //权限按钮 (根据权限动态创建)
import { GLButton, GLTable } from 'glsx-components' //权限按钮 (根据权限动态创建)
import { Http, utils } from 'glsx-common'
import render from './render'
import { routes } from '@/router'
export async function start() {
if (window.__POWERED_BY_QIANKUN__) return
const { response, request, sign, secret } = await fetchConfig(true)
Vue.prototype.$http = new Http({ response, request, sign, secret, alert: message.error, headers: { token: 'mini-f27a0943-8fbf-4b21-a7a1-8e82a117ba39-rop' } })
Vue.use(GLButton,GLTable, { permissions: ['1-1-1-1', '2-1-1-1', '3-1-1-1'] })
Vue.prototype.$http = new Http({ response, request, sign, secret, alert: message.error, headers: { token: 'mini-3ab7a37c-3bfa-4a83-bbf8-9e59c6e10330-rop' } })
Vue.prototype.$http_common = new Http({ response, signWay: "md5", request: 'http://qcdidicb.glsx.net:7060', sign, secret, alert: message.error, headers: { token: 'mini-3ab7a37c-3bfa-4a83-bbf8-9e59c6e10330-rop' } })
Vue.use(GLButton, GLTable, { permissions: ['1-1-1-1', '2-1-1-1', '3-1-1-1'] })
render('/', routes)
}
......@@ -7,26 +7,44 @@
<div class="info-box">
<div class="info-content">
<el-form :model="basicForm" :rules="basicRules" ref="basicForm" label-width="120px">
<el-form-item label="组名" prop="name">
<el-input v-model="basicForm.name" placeholder="为群聊设置一个组名" maxlength="10"></el-input>
<el-form-item label="组名" prop="orgName">
<el-input v-model="basicForm.orgName" placeholder="为群聊设置一个组名" maxlength="10"></el-input>
</el-form-item>
<el-form-item label="群聊名称" prop="groupName">
<el-input v-model="basicForm.groupName" placeholder="设置群聊名称前缀,如新车售后一组" maxlength="10"></el-input>
<div class="form-tips">群聊名称后缀将以日期及序号进行累加,如“新车售后一组211011-1群”</div>
</el-form-item>
<el-form-item label="默认成员" prop="groupName">
<el-form-item prop="userList">
<label slot="label" class="required">默认成员</label>
<el-button size="small" @click="openMembers">
<i class="el-icon-plus"></i>
全部成员
选择成员
</el-button>
<!-- <el-input v-model="basicForm.groupName" placeholder="设置群聊名称前缀,如新车售后一组"></el-input> -->
<span class="label-text">
已选择
<span>{{ basicForm.userList ? basicForm.userList.length : 0 }}</span>
人
</span>
<div class="sale-select" v-show="basicForm.userList">
<div :key="key" class="el-input-tag input-tag-wrapper">
<el-tag v-for="(tag, idx) in basicForm.userList" :key="idx" closable :disable-transitions="false" @close="remove(tag)">
{{ tag.staffName }}
</el-tag>
<el-input size="small" style="outline: none; border: none"></el-input>
</div>
</div>
<div class="form-tips">必须配置2个及以上成员</div>
</el-form-item>
</el-form>
<!-- 编辑入群欢迎语 -->
<div class="title">编辑入群欢迎语</div>
<div>
<WelcomeWords :eventBus="eventBus"></WelcomeWords>
<el-form :model="basicForm" :rules="basicRules" ref="groupForm" label-width="120px">
<el-form-item label="入群欢迎语" prop="attachmentList">
<label slot="label" class="required">入群欢迎语</label>
<WelcomeWords ref="welcome" :eventBus="eventBus"></WelcomeWords>
</el-form-item>
</el-form>
</div>
</div>
<div class="preview">
......@@ -42,11 +60,11 @@
width: footerWidth + 'px'
}"
>
<el-button type="primary" @click="handleNext">确定</el-button>
<el-button type="primary" @click="handleNext">取消</el-button>
<el-button type="primary" @click="handleSubmit">确定</el-button>
<el-button type="primary" @click="handleCancel">取消</el-button>
</div>
<basic-dialog :title="'选择成员'" :width="'712px'" :isVisible="membersVisible" @confirmDialog="handleConfirm" @closeDialog="membersVisible = !membersVisible">
<SelectMembers ref="drawerForm" @closeDrawer="closeDrawer" @handSelectdEmp="handSelectdEmp"></SelectMembers>
<SelectMembers :selectData="selectData" ref="membersForm"></SelectMembers>
</basic-dialog>
</div>
</template>
......@@ -63,25 +81,184 @@ export default {
Preview
},
data() {
const validatorUser = (rule, value, callback) => {
console.log(value)
if (this.$route.params.id == -1) {
if (this.$refs.membersForm.innerTags) this.basicForm.userList = this.$refs.membersForm.innerTags
if (this.basicForm.userList) {
if (this.basicForm.userList.length < 2) {
callback(new Error('至少配置2个及以上成员'))
} else {
callback()
}
} else {
callback(new Error('请选择默认成员'))
}
} else {
if (value) {
if (value.length < 2) {
callback(new Error('至少配置2个及以上成员'))
} else {
callback()
}
} else {
callback(new Error('请选择默认成员'))
}
}
}
const validatorAttachment = (rule, value, callback) => {
const previewList = this.$refs.welcome.previewList
if (previewList.length != 0) {
this.basicForm.attachmentList = previewList
}
console.log(this.basicForm.attachmentList, '---')
if (this.basicForm.attachmentList) {
if (this.basicForm.attachmentList.length > 9) {
callback(new Error('附件不可超过9个'))
} else {
callback()
}
} else {
callback(new Error('请输入入群欢迎语'))
}
}
return {
eventBus: new Vue(),
basicForm: {},
basicRules: {
name: [{ required: true, message: '请输入组名', trigger: 'blur' }],
groupName: [{ required: true, message: '请输入群聊名称', trigger: 'blur' }]
orgName: [{ required: true, message: '请输入组名', trigger: 'blur' }],
groupName: [{ required: true, message: '请输入群聊名称', trigger: 'blur' }],
attachmentList: [
// { required: true, message: '请输入入群欢迎语' },
{ validator: validatorAttachment, trigger: 'change' }
],
userList: [
// { required: true, message: '请选择默认成员', trigger: 'change' },
{ validator: validatorUser, trigger: 'change' }
]
},
membersVisible: false
membersVisible: false,
key: new Date(),
previewFlag: false,
selectData: []
}
},
mounted() {
console.log(this.$route.params)
if (this.$route.params) {
const id = this.$route.params.id
if (id != -1) this.getDetail(id)
}
// // let clientHeight = document.documentElement.clientHeight
// this.footerLeft = document.querySelector('.base-container-right').offsetLeft
// this.footerWidth = document.documentElement.clientWidth - this.footerLeft
// // this.boxHeight = clientHeight - 200
},
// mounted() {
// // let clientHeight = document.documentElement.clientHeight
// this.footerLeft = document.querySelector('.base-container-right').offsetLeft
// this.footerWidth = document.documentElement.clientWidth - this.footerLeft
// // this.boxHeight = clientHeight - 200
// },
methods: {
openMembers() {
this.membersVisible = !this.membersVisible
if (this.membersVisible && this.$route.params.id != -1) {
this.$nextTick(() => {
console.log(this.$refs.membersForm)
this.$refs.membersForm.selectTable(this.basicForm.userList)
this.basicForm.userList.map(item => {
if (item.masterStatus) {
this.basicForm.group = item
this.$refs.membersForm.group = item
this.selectData = this.basicForm.userList
}
})
})
}
},
handleSubmit() {
this.$refs.basicForm.validate(valid => {
if (valid) {
console.log(this.basicForm, '111')
this.$refs.groupForm.validate(v => {
console.log(v)
if (v) {
console.log(this.basicForm, '122211')
const params = {
attachmentList: this.basicForm.attachmentList,
orgName: this.basicForm.orgName,
groupName: this.basicForm.groupName,
merchantId: 1
}
params.userList = this.basicForm.userList.map(item => {
if (this.basicForm.group.id == item.id) {
return {
staffId: item.id,
masterStatus: 1
}
} else {
return {
staffId: item.id
}
}
})
console.log(params)
let apiName = 'insert'
if (this.basicForm.id) {
apiName = 'update'
params.id = this.basicForm.id
}
this.$apis.groupGuest[apiName](params)
.then(res => {
console.log(res)
if (res) {
this.$message({
type: 'success',
message: '操作成功!'
})
this.handleCancel()
}
})
.catch(err => {
this.$message({
type: 'error',
message: err.message
})
})
}
})
}
})
},
getDetail(id) {
this.$apis.groupGuest.detail({ id }).then(res => {
console.log(res)
this.basicForm = {
orgName: res.orgName,
groupName: res.groupName,
id: res.id,
merchantId: 1,
userList: res.userList,
attachmentList: res.attachmentList
}
this.$refs.welcome.updateList(res.attachmentList)
this.selectData = res.userList
// this.$refs.membersForm.selectTable(res.userList)
// this.group = {}
})
},
handleCancel() {
this.$router.go(-1)
},
remove(val) {
this.$refs.membersForm.remove(val)
console.log(this.$refs.membersForm.innerTags)
this.$set(this.basicForm, 'userList', this.$refs.membersForm.innerTags)
this.key = new Date()
},
// 成员弹窗
handleConfirm() {
console.log(this.$refs.membersForm.innerTags)
this.basicForm.userList = this.$refs.membersForm.innerTags
this.basicForm.group = this.$refs.membersForm.group
// if (this.$refs.membersForm.group.id) {
this.openMembers()
// }
}
}
}
......@@ -139,4 +316,80 @@ export default {
background: #ffffff;
box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1);
}
.label-text {
margin-left: 10px;
font-size: 14px;
span {
color: #5850ff;
}
}
.form-error {
color: #f56c6c;
font-size: 12px;
margin-left: 186px;
margin-top: 10px;
}
.sale-select {
display: flex;
align-items: center;
}
.input-tag-wrapper {
max-width: 320px;
position: relative;
font-size: 14px;
background-color: #fff;
background-image: none;
border-radius: 4px;
border: 1px solid #dcdfe6;
box-sizing: border-box;
color: #606266;
display: inline-block;
outline: none;
padding: 0 10px 0 5px;
flex-wrap: wrap;
line-height: 32px;
transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
width: 100%;
display: flex;
align-items: center;
/deep/ input {
/* input { */
/* background-color: red!important; 调试用的样式 */
outline: none !important;
border: none !important;
}
/deep/ .el-input {
min-width: 150px;
width: auto;
flex: 1;
}
}
.el-tag {
margin-right: 4px;
height: 26px;
line-height: 24px;
}
.tag-input {
background: transparent;
border: none !important;
font-size: 14px;
height: 32px;
outline: none;
padding-left: 0;
width: 100px;
}
/deep/ {
.el-form-item .el-form-item {
margin-bottom: 22px;
}
.required {
display: inline-block;
line-height: 40px;
}
.required::before {
content: '*';
color: #f56c6c;
margin-right: 4 px;
}
}
</style>
......@@ -3,26 +3,30 @@
<div class="preview-content">
<div class="preview-time">{{ currentTime }}</div>
<div class="preview-info" v-for="item in previewList" :key="item.id">
<img class="avatar" src="../../../assets/logo.png" alt="" />
<template v-if="item.type == 'text'">
<div class="preview-text text">{{ item.content }}</div>
<img class="avatar" src="@/assets/logo.png" alt="" />
<template v-if="item.attType == 1">
<div class="preview-text text">{{ item.attContent }}</div>
</template>
<template v-else-if="item.type == 'link'">
<template v-else-if="item.attType == 4">
<div class="preview-text preview-link">
{{ item.url }}
<img src="../../../assets/guestCustom/preview-link.png" alt="" />
{{ item.attContent.url }}
<img src="@/assets/guestCustom/preview-link.png" alt="" />
</div>
</template>
<template v-else-if="item.type == 'img'">
<el-image style="width: 100px" :src="item.url" fit="contain"></el-image>
<template v-else-if="item.attType == 2">
<el-image style="width: 100px" :src="item.attContent" fit="contain"></el-image>
</template>
<template v-else-if="item.type == 'applet'">
<template v-else-if="item.attType == 3">
<!-- <el-image style="width: 100px" :src="item.attContent" fit="contain"></el-image> -->
<video style="width: 100px" :src="item.attContent"></video>
</template>
<template v-else-if="item.attType == 5">
<div class="preview-text text preview-applet">
<div class="preview-applet-title">
<img :src="item.appleIcon" alt="" />
<span>{{ item.title }}</span>
<img :src="item.attContent.picUrl" alt="" />
<span>{{ item.attContent.title }}</span>
</div>
{{ item.content }}
{{ item.attContent.page }}
</div>
</template>
</div>
......@@ -88,10 +92,11 @@ export default {
}
.preview-text {
position: relative;
max-width: 190px;
max-width: 169px;
color: #333;
background-color: #fff;
border-radius: 4px;
word-wrap: break-word;
}
.text {
font-size: 16px;
......
......@@ -18,13 +18,19 @@
height: treeHeight + 20 + 'px'
}"
>
<GLTable ref="saleTable" :tableData="tableEmpData" :tableParams="tableParams" :hasNum="false" :hasPage="false" @selectionTable="selectionTable"></GLTable>
<GLTable ref="saleTable" :tableData="tableEmpData" :tableParams="tableParams" :hasNum="false" :hasPage="false" @selectionTable="selectionTable">
<div class="table-btns" slot="optionBtns" slot-scope="scope">
<el-button type="text" v-show="!group.staffName" @click="selectGroup(scope.scope)">设为群主</el-button>
<el-button type="text" v-show="group.staffName && scope.scope.staffName == group.staffName" @click="cancelGroup">取消群主</el-button>
</div>
</GLTable>
</el-col>
</div>
</template>
<script>
export default {
name: 'selectEmp',
props: ['selectData'],
data() {
return {
treeHeight: 0,
......@@ -52,19 +58,41 @@ export default {
{
label: '职务',
prop: 'staffTitle'
},
{
label: '',
prop: 'optionBtns',
addHtml: 'optionBtns',
fixed: 'right'
}
]
},
tableEmpData: []
tableEmpData: [],
group: {},
allGroup: [],
employeeList: []
}
},
methods: {
selectionTable(val) {
console.log(val)
this.$emit('selectTable', val)
this.allGroup = val
const hasGroup = val.find(item => item.id == this.group.id)
if (!hasGroup) {
this.cancelGroup()
}
},
listDepartmentTree() {
this.$apis.emp.listDepartmentTree({ id: 1 }).then(res => {
this.$apis.groupGuest.listDepartmentTree({ merchantId: 10001001, addChildrensFlag: true }).then(res => {
this.listTree = res
this.listTree[0].entmicroStaffResponses = this.getEmployee(this.listTree)
console.log(this.listTree)
this.selectData.forEach(i => {
const row = this.getEmployee(this.listTree).find(j => j.id == i.staffId)
console.log(row)
this.clearSelect(row)
})
this.$nextTick(() => {
document.getElementsByClassName('el-tree-node__expand-icon')[0].click()
document.getElementsByClassName('el-tree-node__content')[0].click()
......@@ -72,30 +100,59 @@ export default {
})
},
clearSelect(row) {
console.log(row, '2222')
this.$refs.saleTable.$refs.salelistMutiTable.toggleRowSelection(row)
},
clearSelection() {
console.log(2222)
this.$refs.saleTable.$refs.salelistMutiTable.clearSelection()
},
handleNodeClick(data) {
this.departmentId = data.id
this.listEntmicroStaff()
this.tableEmpData = data.entmicroStaffResponses
// this.listEntmicroStaff()
},
listEntmicroStaff(staffName) {
let params = {
departmentId: this.departmentId,
staffName: staffName ? staffName : this.staffName,
merchantid: this.$globalState.session.merchantId
}
this.$apis.emp.listEntmicroStaff(params).then(res => {
this.tableEmpData = res
selectGroup(data) {
console.log(data)
this.group = data
const obj = this.allGroup.find(item => item.id == data.id)
if (!obj) this.$refs.saleTable.$refs.salelistMutiTable.toggleRowSelection(data)
this.$emit('group', this.group)
},
cancelGroup() {
this.group = {}
this.$emit('group', this.group)
},
getEmployee(d, arr = []) {
d.forEach(i => {
if (i.entmicroStaffResponses) {
i.entmicroStaffResponses.forEach(j => {
arr.push(j)
})
}
if (i.children) {
this.getEmployee(i.children, arr)
}
})
return arr
}
// listEntmicroStaff(staffName) {
// let params = {
// departmentId: this.departmentId,
// staffName: staffName ? staffName : this.staffName,
// merchantid: this.$globalState.session.merchantId
// }
// this.$apis.emp.listEntmicroStaff(params).then(res => {
// this.tableEmpData = res
// })
// }
},
mounted() {
let clientHeight = document.documentElement.clientHeight
this.treeHeight = clientHeight - 450
this.listDepartmentTree()
console.log(this.selectData, '.....')
}
}
</script>
......
......@@ -13,28 +13,14 @@
</div>
<div>
<div class="select-sale-panel">
<select-emp @selectTable="selectTable" ref="selectEmpTabel"></select-emp>
<select-emp :selectData="selectData" @group="handlGroup" @selectTable="selectTable" ref="selectEmpTabel"></select-emp>
<div class="popper__arrow"></div>
</div>
</div>
</el-form-item>
<el-form-item label="请选择跟进员工类型">
<div class="emp-type">
<div @click="handleType(index)" :class="{ checked: typeIndex == index }" class="emp-type-btn" v-for="(item, index) in empType" :key="index">
{{ item.followName }}
<i class="el-icon-error" @click="delEmpType(item, index)" v-if="!item.commonFlag"></i>
</div>
</div>
<div class="sale-select">
<el-input size="small" v-model="empTypeValue" placeholder="添加类型名称" maxlength="8" show-word-limit></el-input>
<div><el-button size="small" class="sale-select-btn" type="primary" @click="addEmpType">新增</el-button></div>
</div>
<div class="sale-type-desc">跟进员工类型最多新增30个,已新增{{ empType.length - 3 }}个</div>
<el-form-item label="群主">
<el-tag v-show="group.staffName" closable @close="cancelGroup">{{ group.staffName }}</el-tag>
</el-form-item>
<!-- <el-form-item style="text-align: center">
<el-button @click="onCancel" size="small">取消</el-button>
<el-button type="primary" @click="onSubmit" size="small">确定</el-button>
</el-form-item> -->
</el-form>
</div>
</template>
......@@ -42,6 +28,7 @@
import selectEmp from './selectEmp.vue'
export default {
name: 'SelectMembers',
props: ['selectData'],
components: {
selectEmp
},
......@@ -50,10 +37,11 @@ export default {
addForm: {},
typeIndex: 0,
empType: [],
empTypeValue: '',
// empTypeValue: '',
newTag: '',
innerTags: [],
dialog_temp: {}
dialog_temp: {},
group: {}
}
},
methods: {
......@@ -67,16 +55,9 @@ export default {
}
},
selectTable(val) {
console.log(val)
this.innerTags = val
},
listEntFollowerType() {
this.$apis.emp.listEntFollowerType({ merchantId: this.$globalState.session.merchantId }).then(res => {
this.empType = res
})
},
handleType(index) {
this.typeIndex = index
},
foucusTagInput() {
if (this.readOnly || !this.$el.querySelector('.tag-input')) {
return
......@@ -85,58 +66,33 @@ export default {
}
},
remove(row) {
console.log(row, '111')
this.$refs.selectEmpTabel.clearSelect(row)
},
//查询
searchEmp() {
this.$refs.selectEmpTabel.listEntmicroStaff(this.newTag)
this.$refs.selectEmpTabel.listDepartmentTree(this.newTag)
},
addEmpType() {
if (!this.empTypeValue) {
this.$message.error('请输入类型名称')
return
}
if (this.empType.length == 33) {
this.$message.error('跟进员工类型最多新增30个')
handlGroup(val) {
console.log(val)
this.group = val
},
cancelGroup() {
this.$refs.selectEmpTabel.cancelGroup()
},
onSubmit() {
if (this.innerTags.length == 0) {
this.$message({
message: '请选择成员',
type: 'error'
})
return
}
let params = {
followName: this.empTypeValue,
merchantid: this.$globalState.session.merchantId
}
this.$apis.emp.saveFollowerType(params).then(res => {
this.listEntFollowerType()
})
this.empTypeValue = ''
},
delEmpType(item, index) {
this.$apis.emp.deleteFollowerType({ id: item.id }).then(res => {
if (res) {
this.listEntFollowerType()
this.typeIndex = 0
}
let userIds = []
this.innerTags.forEach(item => {
userIds.push(item.userId)
})
}
// onSubmit() {
// if (this.innerTags.length == 0) {
// this.$message({
// message: '请选择员工',
// type: 'error'
// })
// return
// }
// let userIds = []
// this.innerTags.forEach(item => {
// userIds.push(item.userId)
// })
// this.$emit('handSelectdEmp', this.empType[this.typeIndex].id, userIds)
// },
// onCancel() {
// this.$emit('closeDrawer')
// }
},
mounted() {
this.listEntFollowerType()
}
}
</script>
......
<template>
<div class="welcome-box">
<div class="required">入群欢迎语</div>
<!-- <div class="required">入群欢迎语</div> -->
<div class="content">
<el-input type="textarea" :rows="9" maxlength="600" show-word-limit v-model="guestForm.name" placeholder="请输入内容"></el-input>
<div>
<div class="welcome-file" v-for="itm in previewList" :key="itm.id">
<template v-if="itm.type == 'img'">
<img src="../../../assets/guestCustom/icon-img.png" alt="" />
<span>{{ itm.name }}</span>
</template>
<template v-else-if="itm.type == 'link'">
<img src="../../../assets/guestCustom/icon-link.png" alt="" />
<span>{{ itm.url }}</span>
</template>
<template v-else-if="itm.type == 'applet'">
<img src="../../../assets/guestCustom/icon-applet.png" alt="" />
<span>{{ itm.title }}</span>
</template>
<i class="el-icon-circle-close" @click="close(index)"></i>
<div class="content-bg">
<el-input type="textarea" :rows="9" maxlength="600" show-word-limit v-model="text" @input="textInput" placeholder="请输入内容"></el-input>
<div v-for="itm in previewList" :key="itm.id">
<div class="welcome-file" v-if="itm.attType != 1">
<template v-if="itm.attType == 2">
<img src="@/assets/guestCustom/icon-img.png" alt="" />
<span>{{ itm.attContent }}</span>
</template>
<template v-else-if="itm.attType == 3">
<img src="@/assets/guestCustom/icon-img.png" alt="" />
<span>{{ itm.attContent }}</span>
</template>
<template v-else-if="itm.attType == 4">
<img src="@/assets/guestCustom/icon-link.png" alt="" />
<span>{{ itm.attContent.url }}</span>
</template>
<template v-else-if="itm.attType == 5">
<img src="@/assets/guestCustom/icon-applet.png" alt="" />
<span>{{ itm.attContent.title }}</span>
</template>
<i class="el-icon-circle-close" @click="close(index)"></i>
</div>
</div>
</div>
<div class="btn-group">
<div class="add-btn" v-for="item in btnList" :key="item.id">
<i class="el-icon-circle-plus-outline"></i>
<span>{{ item.name }}</span>
<input v-if="item.type == 'img'" type="file" style="opacity: 0" :id="item.name + 'file'" ref="file" class="welcome-input" :accept="item.accept || 'image/png, image/jpeg, image/jpg'" @change="e => handleImgChange(e, item)" />
<el-link v-if="item.type == 'popup'" style="opacity: 0" @click="switchDailog(item.funName)">{{ item.name }}</el-link>
<div class="btn-group">
<div class="add-btn" v-for="item in btnList" :key="item.id">
<i class="el-icon-circle-plus-outline"></i>
<span>{{ item.name }}</span>
<!-- <div id="video"></div> -->
<input v-if="item.type == 'img'" type="file" style="opacity: 0" :id="item.name + 'file'" ref="file" class="welcome-input" :accept="item.accept || 'image/png, image/jpeg, image/jpg'" @change="e => handleImgChange(e, item)" />
<input v-if="item.type == 'video'" type="file" style="opacity: 0" :id="item.name + 'file'" ref="file" class="welcome-input" :accept="item.accept || 'video/*'" @change="e => handleVideoChange(e, item)" />
<el-link v-if="item.type == 'popup'" style="opacity: 0" @click="switchDailog(item.funName)">{{ item.name }}</el-link>
</div>
</div>
</div>
<div class="tips-text">
<img src="../../../assets/guestCustom/tips.png" class="tips-icon" alt="" />
<span>欢迎语将在客户进群时发送一次,不设置时不发送入群欢迎语。</span>
</div>
</div>
<basic-dialog :title="dialogTitle" :width="'712px'" :isVisible="dialogVisible" @confirmDialog="handleConfirm" @closeDialog="dialogVisible = !dialogVisible">
<basic-dialog :title="dialogTitle" :width="'712px'" :isVisible="dialogVisible" @confirmDialog="handleConfirm" @closeDialog="closeDialog">
<slot>
<el-form v-if="dialogTitle == '添加网页消息'" :model="linkForm" :rules="linkRules" ref="linkForm" label-width="120px">
<el-form-item label="网页标题" prop="name">
<el-input v-model="linkForm.name" placeholder="请输入网页标题"></el-input>
<el-form-item label="网页标题" prop="title">
<el-input v-model="linkForm.title" placeholder="请输入网页标题"></el-input>
</el-form-item>
<el-form-item label="添加网页链接" prop="link">
<el-input v-model="linkForm.link" placeholder="以http或https开头"></el-input>
<el-form-item label="添加网页链接" prop="url">
<el-input v-model="linkForm.url" placeholder="以http或https开头"></el-input>
</el-form-item>
</el-form>
<el-form v-else-if="dialogTitle == '添加小程序'" :model="appletForm" :rules="appletRules" ref="appletForm" label-width="120px">
<el-form-item label="小程序标题" prop="name">
<el-input v-model="appletForm.name" placeholder="请输入小程序标题"></el-input>
<el-form-item label="小程序标题" prop="title">
<el-input v-model="appletForm.title" placeholder="请输入小程序标题"></el-input>
</el-form-item>
<el-form-item label="小程序appID" prop="link">
<el-input v-model="appletForm.link" placeholder="请输入小程序appID"></el-input>
<el-form-item label="小程序appID" prop="appid">
<el-input v-model="appletForm.appid" placeholder="请输入小程序appID"></el-input>
</el-form-item>
<el-form-item label="小程序路径" prop="link">
<el-input v-model="appletForm.url" placeholder="请输入小程序路径"></el-input>
<el-form-item label="小程序路径" prop="page">
<el-input v-model="appletForm.page" placeholder="请输入小程序路径"></el-input>
<div class="form-tips">注意:小程序路径以html作为后缀</div>
</el-form-item>
<el-form-item label="小程序路径" prop="link">
<div class="upload-bg">
<i class="el-icon-circle-plus"></i>
<div>上传封面</div>
<el-form-item label="小程序封面" prop="picUrl">
<div class="upload">
<div v-show="!appletForm.picUrl" class="upload-bg">
<i class="el-icon-circle-plus"></i>
<div class="upload-text">上传封面</div>
</div>
<input type="file" style="opacity: 0" ref="file" class="form-upload img-w-h" accept="image/png, image/jpeg, image/gif, image/jpg" @change="handleImg" />
<el-image v-show="appletForm.picUrl" style="width: 140px" :src="appletForm.picUrl" fit="contain"></el-image>
</div>
<div class="form-tips">建议图片大小在2M以内,建议尺寸:352*282px</div>
</el-form-item>
</el-form>
......@@ -68,8 +81,15 @@
</basic-dialog>
</div>
</template>
<script>
const ATT_TYPE = {
TEXT: 1,
IMAGE: 2,
VEDIO: 3,
URL: 4,
MINIPROGRAM: 5,
FILE: 6
}
export default {
name: 'WelcomeWords',
props: { eventBus: Object },
......@@ -87,8 +107,7 @@ export default {
id: 2,
name: '视频',
funcName: '',
type: 'img',
accept: 'video/*',
type: 'video',
limitSize: 10
},
{
......@@ -105,73 +124,29 @@ export default {
}
],
guestForm: {},
text: '',
dialogTitle: '',
dialogVisible: false,
linkForm: {},
linkRules: {
name: [{ required: true, message: '请输入网页标题', trigger: 'blur' }],
link: [{ required: true, message: '请输入网页链接', trigger: 'blur' }]
title: [{ required: true, message: '请输入网页标题', trigger: 'blur' }],
url: [{ required: true, message: '请输入网页链接', trigger: 'blur' }]
},
appletForm: {},
appletRules: {
name: [{ required: true, message: '请输入网页标题', trigger: 'blur' }],
link: [{ required: true, message: '请输入网页链接', trigger: 'blur' }],
url: [{ required: true, message: '请输入小程序路径', trigger: 'blur' }]
title: [{ required: true, message: '请输入小程序标题', trigger: 'blur' }],
appid: [{ required: true, message: '请输入小程序appID', trigger: 'blur' }],
page: [{ required: true, message: '请输入小程序路径', trigger: 'blur' }],
picUrl: [{ required: true, message: '请上传封面路径', trigger: 'change' }]
},
previewList: [
{
id: 1,
type: 'text',
content: 'fasf'
},
{
id: 2,
type: 'link',
url: 'https://baidu.comdfasdfasdfa'
},
{
id: 3,
type: 'img',
name: 'hdjkashfajk',
url: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fhbimg.b0.upaiyun.com%2F945cad7c7105d352aa3c513c94846bb0c2f1a61342067-OWFZcE_fw658&refer=http%3A%2F%2Fhbimg.b0.upaiyun.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1639018450&t=a60f5defc48c980674edcf9a8d5981df'
},
{
id: 4,
type: 'applet',
appleIcon: '../../../assets/logo.png',
title: '我的智慧门店',
content: '我的智慧门店'
},
{
id: 5,
type: 'text',
content: 'fasf'
},
{
id: 6,
type: 'text',
content: 'fasf'
},
{
id: 7,
type: 'text',
content: 'fasf'
},
{
id: 8,
type: 'text',
content: 'fasf'
},
{
id: 9,
type: 'text',
content: 'fasf'
}
]
previewList: []
}
},
mounted() {
console.log(this.previewList)
this.eventBus.$emit('update', this.previewList)
// this.updateList(this.previewList)
// obj.init('video')
},
methods: {
handleImgChange(e, targetItem) {
......@@ -179,7 +154,7 @@ export default {
var reader = new FileReader()
var file = e.srcElement.files[0]
console.log(file)
// // 默认1MB
// 默认1MB
const limitSize = targetItem.limitSize || 1
const isLt = file.size / 1024 / 1024 < limitSize
if (!isLt) {
......@@ -197,13 +172,68 @@ export default {
this.$apis.common.pictureUpload({ file: base64 }).then(res => {
if (res) {
console.log(res)
this.previewList.push({
attType: ATT_TYPE.IMAGE,
attContent: res
})
}
})
}
}
},
handleVideoChange(e, targetItem) {
var file = e.srcElement.files[0]
var reader = new FileReader()
// 默认1MB
const limitSize = targetItem.limitSize || 1
const isLt = file.size / 1024 / 1024 < limitSize
if (!isLt) {
this.$message.error('上传视频大小不能超过' + limitSize + 'MB!')
return true
}
reader.readAsDataURL(file)
reader.onload = e => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
this.$apis.common.pictureUpload({ file: base64 }).then(res => {
if (res) {
console.log(res)
this.previewList.push({
attType: ATT_TYPE.VEDIO,
attContent: res
})
}
})
}
},
handleImg(e) {
var reader = new FileReader()
var file = e.srcElement.files[0]
console.log(file)
// 默认1MB
const limitSize = 10
const isLt = file.size / 1024 / 1024 < limitSize
if (!isLt) {
this.$message.error('上传图片大小不能超过' + limitSize + 'MB!')
return true
}
reader.readAsDataURL(file)
reader.onload = e => {
var image = new Image()
image.src = e.target.result
image.onload = () => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
this.$set(this.appletForm, 'picUrl', 'dfasdfasfa')
this.$apis.common.pictureUpload({ file: base64 }).then(res => {
if (res) {
console.log(res)
this.$set(this.appletForm, 'picUrl', res)
}
})
}
}
this.guestForm.imgUrl = 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fhbimg.b0.upaiyun.com%2F945cad7c7105d352aa3c513c94846bb0c2f1a61342067-OWFZcE_fw658&refer=http%3A%2F%2Fhbimg.b0.upaiyun.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1639018450&t=a60f5defc48c980674edcf9a8d5981df'
},
handleImg(e) {},
switchDailog(funName) {
console.log(funName)
if (funName == 'link') {
......@@ -219,7 +249,16 @@ export default {
case '添加网页消息':
this.$refs.linkForm.validate(valid => {
if (valid) {
alert('submit!')
console.log(this.linkForm)
this.previewList.push({
attType: ATT_TYPE.URL,
attContent: this.linkForm
})
this.closeDialog('linkForm')
// this.dialogVisible = !this.dialogVisible
// this.linkForm = {}
// this.$refs.linkForm.clearValidate()
} else {
console.log('error submit!!')
return false
......@@ -227,9 +266,18 @@ export default {
})
break
case '添加小程序':
console.log(this.appletForm)
this.$refs.appletForm.validate(valid => {
if (valid) {
alert('submit!')
console.log(this.appletForm)
this.previewList.push({
attType: ATT_TYPE.MINIPROGRAM,
attContent: this.appletForm
})
this.closeDialog('appletForm')
// this.dialogVisible = !this.dialogVisible
// this.appletForm = {}
// this.$refs.appletForm.clearValidate()
} else {
console.log('error submit!!')
return false
......@@ -243,6 +291,40 @@ export default {
close(index) {
this.previewList.splice(index, 1)
this.eventBus.$emit('update', this.previewList)
},
textInput(val) {
console.log(val)
const hasText = this.previewList.some(item => item.attType == 1)
console.log(hasText)
if (hasText) {
this.$set(this.previewList, 0, {
attContent: val,
attType: ATT_TYPE.TEXT
})
} else {
this.previewList.unshift({
attContent: val,
attType: ATT_TYPE.TEXT
})
}
console.log(this.previewList)
},
closeDialog() {
if (this.dialogVisible) {
if (this.$refs.linkForm) this.$refs.linkForm.clearValidate()
this.linkForm = {}
if (this.$refs.appletForm) this.$refs.appletForm.clearValidate()
this.appletForm = {}
}
this.dialogVisible = !this.dialogVisible
},
updateList(val) {
this.previewList = val
this.eventBus.$emit('update', this.previewList)
const obj = val.find(item => item.attType == 1)
if (obj) {
this.text = obj.attContent
}
}
}
}
......@@ -250,15 +332,17 @@ export default {
<style lang="scss" scoped>
.welcome-box {
padding-top: 20px;
margin-left: 87px;
// padding-top: 20px;
// margin-left: 87px;
}
.content {
display: inline-block;
vertical-align: text-top;
width: calc(100% - 103px);
margin-left: 12px;
background-color: #f7f7f7;
// margin-left: 12px;
.content-bg {
background-color: #f7f7f7;
}
.welcome-file {
display: flex;
align-items: center;
......@@ -332,9 +416,12 @@ export default {
}
.form-upload {
position: absolute;
width: 100%;
top: 0;
width: 140px;
// width: 100%;
height: 100%;
cursor: pointer;
z-index: 1;
}
/deep/ {
.el-textarea__inner {
......@@ -348,6 +435,9 @@ export default {
background-color: #f7f7f7;
}
}
.upload {
position: relative;
}
.upload-bg {
position: relative;
width: 140px;
......@@ -362,7 +452,7 @@ export default {
transform: translateX(-50%);
font-size: 30px;
}
div {
.upload-text {
position: absolute;
bottom: 40px;
left: 50%;
......@@ -372,7 +462,7 @@ export default {
}
.tips-text {
display: flex;
align-self: center;
align-items: center;
justify-self: center;
color: #000;
font-size: 14px;
......
......@@ -8,18 +8,18 @@
</div>
<div class="container">
<search-form class="searchTop border-shadow" :formModel="searchForm" :formList="searchFormData" @searchTable="searchTable" @syncClick="syncClick">
<search-form class="searchTop border-shadow" :formModel="searchForm" :formList="searchFormData">
<span class="inline-b" slot="form-slot">
<el-button type="primary" @click="searchTable">查询</el-button>
</span>
</search-form>
<!-- 表格区域 开始 -->
<GLTable ref="gueastGroup" :tableData="tableData" :searchForm="searchFormData" :tableParams="tableParams" :pageConf="pageConf">
<GLTable ref="gueastGroup" :getListApi="getListApi" :searchForm="searchForm" :tableParams="tableParams" :pageConf="pageConf">
<div slot="entmicro-name" class="entmicro" slot-scope="scope">
<span v-for="(i, index) in scope.scope.userList" :key="index">{{ i.name }}({{ i.tips }});</span>
<span v-for="(i, index) in scope.scope.userList" :key="index">{{ i.staffName }}({{ i.departmentName }});</span>
</div>
<span slot="status" slot-scope="scope">
<span class="statusText" :class="{ 'red-text': scope.scope.status === '2', 'green-text': scope.scope.status === '1' }">{{ statusText(scope.scope.status) }}</span>
<span class="statusText" :class="{ 'red-text': scope.scope.status === '2', 'green-text': scope.scope.status === '1' }">{{ scope.scope.status == '1' ? '启用' : '停用' }}</span>
</span>
<div class="table-btns" slot="optionBtns" slot-scope="scope">
<el-button type="text" @click="btnClick('edit', scope.scope)">修改</el-button>
......@@ -40,7 +40,7 @@ export default {
{
type: 'input',
inputType: 'text',
prop: 'orgName',
prop: 'groupName',
label: '组名',
placeholder: '请输入组名搜索'
}
......@@ -48,7 +48,7 @@ export default {
// 表格
getListApi: this.$apis.groupGuest.templateList,
tableParams: {
listName: 'data',
listName: '',
tableOption: false,
otherOptions: {
label: '启用开关'
......@@ -180,17 +180,13 @@ export default {
//搜索表格
searchTable() {
console.log(this.searchForm)
// this.$refs.gueastGroup.refreshTable()
},
statusText(val) {
console.log(val)
return val === '1' ? '启用' : '停用'
this.$refs.gueastGroup.refreshTable()
},
btnClick(name, rowData) {
console.log(name)
switch (name) {
case 'create':
this.$router.push('/guestGroup/add/' + 1)
this.$router.push('/guestGroup/add/' + -1)
break
case 'edit':
this.$router.push('/guestGroup/add/' + rowData.id)
......@@ -202,10 +198,29 @@ export default {
type: 'warning'
})
.then(() => {
this.$message({
type: 'success',
message: '操作成功!'
})
const params = {
id: rowData.id,
status: rowData.status == 1 ? 2 : 1,
merchantId: 1
}
this.$apis.groupGuest
.status(params)
.then(res => {
console.log(res)
if (res) {
this.searchTable()
this.$message({
type: 'success',
message: '操作成功!'
})
}
})
.catch(err => {
this.$message({
type: 'error',
message: err.message
})
})
})
.catch(() => {
this.$message({
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!