Parcourir la source

Merge branch 'hou' of http://git.cc-lotus.info/ssfg/OnlineTraining0622 into hou

tiedan il y a 4 ans
Parent
commit
86effacb95

+ 2 - 1
app.json

@@ -41,7 +41,8 @@
     "pages/myPoints/myPoints",
     "pages/myTraining/myTraining",
     "pages/agoClass/agoClass",
-    "pages/videoPlayBack/videoPlayBack"
+    "pages/videoPlayBack/videoPlayBack",
+    "pages/articleDetail/articleDetail"
   ],
   "window": {
     "backgroundTextStyle": "light",

+ 89 - 0
components/banner-swiper/banner-swiper.js

@@ -0,0 +1,89 @@
+// components/banner-swiper/banner-swiper.js
+const app = require('../../utils/util.js');
+// const tools = require('../../utils/tools.js');
+Component({
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+    indicatorDots: true,
+    indicatorColor: 'rgb(255,255,255,1)',
+    indicatorActiveColor: 'rgb(236,114,93,1)',
+    autoplay: false,
+    currentSwiper: 0,
+    circular: true,
+    interval: 3000,
+    banners: [], // 轮播图
+  },
+  /**
+   * 组件的生命周期
+   */
+  pageLifetimes: {
+    show() {
+      this.setData({
+        // currentSwiper: 0,
+        autoplay: true
+      });
+    },
+    hide() {
+      this.setData({
+        autoplay: false
+      });
+      // setTimeout(() => {
+      //   this.setData({
+      //     currentSwiper: 0
+      //   });
+      // }, 300);
+    }
+  },
+  async created() {
+    // let sessionKey = await tools.checkSessionAndLogin(); 
+    wx.request({
+      url: app.globalData.publicUrl + '/wx/article/selArticleList',
+      method: "post",
+      data: {
+        // sessionKey
+      },
+      success: (res) => {
+        // console.log('res--->', res);
+        let {code, data} = res.data;
+        if (code !== 0) {
+          wx.showToast({
+            title: '获取文章列表失败!',
+          });
+          return;
+        }
+        this.setData({
+          banners: data
+        });
+      }
+    })
+  },
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    changeSwiper(e) {
+      let {current, source} = e.detail;
+      if (source === 'touch') {
+        this.setData({
+          currentSwiper: current
+        });
+      } 
+    },
+    tapBanner(e) {
+      let {id, title} = e.currentTarget.dataset;
+      // link ='http://www.baidu.com';
+      wx.navigateTo({
+        url: `/pages/articleDetail/articleDetail?id=${id}&title=${encodeURI(title)}`,
+      });
+    }
+  }
+});

+ 4 - 0
components/banner-swiper/banner-swiper.json

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

+ 10 - 0
components/banner-swiper/banner-swiper.wxml

@@ -0,0 +1,10 @@
+<!--components/banner-swiper/banner-swiper.wxml-->
+<view class="banner-container" wx:if="{{banners.length > 0}}">
+  <swiper class='swiper' indicator-dots="{{indicatorDots}}" indicator-color="{{indicatorColor}}" indicator-active-color="{{indicatorActiveColor}}" autoplay="{{autoplay}}" current="{{currentSwiper}}" circular="{{circular}}" interval="{{interval}}" bindchange="changeSwiper">
+    <block wx:for="{{banners}}" wx:for-item="banner" wx:key="id">
+      <swiper-item>
+        <image wx:if="{{banner.coverImage}}" mode="aspectFill" class="banner-img" src="{{banner.coverImage}}" data-id="{{banner.id}}" data-title="{{banner.title}}" bindtap="tapBanner"></image>
+      </swiper-item>
+    </block>
+  </swiper>
+</view>

+ 16 - 0
components/banner-swiper/banner-swiper.wxss

@@ -0,0 +1,16 @@
+/* components/banner-swiper/banner-swiper.wxss */
+.banner-container{
+  width: 100%;
+  height: 280rpx;
+}
+.swiper{
+  width: 100%;
+  height: 100%;
+}
+.banner-img{
+  width: 710rpx;
+  height: 100%;
+  display: block;
+  margin: 0 auto;
+  border-radius: 12rpx;
+}

+ 81 - 0
pages/articleDetail/articleDetail.js

