浏览代码

微信授权处理

kk.shi 3 年之前
父节点
当前提交
76d37f892b
共有 3 个文件被更改,包括 66 次插入35 次删除
  1. 44 29
      pages/welfareMall/personal/personal.wxml
  2. 20 4
      pages/welfareMall/personal/personal.wxss
  3. 2 2
      utils/request.js

+ 44 - 29
pages/welfareMall/personal/personal.wxml

@@ -5,7 +5,7 @@
     <view class="head-personal flex-row">
       <image class="head-personal-logo" src="/images/welfareMall/head-portrait.png" />
       <view class="head-personal-login" wx:if="{{isLogin}}">{{phone.toHide(mobileTop)}}</view>
-      <button  class="personal-isLogin" wx:if="{{!isLogin}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">登录/注册</button>
+      <button class="personal-isLogin" wx:if="{{!isLogin}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">登录/注册</button>
     </view>
     <view class="head-card flex-row">
       <view class="head-card-coupon">我的优惠券</view>
@@ -21,29 +21,38 @@
     <view class="content flex-column">
       <!-- 签到领券 -->
       <view class="sign-in content-style flex-row">
-        <view class="content-img-text flex-row">
-          <image class="content-img" src="/images/welfareMall/sign-in.png" />
-          <view class="content-text">签到领券</view>
+        <button class="wx-isLogin" wx:if="{{!isLogin}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber"></button>
+        <view class="grant flex-row">
+          <view class="content-img-text flex-row">
+            <image class="content-img" src="/images/welfareMall/sign-in.png" />
+            <view class="content-text">签到领券</view>
+          </view>
+          <image class="content-jump" src="/images/welfareMall/jump.png" />
         </view>
-        <image class="content-jump" src="/images/welfareMall/jump.png" />
       </view>
       <view class="content-lower"></view>
       <!-- 抽奖领券 -->
       <view class="luck-draw content-style flex-row">
-        <view class="content-img-text flex-row">
-          <image class="content-img" src="/images/welfareMall/luck-draw.png" />
-          <view class="content-text">抽奖领券</view>
+        <button class="wx-isLogin" wx:if="{{!isLogin}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber"></button>
+        <view class="grant flex-row">
+          <view class="content-img-text flex-row">
+            <image class="content-img" src="/images/welfareMall/luck-draw.png" />
+            <view class="content-text">抽奖领券</view>
+          </view>
+          <image class="content-jump" src="/images/welfareMall/jump.png" />
         </view>
-        <image class="content-jump" src="/images/welfareMall/jump.png" />
       </view>
       <view class="content-lower"></view>
       <!-- 我的券包 -->
       <view class="coupon-bag content-style flex-row">
-        <view class="content-img-text flex-row">
-          <image class="content-img" src="/images/welfareMall/coupon-bag.png" />
-          <view class="content-text">我的券包</view>
+        <view class="grant flex-row">
+          <button class="wx-isLogin" wx:if="{{!isLogin}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber"></button>
+          <view class="content-img-text flex-row">
+            <image class="content-img" src="/images/welfareMall/coupon-bag.png" />
+            <view class="content-text">我的券包</view>
+          </view>
+          <image class="content-jump" src="/images/welfareMall/jump.png" />
         </view>
-        <image class="content-jump" src="/images/welfareMall/jump.png" />
       </view>
       <view class="content-lower"></view>
       <!-- 邀请好友 -->
@@ -56,21 +65,27 @@
       </view> -->
       <view class="content-lower"></view>
       <!-- 历史订单 -->
-      <view class="historical-order content-style flex-row" catchtap="toHistorical">
-        <view class="content-img-text flex-row">
-          <image class="content-img" src="/images/welfareMall/historical-order.png" />
-          <view class="content-text">历史订单</view>
+      <view class="historical-order content-style flex-row">
+        <button class="wx-isLogin" wx:if="{{!isLogin}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber"></button>
+        <view class="grant flex-row" catchtap="toHistorical">
+          <view class="content-img-text flex-row">
+            <image class="content-img" src="/images/welfareMall/historical-order.png" />
+            <view class="content-text">历史订单</view>
+          </view>
+          <image class="content-jump" src="/images/welfareMall/jump.png" />
         </view>
-        <image class="content-jump" src="/images/welfareMall/jump.png" />
       </view>
       <view class="content-lower"></view>
       <!-- 意见反馈 -->
-      <view class="feedback content-style flex-row" catchtap="toFeedback">
-        <view class="content-img-text flex-row">
-          <image class="content-img" src="/images/welfareMall/feedback.png" />
-          <view class="content-text">意见反馈</view>
+      <view class="feedback content-style flex-row">
+        <button class="wx-isLogin" wx:if="{{!isLogin}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber"></button>
+        <view class="grant flex-row" catchtap="toFeedback">
+          <view class="content-img-text flex-row">
+            <image class="content-img" src="/images/welfareMall/feedback.png" />
+            <view class="content-text">意见反馈</view>
+          </view>
+          <image class="content-jump" src="/images/welfareMall/jump.png" />
         </view>
-        <image class="content-jump" src="/images/welfareMall/jump.png" />
       </view>
       <view class="content-lower"></view>
       <view></view>
@@ -80,9 +95,9 @@
 
 <!-- 使用wxs 手机号码中间四位显示为*号 -->
 <wxs module="phone">
-var toHide = function(array) {
-  var mphone = array.substring(0, 3) + '****' + array.substring(7);
-  return mphone;
-}
-module.exports.toHide = toHide;
-</wxs>
+  var toHide = function (array) {
+    var mphone = array.substring(0, 3) + '****' + array.substring(7);
+    return mphone;
+  }
+  module.exports.toHide = toHide;
+</wxs>

+ 20 - 4
pages/welfareMall/personal/personal.wxss

@@ -41,12 +41,9 @@
   height: 136rpx;
 }
 
-button {
+.personal-isLogin {
   padding: 0 !important;
   padding-left: 0 !important;
-}
-
-button:not([size=mini]) {
   width: 170rpx !important;
   font-size: 38rpx;
   font-weight: 500;
@@ -105,7 +102,26 @@ button:not([size=mini]) {
 .content-style{
   width: 670rpx;
   height: 130rpx;
+}
+
+.grant{
+  width: 670rpx;
+  height: 130rpx;
   justify-content: space-between;
+  position: relative;
+}
+
+.wx-isLogin{
+  position: absolute;
+  z-index: 2;
+  width: 670rpx !important;
+  height: 130rpx !important;
+  padding: 0 !important;
+  padding-left: 0 !important;
+  margin-left: 0rpx !important;
+  margin-right: 0rpx !important;
+  background-color: transparent;
+  border-style: none;
 }
 
 .content-lower{

+ 2 - 2
utils/request.js

@@ -2,11 +2,11 @@ import util from './util.js'
 class request {
 
     //本地的
-    //  static BASE_URL = 'http://www.zmh.com:81/'
+    static BASE_URL = 'http://localhost:8014/'
 //   pre环境的
 //   static BASE_URL = 'https://oapi.shpr.top/'
 //   正式的
-  static BASE_URL = 'https://vapi.hsayi.com/'
+//   static BASE_URL = 'https://vapi.hsayi.com/'
 //   @todo需要修改正式的域名
 
   static HEAD = {