shish 2 месяцев назад
Родитель
Сommit
de0fce4e6b
2 измененных файлов с 62 добавлено и 56 удалено
  1. 31 28
      ghsApp/src/pagesClient/official/apply.vue
  2. 31 28
      hdApp/src/pagesClient/official/apply.vue

+ 31 - 28
ghsApp/src/pagesClient/official/apply.vue

@@ -60,9 +60,29 @@
           <view class="module-com apply-card">
             <tui-list-cell class="line-cell code-wrap name-wrap" :hover="false">
               <view class="tui-title required">姓名</view>
-              <input v-model="form.adminName" type="text" placeholder-class="phcolor" placeholder-style="color:#CCCCCC" class="tui-input tui-input--code" name="adminName" placeholder="申请人姓名" />
               <!-- #ifdef MP-WEIXIN -->
-              <button class="apply-code-btn apply-fill-btn" @click="fillWxName">帮我填</button>
+              <input
+                v-model="form.adminName"
+                type="nickname"
+                placeholder-class="phcolor"
+                placeholder-style="color:#CCCCCC"
+                class="tui-input"
+                name="adminName"
+                placeholder="申请人姓名"
+                @blur="onNameBlur"
+                @input="onNameInput"
+              />
+              <!-- #endif -->
+              <!-- #ifndef MP-WEIXIN -->
+              <input
+                v-model="form.adminName"
+                type="text"
+                placeholder-class="phcolor"
+                placeholder-style="color:#CCCCCC"
+                class="tui-input"
+                name="adminName"
+                placeholder="申请人姓名"
+              />
               <!-- #endif -->
             </tui-list-cell>
             <tui-list-cell class="line-cell code-wrap mobile-wrap" :hover="false">
@@ -150,7 +170,7 @@ import htzImageUpload from '@/components/htz-image-upload/htz-image-upload.vue'
 import { APIHOST } from '@/config'
 import { getHasMap } from "@/api/express"
 import { mapNearby } from '@/api/map/index'
-import { getMobile, getNickname } from '@/api/auth'
+import { getMobile } from '@/api/auth'
 // #ifdef APP-PLUS
 import permision from "@/utils/wa-permission_1.1/permission.js";
 // #endif
@@ -379,32 +399,15 @@ export default {
       this.hasGet = false
       this.count = 120
     },
-    fillWxName() {
-      let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
-      if (this.$util.isEmpty(currentMiniOpenId)) {
-        this.$msg('获取失败,请重新打开小程序')
-        return false
+    onNameBlur(e) {
+      if (e.detail && typeof e.detail.value === 'string') {
+        this.form.adminName = e.detail.value.trim()
+      }
+    },
+    onNameInput(e) {
+      if (e.detail && typeof e.detail.value === 'string') {
+        this.form.adminName = e.detail.value.trim()
       }
-      uni.getUserProfile({
-        desc: '获取微信昵称',
-        success: (res) => {
-          getNickname({
-            iv: res.iv,
-            encryptedData: res.encryptedData,
-            miniOpenId: currentMiniOpenId
-          }).then(subRes => {
-            const name = (subRes.data && (subRes.data.name || subRes.data.nickName)) || ''
-            if (name) {
-              this.form.adminName = name
-            } else {
-              this.$msg('没获取到微信昵称')
-            }
-          })
-        },
-        fail: () => {
-          this.$msg('获取失败')
-        }
-      })
     },
     getSj(e) {
       let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')

+ 31 - 28
hdApp/src/pagesClient/official/apply.vue

@@ -50,9 +50,29 @@
           <view class="module-com apply-card">
             <tui-list-cell class="line-cell code-wrap name-wrap" :hover="false">
               <view class="tui-title required">姓名</view>
-              <input v-model="form.adminName" type="text" placeholder-class="phcolor" placeholder-style="color:#CCCCCC" class="tui-input tui-input--code" name="adminName" placeholder="请填写姓名" />
               <!-- #ifdef MP-WEIXIN -->
-              <button class="apply-code-btn apply-fill-btn" @click="fillWxName">帮我填</button>
+              <input
+                v-model="form.adminName"
+                type="nickname"
+                placeholder-class="phcolor"
+                placeholder-style="color:#CCCCCC"
+                class="tui-input"
+                name="adminName"
+                placeholder="请填写姓名"
+                @blur="onNameBlur"
+                @input="onNameInput"
+              />
+              <!-- #endif -->
+              <!-- #ifndef MP-WEIXIN -->
+              <input
+                v-model="form.adminName"
+                type="text"
+                placeholder-class="phcolor"
+                placeholder-style="color:#CCCCCC"
+                class="tui-input"
+                name="adminName"
+                placeholder="请填写姓名"
+              />
               <!-- #endif -->
             </tui-list-cell>
             <tui-list-cell class="line-cell code-wrap mobile-wrap" :hover="false">
@@ -143,7 +163,7 @@ import { getShopInfo} from "@/utils/auth";
 import { getDictionaries } from '@/api/mini'
 import { checkShop } from '@/api/shop'
 import { ghsInfo } from "@/api/ghs/index";
-import { getMobile, getNickname } from "@/api/auth";
+import { getMobile } from "@/api/auth";
 import { getHasMap } from "@/api/express"
 import { mapNearby } from '@/api/map/index'
 import { iconSrc } from '@/utils/iconSrc'
@@ -399,32 +419,15 @@ export default {
       this.hasGet = false
       this.count = 120
     },
-    fillWxName() {
-      let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
-      if (this.$util.isEmpty(currentMiniOpenId)) {
-        this.$msg('获取失败,请重新打开小程序')
-        return false
+    onNameBlur(e) {
+      if (e.detail && typeof e.detail.value === 'string') {
+        this.form.adminName = e.detail.value.trim()
+      }
+    },
+    onNameInput(e) {
+      if (e.detail && typeof e.detail.value === 'string') {
+        this.form.adminName = e.detail.value.trim()
       }
-      uni.getUserProfile({
-        desc: '获取微信昵称',
-        success: (res) => {
-          getNickname({
-            iv: res.iv,
-            encryptedData: res.encryptedData,
-            miniOpenId: currentMiniOpenId
-          }).then(subRes => {
-            const name = (subRes.data && (subRes.data.name || subRes.data.nickName)) || ''
-            if (name) {
-              this.form.adminName = name
-            } else {
-              this.$msg('没获取到微信昵称')
-            }
-          })
-        },
-        fail: () => {
-          this.$msg('获取失败')
-        }
-      })
     },
 		getSj(e){
 			let that = this