gemercheung 11 ヶ月 前
コミット
d7819460e4

BIN
imgs/icon/comment.png


BIN
imgs/icon/comment_active.png


BIN
imgs/icon/contart.png


BIN
imgs/icon/empty.png


BIN
imgs/icon/full.png


BIN
imgs/icon/half.png


BIN
imgs/icon/like.png


BIN
imgs/icon/like_active.png


BIN
imgs/icon/mapIcon.png


BIN
imgs/icon/order.png


BIN
imgs/icon/saw.png


BIN
imgs/logo.jpg


BIN
imgs/quanping.png


BIN
imgs/star.png


BIN
imgs/swkz.png


BIN
imgs/swkz_active.png


BIN
imgs/testImg/0.jpg


BIN
imgs/testImg/fdkz.png


BIN
imgs/testImg/fdkz1.png


BIN
imgs/testImg/loginBg.jpg


BIN
imgs/testImg/loginBg.png


BIN
imgs/testImg/logo.png


BIN
imgs/testImg/no_exhibition.png


BIN
imgs/testImg/userIcon.png


BIN
imgs/time.png


BIN
imgs/tongcheng.png


BIN
imgs/tongcheng_active.png


BIN
imgs/user.png


BIN
imgs/user_active.png


BIN
imgs/vr_classroom_n.png


BIN
imgs/vr_classroom_s.png


BIN
imgs/yuezhan.png


BIN
imgs/yuezhan_active.png


+ 3 - 2
pages/course/course.js

@@ -1,7 +1,8 @@
 // pages/course/course.js
-const {
+import {
   getVRCourseList
-} = require('../../utils/request');
+} from '../../utils/request'
+
 const {
   noExhibitionImg
 } = require('../../utils/images');

+ 14 - 4
pages/course_detail/course_detail.js

@@ -1,7 +1,13 @@
 // pages/course_detail/course_detail.js
