LiuShu_0203 пре 6 дана
родитељ
комит
a391c6db19

+ 3 - 0
pages/groupbuying/groupbuying.js

@@ -78,6 +78,9 @@ Page({
   loadMore() {
     // 加载更多数据的逻辑
     console.log('加载更多');
+    // this.getDatalist(this.data.types_ids, true);
+    if (this.data.isLoading || !this.data.hasMore) return;
+    this.setData({ isLoading: true });
     this.getDatalist(this.data.types_ids, true);
   },
 

+ 3 - 0
subpackages/collect/collect.js

@@ -49,6 +49,9 @@ Page({
   loadMore() {
     // 加载更多数据的逻辑
     console.log('加载更多');
+    // this.getcollect(true);
+    if (this.data.isLoading || !this.data.hasMore) return;
+    this.setData({ isLoading: true });
     this.getcollect(true);
   },
 

+ 3 - 3
subpackages/jxhome/jxhome.wxml

@@ -16,20 +16,20 @@
     <view class="course-buttons">
       <view class="course-button1" style="background-image: url({{homepage_7}}); background-size: cover;" bindtap="goToGoodsList" data-type="1" >
         <view class="nr_boxs">
-          <text>课程卡尔阅读</text>
+          <text>卡尔阅读</text>
           <text>course</text>
         </view>
       </view>
       <view class="course-buttonstow">
         <view class="course-button2" style="background-image: url({{homepage_6}}); background-size: cover;"  bindtap="goToGoodsList" data-type="2">
           <view class="nr_boxs">
-            <text>课程卡尔思维</text>
+            <text>卡尔思维</text>
             <text>course</text>
           </view>
         </view>
         <view class="course-button2" bindtap="goToGoodsList" data-type="3" style="margin-top: 20rpx; background-image: url({{homepage_5}}); background-size: cover;">
           <view class="nr_boxs">
-            <text>课程动手动脑</text>
+            <text>动手动脑</text>
             <text>course</text>
           </view>
         </view>

+ 3 - 3
subpackages/kchome/kchome.wxml

@@ -16,20 +16,20 @@
     <view class="course-buttons">
       <view class="course-button1" style="background-image: url({{homepage_7}}); background-size: cover;" bindtap="goToGoodsList" data-type="1" >
         <view class="nr_boxs">
-          <text>课程卡尔阅读</text>
+          <text>卡尔阅读</text>
           <text>course</text>
         </view>
       </view>
       <view class="course-buttonstow">
         <view class="course-button2" style="background-image: url({{homepage_6}}); background-size: cover;"  bindtap="goToGoodsList" data-type="2">
           <view class="nr_boxs">
-            <text>课程卡尔思维</text>
+            <text>卡尔思维</text>
             <text>course</text>
           </view>
         </view>
         <view class="course-button2" bindtap="goToGoodsList" data-type="3" style="margin-top: 20rpx; background-image: url({{homepage_5}}); background-size: cover;">
           <view class="nr_boxs">
-            <text>课程动手动脑</text>
+            <text>动手动脑</text>
             <text>course</text>
           </view>
         </view>

+ 18 - 14
subpackages/productdetails/productdetails.js

@@ -104,23 +104,27 @@ Page({
   // 配置微信分享信息
   onShareAppMessage() {
     const { item, shareType } = this.data;
-
-    let title = '';
-    let path = '';
-
+  
     if (shareType === 'teacher') {
-      title = '推荐给老师的优质商品,快来看!';
-      path = `/subpackages/productdetails/productdetails?data=${encodeURIComponent(JSON.stringify(item))}&from=teacher`;
+      // 老师端,正常分享
+      return {
+        title: '推荐给老师的优质商品,快来看!',
+        path: `/subpackages/productdetails/productdetails?data=${encodeURIComponent(JSON.stringify(item))}&from=teacher`,
+        imageUrl: item.detail_images?.[0] || ''
+      };
     } else {
-      title = '推荐给家长的宝藏商品,别错过!';
-      path = `/subpackages/productdetails/productdetails?data=${encodeURIComponent(JSON.stringify(item))}&from=parent`;
+      // 家长端,跳转到另一个小程序
+      return {
+        title: '推荐给家长的宝藏商品,别错过!',
+        path: `/subpackages/productdetails/productdetails?data=${encodeURIComponent(JSON.stringify(item))}&from=parent`,
+        imageUrl: item.detail_images?.[0] || '',
+        appId: 'wx19b14b10ee9d1571', // 家长端小程序的 appId
+        extraData: {
+          // 可以传递一些额外数据(家长端可以在 onLoad 获取)
+          // source: 'teacherApp'
+        }
+      };
     }
-
-    return {
-      title,
-      path,
-      imageUrl: item.detail_images?.[0] || ''
-    };
   },
 
   // 点击切换规格

+ 4 - 0
subpackages/purchasehistory/purchasehistory.js

@@ -49,7 +49,11 @@ Page({
   loadMore() {
     // 加载更多数据的逻辑
     console.log('加载更多');
+    // this.getcollect(true);
+    if (this.data.isLoading || !this.data.hasMore) return;
+    this.setData({ isLoading: true });
     this.getcollect(true);
+
   },
 
   // 收藏列表

+ 3 - 3
subpackages/pxhome/pxhome.wxml

@@ -16,20 +16,20 @@
     <view class="course-buttons">
       <view class="course-button1" style="background-image: url({{homepage_7}}); background-size: cover;" bindtap="goToGoodsList" data-type="1" >
         <view class="nr_boxs">
-          <text>课程卡尔阅读</text>
+          <text>卡尔阅读</text>
           <text>course</text>
         </view>
       </view>
       <view class="course-buttonstow">
         <view class="course-button2" style="background-image: url({{homepage_6}}); background-size: cover;"  bindtap="goToGoodsList" data-type="2">
           <view class="nr_boxs">
-            <text>课程卡尔思维</text>
+            <text>卡尔思维</text>
             <text>course</text>
           </view>
         </view>
         <view class="course-button2" bindtap="goToGoodsList" data-type="3" style="margin-top: 20rpx; background-image: url({{homepage_5}}); background-size: cover;">
           <view class="nr_boxs">
-            <text>课程动手动脑</text>
+            <text>动手动脑</text>
             <text>course</text>
           </view>
         </view>

+ 3 - 3
subpackages/zshome/zshome.wxml

@@ -16,20 +16,20 @@
     <view class="course-buttons">
       <view class="course-button1" style="background-image: url({{homepage_7}}); background-size: cover;" bindtap="goToGoodsList" data-type="1" >
         <view class="nr_boxs">
-          <text>课程卡尔阅读</text>
+          <text>卡尔阅读</text>
           <text>course</text>
         </view>
       </view>
       <view class="course-buttonstow">
         <view class="course-button2" style="background-image: url({{homepage_6}}); background-size: cover;"  bindtap="goToGoodsList" data-type="2">
           <view class="nr_boxs">
-            <text>课程卡尔思维</text>
+            <text>卡尔思维</text>
             <text>course</text>
           </view>
         </view>
         <view class="course-button2" bindtap="goToGoodsList" data-type="3" style="margin-top: 20rpx; background-image: url({{homepage_5}}); background-size: cover;">
           <view class="nr_boxs">
-            <text>课程动手动脑</text>
+            <text>动手动脑</text>
             <text>course</text>
           </view>
         </view>

+ 3 - 0
subpackagestow/course/course.js

@@ -114,6 +114,9 @@ Page({
   loadMore() {
     // 加载更多数据的逻辑
     console.log('加载更多');
+    // this.getdatalist(true);
+    if (this.data.isLoading || !this.data.hasMore) return;
+    this.setData({ isLoading: true });
     this.getdatalist(true);
   },
 

+ 11 - 1
subpackagestow/details/details.js

@@ -166,10 +166,20 @@ Page({
   // 收藏
   async goTocollect() {
     if (this.data.isCollected) {
+      const userInfo = wx.getStorageSync('userInfo');
       const { data } = await models.wx_collect.delete({
         filter: {
           where: {
-            file_manager_id: _.eq(this.data.itemlist._id),  // 收藏文件id
+            $and: [
+              {
+                file_manager_id: {
+                  $eq: this.data.itemlist._id, // 推荐传入_id数据标识进行操作
+                },
+                wx_user_id: {
+                  $eq: userInfo._id, // 推荐传入_id数据标识进行操作
+                },
+              },
+            ]
           }
         },
         // envType: pre 体验环境, prod 正式环境

+ 1 - 1
subpackagestow/details/details.wxml

@@ -2,7 +2,7 @@
   <view class="container">
     <view class="header">
       <text>{{ itemlist.name }}</text>
-      <text>{{itemlist.publisher}} • {{ itemlist.createdAtText }}</text>
+      <!-- <text>{{itemlist.publisher}} • {{ itemlist.createdAtText }}</text> -->
       <text>{{itemlist.type === 0 ? '视频' : itemlist.type === 1 ? '音频' : itemlist.type === 2 ? 'PDF' : itemlist.type === 3 ? 'PPT' : '图文'}} 适用于 {{ itemlist.range }}</text>
     </view>
     <!-- 预览 -->

+ 149 - 123
subpackagestow/down/down.js

@@ -139,143 +139,169 @@ Page({
 
   // 下载
   handleDownloadFile() {
-    const url = this.data.itemtempFileURL;
-    console.log(url);
-    if (!url) {
+    const link = this.data.itemtempFileURL;
+    if (!link) {
       wx.showToast({
-        title: '文件链接不存在',
+        title: '下载链接为空',
         icon: 'none'
       });
       return;
     }
   
-    wx.showLoading({
-      title: '下载中...',
-      mask: true
+    // 复制到剪贴板
+    wx.setClipboardData({
+      data: link,
+      success: () => {
+        wx.showModal({
+          title: '提示',
+          content: '下载链接已复制,请到浏览器粘贴并下载',
+          showCancel: false, // 不显示取消按钮
+          confirmText: '我知道了',
+          success(res) {
+            if (res.confirm) {
+              console.log('用户点击确定,弹框关闭');
+            }
+          }
+        });
+      }
     });
+    // const url = this.data.itemtempFileURL;
+    // console.log(url);
+    // if (!url) {
+    //   wx.showToast({
+    //     title: '文件链接不存在',
+    //     icon: 'none'
+    //   });
+    //   return;
+    // }
+  
+    // wx.showLoading({
+    //   title: '下载中...',
+    //   mask: true
+    // });
   
-    wx.downloadFile({
-      url: url,
-      success: (res) => {
-        wx.hideLoading();
+    // wx.downloadFile({
+    //   url: url,
+    //   success: (res) => {
+    //     wx.hideLoading();
 
-        console.log('进来了++++++++');
-        if (res.statusCode === 200) {
-          const tempFilePath = res.tempFilePath;
-          const fileExt = url.split('.').pop().toLowerCase();
-          const that = this; // 保存页面上下文
-          if (['pdf', 'ppt', 'pptx', 'doc', 'docx', 'xls', 'xlsx'].includes(fileExt)) {
-            // 打开文档
-            wx.openDocument({
-              filePath: tempFilePath,
-              showMenu: true,
-              success() {
-                console.log('打开文档成功');
-                that.getaddlishi()
-              },
-              fail(err) {
-                wx.showToast({
-                  title: '打开文档失败',
-                  icon: 'none'
-                });
-                console.error('文档打开失败', err);
-              }
-            });
+    //     console.log('进来了++++++++');
+    //     if (res.statusCode === 200) {
+    //       const tempFilePath = res.tempFilePath;
+    //       const fileExt = url.split('.').pop().toLowerCase();
+    //       const that = this; // 保存页面上下文
+    //       if (['pdf', 'ppt', 'pptx', 'doc', 'docx', 'xls', 'xlsx'].includes(fileExt)) {
+    //         // 打开文档
+    //         wx.openDocument({
+    //           filePath: tempFilePath,
+    //           showMenu: true,
+    //           success() {
+    //             console.log('打开文档成功');
+    //             that.getaddlishi()
+    //           },
+    //           fail(err) {
+    //             wx.showToast({
+    //               title: '打开文档失败',
+    //               icon: 'none'
+    //             });
+    //             console.error('文档打开失败', err);
+    //           }
+    //         });
   
-          } else if (['mp4', 'mov', 'avi'].includes(fileExt)) {
-            // 视频:先检查权限再保存
-            wx.getSetting({
-              success: (res) => {
-                if (!res.authSetting['scope.writePhotosAlbum']) {
-                  wx.authorize({
-                    scope: 'scope.writePhotosAlbum',
-                    success: () => {
-                      this.saveVideo(tempFilePath);
-                    },
-                    fail: () => {
-                      wx.showModal({
-                        title: '提示',
-                        content: '保存视频需要开启“保存到相册”权限,请前往设置开启。',
-                        showCancel: true,
-                        success(result) {
-                          if (result.confirm) {
-                            wx.openSetting();
-                          }
-                        }
-                      });
-                    }
-                  });
-                } else {
-                  this.saveVideo(tempFilePath);
-                }
-              }
-            });
+    //       } else if (['mp4', 'mov', 'avi'].includes(fileExt)) {
+    //         // 视频:先检查权限再保存
+    //         wx.getSetting({
+    //           success: (res) => {
+    //             if (!res.authSetting['scope.writePhotosAlbum']) {
+    //               wx.authorize({
+    //                 scope: 'scope.writePhotosAlbum',
+    //                 success: () => {
+    //                   this.saveVideo(tempFilePath);
+    //                 },
+    //                 fail: () => {
+    //                   wx.showModal({
+    //                     title: '提示',
+    //                     content: '保存视频需要开启“保存到相册”权限,请前往设置开启。',
+    //                     showCancel: true,
+    //                     success(result) {
+    //                       if (result.confirm) {
+    //                         wx.openSetting();
+    //                       }
+    //                     }
+    //                   });
+    //                 }
+    //               });
+    //             } else {
+    //               this.saveVideo(tempFilePath);
+    //             }
+    //           }
+    //         });
   
-          } else if (['mp3', 'wav', 'aac'].includes(fileExt)) {
-            // 音频保存到本地缓存
-            wx.saveFile({
-              tempFilePath,
-              success(result) {
-                wx.showToast({
-                  title: '音频已保存',
-                  icon: 'success'
-                });
-                that.getaddlishi()
-                console.log('音频保存路径:', result.savedFilePath);
-              },
-              fail(err) {
-                wx.showToast({
-                  title: '保存失败',
-                  icon: 'none'
-                });
-                console.error('音频保存失败:', err);
-              }
-            });
+    //       } else if (['mp3', 'wav', 'aac'].includes(fileExt)) {
+    //         // 音频保存到本地缓存
+    //         wx.saveFile({
+    //           tempFilePath,
+    //           success(result) {
+    //             wx.showToast({
+    //               title: '音频已保存',
+    //               icon: 'success'
+    //             });
+    //             that.getaddlishi()
+    //             console.log('音频保存路径:', result.savedFilePath);
+    //           },
+    //           fail(err) {
+    //             wx.showToast({
+    //               title: '保存失败',
+    //               icon: 'none'
+    //             });
+    //             console.error('音频保存失败:', err);
+    //           }
+    //         });
   
-          } else {
-            wx.showToast({
-              title: '暂不支持的文件类型',
-              icon: 'none'
-            });
-          }
+    //       } else {
+    //         wx.showToast({
+    //           title: '暂不支持的文件类型',
+    //           icon: 'none'
+    //         });
+    //       }
   
-        } else {
-          wx.showToast({
-            title: '下载失败',
-            icon: 'none'
-          });
-        }
-      },
-      fail: (err) => {
-        wx.hideLoading();
-        wx.showToast({
-          title: '下载失败',
-          icon: 'none'
-        });
-        console.error('下载出错:', err);
-      }
-    });
+    //     } else {
+    //       wx.showToast({
+    //         title: '下载失败',
+    //         icon: 'none'
+    //       });
+    //     }
+    //   },
+    //   fail: (err) => {
+    //     wx.hideLoading();
+    //     wx.showToast({
+    //       title: '下载失败',
+    //       icon: 'none'
+    //     });
+    //     console.error('下载出错:', err);
+    //   }
+    // });
   }, 
-  saveVideo(filePath) {
-    const that = this; // 保存页面上下文
-    wx.saveVideoToPhotosAlbum({
-      filePath,
-      success() {
-        wx.showToast({
-          title: '视频已保存',
-          icon: 'success'
-        });
-        that.getaddlishi()
-      },
-      fail(err) {
-        wx.showToast({
-          title: '保存失败',
-          icon: 'none'
-        });
-        console.error('视频保存失败:', err);
-      }
-    });
-  },
+  // saveVideo(filePath) {
+  //   const that = this; // 保存页面上下文
+  //   wx.saveVideoToPhotosAlbum({
+  //     filePath,
+  //     success() {
+  //       wx.showToast({
+  //         title: '视频已保存',
+  //         icon: 'success'
+  //       });
+  //       that.getaddlishi()
+  //     },
+  //     fail(err) {
+  //       wx.showToast({
+  //         title: '保存失败',
+  //         icon: 'none'
+  //       });
+  //       console.error('视频保存失败:', err);
+  //     }
+  //   });
+  // },
 
   // 新增下载历史
   async getaddlishi() {

+ 3 - 0
subpackagestow/show/show.js

@@ -107,6 +107,9 @@ Page({
   loadMore() {
     // 加载更多数据的逻辑
     console.log('加载更多');
+    // this.getdatalist(true);
+    if (this.data.isLoading || !this.data.hasMore) return;
+    this.setData({ isLoading: true });
     this.getdatalist(true);
   },
 

+ 3 - 0
subpackagestow/teaching/teaching.js

@@ -97,6 +97,9 @@ Page({
   loadMore() {
     // 加载更多数据的逻辑
     console.log('加载更多');
+    // this.getdatalist(true);
+    if (this.data.isLoading || !this.data.hasMore) return;
+    this.setData({ isLoading: true });
     this.getdatalist(true);
   },
 

+ 3 - 0
subpackagestow/training/training.js

@@ -99,6 +99,9 @@ Page({
   loadMore() {
     // 加载更多数据的逻辑
     console.log('加载更多');
+    // this.getdatalist(true);
+    if (this.data.isLoading || !this.data.hasMore) return;
+    this.setData({ isLoading: true });
     this.getdatalist(true);
   },