|
@@ -1,44 +1,44 @@
|
|
|
-// 定义一个名为 button-counter 的新组件
|
|
|
-Vue.component('button-counter', {
|
|
|
- props: ['title'],
|
|
|
- data() {
|
|
|
- return {
|
|
|
- count: 0
|
|
|
- }
|
|
|
- },
|
|
|
- methods: {
|
|
|
- addCount() {
|
|
|
- this.count++
|
|
|
- }
|
|
|
- },
|
|
|
- template: '<button @click="addCount">{{ title }} : You clicked me {{ count }} times.</button>'
|
|
|
-})
|
|
|
-
|
|
|
-
|
|
|
var app = new Vue({
|
|
|
el: '#app',
|
|
|
data: {
|
|
|
|
|
|
//公共
|
|
|
id: null,
|
|
|
- columnList: [
|
|
|
- {categoryName:'首页',sname:'/index.html',id:1},
|
|
|
- {categoryName:'解决方案',sname:'/solution.html',id:2},
|
|
|
- {categoryName:'产品服务',sname:'/product.html',id:3},
|
|
|
- {categoryName:'新闻动态',sname:'/news.html',id:4},
|
|
|
- {categoryName:'关于永天',sname:'/about.html',id:5},
|
|
|
+ columnList: [{
|
|
|
+ categoryName: '首页',
|
|
|
+ sname: '/index.html',
|
|
|
+ id: 1
|
|
|
+ },
|
|
|
+ {
|
|
|
+ categoryName: '解决方案',
|
|
|
+ sname: '/solution.html',
|
|
|
+ id: 2
|
|
|
+ },
|
|
|
+ {
|
|
|
+ categoryName: '产品服务',
|
|
|
+ sname: '/product.html',
|
|
|
+ id: 3
|
|
|
+ },
|
|
|
+ {
|
|
|
+ categoryName: '新闻动态',
|
|
|
+ sname: '/news.html',
|
|
|
+ id: 4
|
|
|
+ },
|
|
|
+ {
|
|
|
+ categoryName: '关于永天',
|
|
|
+ sname: '/about.html',
|
|
|
+ id: 5
|
|
|
+ },
|
|
|
],
|
|
|
currentPath: '',
|
|
|
articalArray: [], //详情数组
|
|
|
articalArrayRelated: [], //相关新闻
|
|
|
columnTypes: [], //栏目类型
|
|
|
- columnImage:'',//栏目图片
|
|
|
-
|
|
|
-
|
|
|
+ columnImage: '', //栏目图片
|
|
|
|
|
|
// 公共弹框
|
|
|
centerDialogVisible: false,
|
|
|
- dialogDataArray:[],
|
|
|
+ dialogDataArray: [],
|
|
|
ruleForm: {
|
|
|
platName: '智慧安防',
|
|
|
consultName: '',
|
|
@@ -49,11 +49,10 @@ var app = new Vue({
|
|
|
},
|
|
|
rules: {
|
|
|
platName: [{
|
|
|
- required: true,
|
|
|
- message: '请选择类型',
|
|
|
- trigger: 'change'
|
|
|
- },
|
|
|
- ],
|
|
|
+ required: true,
|
|
|
+ message: '请选择类型',
|
|
|
+ trigger: 'change'
|
|
|
+ }, ],
|
|
|
consultName: [{
|
|
|
required: true,
|
|
|
message: '请输入姓名',
|
|
@@ -74,58 +73,29 @@ var app = new Vue({
|
|
|
},
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
//首页
|
|
|
homeList: [],
|
|
|
status: false,
|
|
|
+
|
|
|
// 新闻
|
|
|
- news: [],
|
|
|
goPage: 1,
|
|
|
totalPageNum: 1,
|
|
|
totalPageSzie: 1,
|
|
|
loading: true,
|
|
|
- categoryid:0,
|
|
|
- requestParams:{
|
|
|
+ categoryid: 0,
|
|
|
+ requestParams: {
|
|
|
categoryid: this.id,
|
|
|
pageNum: 1,
|
|
|
pageSize: 9,
|
|
|
title: ''
|
|
|
-
|
|
|
},
|
|
|
-
|
|
|
-
|
|
|
- //解决方案旧
|
|
|
- array: [],
|
|
|
- //新闻详情旧
|
|
|
- articleInfo: {},
|
|
|
- previousInfo: {},
|
|
|
- nextInfo: {},
|
|
|
- relativeArr: [],
|
|
|
- // ariticle_id: 0,
|
|
|
},
|
|
|
|
|
|
computed: {
|
|
|
-
|
|
|
- // 新闻详情旧
|
|
|
- isNews: function () {
|
|
|
- return (this.articleInfo.type == 1);
|
|
|
- },
|
|
|
- hasPrevious: function () {
|
|
|
- return Object.keys(this.previousInfo).length > 0;
|
|
|
- },
|
|
|
- hasNext: function () {
|
|
|
- return Object.keys(this.nextInfo).length > 0;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
},
|
|
|
created: function () {
|
|
|
this.requestParams.categoryid = this.getQuery('id') ? this.getQuery('id') : ''
|
|
|
-
|
|
|
- // this.ariticle_id = this.getQuery('id')
|
|
|
this.requestParams.title = this.getQuery('title') ? this.getQuery('title') : ''
|
|
|
-
|
|
|
},
|
|
|
mounted: function () {
|
|
|
_this = this
|
|
@@ -145,15 +115,47 @@ var app = new Vue({
|
|
|
_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].sname == window.location.pathname) {
|
|
|
+
|
|
|
+ //进入当前栏目页
|
|
|
+ _this.columnTypes = res.data[i].children
|
|
|
+ if (res.data[i].children.length > 0) {
|
|
|
+ _this.requestParams.categoryid = (_this.getQuery('isUrlId') == 1) ? _this.getQuery('id') : _this.columnTypes[0].id;
|
|
|
+ } else {
|
|
|
+ _this.requestParams.categoryid = _this.getQuery('id')
|
|
|
+ }
|
|
|
+ _this.getArticalData(_this.requestParams)
|
|
|
+ _this.columnImage = res.data[i].imagePath;
|
|
|
+
|
|
|
+ } else {
|
|
|
|
|
|
-
|
|
|
+ // 进入详情页
|
|
|
+ if (res.data[i].sname == '/product/index.html' && window.location.pathname == '/product/read.html') {
|
|
|
+ getDetailCommon()
|
|
|
+ }
|
|
|
+ if (res.data[i].sname == '/solution/index.html' && window.location.pathname == '/solution/read.html') {
|
|
|
+ getDetailCommon()
|
|
|
+ }
|
|
|
+ if (res.data[i].sname == '/news/index.html' && window.location.pathname == '/news/read.html') {
|
|
|
+ getDetailCommon()
|
|
|
+ }
|
|
|
+ function getDetailCommon(){
|
|
|
+ //获取内容详情
|
|
|
+ _this.getArticalData(_this.requestParams)
|
|
|
+ //获取详情相关数据
|
|
|
+ setTimeout(() => {
|
|
|
+ _this.requestParams.title = ''
|
|
|
+ _this.getArticalData(_this.requestParams, 1)
|
|
|
+ }, 1)
|
|
|
+ _this.currentPath = res.data[i].sname //产品详情时栏目高亮
|
|
|
+ _this.columnImage = res.data[i].imagePath; //栏目图片获取
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- if (res.data[i].categoryName == '首页' && window.location.pathname == '/index.html') {
|
|
|
- //首页旧
|
|
|
+ //首页旧
|
|
|
+ if (res.data[i].sname == '/index.html' && window.location.pathname == '/index.html') {
|
|
|
jQuery.ajax({
|
|
|
type: 'POST',
|
|
|
dataType: 'json',
|
|
@@ -163,160 +165,38 @@ var app = new Vue({
|
|
|
_this.status = true
|
|
|
}).fail(function (err) {});
|
|
|
}
|
|
|
- if (res.data[i].categoryName == '产品服务' && window.location.pathname == '/product/read.html') {
|
|
|
- _this.currentPath = '/product/index.html' //产品详情时栏目高亮
|
|
|
- _this.columnImage=res.data[i].imagePath; //栏目图片获取
|
|
|
- setTimeout(()=>{
|
|
|
- _this.requestParams.title=''
|
|
|
- _this.getArticalData( _this.requestParams,1)
|
|
|
- },1)
|
|
|
-
|
|
|
- }
|
|
|
- if (res.data[i].categoryName == '解决方案' && window.location.pathname == '/solution/read.html') {
|
|
|
- _this.currentPath = '/solution/index.html' //产品详情时栏目高亮
|
|
|
- _this.columnImage=res.data[i].imagePath; //栏目图片获取
|
|
|
-
|
|
|
- //获取相关新闻数据
|
|
|
- setTimeout(()=>{
|
|
|
- _this.requestParams.title=''
|
|
|
- _this.getArticalData( _this.requestParams,1)
|
|
|
- },1)
|
|
|
-
|
|
|
- }
|
|
|
- if (res.data[i].categoryName == '解决方案') {
|
|
|
- _this.dialogDataArray=(res.data[i].children)
|
|
|
- _this.ruleForm.platName= _this.dialogDataArray[0].categoryName;
|
|
|
- _this.columnImage=res.data[i].imagePath; //栏目图片获取
|
|
|
- }
|
|
|
-
|
|
|
- if (res.data[i].categoryName == '新闻动态' && window.location.pathname == '/news/read.html') {
|
|
|
- _this.currentPath = '/news/index.html' //新闻详情时栏目高亮
|
|
|
- _this.columnImage=res.data[i].imagePath; //栏目图片获取
|
|
|
|
|
|
- //获取相关新闻数据
|
|
|
- setTimeout(()=>{
|
|
|
- _this.requestParams.title=''
|
|
|
- _this.getArticalData( _this.requestParams,1)
|
|
|
- },1)
|
|
|
-
|
|
|
-
|
|
|
- //新闻详情旧
|
|
|
- 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) {
|
|
|
- _this.columnTypes = res.data[i].children
|
|
|
- _this.requestParams.categoryid=_this.getQuery('id')
|
|
|
- console.log(_this.requestParams)
|
|
|
- _this.getArticalData(_this.requestParams)
|
|
|
- _this.columnImage=res.data[i].imagePath; //栏目图片获取
|
|
|
-
|
|
|
- //关于永天旧
|
|
|
- $.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) {
|
|
|
- _this.columnTypes = res.data[i].children
|
|
|
- _this.requestParams.categoryid = (_this.getQuery('isUrlId') == 1) ? _this.getQuery('id') : _this.columnTypes[0].id;
|
|
|
- _this.getArticalData(_this.requestParams)
|
|
|
-
|
|
|
- //解决方案旧
|
|
|
- $.ajax({
|
|
|
- type: 'POST',
|
|
|
- dataType: 'json',
|
|
|
- url: window.FQDN + 'Solution/index',
|
|
|
- data: {
|
|
|
- id: '1'
|
|
|
- }
|
|
|
- }).done(function (arr) {
|
|
|
- _this.array = arr;
|
|
|
- console.log(_this.array)
|
|
|
- }).fail(function (err) {});
|
|
|
- }
|
|
|
- if (res.data[i].categoryName == '新闻动态' && window.location.pathname.indexOf('news') > -1) {
|
|
|
- _this.columnTypes = res.data[i].children
|
|
|
- _this.requestParams.categoryid = (_this.getQuery('isUrlId') == 1) ? _this.getQuery('id') : _this.columnTypes[0].id;
|
|
|
- _this.getArticalData(_this.requestParams)
|
|
|
- _this.columnImage=res.data[i].imagePath; //栏目图片获取
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- if (res.data[i].categoryName == '产品服务' && window.location.pathname.indexOf('product') > -1) {
|
|
|
- _this.columnTypes = res.data[i].children
|
|
|
- _this.requestParams.categoryid = (_this.getQuery('isUrlId') == 1) ? _this.getQuery('id') : _this.columnTypes[0].id;
|
|
|
- _this.getArticalData(_this.requestParams)
|
|
|
- _this.columnImage=res.data[i].imagePath; //栏目图片获取
|
|
|
- }
|
|
|
+ // 获取反馈弹框类型数据
|
|
|
+ if (res.data[i].sname == '/solution/index.html') {
|
|
|
+ _this.dialogDataArray = (res.data[i].children)
|
|
|
+ _this.ruleForm.platName = _this.dialogDataArray[0].categoryName;
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//获取内容
|
|
|
- getArticalData(requestParams,type) {
|
|
|
+ getArticalData(requestParams, type) {
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
dataType: 'json',
|
|
|
url: window.FQDN2 + 'siteArticle/siteArticleList',
|
|
|
data: requestParams
|
|
|
}).done(function (res) {
|
|
|
-
|
|
|
-
|
|
|
- var aa
|
|
|
var bb
|
|
|
-
|
|
|
- if(type==1){
|
|
|
- bb=res.data.records
|
|
|
- }else{
|
|
|
- aa= res.data.records;
|
|
|
- // aa.sort(_this.compare("lmtitle"))
|
|
|
- _this.articalArray = aa;
|
|
|
+ if (type == 1) {
|
|
|
+ bb = res.data.records
|
|
|
+ } else {
|
|
|
+ _this.articalArray = res.data.records;
|
|
|
}
|
|
|
-
|
|
|
- if(bb){
|
|
|
- _this.articalArrayRelated =bb.filter(obj => obj.id != _this.articalArray[0].id);
|
|
|
+ if (bb) {
|
|
|
+ _this.articalArrayRelated = bb.filter(obj => obj.id != _this.articalArray[0].id);
|
|
|
console.log(_this.articalArrayRelated)
|
|
|
}
|
|
|
_this.loading = false;
|
|
|
_this.totalPageSzie = res.data.total
|
|
|
_this.totalPageNum = Math.ceil(res.data.total / res.data.size);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}).fail(function (err) {});
|
|
|
-
|
|
|
},
|
|
|
|
|
|
//类型点击
|
|
@@ -324,15 +204,11 @@ var app = new Vue({
|
|
|
this.requestParams.categoryid = item.id
|
|
|
this.requestParams.pageNum = 1
|
|
|
this.getArticalData(this.requestParams)
|
|
|
-
|
|
|
},
|
|
|
|
|
|
-
|
|
|
// 分页
|
|
|
oneInnerBox: function (param) {
|
|
|
- window.location = "./read.html?id=" + param.categoryid + "&title=" + param.title+ "&isUrlId=1";
|
|
|
- // window.location = "./read.html?id=154"
|
|
|
-
|
|
|
+ window.location = "./read.html?id=" + param.categoryid + "&title=" + param.title + "&isUrlId=1";
|
|
|
},
|
|
|
enterPage: function (res) {
|
|
|
if (this.goPage >= 1 && this.goPage <= this.totalPageNum) {
|
|
@@ -357,11 +233,10 @@ var app = new Vue({
|
|
|
});
|
|
|
},
|
|
|
|
|
|
- //公共弹框
|
|
|
+ //公共弹框
|
|
|
submitForm(formName) {
|
|
|
_this = this
|
|
|
this.$refs[formName].validate((valid) => {
|
|
|
-
|
|
|
if (valid) {
|
|
|
console.log(_this.ruleForm)
|
|
|
let param = JSON.stringify(_this.ruleForm)
|
|
@@ -393,7 +268,6 @@ var app = new Vue({
|
|
|
this.centerDialogVisible = false
|
|
|
},
|
|
|
|
|
|
-
|
|
|
// 排序
|
|
|
compare(property) {
|
|
|
return function (a, b) {
|