Commit 301b1e54 by xinlaa

员工活码完善等

1 parent 694fff7c
...@@ -33,6 +33,7 @@ export function getScop(id) { ...@@ -33,6 +33,7 @@ export function getScop(id) {
* @param {*} data * @param {*} data
{ {
"id": "主键", "id": "主键",
"mediaId": "素材的id",
"welcomeMsg": "欢迎语", "welcomeMsg": "欢迎语",
"welcomeMsgTplType": "欢迎语模板类型:1:员工欢迎语;2:部门员工欢迎语;3:客户群欢迎语", "welcomeMsgTplType": "欢迎语模板类型:1:员工欢迎语;2:部门员工欢迎语;3:客户群欢迎语",
"weMsgTlpScopes": [ "weMsgTlpScopes": [
......
...@@ -6,6 +6,10 @@ export default { ...@@ -6,6 +6,10 @@ export default {
type: String, type: String,
default: '', default: '',
}, },
isOther: {
type: Boolean,
default: false,
},
}, },
data() { data() {
return {} return {}
...@@ -23,7 +27,7 @@ export default { ...@@ -23,7 +27,7 @@ export default {
<div class="top">小微</div> <div class="top">小微</div>
<div class="small">塬微科技-企微</div> <div class="small">塬微科技-企微</div>
<div class="time">凌晨2:20</div> <div class="time">凌晨2:20</div>
<div class="flex"> <div class="flex msg-li">
<el-avatar <el-avatar
shape="square" shape="square"
size="small" size="small"
...@@ -31,6 +35,16 @@ export default { ...@@ -31,6 +35,16 @@ export default {
></el-avatar> ></el-avatar>
<div class="msg">{{ message }}</div> <div class="msg">{{ message }}</div>
</div> </div>
<div class="flex msg-li" v-if="isOther">
<el-avatar
shape="square"
size="small"
:src="require('@/assets/image/profile.jpg')"
></el-avatar>
<div class="msg" style="line-height: 0; padding: 5px;">
<slot></slot>
</div>
</div>
</div> </div>
</template> </template>
...@@ -40,8 +54,7 @@ export default { ...@@ -40,8 +54,7 @@ export default {
background: #eee; background: #eee;
border-radius: 8px; border-radius: 8px;
padding: 15px 10px; padding: 15px 10px;
height: 450px; height: 350px;
margin-left: 10%;
line-height: 1.25; line-height: 1.25;
.top { .top {
font-weight: 600; font-weight: 600;
...@@ -55,6 +68,9 @@ export default { ...@@ -55,6 +68,9 @@ export default {
transform: scale(0.8); transform: scale(0.8);
padding: 10px 0 5px; padding: 10px 0 5px;
} }
.msg-li {
margin-bottom: 10px;
}
.msg { .msg {
min-height: 28px; min-height: 28px;
background-color: #fff; background-color: #fff;
...@@ -66,7 +82,7 @@ export default { ...@@ -66,7 +82,7 @@ export default {
line-height: 22px; line-height: 22px;
padding: 3px 6px; padding: 3px 6px;
border-radius: 4px; border-radius: 4px;
max-width: 70%; max-width: 90%;
min-width: 24px; min-width: 24px;
box-sizing: border-box; box-sizing: border-box;
word-break: break-all; word-break: break-all;
......
...@@ -106,6 +106,10 @@ export default { ...@@ -106,6 +106,10 @@ export default {
// this.fileUrl = URL.createObjectURL(file.raw) // this.fileUrl = URL.createObjectURL(file.raw)
} }
}, },
onError(err, file, fileList) {
this.loading = false
this.$message.error('上传文件失败')
},
}, },
} }
</script> </script>
...@@ -122,6 +126,7 @@ export default { ...@@ -122,6 +126,7 @@ export default {
:data="{ mediaType: type }" :data="{ mediaType: type }"
:show-file-list="false" :show-file-list="false"
:on-success="onSuccess" :on-success="onSuccess"
:on-error="onError"
:before-upload="handleBeforeUpload" :before-upload="handleBeforeUpload"
> >
<slot> <slot>
......
...@@ -18,7 +18,7 @@ export default { ...@@ -18,7 +18,7 @@ export default {
// 表单参数 // 表单参数
form: { form: {
codeType: 1, codeType: 1,
qrcode: '', qrCode: '',
isJoinConfirmFriends: 0, isJoinConfirmFriends: 0,
weEmpleCodeTags: [], weEmpleCodeTags: [],
weEmpleCodeUseScops: [], weEmpleCodeUseScops: [],
...@@ -41,6 +41,7 @@ export default { ...@@ -41,6 +41,7 @@ export default {
this.loading = true this.loading = true
getDetail(id).then(({ data }) => { getDetail(id).then(({ data }) => {
this.form = data this.form = data
this.materialSelected = data.weMaterial.materialUrl
this.loading = false this.loading = false
}) })
}, },
...@@ -55,7 +56,7 @@ export default { ...@@ -55,7 +56,7 @@ export default {
}, },
codeTypeChange() { codeTypeChange() {
this.form.weEmpleCodeUseScops = [] this.form.weEmpleCodeUseScops = []
this.form.qrcode = '' this.form.qrCode = ''
}, },
// 选择人员变化事件 // 选择人员变化事件
selectedUser(users) { selectedUser(users) {
...@@ -72,7 +73,7 @@ export default { ...@@ -72,7 +73,7 @@ export default {
params.userIds += '' params.userIds += ''
params.departmentIds += '' params.departmentIds += ''
getQrcode(params).then(({ data }) => { getQrcode(params).then(({ data }) => {
this.form.qrcode = data.qr_code this.$set(this.form, 'qrCode', data.qr_code)
}) })
}, },
submitSelectTag(data) { submitSelectTag(data) {
...@@ -98,12 +99,20 @@ export default { ...@@ -98,12 +99,20 @@ export default {
this.dialogVisibleSelectWel = false this.dialogVisibleSelectWel = false
}, },
submit() { submit() {
if (!this.form.weEmpleCodeUseScops.length) {
this.msgError('请至少选择一名使用员工')
return
}
this.loading = true this.loading = true
add(this.form).then(({ data }) => { ;(this.form.id ? update : add)(this.form)
this.msgSuccess('操作成功') .then(({ data }) => {
this.loading = false this.msgSuccess('操作成功')
this.$router.back() this.loading = false
}) this.$router.back()
})
.catch(() => {
this.loading = false
})
}, },
}, },
} }
...@@ -203,15 +212,15 @@ export default { ...@@ -203,15 +212,15 @@ export default {
>添加图片</el-button >添加图片</el-button
> >
</el-popover> --> </el-popover> -->
<el-image <div v-if="materialSelected">
v-if="materialSelected" <el-image
style="width: 100px; height: 100px" style="width: 100px; height: 100px; cursor: pointer;border-radius: 6px;"
:src="materialSelected" :src="materialSelected"
:fit="fit" fit="fit"
@click="dialogVisibleSelectMaterial = true" >
> </el-image>
<i class="el-icon-error" @click="removeMaterial"></i> <i class="el-icon-error" @click="removeMaterial"></i>
</el-image> </div>
<el-button <el-button
v-else v-else
icon="el-icon-plus" icon="el-icon-plus"
...@@ -240,14 +249,14 @@ export default { ...@@ -240,14 +249,14 @@ export default {
<div class="preview-wrap"> <div class="preview-wrap">
<el-image <el-image
style="width: 180px; height: 180px" style="width: 180px; height: 180px"
:src="form.qrcode || require('@/assets/image/user-code-example.jpg')" :src="form.qrCode || require('@/assets/image/user-code-example.jpg')"
fit="fit" fit="fit"
></el-image> ></el-image>
<div class="tip mb20">二维码预览</div> <div class="tip mb20">二维码预览</div>
<el-card shadow="never" :body-style="{ padding: '10px 10px 20px' }"> <el-card shadow="never" :body-style="{ padding: '10px 10px 20px' }">
<i class="el-icon-user-solid" style="font-size: 20px;"></i> 63136 <i class="el-icon-user-solid" style="font-size: 20px;"></i> 昵称
<el-divider></el-divider> <div style="margin: 10px 0; border-bottom: 1px solid #ddd;"></div>
<div>性别:男</div> <div>性别:男</div>
<div>设置:备注和描述</div> <div>设置:备注和描述</div>
<div> <div>
...@@ -260,7 +269,17 @@ export default { ...@@ -260,7 +269,17 @@ export default {
<div class="tip mb20">扫码标签样式</div> <div class="tip mb20">扫码标签样式</div>
<!-- 预览 --> <!-- 预览 -->
<PhoneDialog :message="form.welcomeMsg || '请输入欢迎语'"></PhoneDialog> <PhoneDialog
:message="form.welcomeMsg || '请输入欢迎语'"
:isOther="!!materialSelected"
>
<el-image
style="width: 100px; height: 100px; cursor: pointer;border-radius: 6px;"
:src="materialSelected"
fit="fit"
>
</el-image>
</PhoneDialog>
<div class="tip">欢迎语样式</div> <div class="tip">欢迎语样式</div>
</div> </div>
......
<script> <script>
import { edit } from '@/api/drainageCode/welcome' import { edit } from '@/api/drainageCode/welcome'
import PhoneDialog from '@/components/PhoneDialog' import PhoneDialog from '@/components/PhoneDialog'
import SelectMaterial from '@/components/SelectMaterial'
export default { export default {
components: { PhoneDialog }, components: { PhoneDialog, SelectMaterial },
props: {}, props: {},
data() { data() {
return { return {
dialogVisible: false, dialogVisible: false,
dialogVisible1: false, // dialogVisible1: false,
form: { id: '', welcomeMsgTplType: '', welcomeMsg: '' }, dialogVisibleSelectMaterial: false,
imageUrl: '', form: { id: '', mediaId: '', welcomeMsgTplType: '', welcomeMsg: '' },
materialSelected: '',
} }
}, },
watch: {}, watch: {},
...@@ -27,22 +29,15 @@ export default { ...@@ -27,22 +29,15 @@ export default {
insertName() { insertName() {
this.form.welcomeMsg += '#客户昵称#' this.form.welcomeMsg += '#客户昵称#'
}, },
uploadSuccess(res, file) { // 选择素材确认按钮
debugger submitSelectMaterial(text, image, file) {
this.imageUrl = URL.createObjectURL(file.raw) this.form.mediaId = image.id
this.materialSelected = image.materialUrl
this.dialogVisibleSelectMaterial = false
}, },
beforeUpload(file) { removeMaterial() {
debugger this.form.mediaId = ''
const isJPG = file.type === 'image/jpeg' this.materialSelected = ''
const isLt2M = file.size / 1024 / 1024 < 2
if (!isJPG) {
this.$message.error('上传头像图片只能是 JPG 格式!')
}
if (!isLt2M) {
this.$message.error('上传头像图片大小不能超过 2MB!')
}
return isJPG && isLt2M
}, },
}, },
} }
...@@ -74,9 +69,17 @@ export default { ...@@ -74,9 +69,17 @@ export default {
> >
</div> </div>
<el-divider></el-divider> <el-divider></el-divider>
<img v-if="imageUrl" :src="imageUrl" /> <div v-if="materialSelected">
<el-image
style="width: 100px; height: 100px; cursor: pointer;border-radius: 6px;"
:src="materialSelected"
fit="fit"
>
</el-image>
<i class="el-icon-error" @click="removeMaterial"></i>
</div>
<el-popover placement="top-start" trigger="hover"> <!-- <el-popover placement="top-start" trigger="hover">
<div class="ac"> <div class="ac">
<Upload <Upload
><el-button> ><el-button>
...@@ -85,19 +88,26 @@ export default { ...@@ -85,19 +88,26 @@ export default {
</el-button></Upload </el-button></Upload
> >
<!-- <el-button @click="dialogVisible = true"> <el-button @click="dialogVisible = true">
<i class="el-icon-link"></i> <i class="el-icon-link"></i>
<p>网页</p> <p>网页</p>
</el-button> </el-button>
<el-button @click="dialogVisible1 = true"> <el-button @click="dialogVisible1 = true">
<i class="el-icon-link"></i> <i class="el-icon-link"></i>
<p>小程序</p> <p>小程序</p>
</el-button> --> </el-button>
</div> </div>
<el-button slot="reference" icon="el-icon-plus" size="mini" <el-button slot="reference" icon="el-icon-plus" size="mini"
>添加图片</el-button >添加图片</el-button
> >
</el-popover> </el-popover> -->
<el-button
icon="el-icon-plus"
size="mini"
@click="dialogVisibleSelectMaterial = true"
>添加图片</el-button
>
</el-card> </el-card>
</el-form-item> </el-form-item>
<el-form-item label=" "> <el-form-item label=" ">
...@@ -106,7 +116,27 @@ export default { ...@@ -106,7 +116,27 @@ export default {
</el-form-item> </el-form-item>
</el-form> </el-form>
<PhoneDialog :message="form.welcomeMsg || '请输入欢迎语'"></PhoneDialog> <PhoneDialog
style="margin-left: 10%;"
:message="form.welcomeMsg || '请输入欢迎语'"
:isOther="!!materialSelected"
>
<el-image
style="width: 100px; height: 100px; cursor: pointer;border-radius: 6px;"
:src="materialSelected"
fit="fit"
>
</el-image
></PhoneDialog>
<!-- 选择素材弹窗 -->
<SelectMaterial
:visible.sync="dialogVisibleSelectMaterial"
type="1"
:showArr="[1]"
@success="submitSelectMaterial"
>
</SelectMaterial>
<!-- <el-dialog title="添加网页消息" :visible.sync="dialogVisible" width="width"> <!-- <el-dialog title="添加网页消息" :visible.sync="dialogVisible" width="width">
<el-form :model="form" inline> <el-form :model="form" inline>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!