Commit d484d82d authored by lshan's avatar lshan

消息管理

parents d311e949 2b4e9838
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",
"build": "vue-cli-service build --report" "build": "vue-cli-service build --report",
"bd": "npm run build & bash deploy.sh"
}, },
"dependencies": { "dependencies": {
"@tiptap/extension-image": "^2.0.0-beta.15", "@tiptap/extension-image": "^2.0.0-beta.15",
......
...@@ -52,6 +52,9 @@ export default Vue.extend({ ...@@ -52,6 +52,9 @@ export default Vue.extend({
this.imageUrl = newV this.imageUrl = newV
} }
}, },
created() {
this.imageUrl = this.path
},
data(){ data(){
return{ return{
imageUrl: "", imageUrl: "",
......
...@@ -47,7 +47,8 @@ export default Vue.extend({ ...@@ -47,7 +47,8 @@ export default Vue.extend({
}, },
extensions: [StarterKit, Timage], extensions: [StarterKit, Timage],
autofocus: "start", autofocus: "start",
}); })
this.editor.commands.setContent(this.text)
}, },
beforeDestroy() { beforeDestroy() {
this.editor.destroy(); this.editor.destroy();
......
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
<template #name="text"> <template #name="text">
{{ text +1 }} {{ text +1 }}
</template> </template>
<template #status="text">
{{text | platformfilterUserStatus}}
</template>
<div slot="action" slot-scope="text, record"> <div slot="action" slot-scope="text, record">
<a <a
:class=" :class="
...@@ -147,10 +150,10 @@ export default Vue.extend({ ...@@ -147,10 +150,10 @@ export default Vue.extend({
status: eUserStatusAction.disable, status: eUserStatusAction.disable,
}) })
} }
this.$store.commit('/platformUserManagement/save', { this.$store.commit('platformUserManagement/save', {
page: 1, page: 1,
}) })
this.$store.dispatch('/platformUserManagement/query') this.$store.dispatch('platformUserManagement/query')
this.show = false this.show = false
}, },
}, },
......
...@@ -10,7 +10,7 @@ export default { ...@@ -10,7 +10,7 @@ export default {
formatDate(timeStamp: number) { formatDate(timeStamp: number) {
const commonLen = new Date().getTime().toString().length const commonLen = new Date().getTime().toString().length
if (timeStamp.toString().length === commonLen) { if (timeStamp.toString().length === commonLen) {
return moment(timeStamp).format('YYYY-MM-DD hh:mm') // September 14th 2021, 3:22:23 pm return moment(timeStamp).format('YYYY-MM-DD HH:mm') // September 14th 2021, 3:22:23 pm
} else { } else {
return '' return ''
} }
......
...@@ -64,37 +64,43 @@ const router = new VueRouter({ ...@@ -64,37 +64,43 @@ const router = new VueRouter({
}) })
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
// console.log({ from, to }) console.log({ from, to })
const usermsg = getUserMsg() const usermsg = getUserMsg()
if (usermsg === undefined) { if (usermsg === undefined) {
/* 没有登录 */ /* 没有登录 */
if (to.name == 'adminLogin' || to.name == 'login') { if (to.name == 'adminLogin' || to.name == 'login') {
console.log(1)
next() next()
} else { } else {
console.log(2)
next({ next({
name: 'login', name: 'login',
}) })
} }
} else { } else {
console.log(3)
/* 有登录 */ /* 有登录 */
const roles = (to.meta as { roles?: eRole[] }).roles const roles = (to.meta as { roles?: eRole[] }).roles
const oldRole = getOldRoleFromUserMsg(usermsg) const oldRole = getOldRoleFromUserMsg(usermsg)
// console.log(oldRole, roles, oldRole && roles && roles.includes(oldRole)) // console.log(oldRole, roles, oldRole && roles && roles.includes(oldRole))
const userHasRoleInCurPage = oldRole !== undefined && roles !== undefined && roles.includes(oldRole) const userHasRoleInCurPage =
oldRole !== undefined && roles !== undefined && roles.includes(oldRole)
if (userHasRoleInCurPage) { if (userHasRoleInCurPage) {
// console.log(1) console.log(4)
next() next()
} else { } else {
if (oldRole == eRole.platform_management) { if (oldRole == eRole.platform_management) {
// console.log(2) if (getUserMsg()?.phone) {
if(getUserMsg()?.phone){ console.log(5)
next({ name: 'platformUserManagement' }) next({ name: 'platformUserManagement' })
}else{ } else {
next({name:'changePhone'}) console.log(6)
next({ name: 'changePhone' })
} }
} else { } else {
// console.log(3) console.log(7)
next({ name: 'home' }) next({ name: 'home' })
} }
} }
......
...@@ -6,6 +6,7 @@ import axios, { ...@@ -6,6 +6,7 @@ import axios, {
} from 'axios' } from 'axios'
import { message, Modal } from 'ant-design-vue' import { message, Modal } from 'ant-design-vue'
import router from '@/router' import router from '@/router'
import RouterUtil from '@/utils/router'
const baseAxios = axios.create({ const baseAxios = axios.create({
baseURL: '/proxyApi/api/v1', baseURL: '/proxyApi/api/v1',
...@@ -16,8 +17,9 @@ baseAxios.interceptors.response.use( ...@@ -16,8 +17,9 @@ baseAxios.interceptors.response.use(
const ret = value.data const ret = value.data
if (ret.code !== undefined && ret.code !== 200) { if (ret.code !== undefined && ret.code !== 200) {
if ([504, 503].includes(ret.code)) { if ([504, 503].includes(ret.code)) {
const role = getUserMsg()?.newRole
window.localStorage.clear() window.localStorage.clear()
router.push('/login') RouterUtil.getInstance().gotoLogin(role)
// deleteUserMsg(); // deleteUserMsg();
} }
message.error(ret.msg) message.error(ret.msg)
......
import router from '@/router'
import { eNewRoleRelatedToBackEnd, eRole } from '@/types/role'
export default class RouterUtil {
static instance: RouterUtil
static getInstance() {
if (!RouterUtil.instance) {
RouterUtil.instance = new RouterUtil()
}
return RouterUtil.instance
}
gotoLogin(role: eNewRoleRelatedToBackEnd | undefined) {
if (role === eNewRoleRelatedToBackEnd.PlatformAdmin) {
router.push({
name: 'adminLogin',
})
} else {
router.push({
name: 'login',
})
}
}
}
...@@ -65,6 +65,7 @@ ...@@ -65,6 +65,7 @@
<a-form-model-item prop="phoneNumber"> <a-form-model-item prop="phoneNumber">
<a-input <a-input
placeholder="请输入手机号" placeholder="请输入手机号"
:maxLength="11"
v-model="loginBySmsForm.phoneNumber" v-model="loginBySmsForm.phoneNumber"
> >
<a-icon slot="prefix" type="phone" /> <a-icon slot="prefix" type="phone" />
...@@ -244,7 +245,7 @@ export default Vue.extend({ ...@@ -244,7 +245,7 @@ export default Vue.extend({
name: "home", name: "home",
}); });
} else { } else {
message.warn(ret.msg); // message.warn(ret.msg);
} }
}, },
async loginByPwdFunc(name: string, pwd: string) { async loginByPwdFunc(name: string, pwd: string) {
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
:startTime="queryParam.startTime" :startTime="queryParam.startTime"
:endTime="queryParam.endTime" :endTime="queryParam.endTime"
/> />
<a-button type="primary" style="margin-right: 10px;" @click="fetchList"> <a-button type="primary" style="margin-right: 10px;" @click="handleClickQuery">
查询 查询
</a-button> </a-button>
<!-- 新增 --> <!-- 新增 -->
...@@ -215,6 +215,10 @@ export default Vue.extend({ ...@@ -215,6 +215,10 @@ export default Vue.extend({
} }
}, },
methods: { methods: {
handleClickQuery(){
this.queryParam.offset = 0;
this.fetchList();
},
handlePaginationChange(current: number) { handlePaginationChange(current: number) {
this.queryParam.offset = (current - 1) * this.queryParam.limit this.queryParam.offset = (current - 1) * this.queryParam.limit
this.fetchList() this.fetchList()
......
...@@ -71,16 +71,20 @@ ...@@ -71,16 +71,20 @@
@click="remove(record)"> @click="remove(record)">
下架 下架
</a> </a>
<a-divider type="vertical" /> <a-divider v-show="record.notify_status === 1" type="vertical" />
<a v-show="record.notify_status === 1" <a v-show="record.notify_status === 1"
@click="onEdit(record)"> @click="onEdit(record)">
编辑 编辑
</a> </a>
<a-divider v-show="record.notify_status === 1" type="vertical" /> <a-divider v-show="record.notify_status === 1" type="vertical" />
<<<<<<< HEAD
<a v-if="record.notify_status==1" @click="onDelete(record)"> <a v-if="record.notify_status==1" @click="onDelete(record)">
删除 删除
</a> </a>
<a v-else-if="record.notify_status==2" style="color: rgba(249, 250, 251, var(--tw-text-opacity));"> <a v-else-if="record.notify_status==2" style="color: rgba(249, 250, 251, var(--tw-text-opacity));">
=======
<a v-show="record.notify_status === 1" @click="onDelete(record)">
>>>>>>> origin/dev
删除 删除
</a> </a>
</span> </span>
...@@ -226,9 +230,12 @@ export default Vue.extend({ ...@@ -226,9 +230,12 @@ export default Vue.extend({
this.getList() this.getList()
}, },
publish(){ publish(){
this.resetForm() // (this.$refs.ruleForm as any).resetFields()
this.show = true this.show = true
this.btnType = 'add' this.btnType = 'add'
this.$nextTick(() => {
this.resetForm()
})
}, },
showModal(current:object){ showModal(current:object){
this.visible = true this.visible = true
...@@ -315,11 +322,9 @@ export default Vue.extend({ ...@@ -315,11 +322,9 @@ export default Vue.extend({
labelCol: { span: 4 }, labelCol: { span: 4 },
wrapperCol: { span: 14 }, wrapperCol: { span: 14 },
form: { form: {
// name: '',
title:'', title:'',
type: 1, type: 1,
content:'', content:'',
// module:''
}, },
rules, rules,
uuid: "", uuid: "",
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<!-- 搜索框 --> <!-- 搜索框 -->
<a-input placeholder="标题模糊搜索" v-model="searchPageReqParams.title" style="width: 150px; margin-right:10px;"/> <a-input placeholder="标题模糊搜索" v-model="searchPageReqParams.title" style="width: 150px; margin-right:10px;"/>
<!-- timepicker --> <!-- timepicker -->
<span class=" font-semibold">注册时间:</span> <span class=" font-semibold">发布时间:</span>
<timerange class=" mr-3" :startTime="searchPageReqParams.start_time" :endTime="searchPageReqParams.end_time" <timerange class=" mr-3" :startTime="searchPageReqParams.start_time" :endTime="searchPageReqParams.end_time"
@getNewTime="getNewTime"/> @getNewTime="getNewTime"/>
<!-- 咨询分类 --> <!-- 咨询分类 -->
...@@ -53,13 +53,13 @@ ...@@ -53,13 +53,13 @@
@click="remove(record)"> @click="remove(record)">
下架 下架
</a> </a>
<a-divider type="vertical" /> <a-divider v-show="record.article_status==1" type="vertical" />
<a v-show="record.article_status==1" <a v-show="record.article_status==1"
@click="release(record.uuid, searchPageReqParams.article_type)"> @click="release(record, searchPageReqParams.article_type)">
编辑 编辑
</a> </a>
<a-divider v-show="record.article_status==1" type="vertical" /> <a-divider v-show="record.article_status==1" type="vertical" />
<a @click="onDelete(record)"> <a v-show="record.article_status==1" @click="onDelete(record)">
删除 删除
</a> </a>
</span> </span>
...@@ -187,11 +187,7 @@ export default Vue.extend({ ...@@ -187,11 +187,7 @@ export default Vue.extend({
}, },
query(){ query(){
console.log(this.searchPageReqParams); console.log(this.searchPageReqParams);
if (this.searchPageReqParams.title) {
this.findTitle()
} else {
this.getList() this.getList()
}
}, },
getNewTime(startTime:number,endTime:number){ getNewTime(startTime:number,endTime:number){
this.searchPageReqParams.start_time = startTime this.searchPageReqParams.start_time = startTime
...@@ -205,9 +201,9 @@ export default Vue.extend({ ...@@ -205,9 +201,9 @@ export default Vue.extend({
this.searchPageReqParams.end_time = undefined this.searchPageReqParams.end_time = undefined
this. query() this. query()
}, },
release(key?:string, type?:string){ release(item?: any, type?:string){
if (key && type) { if (item && type) {
this.$router.push({name:'publishNews', query: {key, type}}) this.$router.push({name:'publishNews', query: {msg: JSON.stringify(item), type}})
} else { } else {
this.$router.push({name:'publishNews'}) this.$router.push({name:'publishNews'})
} }
......
...@@ -66,22 +66,26 @@ export default Vue.extend({ ...@@ -66,22 +66,26 @@ export default Vue.extend({
}, },
methods:{ methods:{
getDetails() { getDetails() {
// 新增
if (Object.keys(this.$route.query).length === 0) { if (Object.keys(this.$route.query).length === 0) {
this.type = undefined this.type = undefined
return return
} }
const type = this.$route.query.type const type = this.$route.query.type
const id = this.$route.query.key as string
this.type = +type this.type = +type
if (+type === 1) { const msg = JSON.parse(this.$route.query.msg as string)
news.searchPolicy(id).then(res => { this.initData(msg)
this.initData(res.data) // 编辑
})
} else { // if (+type === 1) {
news.searchNews(id).then(res => { // news.searchPolicy(id).then(res => {
this.initData(res.data) // this.initData(res.data)
}) // })
} // } else {
// news.searchNews(id).then(res => {
// this.initData(res.data)
// })
// }
}, },
initData(res: any) { initData(res: any) {
this.title = res.title this.title = res.title
...@@ -90,6 +94,9 @@ export default Vue.extend({ ...@@ -90,6 +94,9 @@ export default Vue.extend({
this.imageUrl = new FileService().getImageSrc(res.file_name) this.imageUrl = new FileService().getImageSrc(res.file_name)
this.summary = res.desc this.summary = res.desc
this.editableContent = res.content this.editableContent = res.content
this.content = res.content
console.log('res', res)
console.log('imageUrl', this.imageUrl)
}, },
getContent(value:string){ getContent(value:string){
this.content = value this.content = value
...@@ -115,6 +122,7 @@ export default Vue.extend({ ...@@ -115,6 +122,7 @@ export default Vue.extend({
}) })
}, },
editForm() { editForm() {
const msg = JSON.parse(this.$route.query.msg as string)
const params = { const params = {
article_type: this.type, article_type: this.type,
content: this.content, content: this.content,
...@@ -122,7 +130,7 @@ export default Vue.extend({ ...@@ -122,7 +130,7 @@ export default Vue.extend({
file_name: this.imgUrl, file_name: this.imgUrl,
title: this.title, title: this.title,
writer: this.author, writer: this.author,
uuid: this.$route.query.key as string uuid: msg.uuid as string
} }
news.editArticle(params).then(res => { news.editArticle(params).then(res => {
if (res.code === 200) { if (res.code === 200) {
...@@ -133,7 +141,7 @@ export default Vue.extend({ ...@@ -133,7 +141,7 @@ export default Vue.extend({
}, },
onSubmit() { onSubmit() {
console.log(this.content) console.log(this.content)
if (this.$route.query.key) { if (this.$route.query.msg) {
this.editForm() this.editForm()
} else { } else {
this.addForm() this.addForm()
......
...@@ -105,6 +105,7 @@ import { FormModel, Modal } from "ant-design-vue"; ...@@ -105,6 +105,7 @@ import { FormModel, Modal } from "ant-design-vue";
import { phoneValid } from "./const"; import { phoneValid } from "./const";
import UserService from "@/service/UserManagementService"; import UserService from "@/service/UserManagementService";
import { deleteUserMsg, getUserMsg, setUserMsg } from "@/utils/userMsg/userMsg"; import { deleteUserMsg, getUserMsg, setUserMsg } from "@/utils/userMsg/userMsg";
import RouterUtil from "@/utils/router";
export default Vue.extend({ export default Vue.extend({
components: { CodeInput }, components: { CodeInput },
props: { props: {
...@@ -232,7 +233,9 @@ export default Vue.extend({ ...@@ -232,7 +233,9 @@ export default Vue.extend({
title: "手机号修改成功", title: "手机号修改成功",
content: "请重新登陆", content: "请重新登陆",
onOk() { onOk() {
that.$router.push({ name: "login" }); const role = getUserMsg()?.newRole
window.localStorage.clear()
RouterUtil.getInstance().gotoLogin(role)
}, },
}); });
} else { } else {
......
...@@ -61,6 +61,7 @@ import codeInput from "@/components/CodeInput/index.vue"; ...@@ -61,6 +61,7 @@ import codeInput from "@/components/CodeInput/index.vue";
import UserService from "@/service/UserManagementService"; import UserService from "@/service/UserManagementService";
import { deleteUserMsg, getUserMsg } from "@/utils/userMsg/userMsg"; import { deleteUserMsg, getUserMsg } from "@/utils/userMsg/userMsg";
import { Modal } from "ant-design-vue" import { Modal } from "ant-design-vue"
import RouterUtil from "@/utils/router";
export default Vue.extend({ export default Vue.extend({
components: { codeInput }, components: { codeInput },
...@@ -148,7 +149,9 @@ export default Vue.extend({ ...@@ -148,7 +149,9 @@ export default Vue.extend({
title: "密码修改成功", title: "密码修改成功",
content: "请重新登陆", content: "请重新登陆",
onOk() { onOk() {
that.$router.push({ name: "login" }); const role = getUserMsg()?.newRole
window.localStorage.clear()
RouterUtil.getInstance().gotoLogin(role)
}, },
}); });
} else { } else {
......
...@@ -81,6 +81,7 @@ import { Fragment } from "vue-fragment"; ...@@ -81,6 +81,7 @@ import { Fragment } from "vue-fragment";
import { getUserMsg } from "@/utils/userMsg/userMsg"; import { getUserMsg } from "@/utils/userMsg/userMsg";
import { getOldRoleFromUserMsg } from "@/utils/user"; import { getOldRoleFromUserMsg } from "@/utils/user";
import UserService from '@/service/UserManagementService' import UserService from '@/service/UserManagementService'
import RouterUtil from "@/utils/router";
Vue.use(Menu); Vue.use(Menu);
Vue.use(Icon); Vue.use(Icon);
...@@ -151,8 +152,9 @@ export default Vue.extend({ ...@@ -151,8 +152,9 @@ export default Vue.extend({
logout() { logout() {
userService.logout().then(res => { userService.logout().then(res => {
if (res.code === 200) { if (res.code === 200) {
const role = getUserMsg()?.newRole
window.localStorage.clear() window.localStorage.clear()
this.$router.push('/login') RouterUtil.getInstance().gotoLogin(role)
} }
}) })
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment