Lijy преди 6 месеца
родител
ревизия
b1e3b6fcc1

+ 2 - 2
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/components/common/formForm/formItem.vue

@@ -72,7 +72,7 @@
       :class="element.options?.rules?.required ? '' : 'resetStyles'"
     >
       <template #input v-if="element.options.defaultValue">
-        {{ selectedLabel }}
+        <TranslationComponent :openId="selectedLabel" />
       </template>
     </van-field>
   </template>
@@ -244,7 +244,7 @@ function processingData() {
 function requestData(str = "") {
   const url = str.replace(/^(\/?api)/, "").trim();
   if(url.indexOf("getSimpleActiveUserListNew") > -1 && fixedData.allUserData.length) {
-    props.element.options = fixedData.allUserData
+    props.element.options.options = fixedData.allUserData
     return
   }
 

+ 3 - 3
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/components/common/pullDownSelector.vue

@@ -20,7 +20,7 @@
                     <van-radio :name="item.value" />
                   </template>
                   <template #title>
-                    {{ item.label }}
+                    <TranslationComponent :openId="item.label" />
                   </template>
                 </van-cell>
               </van-cell-group>
@@ -36,7 +36,7 @@
                   <van-checkbox :name="item.value" :ref="(el) => (checkboxRefs[index] = el)" @click.stop />
                 </template>
                 <template #title>
-                  {{ item.label }}
+                  <TranslationComponent :openId="item.label" />
                 </template>
               </van-cell>
             </van-cell-group>
@@ -45,7 +45,7 @@
       </template>
     </div>
     <div class="w-full pb-2 px-4">
-      <van-button type="primary" round class="w-full" :disabled="!selectChecked || !selectChecked.length" @click="confirmClick">确定</van-button>
+      <van-button type="primary" round class="w-full" :disabled="multipleChoice ? !selectChecked.length : !selectChecked" @click="confirmClick">确定</van-button>
     </div>
   </div>
 </template>

+ 27 - 4
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/components/common/translationComponent.vue

@@ -1,17 +1,40 @@
 <template>
-  <Page title='首页'>
-    <template v-slot:body>
+  <template v-if="userInfo.userNameNeedTranslate == 1">
+    <template v-if="Array.isArray(openId)">
+      <template v-for="(item, index) in openId">
+        <ww-open-data :type='type' :openid='item'></ww-open-data>
+        <span v-if="index < openId.length - 1">,</span>
+      </template>
     </template>
-  </Page>
+    <ww-open-data :type='type' :openid='openId' v-else></ww-open-data>
+  </template>
+  <template v-else>
+    {{ Array.isArray(openId) ? openId.join(',') : openId }} 😔
+  </template>
 </template>
 
 <script setup>
 import { ref } from 'vue';
-import { useLifecycle } from '@hooks/useCommon.js';
+import { useLifecycle, useEnv } from '@hooks/useCommon.js';
+import useInfoStore from '@store/useInfoStore'
+
+const props = defineProps({
+  openId: {
+    type: [String, Number],
+    default: () => '',
+  },
+  type: {
+    type: String,
+    default: () => 'userName',
+  }
+});
+const userInfo = useInfoStore()
+
 
 useLifecycle({
   load: () => {
     // 添加加载逻辑
+    console.log(useEnv(), '<==== useEnv')
   }
 });
 </script>

+ 7 - 1
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/main.js

@@ -2,9 +2,12 @@ import { createApp } from "vue";
 import App from "@/App.vue";
 import router from "@/router.js";
 import pinia from "@store/pinia.js";
-import Page from "@components/layout/Page.vue";
 import customize from "@utility/customInstructions.js"
 
+// 引入页面
+import Page from "@components/layout/Page.vue";
+import TranslationComponent from "@components/common/translationComponent.vue"
+
 // 引入样式
 import "@/style.scss";
 import "@/assets/tailwind.css"
@@ -14,6 +17,9 @@ import 'vant/lib/index.css'
 
 const app = createApp(App);
 
+// 注册全局转译组件
+app.component('TranslationComponent', TranslationComponent);
+
 // 注册自定义指令
 for (const [key, value] of Object.entries(customize)) {
    app.directive(value.key, value.directive)

+ 5 - 0
fhKeeper/formulahousekeeper/customerBuler-crm-h5/vite.config.js

@@ -44,6 +44,11 @@ export default defineConfig({
   build: {
     chunkSizeWarningLimit: 1600,
   },
+  vue: {
+    compilerOptions: {
+      isCustomElement: (tag) => tag == 'ww-open-data'  // 排除 ww-open-data
+    }
+  },
   resolve: {
     alias: [
       { find: "@", replacement: path.resolve(__dirname, "src") },