This commit is contained in:
liushiwei
2023-08-08 20:56:13 +08:00
3 changed files with 189 additions and 2 deletions

View File

@@ -30,6 +30,11 @@ const router = new VueRouter({
name: 'NormalSendGoods', name: 'NormalSendGoods',
component: () => import('../view/NormalSendGoods.vue') component: () => import('../view/NormalSendGoods.vue')
}, },
{
path: 'message',
name: 'message',
component: () => import('../view/Message.vue')
},
{ {
path: 'copyProduct', path: 'copyProduct',
name: 'copyProduct', name: 'copyProduct',

View File

@@ -22,6 +22,7 @@
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item command="phone">修改手机</el-dropdown-item> --> <!-- <el-dropdown-item command="phone">修改手机</el-dropdown-item> -->
<el-dropdown-item command="pwd">修改密码</el-dropdown-item> <el-dropdown-item command="pwd">修改密码</el-dropdown-item>
<el-dropdown-item command="message">消息推送</el-dropdown-item>
<el-dropdown-item command="logout">退出登录</el-dropdown-item> <el-dropdown-item command="logout">退出登录</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
@@ -151,8 +152,8 @@
this.$router.push('changePhone') this.$router.push('changePhone')
} else if (e === 'pwd') { } else if (e === 'pwd') {
this.$router.push('changePwd') this.$router.push('changePwd')
} else if (e === 'userinfo') { } else if (e === 'message') {
this.$router.push('userInfo') this.$router.push('message')
} else { } else {
this.$store.commit('SignOut', true) this.$store.commit('SignOut', true)
} }

181
src/view/Message.vue Normal file
View File

@@ -0,0 +1,181 @@
<template>
<ai-list class="Learning">
<ai-title
slot="title"
title="消息推送"
isShowBottomBorder>
</ai-title>
<template slot="content">
<ai-search-bar>
<template #left>
<el-button type="primary" @click="getQRCodeUrl(), isShow = true">绑定公众号</el-button>
</template>
<template #right>
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
:current.sync="search.current"
:size.sync="search.size"
style="margin-top: 8px;"
@getList="getList">
<el-table-column slot="send" label="是否发送通知" align="center">
<template v-slot="{ row }">
<el-switch
active-value="1"
inactive-value="0"
@change="e => onChange(row.id, e)"
v-model="row.isSend">
</el-switch>
</template>
</el-table-column>
<el-table-column slot="options" label="操作" align="center" fixed="right" width="140px">
<template v-slot="{ row }">
<div class="table-options">
<el-button type="text" @click="edit(row)">修改姓名</el-button>
</div>
</template>
</el-table-column>
</ai-table>
<AiDialog
title="扫码绑定微信公众号"
:visible.sync="isShow"
:close-on-click-modal="false"
customFooter
width="380px">
<img style="width: 300px" :src="qrcode" />
<div class="dialog-footer" slot="footer">
<el-button @click="isShow = false">取消</el-button>
<el-button @click="getList(), isShow = false" type="primary">我已扫码</el-button>
</div>
</AiDialog>
<AiDialog
title="修改姓名"
:visible.sync="isShowForm"
:close-on-click-modal="false"
width="580px"
@close="form.name = '', id = ''"
@confirm="onConfirm">
<el-form :model="form" ref="form" label-width="100px">
<el-form-item label="姓名" prop="name" :rules="[{required: true, message: '请输入姓名', trigger: 'blur'}]">
<el-input v-model="form.name" placeholder="请输入姓名"></el-input>
</el-form-item>
</el-form>
</AiDialog>
</template>
</ai-list>
</template>
<script>
export default {
data () {
return {
colConfigs: [
{ prop: 'name', label: '姓名', align: 'left' },
{ slot: 'send' },
{ prop: 'createTime', label: '绑定时间', align: 'center' },
],
tableData: [],
total: 0,
qrcode: '',
isShow: false,
search: {
current: 1,
size: 10
},
form: {
name: ''
},
isShowForm: false,
sence: '',
id: ''
}
},
created () {
this.getQRCodeUrl()
this.getList()
},
methods: {
onChange (id, isSend) {
console.log(isSend)
this.$http.post(`/api/malluser/updateWxuserInfo`, {
id,
isSend: isSend
}).then(res => {
if (res.code === 0) {
this.$message.success('操作成功')
this.getList()
}
})
},
onConfirm () {
this.$refs.form.validate((valid) => {
if (valid) {
this.$http.post('/api/malluser/updateWxuserInfo', {
id: this.id,
name: this.form.name
}).then(res => {
if (res.code === 0) {
this.isShowForm = false
this.getList()
this.$message.success('编辑成功')
}
})
}
})
},
edit (e) {
this.id = e.id
this.form.name = e.name
this.isShowForm = true
},
collection (id, isFavorite) {
this.$confirm(isFavorite === '0' ? '确定收藏该文章?' : '确定取消收藏?', '温馨提示', {
confirmButtonText: '确定',
callback: action => {
if (action === 'confirm') {
this.$http.post(isFavorite === '0' ? `/api/learning/addFavorite?id=${id}` : `/api/learning/delFavorite?id=${id}`).then(res => {
if (res.code === 0) {
this.$message.success(isFavorite === '1' ? '取消成功' : '收藏成功')
this.getList()
}
})
}
}
})
},
getQRCodeUrl () {
this.$http.post('/api/malluser/getQRCodeUrl').then(res => {
if (res.code === 0) {
this.qrcode = res.data.picUrl
this.sence = res.data.sence
}
})
},
getList () {
this.$http.post('/api/malluser/getWxuserList', null, {
params: {
...this.search
}
}).then(res => {
if (res.code === 0) {
this.tableData = res.data
this.total = res.data.length
}
})
}
}
}
</script>
<style scoped lang="scss">
</style>