Explorar el Código

添加快速获取手机号逻辑

xiaohaizhao hace 1 año
padre
commit
44e86b7c18
Se han modificado 1 ficheros con 41 adiciones y 5 borrados
  1. 41 5
      components/my_form.vue

+ 41 - 5
components/my_form.vue

@@ -25,8 +25,11 @@
               <text class="must" v-if="item.isMust">*</text>
               {{ item.label }}:
             </view>
-            <view class="content-box">
-              <view class="content" style="flex: 1">
+            <view class="content-box" style="flex: 1">
+              <view
+                class="content"
+                style="display: flex; flex: 1; box-sizing: border-box"
+              >
                 <input
                   v-if="item.inputmode == 'number'"
                   type="number"
@@ -35,7 +38,7 @@
                   :focus="focusLabel == item.label"
                   :placeholder="item.placeholder || '请填写' + item.label"
                   :value="item.value"
-                  :style="{ width: item.value ? tovw(220) : tovw(240) }"
+                  style="flex: 1"
                   @input="onInput($event, index)"
                   :maxlength="item.maxlength || '499'"
                   confirm-type="done"
@@ -48,7 +51,7 @@
                   :focus="focusLabel == item.label"
                   :placeholder="item.placeholder || '请填写' + item.label"
                   :value="item.value"
-                  :style="{ width: item.value ? tovw(220) : tovw(240) }"
+                  style="flex: 1"
                   @input="onInput($event, index)"
                   :maxlength="item.maxlength || '499'"
                   confirm-type="done"
@@ -62,7 +65,7 @@
                   :focus="focusLabel == item.label"
                   :placeholder="item.placeholder || '请填写' + item.label"
                   :value="item.value"
-                  :style="{ width: item.value ? tovw(220) : tovw(240) }"
+                  style="flex: 1; width: 0; box-sizing: border-box"
                   @input="onInput($event, index)"
                   :maxlength="item.maxlength || '499'"
                   confirm-type="done"
@@ -74,6 +77,21 @@
                   size="3.733vw"
                   @click="onClearInput(index)"
                 />
+                <view style="margin-left: 6px" v-if="item.getPhoneNumber">
+                  <u-button
+                    color="#C30D23"
+                    size="small"
+                    open-type="getPhoneNumber"
+                    @click.stop=""
+                    @getphonenumber="butGetphonenumber($event, index)"
+                  >
+                    获取微信
+                    <text
+                      class="iconfont icon-dianhua-hui"
+                      style="font-size: 12px; margin-left: 3px"
+                    />
+                  </u-button>
+                </view>
               </view>
               <view v-if="item.errText" class="err-text">
                 <icon
@@ -599,6 +617,24 @@ export default {
       }
       this.verify();
     },
+    butGetphonenumber(e, index) {
+      if (e.detail.code) {
+        this.$Http
+          .basic({
+            id: 20240520110702,
+            content: {
+              systemclient: "marketingtool",
+              code: e.detail.code,
+            },
+          })
+          .then((res) => {
+            console.log("获取手机号", res);
+            if (this.cutoff(res.msg)) return;
+            this.$set(this.list[index], "value", res.data.phoneNumber);
+            this.verify();
+          });
+      }
+    },
     onInput(e, index) {
       let item = this.list[index];
       item.errText = "";