-const {
+import {
   getVRCourseDetail
-} = require('../../utils/request');
+} from '../../utils/request';
+
+import {
+  IsNotStart,
+  IsInTime
+} from '../../utils/courseTime';
+
 Page({
 
   /**
@@ -9,7 +15,7 @@ Page({
    */
   data: {
     time: 96 * 60 * 1000,
-    data: {
+    detail: {
       compereId: null,
       createTime: "",
       creatorId: null,
@@ -40,6 +46,7 @@ Page({
     if (options.id) {
       // debugger
       this.getVRCourseDetailData(options.id);
+
     }
 
   },
@@ -48,7 +55,10 @@ Page({
     const data = await getVRCourseDetail(id)
     console.log('data', data.data)
     this.setData({
-      data: data.data
+      detail: data.data
+    }, () => {
+      const res = IsNotStart(this.data.detail.createTime)
+      console.log('IsNotStart', res, this.data.detail.createTime)
     })
   },
   /**

+ 6 - 6
pages/course_detail/course_detail.wxml

@@ -1,7 +1,7 @@
 <!--pages/course_detail/course_detail.wxml-->
 <view class="detail-container">
   <t-image class="banner" id="loading-img" shape="round" mode="scaleToFill" loading="slot"
-    src="https://sit-daikan.4dage.com/{{data.thumb}}">
+    src="https://sit-daikan.4dage.com/{{detail.thumb}}">
     <t-loading slot="loading" theme="spinner" size="40rpx" loading />
   </t-image>
 
@@ -9,17 +9,17 @@
 
     <view class="title-info">
       <view class="hugo_price">
-        ¥ {{data.fee}}
+        ¥ {{detail.fee}}
       </view>
       <view class="hugo_title">
-        {{data.title}}
+        {{detail.title}}
       </view>
       <div class="sub_cotnainer">
-        <text class="sub_title">{{data.organization}}-</text>
+        <text class="sub_title">{{detail.organization}}-</text>
 
         <view class="sub_time">
           <image class="time" src="../../imgs/time.png"></image>
-          <text>{{data.duration}}分钟</text>
+          <text>{{detail.duration}}分钟</text>
         </view>
 
       </div>
@@ -28,7 +28,7 @@
     <view class="detail_content">
       <view class="detail_title"> 课程详情</view>
       <view class="content">
-        {{data.rtf}}
+        {{detail.rtf}}
       </view>
     </view>
 

+ 53 - 130
pages/user/index.js

@@ -7,7 +7,9 @@ const {
   Toast
 } = require('../../utils/util.js');
 var app = getApp();
-
+import {
+  getWxUserInfo
+} from '../../utils/request'
 Page({
 
   /**
@@ -69,6 +71,7 @@ Page({
    */
   onLoad: function (options) {
     // this.isLongPolling()
+    // this.newLogin();
   },
 
   isLongPolling: function () {
@@ -385,136 +388,8 @@ Page({
     })
   },
 
-  // 微信改版了 
-  // _getUserInfoToLogin: function(e) {
-  //   Toast.showToast2('loading');
-
-  //   if (e.detail.encryptedData) {
-  //     // 可以将 res 发送给后台解码出 unionId
-  //     // app.globalData.userInfo = res.userInfo;
-  //     // app.globalData.encryptedData = res.encryptedData;
-  //     // app.globalData.iv = res.iv;
-  //     let {
-  //       encryptedData,
-  //       iv,
-  //       userInfo
-  //     } = e.detail;
-
-  //     console.log('---------',e);
-
-  //     app.globalData.userInfo = userInfo;
-  //     wx.setStorageSync("userInfo", userInfo)
-  //     this.setData({
-  //       avatarUrl: wx.getStorageSync('userInfo').avatarUrl
-  //     })
-  //     wx.login({
-  //       success: res => {
-  //         let {
-  //           code
-  //         } = res;
-  //         if (code) {
-
-  //           console.log(123456,code);
-
-  //           wx.request({
-  //             url: serverName + '/wx/api/user/getLoginSessionKey',
-  //             data: {
-  //               encryptedData,
-  //               iv,
-  //               code,
-  //             },
-  //             header: {
-  //               'content-type': 'application/x-www-form-urlencoded'
-  //             },
-  //             method: 'post',
-  //             // dataType: 'json',
-  //             // responseType: 'text',
-  //             success: res => {
-  //               if (res.data.code > -1) {
-  //                 let {
-  //                   loginSessionKey
-  //                 } = res.data.data;
-  //                 wx.setStorageSync('token', loginSessionKey)
-  //               }
-  //               else{
-  //                 Toast.showToast('warn', '登录失败,请重试');
-  //               }
-  //             },
-  //             fail: res => {
-  //               Toast.showToast('warn', '登录失败,请重试');
-
-  //             },
-  //             complete: res=> {
-  //               this._isLogin();
-  //               Toast.hideLoading();
-  //             },
-  //           })
-
-
-  //           request["getLoginSessionKey"]({
-  //             encryptedData,
-  //             iv,
-  //             code,
-  //             loginSessionKey:''
-  //           }, "post", res => {
-  //             if (res.data.code > -1) {
-  //               let {
-  //                 loginSessionKey
-  //               } = res.data.data;
-  //               wx.setStorageSync('token', loginSessionKey)
-  //               this.isLongPolling();
-  //               console.log(loginSessionKey)
-  //             }
-
-  //           }, err => {
-
-  //           }, complete => {
-  //             this._isLogin();
-  //             Toast.hideLoading();
-  //           })
-  //         }
-  //       }
-  //     })
-
-
-
-  //     // console.log(res.userInfo)
-
-  //     // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
-  //     // 所以此处加入 callback 以防止这种情况
-  //     if (this.userInfoReadyCallback) {
-  //       this.userInfoReadyCallback(res)
-  //     }
-  //   }
-
-  // },
-
-  // _login:function(e){
-  //   console.log(e)
-  //   // if(!this.data.isLogin){
-  //   //   Toast.showToast2('loading');
-  //   //   wx.getSetting({
-  //   //     success: res => {
-  //   //       console.log(res.authSetting['scope.userInfo'])
-  //   //       if (!res.authSetting['scope.userInfo'] == undefined || res.authSetting['scope.userInfo'] == false) {
-  //   //         Toast.showToast('tip', '四维看展申请获取个人信息权限', () => {
-  //   //           wx.openSetting({
-  //   //             success: res => {
-  //   //               this._getUserInfoToLogin();
-  //   //             }
-  //   //           });
-  //   //         });
-  //   //       } else {
-  //   //         // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
-  //   //         this._getUserInfoToLogin();
-  //   //       }
-  //   //     }
-  //   //   })
-  //   // }
-  // },
 
   _logout: function () {
-
     if (this.data.isLogin) {
       Toast.showToast2('loading');
       let loginSessionKey = wx.getStorageSync('token');
@@ -562,7 +437,6 @@ Page({
     // url="./my_order/index?status={{item.tag}}&&id={{item.id}}"
   },
 
-
   clickCell: function () {
     wx.navigateTo({
       url: './my_contact/index',
@@ -574,6 +448,52 @@ Page({
       url: '/pages/user/personal/personal',
     })
   },
+
+  newLogin() {
+    wx.login({
+      success: res => {
+        let {
+          code
+        } = res;
+
+        console.log(789, res);
+
+        if (code) {
+          wx.request({
+            url: serverName + '/wx/api/user/getLoginSessionKey',
+            data: {
+              code,
+            },
+            header: {
+              'content-type': 'application/x-www-form-urlencoded'
+            },
+            method: 'post',
+            // dataType: 'json',
+            // responseType: 'text',
+            success: res => {
+              if (res.data.code > -1) {
+                let {
+                  loginSessionKey
+                } = res.data.data;
+                wx.setStorageSync('token', loginSessionKey)
+              } else {
+                Toast.showToast('warn', '登录失败,请重试');
+              }
+            },
+            fail: res => {
+              Toast.showToast('warn', '登录失败,请重试');
+
+            },
+            complete: res => {
+              this._isLogin();
+              Toast.hideLoading();
+            },
+          })
+        }
+      }
+    })
+
+  },
   /**
    * 生命周期函数--监听页面初次渲染完成
    */
@@ -597,6 +517,9 @@ Page({
       avatarName: avatarName || '已登录'
     })
     this._isLogin()
+
+    getWxUserInfo('9fbbd7dfca6e49d9b20b77eb0f94e73a')
+    // debugger
   },
 
   /**

+ 2 - 1
pages/user/index.wxml

@@ -7,7 +7,8 @@
         <image mode="aspectFit" class='user_avatar' src='{{avatarUrl||avatar}}'></image>
         <text class='user_nickName'>{{isLogin?avatarName:"登录"}}</text>
         <!-- <button open-type="getUserInfo" class='user_avatar_btn' bindgetuserinfo="_getUserInfoToLogin"></button> -->
-        <button class='user_avatar_btn' bindtap="toPersonal"></button>
+        <button class='user_avatar_btn' bindtap="getUserProfile"></button>
+        <!-- <button class='user_avatar_btn' bindtap="toPersonal"></button> -->
       </view>
     </view>
   </view>

+ 2 - 1
project.config.json

@@ -21,7 +21,8 @@
     "useMultiFrameRuntime": true,
     "useApiHook": true,
     "useApiHostProcess": true,
-    "packNpmRelationList": []
+    "packNpmRelationList": [],
+    "ignoreUploadUnusedFiles": false
   },
   "compileType": "miniprogram",
   "libVersion": "2.11.3",

+ 2 - 1
project.private.config.json

@@ -112,7 +112,8 @@
   "projectname": "Small_Program",
   "setting": {
     "compileHotReLoad": true,
-    "urlCheck": false
+    "urlCheck": false,
+    "bigPackageSizeSupport": true
   },
   "libVersion": "2.14.1"
 }

+ 21 - 0
utils/courseTime.js

@@ -0,0 +1,21 @@
+import dayjs from 'dayjs'
+const isBetween = require('./dayjs/isBetween')
+dayjs.extend(isBetween);
+
+export function IsNotEnd(comingEndDate) {
+  const now = dayjs();
+  const isNotEnd = dayjs(comingEndDate).diff(now, 'second');
+  return isNotEnd > 0 ? false : true
+}
+
+export function IsNotStart(comingStartDate) {
+  const now = dayjs();
+  const IsNotStart = dayjs(comingStartDate).diff(now, 'second');
+  console.log('IsNotStart', IsNotStart)
+  return IsNotStart > 0 ? true : false
+}
+
+export function IsInTime(comingStartDate, comingEndDate) {
+  const now = dayjs();
+  return now.isBetween(dayjs(comingStartDate), dayjs(comingEndDate))
+}

ファイルの差分が大きいため隠しています
+ 1 - 0
utils/dayjs/isBetween.js


+ 14 - 7
utils/request.js

@@ -5,7 +5,9 @@ const urls = {
   //VR课堂
   getVRCourseList: '/api/show/lesson/pageList',
   //VR课堂详情
-  getVRCourseDetail: '/api/show/lesson/detail/'
+  getVRCourseDetail: '/api/show/lesson/detail/',
+  // 获取微信用户详情
+  getWxUserInfo: "/api/wxUser/getWxUserInfo/"
 
 }
 
@@ -14,17 +16,22 @@ wxRequest.defaults.headers['Token'] = wx.getStorageSync('token') || "";
 wxRequest.defaults.headers.post['Content-Type'] = 'application/json';
 
 
-async function getVRCourseList(params) {
+export async function getVRCourseList(params) {
   return await (await wxRequest.post(urls.getVRCourseList, params)).data;
 }
 
-async function getVRCourseDetail(id) {
+export async function getVRCourseDetail(id) {
   return await (await wxRequest.get(urls.getVRCourseDetail + id)).data;
 }
 
+export async function getWxUserInfo(key) {
+  return await (await wxRequest.get(urls.getWxUserInfo + key)).data;
+}
+
 
 
-module.exports = {
-  getVRCourseList,
-  getVRCourseDetail
-}
+// module.exports = {
+//   getVRCourseList,
+//   getVRCourseDetail,
+//   getWxUserInfo
+// }

+ 3 - 2
utils/services.js

@@ -2,7 +2,8 @@ const {
   Toast
 } = require('./util');
 
-const serverName = 'https://www.4dmuseum.cn/2.0'; // 正式
+// const serverName = 'https://www.4dmuseum.cn/2.0'; // 正式
+const serverName = 'http://sit-kanzhan.4dkankan.com'; // 测试
 // const serverName = 'http://192.168.0.10:8081'; // 本地
 
 //const imgServer = 'https://www.4dmuseum.cn/'
@@ -72,7 +73,7 @@ const urls = {
   //线下展讯热门推荐
   offlineRecommend: '/wx/api/exhibition/offlineRecommend',
 
-  
+
 };
 // 上传路径
 const uploadUrls = {};