gemercheung 2 роки тому
батько
коміт
f19360cdc8

+ 2 - 1
app.json

@@ -117,6 +117,7 @@
   "usingComponents": {
     "lip-sync": "/component/voice/voice",
     "mp-sticky": "/component/sticky/index",
-    "auth": "/component/auth/auth"
+    "auth": "/component/auth/auth",
+    "profile-patch": "/component/profilePatch/profilePatch"
   }
 }

+ 2 - 2
component/auth/auth.wxml

@@ -5,7 +5,7 @@
     <cover-view class="auth-layer" style="bottom: {{bottom}}">
       <cover-view class="title">授权登录</cover-view>
       <cover-view class="content">
-        <cover-image src="/static/images/img_empower_logo@2x.png"></cover-image>
+        <cover-image class="logo" src="/static/images/img_empower_logo@2x.png"></cover-image>
         <cover-view class="text">指房宝(杭州)科技有限公司申请获取以下权限</cover-view>
         <cover-view class="xian"></cover-view>
         <cover-view class="authul">
@@ -15,7 +15,7 @@
         </cover-view>
       </cover-view>
 
-      <button class="button" bindtap="getUserProfile">允许使用1111</button>
+      <button class="button" bindtap="getUserProfile">允许使用</button>
       <!-- <button class="button" wx:if="{{canIUse}}" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo">允许使用</button> -->
     </cover-view>
 </view>

+ 80 - 80
component/auth/auth.wxss

