18 Commits eefdc5cb54 ... 7c28f32ba8

Autor SHA1 Mensagem Data
  sungongwei 7c28f32ba8 Merge branch 'v2' há 8 meses atrás
  sungongwei 631dd53f60 fix: há 8 meses atrás
  sungongwei 8d2c5cfa69 fix: há 8 meses atrás
  sungongwei b9d1adbbdb fix há 8 meses atrás
  sungongwei bde79fa7c0 feat:讲师多选 há 10 meses atrás
  sungongwei 533d95974f fix; há 10 meses atrás
  sungongwei 84f1b38406 fix: há 10 meses atrás
  sungongwei b3381b3ef8 fix: há 10 meses atrás
  sungongwei 07ed324818 fix: há 10 meses atrás
  sungongwei 6e6ab4bc5d fix: há 10 meses atrás
  wmf c34b4889ca style: 首页-面向人才模块毛玻璃效果 há 10 meses atrás
  sungongwei 26cad85a6f fix:专家图片 há 10 meses atrás
  sungongwei bdd57f15f2 fix:font há 10 meses atrás
  sungongwei f4fb046057 fix: há 10 meses atrás
  sungongwei dedfcf9769 fix: há 10 meses atrás
  sungongwei 08da713752 faet: 详情页面 há 10 meses atrás
  wmf 7c74053eb8 feat: 详情页新增模块 há 10 meses atrás
  wmf 30bf925718 feat: 详情页&支付页视频自定义播放按钮 há 10 meses atrás

+ 2 - 1
db/models/course.js

