| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- const { createApp, ref ,onMounted,createVNode, render} = Vue
- createApp({
- setup() {
- onMounted(()=>{
- productList()
- newsDetails()
- })
- const baseURL = ref('http://61.164.207.46:8002/yos/rest/index')
- const data = ref([])
- const productData = ref([])
- const axt_class = ref({})
- const productList = async ()=>{
- const res = await instance.post('',{
- "id": "20240801134003",
- "content": {
- "siteid":"HY",
- "sat_sharematerialid":getQueryParam('id'),
- "where":{
- "condition":""
- }
- }
- })
- productData.value = res.data.data
- }
- const detailData = ref({})
- const newsDetails = async ()=>{
- const res = await instance.post('',{
- "id":20240801134203,
- "content": {
- 'siteid':'HY',
- "sat_sharematerialid":getQueryParam('id')
- }
- })
- if (res.data.code == 1) {
- detailData.value = res.data.data
- tool.modulesClick('工程案例',detailData.value.title)
- }
-
- }
- const getQueryParam = (name)=> {
- // 获取当前页面的URL
- var url = window.location.search;
- // 去除URL中的"?"
- var search = url.substring(1);
- // 将查询字符串分割成键值对数组
- var params = search.split("&");
- // 遍历键值对数组
- for (var i = 0; i < params.length; i++) {
- // 将每个键值对分割成键和值
- var pair = params[i].split("=");
- // 如果键匹配,则返回对应的值
- if (decodeURIComponent(pair[0]) === name) {
- return decodeURIComponent(pair[1] || '');
- }
- }
- // 如果没有找到匹配的参数,则返回null或undefined
- return null;
- }
- const linkOf = (url)=> {
- window.location.href = url
- }
- const queryFaid = async (item)=>{
- const res = await instance.post('',{
- "id": "2024100815094203",
- "content": {
- "siteid":"HY",
- "itemid":item.itemid
- }
- })
- if (res.data.data.length == 0) {
- // alert('该产品未收录在产品名录中')
- tool.alert('该产品未收录在产品名录中')
- } else {
- linkOf(`./productDetail.html?id=` + res.data.data[0].sa_fadid)
- }
-
- }
- return {
- data,
- productList,
- productData,
- axt_class,
- getQueryParam,
- newsDetails,
- detailData,
- linkOf,
- queryFaid
- }
- }
- }).mount('#app')
|