Commit d484d82d authored by lshan's avatar lshan

消息管理

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