fix bug
parent
3734a770dd
commit
21a629b4fb
|
|
@ -7,20 +7,20 @@ import router from '@/router'
|
||||||
export const TOKEN_KEY = 'token'
|
export const TOKEN_KEY = 'token'
|
||||||
|
|
||||||
declare module 'axios' {
|
declare module 'axios' {
|
||||||
export interface AxiosRequestConfig {
|
export interface AxiosRequestConfig {
|
||||||
showLoading?: boolean
|
showLoading?: boolean
|
||||||
// [自定义属性声明]
|
// [自定义属性声明]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// const { createMessage, createWarningModal } = useMessage()
|
// const { createMessage, createWarningModal } = useMessage()
|
||||||
// 创建axios实例
|
// 创建axios实例
|
||||||
const service = axios.create({
|
const service = axios.create({
|
||||||
// 服务接口请求
|
// 服务接口请求
|
||||||
baseURL: '/test-api',
|
baseURL: '/test-api',
|
||||||
// 超时设置
|
// 超时设置
|
||||||
timeout: 15000,
|
timeout: 15000,
|
||||||
headers: { 'Content-Type': 'application/json;charset=utf-8;' },
|
headers: { 'Content-Type': 'application/json;charset=utf-8;' },
|
||||||
showLoading: false
|
showLoading: false
|
||||||
})
|
})
|
||||||
|
|
||||||
// let loading: any;
|
// let loading: any;
|
||||||
|
|
@ -31,143 +31,141 @@ const service = axios.create({
|
||||||
let requestCount: number = 0
|
let requestCount: number = 0
|
||||||
//显示loading
|
//显示loading
|
||||||
const showLoading = () => {
|
const showLoading = () => {
|
||||||
if (requestCount === 0) {
|
if (requestCount === 0) {
|
||||||
//加载中显示样式可以自行修改
|
//加载中显示样式可以自行修改
|
||||||
// loading = ElLoading.service({
|
// loading = ElLoading.service({
|
||||||
// text: "拼命加载中,请稍后...",
|
// text: "拼命加载中,请稍后...",
|
||||||
// background: 'rgba(0, 0, 0, 0.7)',
|
// background: 'rgba(0, 0, 0, 0.7)',
|
||||||
// spinner: 'el-icon-loading',
|
// spinner: 'el-icon-loading',
|
||||||
// })
|
// })
|
||||||
message.loading('请求中...')
|
message.loading('请求中...')
|
||||||
}
|
}
|
||||||
requestCount++
|
requestCount++
|
||||||
}
|
}
|
||||||
//隐藏loading
|
//隐藏loading
|
||||||
const hideLoading = () => {
|
const hideLoading = () => {
|
||||||
requestCount--
|
requestCount--
|
||||||
if (requestCount == 0) {
|
if (requestCount == 0) {
|
||||||
// loading.close()
|
// loading.close()
|
||||||
message.destroyAll()
|
message.destroyAll()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 请求拦截
|
// 请求拦截
|
||||||
service.interceptors.request.use(
|
service.interceptors.request.use(
|
||||||
(config) => {
|
(config) => {
|
||||||
// config.showLoading
|
// config.showLoading
|
||||||
if (config.showLoading) {
|
if (config.showLoading) {
|
||||||
showLoading()
|
showLoading()
|
||||||
}
|
}
|
||||||
if (token) config.headers[TOKEN_KEY] = unref(token)
|
if (token) config.headers[TOKEN_KEY] = unref(token)
|
||||||
// if (getToken()) {
|
// if (getToken()) {
|
||||||
// // 是否需要设置 token放在请求头
|
// // 是否需要设置 token放在请求头
|
||||||
// config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
// config.headers['token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// get请求映射params参数
|
// get请求映射params参数
|
||||||
if (config.method === 'get' && config.params) {
|
if (config.method === 'get' && config.params) {
|
||||||
let url = config.url + '?'
|
let url = config.url + '?'
|
||||||
for (const propName of Object.keys(config.params)) {
|
for (const propName of Object.keys(config.params)) {
|
||||||
const value = config.params[propName]
|
const value = config.params[propName]
|
||||||
const part = encodeURIComponent(propName) + '='
|
const part = encodeURIComponent(propName) + '='
|
||||||
if (value !== null && typeof value !== 'undefined') {
|
if (value !== null && typeof value !== 'undefined') {
|
||||||
// 对象处理
|
// 对象处理
|
||||||
if (typeof value === 'object') {
|
if (typeof value === 'object') {
|
||||||
for (const key of Object.keys(value)) {
|
for (const key of Object.keys(value)) {
|
||||||
const params = propName + '[' + key + ']'
|
const params = propName + '[' + key + ']'
|
||||||
const subPart = encodeURIComponent(params) + '='
|
const subPart = encodeURIComponent(params) + '='
|
||||||
url += subPart + encodeURIComponent(value[key]) + '&'
|
url += subPart + encodeURIComponent(value[key]) + '&'
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
url += part + encodeURIComponent(value) + '&'
|
url += part + encodeURIComponent(value) + '&'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
url = url.slice(0, -1)
|
url = url.slice(0, -1)
|
||||||
config.params = {}
|
config.params = {}
|
||||||
config.url = url
|
config.url = url
|
||||||
}
|
}
|
||||||
return config
|
return config
|
||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
// console.log(error)
|
// console.log(error)
|
||||||
Promise.reject(error)
|
Promise.reject(error)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// 响应拦截器
|
// 响应拦截器
|
||||||
service.interceptors.response.use(
|
service.interceptors.response.use(
|
||||||
async (response: any) => {
|
async (response: any) => {
|
||||||
// console.log('响应拦截器res', response)
|
// console.log('响应拦截器res', response)
|
||||||
// if (res.config.showLoading) {
|
// if (res.config.showLoading) {
|
||||||
// showLoading()
|
// showLoading()
|
||||||
// }
|
// }
|
||||||
hideLoading()
|
hideLoading()
|
||||||
// 未设置状态码则默认成功状态
|
// 未设置状态码则默认成功状态
|
||||||
|
|
||||||
const { data, status } = response
|
const { data, status } = response
|
||||||
if (data instanceof Blob || data instanceof ArrayBuffer) {
|
if (data instanceof Blob || data instanceof ArrayBuffer) {
|
||||||
return {
|
return {
|
||||||
data,
|
data,
|
||||||
code: 200
|
code: 200
|
||||||
}
|
}
|
||||||
if (response.headers['content-disposition']) {
|
if (response.headers['content-disposition']) {
|
||||||
const fileName = response.headers['content-disposition']
|
const fileName = response.headers['content-disposition']?.split(';')[1]?.split('=')[1]
|
||||||
?.split(';')[1]
|
} else {
|
||||||
?.split('=')[1]
|
return Promise.reject('没有访问权限')
|
||||||
} else {
|
}
|
||||||
return Promise.reject('没有访问权限')
|
}
|
||||||
}
|
const { errCode, code, msg } = data || {}
|
||||||
}
|
const errMsg = data?.errMsg || data?.message || msg
|
||||||
const { errCode, code, msg } = data || {}
|
// console.log(11, code, errMsg)
|
||||||
const errMsg = data?.errMsg || data?.message || msg
|
|
||||||
// console.log(11, code, errMsg)
|
|
||||||
|
|
||||||
if (code === 2000) {
|
if (code === 2000) {
|
||||||
await router.push('/')
|
await router.push('/')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (![0, 200].includes(code)) {
|
if (![0, 200].includes(code)) {
|
||||||
// if(errMsg==='用户未登录')
|
if (errMsg === '用户未登录') return Promise.reject(errMsg)
|
||||||
// { message.error(errMsg);}
|
// { message.error(errMsg);}
|
||||||
// else if(errMsg==='密码不正确'){
|
// else if(errMsg==='密码不正确'){
|
||||||
// message.error(errMsg);
|
// message.error(errMsg);
|
||||||
// }
|
// }
|
||||||
// else if(errMsg==="账户信息查找为空"){
|
// else if(errMsg==="账户信息查找为空"){
|
||||||
// message.error(errMsg);
|
// message.error(errMsg);
|
||||||
// }
|
// }
|
||||||
// else{ message.error("服务器升级维护中,请稍后重试!")}\
|
// else{ message.error("服务器升级维护中,请稍后重试!")}\
|
||||||
message.error(errMsg)
|
message.error(errMsg)
|
||||||
return Promise.reject(errMsg)
|
return Promise.reject(errMsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (/^[4|5].*/.test(code || errCode || status)) {
|
if (/^[4|5].*/.test(code || errCode || status)) {
|
||||||
// console.error('> axios(interceptors.response): ', errMsg);
|
// console.error('> axios(interceptors.response): ', errMsg);
|
||||||
message.error(errMsg)
|
message.error(errMsg)
|
||||||
// message.error("服务器访问过多,请稍后重试!");
|
// message.error("服务器访问过多,请稍后重试!");
|
||||||
// 处理未登录,token过期等 情况
|
// 处理未登录,token过期等 情况
|
||||||
// if (code !== 404 && /^[4].*/.test(code || errCode || status)) {
|
// if (code !== 404 && /^[4].*/.test(code || errCode || status)) {
|
||||||
// await app.fedLogout();
|
// await app.fedLogout();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
return Promise.reject(data)
|
return Promise.reject(data)
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
// console.log('err' + error)
|
// console.log('err' + error)
|
||||||
hideLoading()
|
hideLoading()
|
||||||
let { message } = error
|
let { message } = error
|
||||||
if (message == 'Network Error') {
|
if (message == 'Network Error') {
|
||||||
message = '后端接口连接异常'
|
message = '后端接口连接异常'
|
||||||
} else if (message.includes('timeout')) {
|
} else if (message.includes('timeout')) {
|
||||||
message = '系统接口请求超时'
|
message = '系统接口请求超时'
|
||||||
} else if (message.includes('Request failed with status code')) {
|
} else if (message.includes('Request failed with status code')) {
|
||||||
message = '系统接口' + message.substr(message.length - 3) + '异常'
|
message = '系统接口' + message.substr(message.length - 3) + '异常'
|
||||||
}
|
}
|
||||||
message.err('服务器升级维护中,请稍后重试!')
|
message.err('服务器升级维护中,请稍后重试!')
|
||||||
return Promise.reject(error)
|
return Promise.reject(error)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
export default service
|
export default service
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -168,7 +168,7 @@ onMounted(async () => {
|
||||||
addDISH3.value > 0 ? (addDISH3.value = addDISH3.value.toFixed(2)) : 0
|
addDISH3.value > 0 ? (addDISH3.value = addDISH3.value.toFixed(2)) : 0
|
||||||
}
|
}
|
||||||
if (isUpPwds.value) {
|
if (isUpPwds.value) {
|
||||||
ElMessageBox.alert('为了您的帐号安全,首次登录必须更改初始密码', '重要提醒', {
|
ElMessageBox.alert('为了您的帐号安全,此次登录必须更改密码', '重要提醒', {
|
||||||
confirmButtonText: 'OK',
|
confirmButtonText: 'OK',
|
||||||
showClose: false,
|
showClose: false,
|
||||||
showCancelButton: false
|
showCancelButton: false
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ const query = ref<any>({
|
||||||
})
|
})
|
||||||
const year = new Date().getFullYear()
|
const year = new Date().getFullYear()
|
||||||
const month = new Date().getMonth()
|
const month = new Date().getMonth()
|
||||||
const jpMonth = (month < 3 ? year - 1 : year) + ''
|
const jpMonth = (month < 4 ? year - 1 : year) + ''
|
||||||
query.value.year = jpMonth
|
query.value.year = jpMonth
|
||||||
const calendar = [4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3]
|
const calendar = [4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3]
|
||||||
const calendarShow = new Date().getMonth() + 1
|
const calendarShow = new Date().getMonth() + 1
|
||||||
|
|
@ -43,8 +43,11 @@ const getCsrSupplier = () => {
|
||||||
try {
|
try {
|
||||||
csrSupplier.value = resData.length
|
csrSupplier.value = resData.length
|
||||||
? resData.map((key) => {
|
? resData.map((key) => {
|
||||||
const obj = data[key] || {}
|
const arr = String(key).split('-')
|
||||||
const month = String(key).split('-')?.[1] || ''
|
const month = arr?.[1] || ''
|
||||||
|
// const year = arr?.[0] || ''
|
||||||
|
const obj =
|
||||||
|
data[+month < 4 ? +req.year + 1 + '-' + month : req.year + '-' + month] || {}
|
||||||
Object.assign(csrSupplierObj.value[month], obj)
|
Object.assign(csrSupplierObj.value[month], obj)
|
||||||
return {
|
return {
|
||||||
key,
|
key,
|
||||||
|
|
@ -173,19 +176,17 @@ getCsrSupplierTaskInfo()
|
||||||
<el-col :span="8" v-for="(it, i) in months" :key="i">
|
<el-col :span="8" v-for="(it, i) in months" :key="i">
|
||||||
<div
|
<div
|
||||||
v-show="!loading"
|
v-show="!loading"
|
||||||
:class="i <= nowIndexMonth && query.year == jpMonth ? 'times' : 'time'"
|
:class="csrSupplierObj[it]?.submitedCount !== undefined ? 'times' : 'time'"
|
||||||
@click="handleMonth(i)"
|
@click="handleMonth(i)"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
v-if="i > nowIndexMonth || query.year != jpMonth"
|
v-if="csrSupplierObj[it]?.submitedCount === undefined"
|
||||||
class="text-#d3d2d2 text-18px font-bold absolute left-40% top-45%"
|
class="text-#d3d2d2 text-18px font-bold absolute left-40% top-45%"
|
||||||
>
|
>
|
||||||
<span class="text-60px">{{ +it }}</span
|
<span class="text-60px">{{ +it }}</span
|
||||||
>月
|
>月
|
||||||
</div>
|
</div>
|
||||||
<template
|
<template v-if="csrSupplierObj[it]?.submitedCount !== undefined">
|
||||||
v-if="i <= nowIndexMonth && (query.year == jpMonth || !!csrSupplierObj[it])"
|
|
||||||
>
|
|
||||||
<div class="text-#fff text-18px font-bold absolute left-40% top-24px">
|
<div class="text-#fff text-18px font-bold absolute left-40% top-24px">
|
||||||
<span class="text-24px">{{ +it }}</span
|
<span class="text-24px">{{ +it }}</span
|
||||||
>月
|
>月
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,9 +1,10 @@
|
||||||
<!-- 外部情报 -->
|
<!-- 外部情报 -->
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
// import Vue3Tinymce from '@jsdawn/vue3-tinymce';
|
// import Vue3Tinymce from '@jsdawn/vue3-tinymce';
|
||||||
import HomeHead from "@/views/home/components/HomeHead.vue";
|
import HomeHead from '@/views/home/components/HomeHead.vue'
|
||||||
|
import UserPage from '../../../home/intelligence/process/UserPages.vue'
|
||||||
// import HomeHeadSearch from '@/views/home/components/HomeHeadSearch.vue'
|
// import HomeHeadSearch from '@/views/home/components/HomeHeadSearch.vue'
|
||||||
import { useDate } from "@/views/home/hooks/useDate";
|
import { useDate } from '@/views/home/hooks/useDate'
|
||||||
import {
|
import {
|
||||||
NModal,
|
NModal,
|
||||||
NForm,
|
NForm,
|
||||||
|
|
@ -14,37 +15,37 @@ import {
|
||||||
NSelect,
|
NSelect,
|
||||||
NSpace,
|
NSpace,
|
||||||
NRadioGroup,
|
NRadioGroup,
|
||||||
useMessage,
|
useMessage
|
||||||
// FormInst,
|
// FormInst,
|
||||||
} from "naive-ui";
|
} from 'naive-ui'
|
||||||
import { saveArticle, trendsDetail } from "@/api/daikin/base";
|
import { saveArticle, trendsDetail } from '@/api/daikin/base'
|
||||||
import Editor from "../components/TinyECE.vue";
|
import Editor from '../components/TinyECE.vue'
|
||||||
import { useUserStore } from "@/stores/modules/user";
|
import { useUserStore } from '@/stores/modules/user'
|
||||||
import { useRoute } from "vue-router";
|
import { useRoute } from 'vue-router'
|
||||||
const { day, week } = useDate();
|
const { day, week } = useDate()
|
||||||
const { push } = useRouter();
|
const { push } = useRouter()
|
||||||
const store = useUserStore();
|
const store = useUserStore()
|
||||||
let route = useRoute();
|
let route = useRoute()
|
||||||
let cate = ref(1);
|
let cate = ref(1)
|
||||||
const fileList = ref<[]>();
|
const fileList = ref<[]>()
|
||||||
const editorContent = ref("");
|
const editorContent = ref('')
|
||||||
const formRef = ref<any | null>(null);
|
const formRef = ref<any | null>(null)
|
||||||
const message = useMessage();
|
const message = useMessage()
|
||||||
|
|
||||||
const formValue: any = ref({
|
const formValue: any = ref({
|
||||||
type: "1",
|
type: '1',
|
||||||
cate: "1",
|
cate: '1',
|
||||||
title: "",
|
title: '',
|
||||||
tag: "",
|
tag: '',
|
||||||
source: "",
|
source: '',
|
||||||
content: "",
|
content: '',
|
||||||
reviewSource: "2",
|
reviewSource: '2'
|
||||||
});
|
})
|
||||||
|
|
||||||
if (route.query.id) {
|
if (route.query.id) {
|
||||||
trendsDetail(route.query.id).then((res) => {
|
trendsDetail(route.query.id).then((res) => {
|
||||||
let data = res.data;
|
let data = res.data
|
||||||
console.log(res);
|
console.log(res)
|
||||||
formValue.value = {
|
formValue.value = {
|
||||||
type: data.type,
|
type: data.type,
|
||||||
cate: data.cate,
|
cate: data.cate,
|
||||||
|
|
@ -52,34 +53,34 @@ if (route.query.id) {
|
||||||
tag: data.tag,
|
tag: data.tag,
|
||||||
source: data.source,
|
source: data.source,
|
||||||
content: unescapeHTML(data.content),
|
content: unescapeHTML(data.content),
|
||||||
reviewSource: data.reviewSource,
|
reviewSource: data.reviewSource
|
||||||
};
|
}
|
||||||
editorContent.value = unescapeHTML(data.content);
|
editorContent.value = unescapeHTML(data.content)
|
||||||
|
|
||||||
if (data.type === 2) {
|
if (data.type === 2) {
|
||||||
cate.value = 3;
|
cate.value = 3
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
console.log(cate.value, data.cate);
|
console.log(cate.value, data.cate)
|
||||||
rules = {
|
rules = {
|
||||||
title: {
|
title: {
|
||||||
required: false,
|
required: false,
|
||||||
message: "请输入标题",
|
message: '请输入标题',
|
||||||
trigger: "blur",
|
trigger: 'blur'
|
||||||
},
|
},
|
||||||
tag: {
|
tag: {
|
||||||
required: true,
|
required: true,
|
||||||
message: "请输入标题",
|
message: '请输入标题',
|
||||||
trigger: "blur",
|
trigger: 'blur'
|
||||||
},
|
},
|
||||||
|
|
||||||
content: {
|
content: {
|
||||||
required: false,
|
required: false,
|
||||||
message: "请输入内容",
|
message: '请输入内容',
|
||||||
trigger: "blur",
|
trigger: 'blur'
|
||||||
},
|
}
|
||||||
};
|
}
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
let rules: any = {
|
let rules: any = {
|
||||||
// cate: {
|
// cate: {
|
||||||
|
|
@ -89,123 +90,143 @@ let rules: any = {
|
||||||
// },
|
// },
|
||||||
title: {
|
title: {
|
||||||
required: false,
|
required: false,
|
||||||
message: "请输入标题",
|
message: '请输入标题',
|
||||||
trigger: "blur",
|
trigger: 'blur'
|
||||||
},
|
},
|
||||||
tag: {
|
tag: {
|
||||||
required: true,
|
required: true,
|
||||||
message: "请输入标题",
|
message: '请输入标题',
|
||||||
trigger: "blur",
|
trigger: 'blur'
|
||||||
},
|
},
|
||||||
|
|
||||||
content: {
|
content: {
|
||||||
required: false,
|
required: false,
|
||||||
message: "请输入内容",
|
message: '请输入内容',
|
||||||
trigger: "blur",
|
trigger: 'blur'
|
||||||
},
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
function change(i: any) {
|
function change(i: any) {
|
||||||
// console.log(i)
|
// console.log(i)
|
||||||
cate.value = i;
|
cate.value = i
|
||||||
// console.log(formValue.cate)
|
// console.log(formValue.cate)
|
||||||
formValue.cate = i;
|
formValue.cate = i
|
||||||
// console.log(formValue.cate)
|
// console.log(formValue.cate)
|
||||||
}
|
}
|
||||||
function sure(e: MouseEvent) {
|
function sure(e: MouseEvent) {
|
||||||
e.preventDefault();
|
e.preventDefault()
|
||||||
formRef.value?.validate((errors) => {
|
formRef.value?.validate((errors) => {
|
||||||
if (!errors) {
|
if (!errors) {
|
||||||
formValue.value.cate = cate.value;
|
formValue.value.cate = cate.value
|
||||||
if (!formValue.value.type) {
|
if (!formValue.value.type) {
|
||||||
message.success("请选择类型");
|
message.success('请选择类型')
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
// console.log('我草555555', editorContent.value);
|
// console.log('我草555555', editorContent.value);
|
||||||
save();
|
save()
|
||||||
} else {
|
} else {
|
||||||
console.log(errors);
|
console.log(errors)
|
||||||
message.error("请输入完整");
|
message.error('请输入完整')
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function escapeHTML(html: string): string {
|
function escapeHTML(html: string): string {
|
||||||
const tempElement = document.createElement("div");
|
const tempElement = document.createElement('div')
|
||||||
tempElement.textContent = html;
|
tempElement.textContent = html
|
||||||
return tempElement.innerHTML;
|
return tempElement.innerHTML
|
||||||
}
|
}
|
||||||
function unescapeHTML(html: string) {
|
function unescapeHTML(html: string) {
|
||||||
const doc = new DOMParser().parseFromString(html, "text/html");
|
const doc = new DOMParser().parseFromString(html, 'text/html')
|
||||||
return doc.documentElement.textContent;
|
return doc.documentElement.textContent
|
||||||
}
|
}
|
||||||
const header = { token: store.user.token };
|
const header = { token: store.user.token }
|
||||||
// console.log(store.user.token)
|
// console.log(store.user.token)
|
||||||
|
|
||||||
const dialogImageUrl = ref("");
|
const dialogImageUrl = ref('')
|
||||||
const dialogVisible = ref(false);
|
const dialogVisible = ref(false)
|
||||||
|
|
||||||
const handleRemove: UploadProps["onRemove"] = (
|
const handleRemove: UploadProps['onRemove'] = (uploadFile: any, uploadFiles: any) => {
|
||||||
uploadFile: any,
|
|
||||||
uploadFiles: any
|
|
||||||
) => {
|
|
||||||
// console.log(dialogImageUrl,dialogVisible)
|
// console.log(dialogImageUrl,dialogVisible)
|
||||||
};
|
}
|
||||||
|
|
||||||
const handlePictureCardPreview: UploadProps["onPreview"] = (uploadFile: {
|
const handlePictureCardPreview: UploadProps['onPreview'] = (uploadFile: { url: string }) => {
|
||||||
url: string;
|
dialogImageUrl.value = uploadFile.url!
|
||||||
}) => {
|
dialogVisible.value = true
|
||||||
dialogImageUrl.value = uploadFile.url!;
|
|
||||||
dialogVisible.value = true;
|
|
||||||
// console.log(dialogImageUrl.value)
|
// console.log(dialogImageUrl.value)
|
||||||
};
|
}
|
||||||
async function save() {
|
async function save() {
|
||||||
const cont = editorContent.value;
|
const cont = editorContent.value
|
||||||
const content = escapeHTML(cont);
|
const content = escapeHTML(cont)
|
||||||
const reviewSource = 2;
|
const reviewSource = 2
|
||||||
// console.log(fileList.value)
|
// console.log(fileList.value)
|
||||||
let bannerImg;
|
let bannerImg
|
||||||
if (fileList.value && fileList.value.length > 0) {
|
if (fileList.value && fileList.value.length > 0) {
|
||||||
bannerImg = fileList.value.map((item) => item.response.url).join("");
|
bannerImg = fileList.value.map((item) => item.response.url).join('')
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
console.log(formValue.value);
|
let userIdList: any[] = []
|
||||||
|
if (dataList.value?.length > 0) {
|
||||||
|
dataList.value.forEach((i: { userId: any }) => {
|
||||||
|
userIdList.push(i.userId)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const { title, tag, source, cate, type } = formValue.value;
|
const { title, tag, source, cate, type } = formValue.value
|
||||||
console.log(cate);
|
console.log(cate)
|
||||||
const { msg, code } = await saveArticle({
|
const { msg, code } = await saveArticle({
|
||||||
title,
|
title,
|
||||||
tag: "",
|
tag: '',
|
||||||
reviewSource,
|
reviewSource,
|
||||||
source,
|
source,
|
||||||
cate: formValue.cate || formValue.value.cate,
|
cate: formValue.cate || formValue.value.cate,
|
||||||
type,
|
type,
|
||||||
content,
|
content,
|
||||||
bannerImg,
|
bannerImg,
|
||||||
});
|
userIdList
|
||||||
|
})
|
||||||
if (code === 200) {
|
if (code === 200) {
|
||||||
message.success("新增成功");
|
message.success('新增成功')
|
||||||
// window.location.reload();
|
// window.location.reload();
|
||||||
history.back();
|
history.back()
|
||||||
} else {
|
} else {
|
||||||
message.success(msg);
|
message.success(msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取子组件传过来的值
|
// 获取子组件传过来的值
|
||||||
const handleChild = (data: string) => {
|
const handleChild = (data: string) => {
|
||||||
editorContent.value = data;
|
editorContent.value = data
|
||||||
};
|
}
|
||||||
|
|
||||||
const radios = (e: any) => {
|
const radios = (e: any) => {
|
||||||
console.log(e.srcElement.value);
|
console.log(e.srcElement.value)
|
||||||
if (e.srcElement.value === "1") {
|
if (e.srcElement.value === '1') {
|
||||||
cate.value = 1;
|
cate.value = 1
|
||||||
} else {
|
} else {
|
||||||
cate.value = 4;
|
cate.value = 4
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
const showModal = ref(false);
|
const showModal = ref(false)
|
||||||
|
const showModal1 = ref(false)
|
||||||
|
|
||||||
|
const setUserList = ref()
|
||||||
|
const dataList = ref()
|
||||||
|
const thisClick = () => {
|
||||||
|
showModal1.value = true
|
||||||
|
setUserList.value = dataList.value || []
|
||||||
|
}
|
||||||
|
const CloseThis = (data: boolean) => {
|
||||||
|
showModal1.value = data
|
||||||
|
}
|
||||||
|
const handleChild1 = (data: any) => {
|
||||||
|
const { showModal: show, multipleSelection } = data
|
||||||
|
showModal1.value = unref(show)
|
||||||
|
dataList.value = unref(multipleSelection)
|
||||||
|
}
|
||||||
|
const handleClose = (tag: any) => {
|
||||||
|
dataList.value.splice(dataList.value.indexOf(tag), 1)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -332,16 +353,33 @@ const showModal = ref(false);
|
||||||
<n-input v-model:value="formValue.source" placeholder="" />
|
<n-input v-model:value="formValue.source" placeholder="" />
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
<n-form-item label="情报内容" path="content">
|
<n-form-item label="情报内容" path="content">
|
||||||
<Editor
|
<Editor @getChildData="handleChild" v-model="formValue.content"></Editor>
|
||||||
@getChildData="handleChild"
|
|
||||||
v-model="formValue.content"
|
|
||||||
></Editor>
|
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
|
<n-button @click="thisClick"> 情报公开范围 </n-button>
|
||||||
|
<div class="mt15px h150px overflow-y-auto">
|
||||||
|
<el-tag
|
||||||
|
v-for="i in dataList"
|
||||||
|
:key="i"
|
||||||
|
class="mx-1 my5px"
|
||||||
|
closable
|
||||||
|
:disable-transitions="false"
|
||||||
|
@close="handleClose(i)"
|
||||||
|
type="info"
|
||||||
|
size="large"
|
||||||
|
>
|
||||||
|
{{ i.nickName }}
|
||||||
|
</el-tag>
|
||||||
|
</div>
|
||||||
<n-form-item>
|
<n-form-item>
|
||||||
<div>
|
<div>
|
||||||
<n-button @click="showModal = true"> 文本内容预览</n-button>
|
<n-button @click="showModal = true"> 文本内容预览</n-button>
|
||||||
</div>
|
</div>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
|
<!-- <n-form-item>
|
||||||
|
<div>
|
||||||
|
<el-button type="primary" @click="thisClick"> {{'查看范围'}}</el-button>
|
||||||
|
</div>
|
||||||
|
</n-form-item> -->
|
||||||
</n-form>
|
</n-form>
|
||||||
<n-button
|
<n-button
|
||||||
attr-type="button"
|
attr-type="button"
|
||||||
|
|
@ -354,12 +392,19 @@ const showModal = ref(false);
|
||||||
</div>
|
</div>
|
||||||
<n-modal v-model:show="showModal">
|
<n-modal v-model:show="showModal">
|
||||||
<div class="flex w80% p30px bg-#fff my40px rounded-30px">
|
<div class="flex w80% p30px bg-#fff my40px rounded-30px">
|
||||||
<div
|
<div class="overflow-y-auto h800px container" v-html="editorContent"></div>
|
||||||
class="overflow-y-auto h800px container"
|
|
||||||
v-html="editorContent"
|
|
||||||
></div>
|
|
||||||
</div>
|
</div>
|
||||||
</n-modal>
|
</n-modal>
|
||||||
|
<n-modal v-model:show="showModal1">
|
||||||
|
<!-- <n-card style="width:1100px; height: 800px;" title="调达中心" :bordered="false" size="huge" role="dialog"
|
||||||
|
aria-modal="true"> -->
|
||||||
|
<UserPage
|
||||||
|
:userDataList="setUserList"
|
||||||
|
@clickChild="handleChild1"
|
||||||
|
@CloseThis="CloseThis"
|
||||||
|
></UserPage>
|
||||||
|
<!-- </n-card> -->
|
||||||
|
</n-modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
|
|
|
||||||
|
|
@ -68,9 +68,17 @@ const num = ['', '第一周', '第二周', '第三周', '第四周', '第五周'
|
||||||
function groupDatesByWeek(dates = [], weekStartDay = 1) {
|
function groupDatesByWeek(dates = [], weekStartDay = 1) {
|
||||||
return dates.reduce((acc: any, item: any) => {
|
return dates.reduce((acc: any, item: any) => {
|
||||||
const date = dayjs(item.createTime)
|
const date = dayjs(item.createTime)
|
||||||
const weekStart = date.startOf('week').add(weekStartDay, 'day').format('MM月DD日')
|
const weekday = date.day() // 获取目标日期的星期几(0表示周日,1表示周一,依此类推)
|
||||||
|
// 计算到本周周一的距离
|
||||||
|
const mondayDistance = (weekday + 6) % 7
|
||||||
|
// 计算到本周周日的距离
|
||||||
|
const sundayDistance = 7 - mondayDistance - 1
|
||||||
|
// 获取本周周一和周日的日期
|
||||||
|
const weekStart = date.subtract(mondayDistance, 'day').format('MM月DD日')
|
||||||
|
const weekEnd = date.add(sundayDistance, 'day').format('MM月DD日')
|
||||||
|
// const weekStart = date.startOf('week').add(weekStartDay, 'day').format('MM月DD日')
|
||||||
|
// const weekEnd = date.endOf('week').add(weekStartDay, 'day').format('MM月DD日')
|
||||||
item.date = date.format('YYYY-MM-DD')
|
item.date = date.format('YYYY-MM-DD')
|
||||||
const weekEnd = date.endOf('week').add(weekStartDay, 'day').format('MM月DD日')
|
|
||||||
const week = getWeekOfMonth(date)
|
const week = getWeekOfMonth(date)
|
||||||
const month = date.format('MM')
|
const month = date.format('MM')
|
||||||
const key = `${+month}月 ${num[week]} ( ${weekStart} - ${weekEnd} )`
|
const key = `${+month}月 ${num[week]} ( ${weekStart} - ${weekEnd} )`
|
||||||
|
|
@ -132,7 +140,6 @@ const codePath = {
|
||||||
const goModule = (item, type) => {
|
const goModule = (item, type) => {
|
||||||
const { moduleCode, id, cateId } = item
|
const { moduleCode, id, cateId } = item
|
||||||
const { modulePath, path } = codePath[moduleCode]
|
const { modulePath, path } = codePath[moduleCode]
|
||||||
console.log('🚀 ~ file: News.vue:128 ~ modulePath, path:', modulePath, path)
|
|
||||||
if (modulePath) {
|
if (modulePath) {
|
||||||
if (type === 'module') {
|
if (type === 'module') {
|
||||||
push(modulePath)
|
push(modulePath)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue