fix: BUG修改

This commit is contained in:
kun 2024-02-19 10:19:06 +08:00
parent ab9288eda2
commit ebab24a114

View File

@ -2,22 +2,52 @@
<!-- 项目首页 -->
<div class="fullHeight">
<vhead :titleName="projectName" :showR="true"></vhead>
<!-- <div @click="test">123</div> -->
<div class="pageContainer">
<div class="pageDataContainer">
<vue-scroll style="height:900px">
<div class="projectIndexBox" ref="artList" @scroll="scrollGet($event)">
<vue-scroll>
<div
class="projectIndexBox"
ref="artList"
@scroll="scrollGet($event)"
>
<!-- <div class="module_title">{{$t('message.homeLayout.existingProducts')}}</div> -->
<div class="projectIndex" id="projectIndex">
<div class="moduleBox" v-for="(item, index) in list" :key="index" v-if="item.operation">
<div class="module_title" v-if="index == 0 || list[index - 1].labelName != item.labelName">
<div
class="moduleBox"
v-for="(item, index) in list"
:key="index"
v-if="item.operation"
>
<div
class="module_title"
v-if="
index == 0 || list[index - 1].labelName != item.labelName
"
>
{{ item.labelName }}
</div>
<div class="module canclick" :class="{ hovers: item.operation }" @click="itemClick(item, index)" ref="refName">
<img v-if="iconType == 1" :src="require('../../assets/images/menu/' + item.moduleIcon + '.png')" class="icon" />
<div
class="module canclick"
:class="{ hovers: item.operation }"
@click="itemClick(item, index)"
ref="refName"
>
<img
v-if="iconType == 1"
:src="
require('../../assets/images/menu/' +
item.moduleIcon +
'.png')
"
class="icon"
/>
<img
v-if="iconType == 2 && item.bigModuleIcon"
:src="require('../../assets/images/menu/' + item.bigModuleIcon + '.png')"
:src="
require('../../assets/images/menu/' +
item.bigModuleIcon +
'.png')
"
style="margin-bottom: 10px"
class="icon"
/>
@ -31,7 +61,7 @@
</div>
<div v-if="showNotBuyMoudle">
<div class="module_title">
{{ $t('message.homeLayout.ununlockedProducts') }}
{{ $t("message.homeLayout.ununlockedProducts") }}
</div>
<div class="projectIndex">
<div
@ -42,10 +72,22 @@
@click="itemClick(item, index)"
v-if="!item.operation"
>
<img v-if="iconType == 1" :src="require('../../assets/images/menu/' + item.moduleIcon2 + '.png')" class="icon" />
<img
v-if="iconType == 1"
:src="
require('../../assets/images/menu/' +
item.moduleIcon2 +
'.png')
"
class="icon"
/>
<img
v-if="iconType == 2 && item.bigModuleIcon"
:src="require('../../assets/images/menu/' + item.bigModuleIcon + '.png')"
:src="
require('../../assets/images/menu/' +
item.bigModuleIcon +
'.png')
"
style="margin-bottom: 10px; opacity: 0.2"
class="icon"
/>
@ -64,123 +106,68 @@
</div>
</template>
<script>
import { getProjectInfoBySn } from '@/assets/js/api/overview'
import vhead from '@/components/header'
import axios from 'axios'
import { getProjectDetail } from '@/assets/js/api/baseInfo.js'
import { getProjectModuleList, getAllModuleApi } from '@/assets/js/api/jxjadmin.js'
import { getSafeyHatSessionApi } from '@/assets/js/api/demo'
import { getDockingUrlApi } from '@/assets/js/api/configManage'
import { getProjectInfoBySn } from "@/assets/js/api/overview";
import vhead from "@/components/header";
import axios from "axios";
import { getProjectDetail } from "@/assets/js/api/baseInfo.js";
import {
getProjectModuleList,
getAllModuleApi,
} from "@/assets/js/api/jxjadmin.js";
import { getSafeyHatSessionApi } from "@/assets/js/api/demo";
import { getDockingUrlApi } from "@/assets/js/api/configManage";
export default {
name: 'projectIndex',
name: "projectIndex",
components: { vhead },
data() {
return {
firstIn: 0,
selfScrollTop: 0,
projectSn: '',
baseURL: '',
projectNumber: null,
projectName: '',
projectSn: "",
baseURL: "",
projectNumber: "",
projectName: "",
list: [],
showNotBuyMoudle: showNotBuyMoudle,
brIndex: '',
iconType: '1',
allList: [],
COMPANY: COMPANY,
}
brIndex: "",
iconType: "1",
};
},
watch: {
userInfo(newValue) {
// console.log('',newValue);
this.allList = newValue.menuAuthority.moduleList
this.getAllModule(this.allList)
created() {
console.log("进来 created");
this.projectSn = this.$store.state.projectSn;
this.baseURL = this.$http.defaults.baseURL;
},
mounted() {
if (localStorage.getItem("systemInfo")) {
this.iconType = JSON.parse(localStorage.getItem("systemInfo")).iconType
? JSON.parse(localStorage.getItem("systemInfo")).iconType
: "1";
}
console.log(this.iconType);
this.getDataDateils();
// if(this.$store.state.userInfo.accountType==5){
// this.getProjectModule()
// }else{
var arr = this.$store.state.userInfo.menuAuthority.moduleList;
this.getAllModule(arr);
this.getProjectNumber();
// realAllList(newValue) {
// this.list = newValue
// }
},
computed: {
userInfo() {
return this.$store.state.userInfo
},
realAllList() {
return this.list
},
data() {
return this.$store.state.menuList
}
},
async created() {
this.headShow = true;
this.isFirstLogin = !sessionStorage.getItem('isFirstLogin')
this.projectSn = this.$store.state.projectSn
this.baseURL = this.$http.defaults.baseURL
if (localStorage.getItem('systemInfo')) {
this.iconType = JSON.parse(localStorage.getItem('systemInfo')).iconType
? JSON.parse(localStorage.getItem('systemInfo')).iconType
: '1'
}
console.log(this.iconType, 'iconType,iconTypeiconTypeiconTypeiconTypeiconType')
this.allList = this.$store.state.userInfo.menuAuthority.moduleList
await this.getAllModule(this.allList)
await this.getDataDateils()
await this.getProjectNumber()
},
async mounted() {
// if(this.firstIn == 0) {
// this.firstIn ++
// this.$router.go(0)
// }
// this.$forceUpdate()
},
activated() {
this.$refs.artList.scrollTop = this.selfScrollTop
this.$refs.artList.scrollTop = this.selfScrollTop;
},
methods: {
test() {
let item = this.list.find(item => item.moduleName === '劳务管理系统')
let arr = item.menuList
console.log(arr, '测试数据')
let arr2 = []
arr.forEach(element => {
if (element.menuEquipment == 0) {
arr2.push(element)
}
})
this.$store.commit('setMenuList', arr2)
this.$store.commit('setIsShowBackIndex', true)
this.$store.commit('setMoudle', item)
if (arr2[0].target == '_blank') {
let routeUrl = ''
if (arr2[0].path.indexOf('http') != -1) {
routeUrl = arr2[0].path
} else {
let url = this.$router.resolve({
path: arr2[0].path
})
routeUrl = url.href
}
window.open(routeUrl, '_blank')
} else {
if (arr2[0].path == '' || arr2[0].path.indexOf('/') == -1) {
this.$router.push(arr2[0].menuList[0].path)
} else {
this.$router.push(arr2[0].path)
}
}
window._paq.push(['trackEvent', '点击', item.moduleName, '进入' + item.moduleName])
},
scrollGet(e) {
this.selfScrollTop = this.$refs.artList.scrollTop
console.log("滚动触发的事件", e.srcElement.scrollTop, e.target.scrollTop);
this.selfScrollTop = this.$refs.artList.scrollTop;
},
getSafeyHatSession() {
let data = {}
data.projectSn = this.projectSn
getSafeyHatSessionApi(data).then(res => {
console.log('安全帽跳转', res)
let data = {};
data.projectSn = this.projectSn;
getSafeyHatSessionApi(data).then((res) => {
console.log("安全帽跳转", res);
// {
// "success":true,
// "message":"",
@ -196,50 +183,52 @@ export default {
// }
// projectId
if (res.code == 200) {
this.url = 'https://caps.runde.pro/login#token=' + res.result.token + '&user_name=' + res.result.userName + '&target=home'
this.url =
"https://caps.runde.pro/login#token=" +
res.result.token +
"&user_name=" +
res.result.userName +
"&target=home";
// let url = 'https://caps.runde.pro/login#token='+ res.result.token + '&user_name=' + res.result.userName + '&target=home'
window.open(this.url)
window.open(this.url);
}
})
});
},
getProjectNumber() {
let data = {
projectSn: this.projectSn
}
getProjectInfoBySn(data).then(res => {
console.log('------------', res.result.projectNumber)
this.projectNumber = res.result.projectNumber
})
projectSn: this.projectSn,
};
getProjectInfoBySn(data).then((res) => {
console.log("------------", res.result.projectNumber);
this.projectNumber = res.result.projectNumber;
});
},
//
getPanoramicRanging() {
axios({
method: 'GET',
method: "GET",
// url:'http://182.90.224.237:8070/xmgl/docking/url',
// url:'http://182.90.224.237:7000/xmgl/docking/url',
url: `${this.$http.defaults.baseURL}${'xmgl/docking/url'}`,
url: `${this.$http.defaults.baseURL}${"xmgl/docking/url"}`,
params: {
projectNumber: this.projectNumber
}
}).then(res => {
console.log('全景成像测距', res)
let toUrl = res.data.find(item => {
projectNumber: this.projectNumber,
},
}).then((res) => {
console.log("全景成像测距", res);
let toUrl = res.data.find((item) => {
if (this.projectNumber == item.jinqianmaosn) {
return item.url
return item.url;
}
})
window.open(toUrl.url)
})
});
window.open(toUrl.url);
});
},
itemClick(item, index) {
console.log('item', index)
console.log('点击的模块信息', item)
console.log("item", index);
// console.log(item,this.$store.state.userInfo.account)
if (item.moduleName == '智能安全帽系统') {
this.getSafeyHatSession()
this.$message.success(this.$t('message.projectIndex.tips3')) //
if (item.moduleName == "智能安全帽系统") {
this.getSafeyHatSession();
//
// let NodeRSA = require("node-rsa");
// //
@ -253,151 +242,150 @@ export default {
// MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDcmP0ug4NTHwW2oeHxheZjmYPDxVGFP770eECdLwRtaH0pPWvsXG6MSO/kCzgjEVEo1K1bvRxkkasQRu02fhI+gsZa8wvVeo3s4zJDA48Oj99JAXsx56/WN1RlNh+tsXcH9oQWy3gbX5cDkheuVZj8gsV7Ez59Ucj4e78zNJrUDwIDAQAB
// -----END PUBLIC KEY-----`;
// let publicKey = new NodeRSA(pubKey);
// let async_key = publicKey.encrypt(params, 'base64')
setTimeout(() => {
window.open('https://caps.runde.pro')
}, 1000)
// window.open("http://58.210.96.206:91/async_danzhou.html?async_key="+async_key)
// window.location.href = "http://58.210.96.206:91/async_danzhou.html?async_key="+async_key;
}
if (item.moduleName == '全景成像测距') {
this.getPanoramicRanging()
}
if (item.moduleName == '智能穿戴管理系统') {
this.getSafeyHatSession()
}
if (item.moduleName == '智能穿戴管理系统') {
return
}
if (item.moduleName == '智能安全帽系统') {
this.getSafeyHatSession()
}
// var publicKey = new NodeRSA(pubKey);
// var async_key = publicKey.encrypt(params, 'base64')
if (!item.operation) {
this.$message.error(this.$t('message.projectIndex.tips1'))
return
// window.open("http://58.210.96.206:91/async_danzhou.html?async_key="+async_key)
// // window.location.href = "http://58.210.96.206:91/async_danzhou.html?async_key="+async_key;
}
// if (this.COMPANY == 'jlw') {
// if (item.moduleName == 'AR') {
// window.open('https://cloud.kivicube.com/plane-scenes');
// }
// }
if (item.menuList && item.menuList.length > 0 && item.moduleName != '全景成像测距') {
let arr = item.menuList,
arr2 = []
arr.forEach(element => {
if (item.moduleName == "全景成像测距") {
this.getPanoramicRanging();
}
if (item.moduleName == "智能穿戴管理系统") {
this.getSafeyHatSession();
}
if (item.moduleName == "智能穿戴管理系统") {
return;
}
if (item.moduleName == "智能安全帽系统") {
this.getSafeyHatSession();
}
if (!item.operation) {
this.$message.error(this.$t("message.projectIndex.tips1"));
return;
}
if (
item.menuList &&
item.menuList.length > 0 &&
item.moduleName != "全景成像测距"
) {
var arr = item.menuList,
arr2 = [];
arr.forEach((element) => {
if (element.menuEquipment == 0) {
arr2.push(element)
arr2.push(element);
}
})
this.$store.commit('setMenuList', arr2)
this.$store.commit('setIsShowBackIndex', true)
this.$store.commit('setMoudle', item)
if (arr2[0].target == '_blank') {
let routeUrl = ''
if (arr2[0].path.indexOf('http') != -1) {
routeUrl = arr2[0].path
});
this.$store.commit("setMenuList", arr2);
this.$store.commit("setIsShowBackIndex", true);
this.$store.commit("setMoudle", item);
if (arr2[0].target == "_blank") {
let routeUrl = "";
if (arr2[0].path.indexOf("http") != -1) {
routeUrl = arr2[0].path;
} else {
let url = this.$router.resolve({
path: arr2[0].path
})
routeUrl = url.href
path: arr2[0].path,
});
routeUrl = url.href;
}
window.open(routeUrl, '_blank')
window.open(routeUrl, "_blank");
} else {
if (arr2[0].path == '' || arr2[0].path.indexOf('/') == -1) {
this.$router.push(arr2[0].menuList[0].path)
if (arr2[0].path == "" || arr2[0].path.indexOf("/") == -1) {
this.$router.push(arr2[0].menuList[0].path);
} else {
this.$router.push(arr2[0].path)
this.$router.push(arr2[0].path);
}
}
} else if (item.moduleName == '全景成像测距' || item.moduleName == '智能安全帽系统' || item.moduleName == 'AR指挥中心') {
// this.$message.success(this.$t('message.projectIndex.tips3'))//
} else if (
item.moduleName == "全景成像测距" ||
item.moduleName == "智能安全帽系统"
) {
this.$message.success(this.$t("message.projectIndex.tips3"));
} else {
this.$message.error(this.$t('message.projectIndex.tips2'))
this.$message.error(this.$t("message.projectIndex.tips2"));
}
window._paq.push(['trackEvent', '点击', item.moduleName, '进入' + item.moduleName])
window._paq.push([
"trackEvent",
"点击",
item.moduleName,
"进入" + item.moduleName,
]);
},
//
getDataDateils() {
let data = {
projectSn: this.projectSn
}
getProjectDetail(data).then(res => {
projectSn: this.projectSn,
};
getProjectDetail(data).then((res) => {
// console.log(res);
if (res.code == 200) {
this.projectName = res.result.projectName
document.title = this.projectName
this.$store.commit('setProDetail', res.result)
this.projectName = res.result.projectName;
document.title = this.projectName;
this.$store.commit("setProDetail", res.result);
}
})
});
},
//
getAllModule(half) {
getAllModuleApi({ moduleType: 2 }).then(res => {
getAllModuleApi({ moduleType: 2 }).then((res) => {
if (res.success) {
let all = res.result
// console.log('allallallallall', all)
// console.log('halfhalfhalfhalf',half)
var all = res.result;
console.log("all", all);
all.forEach((element, index) => {
all[index].operation = false
half.forEach(element2 => {
all[index].operation = false;
half.forEach((element2) => {
if (element2.moduleId == element.moduleId) {
all[index].operation = true
all[index].menuList = element2.menuList
all[index].operation = true;
all[index].menuList = element2.menuList;
}
})
})
this.list = all
this.$forceUpdate()
console.log(this.list, '权限数据')
if (window.location.href.indexOf('labor') != -1) {
console.log('大屏跳转进来携带参数跳转进来了吗----', window.location.href.indexOf('labor'))
this.test()
}
});
});
this.list = all;
console.log(this.list);
this.$nextTick(() => {
let projectIndex = document.getElementById('projectIndex')
let array = document.getElementsByClassName('module_title')
console.log(array)
var projectIndex = document.getElementById("projectIndex");
var array = document.getElementsByClassName("module_title");
console.log(array);
for (let index = 0; index < array.length; index++) {
let newElement = document.createElement('div')
newElement.style = 'width: 100%; height: 1px'
projectIndex.insertBefore(newElement, array[index].parentNode)
var newElement = document.createElement("div");
newElement.style = "width: 100%; height: 1px";
projectIndex.insertBefore(newElement, array[index].parentNode);
}
})
});
}
})
});
},
insertAfter(newElement, targetElement) {
// newElement targetElement
let parent = targetElement.parentNode //
var parent = targetElement.parentNode; //
if (parent.lastChild == targetElement) {
// 使appendChild
parent.appendChild(newElement, targetElement)
parent.appendChild(newElement, targetElement);
} else {
parent.insertBefore(newElement, targetElement.nextSibling)
parent.insertBefore(newElement, targetElement.nextSibling);
}
}
},
//
// getProjectModule(projectSn) {
// getProjectModuleList({ projectSn: this.$store.state.projectSn }).then(
// (result) => {
// if (result.success) {
// let half = result.result;
// var half = result.result;
// this.getAllModule(half);
// }
// }
// );
// },
}
}
},
};
</script>
<style lang="less" scoped>
.pageContainer {
height: calc(100% - 61px);
background: rgba(247, 249, 255, 0.9);
font-family: '思源黑体';
font-family: "思源黑体";
}
.projectIndexBox {