Commit 1da4c804 by 胡悦

添加eventbus

1 parent 9c58092b
......@@ -8,10 +8,10 @@
<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="为群聊设置一个组名"></el-input>
<el-input v-model="basicForm.name" placeholder="为群聊设置一个组名" maxlength="10"></el-input>
</el-form-item>
<el-form-item label="群聊名称" prop="groupName">
<el-input v-model="basicForm.groupName" placeholder="设置群聊名称前缀,如新车售后一组"></el-input>
<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">
......@@ -26,11 +26,11 @@
<!-- 编辑入群欢迎语 -->
<div class="title">编辑入群欢迎语</div>
<div>
<WelcomeWords></WelcomeWords>
<WelcomeWords :eventBus="eventBus"></WelcomeWords>
</div>
</div>
<div class="preview">
<Preview></Preview>
<Preview :eventBus="eventBus"></Preview>
</div>
</div>
</div>
......@@ -52,7 +52,8 @@
</template>
<script>
import WelcomeWords from './components/ welcomeWords.vue'
import Vue from 'vue'
import WelcomeWords from './components/welcomeWords.vue'
import SelectMembers from './components/selectMembers.vue'
import Preview from './components/preview.vue'
export default {
......@@ -63,6 +64,7 @@ export default {
},
data() {
return {
eventBus: new Vue(),
basicForm: {},
basicRules: {
name: [{ required: true, message: '请输入组名', trigger: 'blur' }],
......
......@@ -33,57 +33,59 @@
<script>
export default {
name: 'Preview',
props: { eventBus: Object },
data() {
return {
previewList: [
{
id: 1,
type: 'text',
content: 'fasf'
},
{
id: 2,
type: 'link',
url: 'https://baidu.comdfasdfasdfa'
},
{
id: 3,
type: 'img',
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: [],
// previewList: [
// {
// id: 1,
// type: 'text',
// content: 'fasf'
// },
// {
// id: 2,
// type: 'link',
// url: 'https://baidu.comdfasdfasdfa'
// },
// {
// id: 3,
// type: 'img',
// 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'
// }
// ],
currentTime: ''
}
},
......@@ -94,6 +96,10 @@ export default {
let minutes = date.getMinutes()
minutes = minutes < 10 ? `0${minutes}` : minutes
this.currentTime = `${date.getFullYear()}年${date.getMonth() + 1}月${date.getDate()}日 ${hours}:${minutes}`
this.eventBus.$on('update', val => {
console.log(val)
this.previewList = val
})
}
}
</script>
......
......@@ -72,6 +72,7 @@
<script>
export default {
name: 'WelcomeWords',
props: { eventBus: Object },
data() {
return {
btnList: [
......@@ -169,6 +170,9 @@ export default {
]
}
},
mounted() {
this.eventBus.$emit('update', this.previewList)
},
methods: {
handleImgChange(e, targetItem) {
console.log(e, targetItem)
......@@ -242,7 +246,7 @@ export default {
<style lang="scss" scoped>
.welcome-box {
padding: 20px 0;
padding-top: 20px;
margin-left: 87px;
}
.content {
......
......@@ -22,11 +22,9 @@
<span class="statusText" :class="{ 'red-text': scope.scope.status === '2', 'green-text': scope.scope.status === '1' }">{{ statusText(scope.scope.status) }}</span>
</span>
<div class="table-btns" slot="optionBtns" slot-scope="scope">
<el-button type="text" @click="handleEdit(scope.scope)">修改</el-button>
<el-button type="text" @click="btnClick('edit', scope.scope)">修改</el-button>
<el-button type="text" @click="btnClick('status', scope.scope)">{{ scope.scope.status == 1 ? '停用' : '启用' }}</el-button>
</div>
<template slot="otherOptions" slot-scope="scope">
<el-switch :size="size" slot="reference" v-model="scope.scope.status" active-value="1" inactive-value="2" @change="e => handleSwitchChange(e, scope.scope)"></el-switch>
</template>
</GLTable>
<!-- 表格区域 end -->
</div>
......@@ -84,19 +82,13 @@ export default {
width: '140px',
addHtml: 'optionBtns',
fixed: 'right'
},
{
label: '启用开关',
prop: 'optionBtns',
width: '80px',
addHtml: 'otherOptions',
fixed: 'right'
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
tableData: [
{
id: 1,
orgName: '守候专用服务一组',
createdTime: '2021-11-05',
status: '1',
......@@ -154,6 +146,7 @@ export default {
]
},
{
id: 2,
orgName: '守候专用服务er组',
createdTime: '2021-11-05',
status: '2',
......@@ -189,21 +182,40 @@ export default {
console.log(this.searchForm)
// this.$refs.gueastGroup.refreshTable()
},
// 启用开关
handleSwitchChange(e, scope) {
console.log(e, scope)
},
statusText(val) {
console.log(val)
return val === '1' ? '启用' : val === '2' ? '停用' : ''
return val === '1' ? '启用' : '停用'
},
btnClick(name) {
btnClick(name, rowData) {
console.log(name)
const id = 1
switch (name) {
case 'create':
this.$router.push('/guestGroup/add/' + id)
this.$router.push('/guestGroup/add/' + 1)
break
case 'edit':
this.$router.push('/guestGroup/add/' + rowData.id)
break
case 'status':
this.$confirm(`是否确认${rowData.status == 1 ? '启用' : '停用'}?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
this.$message({
type: 'success',
message: '操作成功!'
})
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消操作'
})
})
break
default:
console.log('gaocuole')
}
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!