소스 검색

Revert "【MiniProgram】update Miniprogram"

This reverts commit 7f7f8e23a21f09ef016ac381a1d2db20342133a0.
connor 11 달 전
부모
커밋
866bf0790d

+ 34 - 38
MiniProgram/configureProject_bin.js

@@ -45,24 +45,20 @@ class InitProject {
   init(answers) {
     const { creationMethod } = answers;
     this.answers = answers;
-    this.srcPath =
-      creationMethod === 'CLI'
-        ? path.join(this.destBase, './src')
-        : this.destBase;
+    this.srcPath = creationMethod === 'CLI'
+      ? path.join(this.destBase, './src')
+      : this.destBase;
   }
 
   async run() {
-    const { setManifestJSON, setPagesJSON } =
-      await this.askForProjectCreationMethod(); // CLI or HBuilderX
+    const { setManifestJSON, setPagesJSON } = await this.askForProjectCreationMethod(); // CLI or HBuilderX
     this.copyFile();
     setManifestJSON && this.setManifest();
     setPagesJSON && this.setPages();
     this.addStyleToApp();
   }
   async askForProjectCreationMethod() {
-    console.log(
-      '配置相关说明,请参考:https://cloud.tencent.com/document/product/647/97754#2.2-.E9.A1.B9.E7.9B.AE.E9.85.8D.E7.BD.AE.E6.9B.B4.E6.94.B9'
-    );
+    console.log('配置相关说明,请参考:https://cloud.tencent.com/document/product/647/97754#2.2-.E9.A1.B9.E7.9B.AE.E9.85.8D.E7.BD.AE.E6.9B.B4.E6.94.B9');
     const questions = [
       {
         type: 'list',
@@ -111,18 +107,18 @@ class InitProject {
     const { creationMethod, createViteConfig, createTsConfig } = this.answers;
 
     // Copy roomkit and locales directories
-    ['roomkit', 'locales', 'router'].forEach(dir => {
+    ['roomkit', 'locales', 'router'].forEach((dir) => {
       copyDir(
         path.join(this.sourceBase, './src', dir),
-        path.join(this.srcPath, dir)
+        path.join(this.srcPath, dir),
       );
     });
 
     // Copy wxmini_dev.sh and wxmini_prod.sh files
-    ['wxmini_dev.sh', 'wxmini_prod.sh'].forEach(file => {
+    ['wxmini_dev.sh', 'wxmini_prod.sh'].forEach((file) => {
       fs.copyFileSync(
         path.join(this.sourceBase, file),
-        path.join(this.destBase, file)
+        path.join(this.destBase, file),
       );
     });
 
@@ -131,12 +127,12 @@ class InitProject {
     createDirIfNotExist(path.dirname(wasmDest));
     fs.copyFileSync(
       './node_modules/@tencentcloud/tuiroom-engine-wx/RTCRoomEngine.wasm.br',
-      path.join(this.srcPath, wasmDest)
+      path.join(this.srcPath, wasmDest),
     );
 
     fs.copyFileSync(
       path.join(this.sourceBase, 'src/pages/index.vue'),
-      path.join(this.srcPath, 'pages/roomkitTest.vue')
+      path.join(this.srcPath, 'pages/roomkitTest.vue'),
     );
 
     if (createViteConfig) {
@@ -145,9 +141,9 @@ class InitProject {
           this.sourceBase,
           creationMethod === 'CLI'
             ? './vite.config.ts'
-            : 'vite.config_HBuliderX.ts'
+            : 'vite.config_HBuliderX.ts',
         ),
-        path.join(this.destBase, 'vite.config.ts')
+        path.join(this.destBase, 'vite.config.ts'),
       );
     }
 
@@ -155,9 +151,9 @@ class InitProject {
       fs.copyFileSync(
         path.join(
           this.sourceBase,
-          creationMethod === 'CLI' ? 'tsconfig.json' : 'tsconfig_HBuliderX.json'
+          creationMethod === 'CLI' ? 'tsconfig.json' : 'tsconfig_HBuliderX.json',
         ),
-        path.join(this.destBase, 'tsconfig.json')
+        path.join(this.destBase, 'tsconfig.json'),
       );
     }
   }
@@ -177,21 +173,21 @@ class InitProject {
         packNpmManually: true,
         packNpmRelationList: [
           ...(oldConfig?.setting?.packNpmRelationList || []),
-          ...(oldConfig?.setting?.packNpmRelationList &&
-          oldConfig?.setting?.packNpmRelationList[
+          ...(oldConfig?.setting?.packNpmRelationList
+          && oldConfig?.setting?.packNpmRelationList[
             oldConfig?.setting?.packNpmRelationList.length - 1
           ]?.packageJsonPath === './roomkit/package.json'
             ? []
             : [
-                {
-                  packageJsonPath: './package.json',
-                  miniprogramNpmDistDir: './',
-                },
-                {
-                  packageJsonPath: './roomkit/package.json',
-                  miniprogramNpmDistDir: './roomkit',
-                },
-              ]),
+              {
+                packageJsonPath: './package.json',
+                miniprogramNpmDistDir: './',
+              },
+              {
+                packageJsonPath: './roomkit/package.json',
+                miniprogramNpmDistDir: './roomkit',
+              },
+            ]),
         ],
       },
       usingComponents: true,
@@ -208,7 +204,7 @@ class InitProject {
       manifestContent,
       ['mp-weixin'],
       manifest['mp-weixin'],
-      { formattingOptions: { insertSpaces: true, tabSize: 2 } }
+      { formattingOptions: { insertSpaces: true, tabSize: 2 } },
     );
     const newContent = jsoncParser.applyEdits(manifestContent, edits);
 
@@ -229,17 +225,17 @@ class InitProject {
       pages: [
         pages?.pages[0]?.path !== 'pages/roomkitTest'
           ? {
-              path: 'pages/roomkitTest',
-              style: {
-                navigationBarTitleText: '',
-              },
-            }
+            path: 'pages/roomkitTest',
+            style: {
+              navigationBarTitleText: '',
+            },
+          }
           : null,
         ...(pages?.pages || []),
       ].filter(Boolean),
       subpackages: [
-        ...((pages?.subpackages && pages.subpackages[0]?.root !== 'roomkit') ||
-          []),
+        ...((pages?.subpackages && pages.subpackages[0]?.root !== 'roomkit')
+          || []),
         {
           root: 'roomkit',
           pages: [

+ 4 - 4
MiniProgram/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@tencentcloud/tui-roomkit-uniapp",
-  "version": "3.0.0",
+  "version": "2.9.1",
   "bin": {
     "configureProject": "./configureProject_bin.js"
   },
@@ -57,12 +57,12 @@
     "@dcloudio/uni-mp-weixin": "3.0.0-alpha-3070720230316001",
     "@dcloudio/uni-quickapp-webview": "3.0.0-alpha-3070720230316001",
     "@dcloudio/vue-cli-plugin-uni-optimize": "2.0.2-3080720230703001",
-    "@tencentcloud/chat": "^3.5.2",
+    "@tencentcloud/chat": "latest",
     "@tencentcloud/trtc-component-wx": "^1.0.2",
     "@tencentcloud/tui-core": "latest",
-    "@tencentcloud/tuiroom-engine-wx": "~3.0.0",
-    "@tencentcloud/uikit-base-component-uni": "0.3.2",
+    "@tencentcloud/tuiroom-engine-wx": "2.9.1",
     "@tencentcloud/universal-api": "^2.0.9",
+    "@tencentcloud/uikit-base-component-uni": "^0.3.1",
     "axios": "^0.27.2",
     "inquirer": "^9.2.11",
     "interactjs": "^1.10.26",

+ 15 - 51
MiniProgram/src/roomkit/TUIRoom/components/common/SwitchTheme.vue

@@ -21,11 +21,11 @@
         <span>{{ t('Theme Colours') }}</span>
         <div class="color-blocks two-blocks">
           <div
-            :class="['color-block black', { active: currentTheme === 'dark' }]"
+            class="color-block black"
             @click="toggleCustomTheme('dark')"
           ></div>
           <div
-            :class="['color-block white', { active: currentTheme === 'light' }]"
+            class="color-block white"
             @click="toggleCustomTheme('light')"
           ></div>
         </div>
@@ -34,31 +34,16 @@
         <span>{{ t('Custom Themes') }}</span>
         <div class="color-blocks four-blocks">
           <div
-            :class="[
-              'color-block theme',
-              { active: currentCustomTheme === 'theme' },
-            ]"
+            class="color-block theme"
             @click="toggleCustomTheme('theme')"
           ></div>
           <div
-            :class="[
-              'color-block green',
-              { active: currentCustomTheme === 'green' },
-            ]"
+            class="color-block green"
             @click="toggleCustomTheme('green')"
           ></div>
+          <div class="color-block red" @click="toggleCustomTheme('red')"></div>
           <div
-            :class="[
-              'color-block red',
-              { active: currentCustomTheme === 'red' },
-            ]"
-            @click="toggleCustomTheme('red')"
-          ></div>
-          <div
-            :class="[
-              'color-block orange',
-              { active: currentCustomTheme === 'orange' },
-            ]"
+            class="color-block orange"
             @click="toggleCustomTheme('orange')"
           ></div>
         </div>
@@ -68,7 +53,7 @@
 </template>
 
 <script setup lang="ts">
-import { withDefaults, defineProps, ref, computed } from 'vue';
+import { withDefaults, defineProps, ref } from 'vue';
 import IconButton from './base/IconButton.vue';
 import SwitchThemeIcon from '../../assets/icons/SwitchThemeIcon.svg';
 import { IconButtonLayout } from '../../constants/room';
@@ -84,8 +69,6 @@ const basicStore = useBasicStore();
 const { theme, setTheme } = useUIKit();
 const isShowThemeColorContainer = ref(false);
 const switchThemeConfig = roomService.getComponentConfig('SwitchTheme');
-const currentCustomTheme = ref('theme');
-const currentTheme = computed(() => theme.value || basicStore.defaultTheme);
 
 interface Props {
   visible?: boolean;
@@ -100,8 +83,14 @@ function handleSwitchTheme() {
     isShowThemeColorContainer.value = !isShowThemeColorContainer.value;
     return;
   }
-  const newTheme = currentTheme.value === 'light' ? 'dark' : 'light';
-  theme.value ? setTheme(newTheme) : roomService.setTheme(newTheme);
+  const currentTheme = theme.value || basicStore.defaultTheme;
+  const newTheme = currentTheme === 'light' ? 'dark' : 'light';
+
+  if (theme.value) {
+    setTheme(newTheme);
+  } else {
+    roomService.setTheme(newTheme);
+  }
 }
 
 function toggleCustomTheme(newTheme: string) {
@@ -115,10 +104,6 @@ function toggleCustomTheme(newTheme: string) {
     ? newTheme
     : { themeStyle: theme.value, primaryColor: newTheme };
   setTheme(themeConfig);
-
-  if (!isBaseTheme) {
-    currentCustomTheme.value = newTheme;
-  }
 }
 
 function handleClickOutSide() {
@@ -167,44 +152,23 @@ function handleClickOutSide() {
       .color-block {
         cursor: pointer;
         border-radius: 6px;
-        &.active {
-          outline-offset: 2px;
-        }
         &.black {
           background-color: var(--uikit-color-black-1);
-          &.active {
-            outline: 1px solid var(--uikit-color-theme-6);
-          }
         }
         &.white {
           background-color: var(--uikit-color-white-1);
-          &.active {
-            outline: 1px solid var(--uikit-color-theme-6);
-          }
         }
         &.red {
           background-color: var(--uikit-color-red-6);
-          &.active {
-            outline: 1px solid var(--uikit-color-red-6);
-          }
         }
         &.green {
           background-color: var(--uikit-color-green-6);
-          &.active {
-            outline: 1px solid var(--uikit-color-green-6);
-          }
         }
         &.orange {
           background-color: var(--uikit-color-orange-6);
-          &.active {
-            outline: 1px solid var(--uikit-color-orange-6);
-          }
         }
         &.theme {
           background-color: var(--uikit-color-theme-6);
-          &.active {
-            outline: 1px solid var(--uikit-color-theme-6);
-          }
         }
       }
     }

+ 3 - 0
MiniProgram/src/roomkit/TUIRoom/services/manager/roomActionManager.ts

@@ -20,6 +20,9 @@ smallParam.videoResolution = TRTCVideoResolution.TRTCVideoResolution_640_360;
 smallParam.videoFps = 10;
 smallParam.videoBitrate = 550;
 
+export enum FetchRoomInfoErrorCode {
+  ROOM_NOT_EXIST = -2100,
+}
 export interface DeviceParams {
   isOpenCamera?: boolean;
   isOpenMicrophone?: boolean;

+ 2 - 2
MiniProgram/src/roomkit/TUIRoom/services/manager/scheduleConferenceManager.ts

@@ -7,10 +7,10 @@ import {
   TUIUserInfo,
   TUIConferenceStatus,
   TUIConferenceModifyInfo,
-  TUIErrorCode,
 } from '@tencentcloud/tuiroom-engine-wx';
 import { EventType, IRoomService } from '../types';
 import mitt from 'mitt';
+import { FetchRoomInfoErrorCode } from './roomActionManager.ts';
 export * from '@tencentcloud/tuiroom-engine-wx';
 interface IScheduleConferenceManager {
   on(
@@ -255,7 +255,7 @@ export class ScheduleConferenceManager implements IScheduleConferenceManager {
       });
       return await this.generateRoomId(attempt + 1);
     } catch (err: any) {
-      if (err?.code === TUIErrorCode.ERR_ROOM_ID_NOT_EXIST) {
+      if (err?.code === FetchRoomInfoErrorCode.ROOM_NOT_EXIST) {
         return roomId;
       }
       throw err;

BIN
MiniProgram/src/static/RTCRoomEngine.wasm.br


+ 1 - 1
MiniProgram/wxmini_dev.bat

@@ -8,4 +8,4 @@ if exist "dist\dev\mp-weixin" (
   exit /b 1
 )
 
-npm init -y && npm i @tencentcloud/trtc-component-wx@^1.0.2 --no-package-lock && cd roomkit && npm init -y && npm i @tencentcloud/tuiroom-engine-wx@~3.0.0 --no-package-lock && npm i @tencentcloud/chat@^3.5.2 --no-package-lock && npm i @tencentcloud/tui-core --no-package-lock
+npm init -y && npm i @tencentcloud/trtc-component-wx --no-package-lock && cd roomkit && npm init -y && npm i @tencentcloud/tuiroom-engine-wx@2.9.1 --no-package-lock && npm i @tencentcloud/chat --no-package-lock && npm i @tencentcloud/tui-core --no-package-lock

+ 3 - 3
MiniProgram/wxmini_dev.sh

@@ -1,9 +1,9 @@
 cd dist/dev/mp-weixin
 cd unpackage/dist/dev/mp-weixin
 npm init -y
-npm i @tencentcloud/trtc-component-wx@^1.0.2 --no-package-lock
+npm i @tencentcloud/trtc-component-wx --no-package-lock
 cd roomkit
 npm init -y
-npm i @tencentcloud/tuiroom-engine-wx@~3.0.0 --no-package-lock
-npm i @tencentcloud/chat@^3.5.2 --no-package-lock
+npm i @tencentcloud/tuiroom-engine-wx@2.9.1 --no-package-lock
+npm i @tencentcloud/chat --no-package-lock
 npm i @tencentcloud/tui-core --no-package-lock

+ 1 - 1
MiniProgram/wxmini_prod.bat

@@ -8,4 +8,4 @@ if exist "dist\build\mp-weixin" (
   exit /b 1
 )
 
-npm init -y && npm i @tencentcloud/trtc-component-wx@^1.0.2 --no-package-lock && cd roomkit && npm init -y && npm i @tencentcloud/tuiroom-engine-wx@~3.0.0 --no-package-lock && npm i @tencentcloud/chat@^3.5.2 --no-package-lock && npm i @tencentcloud/tui-core --no-package-lock
+npm init -y && npm i @tencentcloud/trtc-component-wx --no-package-lock && cd roomkit && npm init -y && npm i @tencentcloud/tuiroom-engine-wx@2.9.1 --no-package-lock && npm i @tencentcloud/chat --no-package-lock && npm i @tencentcloud/tui-core --no-package-lock

+ 3 - 3
MiniProgram/wxmini_prod.sh

@@ -1,9 +1,9 @@
 cd dist/build/mp-weixin
 cd unpackage/dist/build/mp-weixin
 npm init -y
-npm i @tencentcloud/trtc-component-wx@^1.0.2 --no-package-lock
+npm i @tencentcloud/trtc-component-wx --no-package-lock
 cd roomkit
 npm init -y
-npm i @tencentcloud/tuiroom-engine-wx@~3.0.0 --no-package-lock
-npm i @tencentcloud/chat@^3.5.2 --no-package-lock
+npm i @tencentcloud/tuiroom-engine-wx@2.9.1 --no-package-lock
+npm i @tencentcloud/chat --no-package-lock
 npm i @tencentcloud/tui-core --no-package-lock