shish hai 2 meses
pai
achega
a815c2eb5d

+ 4 - 0
ghsApp/src/api/auth/index.js

@@ -18,6 +18,10 @@ export const getMobile = data => {
 	return https.post('/auth/get-mobile', data)
 }
 
+export const getNickname = data => {
+	return https.post('/auth/get-nickname', data)
+}
+
 //服务协议
 export const getRegisterAgreement = data => {
 	return https.get('/auth/register', data)

+ 33 - 3
ghsApp/src/pagesClient/official/apply.vue

@@ -58,9 +58,12 @@
         <view class="apply-section">
           <view class="apply-section-title">申请人信息</view>
           <view class="module-com apply-card">
-            <tui-list-cell class="line-cell" :hover="false">
+            <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" name="adminName" placeholder="申请人姓名" />
+              <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>
+              <!-- #endif -->
             </tui-list-cell>
             <tui-list-cell class="line-cell code-wrap mobile-wrap" :hover="false">
               <view class="tui-title required">手机号</view>
@@ -147,7 +150,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 } from '@/api/auth'
+import { getMobile, getNickname } from '@/api/auth'
 // #ifdef APP-PLUS
 import permision from "@/utils/wa-permission_1.1/permission.js";
 // #endif
@@ -362,6 +365,33 @@ export default {
       this.hasGet = false
       this.count = 120
     },
+    fillWxName() {
+      let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
+      if (this.$util.isEmpty(currentMiniOpenId)) {
+        this.$msg('获取失败,请重新打开小程序')
+        return false
+      }
+      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')
       if (e.detail.errMsg === 'getPhoneNumber:ok') {

+ 4 - 0
hdApp/src/api/auth/index.js

@@ -18,6 +18,10 @@ export const getMobile = data => {
 	return	https.post("/auth/get-mobile", data) 
 }
 
+export const getNickname = data => {
+	return https.post('/auth/get-nickname', data)
+}
+
 //服务协议
 export const getRegisterAgreement = data => {
 	return https.get('/auth/register', data)

+ 39 - 3
hdApp/src/pagesClient/official/apply.vue

@@ -5,9 +5,12 @@
         <view class="apply-section">
           <view class="apply-section-title">注册人信息</view>
           <view class="module-com apply-card">
-            <tui-list-cell class="line-cell" :hover="false">
+            <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" name="adminName" placeholder="请填写姓名" />
+              <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>
+              <!-- #endif -->
             </tui-list-cell>
             <tui-list-cell class="line-cell code-wrap mobile-wrap" :hover="false">
               <view class="tui-title required">手机号</view>
@@ -140,7 +143,7 @@ import { getShopInfo} from "@/utils/auth";
 import { getDictionaries } from '@/api/mini'
 import { checkShop } from '@/api/shop'
 import { ghsInfo } from "@/api/ghs/index";
-import { getMobile } from "@/api/auth";
+import { getMobile, getNickname } from "@/api/auth";
 import { getHasMap } from "@/api/express"
 import { mapNearby } from '@/api/map/index'
 import { iconSrc } from '@/utils/iconSrc'
@@ -381,6 +384,33 @@ export default {
       }
       this.hasGet = false
       this.count = 120
+    },
+    fillWxName() {
+      let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
+      if (this.$util.isEmpty(currentMiniOpenId)) {
+        this.$msg('获取失败,请重新打开小程序')
+        return false
+      }
+      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
@@ -675,16 +705,21 @@ export default {
   align-items: center;
   flex: 1;
   min-width: 0;
+  height: 64upx;
 }
 
 .apply-mode-btn {
   flex: 1;
   min-width: 0;
   height: 64upx;
+  box-sizing: border-box;
+  margin: 0;
+  padding: 0 24upx;
   line-height: 64upx;
   text-align: center;
   color: #6b737c;
   font-size: 26upx;
+  font-weight: 600;
   border-radius: 999upx;
   background: #f2f7f4;
   border: 1upx solid #e3ebe6;
@@ -776,6 +811,7 @@ export default {
   flex-shrink: 0;
   min-width: 140upx;
   height: 64upx;
+  box-sizing: border-box;
   margin: 0;
   padding: 0 24upx;
   line-height: 64upx;