Explorar el Código

5-15-邵根。修改测试服务器域名。小程序增加手机号录入

shaogen1995 hace 2 años
padre
commit
c64657ebe5

+ 6 - 1
miniProgram/app.js

@@ -40,7 +40,7 @@ App({
       }
     })
   },
-  
+
   login() {
     wx.login({
       success: res => {
@@ -53,6 +53,11 @@ App({
           this.globalData.hasAvatar = response.data.wxUser.avatarUrl
           console.log(response);
         })
+        // 获取用户手机号
+        // fetchutil.get(`api/wx/getPhone/${res.code}`, {}, {}).then((res) => {
+
+        //   console.log('获取用户手机号', res);
+        // })
       },
     })
 

+ 10 - 3
miniProgram/components/authorize/index.js

@@ -21,6 +21,7 @@ Component({
    */
   data: {
     inputNickName: '',
+    inputPhone: '',
     avatarUrl: `${CDN_URL}images/default.png`,
     CDN_URL
   },
@@ -35,6 +36,11 @@ Component({
         inputNickName: e.detail.value
       })
     },
+    bindKeyPhone(e) {
+      this.setData({
+        inputPhone: e.detail.value
+      })
+    },
     onChooseAvatar(e) {
       const {
         avatarUrl
@@ -87,9 +93,9 @@ Component({
     },
 
 
-    updateUserInfo(cb = () => {}) {
+    updateUserInfo(cb = () => { }) {
 
-      if (!this.data.avatarUrl || !this.data.inputNickName.trim()) {
+      if (!this.data.avatarUrl || !this.data.inputNickName.trim() || !this.data.inputPhone.trim()||this.data.inputPhone.length<11) {
         wx.showToast({
           title: '请补充完整信息~',
           icon: 'error'
@@ -100,10 +106,11 @@ Component({
       fetchutil.post(`api/cms/wxUser/update`, {
         "avatarUrl": this.data.avatarUrl,
         "nickName": this.data.inputNickName,
+        "phone": this.data.inputPhone,
       }, {}).then((res) => {
         app.globalData.userInfo = res.data;
         cb()
-      }).catch(() => {})
+      }).catch(() => { })
     },
 
 

+ 1 - 0
miniProgram/components/authorize/index.wxml

@@ -5,6 +5,7 @@
       <image mode="aspectFit" class="avatar" src="{{avatarUrl}}"></image>
     </button> 
     <input type="nickname" bindinput="bindKeyInput" value="{{inputNickName}}" maxlength="20" placeholder="请输入昵称" class="nameinput" />
+    <input type="phone" bindinput="bindKeyPhone" value="{{inputPhone}}" maxlength="11" placeholder="请输入手机号" class="nameinput" />
 
     <view class="btn-area">
       <image bindtap="onCancel" src="{{CDN_URL}}images/btn_cancel.png" mode="widthFix"/>

+ 5 - 1
miniProgram/pages/index/index.js

@@ -13,12 +13,16 @@ Page({
   data: {
     CDN_URL,
     isShowVideo: false,
-    isShowAuthorize: false
+    isShowAuthorize: false,
+
   },
 
   onLoad() {
   },
 
+
+
+
   onShow(){
     this.getUserInfo()
   },

+ 1 - 1
miniProgram/pages/index/index.less

@@ -61,4 +61,4 @@
   pointer-events: auto;
   opacity: 1;
   top: 0;
-}
+}

+ 6 - 4
miniProgram/pages/index/index.wxml

@@ -1,16 +1,18 @@
 <!--index.wxml-->
 <view class="home" style="background-image:url({{CDN_URL}}images/bg.jpg)">
   <view class="left">
-    <image src="{{CDN_URL}}images/title.png" mode="widthFix"/>
-    <image bindtap="onStart" src="{{CDN_URL}}images/btn_start.png" mode="widthFix"/>
+    <image src="{{CDN_URL}}images/title.png" mode="widthFix" />
+    <image bindtap="onStart" src="{{CDN_URL}}images/btn_start.png" mode="widthFix" />
   </view>
 </view>
 
+
+
 <view class="video" wx:if="{{isShowVideo}}">
-  <video vslide-gesture="true" enable-play-gesture="true" controls autoplay="true" show-mute-btn="true" src="{{CDN_URL}}video/video.mp4" /> 
+  <video vslide-gesture="true" enable-play-gesture="true" controls autoplay="true" show-mute-btn="true" src="{{CDN_URL}}video/video.mp4" />
   <view bindtap="onSkipButtonTap" class="jump">
     跳过
   </view>
 </view>
 
-<authorize  class="auth {{isShowAuthorize?'auth_show':''}}" bind:onCancel="tapAuthclose" bind:onComfirm="tapAuthComfirm"/>
+<authorize class="auth {{isShowAuthorize?'auth_show':''}}" bind:onCancel="tapAuthclose" bind:onComfirm="tapAuthComfirm" />

+ 2 - 1
miniProgram/utils/util.js

@@ -20,5 +20,6 @@ const formatNumber = (n) => {
 
 
 // export const API_BASE_URL = 'http://192.168.0.135:8015/'
-export const API_BASE_URL = 'http://192.168.20.55:8047/'
+// export const API_BASE_URL = 'http://192.168.20.55:8047/'
+export const API_BASE_URL = 'https://hnbwgwx.4dage.com/'
 export const CDN_URL = 'https://culture.4dage.com/hn_museum_game/'

+ 5 - 2
web/src/api/http.js

@@ -2,11 +2,14 @@ import axios from "axios";
 import utils from '@/utils/index.js'
 
 const isProduction = process.env.NODE_ENV === 'production'
-export const baseURL = isProduction ? '' : 'http://192.168.20.55:8047/';
+// export const baseURL = isProduction ? '' : 'http://192.168.20.55:8047/';
+export const baseURL = isProduction ? '' : 'https://hnbwgwx.4dage.com/';
+
 
 
 let token = utils.getQueryByName('token')
 
+
 const http = axios.create({
   baseURL: isProduction ? '/api/' : (baseURL + "api/"),
   timeout: 30000,
@@ -49,4 +52,4 @@ http.interceptors.response.use(
   }
 );
 
-export default http;
+export default http;