yukangzhe 4 years ago
parent
commit
84862c1057

+ 1 - 1
pages/addClass/addClass.js

@@ -24,7 +24,7 @@ Page({
       cancelText: "否", //默认是“取消”
       cancelColor: '#999999', //取消文字的颜色
       confirmText: "我知道了", //默认是“确定”
-      confirmColor: 'skyblue', //确定文字的颜色
+      // confirmColor: 'skyblue', //确定文字的颜色
     })
   },
 

+ 1 - 1
pages/evaluationDetail/evaluationDetail.js

@@ -34,7 +34,7 @@ Page({
       cancelText: "否",//默认是“取消”
       cancelColor: '#999999',//取消文字的颜色
       confirmText: "我知道了",//默认是“确定”
-      confirmColor: 'skyblue',//确定文字的颜色
+      // confirmColor: 'skyblue',//确定文字的颜色
     })
   },
 

+ 7 - 7
pages/quan/quan.wxml

@@ -8,17 +8,17 @@
   <view class="quan-view">
     <view class="quan-list">
       <view class="quan-box">
-        <view class="{{index == 0 ? 'wrapper' : 'wrapper-ed'}}" wx:for="{{list}}" wx:key='index'>
+        <view class="{{status == 0 ? 'wrapper' : 'wrapper-ed'}}" wx:for="{{list}}" wx:key='index'>
           <!-- 左侧box -->
           <view class="content">
-            <view class="{{index == 0 ? 'couponCount' : 'couponCount-ed'}}">火爆</view>
+            <view class="{{status == 0 ? 'couponCount' : 'couponCount-ed'}}">火爆</view>
             <view class="oilline linwidth160 lineBt"></view>
             <view  wx:if="{{item.couponType == 1}}">
               <text class="moyfh">¥</text>
               <text class="moneyNum">{{item.couponAmount}}</text>
             </view>
             <view  wx:if="{{item.couponType == 2}}">
-              <text class="moneyNum">{{item.couponAmount}} 折</text>
+              <text class="moneyNum zk-quan">{{item.couponAmount}} 折</text>
             </view>
             <view  wx:if="{{item.couponType == 3}}">
               <text class="moneyNum">{{item.couponAmount}} 课时</text>
@@ -42,13 +42,13 @@
             </view>
             <view class="oilline linwidth227 lineBt"></view>
 
-            <view class="moveCm btnbx" wx:if="status == '0'">
-              <view class="btnw btnBgActive">
-                <view  class="btnn" bindtap="submitCilck" data-index="{{index}}">立即领取</view>
+            <view class="moveCm btnbx" wx:if="status == '0'"> 
+              <view class="btnw btnBgActive" bindtap="submitCilck" data-index="{{index}}">
+                <view class="btnn">立即领取</view>
               </view>
             </view>
 
-            <view class="moveCm-ed btnbx-ed"  wx:if="status != '0'">
+            <view class="moveCm-ed btnbx-ed"  wx:elif="status != '0'">
               <view class="btnw btnBgGray">
                 <view wx:if="{{item.couponStatus == 1}}" class="btnn-ed">可使用</view>
                 <view wx:if="{{item.couponStatus == 2}}" class="btnn-ed">已使用</view>

+ 4 - 2
pages/quan/quan.wxss

@@ -257,7 +257,7 @@
   text-align: center;
   box-sizing: border-box;
   padding: 18rpx;
