Prechádzať zdrojové kódy

Signed-off-by: yukangzhe <382985154@qq.com>

yukangzhe 3 rokov pred
rodič
commit
431a66088b

+ 1 - 1
app.js

@@ -68,7 +68,7 @@ App({
   },
 
   globalData: {
-    ver:'1.1.2',
+    ver:'1.1.4',
     userInfo: null,
     openId: '',
     imageUrl: 'https://app.schoolwisdoms.com/static/wx/images/',

+ 0 - 24
app.json

@@ -65,29 +65,5 @@
       "desc": "你的位置信息将用于小程序位置接口的效果展示"
     }
   },
-  "tabBar": {
-    "color": "#bfbfbf",
-    "selectedColor": "#d81e06",
-    "list": [
-      {
-        "selectedIconPath": "images/cur-index.png",
-        "iconPath": "images/index.png",
-        "pagePath": "pages/index/index",
-        "text": "首页"
-      },
-      {
-        "selectedIconPath": "images/cur-piano.png",
-        "iconPath": "images/piano.png",
-        "pagePath": "pages/piano/piano",
-        "text": "预约"
-      },
-      {
-        "selectedIconPath": "images/cur-my.png",
-        "iconPath": "images/my.png",
-        "pagePath": "pages/myself/myself",
-        "text": "我的"
-      }
-    ]
-  },
   "usingComponents": {}
 }

BIN
images/active-red.png


BIN
images/active.png


+ 164 - 0
pages/Components/tabbar/tabbar.js

@@ -0,0 +1,164 @@
+// pages/Components/tabbar/tabbar.js
+const app = getApp();
+const util = require('../../../utils/util.js')
+let url = null
+
+Component({
+  lifetimes: {
+    attached() {
+      this.isApple()
+      if (!wx.getStorageSync('isShow')) {
+        this.data.titleList.splice(2, 1)
+        this.setData({
+          titleList: this.data.titleList
+        })
+      }
+    }
+  },
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+    curIndex: {
+      type: Number,
+      value: 0
+    },
+    curHtml: {
+      type: String,
+      value: ''
+    },
+    phone:{
+      type: String,
+      value: ''
+    }
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+    titleList: [{
+        title: '首页',
+        icon: '/images/index.png',
+        curIcon: '/images/cur-index.png',
+        val: '首页',
+        path: '/pages/index/index'
+      },
+      {
+        title: '预约',
+        icon: '/images/piano.png',
+        curIcon: '/images/cur-piano.png',
+        val: '预约',
+        path: '/pages/piano/piano'
+      },
+      {
+        title: '活动',
+        icon: '/images/active.png',
+        curIcon: '/images/active-red.png',
+        val: '活动',
+        path: '/pages/tabBar/active/active'
+      },
+      {
+        title: '我的',
+        icon: '/images/my.png',
+        curIcon: '/images/cur-my.png',
+        val: '我的',
+        path: '/pages/myself/myself'
+      },
+    ],
+    phoneList: [
+      'iPhone X',
+      'iPhone XR',
+      'iPhone XS Max',
+      'iPhone 11',
+      'iPhone 11 Pro',
+      'iPhone 11 Pro Max',
+      'iPhone 12',
+      'iPhone 12 Mini',
+      'iPhone 12 Pro',
+      'iPhone 12 Pro Max'
+    ],
+  },
+
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    isApple: function () {
+      wx.getSystemInfo({ //当小程序初始化完成时 获取用户的手机机型 并写出适配ipnone手机安全区域的的适配方案
+        success: (res) => {
+          const phone = res.model.split(" ")
+          this.data.phoneList.forEach(item => {
+            if (item == phone[0] + ' ' + phone[1]) {
+              this.setData({
+                bottomStyle: true
+              })
+              return false;
+            }
+          });
+        }
+      })
+    },
+
+    changeTitle: function (e) {
+      const name = e.currentTarget.dataset.value
+      if(name == '活动'){
+        wx.navigateToMiniProgram({
+          appId: 'wx4efd688fa52ba3f7',
+          path: 'pages/welcome/welcome?isPage=active',
+          // extraData: {
+          //   foo: 'bar'
+          // },
+          envVersion: 'release',
+          success(res) {
+            // 打开成功
+            wx.redirectTo({
+              url: '/pages/index/index',
+            })
+          }
+        })
+        return
+      }
+
+
+      const phone = wx.getStorageSync('phone')
+      if (e.currentTarget.dataset.index == this.data.curIndex) {
+        return
+      } 
+      const index = e.currentTarget.dataset.index
+
+      wx.redirectTo({
+        url: this.data.titleList[index].path
+      })
+    },
+
+    //授权手机号
+    getPhoneNumber: function (e) {
+      url = e.currentTarget.dataset.url
+      let that = this;
+      if (e.detail.errMsg == "getPhoneNumber:ok") {
+        util.doPost(
+          'getPhoneNumber', {
+            encryptedData: e.detail.encryptedData,
+            iv: e.detail.iv,
+            openId: app.globalData.openId,
+          }
+        ).then(rs => {
+          if (rs.success > 0) {
+            wx.setStorageSync('phone', rs.data.phoneNumber)
+            this.setData({
+              phone: rs.data.phoneNumber
+            })
+            wx.redirectTo({
+              url: e.currentTarget.dataset.url,
+            })
+          }
+        })
+      }
+      that.setData({
+        model: false,
+        localtion: true
+      })
+    },
+  }
+})