@@ -1,81 +1,81 @@
-/* component/auth/auth.wxss */
-
-.auth-layer {
-  position: fixed;
-  height: calc(612rpx + env(safe-area-inset-bottom));
-  background: #FFFFFF;
-  border-radius: 8px 8px 0px 0px;
-  bottom: 0;
-  left: 0;
-  width: 100%;
-  z-index: 99999999999999;
-  padding: 52rpx 36rpx 32rpx;
-  box-sizing: border-box;
-  display: flex;
-  flex-direction: column;
-  padding-bottom: calc(env(safe-area-inset-bottom) + 36rpx);
-}
-
-
-.auth-bg {
-  width: 100vw;
-  height: 100vh;
-  background-color: rgba(0, 0, 0, 0.3);
-  z-index: 9999999999;
-  position: fixed;
-  left: 0;
-  top: 0;
-}
-
-.auth-layer .title {
-  font-size: 30rpx;
-  color: #111111;
-  line-height: 42rpx;
-}
-
-.auth-layer .content {
-  height: 406rpx;
-  display: flex;
-  flex-direction: column;
-  align-items: center;
-}
-
-.auth-layer .content cover-image {
-  width: 165rpx;
-  height: 165rpx;
-}
-
-.auth-layer .content .text {
-  font-size: 26rpx;
-  color: #111111;
-  padding: 28rpx 0 36rpx;
-}
-
-.xian {
-  align-self: stretch;
-  height: 1px;
-  background-color: rgba(0, 0, 0, 0.1);
-}
-
-.auth-layer .authul {
-  align-self: stretch;
-  flex: 1;
-}
-
-.auth-layer .authul .authli {
-  text-align: center;
-  font-size: 26rpx;
-  color: #79868F;
-  margin-top: 30rpx;
-}
-
-.auth-layer .button {
-  line-height: 80rpx;
-  font-size: 30rpx;
-  color: #fff;
-  background: #07C563;
-  opacity: 1;
-  border-radius: 4px;
-  width: 100%;
-  text-align: center;
+/* component/auth/auth.wxss */
+
+.auth-layer {
+  position: fixed;
+  height: calc(612rpx + env(safe-area-inset-bottom));
+  background: #FFFFFF;
+  border-radius: 8px 8px 0px 0px;
+  bottom: 0;
+  left: 0;
+  width: 100%;
+  z-index: 99999999999999;
+  padding: 52rpx 36rpx 32rpx;
+  box-sizing: border-box;
+  display: flex;
+  flex-direction: column;
+  padding-bottom: calc(env(safe-area-inset-bottom) + 36rpx);
+}
+
+
+.auth-bg {
+  width: 100vw;
+  height: 100vh;
+  background-color: rgba(0, 0, 0, 0.3);
+  z-index: 9999999999;
+  position: fixed;
+  left: 0;
+  top: 0;
+}
+
+.auth-layer .title {
+  font-size: 30rpx;
+  color: #111111;
+  line-height: 42rpx;
+}
+
+.auth-layer .content {
+  height: 406rpx;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+}
+
+.auth-layer .content .logo {
+  width: 165rpx;
+  height: 165rpx;
+}
+
+.auth-layer .content .text {
+  font-size: 26rpx;
+  color: #111111;
+  padding: 28rpx 0 36rpx;
+}
+
+.xian {
+  align-self: stretch;
+  height: 1px;
+  background-color: rgba(0, 0, 0, 0.1);
+}
+
+.auth-layer .authul {
+  align-self: stretch;
+  flex: 1;
+}
+
+.auth-layer .authul .authli {
+  text-align: center;
+  font-size: 26rpx;
+  color: #79868F;
+  margin-top: 30rpx;
+}
+
+.auth-layer .button {
+  line-height: 80rpx;
+  font-size: 30rpx;
+  color: #fff;
+  background: #07C563;
+  opacity: 1;
+  border-radius: 4px;
+  width: 100%;
+  text-align: center;
 }

+ 118 - 0
component/profilePatch/profilePatch.js

@@ -0,0 +1,118 @@
+// component/profilePatch.js
+const api = require('../../config/api')
+const util = require('../../utils/util.js');
+
+Component({
+  /**
+   * 组件的属性列表
+   */
+
+  properties: {
+    show: { // 属性名
+      type: Boolean,
+      value: false,
+
+    },
+
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  observers: {
+    show: function (val) {
+      // 在 numberA 或者 numberB 被设置时,执行这个函数
+      console.log('gemer', val)
+      this.setData({
+        ifShow: val
+      })
+    }
+  },
+  data: {
+    ifShow: true,
+    bottom: 0,
+    defaultAvatarUrl: 'https://platform-wxmall.oss-cn-beijing.aliyuncs.com/upload/20180727/150547696d798c.png',
+    avatar: '',
+    nickname: ''
+  },
+  attached() {
+    // this.setData({
+    //   bottom: 0
+    // })
+    // debugger
+  },
+
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    updateNickName(ev) {
+      this.setData({
+        nickname: ev.detail.value
+      })
+    },
+    quitHandle: function () {
+      getApp().setLoginProps(true)
+    },
+    async onChooseAvatar(e) {
+      const {
+        avatarUrl
+      } = e.detail
+      const dataURL = await (new Promise(r => {
+        wx.uploadFile({
+          filePath: avatarUrl,
+          name: 'file',
+          url: api.UploadFile,
+          header: {
+            'X-Nideshop-Token': wx.getStorageSync('token')
+          },
+          success: (res) => {
+            const data = JSON.parse(res.data)
+            r(data.message || defaultAvatarUrl)
+          }
+        })
+      }));
+      console.log('upload-file', dataURL)
+      this.setData({
+        avatar: dataURL,
+      })
+    },
+    async updateUserInfo() {
+      const {
+        avatar,
+        nickname
+      } = this.data
+
+      if (avatar == '' || nickname == '') {
+        return
+      }
+
+      const {
+        data: getUserData
+      } = await util.request(api.UserInfo)
+
+      const body = {
+        userId: getUserData.userId,
+        avatar: this.data.avatar,
+        nickname: this.data.nickname,
+      }
+      console.error('userInfo', body)
+      const {
+        data
+      } = await util.request(api.UpdateUserInfo, body, 'POST', 'application/json')
+      console.log('data', data)
+
+      // wx.setStorageSync('token', data.token);
+      const lastUpdate = {
+        ...getUserData,
+        ...body
+      }
+      console.error('userInfo-lastUpdate', lastUpdate)
+      wx.setStorageSync('userInfo', lastUpdate);
+      this.setData({
+        ifShow: false
+      })
+      this.triggerEvent('save', lastUpdate)
+    }
+  }
+})

+ 4 - 0
component/profilePatch/profilePatch.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}