-  line-height: 90rpx;
+  line-height: 92rpx;
 }
 .moveCm {
   animation: scale 0.8s ease-in-out infinite alternate;
@@ -275,7 +275,9 @@
 .loading {
   height: 200rpx;
   line-height: 100rpx;
-  background: #f1f1f1;
   color: #999;
   text-align: center;
+}
+.zk-quan{
+  font-size: 60rpx;
 }

+ 97 - 24
pages/student/student.js

@@ -16,34 +16,87 @@ Page({
     count: 0,
     enroll: 0,
     coin: '0',
-    invitations: []
-  },
-  closeCamera: function () {
-    this.animation = wx.createAnimation({
-      timingFunction: 'linear',
-      duration: 400
-    })
-    const left = 750
-    this.animation.translateX(left).step()
-    this.setData({
-      animation: this.animation.export()
-    })
+    invitations: [],
+    showShareImg: false,
+    showCodeImg: false,
+    posterConfig: {
+      'width': 700,
+      'height': 900,
+      'backgroundColor': '#fff',
+      'debug': false,
+      'preload': true,
+      'hide-loading': true,
+      images: [{
+        x: 0,
+        y: 0,
+        url: 'https://app.schoolwisdoms.com/static/app/student/imgs/share-bill.png',
+        width: 700,
+        height: 900
+      }, {
+        x: 250,
+        y: 640,
+        url: 'https://app.schoolwisdoms.com/static/app/student/imgs/share-bill.png',
+        width: 200,
+        height: 200
+      }],
+    },
   },
 
-  showCamaer: function () {
-    this.animation = wx.createAnimation({
-      timingFunction: 'linear',
-      duration: 100
-    })
-    const left = 0
-    this.animation.translateX(left).step()
-    this.setData({
-      animation: this.animation.export(),
-      left
+
+  onPosterSuccess(e) {
+    let that = this;
+    let {
+      detail
+    } = e;
+    wx.saveImageToPhotosAlbum({
+      filePath: detail,
+      success(res) {
+        wx.showToast({
+          title: '图片已保存到本地相册',
+          icon:'none'
+        })
+        that.setData({
+          showShareImg: false
+        })
+        that.triggerEvent("callMethod")
+      },fail(res){
+        console.log(res)
+        that.getSetting()
+      }
     })
   },
-  scanCode: function (e) {
-    console.log(JSON.stringify(e))
+
+  getSetting:function(){
+    // 相册授权
+    wx.getSetting({
+     success(res) {
+       // 进行授权检测,未授权则进行弹层授权
+       if (!res.authSetting["scope.writePhotosAlbum"]) {
+           wx.showModal({
+             title: '提示',
+             content: '您未授权相册使用权限,是否重新授权?',
+             success:function(res){
+               if(res.confirm){
+                 wx.openSetting({
+                   success(settingdata) {
+                     if (settingdata.authSetting["scope.writePhotosAlbum"]) {
+                       console.log("获取权限成功,再次点击图片保存到相册")
+                     } else {
+                       console.log("获取权限失败")
+                     }
+                   },fail(res){
+                     console.log(res)
+                   }
+                 })
+               }
+             }
+           })
+         } 
+       },
+       fail(res) {
+         console.log(res);
+       }
+     });
   },
 
   /**
@@ -65,6 +118,19 @@ Page({
     }, 1000);
   },
 
+  showCodeImg:function(){
+    this.setData({
+      showCodeImg: true
+    })
+  },
+
+  closeImg:function(){
+    this.setData({
+      showShareImg: false,
+      showCodeImg: false
+    })
+  },
+
   /**
    * 生命周期函数--监听页面初次渲染完成
    */
@@ -196,8 +262,12 @@ Page({
     }
   },
   billShare: function () {
+   
     if (this.data.inviteConfig.url && this.data.inviteConfig.url.length > 4) {
       console.log('弹出海报分享页面')
+      this.setData({
+        showShareImg: true
+      })
       // this.modal = this.modalCtrl.create('BillSharePage', { item: this.inviteConfig });
       // this.modal.present();
     } else {
@@ -226,6 +296,9 @@ Page({
   openModal: function (imgUrl) {
     // 弹出页面
     console.log('...' + imgUrl)
+    this.setData({
+      showCodeImg: true
+    })
   }
 
 })

+ 3 - 1
pages/student/student.json

@@ -1,4 +1,6 @@
 {
   "navigationBarTitleText": "邀请有礼",
-  "usingComponents": {}
+  "usingComponents": {
+    "poster": "/pages/Components/miniprogram_dist/poster/index"
+  }
 }

+ 38 - 10
pages/student/student.wxml

@@ -1,10 +1,34 @@
 <view class="container">
-  <view class="imgBg" bindtap="closeImg"></view>
-  <view class="shareImg-view">
-    <view>
-      <image src="{{shareImg}}"></image>
+  <!-- 背景遮罩颜色 -->
+  <view class="shareImgBg" bindtap="closeImg" wx:if="{{showShareImg || showCodeImg}}"></view>
+  <!-- end -->
+
+  <!-- 海报 -->
+  <view class="shareImg-view" wx:if="{{showShareImg}}">
+    <image src="{{shareImg}}"></image>
+    <image class="code-img" src=""></image>
+    <view class="shareImg-btn">
+      <!-- <button open-type='share' class="edit-view shareBtn">
+        <image src="https://app.schoolwisdoms.com/static/app/student/imgs/wechat.png"></image>
+        <view>分享好友</view>
+      </button> -->
+      <view class="downloadBtn edit-view">
+        <image src="https://app.schoolwisdoms.com/static/app/student/imgs/download-to-images.png"></image>
+        <view>
+          <poster id="poster" config="{{posterConfig}}" bind:success="onPosterSuccess">
+            <view class="save-image">保存图片</view>
+          </poster>
+        </view>
+      </view>
     </view>
   </view>
+  <!-- end -->
+  <!-- 二维码 -->
+  <view class="shareCodeImg-view" wx:if="{{showCodeImg}}">
+    <image src="https://app.schoolwisdoms.com/static/app/student/imgs/share-bill.png"></image>
+    <view>邀请好友微信扫一扫</view>
+  </view>
+  <!-- end -->
 
   <image class="bgImg" mode="widthFix" src="https://app.schoolwisdoms.com/static/app/student/imgs/invitation_bg.png">
   </image>
@@ -15,11 +39,15 @@
       <view class="share-btn" bindtap="billShare">海报分享邀请好友</view>
       <view class="line"></view>
       <view class="other-btn">
-        <view class="" bindtap="share">
+        <!-- <view class="" bindtap="share">
           <image class="icon-img" mode="heightFix"
             src="https://app.schoolwisdoms.com/static/app/student/imgs/sm_link.png"></image>
           <text>链接邀请</text>
-        </view>
+        </view> -->
+        <button open-type='share' class="edit-view shareBtn">
+          <image class="icon-img" mode="heightFix" src="https://app.schoolwisdoms.com/static/app/student/imgs/sm_link.png"></image>
+          <view>链接邀请</view>
+        </button>
         <view class="" bindtap="codeInvite">
           <image class="icon-img" mode="heightFix"
             src="https://app.schoolwisdoms.com/static/app/student/imgs/sm_code.png"></image>
@@ -34,21 +62,21 @@
     src="https://app.schoolwisdoms.com/static/app/student/imgs/invitation-c2.png"></image>
   <view class="total-view">
     <view>
-    {{count}}
+      {{count}}
       <text>已试听/人</text>
     </view>
     <view>
-     {{enroll}}
+      {{enroll}}
       <text>已购课/人</text>
     </view>
     <view>
-     {{coin}}
+      {{coin}}
       <text>获得奖励</text>
     </view>
   </view>
   <image class="bgImg step-three" mode="widthFix"
     src="https://app.schoolwisdoms.com/static/app/student/imgs/invitation-c3.png"></image>
-    <view class="total-view"  wx:for="{{invitations}}">
+  <view class="total-view" wx:for="{{invitations}}">
     <view>{{item.name}}</view>
     <view>{{item.subDate}}</view>
     <view>{{item.statusText}}</view>

+ 90 - 1
pages/student/student.wxss

@@ -47,7 +47,7 @@ image{
     display: flex;
     justify-content: space-between;
 }
-.other-btn>view{
+.other-btn>view,.other-btn>button{
   display: flex;
     background: linear-gradient(45deg, #FA2E17, #FB671E);
     color: #FFF;
@@ -145,4 +145,93 @@ image{
 .unit {
   color: #999;
   font-size: 0.9rem;
+}
+
+.shareImgBg{
+  position: fixed;
+    top: 0;
+    height: 100%;
+    background: #333;
+    width: 750rpx;
+    z-index: 2;
+    opacity: 0.4;
+}
+
+.shareImg-view{
+  width: 700rpx;
+  height: 900rpx;
+  position: fixed;
+  top:100rpx;
+  left: 25rpx;
+  z-index: 3;
+}
+.shareImg-view image{
+  height: 100%;
+  width: 100%;
+}
+.code-img{
+    background: #FFF;
+    width: 200rpx !important;
+    height: 200rpx !important;
+    position: absolute;
+    bottom: 60rpx;
+    left: 50%;
+    margin-left: -100rpx;
+}
+.shareImg-btn{
+  width: 700rpx;
+  background: #FFF;
+  padding: 25rpx 0;
+  margin: 20rpx 0;
+  position: fixed;
+  z-index: 3;
+  display: flex;
+}
+.shareImg-btn image{
+  width: 100rpx;
+  height: 100rpx;
+  margin-left: 25rpx;
+  margin-bottom: 10rpx;
+}
+.shareImg-btn>view{
+  margin: 0 auto;
+}
+.edit-view{
+  text-align: center;
+  width: 150rpx;
+  font-size: 32rpx;
+}
+.downloadBtn{
+    width: 150rpx !important;
+    background: #FFF;
+    text-align: center;
+    padding: 0;
+    font-weight: 400;
+    font-size: 32rpx;
+}
+.shareBtn{
+  width: 270rpx !important;
+  margin-left: 0 !important;
+  text-align: center;
+    padding: 0;
+    font-weight: 400;
+    font-size: 32rpx;
+}
+
+.shareCodeImg-view{
+  position: fixed;
+    z-index: 3;
+    background: #FFF;
+    width: 700rpx;
+    height: 600rpx;
+    top: 50%;
+    margin-top: -350rpx;
+    left: 25rpx;
+    text-align: center;
+    font-size: 36rpx;
+}
+.shareCodeImg-view image{
+  width: 400rpx;
+    height: 400rpx;
+    margin: 50rpx 150rpx;
 }

+ 1 - 1
pages/theClasses/theClasses.js

@@ -40,7 +40,7 @@ Page({
       cancelText: "否",//默认是“取消”
       cancelColor: '#999999',//取消文字的颜色
       confirmText: "我知道了",//默认是“确定”
-      confirmColor: 'skyblue',//确定文字的颜色
+      // confirmColor: 'skyblue',//确定文字的颜色
     })
   },
 

+ 2 - 2
utils/urls.js

@@ -1,7 +1,7 @@
-const baseUrl = 'https://demo.schoolwisdoms.com';
+// const baseUrl = 'https://demo.schoolwisdoms.com';
 // const baseUrl = 'https://app.schoolwisdoms.com';
 
-// const baseUrl = 'http://192.168.2.103';
+const baseUrl = 'http://192.168.2.103';
 
 const ssoBase = baseUrl + '/sso';
 const platformBase = baseUrl + '/admin';