guojy 1 year ago
parent
commit
038a291128

+ 5 - 0
package-lock.json

@@ -16578,6 +16578,11 @@
       "integrity": "sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==",
       "dev": true
     },
+    "weixin-js-sdk": {
+      "version": "1.6.5",
+      "resolved": "https://registry.npmmirror.com/weixin-js-sdk/-/weixin-js-sdk-1.6.5.tgz",
+      "integrity": "sha512-Gph1WAWB2YN/lMOFB/ymb+hbU/wYazzJgu6PMMktCy9cSCeW5wA6Zwt0dpahJbJ+RJEwtTv2x9iIu0U4enuVSQ=="
+    },
     "when": {
       "version": "3.6.4",
       "resolved": "https://registry.npmmirror.com/when/-/when-3.6.4.tgz",

+ 2 - 1
package.json

@@ -46,7 +46,8 @@
     "vue2-svg-icon": "^1.3.2",
     "vuex": "^3.3.0",
     "vuex-persistedstate": "^3.1.0",
-    "webpack-bundle-analyzer": "^4.4.2"
+    "webpack-bundle-analyzer": "^4.4.2",
+    "weixin-js-sdk": "^1.6.5"
   },
   "devDependencies": {
     "autoprefixer": "^7.1.2",

+ 0 - 1
src/App.vue

@@ -5,7 +5,6 @@
      </vc-keep-alive>
   </div>
 </template>
-
 <script>
   import Vue from 'vue';
   import FastClick from 'fastclick'

+ 0 - 3
src/main.js

@@ -50,9 +50,6 @@ Vue.prototype.$isWx = getIsWx()
 // true为APP打包,false为M端打包
 Vue.prototype.$isApp = true
 
-// setWxToken('eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOm51bGwsImlhdCI6MTcwMzU3MzQyMywiZXhwIjotMSwibmJmIjoxNzAzNTczNDIzLCJqdGkiOiJNS0wwQ1d2QW9IZjhGTnhjIiwic3ViIjoyOCwicHJ2IjoiY2E2NDg5ZDUwZjI0MDdhNjc4MzBlODA5MGQwMTQ4ODM1Njg1OTYyYiIsInJvbGUiOiJlbXBsb3llZSJ9.3tu6W0NaobTYKF_p0GxIDcSNbwFOqPr1vwXS0bO9lb0')
-// localStorage.setItem("wx_user_info",JSON.stringify({"account_id":31608,"nickname":"沐阳人","account":{"id":31608,"img_url":"","name":"雷阳","site_count_max":1,"tel":"15270803986","try_user":0,"account":""},"account_site":[{"id":24451,"account_id":31608,"site_id":14,"employee_id":35131,"create_time":"1709805792","update_time":"1709805792","delete_time":null,"site":{"id":14,"name":"广东功道云数字科技有限公司","status":1,"account_id":18,"expire_time":2067350399}}],"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOm51bGwsImlhdCI6MTcxMTA5MjAyNSwiZXhwIjotMSwibmJmIjoxNzExMDkyMDI1LCJqdGkiOiJIOExwaTdmTXpXRGVVTmNIIiwic3ViIjozMTYwOCwicHJ2IjoiOTNhMjEyMzNhMWE5ZDMxZmNkNjlmNzZhMjZhZTVkNzczMzU4NzgxNSIsInJvbGUiOiJwbGF0Zm9ybSJ9.q4z339k_Lb1YyLRNQFzSBXV3rvInExqTh6lM0CiguPQ","invitation_wait_count":0,"join_wait_count":0,"wo_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOm51bGwsImlhdCI6MTcxMTA5MjAyNSwiZXhwIjotMSwibmJmIjoxNzExMDkyMDI1LCJqdGkiOiI3cFRYclZhR0NwQW11eGNFIiwic3ViIjoxMTc3MCwicHJ2IjoiMDMwMGE1NDlhYjhmNzAyY2RhODMyMzFhNDEzMzJlY2NiZGU5ZGY4ZiIsInJvbGUiOiJ3ZWNoYXRfb3Blbl91c2VyIn0.iK5JQ5e2t8aGSK9CdIelDvOm47zUI4FtDM0oMr0FAtE"}))
-
 Vue.use(VueScroller)
 Vue.component('icon', icon)
 Vue.component('noData', noData)

+ 2 - 1
src/permission.js

@@ -3,7 +3,7 @@ import router from './router'
 import store from './store'
 import { getToken, getWxToken } from '@/utils/auth'
 //课程免登录名单
-const whiteList = ['/courseHome', '/courseLogin','/courseError','/courseAuth','/courseDeal', '/course/adlist', '/course/limitChange', '/course/courseManage', '/course/courseCreate', '/course/dealerManage']
+const whiteList = ['/courseHome', '/courseLogin','/courseUser','/courseError','/courseAuth','/courseDeal', '/course/adlist', '/course/limitChange', '/course/courseManage', '/course/courseCreate', '/course/dealerManage']
 const whiteList2 = ['/courseDeal/', '/courseDetail/','/courseTeam/', '/courseAdDetail/', '/course/limitChange/', '/course/transfer/', '/course/video/', '/course/dealOrder/']
 function filterWhite(path) {
   return whiteList2.some(item => {
@@ -53,6 +53,7 @@ router.beforeEach((to, from, next) => {
           }
         })
       }else{
+        // sessionStorage.setItem('cur_path',to.path)
         next({
           path:`/courseAuth`,
         })

+ 15 - 1
src/router/course.js

@@ -7,6 +7,13 @@
       label: '首页',
       need_login: true,
     },
+    {
+      path: '/courseUser',
+      name: 'courseUser',
+      component: () => import('@/view/course/user'),
+      label: '我的',
+      need_login: true,
+    },
     {
       path: '/courseAuth',
       name: 'courseAuth',
@@ -66,10 +73,17 @@
     {
       path: '/course/video/:id',
       name: 'courseVideo',
-      component: () => import('@/view/course/video/video'),
+      component: () => import('@/view/course/video/courseVideo'),
       label: '课程播放',
       need_login: false,
     },
+    {
+      path: '/freeCourse',
+      name: 'freeCourse',
+      component: () => import('@/view/course/video/freeVideo'),
+      label: '免费课程',
+      need_login: false,
+    },
     {
       path: '/courseLogin',
       name: 'courseLogin',

+ 53 - 0
src/view/course/api/index.js

@@ -16,6 +16,19 @@ export function getMobileYzm(data) {
         })
     })
 }
+//获取微信公众号信息
+export function getWxConfigInfo(data,appId='wx65f4dde5ec7c31e7') {
+    return new Promise((resolve, reject) => {
+        axiosKc('get', `/wx/mp/jsapi/wx65f4dde5ec7c31e7/config`,data).then((res) => {
+            if (res.data.code == 1) {
+                resolve(res.data.data)
+            } else {
+                Notify({ type: 'danger', message: data.message });
+                reject(res.data.message)
+            }
+        })
+    })
+}
 //wxid获取用户wxtoken
 export function getWxApiToken(wxId) {
     return new Promise((resolve, reject) => {
@@ -87,6 +100,32 @@ export function getDealerCourseList() {
         })
     })
 }
+//获取所有课程
+export function getUserAllCourseList(data) {
+    return new Promise((resolve, reject) => {
+        axiosKc('get', `/mkt/client/subject/list`,data).then((res) => {
+            if (res.data.code == 1) {
+                resolve(res.data.data)
+            } else {
+                Notify({ type: 'danger', message: data.message });
+                reject(res.data.message)
+            }
+        })
+    })
+}
+//获取免费课程
+export function getFreeCourseList() {
+    return new Promise((resolve, reject) => {
+        axiosKc('get', `/mkt/client/subject/free`).then((res) => {
+            if (res.data.code == 1) {
+                resolve(res.data.data)
+            } else {
+                Notify({ type: 'danger', message: data.message });
+                reject(res.data.message)
+            }
+        })
+    })
+}
 //获取经销商推广的指定课程
 export function getDealerCourseDetail(id) {
     return new Promise((resolve, reject) => {
@@ -282,4 +321,18 @@ export function getVideoSrc(data){
             }
         })
     })
+}
+//获取解析的免费视频地址
+export function getFreeVideoSrc(data){
+    return new Promise((resolve, reject) => {
+        axiosKc('post', `/mkt/client/${getWxUserId()}/subject/presign/free`,data).then((res) => {
+            if (res.data.code == 1) {
+                resolve(res.data.data)
+            } else {
+                Notify({ type: 'danger', message: data.message });
+                router.replace('/courseError')
+                reject(res.data.message)
+            }
+        })
+    })
 }

+ 8 - 3
src/view/course/components/courseList.vue

@@ -16,7 +16,7 @@
           <div class="listLiTit" v-if="item.toUserId && listType == 2">
             <p>
               {{ item.toUserId == user_info.id ? "收到" : "转出"
-              }}<span>【{{ item.dealAmount }}套</span>课程
+              }}<span>【{{ item.dealAmount }}套</span>课程
             </p>
           </div>
           <div
@@ -31,8 +31,9 @@
               </div>
               <div class="courseLiDesc">
                 <span v-if="showNum == 1">剩余{{ item.amount }}套</span>
+                <span v-else-if="showNum == 4">{{ item.clickNum }}次浏览</span>
                 <span v-else>共{{ item.sectionsNum }}节</span>
-                <span style="color: #F76146;">{{ item.subjectPrice }}</span>
+                <span style="color: #F76146;">{{ item.subjectPrice }}</span>
               </div>
             </div>
           </div>
@@ -137,6 +138,10 @@ export default {
         // this.$router.push({
         //   path: `/courseAdDetail/${item.subjectId}`
         // });
+      }else if(this.showNum == 4 ){
+        this.$router.push({
+          path: `/courseDetail/${item.subjectId}`
+        });
       }else if(item.status == 1 && this.listType == 2){
         this.comfirm(item)
       }
