diff --git a/package.json b/package.json
index b90c11d..20e1a57 100644
--- a/package.json
+++ b/package.json
@@ -18,6 +18,7 @@
"core-js": "3.6.5",
"element-ui": "2.13.2",
"js-cookie": "2.2.0",
+ "moment": "^2.29.1",
"node-sass": "^4.14.1",
"normalize.css": "7.0.0",
"nprogress": "0.2.0",
diff --git a/src/main.js b/src/main.js
index 79bd1fe..33b4bc3 100644
--- a/src/main.js
+++ b/src/main.js
@@ -5,6 +5,7 @@ import 'normalize.css/normalize.css' // A modern alternative to CSS resets
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// import locale from 'element-ui/lib/locale/lang/en' // lang i18n
+import moment from 'moment'
import '@/styles/index.scss' // global css
@@ -32,6 +33,8 @@ Vue.use(ElementUI)
// 如果想要中文版 element-ui,按如下方式声明
// Vue.use(ElementUI)
+Vue.prototype.$moment = moment
+
Vue.config.productionTip = false
new Vue({
diff --git a/src/utils/request.js b/src/utils/request.js
index 6561fff..707dc93 100644
--- a/src/utils/request.js
+++ b/src/utils/request.js
@@ -30,7 +30,7 @@ service.interceptors.response.use(
// if the custom code is not 20000, it is judged as an error.
if (res.code !== 200) {
Message({
- message: res.message || 'Error',
+ message: res.msg || 'Error',
type: 'error',
duration: 5 * 1000
})
@@ -48,7 +48,7 @@ service.interceptors.response.use(
})
})
}
- return Promise.reject(new Error(res.message || 'Error'))
+ return Promise.reject(new Error(res.msg || 'Error'))
} else {
return res.data
}
@@ -56,7 +56,7 @@ service.interceptors.response.use(
error => {
console.log('err' + error) // for debug
Message({
- message: error.message,
+ message: error.msg,
type: 'error',
duration: 5 * 1000
})
diff --git a/src/views/firstPages/policy.vue b/src/views/firstPages/policy.vue
index 3a692f0..40b9b67 100644
--- a/src/views/firstPages/policy.vue
+++ b/src/views/firstPages/policy.vue
@@ -195,7 +195,12 @@
-
+
-
@@ -240,7 +238,7 @@
-
+
-
+
-
+
@@ -376,7 +368,7 @@
import { mapGetters } from 'vuex'
import * as api from '@/api/policy'
import Pagination from '@/components/Pagination' // secondary package based on el-pagination
-
+import { Message } from 'element-ui'
export default {
name: 'Policy',
components: { Pagination },
@@ -421,23 +413,33 @@ export default {
pushDep: ''
},
options: [{
- value: '0',
+ value: 0,
label: '部委政策'
}, {
- value: '1',
+ value: 1,
label: '省政策'
}, {
- value: '2',
+ value: 2,
label: '市政策'
}, {
- value: '3',
+ value: 3,
label: '区政策'
}],
contentDetail: '',
projectLabels: [],
value: '',
value1: '',
- publishTime: ''
+ publishTime: '',
+ warning: {
+ title: '政策标题',
+ publishTime: '发布时间',
+ titleUrl: '原文链接',
+ imgUrl: '图片路径',
+ content: '原文内容',
+ pushDep: '发布部门',
+ intro: '政策简介'
+
+ }
}
},
computed: {
@@ -453,6 +455,10 @@ export default {
},
methods: {
+ changePushDep(e) {
+ this.temp.pushDep = e
+ },
+
// 原先的发布部门
// handleChange(value) {
// this.temp.pushDep = value[value.length - 1]
@@ -551,12 +557,15 @@ export default {
// i -= 1
// }
// }
+ // console.log(that.temp.publishTime)
+ const time1 = document.getElementById('TimeUpdate').value
+ var str = time1.replace(/-/g, '/')
+ that.temp.publishTime = str
+ console.log(time1)
+ console.log(this.$moment(that.temp.publishTime).format('YYYY-MM-DD'))
- console.log(that.temp.publishTime)
- that.temp.publishTime = that.temp.publishTime.replaceAll('/', '-')
- // that.temp.pushDep = that.value
+ // that.temp.publishTime = this.$moment(that.temp.publishTime).format('YYYY-MM-DD')
- // that.temp.projectLabels = this.value1
console.log('commit=========>', that.temp)
await api.PolicyUpdate(that.temp).then(res => {
this.getList()
@@ -565,12 +574,18 @@ export default {
})
},
async handleModifyStatus(detail, num) {
+ console.log(detail)
this.listLoading = true
detail.auditStatus = num
await api.PolicyUpdate(detail).then(res => {
this.cascader = ''
this.listLoading = false
})
+ .catch(err => {
+ console.log(err)
+ this.listLoading = false
+ detail.auditStatus = 0
+ })
},
async handleDelete(id) {
await api.PolicyDelete(id).then(res => {
@@ -582,26 +597,34 @@ export default {
for (const key in that.addPolicy) {
that.addPolicy[key] = ''
}
- that.addPolicy.publishTime = new Date()
+ // that.addPolicy.publishTime = new Date()
that.dialogFormVisible1 = true
},
async CommitAdd() {
const that = this
- that.addPolicy.pushDep = this.value
+
+ // that.addPolicy.pushDep = this.value
var Content = document.getElementById('Content')
var Time = document.getElementById('Time').value
that.addPolicy.content = Content.innerHTML
var str = Time.replace(/-/g, '/')
that.addPolicy.publishTime = str
for (const key in that.addPolicy) {
+ console.log(key)
if (that.addPolicy[key] === '') {
- alert(key + '不能为空')
+ Message({
+ message: that.warning[key] + ' 不能为空',
+ type: 'error',
+ duration: 3 * 1000
+ })
return
}
}
+ console.log('CommitAdd', that.addPolicy)
api.PolicyAdd(that.addPolicy).then(res => {
this.value = ''
that.dialogFormVisible1 = false
+ this.getList()
})
}
// addLabel() {