guojy 1 vuosi sitten
vanhempi
commit
b5d8b593cd

+ 0 - 0
static/images/courseLogin.png → src/assets/images/courseLogin.png


BIN
src/assets/images/courseUser.png


+ 1 - 1
src/permission.js

@@ -30,7 +30,7 @@ router.beforeEach((to, from, next) => {
     init(next);
     // next();
   } else if (whiteList.indexOf(to.path) != -1 || filterWhite(to.path)) {
-    if (getWxToken() || to.path == '/courseAuth') {
+    if ((getWxToken()&&localStorage.getItem('wx_user_info')) || to.path == '/courseAuth') {
       if (typeof (window.$routes_map[to.name]) != 'undefined') {
         window.document.title = window.$routes_map[to.name].label
       } else {

+ 1 - 1
src/router/course.js

@@ -4,7 +4,7 @@
       path: '/courseHome',
       name: 'courseHome',
       component: () => import('@/view/course/home'),
-      label: '课程首页',
+      label: '首页',
       need_login: true,
     },
     {

+ 2 - 2
src/utils/axiosKc.js

@@ -17,8 +17,8 @@ if (window.plus) {
 }
 let url = '';
 const request = axios.create({
-  baseURL: process.env.BASE_API, 
-  // baseURL: 'https://oa.g107.com',
+  // baseURL: process.env.BASE_API, 
+  baseURL: 'https://oa.g107.com',
   // baseURL:'http://192.168.0.66:8081',
   timeout: 20000,
   headers: {

+ 11 - 0
src/view/course/components/CourseTeam.vue

@@ -19,7 +19,17 @@
           :user_name="item.name"
           width=".8rem"
           height=".8rem"
+          v-if="item.imgUrl"
         ></userImage>
+        <div style="background: #26A2FF;border-radius: 50%;overflow: hidden;" v-else>
+          <userImage
+            class="about-me__avatar"
+            :img_url="defaultImgUrl"
+            user_name="用户"
+            width=".8rem"
+            height=".8rem"
+          ></userImage>
+        </div>
         <div class="flex-r">
           <div class="flex-tel">
             <p>{{ item.name }}</p>
@@ -56,6 +66,7 @@ export default {
   },
   data() {
     return {
+      defaultImgUrl:require('../../../assets/images/courseUser.png'),
       searchValue: "",
       teamData: {
         count: 0,

+ 1 - 1
src/view/course/components/courseList.vue

@@ -15,7 +15,7 @@
           </div>
           <div class="listLiTit" v-if="item.toUserId && listType == 2">
             <p>
-              {{ item.toUserId == user_info.id ? "收到" : "出"
+              {{ item.toUserId == user_info.id ? "收到" : "出"
               }}<span>【{{ item.dealAmount }}】套</span>课程
             </p>
           </div>

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

@@ -8,7 +8,7 @@
     ></van-nav-bar>
     <div class="recordContent">
       <scroller
-        ref="scroller"
+        ref="recordScroller"
         :list="recordList"
         noDataText="没有更多..."
         :on-infinite='getMoreList'
@@ -42,7 +42,6 @@ export default {
   props: [],
   data() {
     return {
-      canReq:true,
       noDate:false,
       title: "名额变动明细",
       page:{

+ 22 - 14
src/view/course/home.vue

@@ -1,9 +1,6 @@
 <template>
   <div class="curPage">
-    <div v-show="!isWx">
-      <p>请在微信中打开</p>
-    </div>
-    <div class="userInfo" v-show="isWx">
+    <div class="userInfo">
       <van-row
         type="flex"
         class="imageName"
@@ -17,10 +14,20 @@
             :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 : "未知"
+              >{{ user_info.name ? user_info.name : "新用户"
               }}<van-icon
                 name="notes-o"
                 color="#E1B98B"
@@ -46,7 +53,7 @@
       <div class="tabs_content">
         <div class="tabsLi" @click="toUrl('/courseTeam/1')">
           <van-image
-            :src="teamPic"
+            src="static/images/course_team.png"
             style="width: .8rem;height: .8rem;"
             type="contain"
           />
@@ -54,7 +61,7 @@
         </div>
         <div class="tabsLi" @click="qropen">
           <van-image
-            :src="ewmPic"
+            src="static/images/course_ewm.png"
             style="width: .8rem;height: .8rem;"
             type="contain"
           />
@@ -62,7 +69,7 @@
         </div>
         <div class="tabsLi" @click="toUrl('/courseTeam/2')">
           <van-image
-            :src="dealPic"
+            src="static/images/course_dingdan.png"
             style="width: .8rem;height: .8rem;"
             type="contain"
           />
@@ -142,9 +149,7 @@
 import Clipboard from "clipboard";
 import QRCode from "qrcodejs2";
 import courseList from "./components/courseList.vue";
-import teamPic from '../../../static/images/course_team.png'
-import dealPic from '../../../static/images/course_dingdan.png'
-import ewmPic from '../../../static/images/course_ewm.png'
+import {setDocumentTitle} from '../../components/vueHashCalendar/utils/util'
 import {
   getWxApiToken,
   getUSerInfo,
@@ -158,13 +163,13 @@ export default {
   },
   data() {
     return {
+      defaultImgUrl:require('../../assets/images/courseUser.png'),
       showLoad: false,
       tbsIndex: 0,
       clipboard: null,
       qrVisible: false,
       qrcode: null,
       qrcodeStatus: false,
-      isWx: true,
       isAndroid: this.$getCache("isAndroid"),
       user_info: {
         imgUrl: "",
@@ -248,6 +253,7 @@ export default {
     },
     //获取用户数据
     init() {
+      setDocumentTitle('首页')
       this.user_info = JSON.parse(localStorage.getItem("wx_user_info"));
       if (this.user_info.marketable) {
         this.getDealerCourseList();
@@ -302,7 +308,7 @@ export default {
           }`
         );
         this.qrcode = new QRCode(this.$refs.qrCodeUrl, {
-          text: `${window.location.href.split("#")[0]}#/courseHome?pid=${
+          text: `${window.location.href.split("#")[0]}#/courseLogin?pid=${
             JSON.parse(localStorage.getItem("wx_user_info")).id
           }`, // 需要转换为二维码的内容
           width: 200,
@@ -456,11 +462,13 @@ img {
       }
     }
     .tbsR {
+      display: flex;
+      align-items: center;
       margin-right: .2rem;
       span {
         font-size: 0.24rem;
         color: #333;
-        line-height: 0.3rem;
+        line-height: 0.4rem;
       }
     }
   }

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

@@ -90,7 +90,6 @@ export default {
   data() {
     return {
       showShare: false,
-      canReq: true,
       loading: false,
       finished: false,
       activeTab: 0,

+ 14 - 3
src/view/course/user/courseDeal.vue

@@ -2,10 +2,19 @@
   <div class="page">
     <van-nav-bar
       :title="title"
-      left-text="返回"
-      left-arrow
       @click-left="onClickLeft"
-    ></van-nav-bar>
+    >
+    <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>
+  </van-nav-bar>
     <div class="courseContent">
       <div class="previewImg">
         <img :src="courseDetail.thumb" />
@@ -74,6 +83,7 @@ export default {
   props: [],
   data() {
     return {
+      goLeft:'返回',
       loading: false,
       finished: false,
       activeTab: 0,
@@ -166,6 +176,7 @@ export default {
       this.courseId = this.$route.params.id;
       this.getDetail();
       if (this.$route.query && this.$route.query.code) {
+        this.goLeft = '首页'
         this.getCodeDetail();
       }else{
         this.canGive = false;

+ 1 - 1
src/view/course/user/deal.vue

@@ -80,7 +80,7 @@
             <div class="flex-name-num">
               <p>{{ item.subjectName }}</p>
               <span :style="{color:item.toUserId == target_user_info.id ?'#26A2FF':'#eb6f6f'}"
-                >{{ item.toUserId == target_user_info.id ? "收到" : "出"
+                >{{ item.toUserId == target_user_info.id ? "收到" : "出"
                 }}{{ item.amount }}套</span
               >
             </div>

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

@@ -172,7 +172,7 @@ img {
   display: block;
 }
 .page {
-  background: url('/static/images/courseLogin.png') no-repeat;
+  background: url(~@/assets/images/courseLogin.png) no-repeat;
   background-size: 100% 100%;
   .buibOuter {
     width: 100%;

+ 42 - 31
src/view/course/user/team.vue

@@ -8,7 +8,12 @@
       @click-left="onClickLeft"
     ></van-nav-bar>
     <div class="teamContent">
-      <scroller :isInitRefresh="false" :on-infinite="getMoreList">
+      <scroller 
+      :isInitRefresh="false" 
+      ref="recordScroller"
+      :list="recordList"
+      noDataText="没有更多..."
+      :on-infinite="getMoreList">
         <Team
           :teamType="type"
           :teamList="teamList"
@@ -28,13 +33,15 @@
 <script>
 import { getDealerTeam, getDealerPerson } from "../api";
 import Team from "../components/CourseTeam";
+import {setDocumentTitle} from '../../../components/vueHashCalendar/utils/util'
 export default {
   name: "",
   components: { Team },
   data() {
     return {
       canReq: true,
-      type: this.$route.params.id,//0 or 1
+      noDate: false,
+      type: this.$route.params.id,//1 or 2
       page: {
         cur: 1,
         size: 10,
@@ -54,45 +61,32 @@ export default {
   },
   methods: {
     // 触底加载
-    getMoreList() {
+    getMoreList(done) {
       console.log("到底了");
-      if (this.teamList.length < this.page.total && this.canReq) {
-        this.canReq = false;
-        this.$toast.loading({
-          duration: 1,
-          message: "加载中...",
-          forbidClick: true
-        });
-        this.page.cur += 1;
-        this.getList();
+      if (!this.noDate) {
+        setTimeout(() => {
+          this.getList(done);
+        }, 300);
+      } else {
+        this.$refs.recordScroller.finishInfinite(true);
       }
     },
     // 初始化
     init() {
       this.type = this.$route.params.id;
+      if(this.type == 1){
+        setDocumentTitle('我的团队')
+      }else if(this.type == 2){
+        setDocumentTitle('近30天交易')
+      }
       this.getList();
     },
     //导航左侧返回
     onClickLeft() {
       this.$router.go(-1);
-      // if (this.type) {
-      //   this.$router.go(-1);
-      // } else {
-      //   this.type = 1;
-      //   this.total = 0;
-      //   this.page.cur = 1;
-      //   this.getList();
-      // }
-    },
-    //导航右侧30天交易
-    onClickRight() {
-      this.type = 0;
-      this.total = 0;
-      this.page.cur = 1;
-      this.getList();
     },
     // 获取团队列表
-    getList() {
+    getList(done) {
       let data = {
         page: this.page.cur,
         pageSize: this.page.size,
@@ -102,17 +96,34 @@ export default {
         getDealerTeam(data).then(res => {
           this.teamList = res.list;
           this.page.total = res.total;
+          if (res.pages == res.current) {
+            console.log("已无更多");
+            if (done) done(true);
+            this.noDate = true;
+          } else {
+            console.log("更多...");
+            if (done) done();
+            this.page.cur++; //下拉一次页数+1
+            this.noDate = false;
+          }
         });
       } else if(this.type==2) {
         getDealerPerson(data).then(res => {
           this.teamList = res.list;
           this.page.total = res.total;
           this.page.cur = res.current;
+          if (res.pages == res.current) {
+            console.log("已无更多");
+            if (done) done(true);
+            this.noDate = true;
+          } else {
+            console.log("更多...");
+            if (done) done();
+            this.page.cur++; //下拉一次页数+1
+            this.noDate = false;
+          }
         });
       }
-      if (this.teamList.length < this.page.total) {
-        this.canReq = true;
-      }
     },
     // 搜索
     search(val) {