PageSourceSearch

https://www.okamura.co.jp/corporate/news/js/app.js

js okamura.co.jp collected 2026-09-24 09:00:02 UTC 5,847 bytes, 321 lines download raw bytes

1import {mods_object_search} from "/global_assets/js/mods_object.js"
2
3
4
5if (jsParams.tag === undefined) jsParams.tag = ''
6console.log(jsParams.tag)
7
8
9
10/*
11 * app
12 */
13const app = new Vue({
14	el: "#app",
15
16	data(){
17		return {
18			all: [],
19			result: [],
20			result_num: 0,
21			parPage: 20,    // 1ページに表示する件数
22			currentPage: 1,	// 現在のページ
23
24			category: {
25				"すべて": true,
26				"製品・サービス": false,
27				"展示会": false,
28				"受賞・認定": false,
29				"その他": false,
30			},
31
32			categorys: {},
33
34			tag: {
35				"すべて": true,
36				"オフィス": false,
37				"教育文化施設": false,
38				"医療福祉施設": false,
39				"研究施設": false,
40				"商業施設": false,
41				"物流システム機器": false,
42				"セキュリティ": false,
43				"間仕切建材": false,
44				"ホームインテリア": false,
45			},
46
47			tags: "",
48			param_tag: "",
49
50			year: "",
51			word: "",
52
53			search_categorys: [],
54			search_tags: [],
55
56		}
57	},
58
59
60
61	/* == components == */
62	components: {
63		'paginate': VuejsPaginate,
64	},
65
66
67
68	/* == created == */
69	created(){
70
71		this.param_tag = this.getUrlParam('tag')
72		if (jsParams.tag) this.param_tag = jsParams.tag
73
74		axios.get('/corporate/news/json/topics.json?ver=20260917-135536')
75		.then((response) => {
76			
77        	this.all = response.data
78        
79        	// -- hidden_flag
80        	if (jsParams.hidden_flag){
81				this.all = response.data.filter((item) => {return !item.hidden_flag})
82			}
83        
84			// -- flag
85			if (jsParams.flag){
86				this.all = this.all.filter((item) => {return item.flag == jsParams.flag})
87			}
88
89			// console.log('RowData = ' + response.data.length, ': all  = ' + this.all.length)
90
91			let i = 0;
92			this.all.forEach((val) => {
93				val.sn = i
94				i++
95			})
96			
97			this.result = this.all
98			this.result_num = this.result.length
99
100			if (this.param_tag){
101				this.search('tag', this.param_tag)
102			}
103
104		})
105		.catch((error) => {
106			console.log(error)
107		})
108
109	},
110
111
112
113	/* == mounted == */
114	mounted(){
115		//console.log('mounted')
116	},
117
118
119
120	/* == watch ==*/
121	watch: {
122		year(old, val)	{ this.search('year', val) },
123		// word(old, val)	{ this.search('word', val) },
124	},
125
126
127
128	/* == computed ==*/
129	computed: {
130		getItems: function(){
131			let current = this.currentPage * this.parPage;
132			let start = current - this.parPage;
133			return this.result.slice(start, current);
134		},
135		getPageCount: function(){
136			return Math.ceil(this.result.length / this.parPage);
137		}
138	},
139
140
141
142	/* == methods == */
143	methods: {
144
145		ex_date(date){
146			date = date.replace(/年|月/g, '.')
147			return date.replace('日', '')
148		},
149
150		split_tag(tag){
151			return tag.split(',')
152
153		},
154
155		search(index, value){
156
157			switch(index){
158
159				// -------------------------- category
160				case "category":
161
162					this.search_categorys = []
163
164					Object.keys(this.category).forEach((idx) => {
165						this.category[idx] = false
166					})
167
168					this.category[value] = true
169
170					if (value !== 'すべて'){
171						this.search_categorys.push(value)
172					}
173
174					// カテゴリーが選択された場合、他の選択項目をクリア
175					this.search_tags = []
176					Object.keys(this.tag).forEach((idx) => {
177						this.tag[idx] = false
178					})
179
180					this.tag['すべて'] = true
181
182					this.year = ""
183					this.word = ""
184
185				break;
186
187				// -------------------------- tag
188				case "tag":
189
190					this.tags_param  = ""
191					this.search_tags = []
192
193					if (value == 'すべて'){
194
195						Object.keys(this.tag).forEach((idx) => {
196							this.tag[idx] = false
197						})
198						this.tag['すべて'] = true
199
200					}else{
201
202						this.tag['すべて'] = false
203						if (this.tag[value]){
204							this.tag[value] = false
205						}else{
206							this.tag[value] = true
207						}
208						Object.keys(this.tag).forEach((idx) => {
209							if (this.tag[idx]){
210								this.search_tags.push(`@_${idx}_@`)
211							}
212						})
213
214					}
215
216				break;
217
218				// -------------------------- year
219				case "year":
220					value = this.year
221				break;
222
223				/// -------------------------- word
224				case "word":
225					value = this.word
226				break;
227			}
228
229			this.result = this.all
230
231			// -- category
232			if (this.search_categorys.length){
233				this.result = mods_object_search({
234					obj:  this.result,
235					key: 'cateogory',
236					word: this.search_categorys,
237					incl: false
238				})
239			}
240
241			// -- tag
242			if (this.search_tags.length){
243				this.result = mods_object_search({
244					obj:  this.result,
245					key: 'search_tag',
246					word: this.search_tags,
247					incl: true
248				})
249			}
250
251			// -- year
252			if (this.year){
253				this.result = mods_object_search({
254					obj:  this.result,
255					key: 'year',
256					word: this.year,
257					incl: false
258				})
259			}
260
261			// -- word
262			if (this.word){
263				this.result = mods_object_search({
264					obj:  this.result,
265					key: 'search_words',
266					word: this.word,
267					incl: true
268				})
269			}
270
271			this.result_num = this.result.length
272
273			// ページネーションのカレントを強制的に変更する
274			this.$refs.paginate.selected = 1
275			this.currentPage = 1
276
277		},
278
279		// -- ページネーションがクリックされたら
280		// https://github.com/lokyoung/vuejs-paginate#props
281		pagination_click(pageNum) {
282			this.currentPage = Number(pageNum);
283			const el = document.getElementById('wrapper')
284			el.scrollIntoView({ behavior: 'smooth'})
285		},
286
287		/*
288		 * URLのパラメータを取得
289		 */
290		getUrlParam(arg){
291			if (location.search){
292
293				const _arg  = new Object;
294				const pair = location.search.substring(1).split('&');
295
296				for(var i=0; i < pair.length; i++) {
297					var kv = pair[i].split('=')
298					kv[1] = decodeURIComponent(kv[1])
299					if (kv[1] === 'undefined') kv[1] = ""
300					_arg[kv[0]] = kv[1]
301				}
302
303				if (arg) return _arg[arg]; else return _arg
304
305			}else{
306				return ""
307			}
308		},
309
310		/*
311		 * mods_url_addParam URLにパラメータを追加
312		 */
313		addUrlParam(param){
314			history.pushState('', '', param)
315		},
316
317	},
318
319
320
321})

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.