@@ -47,7 +47,8 @@ const model = connect.define(
       comment: '标签图',
     },
     teacherId: {
-      type: DataTypes.INTEGER,
+      type: DataTypes.JSON,
+      defaultValue: [],
       comment: '讲师',
     },
     recordId: {

+ 1 - 1
db/models/inviter.js

@@ -35,7 +35,7 @@ const model = connect.define(
       comment: '邀请码',
     },
     discount: {
-      type: DataTypes.DECIMAL(2, 1),
+      type: DataTypes.DECIMAL(3, 2),
       defaultValue: 1,
       comment: '折扣',
     },

BIN
server/public/images/prof_2.png


BIN
server/public/images/prof_3.png


BIN
server/public/images/prof_4.png


BIN
server/public/images/prof_5.png


+ 10 - 2
server/routes/course.js

@@ -45,7 +45,11 @@ router.get('/:id', async (req, res) => {
     where: { type: cdata.type, id: { [Op.not]: id }, status: COURSE_STATUS.已上线 },
     attributes: ['id', 'detailimg', 'title', 'price'],
   });
-  const tdata = await teacher.findOne({ where: { id: cdata.teacherId } });
+  const tdata = await Promise.all(
+    cdata.teacherId.map(item => {
+      return teacher.findOne({ where: { id: item } });
+    })
+  );
 
   const option = {
     title: '课程详情页',
@@ -95,7 +99,11 @@ router.get('/:id/:chapterId', async (req, res) => {
     where: { type: cdata.type, id: { [Op.not]: id }, status: COURSE_STATUS.已上线 },
     attributes: ['id', 'detailimg', 'title', 'price'],
   });
-  const tdata = await teacher.findOne({ where: { id: cdata.teacherId } });
+  const tdata = await Promise.all(
+    cdata.teacherId.map(item => {
+      return teacher.findOne({ where: { id: item } });
+    })
+  );
   const chdata = await chapter.findAll({
     where: { cid: id, status: 1 },
   });

+ 7 - 6
server/routes/master/course.js

@@ -14,12 +14,13 @@ const _COURSE_TYPE = _.invert(COURSE_TYPE);
 
 async function fillSingle(data) {
   const { teacherId, recordId } = data;
-  const tdata = await Promise.all([
-    Teacher.findOne({ where: { id: teacherId } }),
-    Teacher.findOne({ where: { id: recordId } }),
-  ]);
-  tdata[0] && (data.teacherName = tdata[0].name);
-  tdata[1] && (data.recordName = tdata[1].name);
+  const recorder = await Teacher.findOne({ where: { id: recordId } });
+  data.teachers = await Promise.all(
+    teacherId.map(item => {
+      return Teacher.findOne({ where: { id: item } });
+    })
+  );
+  recorder && (data.recordName = recorder.name);
   data.publishAt && (data.publishAt = dateFormat(data.publishAt));
   data.statusStr = _COURSE_STATUS[data.status];
   data.typeStr = _COURSE_TYPE[data.type];

+ 12 - 5
server/routes/master/order.js

@@ -60,19 +60,26 @@ async function fillSingle(data) {
  * @number
  */
 router.get('/', async (req, res) => {
-  const { page = 0, title, uname, stime, etime, channel } = req.query;
-  const where = _.omit(req.query, ['page', 'uname', 'stime', 'etime']);
+  const { page = 0, title, uname, stime, etime, channel, phone } = req.query;
+  const where = _.omit(req.query, ['page', 'uname', 'stime', 'etime', 'phone']);
   if (title) {
-    where.title = { [Op.like]: `%${title}` };
+    where.title = { [Op.like]: `%${title}%` };
   }
   if (stime || etime) {
     where.payAt = {};
     stime && (where.payAt[Op.gte] = moment(stime).startOf('d'));
     etime && (where.payAt[Op.lte] = moment(etime).endOf('d'));
   }
-  if (uname) {
+  if (uname || phone) {
+    const where2 = {};
+    if (uname) {
+      where2.login = { [Op.like]: `%${uname}%` };
+    }
+    if (phone) {
+      where2.phoneNumber = { [Op.like]: `%${phone}%` };
+    }
     const uList = await SysUser.findAll({
-      where: { login: { [Op.like]: `%${uname}` } },
+      where: where2,
       attributes: ['id'],
     });
     where.uid = { [Op.in]: uList.map(item => item.id) };

+ 3 - 1
server/routes/master/teacher.js

@@ -107,7 +107,9 @@ router.put('/:id', async (req, res) => {
  */
 router.delete('/:id', async (req, res) => {
   const { id } = req.params;
-  const ccount = await Course.count({ where: { [Op.or]: [{ teacherId: id }, { recordId: id }] } });
+  const ccount = await Course.count({
+    where: { [Op.or]: [{ teacherId: { [Op.like]: `%${id}%` } }, { recordId: id }] },
+  });
   if (ccount) {
     return res.send(onError('请先解绑相关课程'));
   }

+ 7 - 5
server/views/components/course-section.html

@@ -16,7 +16,7 @@
           <h4>本课程包括</h4>
         </div>
         <ul class="includes-list">
-          <li class="course-time"><%= course.cHours%>小时长的精选视频</li>
+          <li class="course-time"><%= course.cHours%> 小时长的精选视频</li>
           <li class="course-articles"><%= course.cChapter%> 篇文章</li>
           <li class="course-auth">永久访问权</li>
           <li class="course-certificate">结业证书</li>
@@ -27,18 +27,20 @@
           <h4>授课教师</h4>
         </div>
         <ul class="masters-list">
+          <% teacher.forEach(item => { %>
           <li>
             <div class="master-intro">
               <div class="avatar">
-                <img src="<%= teacher.img%>" alt="讲师" />
+                <img src="<%= item.img%>" alt="讲师" />
               </div>
               <div class="info">
-                <h5><%= teacher.name%></h5>
-                <div class="title"><%= teacher.title%></div>
+                <h5><%= item.name%></h5>
+                <div class="title"><%= item.title%></div>
               </div>
             </div>
-            <div class="master-desc"><%= teacher.desc%></div>
+            <div class="master-desc"><%= item.desc%></div>
           </li>
+          <% }) %>
         </ul>
       </div>
       <% if(otherCourse.length){ %>

+ 1 - 1
server/views/components/site-footer.html

@@ -1,7 +1,7 @@
 <div class="site-footer">
   <div class="wrapper">
     <p>
-      版权所有&copy;红杉天科技集团有限公司<a href="https://beian.mps.gov.cn/#/query/webSearch" target="_blank" class="police">京公网安备11010602104726号</a><a href="https://beian.miit.gov.cn/#/Integrated/index" target="_blank">京ICP备2021020520号-1</a> 
+      版权所有&copy;红杉天科技集团有限公司<a href="https://beian.mps.gov.cn/#/query/webSearch" target="_blank" class="police">京公网安备11010602104726号</a><a href="https://beian.miit.gov.cn/#/Integrated/index" target="_blank">京ICP备2021020520号-1</a> 
     </p>
     <p><a href="/">服务条款</a>|<a href="/">隐私政策</a></p>
   </div>

+ 5 - 1
server/views/index.html

@@ -180,6 +180,7 @@
                 <div class="title">
                   <p>中国农业大学教授、博导</p>
                   <p>国家级高层次青年人才</p>
+                  <p>《麻省理工科技评论》亚太区“35岁以下科技创新35人</p>
                 </div>
                 <div class="desc">
                   「综合利用遥感技术,可以实现CCER项目的全面监测和管理,为项目有效性提供支持」
@@ -209,7 +210,8 @@
                 <h3 class="name">张颖</h3>
                 <div class="title">
                   <p>东北农业大学教授、博导</p>
-                  <p>国家高层次学者特聘教授</p>
+                  <p>国家杰出青年基金获得者;国家高层次学者特聘教授</p>
+                  <p>国家“万人计划”领军人才</p>
                 </div>
                 <div class="desc">
                   「3060双碳目标下,农业农村减排固碳既是重要举措,也是潜力所在」
@@ -225,6 +227,7 @@
                 <div class="title">
                   <p>北京工业大学教授、博导</p>
                   <p>中国环境科学学会环境工程分会副秘书长</p>
+                  <p>中国土木工程学会给水排水学会理事</p>
                 </div>
                 <div class="desc">
                   「水是气候变化的关键因素,水处理工艺的创新对实现碳中和目标至关重要」
@@ -240,6 +243,7 @@
                 <div class="title">
                   <p>哈尔滨工业大学教授、博导</p>
                   <p>中国生态学学会产业生态学专委会委员</p>
+                  <p>中国水协海绵城市建设专家委员会委员</p>
                 </div>
                 <div class="desc">
                   「污水厂低碳设计可以显著减排降耗,采用新型技术降低碳足迹,实现可持续发展」