import Vue from 'vue' import config from '../config' import bus from '../utils/eventbus' import { Alert, Confirm, Tips } from '../components/shared/message' import clickoutside from './v-clickoutside' import clickwindow from './v-clickwindow' import * as api from '../api' Vue.prototype.$bus = bus Vue.prototype.$api = api Vue.prototype.$intranet = config.intranet Vue.prototype.$cdn = config.CDN Vue.prototype.$config = config Vue.prototype.$panoType = [{ id:'building', name:'楼盘全景' },{ id:'garden', name:'园林全景' },{ id:'house', name:'户型' }] Vue.prototype.$nameStr = { 'building':'楼盘全景', 'garden':'园林全景', 'house':'户型' } Vue.prototype.$nameSort = { 'building':1, 'garden':2, 'house':3 } Vue.prototype.$scrollbars = [] let SettingPanel = require('@/framework/SettingPC').default Vue.mixin({ components: { SettingPanel }, directives: { 'clickoutside': clickoutside, 'clickwindow': clickwindow }, data() { return { } }, methods: { $alert(data = {}) { let instance = new Alert({ data }).$mount() document.body.appendChild(instance.$el) Vue.nextTick(() => { instance.show = true }) }, $confirm(data = {}) { let instance = new Confirm({ data }).$mount() document.body.appendChild(instance.$el) Vue.nextTick(() => { instance.show = true }) }, $tips(data = {}) { let instance = new Tips({ data }).$mount() document.body.appendChild(instance.$el) Vue.nextTick(() => { instance.show = true }) }, $getStaticResource(url) { return config.getStaticResource(url) }, $html_encode(str){ return config.html_encode(str) }, $getKrpano(str){ return config.getKrpano(str) }, $randomWord(randomFlag, min, max) {//随机字符串 var str = "", range = min, arr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']; if (randomFlag) { // 随机长度 range = Math.round(Math.random() * (max - min)) + min; } for (var i = 0; i < range; i++) { var pos = Math.round(Math.random() * (arr.length - 1)); str += arr[pos]; } return str; }, $htmlEncode(str) { var s = ""; if (str.length == 0) return ""; s = str.replace(/\'/g, "'"); s = s.replace(/\"/g, """); s = s.replace(/\(/g, "("); s = s.replace(/\)/g, ")"); s = s.replace(/,/g, ","); return s; }, $deleteKRHotspot(data){ let krpano = document.getElementById('krpanoSWFObject'); let HV = window.__krfn.utils.getHotspotHV(krpano,data.name); krpano.call('removehotspot('+data.name+',true);'); krpano.call('removeplugin(' + ('tooltip_' + data.name) + ',true);'); return HV }, $refreshHotspot(data){ let HV = this.$deleteKRHotspot(data) data.ath = HV.ath data.atv = HV.atv this.$bus.emit("addhotspot", data); } } })