Переглянути джерело

Merge branch 'test' into release-buffer

chenlei 1 рік тому
батько
коміт
51fd717277
4 змінених файлів з 10 додано та 6 видалено
  1. 1 0
      .prettierignore
  2. 2 0
      README.md
  3. 5 4
      public/js/manage.js
  4. 2 2
      scripts/publish.js

+ 1 - 0
.prettierignore

@@ -1,4 +1,5 @@
 build/
+public/
 **/*.png
 **/*.svg
 **/*.jpg

+ 2 - 0
README.md

@@ -32,6 +32,8 @@ yarn serve
 
 ### 多场景模式
 
+⚠️ `/public` 下为公用文件,不要在场景分支里修改
+
 通过 `process.env.SCENE` 区分场景
 
 尽量避免使用 `.vue` 自定义后缀,ide 暂不能友好支持模糊匹配 `.vue`,需要明确使用 `demo.vue`,导致无法区分场景

+ 5 - 4
public/js/manage.js

@@ -1768,9 +1768,11 @@ Manage.prototype.loadAudio = function () {
       if (state) {
         $('#volume a img').attr('src', './images/Volume btn_off.png');
         $('#volume').attr('title', '关闭声音');
+        $('#volume').addClass('active');
       } else {
         $('#volume a img').attr('src', './images/Volume btn_on.png');
         $('#volume').attr('title', '打开声音');
+        $('#volume').removeClass('active');
       }
     },
   });
@@ -1793,11 +1795,10 @@ Manage.prototype.loadAudio = function () {
   });
 
   $('#volume')
-    .find('a')
-    .on('click', () => {
-      if ($('#volume img')[0].src.indexOf('btn_on.png') > -1) {
+    .on('click', (e) => {
+      if (!$('#volume').hasClass('active')) {
         this.switchBgmState(true);
-      } else if ($('#volume img')[0].src.indexOf('btn_off.png') > -1) {
+      } else {
         this.switchBgmState(false);
       }
     });

+ 2 - 2
scripts/publish.js

@@ -5,9 +5,9 @@ const SCENE = process.env.SCENE;
 fs.ensureDirSync('.temp');
 fs.emptyDirSync('.temp');
 
-const distDir = `build${!!SCENE ? '/' + SCENE : ''}`;
+const distDir = `build${SCENE ? '/' + SCENE : ''}`;
 
-ch.execSync(`npm run build${!!SCENE ? ':' + SCENE : ''}:test`, {
+ch.execSync(`npm run build${SCENE ? ':' + SCENE : ''}:test`, {
   stdio: ['ignore', 'inherit', 'inherit'],
 });