@@ -0,0 +1,81 @@
+// pages/articleDetail/articleDetail.js
+const app = require('../../utils/util.js');
+// const appInstance= getApp();
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    link: ''
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    // console.log(`${app.globalData.publicUrl}/ruoyi/articlePreview.html?id=${options.id}`);
+    let {id, title} = options;
+    this.setData({
+      link: `${app.globalData.publicUrl}/ruoyi/articlePreview.html?id=${id}`
+    });
+    let pages = getCurrentPages();
+    // console.log('pages', pages);
+    let currentPage = pages[pages.length - 1];  
+    if (currentPage.route === 'pages/articleDetail/articleDetail') {
+      // 👆 如果不添加判断,快速返回上一页,动态设置导航标题会设置到上一页上
+      wx.setNavigationBarTitle({
+        title: decodeURI(title)
+      });  
+    }
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

+ 4 - 0
pages/articleDetail/articleDetail.json

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

+ 4 - 0
pages/articleDetail/articleDetail.wxml

@@ -0,0 +1,4 @@
+<!--pages/articleDetail/articleDetail.wxml-->
+<view wx:if="{{link}}" class="page">
+  <web-view src="{{link}}" />  
+</view>

+ 5 - 0
pages/articleDetail/articleDetail.wxss

@@ -0,0 +1,5 @@
+/* pages/articleDetail/articleDetail.wxss */
+.page{
+  width: 100%;
+  min-height: 100%;
+}

+ 1 - 1
pages/index/index.js

