gemercheung 2 năm trước cách đây
mục cha
commit
bb354aefed

+ 2 - 2
packages/qjkankan-editor/.env.testprod

@@ -7,5 +7,5 @@ VUE_APP_PROXY_URL_ROOT='https://test.4dkankan.com'
 VUE_APP_PROXY_URL='https://test.4dkankan.com/qjkankan/'
 VUE_APP_ORIGIN=
 VUE_APP_URL_FILL=/qjkankan
-VUE_APP_DEBBUG_FLAG=0614-01
-VUE_APP_DEBBUG_NOTIFY=0
+VUE_APP_DEBBUG_FLAG=0615-01
+VUE_APP_DEBBUG_NOTIFY=1

+ 1 - 0
packages/qjkankan-editor/package.json

@@ -24,6 +24,7 @@
     "d3": "^7.8.0",
     "element-ui": "^2.15.1",
     "html2canvas": "^1.4.1",
+    "is-chinese-phone-number": "^0.1.9",
     "libphonenumber-js": "^1.10.19",
     "log-beautify": "^1.2.0",
     "photoswipe": "^4.1.3",

+ 24 - 26
packages/qjkankan-editor/src/mixins/debuggerHelper.js

@@ -1,28 +1,26 @@
-import Vue from 'vue'
+import Vue from "vue";
 export const debuggerHelper = (show = true) => {
-    const version = '1.4.0'
-    if (show) {
-        // log.setColors({
-        var css = "background: #28b561; color:#fff;font-size:14px;padding:5px;";
+  const version = "1.4.0--" + process.env.VUE_APP_DEBBUG_FLAG;
+  if (show) {
+    // log.setColors({
+    var css = "background: #28b561; color:#fff;font-size:14px;padding:5px;";
 
-        console.log(`%c 👉:当前版本::---> ${version}--${process.env.VUE_APP_DEBBUG_FLAG}`, css);
-
-    }
-    if (Number(process.env.VUE_APP_DEBBUG_NOTIFY) === 1) {
-
-        Vue.$toast.warning(`当前正在开发重构${version}中, 如果要指定版本,请联系开发!`, {
-            position: "top-center",
-            timeout: 400000,
-            closeOnClick: true,
-            pauseOnFocusLoss: true,
-            pauseOnHover: true,
-            draggable: true,
-            draggablePercent: 0.6,
-            showCloseButtonOnHover: false,
-            hideProgressBar: true,
-            closeButton: "button",
-            icon: true,
-            rtl: false
-        });
-    }
-}
+    console.log(`%c 👉:当前版本::---> ${version}`, css);
+  }
+  if (Number(process.env.VUE_APP_DEBBUG_NOTIFY) === 1) {
+    Vue.$toast.warning(`当前开发正在调试${version}中, 请等候!`, {
+      position: "top-center",
+      timeout: 400000,
+      closeOnClick: true,
+      pauseOnFocusLoss: true,
+      pauseOnHover: true,
+      draggable: true,
+      draggablePercent: 0.6,
+      showCloseButtonOnHover: false,
+      hideProgressBar: true,
+      closeButton: "button",
+      icon: true,
+      rtl: false,
+    });
+  }
+};

+ 3 - 5
packages/qjkankan-editor/src/views/hotspot/EditPanel.vue

@@ -205,7 +205,8 @@ import Switcher from "@/components/shared/Switcher.vue";
 import TabbarSwitcher from "@/components/shared/TabbarSwitcher.vue";
 import TabbarSwitcherIcon from "@/components/shared/TabbarSwitcherIcon.vue";
 import hotspotTypeList from "./hotspotTypeList.js";
