|
@@ -1,43 +1,74 @@
|
|
|
// 定义一个名为 button-counter 的新组件
|
|
|
Vue.component('button-counter', {
|
|
|
props: ['title'],
|
|
|
- data () {
|
|
|
+ data() {
|
|
|
return {
|
|
|
count: 0
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
addCount() {
|
|
|
- this.count++
|
|
|
+ this.count++
|
|
|
}
|
|
|
},
|
|
|
template: '<button @click="addCount">{{ title }} : You clicked me {{ count }} times.</button>'
|
|
|
})
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
var app = new Vue({
|
|
|
el: '#app',
|
|
|
data: {
|
|
|
+
|
|
|
//公共
|
|
|
id: null,
|
|
|
- columnList:[],
|
|
|
- currentPath:'',
|
|
|
+ columnList: [],
|
|
|
+ currentPath: '',
|
|
|
articalArray: [], //详情数组
|
|
|
columnTypes: [], //栏目类型
|
|
|
|
|
|
- //首页
|
|
|
- homeList: [],
|
|
|
- status: false,
|
|
|
+ // 公共弹框
|
|
|
+ centerDialogVisible: false,
|
|
|
+ dialogDataArray:[],
|
|
|
+ ruleForm: {
|
|
|
+ platName: '智慧安防',
|
|
|
+ consultName: '',
|
|
|
+ consultPhone: '',
|
|
|
+ mail: '',
|
|
|
+ company: '',
|
|
|
+ consultContent: "",
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ platName: [{
|
|
|
+ required: true,
|
|
|
+ message: '请选择类型',
|
|
|
+ trigger: 'change'
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ consultName: [{
|
|
|
+ required: true,
|
|
|
+ message: '请输入姓名',
|
|
|
+ trigger: 'blur'
|
|
|
+ }, ],
|
|
|
+ consultPhone: [{
|
|
|
+ required: true,
|
|
|
+ message: '请输入正确的电话号码',
|
|
|
+ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
|
|
|
+ trigger: 'change'
|
|
|
+ }],
|
|
|
+ mail: [{
|
|
|
+ required: false,
|
|
|
+ type: "email",
|
|
|
+ message: "请输入正确的邮箱地址",
|
|
|
+ trigger: 'blur'
|
|
|
+ }],
|
|
|
+ },
|
|
|
|
|
|
- //解决方案旧
|
|
|
- array: [],
|
|
|
|
|
|
|
|
|
+
|
|
|
+ //首页
|
|
|
+ homeList: [],
|
|
|
+ status: false,
|
|
|
// 新闻
|
|
|
news: [],
|
|
|
goPage: 1,
|
|
@@ -47,136 +78,127 @@ var app = new Vue({
|
|
|
totalPageSzie: 4,
|
|
|
loading: true,
|
|
|
|
|
|
+
|
|
|
+ //解决方案旧
|
|
|
+ array: [],
|
|
|
//新闻详情旧
|
|
|
articleInfo: {},
|
|
|
previousInfo: {},
|
|
|
nextInfo: {},
|
|
|
relativeArr: [],
|
|
|
ariticle_id: 0,
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
},
|
|
|
+
|
|
|
computed: {
|
|
|
+
|
|
|
// 新闻详情旧
|
|
|
- isNews: function() {
|
|
|
+ isNews: function () {
|
|
|
return (this.articleInfo.type == 1);
|
|
|
},
|
|
|
- hasPrevious: function() {
|
|
|
- return Object.keys(this.previousInfo).length > 0;
|
|
|
+ hasPrevious: function () {
|
|
|
+ return Object.keys(this.previousInfo).length > 0;
|
|
|
},
|
|
|
- hasNext: function() {
|
|
|
- return Object.keys(this.nextInfo).length > 0;
|
|
|
+ hasNext: function () {
|
|
|
+ return Object.keys(this.nextInfo).length > 0;
|
|
|
}
|
|
|
|
|
|
|
|
|
},
|
|
|
created: function () {
|
|
|
this.ariticle_id = this.getQuery('id')
|
|
|
- // this.title = this.getQuery('title')?this.getQuery('title'):''
|
|
|
- this.title = this.getQuery('title')?this.getQuery('title'):''
|
|
|
+ this.title = this.getQuery('title') ? this.getQuery('title') : ''
|
|
|
|
|
|
},
|
|
|
mounted: function () {
|
|
|
_this = this
|
|
|
-
|
|
|
this.getColumnData()
|
|
|
|
|
|
-
|
|
|
-
|
|
|
},
|
|
|
methods: {
|
|
|
|
|
|
//获取栏目
|
|
|
getColumnData() {
|
|
|
- this.columnTypes= []
|
|
|
+ this.columnTypes = []
|
|
|
$.ajax({
|
|
|
type: 'get',
|
|
|
dataType: 'json',
|
|
|
url: window.FQDN2 + 'siteCategory/siteCategoryList',
|
|
|
}).done(function (res) {
|
|
|
-
|
|
|
- _this.columnList=res.data;
|
|
|
- _this.currentPath=window.location.pathname
|
|
|
-
|
|
|
+ _this.columnList = res.data;
|
|
|
+ _this.currentPath = window.location.pathname
|
|
|
for (let i = 0; i < res.data.length; i++) {
|
|
|
// console.log(res.data[i].sname)
|
|
|
// console.log(window.location.pathname)
|
|
|
-
|
|
|
- if (res.data[i].categoryName == '首页'&& window.location.pathname=='/index.html') {
|
|
|
- //首页旧
|
|
|
- jQuery.ajax({
|
|
|
- type: 'POST',
|
|
|
- dataType: 'json',
|
|
|
- url: window.FQDN + 'Index/index',
|
|
|
- }).done(function (res) {
|
|
|
- _this.homeList = res
|
|
|
- _this.status = true
|
|
|
-
|
|
|
-
|
|
|
- }).fail(function (err) {});
|
|
|
+
|
|
|
+
|
|
|
+ if (res.data[i].categoryName == '首页' && window.location.pathname == '/index.html') {
|
|
|
+ //首页旧
|
|
|
+ jQuery.ajax({
|
|
|
+ type: 'POST',
|
|
|
+ dataType: 'json',
|
|
|
+ url: window.FQDN + 'Index/index',
|
|
|
+ }).done(function (res) {
|
|
|
+ _this.homeList = res
|
|
|
+ _this.status = true
|
|
|
+ }).fail(function (err) {});
|
|
|
}
|
|
|
- if (res.data[i].categoryName == '产品服务'&& window.location.pathname=='/product/read.html') {
|
|
|
-
|
|
|
- _this.currentPath='/product/index.html' //新闻详情时栏目高亮
|
|
|
+ if (res.data[i].categoryName == '产品服务' && window.location.pathname == '/product/read.html') {
|
|
|
+ _this.currentPath = '/product/index.html' //产品详情时栏目高亮
|
|
|
+ }
|
|
|
+ if (res.data[i].categoryName == '解决方案') {
|
|
|
+ _this.dialogDataArray=(res.data[i].children)
|
|
|
+ _this.ruleForm.platName= _this.dialogDataArray[0].categoryName
|
|
|
}
|
|
|
|
|
|
- if (res.data[i].categoryName == '新闻动态'&& window.location.pathname=='/news/read.html') {
|
|
|
-
|
|
|
- _this.currentPath='/news/index.html' //新闻详情时栏目高亮
|
|
|
-
|
|
|
- console.log(res.data[i].categoryName)
|
|
|
-
|
|
|
+ if (res.data[i].categoryName == '新闻动态' && window.location.pathname == '/news/read.html') {
|
|
|
+ _this.currentPath = '/news/index.html' //新闻详情时栏目高亮
|
|
|
//新闻详情旧
|
|
|
- jQuery.ajax({
|
|
|
- type: 'POST',
|
|
|
- dataType: 'json',
|
|
|
- url: window.FQDN + 'agw/journalism_details',
|
|
|
- data: {
|
|
|
- id: 154
|
|
|
- }
|
|
|
- }).done(function(res) {
|
|
|
- if (!res.msg) {
|
|
|
- return;
|
|
|
- }
|
|
|
- _this.loading = false;
|
|
|
- _this.articleInfo = res;
|
|
|
- _this.relativeArr = res.related;
|
|
|
- console.log(_this.relativeArr)
|
|
|
-
|
|
|
- if (res.previous != null) {
|
|
|
- _this.previousInfo = res.previous;
|
|
|
- }
|
|
|
- if (res.next != null) {
|
|
|
- _this.nextInfo = res.next;
|
|
|
- }
|
|
|
-
|
|
|
- }).fail(function(err) {});
|
|
|
+ jQuery.ajax({
|
|
|
+ type: 'POST',
|
|
|
+ dataType: 'json',
|
|
|
+ url: window.FQDN + 'agw/journalism_details',
|
|
|
+ data: {
|
|
|
+ id: 154
|
|
|
+ }
|
|
|
+ }).done(function (res) {
|
|
|
+ if (!res.msg) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ _this.loading = false;
|
|
|
+ _this.articleInfo = res;
|
|
|
+ _this.relativeArr = res.related;
|
|
|
+ console.log(_this.relativeArr)
|
|
|
+
|
|
|
+ if (res.previous != null) {
|
|
|
+ _this.previousInfo = res.previous;
|
|
|
+ }
|
|
|
+ if (res.next != null) {
|
|
|
+ _this.nextInfo = res.next;
|
|
|
+ }
|
|
|
+
|
|
|
+ }).fail(function (err) {});
|
|
|
}
|
|
|
- if (res.data[i].categoryName == '关于永天'&& window.location.pathname.indexOf('about')>-1) {
|
|
|
-
|
|
|
+ if (res.data[i].categoryName == '关于永天' && window.location.pathname.indexOf('about') > -1) {
|
|
|
_this.columnTypes = res.data[i].children
|
|
|
- // _this.id = _this.columnTypes[0].id;
|
|
|
- _this.getArticalData( _this.getQuery('id'))
|
|
|
-
|
|
|
+ _this.getArticalData(_this.getQuery('id'))
|
|
|
|
|
|
//关于永天旧
|
|
|
- $.ajax({
|
|
|
- type: 'POST',
|
|
|
- dataType: 'json',
|
|
|
- url: window.FQDN + 'Aboutus/index',
|
|
|
- }).done(function(arr) {
|
|
|
- // console.log(arr)
|
|
|
- _this.array = arr;
|
|
|
- }).fail(function(err) {});
|
|
|
+ $.ajax({
|
|
|
+ type: 'POST',
|
|
|
+ dataType: 'json',
|
|
|
+ url: window.FQDN + 'Aboutus/index',
|
|
|
+ }).done(function (arr) {
|
|
|
+ // console.log(arr)
|
|
|
+ _this.array = arr;
|
|
|
+ }).fail(function (err) {});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
if (res.data[i].children.length > 0) {
|
|
|
- if (res.data[i].categoryName == '解决方案'&& window.location.pathname.indexOf('solution')>-1) {
|
|
|
+ if (res.data[i].categoryName == '解决方案' && window.location.pathname.indexOf('solution') > -1) {
|
|
|
_this.columnTypes = res.data[i].children
|
|
|
- _this.id = _this.columnTypes[0].id;
|
|
|
+ _this.id = (_this.getQuery('isTwo') == 1) ? _this.getQuery('id') : _this.columnTypes[0].id;
|
|
|
_this.getArticalData(_this.id)
|
|
|
|
|
|
//解决方案旧
|
|
@@ -192,14 +214,14 @@ var app = new Vue({
|
|
|
console.log(_this.array)
|
|
|
}).fail(function (err) {});
|
|
|
}
|
|
|
- if (res.data[i].categoryName == '新闻动态'&& window.location.pathname.indexOf('news')>-1) {
|
|
|
+ if (res.data[i].categoryName == '新闻动态' && window.location.pathname.indexOf('news') > -1) {
|
|
|
_this.columnTypes = res.data[i].children
|
|
|
- _this.id = _this.columnTypes[0].id;
|
|
|
+ _this.id = (_this.getQuery('isTwo') == 1) ? _this.getQuery('id') : _this.columnTypes[0].id;
|
|
|
_this.getArticalData(_this.id)
|
|
|
}
|
|
|
- if (res.data[i].categoryName == '产品服务'&& window.location.pathname.indexOf('product')>-1) {
|
|
|
+ if (res.data[i].categoryName == '产品服务' && window.location.pathname.indexOf('product') > -1) {
|
|
|
_this.columnTypes = res.data[i].children
|
|
|
- _this.id = _this.columnTypes[0].id;
|
|
|
+ _this.id = (_this.getQuery('isTwo') == 1) ? _this.getQuery('id') : _this.columnTypes[0].id;
|
|
|
_this.getArticalData(_this.id)
|
|
|
}
|
|
|
}
|
|
@@ -215,13 +237,13 @@ var app = new Vue({
|
|
|
url: window.FQDN2 + 'siteArticle/siteArticleList',
|
|
|
data: {
|
|
|
categoryid: param,
|
|
|
- pageNum:_this.currentPageNum,
|
|
|
- pageSize:_this.one_page_size,
|
|
|
- title:_this.title
|
|
|
+ pageNum: _this.currentPageNum,
|
|
|
+ pageSize: _this.one_page_size,
|
|
|
+ title: _this.title
|
|
|
}
|
|
|
}).done(function (res) {
|
|
|
var aa = res.data.records;
|
|
|
-
|
|
|
+
|
|
|
aa.sort(_this.compare("lmtitle"))
|
|
|
_this.loading = false;
|
|
|
_this.articalArray = aa;
|
|
@@ -237,29 +259,74 @@ var app = new Vue({
|
|
|
facilityClick(e, item) {
|
|
|
this.id = item.id
|
|
|
this.getArticalData(item.id)
|
|
|
- this.currentPageNum=1
|
|
|
+ this.currentPageNum = 1
|
|
|
// console.log(item.id)
|
|
|
},
|
|
|
|
|
|
|
|
|
- // 分页
|
|
|
- oneInnerBox: function(param) {
|
|
|
- window.location = "./read.html?id=" + param.categoryid+'&title='+param.title;
|
|
|
- // window.location = "./read.html?id=154"
|
|
|
+ // 分页
|
|
|
+ oneInnerBox: function (param) {
|
|
|
+ window.location = "./read.html?id=" + param.categoryid + '&title=' + param.title;
|
|
|
+ // window.location = "./read.html?id=154"
|
|
|
|
|
|
},
|
|
|
- enterPage: function(res) {
|
|
|
- if (this.goPage >= 1 && this.goPage <= this.totalPageNum) {
|
|
|
- this.currentPageNum = this.goPage
|
|
|
- this.getArticalData(this.id )
|
|
|
+ enterPage: function (res) {
|
|
|
+ if (this.goPage >= 1 && this.goPage <= this.totalPageNum) {
|
|
|
+ this.currentPageNum = this.goPage
|
|
|
+ this.getArticalData(this.id)
|
|
|
+ } else {
|
|
|
+ this.goPage = 1
|
|
|
+ alert('输入页数有误!')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ currentChange: function (res) {
|
|
|
+ this.currentPageNum = res
|
|
|
+ this.getArticalData(this.id)
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ //首页
|
|
|
+ scrollToTop() {
|
|
|
+ window.scrollTo({
|
|
|
+ top: 0,
|
|
|
+ behavior: "smooth"
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ //公共弹框
|
|
|
+ submitForm(formName) {
|
|
|
+ _this = this
|
|
|
+ this.$refs[formName].validate((valid) => {
|
|
|
+
|
|
|
+ if (valid) {
|
|
|
+ console.log(_this.ruleForm)
|
|
|
+ let param = JSON.stringify(_this.ruleForm)
|
|
|
+ jQuery.ajax({
|
|
|
+ type: 'POST',
|
|
|
+ // dataType: 'json',
|
|
|
+ contentType: 'application/json;charset=UTF-8',
|
|
|
+ url: window.FQDN2 + 'siteReview',
|
|
|
+ data: param
|
|
|
+ }).done(function (res) {
|
|
|
+ if (res.status === "SUCCESS") {
|
|
|
+ _this.$message({
|
|
|
+ message: '提交成功',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ _this.centerDialogVisible = false
|
|
|
+
|
|
|
+ _this.$refs[formName].resetFields(); //重置from校验
|
|
|
+ }
|
|
|
+ }).fail(function (err) {});
|
|
|
} else {
|
|
|
- this.goPage = 1
|
|
|
- alert('输入页数有误!')
|
|
|
+ console.log('error submit!!');
|
|
|
+ return false;
|
|
|
}
|
|
|
+ });
|
|
|
},
|
|
|
- currentChange: function(res) {
|
|
|
- this.currentPageNum = res
|
|
|
- this.getArticalData(this.id)
|
|
|
+ resetForm(formName) {
|
|
|
+ this.$refs[formName].resetFields();
|
|
|
+ this.centerDialogVisible = false
|
|
|
},
|
|
|
|
|
|
|
|
@@ -272,35 +339,31 @@ var app = new Vue({
|
|
|
}
|
|
|
},
|
|
|
|
|
|
-
|
|
|
// 获取路由参数
|
|
|
- getQuery(name) {
|
|
|
- var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
|
|
- var r = window.location.search.substr(1).match(reg);
|
|
|
- if (r != null) return decodeURI(r[2]); return null;
|
|
|
- },
|
|
|
-
|
|
|
- //获得年月日时分秒
|
|
|
- //传入日期//例:2020-10-27T14:36:23
|
|
|
- timeFormatSeconds(time) {
|
|
|
- var d = time ? new Date(time) : new Date();
|
|
|
- var year = d.getFullYear();
|
|
|
- var month = d.getMonth() + 1;
|
|
|
- var day = d.getDate();
|
|
|
- var hours = d.getHours();
|
|
|
- var min = d.getMinutes();
|
|
|
- var seconds = d.getSeconds();
|
|
|
-
|
|
|
- if (month < 10) month = '0' + month;
|
|
|
- if (day < 10) day = '0' + day;
|
|
|
- if (hours < 0) hours = '0' + hours;
|
|
|
- if (min < 10) min = '0' + min;
|
|
|
- if (seconds < 10) seconds = '0' + seconds;
|
|
|
-
|
|
|
- return (year + '-' + month + '-' + day + ' ' + hours + ':' + min + ':' + seconds);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
+ getQuery(name) {
|
|
|
+ var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
|
|
+ var r = window.location.search.substr(1).match(reg);
|
|
|
+ if (r != null) return decodeURI(r[2]);
|
|
|
+ return null;
|
|
|
+ },
|
|
|
|
|
|
+ //获得年月日时分秒 //传入日期//例:2020-10-27T14:36:23
|
|
|
+ timeFormatSeconds(time) {
|
|
|
+ var d = time ? new Date(time) : new Date();
|
|
|
+ var year = d.getFullYear();
|
|
|
+ var month = d.getMonth() + 1;
|
|
|
+ var day = d.getDate();
|
|
|
+ var hours = d.getHours();
|
|
|
+ var min = d.getMinutes();
|
|
|
+ var seconds = d.getSeconds();
|
|
|
+
|
|
|
+ if (month < 10) month = '0' + month;
|
|
|
+ if (day < 10) day = '0' + day;
|
|
|
+ if (hours < 0) hours = '0' + hours;
|
|
|
+ if (min < 10) min = '0' + min;
|
|
|
+ if (seconds < 10) seconds = '0' + seconds;
|
|
|
+
|
|
|
+ return (year + '-' + month + '-' + day + ' ' + hours + ':' + min + ':' + seconds);
|
|
|
+ }
|
|
|
}
|
|
|
});
|