+ 4 - 0
pages/Components/tabbar/tabbar.json

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

+ 10 - 0
pages/Components/tabbar/tabbar.wxml

@@ -0,0 +1,10 @@
+<view>
+	<view class="tabbar-view {{ bottomStyle ? 'isAppleStyle' : ''}}">
+		<view class="tabber-view-nav" wx:for="{{titleList}}" wx:key="index" bindtap="changeTitle" data-value="{{item.val}}" data-index="{{index}}">
+			<image lazy-load class="titleImg" src="{{ curIndex == index ? item.curIcon : item.icon}}"></image>
+			<view class="isTitle {{ curIndex == index ? 'curTitle' : '' && index}}" >
+				{{item.title}}
+			</view>
+		</view>
+	</view>
+</view>

+ 81 - 0
pages/Components/tabbar/tabbar.wxss

@@ -0,0 +1,81 @@
+/* page{
+  background: #FFF;
+} */
+
+.tabbar-view{
+  position: fixed;
+  width: 100%;
+  background: #FFF;
+  bottom: 0;
+  display: flex;
+  height: 119rpx;
+  padding-top: 20rpx;
+  border-top: 1rpx solid #EEE;
+  color: #CCC;
+  z-index: 999999;
+}
+.tabbar-view .tabber-view-nav{
+  text-align: center;
+  margin: 0 auto;
+  font-size: 24rpx;
+  position: relative;
+}
+.titleImg{
+  height: 50rpx;
+  width: 50rpx;
+}
+
+.curTitle{
+  color: #cc6031;
+}
+
+.isAppleStyle{
+  padding-bottom: 20rpx;
+}
+
+.liveShow{
+  font-size: 36rpx;
+  width: 120rpx;
+  line-height: 120rpx;
+  border: 1px solid #EEE;
+  background: linear-gradient(90deg, rgba(236, 58, 78, 1) 0%, rgba(255, 115, 115, 1) 100%);
+  color: #FFF;
+  border-radius: 100rpx;
+  position: relative;
+  top: -20rpx;
+  box-shadow: 0 0 10rpx #999;
+  top: -60rpx;
+}
+
+.liveShowBg{
+  width: 120rpx;
+  height: 120rpx;
+  border-radius: 50%;
+    position: absolute; 
+    top: 0;
+    left: 0;
+    animation: pulse 3s infinite;
+}
+
+
+@keyframes pulse {
+  0% {
+      box-shadow: 0 0 4px 2px #fff;
+  }
+  50% {
+      box-shadow: 0 0 4px 2px #EC3A4E;
+  }
+  100% {
+      box-shadow: 0 0 4px 2px #fff;
+  }
+}
+
+.nav-item{
+    position: absolute;
+    left: 0;
+    width: 100% !important;
+    top: 0;
+    height: 100%;
+    padding: 0 !important;
+    opacity: 0;
+}