-import { isValidPhoneNumber } from "libphonenumber-js/max";
+import { isValidPhoneNumber } from "@/utils/other.js";
+// import isValidPhoneNumber from "is-chinese-phone-number";
 import { tree } from "d3";
 
 export default {
@@ -438,10 +439,7 @@ export default {
           }
           break;
         case "phone":
-          if (
-            !isValidPhoneNumber(this.hotspot.phoneInfo.phone) &&
-            !isValidPhoneNumber("+86" + this.hotspot.phoneInfo.phone)
-          ) {
+          if (!isValidPhoneNumber(this.hotspot.phoneInfo.phone)) {
             return false;
           }
           break;

+ 18 - 16
packages/qjkankan-editor/src/views/hotspot/hotspotType/phone.vue

@@ -16,49 +16,51 @@
 
 <script>
 import { mapGetters } from "vuex";
-import { isValidPhoneNumber } from 'libphonenumber-js/max'
+import { isValidPhoneNumber } from "@/utils/other.js";
+// import isChinesePhoneNumber from "is-chinese-phone-number";
 
 export default {
   data() {
-    return {
-    }
+    return {};
   },
   computed: {
     ...mapGetters({
-      hotspot: 'hotspot',
+      hotspot: "hotspot",
     }),
   },
+
   methods: {
     onInput(e) {
-      this.hotspot.phoneInfo.phone = this.$refs.input.value
+      this.hotspot.phoneInfo.phone = this.$refs.input.value;
     },
+
     onInputBlur() {
-      if (!isValidPhoneNumber(this.hotspot.phoneInfo.phone) && !isValidPhoneNumber('+86' + this.hotspot.phoneInfo.phone)) {
+      if (!isValidPhoneNumber(this.hotspot.phoneInfo.phone)) {
         this.$msg({
-          message: this.$i18n.t('hotspot.phone_error_tip'),
-          type: 'error'
-        })
+          message: this.$i18n.t("hotspot.phone_error_tip"),
+          type: "error",
+        });
       }
-    }
+    },
   },
-}
+};
 </script>
 
 <style lang="less" scoped>
 .phone-effect-setting {
-  >.phone-input-wrapper {
+  > .phone-input-wrapper {
     position: relative;
     border: 1px solid rgba(151, 151, 151, 0.2);
     padding: 0 16px;
-    background: #1A1B1D;
+    background: #1a1b1d;
     border-radius: 2px;
     height: 36px;
     width: 100%;
     margin-top: 18px;
     &:focus-within {
-      border-color: #0076F6;
+      border-color: #0076f6;
     }
-    >input {
+    > input {
       border: none;
       background: transparent;
       outline: none;
@@ -80,4 +82,4 @@ export default {
     // }
   }
 }
-</style>
+</style>

+ 1 - 1
packages/qjkankan-editor/src/views/material/works/index.vue

@@ -58,7 +58,7 @@
             <div>
               <span>{{ item.createTime.split(' ')[0] }}</span>
               <div :title="item.visit">
-                <i class="iconfont iconworks_look"></i>{{ item.visit > 10000 ? '1w+' : item.visit }}
+                <i class="iconfont icon-works_look"></i>{{ item.visit > 10000 ? '1w+' : item.visit }}
               </div>
             </div>
           </div>

+ 3 - 1
packages/qjkankan-view/.env.testdev

@@ -8,4 +8,6 @@ VUE_APP_URL_FILL=
 # 接口请求地址
 VUE_APP_APIS_URL=https://test.4dkankan.com/
 VUE_APP_DEBBUG_FLAG=0516-03
-VUE_APP_DEBBUG_NOTIFY=0
+VUE_APP_DEBBUG_NOTIFY=0
+VUE_APP_DEBBUG_V4=1
+VUE_APP_DEBBUG_V4_URL="http://192.168.0.186:8081"

+ 4 - 2
packages/qjkankan-view/.env.testprod

@@ -7,5 +7,7 @@ VUE_APP_PROXY_URL='https://test.4dkankan.com/qjkankan/'
 VUE_APP_URL_FILL=/qjkankan
 # 接口请求地址
 VUE_APP_APIS_URL=https://test.4dkankan.com/
-VUE_APP_DEBBUG_FLAG=0614-04
-VUE_APP_DEBBUG_NOTIFY=0
+VUE_APP_DEBBUG_FLAG=0615-01
+VUE_APP_DEBBUG_NOTIFY=1
+VUE_APP_DEBBUG_V4=0
+VUE_APP_DEBBUG_V4_URL="http://192.168.0.186:8081"

+ 16 - 6
packages/qjkankan-view/src/components/Fdkk/index.vue

@@ -36,16 +36,14 @@
       class="V4"
       v-else
       id="fdkkifr"
-      :src="`${isMobile ? 'smg' : 'spg'}.html?m=${
-        currentScene.sceneCode
-      }&lang=${lang}`"
+      :src="V4IframeUrl"
       frameborder="0"
     ></iframe>
   </div>
 </template>
 
 <script setup>
-import { ref, computed, onUnmounted, onMounted, nextTick } from "vue";
+import { ref, computed, onUnmounted, onMounted, nextTick, unref } from "vue";
 import { useStore } from "vuex";
 import browser from "@/utils/browser";
 
@@ -72,6 +70,20 @@ const otherLink = ref(null);
 
 const rnd = ref(null);
 
+const V4IframeUrl = computed(() => {
+  const v4Mi = process.env.VUE_APP_DEBBUG_V4_URL;
+
+  if (process.env.VUE_APP_DEBBUG_V4 == 1) {
+    return `${v4Mi}/${unref(isMobile) ? "smg" : "spg"}.html?m=${
+      unref(currentScene).sceneCode
+    }&lang=${unref(lang)}`;
+  } else {
+    return `${unref(isMobile) ? "smg" : "spg"}.html?m=${
+      unref(currentScene).sceneCode
+    }&lang=${unref(lang)}`;
+  }
+});
+
 const handleMessage = (res) => {
   if (Object.prototype.toString.call(res.data) == "[object Object]") {
     if (res.data.source !== "qjkankan") {
@@ -127,9 +139,7 @@ const handleMessage = (res) => {
       console.error("toggleBgmStatus", params);
       // debugger;
       if (params.status) {
-
       } else {
-
       }
     }
 

+ 19 - 3
packages/qjkankan-view/src/components/Pano/index.vue

@@ -4,7 +4,15 @@
 </template>
 
 <script setup>
-import { ref, onMounted, computed, watch, nextTick, unref } from "vue";
+import {
+  ref,
+  onMounted,
+  computed,
+  watch,
+  nextTick,
+  unref,
+  watchEffect,
+} from "vue";
 import { useStore } from "vuex";
 import { useApp, getApp } from "@/app";
 import Fdkk from "../Fdkk";
@@ -12,7 +20,8 @@ import { getFdkkInfo } from "@/apis";
 import { isUpgradeAdapter } from "@/utils/fixVersion";
 import browser from "@/utils/browser";
 import config from "@/utils/config";
-
+import { useI18n } from "vue-i18n";
+const { t } = useI18n({ useScope: "global" });
 const store = useStore();
 const isMobile = computed(() => browser.isMobile());
 const lang = computed(() => config.lang);
@@ -39,7 +48,6 @@ const loadScene = async (currentScene) => {
       },${initVisual ? initVisual.hlookat : "0"})`
     );
     console.log(sceneCode, someData);
-
     if (someData && someData.hotspots && someData.hotspots.length > 0) {
       app.Tags.initHotspot(someData.hotspots, false);
     }
@@ -176,6 +184,14 @@ useApp().then((app) => {
     }
   });
 });