+ 29 - 0
component/profilePatch/profilePatch.wxml

@@ -0,0 +1,29 @@
+<!--component/profilePatch.wxml-->
+
+<view wx:if="{{ifShow}}" class="pa-layer-container">
+  <view class="auth-bg" bindtap="quitHandle" disable-scroll="true">
+  </view>
+  <view class="pa-layer" style="bottom: {{bottom}}">
+    <view class="title">还差一步,更新微信信息即可参与活动</view>
+    <view class="content">
+      <!-- <cover-image src="/static/images/img_empower_logo@2x.png"></cover-image> -->
+      <view class="col">
+        <text class="label">头像</text>
+
+        <button class="avatar-wrapper" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar">
+          <image class="avatar-select" src="{{avatar || defaultAvatarUrl}}"></image>
+        </button>
+        <button class="avatar-wrapper" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar">
+          <text class="update-text">点击更新</text>
+        </button>
+      </view>
+
+      <view class="col">
+        <text class="label">昵称</text>
+        <input type="nickname" placeholder="请输入昵称" maxlength="15" value="{{nickname}}" class="ipname" bindinput="updateNickName"></input>
+      </view>
+
+    </view>
+    <button class="button {{(avatar.length> 0 && nickname.length> 0) ? 'enable':'disable'}}" bindtap="updateUserInfo">更新微信息</button>
+  </view>
+</view>

+ 113 - 0
component/profilePatch/profilePatch.wxss

@@ -0,0 +1,113 @@
+/* component/profilePatch.wxss */
+.pa-layer-container {
+}
+
+.pa-layer {
+  position: fixed;
+  height: calc(612rpx + env(safe-area-inset-bottom));
+  background: #FFFFFF;
+  border-radius: 8px 8px 0px 0px;
+  bottom: 0;
+  left: 0;
+  width: 100%;
+  z-index: 99999999999999;
+  padding: 52rpx 36rpx 32rpx;
+  box-sizing: border-box;
+  display: flex;
+  flex-direction: column;
+  padding-bottom: calc(env(safe-area-inset-bottom) + 36rpx);
+}
+
+
+.auth-bg {
+  width: 100vw;
+  height: 100vh;
+  background-color: rgba(0, 0, 0, 0.3);
+  z-index: 9999999999;
+  position: fixed;
+  left: 0;
+  top: 0;
+  overflow: hidden;
+}
+
+.pa-layer .title {
+  font-size: 30rpx;
+  color: #111111;
+  line-height: 80rpx;
+  text-align: center;
+}
+
+.pa-layer .content {
+  height: 406rpx;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+}
+
+
+/* .pa-layer .content .text {
+  font-size: 26rpx;
+  color: #111111;
+  padding: 28rpx 0 36rpx;
+} */
+
+.pa-layer .button {
+  line-height: 80rpx;
+  font-size: 36rpx;
+  color: #fff;
+  background: #07C563;
+  opacity: 1;
+  border-radius: 4px;
+  width: 100%;
+  text-align: center;
+}
+.pa-layer .button.disable{
+  background: #dddddd;
+}
+
+.pa-layer .content {
+  display: flex;
+  flex-direction: column;
+  /* justify-content: space-between; */
+}
+
+.pa-layer .col {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  width: 100%;
+  /* height: 180rpx; */
+  padding: 30rpx 0;
+  border-bottom: 1rpx solid #dddddd;
+  height: 150rpx;
+}
+
+.pa-layer .col .label {
+  font-size: 30rpx;
+  padding-right: 50rpx;
+
+}
+
+.avatar-select {
+  width: 120rpx;
+  height: 120rpx;
+  border-radius: 50%;
+}
+
+.avatar-wrapper {
+  display: flex;
+  margin: 0;
+  background-color: transparent;
+  padding: 0 10rpx;
+}
+
+.update-text {
+  font-size: 30rpx;
+  color: rgb(0, 131, 253);
+  padding: 0 10rpx;
+}
+
+.ipname {
+  height: 60rpx;
+  width: 80%;
+}