@@ -239,7 +244,7 @@ export default {
         }
         .liInfo {
           flex: 1;
-          margin-left: 0.35rem;
+          margin-left: 0.15rem;
           display: flex;
           flex-direction: column;
           justify-content: space-between;

+ 1 - 0
src/view/course/deal/dealOrder.vue

@@ -162,6 +162,7 @@ export default {
 };
 </script>
 <style scoped lang="scss">
+@import url('../utils/navBar.scss');
 .page {
   background: #F3F2EE;
   background: linear-gradient(90deg, #F3F2EE, #E7EFF9);

+ 1 - 0
src/view/course/deal/limitRecord.vue

@@ -96,6 +96,7 @@ export default {
 };
 </script>
 <style scoped lang="scss">
+@import url('../utils/navBar.scss');
 *{
   margin: 0;
   padding: 0;

+ 1 - 0
src/view/course/deal/transfer.vue

@@ -158,6 +158,7 @@ export default {
 };
 </script>
 <style scoped lang="scss">
+@import url('../utils/navBar.scss');
 * {
   margin: 0;
   padding: 0;

+ 170 - 481
src/view/course/home.vue

@@ -1,545 +1,234 @@
 <template>
-  <div class="curPage">
-    <div class="userInfo">
-      <van-row
-        type="flex"
-        class="imageName"
-        justify="space-between"
-        align="center"
-      >
-        <div class="userImage">
-          <userImage
-            class="about-me__avatar"
-            :img_url="user_info.imgUrl"
-            :user_name="user_info.name"
-            width="1.12rem"
-            height="1.12rem"
-            v-if="user_info.imgUrl"
-          ></userImage>
-          <div style="background: #26A2FF;border-radius: 50%;overflow: hidden;" v-else>
-            <userImage
-              class="about-me__avatar"
-              :img_url="defaultImgUrl"
-              user_name="用户"
-              width="1.12rem"
-              height="1.12rem"
-            ></userImage>
-          </div>
-          <div class="info">
-            <span
-              >{{ user_info.name ? user_info.name : "新用户"
-              }}<van-icon
-                name="notes-o"
-                color="#E1B98B"
-                style="margin-left: .1rem;"
-            /></span>
-            <!-- <p>手机:{{ user_info.tel }}</p> -->
-            <!-- <p
-              class="userId"
-              :aria-label="user_info.id"
-              @click="copyLink('.userId')"
-            >
-              <i class="courseIcon icon-fuzhi"></i>复制身份ID
-            </p> -->
-          </div>
-        </div>
-        <div class="user_leave">
-          <van-icon name="gem-o" color="#a66666" />
-          {{ user_info.marketable ? "经销商" : "学员" }}
-        </div>
-      </van-row>
-    </div>
-    <div class="user_tabs" v-if="user_info.marketable">
-      <div class="tabs_content">
-        <div class="tabsLi" @click="toUrl('/courseTeam/1')">
-          <van-image
-            src="static/images/course_team.png"
-            style="width: .8rem;height: .8rem;"
-            type="contain"
-          />
-          <span>我的团队</span>
-        </div>
-        <div class="tabsLi" @click="qropen">
-          <van-image
-            src="static/images/course_ewm.png"
-            style="width: .8rem;height: .8rem;"
-            type="contain"
-          />
-          <span>邀请二维码</span>
+  <div class="homePage">
+    <div class="homeContent">
+      <scroller 
+      :isInitRefresh="false" 
+      ref="recordScroller"
+      :list="courseList"
+      noDataText="没有更多..."
+      :on-refresh='resetList'
+      :on-infinite="getMoreList">
+        <div class="tit" style="margin-top: .3rem;">
+          <span>今日更新</span>
         </div>
-        <div class="tabsLi" @click="toUrl('/courseTeam/2')">
-          <van-image
-            src="static/images/course_dingdan.png"
-            style="width: .8rem;height: .8rem;"
-            type="contain"
-          />
-          <span>交易往来</span>
-        </div>
-      </div>
-    </div>
-    <div class="user_course_tabs" v-if='user_info.marketable'>
-      <van-tabs v-model="tbsIndex" style="width: 60%;">
-        <van-tab title="我的推广"></van-tab>
-        <van-tab title="我的学习"></van-tab>
-      </van-tabs>
-      <!-- <div class="tbsL" v-if='user_info.marketable'>
-        <div class="tbsi" :class="{active:tbsIndex==0}" @click="selectTbs(0)">我的推广</div>
-        <div class="tbsi" :class="{active:tbsIndex==1}" @click="selectTbs(1)">我的学习</div>
-      </div> -->
-      <div class="tbsR" v-if="user_info.marketable" @click="toMoreUrl">
-        <span>名额变动明细<van-icon name="arrow" /></span>
-      </div>
-    </div>
-    <!-- <van-search
-      v-model="wxId"
-      placeholder="请输入wxid替换当前账号"
-      show-action
-      style="margin: 0.1rem 0.2rem 0;border-radius: 0.1rem;"
-      @search="changeUSer"
-    /> -->
-    <div
-      class="courScroll"
-      :style="{
-        height: user_info.marketable
-          ? 'calc(100vh - 4.38rem) !important'
-          : 'calc(-2.05rem + 100vh) !important'
-      }"
-    >
-      <scroller ref="scroller" :isInitRefresh="false">
-        <van-loading
-          v-show="showLoad"
-          style="margin: 0px auto;position: relative;left: 50%;transform: translateX(-0.25rem);"
-        />
-        <div
-          class="myCourseList"
-          v-if="user_info.marketable && tbsIndex == 0 && !showLoad"
-        >
-          <courseList
-            :dataList="courseClass.proCourse.courseList"
-            :showNum="1"
-            :fixedTitle="courseClass.proCourse.title"
-          ></courseList>
+        <div class="freeContent">
+          <div class="freeLi" v-for="(item,index) in freeCourseList" :key="index" @click="toUrl(item)">
+            <div class="liIcon">
+              <van-icon name="play-circle-o" />
+            </div>
+            <div class="freeR">
+              <p>{{ item.name }}</p>
+              <span>{{ Math.floor(Math.random()*100) }}人浏览</span>
+            </div>
+          </div>
         </div>
-        <div class="myCourseList" v-if="tbsIndex == 1 && !showLoad">
-          <courseList
-            :dataList="courseClass.learnCourse.courseList"
-            :fixedTitle="courseClass.learnCourse.title"
-            isNoAd
-          ></courseList>
+        <div class="tit">
+          <span>课程推荐</span>
         </div>
+        <courseList :dataList="courseList" :showNum="4"></courseList>
       </scroller>
+      <van-tabbar v-model="active" @change="activeChange">
+        <van-tabbar-item icon="home-o">首页</van-tabbar-item>
+        <van-tabbar-item icon="friends-o">我的</van-tabbar-item>
+      </van-tabbar>
     </div>
-    <van-overlay :show="qrVisible" @click="qrVisible = false">
-      <div class="wrapper">
-        <div class="qrContent">
-          <div class="tit">
-            邀请二维码
-          </div>
-          <div class="qrcode-wrap" ref="qrCodeUrl"></div>
-          <div class="btm">
-            <p>邀请朋友成为经销商,并加入你的团队</p>
-          </div>
-        </div>
-      </div>
-    </van-overlay>
   </div>
 </template>
 
 <script>
-import Clipboard from "clipboard";
-import QRCode from "qrcodejs2";
+import { getUserAllCourseList ,getFreeCourseList} from "./api";
 import courseList from "./components/courseList.vue";
 import {setDocumentTitle} from '../../components/vueHashCalendar/utils/util'
-import {isWeChatMobile,isWeChatPC,isWeChat} from './utils'
-import {
-  getWxApiToken,
-  getUSerInfo,
-  getDealerCourseList,
-  getUserCourseList
-} from "./api";
+import {setWxConfig} from './utils'
 export default {
-  name: "courseHome",
+  name: "",
   components: {
     courseList
   },
   data() {
     return {
-      defaultImgUrl:require('../../assets/images/courseUser.png'),
-      showLoad: false,
-      tbsIndex: 0,
-      clipboard: null,
-      qrVisible: false,
-      qrcode: null,
-      qrcodeStatus: false,
-      isAndroid: this.$getCache("isAndroid"),
-      user_info: {
-        imgUrl: "",
-        id: "0",
-        name: "用户名",
-        mobile: "0",
-        marketable: false
-      },
+      active:0,
+      canReq: true,
+      noDate: false,
       page: {
         cur: 1,
         size: 10,
         total: 0
       },
-      courseClass: {
-        proCourse: {
-          title: "我推广的课程",
-          total: 0,
-          courseList: []
-        },
-        learnCourse: {
-          title: "我学习的课程",
-          total: 0,
-          courseList: []
-        }
-      },
-      wxId: "11770"
+      courseList: [],
+      freeCourseList:[]
     };
   },
   created() {
+    setDocumentTitle('首页')
     this.init();
-    console.log(isWeChat()?isWeChatMobile()?'手机微信':isWeChatPC()?'电脑微信':'无法判断':'不是微信')
-  },
-  watch: {
-    $route(to) {
-      if (to.path == "/courseHome") {
-        this.init();
-      }
+    if(this.$isWx){
+      setWxConfig().then(() => {
+        wx.ready(() => {
+          console.log("微信配置成功");
+          wx.updateAppMessageShareData({
+            title: "公道云课程", // 分享标题
+            desc: "点击查看课程", // 分享描述
+            link: window.location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
+            imgUrl: logo, // 分享图标
+            success: function () {
+              // 设置成功
+              console.log("分享成功");
+              // this.$toast.success('')
+            },
+          });
+        });
+      });
     }
   },
   methods: {
-    // 推广/学习标签切换
-    selectTbs(i) {
-      if (this.user_info.marketable) {
-        if (i == 0 && this.tbsIndex != 0) {
-          this.tbsIndex = 0;
-          this.showLoad = true;
-          setTimeout(() => {
-            this.getDealerCourseList();
-          }, 1000);
-        } else if (i == 1 && this.tbsIndex != 1) {
-          this.tbsIndex = 1;
-          this.showLoad = true;
-          setTimeout(() => {
-            this.getUserCourseList();
-          }, 1000);
-        }
-      }
+    //跳转免费课程
+    toUrl(item){
+      this.$router.push({
+        path:`/freeCourse`,
+        query:item
+      })
     },
-    //查看名额变动明细
-    toMoreUrl() {
-      // this.$router.push(`/course/adlist`);
-      this.$router.push(`/course/limitChange`);
+    // 触底加载
+    getMoreList(done) {
+      if (!this.noDate) {
+        setTimeout(() => {
+          this.getList(done);
+        }, 300);
+      } else {
+        this.$refs.recordScroller.finishInfinite(true);
+      }
     },
-    // 清楚本地存储/测试用
-    changeUSer() {
-      localStorage.clear();
-      this.getUerInfo(this.wxId);
+    //上拉刷新
+    resetList(done){
+      this.page.cur = 1;
+      this.getList(done,1)
     },
-    // 获取指定用户信息/测试用
-    getUerInfo(wxid) {
-      getWxApiToken(wxid).then(token => {
-        getUSerInfo(token).then(res => {
-          this.user_info = JSON.parse(localStorage.getItem("wx_user_info"));
-          if (this.user_info.marketable) {
-            getDealerCourseList();
-          } else if (!this.user_info.marketable) {
-            this.tbsIndex = 1;
-          }
-          getUserCourseList();
-        });
-      });
+    //底部导航变化
+    activeChange(){
+      if(this.active != 0){
+        this.$router.push('/courseUser')
+        this.active = 0
+      }
     },
-    //获取用户数据
+    // 初始化
     init() {
-      setDocumentTitle('首页')
-      this.user_info = JSON.parse(localStorage.getItem("wx_user_info"));
-      if (this.user_info.marketable) {
-        this.getDealerCourseList();
-      } else if (!this.user_info.marketable) {
-        this.tbsIndex = 1;
-      }
-      this.getUserCourseList();
+      this.getList();
+      this.getFreeList();
     },
-    //获取经销推广课程列表
-    getDealerCourseList(done) {
-      getDealerCourseList().then(res => {
-        this.courseClass.proCourse.total = res.total;
-        this.courseClass.proCourse.courseList = res.list;
-        this.showLoad = false;
-        if (done) done();
-      });
+    // 获取免费课程列表
+    getFreeList(){
+      getFreeCourseList().then(res=>{
+        this.freeCourseList = res.sections
+      })
     },
-    //获取用户消费的课程列表
-    getUserCourseList(done) {
-      getUserCourseList().then(res => {
-        this.courseClass.learnCourse.total = res.total;
-        let list = [];
+    // 获取所有课程列表
+    getList(done,type) {
+      let data = {
+        page: this.page.cur,
+        pageSize: this.page.size,
+        enable: 1
+      };
+      getUserAllCourseList(data).then(res => {
+        let list = []
         res.list.forEach(item => {
           let data = {
-            subjectName: item.name,
-            subjectId: item.id,
-            subjectPrice: item.price,
-            subjectThumb: item.thumb,
-            subjectEnable: item.enable,
-            sectionsNum: item.sectionsNum
-          };
-          list.push(data);
-        });
-        this.courseClass.learnCourse.courseList = list;
-        this.showLoad = false;
-        if (done) done();
-      });
-    },
-    // 打开二维码
-    qropen() {
-      this.qrVisible = true;
-      this.$nextTick(() => {
-        this.creatQrCode();
-      });
-    },
-    // 创建二维码
-    creatQrCode() {
-      if (!this.qrcodeStatus) {
-        console.log(
-          `${window.location.href.split("#")[0]}#/courseLogin?pid=${
-            JSON.parse(localStorage.getItem("wx_user_info")).id
-          }`
-        );
-        this.qrcode = new QRCode(this.$refs.qrCodeUrl, {
-          text: `${window.location.href.split("#")[0]}#/courseLogin?pid=${
-            JSON.parse(localStorage.getItem("wx_user_info")).id
-          }`, // 需要转换为二维码的内容
-          width: 200,
-          height: 200,
-          colorDark: "#000000",
-          colorLight: "#ffffff",
-          correctLevel: QRCode.CorrectLevel.H
+              subjectName: item.name,
+              subjectId: item.id,
+              subjectPrice: item.price,
+              subjectThumb: item.thumb,
+              subjectEnable: item.enable,
+              sectionsNum: item.sectionsNum,
+              clickNum:Number(item.baseClick) + Number(item.clickNum)
+            };
+            list.push(data);
         });
-        this.qrcodeStatus = true;
-      }
-    },
-    //复制剪切板
-    copyLink(event) {
-      let that = this;
-      //这里是复制目标的类名
-      that.clipboard = new Clipboard(event, {
-        text: function(trigger) {
-          return trigger.getAttribute("aria-label");
+        if(type == 1){
+          this.courseList = list;
+        }else{
+          this.courseList = this.courseList.concat(list);
+        }
+        this.page.total = res.total;
+        this.page.cur = res.current;
+        if (res.pages == res.current || res.pages == 0) {
+          if (done) done(true);
+          this.noDate = true;
+        } else {
+          if (done) done();
+          this.page.cur++; //下拉一次页数+1
+          this.noDate = false;
         }
-      });
-      console.log(that.clipboard)
-      that.clipboard.on("success", function(e) {
-        e.clearSelection(); //清除选中的文字的选择状态
-        that.$toast.success("ID复制成功~");
-      });
-
-      that.clipboard.on("error", function(e) {
-        console.error(e);
       });
     },
-    //跳转内页
-    toUrl(url, params) {
-      this.$router.push({
-        path: url
-      });
-    }
   }
 };
 </script>
 <style scoped lang="scss">
-@import "../../assets/iconfont.css";
-* {
+*{
   margin: 0;
   padding: 0;
 }
-img {
-  display: block;
-}
-.curPage {
-  height: 100%;
-  position: relative !important;
-  padding-top: 0.4rem;
+.homePage {
   background: #f3f2ee;
   background: linear-gradient(90deg, #f3f2ee, #e7eff9);
-  .userInfo {
-    padding: 0.24rem 0.32rem 0.12rem;
-    .userImage {
+  .homeContent {
+    height: calc(100vh - 1rem);
+    margin: 0 .2rem;
+    box-sizing: border-box;
+    position: relative;
+    .tit{
       display: flex;
-      align-items: center;
-      flex: 1;
-      .info {
-        display: flex;
-        flex-direction: column;
-        justify-content: center;
-        margin-left: 0.2rem;
-        span {
-          font-size: 0.32rem;
-          font-weight: 600;
-          color: #000;
-          line-height: 2;
-          display: block;
-        }
-        p {
-          font-size: 0.22rem;
-          color: #222;
-          line-height: 1;
-          display: block;
-          i {
-            font-size: 0.22rem;
-            color: #222;
-            line-height: 1;
-          }
-        }
+      span{
+        font-size: .32rem;
+        color: #000;
+        font-weight: 600;
+        line-height: .6rem;
       }
     }
-    .user_leave {
-      padding: 0.05rem 0.3rem;
-      font-size: 0.26rem;
-      font-weight: 550;
-      color: #a66666;
-      border: 1px solid #c9c3c0;
-      border-radius: 0.1rem;
-      line-height: 1.5;
-    }
-  }
-  .user_tabs {
-    padding: 0 0.2rem;
-    margin-top: 0.15rem;
-    .tabs_content {
-      box-sizing: border-box;
-      height: 1.5rem;
-      padding: 0.1rem 0;
-      display: flex;
-      justify-content: space-around;
-      border-radius: 0.1rem;
-      background: #fff;
-      .tabsLi {
-        // flex: 1;
+    .freeContent{
+      margin-bottom: .3rem;
+      .freeLi{
+        background-color: #FFF;
         display: flex;
-        flex-direction: column;
-        justify-content: center;
+        justify-content: space-between;
         align-items: center;
-        span {
-          font-size: 0.24rem;
-          color: #333;
-          line-height: 0.3rem;
-        }
-      }
-    }
-  }
-  .user_course_tabs {
-    margin: 0.15rem 0.2rem 0;
-    display: flex;
-    justify-content: space-between;
-    align-items: center;
-    background-color: #fff;
-    border-radius: .1rem;
-    overflow: hidden;
-    .ctbsL {
-      width: 2rem;
-      display: flex;
-      align-items: center;
-    }
-    .tbsL {
-      width: 60%;
-      display: flex;
-      align-items: center;
-      .tbsi {
-        padding: 0 0.15rem;
-        border-radius: 0.25rem;
-        border: 0.02rem solid #999;
-        font-size: 0.24rem;
-        color: #444;
-        line-height: 0.4rem;
-        text-align: center;
-        margin-right: 0.2rem;
-        &.active {
-          border: 1px solid rgb(22, 132, 252);
-          background-color: rgba(38, 162, 255, 0.1);
-          color: rgb(22, 132, 252);
+        border-radius: 0.1rem;
+        margin-bottom: 0.1rem;
+        padding: 0.15rem;
+        .liIcon{
+          background: #DBECFE;
+          width: .8rem;
+          height: .8rem;
+          display: flex;
+          justify-content: center;
+          align-items: center;
+          border-radius: .1rem;
+          i{
+            font-size: .62rem;
+            color:#609DFF;
+          }
         }
-      }
-    }
-    .tbsR {
-      display: flex;
-      align-items: center;
-      margin-right: .2rem;
-      span {
-        font-size: 0.24rem;
-        color: #333;
-        line-height: 0.4rem;
-      }
-    }
-  }
-  .courScroll {
-    height: calc(100vh - 2.75rem) !important;
-    position: relative;
-    .cScroll {
-      height: 100%;
-      position: relative !important;
-    }
-    .myCourseList {
-      &:nth-child(2) {
-        padding-bottom: 0.4rem;
-      }
-      padding: 0 0.2rem;
-      // margin-top: 0.2rem;
-    }
-  }
-  .wrapper {
-    display: flex;
-    justify-content: center;
-    align-items: center;
-    height: 100vh;
-    .qrContent {
-      width: 70%;
-      border-radius: 0.2rem;
-      overflow: hidden;
-      background-color: #FFF;
-      .btm{
-        font-size: .23rem;
-        color: #666;
-        line-height: .6rem;
-        text-align: center;
-        border: 0;
-      }
-      .tit {
-        position: relative;
-        width: 100%;
-        text-align: center;
-        font-size: 0.3rem;
-        color: #333;
-        line-height: 0.8rem;
-        &::after {
-          content: "X";
-          position: absolute;
-          right: 0.2rem;
-          top: 0.2rem;
-          font-size: 0.3rem;
-          line-height: 0.3rem;
+        .freeR{
+          flex: 1;
+          margin-left: .2rem;
+          width: calc(100% - 1.2rem);
+          p{
+            font-size: .3rem;
+            color: #333;
+            line-height: .35rem;
+            text-overflow: ellipsis;
+            overflow: hidden;
+            word-break: break-all;
+            white-space: nowrap;
+          }
+          span{
+            font-size: .22rem;
+            color: #999;
+            line-height: .3rem;
+          }
         }
       }
-      .qrcode-wrap {
-        padding: 0.2rem .2rem 0;
-        background-color: #fff;
-        text-align: center;
-        display: flex;
-        justify-content: center;
-      }
     }
   }
 }
-/deep/ .van-search .van-cell {
-  padding: 0.1rem 0.16rem 0.1rem 0.16rem;
-}
-/deep/ .van-tabs--line .van-tabs__wrap{
-  height: .68rem;
-}
-/deep/ .van-tab--active{
-  font-weight: 600;
-}
 </style>

+ 552 - 0
src/view/course/user.vue

@@ -0,0 +1,552 @@
+<template>
+    <div class="curPage">
+      <div class="userInfo">
+        <van-row
+          type="flex"
+          class="imageName"
+          justify="space-between"
+          align="center"
+        >
+          <div class="userImage">
+            <userImage
+              class="about-me__avatar"
+              :img_url="user_info.imgUrl"
+              :user_name="user_info.name"
+              width="1.12rem"
+              height="1.12rem"
+              v-if="user_info.imgUrl"
+            ></userImage>
+            <div style="background: #26A2FF;border-radius: 50%;overflow: hidden;" v-else>
+              <userImage
+                class="about-me__avatar"
+                :img_url="defaultImgUrl"
+                user_name="用户"
+                width="1.12rem"
+                height="1.12rem"
+              ></userImage>
+            </div>
+            <div class="info">
+              <span
+                >{{ user_info.name ? user_info.name : "新用户"
+                }}<van-icon
+                  name="notes-o"
+                  color="#E1B98B"
+                  style="margin-left: .1rem;"
+              /></span>
+              <!-- <p>手机:{{ user_info.tel }}</p> -->
+              <!-- <p
+                class="userId"
+                :aria-label="user_info.id"
+                @click="copyLink('.userId')"
+              >
+                <i class="courseIcon icon-fuzhi"></i>复制身份ID
+              </p> -->
+            </div>
+          </div>
+          <div class="user_leave">
+            <van-icon name="gem-o" color="#a66666" />
+            {{ user_info.marketable ? "经销商" : "学员" }}
+          </div>
+        </van-row>
+      </div>
+      <div class="user_tabs" v-if="user_info.marketable">
+        <div class="tabs_content">
+          <div class="tabsLi" @click="toUrl('/courseTeam/1')">
+            <van-image
+              src="static/images/course_team.png"
+              style="width: .8rem;height: .8rem;"
+              type="contain"
+            />
+            <span>我的团队</span>
+          </div>
+          <div class="tabsLi" @click="qropen">
+            <van-image
+              src="static/images/course_ewm.png"
+              style="width: .8rem;height: .8rem;"
+              type="contain"
+            />
+            <span>邀请二维码</span>
+          </div>
+          <div class="tabsLi" @click="toUrl('/courseTeam/2')">
+            <van-image
+              src="static/images/course_dingdan.png"
+              style="width: .8rem;height: .8rem;"
+              type="contain"
+            />
+            <span>交易往来</span>
+          </div>
+        </div>
+      </div>
+      <div class="user_course_tabs" v-if='user_info.marketable'>
+        <van-tabs v-model="tbsIndex" style="width: 60%;">
+          <van-tab title="我的推广"></van-tab>
+          <van-tab title="我的学习"></van-tab>
+        </van-tabs>
+        <!-- <div class="tbsL" v-if='user_info.marketable'>
+          <div class="tbsi" :class="{active:tbsIndex==0}" @click="selectTbs(0)">我的推广</div>
+          <div class="tbsi" :class="{active:tbsIndex==1}" @click="selectTbs(1)">我的学习</div>
+        </div> -->
+        <div class="tbsR" v-if="user_info.marketable" @click="toMoreUrl">
+          <span>名额变动明细<van-icon name="arrow" /></span>
+        </div>
+      </div>
+      <!-- <van-search
+        v-model="wxId"
+        placeholder="请输入wxid替换当前账号"
+        show-action
+        style="margin: 0.1rem 0.2rem 0;border-radius: 0.1rem;"
+        @search="changeUSer"
+      /> -->
+      <div
+        class="courScroll"
+        :style="{
+          height: user_info.marketable
+            ? 'calc(100vh - 5.38rem) !important'
+            : 'calc(-3.05rem + 100vh) !important'
+        }"
+      >
+        <scroller ref="scroller" :isInitRefresh="false">
+          <van-loading
+            v-show="showLoad"
+            style="margin: 0px auto;position: relative;left: 50%;transform: translateX(-0.25rem);"
+          />
+          <div
+            class="myCourseList"
+            v-if="user_info.marketable && tbsIndex == 0 && !showLoad"
+          >
+            <courseList
+              :dataList="courseClass.proCourse.courseList"
+              :showNum="1"
+              :fixedTitle="courseClass.proCourse.title"
+            ></courseList>
+          </div>
+          <div class="myCourseList" v-if="tbsIndex == 1 && !showLoad">
+            <courseList
+              :dataList="courseClass.learnCourse.courseList"
+              :fixedTitle="courseClass.learnCourse.title"
+              isNoAd
+            ></courseList>
+          </div>
+        </scroller>
+        <van-tabbar v-model="active" @change="activeChange">
+            <van-tabbar-item icon="home-o">首页</van-tabbar-item>
+            <van-tabbar-item icon="friends-o">我的</van-tabbar-item>
+        </van-tabbar>
+      </div>
+      <van-overlay :show="qrVisible" @click="qrVisible = false">
+        <div class="wrapper">
+          <div class="qrContent">
+            <div class="tit">
+              邀请二维码
+            </div>
+            <div class="qrcode-wrap" ref="qrCodeUrl"></div>
+            <div class="btm">
+              <p>邀请朋友成为经销商,并加入你的团队</p>
+            </div>
+          </div>
+        </div>
+      </van-overlay>
+    </div>
+  </template>
+  
+  <script>
+  import Clipboard from "clipboard";
+  import QRCode from "qrcodejs2";
+  import courseList from "./components/courseList.vue";
+  import {setDocumentTitle} from '../../components/vueHashCalendar/utils/util'
+  import {isWeChatMobile,isWeChatPC,isWeChat} from './utils'
+  import {
+    getWxApiToken,
+    getUSerInfo,
+    getDealerCourseList,
+    getUserCourseList
+  } from "./api";
+  export default {
+    name: "courseHome",
+    components: {
+      courseList
+    },
+    data() {
+      return {
+        active:1,
+        defaultImgUrl:require('../../assets/images/courseUser.png'),
+        showLoad: false,
+        tbsIndex: 0,
+        clipboard: null,
+        qrVisible: false,
+        qrcode: null,
+        qrcodeStatus: false,
+        isAndroid: this.$getCache("isAndroid"),
+        user_info: {
+          imgUrl: "",
+          id: "0",
+          name: "用户名",
+          mobile: "0",
+          marketable: false
+        },
+        page: {
+          cur: 1,
+          size: 10,
+          total: 0
+        },
+        courseClass: {
+          proCourse: {
+            title: "我推广的课程",
+            total: 0,
+            courseList: []
+          },
+          learnCourse: {
+            title: "我学习的课程",
+            total: 0,
+            courseList: []
+          }
+        },
+        wxId: "11770"
+      };
+    },
+    created() {
+      this.init();
+      console.log(isWeChat()?isWeChatMobile()?'手机微信':isWeChatPC()?'电脑微信':'无法判断':'不是微信')
+    },
+    watch: {
+      $route(to) {
+        if (to.path == "/courseUser") {
+          this.init();
+        }
+      }
+    },
+    methods: {
+        //底部导航变化
+        activeChange(){
+            if(this.active != 1){
+                this.$router.push('/courseHome');
+                this.active = 1;
+            }
+        },
+      // 推广/学习标签切换
+      selectTbs(i) {
+        if (this.user_info.marketable) {
+          if (i == 0 && this.tbsIndex != 0) {
+            this.tbsIndex = 0;
+            this.showLoad = true;
+            setTimeout(() => {
+              this.getDealerCourseList();
+            }, 1000);
+          } else if (i == 1 && this.tbsIndex != 1) {
+            this.tbsIndex = 1;
+            this.showLoad = true;
+            setTimeout(() => {
+              this.getUserCourseList();
+            }, 1000);
+          }
+        }
+      },
+      //查看名额变动明细
+      toMoreUrl() {
+        // this.$router.push(`/course/adlist`);
+        this.$router.push(`/course/limitChange`);
+      },
+      // 清楚本地存储/测试用
+      changeUSer() {
+        localStorage.clear();
+        this.getUerInfo(this.wxId);
+      },
+      // 获取指定用户信息/测试用
+      getUerInfo(wxid) {
+        getWxApiToken(wxid).then(token => {
+          getUSerInfo(token).then(res => {
+            this.user_info = JSON.parse(localStorage.getItem("wx_user_info"));
+            if (this.user_info.marketable) {
+              getDealerCourseList();
+            } else if (!this.user_info.marketable) {
+              this.tbsIndex = 1;
+            }
+            getUserCourseList();
+          });
+        });
+      },
+      //获取用户数据
+      init() {
+        setDocumentTitle('首页')
+        this.user_info = JSON.parse(localStorage.getItem("wx_user_info"));
+        if (this.user_info.marketable) {
+          this.getDealerCourseList();
+        } else if (!this.user_info.marketable) {
+          this.tbsIndex = 1;
+        }
+        this.getUserCourseList();
+      },
+      //获取经销推广课程列表
+      getDealerCourseList(done) {
+        getDealerCourseList().then(res => {
+          this.courseClass.proCourse.total = res.total;
+          this.courseClass.proCourse.courseList = res.list;
+          this.showLoad = false;
+          if (done) done();
+        });
+      },
+      //获取用户消费的课程列表
+      getUserCourseList(done) {
+        getUserCourseList().then(res => {
+          this.courseClass.learnCourse.total = res.total;
+          let list = [];
+          res.list.forEach(item => {
+            let data = {
+              subjectName: item.name,
+              subjectId: item.id,
+              subjectPrice: item.price,
+              subjectThumb: item.thumb,
+              subjectEnable: item.enable,
+              sectionsNum: item.sectionsNum
+            };
+            list.push(data);
+          });
+          this.courseClass.learnCourse.courseList = list;
+          this.showLoad = false;
+          if (done) done();
+        });
+      },
+      // 打开二维码
+      qropen() {
+        this.qrVisible = true;
+        this.$nextTick(() => {
+          this.creatQrCode();
+        });
+      },
+      // 创建二维码
+      creatQrCode() {
+        if (!this.qrcodeStatus) {
+          this.qrcode = new QRCode(this.$refs.qrCodeUrl, {
+            text: `${window.location.href.split("#")[0]}#/courseLogin?pid=${
+              JSON.parse(localStorage.getItem("wx_user_info")).id
+            }`, // 需要转换为二维码的内容
+            width: 200,
+            height: 200,
+            colorDark: "#000000",
+            colorLight: "#ffffff",
+            correctLevel: QRCode.CorrectLevel.H
+          });
+          this.qrcodeStatus = true;
+        }
+      },
+      //复制剪切板
+      copyLink(event) {
+        let that = this;
+        //这里是复制目标的类名
+        that.clipboard = new Clipboard(event, {
+          text: function(trigger) {
+            return trigger.getAttribute("aria-label");
+          }
+        });
+        that.clipboard.on("success", function(e) {
+          e.clearSelection(); //清除选中的文字的选择状态
+          that.$toast.success("ID复制成功~");
+        });
+  
+        that.clipboard.on("error", function(e) {
+          console.error(e);
+        });
+      },
+      //跳转内页
+      toUrl(url, params) {
+        this.$router.push({
+          path: url
+        });
+      }
+    }
+  };
+  </script>
+  <style scoped lang="scss">
+  @import "../../assets/iconfont.css";
+  * {
+    margin: 0;
+    padding: 0;
+  }
+  img {
+    display: block;
+  }
+  .curPage {
+    height: 100%;
+    position: relative !important;
+    padding-top: 0.4rem;
+    background: #f3f2ee;
+    background: linear-gradient(90deg, #f3f2ee, #e7eff9);
+    .userInfo {
+      padding: 0.24rem 0.32rem 0.12rem;
+      .userImage {
+        display: flex;
+        align-items: center;
+        flex: 1;
+        .info {
+          display: flex;
+          flex-direction: column;
+          justify-content: center;
+          margin-left: 0.2rem;
+          span {
+            font-size: 0.32rem;
+            font-weight: 600;
+            color: #000;
+            line-height: 2;
+            display: block;
+          }
+          p {
+            font-size: 0.22rem;
+            color: #222;
+            line-height: 1;
+            display: block;
+            i {
+              font-size: 0.22rem;
+              color: #222;
+              line-height: 1;
+            }
+          }
+        }
+      }
+      .user_leave {
+        padding: 0.05rem 0.3rem;
+        font-size: 0.26rem;
+        font-weight: 550;
+        color: #a66666;
+        border: 1px solid #c9c3c0;
+        border-radius: 0.1rem;
+        line-height: 1.5;
+      }
+    }
+    .user_tabs {
+      padding: 0 0.2rem;
+      margin-top: 0.15rem;
+      .tabs_content {
+        box-sizing: border-box;
+        height: 1.5rem;
+        padding: 0.1rem 0;
+        display: flex;
+        justify-content: space-around;
+        border-radius: 0.1rem;
+        background: #fff;
+        .tabsLi {
+          // flex: 1;
+          display: flex;
+          flex-direction: column;
+          justify-content: center;
+          align-items: center;
+          span {
+            font-size: 0.24rem;
+            color: #333;
+            line-height: 0.3rem;
+          }
+        }
+      }
+    }
+    .user_course_tabs {
+      margin: 0.15rem 0.2rem 0;
+      display: flex;
+      justify-content: space-between;
+      align-items: center;
+      background-color: #fff;
+      border-radius: .1rem;
+      overflow: hidden;
+      .ctbsL {
+        width: 2rem;
+        display: flex;
+        align-items: center;
+      }
+      .tbsL {
+        width: 60%;
+        display: flex;
+        align-items: center;
+        .tbsi {
+          padding: 0 0.15rem;
+          border-radius: 0.25rem;
+          border: 0.02rem solid #999;
+          font-size: 0.24rem;
+          color: #444;
+          line-height: 0.4rem;
+          text-align: center;
+          margin-right: 0.2rem;
+          &.active {
+            border: 1px solid rgb(22, 132, 252);
+            background-color: rgba(38, 162, 255, 0.1);
+            color: rgb(22, 132, 252);
+          }
+        }
+      }
+      .tbsR {
+        display: flex;
+        align-items: center;
+        margin-right: .2rem;
+        span {
+          font-size: 0.24rem;
+          color: #333;
+          line-height: 0.4rem;
+        }
+      }
+    }
+    .courScroll {
+      height: calc(100vh - 2.75rem) !important;
+      position: relative;
+      .cScroll {
+        height: 100%;
+        position: relative !important;
+      }
+      .myCourseList {
+        &:nth-child(2) {
+          padding-bottom: 0.4rem;
+        }
+        padding: 0 0.2rem;
+        // margin-top: 0.2rem;
+      }
+    }
+    .wrapper {
+      display: flex;
+      justify-content: center;
+      align-items: center;
+      height: 100vh;
+      .qrContent {
+        width: 70%;
+        border-radius: 0.2rem;
+        overflow: hidden;
+        background-color: #FFF;
+        .btm{
+          font-size: .23rem;
+          color: #666;
+          line-height: .6rem;
+          text-align: center;
+          border: 0;
+        }
+        .tit {
+          position: relative;
+          width: 100%;
+          text-align: center;
+          font-size: 0.3rem;
+          color: #333;
+          line-height: 0.8rem;
+          &::after {
+            content: "X";
+            position: absolute;
+            right: 0.2rem;
+            top: 0.2rem;
+            font-size: 0.3rem;
+            line-height: 0.3rem;
+          }
+        }
+        .qrcode-wrap {
+          padding: 0.2rem .2rem 0;
+          background-color: #fff;
+          text-align: center;
+          display: flex;
+          justify-content: center;
+        }
+      }
+    }
+  }
+  /deep/ .van-search .van-cell {
+    padding: 0.1rem 0.16rem 0.1rem 0.16rem;
+  }
+  /deep/ .van-tabs--line .van-tabs__wrap{
+    height: .68rem;
+  }
+  /deep/ .van-tab--active{
+    font-weight: 600;
+  }
+  </style>
+  

+ 39 - 1
src/view/course/user/courseAdDeal.vue

@@ -82,9 +82,11 @@
 </template>
 <script>
 import { getCourseRecordList, createCourseCode ,getDealerCourseDetail} from "../api";
+import {setWxConfig} from '../utils'
 import Clipboard from "clipboard";
 import axios from "axios";
 import courseList from "../components/courseList.vue";
+import wx from "weixin-js-sdk";
 export default {
   name: "",
   components: { courseList },
@@ -142,11 +144,46 @@ export default {
   },
   created() {
     this.init();
+    // setWxConfig();
   },
   mounted(){
     this.copyBtn = new Clipboard(this.$refs.copys);
   },
   methods: {
+    setShare(){
+      wx.ready(function () {
+        console.log("微信配置成功")
+      })
+      wx.error(function (res) {
+        console.log("微信配置失败",res)
+      })
+      // if(this.$isWx){
+      //   wx.ready(function () {
+      //     console.log("微信配置成功")
+      //   })
+      //   wx.error(function (res) {
+      //     console.log("微信配置失败",res)
+      //   })
+      // }
+    },
+    //分享链接
+    shareLink(){
+      if(this.$isWx){
+        wx.updateAppMessageShareData({ 
+          title: this.courseDetail.subjectName, // 分享标题
+          desc: '点击查看课程', // 分享描述
+          link: this.giveLink, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
+          imgUrl: this.courseDetail.subjectThumb, // 分享图标
+          success: function () {
+            // 设置成功
+            console.log("分享成功")
+            // this.$toast.success('')
+          }
+        })
+      }else{
+        this.$toast.fail('请在微信中打开分享')
+      }
+    },
     //复制
     copy () {
       let _this = this
@@ -174,7 +211,7 @@ export default {
     // 获取课程码
     getCourseCode() {
       createCourseCode(this.courseDetail.subjectId).then(res => {
-        this.giveLink = `${window.location.href.split("#")[0]}#/courseDetail/${
+        this.giveLink = `点我领取课程,1小时内可领取有效 ${window.location.href.split("#")[0]}#/courseDetail/${
           this.subjectId
         }?code=${res}`;
         console.log(this.giveLink)
@@ -262,6 +299,7 @@ export default {
 };
 </script>
 <style scoped lang="scss">
+@import url('../utils/navBar.scss');
 * {
   margin: 0;
   padding: 0;

+ 167 - 81
src/view/course/user/courseDeal.vue

@@ -1,35 +1,41 @@
 <template>
   <div class="page">
-    <van-nav-bar
-      :title="title"
-      @click-left="onClickLeft"
-    >
-    <template #left>
-      <template v-if="$route.query&&$route.query.code">
-        <van-icon name="wap-home-o"/>
-        <span style="font-size: .32rem;color: #FFF;">首页</span>
+    <van-nav-bar :title="title" @click-left="onClickLeft">
+      <template #left>
+        <template v-if="$route.query && $route.query.code">
+          <van-icon name="wap-home-o" />
+          <span style="font-size: .32rem;color: #FFF;">首页</span>
+        </template>
+        <template v-else>
+          <van-icon name="arrow-left" />
+          <span style="font-size: .32rem;color: #FFF;">返回</span>
+        </template>
       </template>
-      <template v-else>
-        <van-icon name="arrow-left" />
-        <span style="font-size: .32rem;color: #FFF;">返回</span>
-      </template>
-    </template>
-  </van-nav-bar>
+    </van-nav-bar>
     <div class="courseContent">
-      <div class="previewImg">
-        <img :src="courseDetail.thumb" />
-      </div>
-      <div class="title">
-        <p>{{ courseDetail.name }}</p>
-      </div>
       <div class="tabs">
-        <scroller ref="scroller">
-          <van-tabs v-model="activeTab" swipeable>
+        <div v-show="showBack" class="toTop" @click="BackTop">
+          <span><van-icon name="back-top"/></span>
+        </div>
+        <scroller ref="scroller" :on-scrolling="scrollChange">
+          <div class="previewImg">
+            <img :src="courseDetail.thumb" />
+          </div>
+          <div class="title">
+            <span>{{ courseDetail.price }}</span>
+            <p>{{ courseDetail.name }}</p>
+            <i style="margin-right: .1rem;"
+              >已更新{{ courseDetail.sections.length }}节课</i
+            >
+            <i
+              >{{
+                Number(courseDetail.baseClick) + Number(courseDetail.clickNum)
+              }}次浏览</i
+            >
+          </div>
+          <van-tabs v-model="activeTab" swipeable sticky>
             <van-tab title="课程目录">
               <div class="catelog">
-                <div class="sup">
-                  <span>共{{ courseDetail.sections.length }}节课</span>
-                </div>
                 <div class="logConetent">
                   <div
                     class="logLi"
@@ -54,12 +60,16 @@
               </div>
             </van-tab>
           </van-tabs>
-          <div id="xxhh" style="height: 1.2rem;" v-if="!courseDetail.buy&&canGive&&canGive2"></div>
+          <div
+            id="xxhh"
+            style="height: 1.2rem;"
+            v-if="!courseDetail.buy && canGive && canGive2"
+          ></div>
         </scroller>
       </div>
       <div
         class="getCourse"
-        v-if="!courseDetail.buy&&canGive&&canGive2"
+        v-if="!courseDetail.buy && canGive && canGive2"
         @click="useCode"
       >
         <van-button icon="fire-o" square class="getBtn"
@@ -71,6 +81,7 @@
 </template>
 
 <script>
+import { setWxConfig } from "../utils";
 import {
   learnerCourseDetail,
   getCourseCodeDetail,
@@ -83,7 +94,8 @@ export default {
   props: [],
   data() {
     return {
-      goLeft:'返回',
+      showBack:false,
+      goLeft: "返回",
       loading: false,
       finished: false,
       activeTab: 0,
@@ -95,8 +107,8 @@ export default {
         sections: [],
         buy: false
       },
-      canGive:true,
-      canGive2:true,
+      canGive: true,
+      canGive2: true,
       giveCode: false,
       codeDetail: {
         enable: true
@@ -105,85 +117,110 @@ export default {
   },
   created() {
     this.init();
+    if (this.$isWx) {
+      setWxConfig().then(() => {
+        wx.ready(() => {
+          console.log("微信配置成功");
+          wx.updateAppMessageShareData({
+            title: this.courseDetail.name, // 分享标题
+            desc: "点击查看课程", // 分享描述
+            link: window.location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
+            imgUrl: this.courseDetail.thumb, // 分享图标
+            success: function() {
+              // 设置成功
+              console.log("分享成功");
+              // this.$toast.success('')
+            }
+          });
+        });
+      });
+    }
   },
   methods: {
+    scrollChange(e){
+      if(e>60){
+        this.showBack = true;
+      }else{
+        this.showBack = false;
+      }
+    },
+    //回到顶部
+    BackTop() {
+      this.$refs.scroller.scrollTo(0, 0, 500);
+    },
     // 领取课程提示
     useCode() {
-      if(this.codeDetail&&this.codeDetail.enable){
+      if (this.codeDetail && this.codeDetail.enable) {
         this.$dialog
-        .confirm({
-          title: "提示",
-          message: "确定领取当前课程吗"
-        })
-        .then(() => {
-          let data = {
-            salesCode: this.codeDetail.salesCode,
-            userId: this.codeDetail.userId,
-            subjectId: this.codeDetail.subjectId
-          };
-          getCourseCode(data).then(res => {
-            this.$toast.success("领取成功!");
-            this.giveCode = true;
-            this.getDetail();
+          .confirm({
+            title: "提示",
+            message: "确定领取当前课程吗"
+          })
+          .then(() => {
+            let data = {
+              salesCode: this.codeDetail.salesCode,
+              userId: this.codeDetail.userId,
+              subjectId: this.codeDetail.subjectId
+            };
+            getCourseCode(data).then(res => {
+              this.$toast.success("领取成功!");
+              this.giveCode = true;
+              this.getDetail();
+            });
           });
+      } else {
+        this.$dialog.confirm({
+          title: "提示",
+          message: "该课程码已失效"
         });
-      }else{
-        this.$toast.fail("该课程码已失效");
+        // this.$toast.fail("该课程码已失效");
       }
     },
     // 领取课程码课程
     getCodeDetail() {
       getCourseCodeDetail(this.$route.query.code).then(res => {
         this.codeDetail = res;
-        if(!res && !this.courseDetail.buy){
-          this.$toast.fail("该课程码已失效");
+        if (!res && !this.courseDetail.buy) {
+          this.$dialog.confirm({
+            title: "提示",
+            message: "该课程码已失效"
+          });
+          // this.$toast.fail("该课程码已失效");
         }
       });
     },
-    // 获取link对应的视频真实地址
-    getVideoLink(link){
-      let data = {
-        subjectId:this.$route.params.id,
-        link:link
-      }
-      getVideoSrc(data).then(res=>{
-        window.location.href = res
-      })
-    },
     // 章节点击观看视频
     toSectionVidio(item, index) {
-      if (this.courseDetail.buy&&this.courseDetail.enable) {
-        // this.getVideoLink(item.link)
+      if (this.courseDetail.buy && this.courseDetail.enable) {
         let data = {
           index: index,
           link: item.link
         };
-        sessionStorage.setItem('vd_info',JSON.stringify(data))
+        sessionStorage.setItem("vd_info", JSON.stringify(data));
         this.$router.push({
           path: `/course/video/${this.$route.params.id}`
         });
-      } else if(!this.courseDetail.buy){
+      } else if (!this.courseDetail.buy) {
         this.$toast.fail("请先领取课程后再观看");
-      }else{
+      } else {
         this.$toast.fail("课程已下架");
       }
     },
     // 返回首页
     onClickLeft() {
-      if(this.$route.query&&this.$route.query.code){
-        this.$router.push('/courseHome');
-      }else{
+      if (this.$route.query && this.$route.query.code) {
+        this.$router.push("/courseHome");
+      } else {
         this.$router.go(-1);
       }
-      
     },
     // 初始化
     init() {
       this.courseId = this.$route.params.id;
       if (this.$route.query && this.$route.query.code) {
-        this.goLeft = '首页'
+        this.goLeft = "首页";
         this.getDetail();
-      }else{
+      } else {
         this.getDetail();
         this.canGive = false;
       }
@@ -199,10 +236,21 @@ export default {
           !this.giveCode
         ) {
           this.$toast.fail("您已经购买课程,无需再次购买");
-          this.getCodeDetail();
-        }else if(!res.enable){
+          return;
+        }
+        if (!this.courseDetail.enable) {
           this.canGive2 = false;
           this.$toast.fail("课程已下架");
+          return;
+        }
+        if (
+          !this.courseDetail.buy &&
+          this.$route.query &&
+          this.$route.query.code &&
+          this.courseDetail.enable &&
+          !this.giveCode
+        ) {
+          this.getCodeDetail();
         }
       });
     }
@@ -211,6 +259,7 @@ export default {
 };
 </script>
 <style scoped lang="scss">
+@import url("../utils/navBar.scss");
 * {
   margin: 0;
   padding: 0;
@@ -219,13 +268,14 @@ img {
   display: block;
 }
 .page {
-  background-color: #fff;
+  // background-color: #fff;
   box-sizing: border-box;
   .courseContent {
-    padding: 0 0.2rem;
-    margin-top: 0.3rem;
+    // padding: 0 0.2rem;
+    // margin-top: 0.3rem;
+    position: relative;
     .previewImg {
-      border-radius: 0.1rem;
+      // border-radius: 0.1rem;
       overflow: hidden;
       img {
         width: 100%;
@@ -233,12 +283,21 @@ img {
       }
     }
     .title {
+      padding: 0 0.2rem 0.2rem;
+      background-color: #fff;
+      margin-bottom: 0.2rem;
+      span {
+        font-size: 0.35rem;
+        font-weight: 600;
+        color: red;
+        line-height: 0.8rem;
+      }
       p {
         font-size: 0.32rem;
         font-weight: 600;
         color: #000;
-        line-height: .4rem;
-        padding: 0.1rem 0;
+        line-height: 0.4rem;
+        margin-bottom: 0.2rem;
         /* white-space: pre-wrap; */
         /* overflow: hidden; */
         /* text-overflow: ellipsis; */
@@ -247,19 +306,45 @@ img {
         width: 100%;
         word-wrap: break-word;
       }
+      i {
+        font-size: 0.22rem;
+        color: #888;
+        line-height: 0.3rem;
+        font-style: normal;
+      }
     }
     .tabs {
-      height: calc(100vh - 6.25rem);
+      height: calc(100vh - 0.92rem);
       position: relative;
+      .toTop {
+        width: 1rem;
+        height: 1rem;
+        background-color: #ccc;
+        border-radius: 50%;
+        overflow: hidden;
+        text-align: center;
+        position: absolute;
+        right: 0.4rem;
+        bottom: 0.4rem;
+        z-index: 999;
+        span {
+          font-size: 0.48rem;
+          color: #fff;
+          line-height: 1rem;
+        }
+      }
       .images {
-        margin-top: 0.1rem;
+        // margin-top: 0.1rem;
         img {
           width: 100%;
         }
       }
       .catelog {
+        background: #fff;
+        padding: 0.2rem;
         margin-top: 1px;
         border-top: 1px solid #efefef;
+        position: relative;
         .sup {
           display: flex;
           justify-content: space-between;
@@ -268,6 +353,7 @@ img {
             font-size: 0.24rem;
             color: #666;
             line-height: 3;
+            margin-left: 0.1rem;
           }
         }
         .logConetent {
@@ -277,7 +363,7 @@ img {
             padding: 0 0.2rem;
             margin-bottom: 0.15rem;
             p {
-              padding: .2rem 0;
+              padding: 0.2rem 0;
               font-size: 0.3rem;
               color: #000;
               line-height: 1.3;

+ 2 - 0
src/view/course/user/deal.vue

@@ -266,6 +266,7 @@ export default {
 };
 </script>
 <style scoped lang="scss">
+@import url('../utils/navBar.scss');
 * {
   margin: 0;
   padding: 0;
@@ -367,6 +368,7 @@ export default {
             font-size: 0.32rem;
             color: #000;
             line-height: 1.5;
+            flex: 1;
           }
           & > span {
             font-size: 0.28rem;

+ 1 - 0
src/view/course/user/login.vue

@@ -164,6 +164,7 @@ export default {
 };
 </script>
 <style scoped lang="scss">
+@import url('../utils/navBar.scss');
 * {
   margin: 0;
   padding: 0;

+ 2 - 1
src/view/course/user/team.vue

@@ -98,7 +98,7 @@ export default {
       };
       if (this.type==1) {
         getDealerTeam(data).then(res => {
-          this.teamList = res.list;
+          this.teamList = this.teamList.concat(res.list);
           this.page.total = res.total;
           this.page.cur = res.current;
           if (res.pages == res.current || res.pages == 0) {
@@ -140,6 +140,7 @@ export default {
 };
 </script>
 <style scoped lang="scss">
+@import url('../utils/navBar.scss');
 .team-x {
   .teamContent {
     height: calc(100vh - 0.92rem);

+ 14 - 30
src/view/course/home_qr2img_next.vue → src/view/course/user_qr2img_next.vue

@@ -329,36 +329,19 @@
           this.createImg();
         }
       },
+      createHDCanvas (w=300,h=150) {
+        let ratio = window.devicePixelRatio || 1;
+        let canvas = document.createElement('canvas');
+        canvas.width = w * ratio; // 实际渲染像素
+        canvas.height = h * ratio; // 实际渲染像素
+        canvas.style.width = `${w}px`; // 控制显示大小
+        canvas.style.height = `${h}px`; // 控制显示大小
+        canvas.getContext('2d').setTransform(ratio, 0, 0, ratio, 0, 0);
+        return canvas;
+      },
       createImg() {
-        const vm = this;
-       const domObj = document.getElementById("posterHtml");
-  
-       var width = document.documentElement.clientWidth;
-       var height = document.documentElement.clientHeight;
-       var canvas = document.createElement("canvas");
-       var scale = 2;
-  
-       canvas.width = width * scale;
-       canvas.height = height * scale;
-       canvas.getContext("2d").scale(scale, scale);
-  
-       var opts = {
-         scale: scale,
-         canvas: canvas,
-         logging: true,
-         width: width,
-         height: height,
-         useCORS: true,
-         allowTaint: false,
-         logging: false,
-         letterRendering: true,
-  
-       };
-  
-  
-  
         let that = this
-        var opts = {
+        let opts = {
           useCORS: true, //支持图片跨域
           allowTaint: false, //这个属性和useCORS不能同时为true哦
           logging: false,
@@ -366,14 +349,15 @@
         };
         html2canvas(this.$refs.canvasImg, opts) //传入你想生成图片的dom
           .then(function (canvas) {
-            var img = Canvas2Image.convertToImage(
+            // let canvas2 = that.createHDCanvas()
+            let img = Canvas2Image.convertToImage(
               canvas,
               canvas.width,
               canvas.height
             );
             img.style.width = "200px";
             img.style.height = "250px";
-            var url = canvas.toDataURL("image/png"); //得到图片的base64编码数据
+            let url = canvas.toDataURL("image/png"); //得到图片的base64编码数据
             that.imgEwmUrl = url
           });
       },

+ 23 - 1
src/view/course/utils/index.js

@@ -1,7 +1,10 @@
 import { Toast, Notify } from 'vant'
 import Clipboard from "clipboard";
 import { getWxToken, setWxToken, openError } from "@/utils/auth";
-import {getCache} from '@/utils/auth'
+import { getCache } from '@/utils/auth'
+import { getWxConfigInfo } from '../api'
+import router from '@/router'
+import wx from "weixin-js-sdk";
 //判断环境/登录状态
 export function isWxEnv(type, data) {
     return new Promise((resolve, reject) => {
@@ -97,4 +100,23 @@ export function copyLink(event) {
     clipboard.on("error", function (e) {
         console.error(e);
     });
+}
+export function setWxConfig() {
+    let data = {
+        url:window.location.href
+    }
+    return new Promise((resovle,reject)=>{
+        getWxConfigInfo(data).then(config => {
+            wx.config({
+                appId: config.appId,
+                timestamp: config.timestamp,
+                nonceStr: config.nonceStr,
+                signature: config.signature,
+                jsApiList: ['updateAppMessageShareData']
+            })
+            resovle()
+        }).catch(err=>{
+            console.log(err)
+        })
+    })
 }

+ 16 - 0
src/view/course/utils/navBar.scss

@@ -0,0 +1,16 @@
+/deep/ .van-nav-bar{
+    background-color:#FFF;
+    border-bottom: 1px solid #efefef;
+}
+/deep/ .van-nav-bar .van-icon{
+    color:#333;
+}
+/deep/ .van-nav-bar__text{
+    color: #333;
+}
+/deep/ .van-nav-bar__title{
+    color: #333;
+}
+/deep/ .van-nav-bar__left span{
+    color: #333!important;
+}

+ 82 - 28
src/view/course/video/video.vue → src/view/course/video/courseVideo.vue

@@ -8,22 +8,22 @@
     ></van-nav-bar>
     <div class="courseContent">
       <div class="previewImg">
-        <!-- <video controls autoplay name="media">
-          <source :src="videoSrc" type="video/mp4">
-        </video> -->
         <video ref="vueMiniPlayer" :src="videoSrc" controls autoplay v-if="showVideo" controlsList="nodownload"></video>
       </div>
       <div class="title">
-        <p>{{ courseDetail.name }}</p>
+        <!-- <span>{{ courseDetail.price }}</span> -->
+        <p>{{ curTitle }}</p>
+        <!-- <i style="margin-right: .1rem;">已更新{{ courseDetail.sections.length }}节课</i>
+        <i>{{ Number(courseDetail.baseClick) + Number(courseDetail.clickNum) }}次浏览</i> -->
       </div>
       <div class="tabs">
-        <scroller ref="scroller">
+        <div v-show="showBack" class="toTop" @click="BackTop">
+          <span><van-icon name="back-top"/></span>
+        </div>
+        <scroller ref="scroller" :on-scrolling="scrollChange">
           <van-tabs v-model="activeTab" swipeable>
             <van-tab title="课程目录">
               <div class="catelog">
-                <div class="sup">
-                  <span>共{{ courseDetail.sections.length }}节课</span>
-                </div>
                 <div class="logConetent">
                   <div
                     class="logLi"
@@ -61,11 +61,13 @@ export default {
   name: "video",
   data() {
     return {
+      showBack:false,
       showVideo:true,
       loading: false,
       finished: false,
       activeTab: 0,
       title: "课程详情",
+      curTitle:'',
       videoSrc:"",
       courseDetail: {
         thumb: "",
@@ -90,6 +92,18 @@ export default {
     this.init();
   },
   methods: {
+    //滚动监控
+    scrollChange(e){
+      if(e>60){
+        this.showBack = true;
+      }else{
+        this.showBack = false;
+      }
+    },
+    //回到顶部
+    BackTop() {
+      this.$refs.scroller.scrollTo(0, 0, 500);
+    },
     // 章节切换获取视频地址
     toSectionVidio(item,i) {
       this.courseDetail.sections.forEach((item,index)=>{
@@ -138,6 +152,7 @@ export default {
         })
         if(JSON.parse(sessionStorage.getItem('vd_info'))){
           res.sections[JSON.parse(sessionStorage.getItem('vd_info')).index].active = true;
+          this.curTitle = res.sections[JSON.parse(sessionStorage.getItem('vd_info')).index].name
         }
         this.courseDetail = res;
       })
@@ -146,6 +161,7 @@ export default {
 };
 </script>
 <style scoped lang="scss">
+@import url('../utils/navBar.scss');
 * {
   margin: 0;
   padding: 0;
@@ -154,43 +170,79 @@ img {
   display: block;
 }
 .page {
-  background-color: #fff;
+  // background-color: #fff;
   box-sizing: border-box;
   .courseContent {
-    padding: 0 0.2rem;
-    margin-top: 0.3rem;
+    // padding: 0 0.2rem;
+    // margin-top: 0.3rem;
     .previewImg {
-      border-radius: 0.1rem;
+      // border-radius: 0.1rem;
       overflow: hidden;
-      width: 100%;
-      height: 4rem;
       video {
         width: 100%;
         height: 4rem;
       }
     }
     .title {
+      padding: .2rem;
+      background-color: #FFF;
+      margin-bottom: .2rem;
+      span{
+        font-size: .35rem;
+        font-weight: 600;
+        color: red;
+        line-height: .8rem;
+      }
       p {
         font-size: 0.32rem;
         font-weight: 600;
         color: #000;
-        line-height: 1rem;
-        overflow: hidden;
-        text-overflow: ellipsis;
-        white-space: nowrap;
-        word-break: break-all;
+        line-height: .4rem;
+        // margin-bottom: .2rem;
+        /* white-space: pre-wrap; */
+        /* overflow: hidden; */
+        /* text-overflow: ellipsis; */
+        /* white-space: nowrap; */
+        /* word-break: break-all; */
+        width: 100%;
+        word-wrap: break-word;
+      }
+      i{
+        font-size: .22rem;
+        color: #888;
+        line-height: .3rem;
+        font-style: normal;
       }
     }
     .tabs {
       height: calc(100vh - 6.25rem);
       position: relative;
+      .toTop {
+        width: 1rem;
+        height: 1rem;
+        background-color: #ccc;
+        border-radius: 50%;
+        overflow: hidden;
+        text-align: center;
+        position: absolute;
+        right: 0.4rem;
+        bottom: 0.4rem;
+        z-index: 999;
+        span {
+          font-size: 0.48rem;
+          color: #fff;
+          line-height: 1rem;
+        }
+      }
       .images {
-        margin-top: 0.1rem;
+        // margin-top: 0.1rem;
         img {
           width: 100%;
         }
       }
       .catelog {
+        background: #FFF;
+        padding: 0.2rem;
         margin-top: 1px;
         border-top: 1px solid #efefef;
         .sup {
@@ -201,6 +253,7 @@ img {
             font-size: 0.24rem;
             color: #666;
             line-height: 3;
+            margin-left: .1rem;
           }
         }
         .logConetent {
@@ -209,22 +262,23 @@ img {
             border-radius: 0.1rem;
             padding: 0 0.2rem;
             margin-bottom: 0.15rem;
+            &.active{
+              box-shadow: 0.02rem 0.08rem #ddd;
+              p{
+                color:#26a2ff;
+              }
+            }
             p {
               padding: .2rem 0;
               font-size: 0.3rem;
               color: #000;
               line-height: 1.3;
+              // line-height: 3;
               // overflow: hidden;
               // text-overflow: ellipsis;
               // white-space: nowrap;
               // word-break: break-all;
             }
-            &.active{
-              box-shadow: 1px 4px #ddd;
-              p{
-                color: #26A2FF;
-              }
-            }
           }
         }
       }
@@ -237,10 +291,10 @@ img {
     width: calc(100% - 0.2rem);
     .getBtn {
       width: 100%;
-      background-color: #26A2FF;
+      background-color: #26a2ff;
       color: #fff;
       // animation: getFire 3s infinite linear;
-      border-radius: .1rem;
+      border-radius: 0.1rem;
     }
   }
 }

+ 211 - 0
src/view/course/video/freeVideo.vue

@@ -0,0 +1,211 @@
+<template>
+    <div class="page">
+      <van-nav-bar
+        :title="title"
+        left-text="返回"
+        left-arrow
+        @click-left="onClickLeft"
+      ></van-nav-bar>
+      <div class="courseContent">
+        <div class="previewImg">
+          <video ref="vueMiniPlayer" :src="videoSrc" controls autoplay v-if="showVideo" controlsList="nodownload"></video>
+        </div>
+        <div class="title">
+          <p>{{ video_info.name }}</p>
+        </div>
+      </div>
+    </div>
+  </template>
+  
+  <script>
+  import {learnerCourseDetail,getFreeVideoSrc} from '../api'
+  export default {
+    name: "video",
+    data() {
+      return {
+        video_info:{
+            name:'免费课程'
+        },
+        showVideo:true,
+        title: "免费课程",
+        videoSrc:"",
+        courseDetail: {
+          thumb: "",
+          name: "",
+          images: [],
+          sections: []
+        }
+      };
+    },
+    watch:{
+      videoSrc(){
+        this.showVideo = false;
+        this.$nextTick(()=>{
+          this.showVideo = true;
+          this.$nextTick(()=>{
+            this.$refs.vueMiniPlayer.play();//播放
+          })
+        })
+      }
+    },
+    created() {
+      this.init();
+    },
+    methods: {
+      // 章节切换获取视频地址
+      toSectionVidio(item,i) {
+        this.courseDetail.sections.forEach((item,index)=>{
+          item.active = false;
+          if(index == i){
+            item.active = true;
+          }
+        })
+        let data = {
+            index: i,
+            link: item.link
+        };
+        sessionStorage.setItem('vd_info',JSON.stringify(data))
+        this.getVideoLink(item.link)
+        // this.videoSrc = this.courseDetail.sections[index].link
+      },
+      // 获取视频地址
+      getVideoLink(link){
+        let data = {
+          subjectId:this.$route.params.id,
+          link:link
+        }
+        getFreeVideoSrc(data).then(res=>{
+          this.videoSrc = res
+        }).catch(err=>{
+          this.$router.push('/courseError')
+        })
+      },
+      // 返回
+      onClickLeft() {
+        this.$router.go(-1);
+      },
+      // 初始化
+      init() {
+        if(this.$route.query){
+            this.video_info = this.$route.query;
+            this.getVideoLink(this.video_info.link)
+        }else{
+            this.$toast.fail('视频似乎有点问题')
+            setTimeout(() => {
+                this.$router.go(-1)
+            }, 2000);
+        }
+      },
+    },
+  };
+  </script>
+  <style scoped lang="scss">
+  @import url('../utils/navBar.scss');
+  * {
+    margin: 0;
+    padding: 0;
+  }
+  img {
+    display: block;
+  }
+  .page {
+    background-color: #fff;
+    box-sizing: border-box;
+    .courseContent {
+      padding: 0 0.2rem;
+      margin-top: 0.3rem;
+      .previewImg {
+        border-radius: 0.1rem;
+        overflow: hidden;
+        width: 100%;
+        height: 4rem;
+        video {
+          width: 100%;
+          height: 4rem;
+        }
+      }
+      .title {
+        p {
+          font-size: 0.32rem;
+          font-weight: 600;
+          color: #000;
+          line-height: 1rem;
+          overflow: hidden;
+          text-overflow: ellipsis;
+          white-space: nowrap;
+          word-break: break-all;
+        }
+      }
+      .tabs {
+        height: calc(100vh - 6.25rem);
+        position: relative;
+        .images {
+          margin-top: 0.1rem;
+          img {
+            width: 100%;
+          }
+        }
+        .catelog {
+          margin-top: 1px;
+          border-top: 1px solid #efefef;
+          .sup {
+            display: flex;
+            justify-content: space-between;
+            align-items: center;
+            span {
+              font-size: 0.24rem;
+              color: #666;
+              line-height: 3;
+            }
+          }
+          .logConetent {
+            .logLi {
+              border: 1px solid #efefef;
+              border-radius: 0.1rem;
+              padding: 0 0.2rem;
+              margin-bottom: 0.15rem;
+              p {
+                padding: .2rem 0;
+                font-size: 0.3rem;
+                color: #000;
+                line-height: 1.3;
+                // overflow: hidden;
+                // text-overflow: ellipsis;
+                // white-space: nowrap;
+                // word-break: break-all;
+              }
+              &.active{
+                box-shadow: 1px 4px #ddd;
+                p{
+                  color: #26A2FF;
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+    .getCourse {
+      position: absolute;
+      bottom: 0.1rem;
+      left: 0.1rem;
+      width: calc(100% - 0.2rem);
+      .getBtn {
+        width: 100%;
+        background-color: #26A2FF;
+        color: #fff;
+        // animation: getFire 3s infinite linear;
+        border-radius: .1rem;
+      }
+    }
+  }
+  @keyframes getFire {
+    0% {
+      transform: scale(0.95);
+    }
+    100% {
+      transform: scale(1.05);
+    }
+  }
+  </style>
+  

+ 2 - 2
src/view/user/accountSet.vue

@@ -12,8 +12,8 @@
     </van-cell-group>
     <van-dialog v-model="show" show-cancel-button @confirm="verify">
        <div class="text">
-         <div>操作前需要验证你的登录密码</div>
-         <div>如果忘了原密码,请退出登录,点击"忘记密码",使用短信验证码重新登录后设置新密码。</div>
+         <div style="color: red;font-size: .3rem;">操作前需要验证你的登录密码</div>
+         <div style="padding: 0 0.2rem;color: #333;margin-top: 0.2rem;">如果忘了原密码,请退出登录,点击"忘记密码",使用短信验证码重新登录后设置新密码。</div>
        </div>
        <van-cell-group>
          <van-field v-model="password" label="原密码" placeholder="请输入原密码" type="password"  />

+ 44 - 0
src/view/user/create_company.vue

@@ -26,11 +26,23 @@
       <div class="submit_btn_box login_butto">
         <van-button hairline plain v-show="false" type="info" size="small" round block @click="$router.push({ name: 'scanqr' })">加入已有组织</van-button>
       </div>
+      <!-- <div style="position: absolute;bottom: .3rem;right: .2rem;cursor: pointer;font-size: .26rem;" @click="show = true">
+        <span>注销账号</span>
+      </div> -->
     </div>
     <van-popup v-model="industry_columns_show" position="bottom"><van-picker :columns="industry_columns" @confirm="onIndustryChange" show-toolbar /></van-popup>
     <van-popup v-model="scale_columns_show" position="bottom">
       <van-picker :columns="scale_columns" @confirm="onScaleChange" show-toolbar @cancel="scale_columns_show = false" />
     </van-popup>
+    <van-dialog v-model="show" show-cancel-button @confirm="verify">
+       <div class="text">
+         <div style="color: red;font-size: .3rem;">操作前需要验证你的登录密码</div>
+         <div style="padding: 0 0.2rem;color: #333;margin-top: 0.2rem;">如果忘了原密码,请退出登录,点击"忘记密码",使用短信验证码重新登录后设置新密码。</div>
+       </div>
+       <van-cell-group>
+         <van-field v-model="password" label="原密码" placeholder="请输入原密码" type="password"  />
+       </van-cell-group>
+    </van-dialog>
   </div>
 </template>
 
@@ -38,12 +50,16 @@
 import Vue from 'vue';
 import { setToken } from '@/utils/auth';
 import { Picker } from 'vant';
+import {returnJSEncrypt} from '@/utils/auth'
 
 Vue.use(Picker);
 export default {
   name: 'create_company',
   data() {
     return {
+      account_info: this.$store.getters.account_info,
+      password:'',
+      show:false,
       submit_loading: false,
       formdata: {
         tel: '',
@@ -81,6 +97,28 @@ export default {
     );
   },
   methods: {
+    verify () {
+      if (!this.password) {
+        this.$toast('请输入密码')
+        return false
+      }
+      this.$toast.loading({
+        mask: true,
+        message: '正在验证...'
+      })
+      let data = {
+        tel: this.account_info.tel,
+        password: this.password,
+        st: new Date().getTime()
+      }
+      this.$axiosUser('post', '/api/destruction',{data:returnJSEncrypt(data)},'v2').then(res => {
+        if (res.data.code == 1) {
+          this.$router.push({name: 'login'})
+        }
+      }).finally(e => {
+        this.$toast.clear()
+      })
+    },
     get_company_info(id) {
       let self = this;
       this.$axios('get', '/addons/ems/index/get_company_info', { id: id }).then(res => {
@@ -144,6 +182,12 @@ export default {
 </script>
 
 <style scoped>
+.text{
+  text-align: center;
+  color: #969799;
+  font-size: 0.28rem;
+  padding: 0.2rem 0;
+}
 .van-nav-bar__title {
   font-weight: bold;
 }

+ 7 - 0
src/view/user/login.vue

@@ -316,6 +316,13 @@
               }).then(res => {
                 if (res.code == 1) {
                   localStorage.setItem('a-token-temp', res.data.token); // 保存平台账号登录的token
+                  if(window.plus){
+                    let deviceInfo = window.plus.os.name;
+                    if(deviceInfo === 'IOS'&&res.data.account_site.length == 0){
+                      console.log('苹果软件用户没有创建公司')
+                    }
+                  }
+                  console.log(res.data.account_site)
                   this.openUrl2(res.data.account_site, res.data.invitation_wait_count);
                 } else {
                   this.$toast.fail({

+ 5 - 1
src/view/user/wxInit.vue

@@ -147,7 +147,11 @@ export default {
                     code: request.expendCode
                   }
                 });
-              } else {
+              } else if(sessionStorage.getItem('cur_path')){
+                this.$router.push(sessionStorage.getItem('cur_path')).then(()=>{
+                  sessionStorage.removeItem('cur_path')
+                })
+              }else{
                 this.$router.push("/courseHome");
               }
             });