+ 27 - 4
pages/index/index.js

@@ -9,6 +9,7 @@ Page({
    * 页面的初始数据
    */
   data: {
+    quanTipFlag: false,
     isShow: true,
     array: ['艾克斯郎校区1', '艾克斯郎校区2', '艾克斯郎校区3', '艾克斯郎校区4'],
     index: 0,
@@ -151,10 +152,29 @@ Page({
     })
   },
 
+  closeTip:function(){
+    this.setData({
+      quanTipFlag:false
+    })
+  },
+  toQuan:function(){
+    wx.navigateTo({
+      url: '/pages/quan/quan',
+    })
+    this.setData({
+      quanTipFlag:false
+    })
+  },
+
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
+    setTimeout(() => {
+      this.setData({
+        quanTipFlag: true
+      })
+  }, 3000);
     this.setData({
       isShow: wx.getStorageSync('isShow'),
     })
@@ -172,15 +192,16 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
+    wx.hideHomeButton()
     const latlng = wx.getStorageSync('latlng')
     if(!latlng){
       this.localtionMethod()
     }
     if(!wx.getStorageSync('openId')){
-      wx.redirectTo({
-        url: '/pages/login/login',
-      })
-      return
+      // wx.redirectTo({
+      //   url: '/pages/login/login',
+      // })
+      // return
     } else {
       this.loadIndexData();
     }
@@ -308,6 +329,8 @@ Page({
         } else {
           u.imageUrl = urls.oss_file + 'image/' + u.imageUrl
         }
+
+        u.headName = u.studentName.substring(u.studentName.length - 1, u.studentName.length)
       })
 
       this.setData({

+ 2 - 1
pages/index/index.json

@@ -1,6 +1,7 @@
 {
   "usingComponents": {
-    "showView":"/pages/Components/showList/showList"
+    "showView":"/pages/Components/showList/showList",
+    "tabbar":"/pages/Components/tabbar/tabbar"
   },
   "navigationBarTitleText": "首页"
 }

+ 48 - 17
pages/index/index.wxml

@@ -2,16 +2,21 @@
   <!-- 顶部学生信息 -->
   <view class="head-view">
     <view class="head-left">
-      <view class="head-img-view" wx:for="{{userItems}}" wx:key="index" data-id="{{item.studentId}}" bindtap="changeStu" wx:if="{{curStu.orgId == item.orgId}}">
-        <image class="{{curStu.studentId == item.studentId ? 'curStu' : 'stuHead'}}" src="{{item.imageUrl}}"></image>
-      </view> 
+      <view class="head-img-view" wx:for="{{userItems}}" wx:key="index" data-id="{{item.studentId}}" bindtap="changeStu"
+        wx:if="{{curStu.orgId == item.orgId}}">
+        <!-- <image class="{{curStu.studentId == item.studentId ? 'curStu' : 'stuHead'}}" src="{{item.imageUrl}}"></image> -->
+        <view class="{{curStu.studentId == item.studentId ? 'curStu' : 'stuHead'}} headName">{{item.headName}}</view>
+      </view>
     </view>
     <view class="head-right">
       <view class="section">
-        <picker class="picker-box" bindchange="bindPickerChange" value="{{index}}" range="{{orgItems}}" range-key="orgName">
+        <picker class="picker-box" bindchange="bindPickerChange" value="{{index}}" range="{{orgItems}}"
+          range-key="orgName">
           <view class="picker">
             {{orgItems[index].orgName}}
-            <view class="toDown"><image src="/images/toDown.png"></image></view>
+            <view class="toDown">
+              <image src="/images/toDown.png"></image>
+            </view>
           </view>
         </picker>
       </view>
@@ -21,21 +26,22 @@
 
   <!-- 轮播图 -->
   <view class="swiper">
-			<swiper class="banner" autoplay circular interval="3000">
-				<block wx:for="{{bannerList}}" wx:key="index">
-					<swiper-item class="banner-box" >
-						<image lazy-load mode="aspectFill" class="bb-image" src="{{item.imageUrl}}"></image>
-					</swiper-item>
-				</block>
-			</swiper>
-		</view>
+    <swiper class="banner" autoplay circular interval="3000">
+      <block wx:for="{{bannerList}}" wx:key="index">
+        <swiper-item class="banner-box">
+          <image lazy-load mode="aspectFill" class="bb-image" src="{{item.imageUrl}}"></image>
+        </swiper-item>
+      </block>
+    </swiper>
+  </view>
   <!-- end -->
 
   <!-- 课程数据 -->
   <view class="class-view">
     <view class="title">课程数据</view>
     <view class="class-list">
-      <view class="class-box" wx:for="{{classList}}" wx:key="index" data-url="{{item.url}}" bindtap="toPage" wx:if="{{index == 1 ? isShow : true}}">
+      <view class="class-box" wx:for="{{classList}}" wx:key="index" data-url="{{item.url}}" bindtap="toPage"
+        wx:if="{{index == 1 ? isShow : true}}">
         <view class="class-img">
           <image src="{{item.img}}"></image>
         </view>
@@ -52,7 +58,8 @@
   <view class="app-view">
     <view class="title">我的应用</view>
     <view class="app-list">
-      <view class="app-box" wx:for="{{appList}}" wx:key="index" data-url="{{item.url}}" bindtap="toPage"  wx:if="{{index == 1 ? isShow : true}}">
+      <view class="app-box" wx:for="{{appList}}" wx:key="index" data-url="{{item.url}}" bindtap="toPage"
+        wx:if="{{index == 1 ? isShow : true}}">
         <view class="app-img">
           <image src="{{item.img}}"></image>
         </view>
@@ -74,8 +81,8 @@
   </view>
   <!-- end -->
 
-   <!-- 老师秀 -->
-   <view class="show-view"  wx:if="{{isShow}}">
+  <!-- 老师秀 -->
+  <view class="show-view" wx:if="{{isShow}}">
     <view class="title-view">
       <view class="title">老师秀</view>
       <view class="more" bindtap="getMoreShow" data-type="1">更多</view>
@@ -86,4 +93,28 @@
   </view>
   <!-- end -->
 
+  <!-- 优惠券弹窗 -->
+  <view class="quan-bg" wx:if="{{quanTipFlag}}"></view>
+  <view class="quan-tip" wx:if="{{quanTipFlag}}">
+    <image src="/images/quan-tip.png"></image>
+    <view class="quan-tip-content">
+      <view class="quan-tip-title">恭喜获得优惠券4张</view>
+      <view class="quan-tip-list">
+        <view class="quan-tip-list-box" wx:for="{{4}}" wx:key="index">
+          <view class="quan-tip-list-title view-left">钢琴类通用</view>
+          <view class="quan-tip-list-price"><text>¥</text>20</view>
+          <view class="quan-tip-list-date view-left">有效期至2021/07/01</view>
+          <view class="quan-tip-list-code">满200可用</view>
+        </view>
+      </view>
+      <view class="quan-tip-bottom">
+        <view class="quan-tip-btn" bindtap="toQuan">去看看</view>
+        <view class="tip-font">已自动存至优惠券</view>
+      </view>
+    </view>
+    <view class="close-tip" bindtap="closeTip">X</view>
+  </view>
+  <!-- end -->
+  <tabbar curIndex="0"></tabbar>
+
 </view>

+ 148 - 1
pages/index/index.wxss

@@ -1,5 +1,5 @@
 .container {
-  padding: 0;
+  padding: 0 0 200rpx 0;
   margin: 0;
   color: #333;
 }
@@ -27,6 +27,17 @@
   border-radius: 60rpx;
 }
 
+.headName{
+  background: #005033;
+    color: #FFF;
+    text-align: center;
+    border-radius: 100%;
+    height: 60rpx;
+    width: 60rpx;
+    line-height: 60rpx;
+    font-size: 36rpx;
+}
+
 .section {
   height: 60rpx;
   line-height: 60rpx;
@@ -208,4 +219,140 @@
     text-align: center;
     color: #999;
   }
+
+  .quan-bg {
+    position: fixed;
+    top: 0;
+    width: 100%;
+    height: 100%;
+    background: #333;
+    opacity: 0.3;
+    z-index: 9999998;
+  }
+  
+  .quan-tip {
+    position: fixed;
+    text-align: center;
+    z-index: 9999999;
+    width: 750rpx;
+    height: 1050rpx;
+    top: 50%;
+    margin-top: -525rpx;
+  }
+  
+  .quan-tip image {
+    width: 750rpx;
+    height: 808rpx;
+    position: relative;
+    z-index: 2;
+  }
+  
+  .quan-tip-content {
+    background: -webkit-gradient(linear, left top, right bottom, color-stop(0%, #EFCC61), color-stop(100%, #FFA423));
+    width: 600rpx;
+    height: 800rpx;
+    position: absolute;
+    left: 75rpx;
+    color: #FFF;
+    border-radius: 10rpx;
+    top: 40rpx;
+  }
+  
+  .quan-tip-list {
+    position: relative;
+    z-index: 3;
+  }
+  
+  .quan-tip-title {
+    font-size: 56rpx;
+    letter-spacing: 6rpx;
+    height: 100rpx;
+    line-height: 100rpx;
+  }
+  
+  .quan-tip-list-box {
+    background: #FFF;
+    width: 450rpx;
+    margin: 30rpx 75rpx;
+    display: flex;
+    flex-wrap: wrap;
+    padding: 5rpx;
+    position: relative;
+    border-radius: 10rpx;
+  }
+  
+  .quan-tip-list-title {
+    color: red;
+    font-size: 30rpx;
+    line-height: 84rpx;
+    min-width: 250rpx;
+    text-align: left;
+  }
+  
+  .quan-tip-list-price {
+    color: red;
+    margin-left: auto;
+    font-size: 36rpx;
+    height: 84rpx;
+    line-height: 84rpx;
+  }
+  
+  .quan-tip-list-price text {
+    font-size: 28rpx;
+  }
+  
+  .quan-tip-list-date {
+    color: #333;
+    font-size: 24rpx;
+    line-height: 38rpx;
+  }
+  
+  .quan-tip-list-code {
+    color: #333;
+    font-size: 24rpx;
+    margin-left: auto;
+    line-height: 38rpx;
+  }
+  
+  .tip-font {
+    color: #9B9B9B;
+    position: relative;
+    top: 20rpx;
+    font-size: 24rpx;
+  }
+  
+  .quan-tip-btn {
+    color: red;
+    background: linear-gradient(to bottom, #EFCC61 0%, #FFA423 100%);
+    font-size: 42rpx;
+    height: 100rpx;
+    line-height: 100rpx;
+    border-radius: 100rpx;
+    width: 500rpx;
+    margin: 50rpx 50rpx 0;
+  }
+  
+  .close-tip {
+    width: 50rpx;
+    height: 50rpx;
+    color: #FFF;
+    border: 4rpx solid #FFF;
+    border-radius: 50rpx;
+    font-weight: 600;
+    line-height: 50rpx;
+    margin: 0 350rpx 0;
+    position: absolute;
+    bottom: -30px;
+  }
+  
+  .quan-tip-bottom {
+    width: 600rpx;
+    background: #FFF;
+    height: 232rpx;
+    position: absolute;
+  }
+  
+  /* #EFCC61 */
+  /* #FFA423 */
+
  /* end */

+ 2 - 2
pages/login/login.js

@@ -219,7 +219,7 @@ Page({
             url: '/pages/' + this.data.isPage + "/" + this.data.isPage + "?proId=" + this.data.isId,
           })
         } else {
-          wx.switchTab({
+          wx.redirectTo({
             url: '/pages/index/index'
           })
         }
@@ -246,7 +246,7 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
-
+    
   },
 
   /**

+ 1 - 0
pages/myself/myself.js

@@ -43,6 +43,7 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
+    wx.hideHomeButton()
     this.setData({
       userAvatar: wx.getStorageSync('student').headImg,
       userName: wx.getStorageSync('student').name

+ 3 - 1
pages/myself/myself.json

@@ -1,4 +1,6 @@
 {
   "navigationBarTitleText": "我的",
-  "usingComponents": {}
+  "usingComponents": {
+    "tabbar":"/pages/Components/tabbar/tabbar"
+  }
 }

+ 1 - 0
pages/myself/myself.wxml

@@ -96,4 +96,5 @@
 			</view>
 		</view>
 	</view>
+	<tabbar curIndex="3"></tabbar>
 </view>

+ 1 - 0
pages/piano/piano.js

@@ -56,6 +56,7 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
+    wx.hideHomeButton()
     let now = new Date();
     // 显示近7天的预约记录
     let bd = util.formatTime(now).substring(0, 10).replace(/\//g, '-')

+ 2 - 1
pages/piano/piano.json

@@ -1,6 +1,7 @@
 {
   "usingComponents": {
-    "selectDate":"/pages/Components/selectDate/selectDate"
+    "selectDate":"/pages/Components/selectDate/selectDate",
+    "tabbar":"/pages/Components/tabbar/tabbar"
   },
   "navigationBarTitleText": "预约练琴"
 }

+ 1 - 1
pages/piano/piano.wxml

@@ -60,5 +60,5 @@
     </view>
     <view class="close-rule" bindtap="ruleShow" wx:if="{{ruleShow}}">X</view>
   </view>
-  
+  <tabbar curIndex="1"></tabbar>
 </view>

+ 7 - 2
pages/piano/piano.wxss

@@ -1,3 +1,8 @@
+.container{
+  padding: 0 0 200rpx 0;
+  margin: 0;
+  color: #333;
+}
 .piano-list {
   width: 750;
 }
@@ -138,7 +143,7 @@ page{
   text-align: center;
   padding: 15rpx;
   position: fixed;
-  bottom: 20rpx;
+  bottom: 210rpx;
   width: 300rpx;
   left: 50%;
   margin-left: -150rpx;
@@ -180,7 +185,7 @@ page{
     text-align: center;
     border-radius: 100rpx 0 0 100rpx;
     position: fixed;
-    bottom: 45rpx;
+    bottom: 210rpx;
     right: 0;
     font-size: 24rpx;
     text-indent: 24rpx;

+ 4 - 1
pages/pianoDetail/pianoDetail.js

@@ -132,9 +132,12 @@ Page({
       // extraData: {
       //   foo: 'bar'
       // },
-      envVersion: 'develop',
+      envVersion: 'release',
       success(res) {
         // 打开成功
+        wx.redirectTo({
+          url: '/pages/index/index',
+        })
       }
     })
   },

+ 2 - 2
project.private.config.json

@@ -13,8 +13,8 @@
     "miniprogram": {
       "list": [
         {
-          "name": "pages/agreement/agreement",
-          "pathName": "pages/agreement/agreement",
+          "name": "pages/index/index",
+          "pathName": "pages/index/index",
           "query": "",
           "scene": null
         }