+ 8 - 1
pages/user/user.js

@@ -2,6 +2,7 @@
 const api = require('../../config/api.js');
 const util = require('../../utils/util.js');
 
+const services = require('../../services/user.js');
 
 Page({
 
@@ -26,10 +27,11 @@ Page({
   /**
    * 生命周期函数--监听页面加载
    */
-  onLoad: function (options) {
+  onLoad: async function (options) {
     this.getUserInfo()
 
     let userInfo = wx.getStorageSync('userInfo')
+
     try {
       userInfo.avatar = userInfo.avatarUrl
       this.sessionKey = userInfo.sessionKey
@@ -61,6 +63,11 @@ Page({
   },
 
   async getPhoneNumber(e) {
+    const isLogin = await services.checkLogin();
+    let userInfo = wx.getStorageSync('userInfo')
+    if (!isLogin) {
+      await services.loginByWeixin(userInfo)
+    }
     let {
       encryptedData,
       iv

+ 23 - 39
pages/webview/index.js

@@ -176,21 +176,15 @@ Page({
     this.setData({
       urlTemp: url.split('').join(' ')
     })
+
+    const hideWebView = this.data.isNotPersonalfullpack ? Boolean(true) : Boolean(false);
+    console.log('hideWebView', hideWebView)
     this.setData({
       url,
       loadUrl: true,
       socketOptions,
       reload: true,
-      hideWebView: false,
-      // debugerInfo: JSON.stringify({
-      //   userId: socketOptions.userId,
-      //   roomId: socketOptions.roomId,
-      //   num: socketOptions.sceneNumber,
-      //   userLimitNum: socketOptions.userLimitNum,
-      //   isAssistant: socketOptions.isAssistant,
-      //   role: socketOptions.role,
-      //   assistantId: socketOptions.assistantId
-      // })
+      hideWebView: hideWebView,
     })
     this.recorderManager = wx.getRecorderManager()
     this.brandId = options.id
@@ -198,6 +192,22 @@ Page({
     // this.mic()
   },
 
+  // 新登录强制
+  handleProfilePatch() {
+    // debugger
+    this.setData({
+      reload: true,
+      hideWebView: false,
+      isNotPersonalfullpack: false,
+    }, () => {
+      setTimeout(() => {
+        this.init();
+      }, 200)
+    });
+
+  },
+
+
   hideInvitation() {
     this.setData({
       showInvitation: false
@@ -269,8 +279,6 @@ Page({
 
     getApp().updateCardCount()
 
-
-
     // this.options.join = true
     // this.getCartList()
 
@@ -279,15 +287,6 @@ Page({
 
     if (!(userInfo && userInfo.userId && token)) {
       return;
-      // return wx.navigateTo({
-      //   url: '/pages/auth/btnAuth/btnAuth',
-      // })
-      if (this.options.join) {
-        getApp().setLoginProps(false)
-      } else {
-        this.socketStop && this.socketStop()
-        this.init()
-      }
     } else if (this.token !== wx.getStorageSync('token')) {
       if (this.data.join) {
         let res = await util.request(api.UserInfo)
@@ -304,8 +303,10 @@ Page({
           webviewUrl: null
         })
         setTimeout(() => {
+
+          const hideWebView = this.data.isNotPersonalfullpack ? Boolean(true) : Boolean(false);
           this.setData({
-            hideWebView: false
+            hideWebView: hideWebView
           })
           this.init()
         }, 500)
@@ -338,21 +339,4 @@ Page({
   onReachBottom: function () {
 
   },
-  tapInput() {
-    this.setData({
-      //在真机上将焦点给input
-      inputFocus: true,
-      //初始占位清空
-      inputInfo: ''
-    });
-  },
-
-  /**
-   * input 失去焦点后将 input 的输入内容给到cover-view
-   */
-  blurInput(e) {
-    this.setData({
-      inputInfo: e.detail.value || '输入'
-    });
-  }
 })

+ 1 - 18
pages/webview/index.wxml

@@ -1,6 +1,7 @@
 <view class="web-view">
   <lip-sync />
   <auth bindlogin="onShow" />
+  <profile-patch show="{{isNotPersonalfullpack}}" bind:save="handleProfilePatch"/>
 
   <!-- {{url}} -->
   <!-- -->
@@ -278,24 +279,6 @@
       </cover-view>
     </cover-view>
 
-    <cover-view class="dialog invitation-view full-fill-view" wx:if="{{false}}">
-      <cover-view class="title">填入个人信息</cover-view>
-      <cover-view class="content">
-
-        <button class="avatar-wrapper" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar">
-          <cover-view class="userinfo-avatar" style="background-image: url({{defaultAvatarUrl}})">
-          </cover-view>
-        </button>
-        <cover-view class='cover-input' bindtap='tapInput'>
-          <cover-view class='text'>{{inputInfo}}</cover-view>
-          <input type="nickname" class='input' value='{{inputModel}}' focus='{{inputFocus}}' bindblur='blurInput'></input>
-        </cover-view>
-      </cover-view>
-
-      <cover-view class="btns">
-        <button class="btn" bindtap="updateUserInfo">确定</button>
-      </cover-view>
-    </cover-view>
 
     <!-- <cover-view style="position: fixed;  font-size:10px; background-color: rgba(0,0,0,0.5); color: #fff;white-space:pre-wrap;z-index:989999" wx:if="{{debugerInfo}}">
       {{debugerInfo}}

+ 0 - 38
pages/webview/index.wxss

@@ -808,41 +808,3 @@
   z-index: 10;
 }
 
-.full-fill-view .cover-input {
-  height: 32px;
-  width: 90%;
-  line-height: 32px;
-  border-radius: 5px;
-  background-color: rgba(255, 255, 255, 0.9);
-  margin: 0 auto;
-  padding-left: 15rpx;
-  padding-right: 15rpx;
-}
-
-.full-fill-view .cover-input .text {
-  height: 32px;
-  line-height: 32px;
-}
-
-.full-fill-view .cover-input .input {
-  height: 32px;
-  line-height: 32px;
-  /* margin-top为text的高度,保持视觉上一致 */
-  margin-top: -32px;
-}
-
-.avatar-wrapper {
-  background-color: none !important;
-}
-
-.userinfo-avatar {
-  width: 80px;
-  height: 80px;
-  border: 1px solid rgba(0, 0, 0, 0.1);
-  border-radius: 50%;
-  overflow: hidden;
-  margin: 0 auto;
-  background-size: 80px 80px;
-  overflow: hidden;
-  position: relative;
-}

+ 1 - 1
project.private.config.json

@@ -207,5 +207,5 @@
   "setting": {
     "compileHotReLoad": false
   },
-  "libVersion": "2.25.4"
+  "libVersion": "2.28.1"
 }

+ 1 - 1
socket.js

@@ -269,7 +269,7 @@ export default {
       const data = res.data
       data.region = data.city ? data.city.split(',') : []
       data.birthday = data.birthday || '1990-01-01'
-      if (!data.nickname) {
+      if (!data.nickname || !data.avatar) {
         this.setData({
           isNotPersonalfullpack: true
         })