+
+onMounted(() => {
+  watchEffect(() => {
+    if (metadata.value.name === "") {
+      document.title = t("common.no_title");
+    }
+  });
+});
 </script>
 
 <style lang="scss" scoped>

+ 8 - 2
packages/qjkankan-view/src/components/UIGather/control.vue

@@ -194,10 +194,15 @@ const onIsBGM = () => {
       store.dispatch("audio/pauseBGM");
     }
   } else {
-    if (!unref(isCurrentPlaying)) {
+    if (!unref(isPlayNormalBGM)) {
+      console.log("从其他切过来");
       store.dispatch("audio/playBGM", 0);
     } else {
-      store.dispatch("audio/pauseBGM");
+      if (!unref(isCurrentPlaying)) {
+        store.dispatch("audio/playBGM", 0);
+      } else {
+        store.dispatch("audio/pauseBGM");
+      }
     }
   }
 };
@@ -208,6 +213,7 @@ const onIsAutoRotate = (data) => {
 
 const onIsCommentary = () => {
   if (!unref(isPlayExplanationBGM)) {
+    console.log("从其他切过来");
     store.dispatch("audio/playBGM", 3);
   } else {
     if (unref(isCurrentPlaying)) {

+ 5 - 3
packages/qjkankan-view/src/hooks/useAudio.js

@@ -142,8 +142,8 @@ class AudioPlayer {
       this[method] = emitter[method];
     });
     this.audio = null;
-    this.switchUrl = debounce(this.switchUrlSource, 300).bind(this);
-    this.play = debounce(this.toPlay, 300).bind(this);
+    this.switchUrl = debounce(this.switchUrlSource, 100).bind(this);
+    this.play = debounce(this.toPlay, 100).bind(this);
     this.init();
   }
   get isPlaying() {
@@ -192,7 +192,9 @@ class AudioPlayer {
       },
       onend: () => {
         this._isPlaying = false;
-        this.audio.unload();
+        if (!this._loop) {
+          this.audio.unload();
+        }
         this.emit("end");
       },
     });

+ 46 - 45
packages/qjkankan-view/src/i18n/index.js

@@ -1,59 +1,60 @@
-import { nextTick } from 'vue'
-import { useI18n, createI18n } from 'vue-i18n'
-import browser from '@/utils/browser'
-
-export { useI18n }
-export const SUPPORT_LOCALES = ['zh', 'en', 'ja']
+import { nextTick } from "vue";
+import { useI18n, createI18n } from "vue-i18n";
+import browser from "@/utils/browser";
 
+export { useI18n, i18n };
+export const SUPPORT_LOCALES = ["zh", "en", "ja"];
+let i18n;
 export function getLocale() {
-    let lang = browser.getURLParam('lang')
-    if (!lang) {
-        lang = window.navigator.language || window.navigator.userLanguage || null
-        if (lang && !/^zh/.test(lang)) {
-            console.log('自动获取浏览器语言:' + lang)
-            lang = 'en'
-        } else {
-            lang = 'zh'
-        }
+  let lang = browser.getURLParam("lang");
+  if (!lang) {
+    lang = window.navigator.language || window.navigator.userLanguage || null;
+    if (lang && !/^zh/.test(lang)) {
+      console.log("自动获取浏览器语言:" + lang);
+      lang = "en";
+    } else {
+      lang = "zh";
     }
-    document.documentElement.setAttribute('lang', lang);
-    return lang
+  }
+  document.documentElement.setAttribute("lang", lang);
+  return lang;
 }
 
-
-export function setupI18n(options = { locale: 'zh' }) {
-    const i18n = createI18n(options)
-    setI18nLanguage(i18n, options.locale)
-    return i18n
+export function setupI18n(options = { locale: "zh" }) {
+  i18n = createI18n(options);
+  setI18nLanguage(i18n, options.locale);
+  return i18n;
 }
 
 export function setI18nLanguage(i18n, locale) {
-    if (i18n.mode === 'legacy') {
-        i18n.global.locale = locale
-    } else {
-        i18n.global.locale.value = locale
-    }
-    /**
-     * NOTE:
-     * If you need to specify the language setting for headers, such as the `fetch` API, set it here.
-     * The following is an example for axios.
-     *
-     * axios.defaults.headers.common['Accept-Language'] = locale
-     */
-    document.querySelector('html').setAttribute('lang', locale)
+  if (i18n.mode === "legacy") {
+    i18n.global.locale = locale;
+  } else {
+    i18n.global.locale.value = locale;
+  }
+  /**
+   * NOTE:
+   * If you need to specify the language setting for headers, such as the `fetch` API, set it here.
+   * The following is an example for axios.
+   *
+   * axios.defaults.headers.common['Accept-Language'] = locale
+   */
+  document.querySelector("html").setAttribute("lang", locale);
 }
 
 export async function loadLocaleMessages(i18n, locale) {
-    // load locale messages with dynamic import
-    // set locale and locale message
-    const messages = await import(/* webpackChunkName: "locale-[request]" */ `../locales/${locale}.json`)
-    i18n.global.setLocaleMessage(locale, messages.default)
-    return nextTick()
+  // load locale messages with dynamic import
+  // set locale and locale message
+  const messages = await import(
+    /* webpackChunkName: "locale-[request]" */ `../locales/${locale}.json`
+  );
+  i18n.global.setLocaleMessage(locale, messages.default);
+  return nextTick();
 }
 
 export default setupI18n({
-    globalInjection: true,
-    legacy: false,
-    locale: '',
-    fallbackLocale: 'zh',
-})
+  globalInjection: true,
+  legacy: false,
+  locale: "",
+  fallbackLocale: "zh",
+});

+ 1 - 1
packages/qjkankan-view/src/pages/show.vue

@@ -96,7 +96,7 @@ onMounted(async () => {
       hasPasswordLock.value = true;
     }
     store.commit("scene/setMetaData", data);
-    document.title = data.name || t("common.no_title");
+    // document.title = data.name || t("common.no_title");
 
     let firstScene = "";
 

+ 2 - 1
packages/qjkankan-view/src/pages/showMobile.vue

@@ -97,7 +97,8 @@ onMounted(async () => {
       hasPasswordLock.value = true;
     }
     store.commit("scene/setMetaData", data);
-    document.title = data.name || t("common.no_title");
+    
+    // document.title = data.name || t("common.no_title");
 
     let firstScene = "";
 

+ 2 - 3
packages/qjkankan-view/src/store/modules/scene.js

@@ -1,4 +1,4 @@
-import i18n from "@/i18n";
+import { useI18n, i18n, getLocale } from "@/i18n";
 
 /**
  * 兼容自定主义按键为中文的处理器
@@ -173,8 +173,7 @@ export default {
     },
     setMetaData(state, payload) {
       state.metadata = payload;
-      document.title = payload.name || i18n.t("common.no_title");
-      // debugger
+      document.title = payload.name;
       document
         .querySelector('meta[name="description"]')
         .setAttribute(

+ 5 - 0
yarn.lock

@@ -10194,6 +10194,11 @@ is-callable@^1.1.3, is-callable@^1.1.4, is-callable@^1.2.7:
   resolved "https://mirrors.cloud.tencent.com/npm/is-callable/-/is-callable-1.2.7.tgz#3bc2a85ea742d9e36205dcacdd72ca1fdc51b055"
   integrity sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==
 
+is-chinese-phone-number@^0.1.9:
+  version "0.1.9"
+  resolved "http://192.168.0.47:4873/is-chinese-phone-number/-/is-chinese-phone-number-0.1.9.tgz#48e8239904f5669871beee1d354f920cb3e3a909"
+  integrity sha512-yy4X7tlL2NYPZRPf+B/LLwnBHaZiQ3HpJchSyci6Ffue1UGlui4cCpyH6vQM9Sx5QQAg9TMZZ3f5Br3h5BsSSw==
+
 is-ci@^1.0.10:
   version "1.2.1"
   resolved "https://mirrors.cloud.tencent.com/npm/is-ci/-/is-ci-1.2.1.tgz#e3779c8ee17fccf428488f6e281187f2e632841c"