@@ -312,7 +312,7 @@ Page({
   },
   async onShow() {
     const sessionKey = await tools.checkSessionAndLogin();
-    this.getBanner(sessionKey);
+    // this.getBanner(sessionKey);
     this.getjjLength(sessionKey);
     this.getwqLength(sessionKey);
     this.getRedPoint1(sessionKey);

+ 3 - 1
pages/index/index.json

@@ -1,4 +1,6 @@
 {
-  "usingComponents": {},
+  "usingComponents": {
+    "banner-swiper": "/components/banner-swiper/banner-swiper"
+  },
   "navigationBarTitleText":"首页"
 }

+ 4 - 2
pages/index/index.wxml

@@ -1,7 +1,7 @@
 <view class="switch_tab_container">
     <van-notice-bar wx:if="{{noticeVis}}" left-icon="volume-o" mode="link" text="{{notice}}" bindtap="toNotice" style="padding-bottom:10rpx;" />
 	
-	<view class="banner">
+	<!-- <view class="banner">
 		<swiper class='u-wrp-bnr' indicator-dots="true" interval='5000' duration='1000'>
 			<block wx:for="{{bnrUrl}}" wx:for-index="index" wx:key="idx">
 				<swiper-item bindtap="gomyClass" data-item="{{item}}">
@@ -15,7 +15,9 @@
 				</swiper-item>
 			</block>
 		</swiper>
-	</view>
+	</view> -->
+	<!-- banner 组件 -->
+	<banner-swiper></banner-swiper>
 	<view class="sec">
 		<view class="sec_item" bindtap="gostartClass" data-item='{{jjdataArr}}'>
 			<image src="/images/jjkb.png" mode='aspectFill' class="secimg"></image>

+ 80 - 25
pages/myMission/myMission.js

@@ -1,8 +1,28 @@
 const app = require('../../utils/util.js');
 const tools = require('../../utils/tools.js');
+const tips = {
+  identify: {
+    image: 'error',
+    desc: '您还没有进行身份认证哦!',
+    showBtn: true
+  },
+  openClass: {
+    image: 'search',
+    desc: '您当前还没有正在开放的班级'
+  },
+  studentErr: {
+    image: 'error',
+    desc: '学员不可同时存在多个班级中哦!'
+  }
+};
 Page({
   data: {
-    isRz: false,
+    isLoading: true,//是否正在加载数据
+    pageTip: {
+      show: false,
+      detail: {}
+    },
+    isRz: false, // false -- 已认证 / true -- 未认证
     showewm: false, //是否显示班级群二维码
     showzs: false, //是否显示毕业证书
     show: false, //协议显示
@@ -178,8 +198,13 @@ Page({
           })
         } else {
           this.setData({
-            isRz: true
-          })
+            isRz: true,
+            pageTip: {
+              show: true,
+              detail: tips.identify
+            }
+          });
+          this.stopLoading();
           // wx.showModal({
           //   content: "您还没有进行身份认证哦",
           //   showCancel: false,
@@ -213,12 +238,16 @@ Page({
       data: {
         sessionKey: sessionKey
       },
+      complete: () => {
+        this.stopLoading();
+      },
       success: (res) => {
         console.log(res);
         if (res.data.code == 0) {
           this.setData({
-            classInfo: res.data.data
-          })
+            classInfo: res.data.data,
+            'pageTip.show': false
+          });
           this.isAgree(sessionKey);
           this.getMycourse(sessionKey);
           this.checkTaskList(sessionKey);
@@ -226,30 +255,42 @@ Page({
           this.checkTaskList5(sessionKey, res.data.data.id)
         } else {
           if (res.data.msg == "运行时异常:学员不可同时存在两个班级中。") {
-            wx.showModal({
-              content: "学员不可同时存在多个班级中哦",
-              showCancel: false,
-              success(res) {
-                if (res.confirm) {
-                  wx.switchTab({
-                    url: '../index/index'
-                  })
-                }
+            // wx.showModal({
+            //   content: "学员不可同时存在多个班级中哦",
+            //   showCancel: false,
+            //   success(res) {
+            //     if (res.confirm) {
+            //       wx.switchTab({
+            //         url: '../index/index'
+            //       })
+            //     }
+            //   }
+            // })
+            this.setData({
+              pageTip: {
+                show: true,
+                detail: tips.studentErr
               }
-            })
+            });
             return false;
           } else {
-            wx.showModal({
-              content: "您当前还没有正在开放的班级!",
-              showCancel: false,
-              success(res) {
-                if (res.confirm) {
-                  wx.switchTab({
-                    url: '../index/index'
-                  })
-                }
+            // wx.showModal({
+            //   content: "您当前还没有正在开放的班级!",
+            //   showCancel: false,
+            //   success(res) {
+            //     if (res.confirm) {
+            //       wx.switchTab({
+            //         url: '../index/index'
+            //       })
+            //     }
+            //   }
+            // })
+            this.setData({
+              pageTip: {
+                show: true,
+                detail: tips.openClass
               }
-            })
+            });
             return false;
           }
         }
@@ -917,10 +958,24 @@ Page({
     })
   },
   async onShow() {
+    wx.showLoading({
+      title: '正在加载',
+    });
     const sessionKey = await tools.checkSessionAndLogin();
     this.setData({
       sessionKey
     })
     this.isRz(sessionKey);
+  },
+  onHide(){
+    this.setData({
+      isLoading: true
+    });
+  },
+  stopLoading() {
+    this.setData({
+      isLoading: false
+    });
+    wx.hideLoading();
   }
 })

+ 11 - 3
pages/myMission/myMission.wxml

@@ -1,4 +1,12 @@
-<view class="container">
+<van-empty image="{{pageTip.detail.image}}" wx:if="{{!isLoading && pageTip.show}}">
+	<view slot='description'>
+		<view class='tip-desc'>{{pageTip.detail.desc}}</view>
+		<view class='identify_btn' wx:if="{{pageTip.detail.showBtn}}" bindtap="goRz" color="linear-gradient(to right, #4bb0ff, #6149f6)">
+  		去认证
+		</view>
+	</view>
+</van-empty>
+<view wx:elif="{{!isLoading}}" class="container">
 	<van-popup show="{{ show }}" bind:close="onClose">
 		<view class="nr_box">
 			<view class="title">学员须知</view>
@@ -21,7 +29,7 @@
 			<view class="thinking" bindtap="moreThink">我再想想</view>
 		</view>
 	</van-popup>
-	<view wx:if="{{isRz}}" class="rzbj" catchtouchmove='true'>
+	<!-- <view wx:if="{{isRz}}" class="rzbj" catchtouchmove='true'>
 		<view class="rzbox">
 			<view class="tip">提示</view>
 			<view class="tip1">
@@ -32,7 +40,7 @@
 				<view class="sure" catchtap="goRz">确定</view>
 			</view>
 		</view>
-	</view>
+	</view> -->
 	<view class="step" style="margin-top:20rpx">
 		<image src='{{istask1==false?"/images/step_unfinish.png":"/images/step_finish.png"}}' mode='aspectFill' class="finish_img"></image>
 		<view class="whitebj">

+ 14 - 0
pages/myMission/myMission.wxss

@@ -479,4 +479,18 @@
   margin-bottom: 50rpx;
   margin-top: 10rpx;
   margin-left: 170rpx;
+}
+.tip-desc{
+  text-align: center;
+}
+.identify_btn{
+  width: 320rpx;
+  padding: 16rpx 10rpx;
+  box-sizing: border-box;
+  margin: 20rpx auto;
+  text-align: center;
+  color: #fff;
+  border-radius: 10rpx;
+  letter-spacing: 2px;
+  background: linear-gradient(to right, #4bb0ff, #6149f6);
 }

+ 76 - 56
project.config.json

@@ -1,58 +1,78 @@
 {
-	"description": "项目配置文件",
-	"packOptions": {
-		"ignore": []
-	},
-	"setting": {
-		"urlCheck": false,
-		"es6": true,
-		"enhance": true,
-		"postcss": true,
-		"preloadBackgroundData": false,
-		"minified": true,
-		"newFeature": true,
-		"coverView": true,
-		"nodeModules": true,
-		"autoAudits": false,
-		"showShadowRootInWxmlPanel": true,
-		"scopeDataCheck": false,
-		"checkInvalidKey": true,
-		"checkSiteMap": true,
-		"uploadWithSourceMap": true,
-		"babelSetting": {
-			"ignore": [],
-			"disablePlugins": [],
-			"outputPath": ""
-		},
-		"useCompilerModule": false,
-		"userConfirmedUseCompilerModuleSwitch": false
-	},
-	"compileType": "miniprogram",
-	"libVersion": "2.11.2",
-	"appid": "wx7e7a46e129d6cd0f",
-	"projectname": "demo1",
-	"debugOptions": {
-		"hidedInDevtools": []
-	},
-	"isGameTourist": false,
-	"simulatorType": "wechat",
-	"simulatorPluginLibVersion": {},
-	"condition": {
-		"search": {
-			"current": -1,
-			"list": []
-		},
-		"conversation": {
-			"current": -1,
-			"list": []
-		},
-		"game": {
-			"currentL": -1,
-			"list": []
-		},
-		"miniprogram": {
-			"current": -1,
-			"list": []
-		}
-	}
+  "description": "项目配置文件",
+  "packOptions": {
+    "ignore": []
+  },
+  "setting": {
+    "urlCheck": false,
+    "es6": true,
+    "enhance": true,
+    "postcss": true,
+    "preloadBackgroundData": false,
+    "minified": true,
+    "newFeature": true,
+    "coverView": true,
+    "nodeModules": true,
+    "autoAudits": false,
+    "showShadowRootInWxmlPanel": true,
+    "scopeDataCheck": false,
+    "checkInvalidKey": true,
+    "checkSiteMap": true,
+    "uploadWithSourceMap": true,
+    "useMultiFrameRuntime": false,
+    "useApiHook": false,
+    "babelSetting": {
+      "ignore": [],
+      "disablePlugins": [],
+      "outputPath": ""
+    },
+    "useIsolateContext": true,
+    "useCompilerModule": true,
+    "userConfirmedUseCompilerModuleSwitch": false,
+    "packNpmManually": false,
+    "packNpmRelationList": []
+  },
+  "compileType": "miniprogram",
+  "libVersion": "2.11.2",
+  "appid": "wx7e7a46e129d6cd0f",
+  "projectname": "demo1",
+  "debugOptions": {
+    "hidedInDevtools": []
+  },
+  "isGameTourist": false,
+  "simulatorType": "wechat",
+  "simulatorPluginLibVersion": {},
+  "condition": {
+    "search": {
+      "current": -1,
+      "list": []
+    },
+    "conversation": {
+      "current": -1,
+      "list": []
+    },
+    "plugin": {
+      "current": -1,
+      "list": []
+    },
+    "game": {
+      "currentL": -1,
+      "list": []
+    },
+    "gamePlugin": {
+      "current": -1,
+      "list": []
+    },
+    "miniprogram": {
+      "current": -1,
+      "list": [
+        {
+          "id": -1,
+          "name": "我的任务",
+          "pathName": "pages/myMission/myMission",
+          "scene": null
+        }
+      ]
+    }
+  }
 }