guojy 1 سال پیش
والد
کامیت
f052ed1f0d

+ 3 - 4
src/api/courseLogin.js → src/api/course.js

@@ -1,10 +1,9 @@
 
 import axiosKc from '@/utils/axiosKc'
-import axios from '@/utils/axios'
-import {returnJSEncrypt} from '@/utils/auth'
+//根据wo_token获取管理员id和管理员token
 // export function get_site_info() {
-//     return axiosUser('get', '/api/pro/site/info')
-//   }
+//     return axiosKc('get', '/mkt/admin/login')
+// }
   
 //   export function get_account_info() {
 //     return axiosKc('post', '/api/pro/account/info')

+ 276 - 175
src/course/courseManage/create.vue

@@ -2,170 +2,278 @@
 
 <template>
   <div class="pjc">
+    <el-page-header @back="$router.go(-1)" :content="title"></el-page-header>
     <h3>{{ title }}</h3>
-    <el-form v-model="courseDeail" label-width="110px">
+    <el-form :model="courseDeail" label-width="110px">
       <el-form-item label="课程名称:">
-        <el-input v-model.trim="role.roleName"></el-input>
+        <el-input v-model.trim="courseDeail.name"></el-input>
+      </el-form-item>
+      <el-form-item label="预览图:">
+        <el-upload
+          action="#"
+          list-type="picture-card"
+          :auto-upload="false"
+          :file-list="courseDeail.img_url"
+          :limit="1"
+          :on-change="uploadChange"
+        >
+          <i slot="default" class="el-icon-plus"></i>
+          <div slot="file" slot-scope="{ file }">
+            <img
+              class="el-upload-list__item-thumbnail"
+              :src="file.url"
+              alt=""
+            />
+            <span class="el-upload-list__item-actions">
+              <span
+                class="el-upload-list__item-preview"
+                @click="handlePictureCardPreview(file)"
+              >
+                <i class="el-icon-zoom-in"></i>
+              </span>
+              <span
+                class="el-upload-list__item-delete"
+                @click="handleRemove(file)"
+              >
+                <i class="el-icon-delete"></i>
+              </span>
+            </span>
+          </div>
+        </el-upload>
       </el-form-item>
-      <el-form-item label="预览图:"> </el-form-item>
       <el-form-item label="价格:">
-        <el-input-number v-model="num" @change="handleChange" :min="1" :max="10" label="描述文字"></el-input-number>
+        <el-input-number
+          v-model="courseDeail.price"
+          @change="this.courseDeail.price = !courseDeail.price"
+          :min="1"
+          :max="10000000"
+          label="课程价格"
+        ></el-input-number>
       </el-form-item>
       <el-form-item label="是否上架:">
         <el-switch
-          v-model="value"
+          v-model="courseDeail.isShelf"
           active-color="#13ce66"
-          inactive-color="#ff4949"
+          inactive-color="#999"
         >
         </el-switch>
       </el-form-item>
       <el-form-item label="课程介绍:">
-        <el-input
-          type="textarea"
-          :rows="2"
-          placeholder="请输入内容"
-          v-model="textarea"
+        <el-upload
+          action="#"
+          list-type="picture-card"
+          :auto-upload="false"
+          :file-list="courseDeail.imgList"
+          :limit="20"
+          multiple
+          :on-change="uploadChange2"
+          :on-error="uploadErr"
         >
-        </el-input>
+          <i slot="default" class="el-icon-plus"></i>
+          <div slot="file" slot-scope="{ file }">
+            <img
+              class="el-upload-list__item-thumbnail"
+              :src="file.url"
+              alt=""
+            />
+            <span class="el-upload-list__item-actions">
+              <span
+                class="el-upload-list__item-preview"
+                @click="handlePictureCardPreview(file)"
+              >
+                <i class="el-icon-zoom-in"></i>
+              </span>
+              <span
+                class="el-upload-list__item-delete"
+                @click="handleRemove2(file)"
+              >
+                <i class="el-icon-delete"></i>
+              </span>
+            </span>
+          </div>
+        </el-upload>
+      </el-form-item>
+      <el-form-item label="课程章节" size="normal">
+        <div class="sectionout">
+          <div
+            class="sectionInner"
+            v-for="(item, index) in courseDeail.courseSection"
+            :key="index"
+          >
+            <div class="sectionName">
+              <el-input v-model.trim="item.name"></el-input>
+            </div>
+            <div class="sectionUrl">
+              <el-input v-model.trim="item.url"></el-input>
+            </div>
+            <div class="del">
+              <el-button
+                type="text"
+                size="mini"
+                plain
+                @click="sectionDel(index, item)"
+                style="color: #f89881"
+                >删除</el-button
+              >
+            </div>
+          </div>
+          <div class="addSection">
+            <el-button plain @click="addSection">+</el-button>
+          </div>
+        </div>
       </el-form-item>
-      <el-form-item label>
+
+      <el-form-item style="display: flex;flex-direction: row-reverse;">
+        <el-button @click="$router.go(-1)">取消</el-button>
         <el-button @click="iffirm">{{ alterCreate }}</el-button>
       </el-form-item>
     </el-form>
+    <el-dialog :visible.sync="dialogVisible">
+      <img width="100%" :src="dialogImageUrl" alt="" />
+    </el-dialog>
   </div>
 </template>
 <script>
 export default {
-  name: "roleCreate",
+  name: "courseEdit",
   data() {
     return {
       title: "",
-      alterCreate: "确认",
-      operate: [
-        {
-          code: 1,
-          name: "默认权限",
-        },
-        {
-          code: 2,
-          name: "角色管理-全部",
-        },
-        {
-          code: 3,
-          name: "用户管理-全部",
-        },
-        {
-          code: 4,
-          name: "组件管理-全部",
-        },
-        {
-          code: 5,
-          name: "布局管理-全部",
-        },
-        {
-          code: 6,
-          name: "项目管理-全部",
-        },
-      ],
-      ui: [
-        {
-          code: 1,
-          name: "默认权限",
-        },
-        {
-          code: 2,
-          name: "角色管理-全部",
-        },
-        {
-          code: 3,
-          name: "用户管理-全部",
-        },
-        {
-          code: 4,
-          name: "组件管理-全部",
-        },
-        {
-          code: 5,
-          name: "布局管理-全部",
-        },
-        {
-          code: 6,
-          name: "项目管理-全部",
-        },
-      ],
-      route: [
-        {
-          code: "1",
-          name: "默认权限",
-        },
-        {
-          code: "2",
-          name: "角色管理-全部",
-        },
-        {
-          code: "3",
-          name: "用户管理-全部",
-        },
-        {
-          code: "4",
-          name: "组件管理-全部",
-        },
-        {
-          code: "5",
-          name: "布局管理-全部",
-        },
-        {
-          code: "6",
-          name: "项目管理-全部",
-        },
-      ],
+      alterCreate: "保存",
+      // 个人信息
       courseDeail: {
         id: 0,
         name: "",
+        price: 0,
+        img_url: [
+          {
+            name: "dsd.jpg",
+            url: "../../../static/images/321.jpg",
+          },
+        ],
+        imgList: [
+          {
+            name: "dsd.png",
+            url: "../../../static/images/2.png",
+          },
+          {
+            name: "dsd.png",
+            url: "../../../static/images/1.png",
+          },
+        ],
+        courseSection: [
+          {
+            name: "精讲1",
+            url: "http:sasdsada.com",
+          },
+          {
+            name: "精讲1",
+            url: "http:sasdsada.com",
+          },
+          {
+            name: "精讲1",
+            url: "http:sasdsada.com",
+          },
+          {
+            name: "精讲1",
+            url: "http:sasdsada.com",
+          },
+        ],
       },
-      roleShift: "",
+      dialogVisible: false,
+      dialogImageUrl: "",
     };
   },
   computed: {},
   methods: {
-    //字符串转换成数组并传值给role
-    toRole(res) {
-      let roleShift = res;
-      //全局方法中的字符串转化成数组并去除空格
-      roleShift.operateSetting = this.$globalf.stringToArr(
-        roleShift.operateSetting
-      );
-      roleShift.uiSetting = this.$globalf.stringToArr(roleShift.uiSetting);
-      roleShift.routeSetting = this.$globalf.stringToArr(
-        roleShift.routeSetting
-      );
-      this.role = roleShift;
+    // 添加课程
+    addSection() {
+      let section = {
+        name: "",
+        url: "",
+      };
+      this.courseDeail.courseSection.push(section);
+    },
+    // 删除课程
+    sectionDel(index, item) {
+      this.$confirm("确定删除当前章节?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          this.courseDeail.courseSection.splice(index, 1);
+        })
+        .catch((err) => {
+          this.$message({
+            type: "info",
+            message: "已取消",
+          });
+        });
+    },
+    // 上传图片失败
+    uploadErr(err, file, fileList) {
+      console.log(err);
+      console.log(file);
+    },
+    //上传预览图
+    uploadChange(file, fileList) {
+      this.courseDeail.img_url.push(file);
     },
-    //数组转换成字符串
-    toRoleShift(res) {
-      let roleShift = JSON.parse(JSON.stringify(res));
-      //全局方法中的数组转化成字符串并去除空格
-      roleShift.operateSetting = this.$globalf.arrToString(
-        roleShift.operateSetting
-      );
-      roleShift.uiSetting = this.$globalf.arrToString(roleShift.uiSetting);
-      roleShift.routeSetting = this.$globalf.arrToString(
-        roleShift.routeSetting
-      );
-      return roleShift;
+    // 上传介绍图组
+    uploadChange2(file, fileList) {
+      this.courseDeail.imgList.push(file);
+    },
+    // 删除预览图
+    handleRemove(file) {
+      this.deleteImage(file.url);
+    },
+    // 删除介绍图
+    handleRemove2(file) {
+      this.deleteImage(file.url, 1);
+    },
+    // 图片放大查看
+    handlePictureCardPreview(file) {
+      this.dialogImageUrl = file.url;
+      this.dialogVisible = true;
+    },
+    // 删除图片
+    deleteImage(url, type) {
+      this.$confirm("确定删除图片?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          if (type) {
+            let newList = this.courseDeail.imgList.filter((item) => {
+              return item.url !== url;
+            });
+            this.courseDeail.imgList = newList;
+          } else {
+            console.log(123);
+            this.courseDeail.img_url = [];
+          }
+        })
+        .catch((err) => {
+          this.$message({
+            type: "info",
+            message: "已取消",
+          });
+        });
     },
     //保存修改
     iffirm() {
       if (
-        !this.role.roleName == "" &&
-        !this.role.operateSetting.length == 0 &&
-        !this.role.routeSetting.length == 0 &&
-        !this.role.uiSetting.length == 0
+        !this.courseDeail.name == "" &&
+        !this.courseDeail.imgList.length == 0 &&
+        !this.courseDeail.img_url == "" &&
+        !this.courseDeail.price !== 0
       ) {
         this.$confirm("确定保存当前页面信息?", "提示", {
           confirmButtonText: "确定",
           cancelButtonText: "取消",
-          type: "warning",
+          type: "info",
         })
           .then(() => {
             if (this.$route.params.id) {
@@ -187,69 +295,41 @@ export default {
         });
       }
     },
-    //修改角色保存post
+    //修改保存
     saveAlter() {
-      this.$api.role
-        .saveOne(this.$route.params.id, this.toRoleShift(this.role))
-        .then((res) => {
-          if (res.data.code == 200) {
-            this.$message({
-              type: "success",
-              message: res.data.message,
-            });
-            setTimeout(() => {
-              this.$router.push("/index/role");
-            }, 10);
-          } else {
-            this.$message({
-              type: "warning",
-              message: res.data.message,
-            });
-          }
-        });
+      this.$message({
+        message: '修改成功!',
+        type: 'success',
+        showClose: true,
+        duration: 2000,
+      });
+      
     },
     //新建角色保存post
     saveCreate() {
-      this.$api.role
-        .create(this.toRoleShift(this.role))
-        .then((res) => {
-          if (res.data.code == 200) {
-            this.$message({
-              type: "success",
-              message: res.data.message,
-            });
-            setTimeout(() => {
-              this.$router.push("/index/role");
-            }, 10);
-          } else {
-            this.$message({
-              type: "warning",
-              message: res.data.message,
-            });
-          }
-        })
-        .catch((error) => {});
+      this.$message({
+        message: '新建课程成功!',
+        type: 'success',
+        showClose: true,
+        duration: 2000,
+      });
     },
     //判断新建/修改
     judge() {
       if (this.$route.params.id == undefined) {
-        this.title = "创建新角色";
-        this.alterCreate = "确认新建";
+        this.title = "创建课程";
       } else {
-        this.title = "修改角色信息";
-        this.alterCreate = "确认修改";
+        this.title = "编辑课程";
       }
-      // this.getOneAccount();
-      // this.getOpAuthority();
     },
     //获取单个角色信息
     getOneAccount() {
-      this.$api.role
-        .getOne(this.$route.params.id)
-        .then((res) => {
-          this.toRole(res.data.result);
-        })
-        .catch((error) => {});
+      // this.$api.role
+      //   .getOne(this.$route.params.id)
+      //   .then((res) => {
+      //     this.toRole(res.data.result);
+      //   })
+      //   .catch((error) => {});
     },
   },
   created() {
@@ -260,10 +340,13 @@ export default {
 
 <style scoped lang="scss">
 .pjc {
-  width: 550px;
+  width: 900px;
   height: auto;
   margin: 0 auto;
-  margin-top: 30px;
+  margin-top: 10px;
+  background-color: #FFF;
+  border-radius: 5px;
+  padding: 30px 60px;
   h3 {
     color: #000;
     text-align: center;
@@ -284,4 +367,22 @@ export default {
     }
   }
 }
+.sectionout {
+  .sectionInner {
+    display: flex;
+    // justify-content: space-between;
+    align-items: center;
+    margin-bottom: 10px;
+    .sectionName {
+      width: 150px;
+      margin-right: 20px;
+    }
+    .sectionUrl {
+      width: 250px;
+      margin-right: 20px;
+    }
+    .sectionDel {
+    }
+  }
+}
 </style>

+ 30 - 6
src/course/courseManage/home.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="page">
     <el-header height="">
-      <el-button type="primary" size="default" @click="" plain
+      <el-button type="primary" size="default" @click="courseCreate" plain
         >+ 添加课程</el-button
       >
     </el-header>
@@ -19,12 +19,11 @@
         </el-table-column>
         <el-table-column fixed="right" label="操作" width="250" align="center">
           <template slot-scope="scope">
-            <el-button size="mini" @click="courseEdit(scope.row,scope.$index)"
+            <el-button  type="text" @click="courseEdit(scope.row,scope.$index)"
               >编辑</el-button
             >
             <el-button
-              size="mini"
-              type="danger"
+              type="text"
               @click="courseDel(scope.row,scope.$index)"
               >删除</el-button
             >
@@ -41,7 +40,7 @@
           :current-page.sync="page.cur"
           :page-size="page.size"
           :total="page.total"
-          :hide-on-single-page="false"
+          :hide-on-single-page="true"
         >
         </el-pagination>
       </div>
@@ -91,23 +90,48 @@ export default {
   },
   created() {},
   methods: {
+    // 上一页
     prevPage(){
       console.log(this.page)
     },
+    // 下一页
     nextPage(){
       console.log(this.page)
     },
+    // 当前页切换
     curPageChange(){
       console.log(this.page)
     },
+    // 跳转课程修改
     courseEdit(row) {
+      this.$router.push({
+        path:`/course/courseEdit/${row.id}`,
+      })
       console.log(row);
     },
+    // 跳转创建新课程
+    courseCreate(){
+      this.$router.push('/course/courseCreate')
+    },
+    // 删除课程
     courseDel(row) {
+      this.$confirm('确定删除当前课程吗?', '提示', {
+        confirmButtonText: '确认',
+        cancelButtonText: '取消',
+        type: 'warning',
+      }).then(action => {
+        this.$message({
+          message: '删除成功!',
+          type: 'success',
+          showClose: true,
+          duration: 2000,
+        });
+      }).catch(() => {
+      });
+      
       console.log(row);
     },
   },
-  computed: {},
 };
 </script>
 <style scoped lang="scss">

+ 251 - 0
src/course/dealerManage/edit.vue

@@ -0,0 +1,251 @@
+<template>
+  <div class="page">
+    <el-page-header @back="$router.go(-1)" :content='curName' style="margin-bottom: 20px;"></el-page-header>
+    <el-container class="course_data">
+      <el-table :data="courseList" border stripe highlight-current-row>
+        <el-table-column prop="name" label="课程名称" align="center">
+        </el-table-column>
+        <el-table-column label="卖出" align="center">
+          <template slot-scope="scope"> {{ scope.row.save }} </template>
+        </el-table-column>
+        <el-table-column label="剩余" align="center">
+          <template slot-scope="scope"> {{ scope.row.surplus }} </template>
+        </el-table-column>
+        <el-table-column fixed="right" label="操作" width="250" align="center">
+          <template slot-scope="scope">
+            <el-button type="text" size="mini" @click="courseAdd(scope.row, scope.$index)"
+              >增加</el-button
+            >
+            <el-button
+              size="mini"
+              type="text"
+              @click="courseSurplus(scope.row, scope.$index)"
+              >减少</el-button
+            >
+            <el-button
+              size="mini"
+              type="text"
+              @click="courseRecord(scope.row, scope.$index)"
+              >变动明细</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="proness">
+        <el-pagination
+          background
+          layout="prev, pager, next"
+          @prev-click="prevPage()"
+          @next-click="nextPage()"
+          @current-change="curPageChange()"
+          :current-page.sync="page.cur"
+          :page-size="page.size"
+          :total="page.total"
+          :hide-on-single-page="false"
+        >
+        </el-pagination>
+      </div>
+    </el-container>
+    <el-dialog
+      :title="eldiType?'增加课程名额':'减少课程名额'"
+      :visible.sync="changeLimit"
+      width="30%"
+      :close-on-click-modal="false"
+      :close-on-press-escape='false'
+      center
+      @close="cancleDi">
+      <el-form :model="eldiForm" ref="form" label-width="80px" :inline="false" size="normal">
+        <el-form-item label="选择课程" size="normal">
+          <el-select v-model="eldiForm.id" placeholder="请选择课程">
+            <el-option
+              v-for="item in courseOptions"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value">
+            </el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="数量">
+          <el-input-number v-model="eldiForm.num" size="normal" :min="1" :step="1" :controls="true">
+          </el-input-number>
+        </el-form-item>
+        <el-form-item label="备注" size="normal">
+          <el-input type="textarea" :rows="2" v-model="eldiForm.beizhu" placeholder="请输入备注" 
+            :maxlength="-1" :show-word-limit="false" :autosize="{ minRows: 2, maxRows: 5 }">
+          </el-input>
+        </el-form-item>
+      </el-form>
+      <span slot="footer">
+        <el-button @click="cancleDi">取消</el-button>
+        <el-button type="primary" @click="confirmSave">保存</el-button>
+      </span>
+    </el-dialog>
+    
+  </div>
+</template>
+
+<script>
+export default {
+  name: "dealerManage",
+  data() {
+    return {
+      curName: "",
+      page: {
+        total: 1000,
+        size: 10,
+        cur: 1,
+      },
+      teamValue: "",
+      changeLimit:false,
+      eldiType:0,
+      eldiForm:{
+        id:0,
+        num:0,
+        addOrreduce:false,
+        beizhu:''
+      },
+      courseOptions:[
+        {
+          label:"经济讲堂1",
+          value:1555
+        },
+        {
+          label:"经济讲堂2",
+          value:1552
+        },
+        {
+          label:"经济讲堂3",
+          value:1535
+        },
+        {
+          label:"经济讲堂4",
+          value:1255
+        }
+      ],
+      courseList:[],
+      courseList: [
+        {
+          id: 123455,
+          name: "经济论坛001",
+          save: 64,
+          surplus:136,
+        },
+        {
+          id: 123452,
+          name: "经济论坛002",
+          save: 33,
+          surplus:16,
+        },
+        {
+          id: 123451,
+          name: "经济论坛003",
+          save: 64,
+          surplus:136,
+        },
+        {
+          id: 123422,
+          name: "经济论坛004",
+          save: 62,
+          surplus:116,
+        },
+      ],
+    };
+  },
+  created() {
+    this.init();
+  },
+  watch:{
+    $route(){
+      this.init()
+    }
+  },
+  methods: {
+    //增加名额
+    courseAdd(row,index){
+      this.eldiType = 1
+      this.changeLimit = true
+    },
+    //减少名额
+    courseSurplus(row,index){
+      this.eldiType = 0
+      this.changeLimit = true
+    },
+    //查看明细
+    courseRecord(row,index){
+      this.$router.push({
+        path:`/course/courseRecord/${row.id}`,
+        query:{
+          name:row.name
+        }
+      })
+    },
+    // 提交名额交易
+    confirmSave(){
+      this.$confirm('确定要提交名额交易吗?', '提示', {
+        confirmButtonText: '确认',
+        cancelButtonText: '取消',
+        type: 'info',
+      }).then(action => {
+        this.$message({
+          message: '交易成功!',
+          type: 'success',
+          showClose: true,
+          duration: 1500,
+        });
+        this.cancleDi()
+      }).catch(() => {
+        
+      });
+      
+    },
+    //取消弹窗
+    cancleDi(){
+      let form = {
+        id:0,
+        num:0,
+        addOrreduce:false,
+        beizhu:''
+      }
+      this.eldiType = 0
+      this.eldiForm = form
+      this.changeLimit = false
+    },
+    //初始化
+    init() {
+      // console.log(this.$route)
+        this.curName = `${this.$route.query.tel}推广的课程`;
+    },
+    // 上一页
+    prevPage() {
+      console.log(this.page);
+    },
+    // 下一页
+    nextPage() {
+      console.log(this.page);
+    },
+    // 页面切换
+    curPageChange() {
+      console.log(this.page);
+    },
+  },
+};
+</script>
+<style scoped lang="scss">
+.page {
+  padding: 15px;
+  background-color: #fff;
+  border-radius: 5px;
+  .search {
+    margin-left: 15px;
+  }
+  .course_data {
+    margin-top: 25px;
+    display: block;
+    .proness {
+      margin-top: 20px;
+      display: flex;
+      justify-content: center;
+    }
+  }
+}
+</style>

+ 251 - 13
src/course/dealerManage/home.vue

@@ -1,24 +1,262 @@
 <template>
-<div>
-    dealerManage
-</div>
+  <div class="page">
+    <el-page-header @back="$router.go(-1)" :content='curTeamTel' style="margin-bottom: 20px;" v-if="!isOuter"></el-page-header>
+    <el-header height="40px" style="display: flex; align-items: center">
+      <el-button
+        type="primary"
+        size="normal"
+        @click="createQr"
+        plain
+        v-if="isOuter"
+        >经销商邀请二维码</el-button
+      >
+      <div class="search">
+        <el-input
+          placeholder="请输入内容"
+          v-model.trim="teamValue"
+          @keyup.enter.native="teamSearch"
+        >
+          <i slot="prefix" class="el-input__icon el-icon-search"></i>
+        </el-input>
+      </div>
+    </el-header>
+    <el-container class="course_data">
+      <el-table :data="courseList" border stripe highlight-current-row>
+        <el-table-column prop="name" label="用户名" align="center">
+        </el-table-column>
+        <el-table-column label="微信ID" align="center">
+          <template slot-scope="scope"> {{ scope.row.wx_id }} </template>
+        </el-table-column>
+        <el-table-column label="手机号" align="center">
+          <template slot-scope="scope"> {{ scope.row.tel }} </template>
+        </el-table-column>
+        <el-table-column label="TA的团队" align="center" style="color: #409eff" class="outTeam" v-if="isOuter">
+          <template slot-scope="scope">
+            <span @click="toDealerTeam(scope.row)" style="color: #409eff;cursor: pointer;">{{
+              scope.row.teamNum
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column fixed="right" label="操作" width="250" align="center">
+          <template slot-scope="scope">
+            <el-button type="text" size="mini" @click="infoEdit(scope.row, scope.$index)"
+              >修改信息</el-button
+            >
+            <el-button
+              size="mini"
+              type="text"
+              @click="dealerPay(scope.row, scope.$index)"
+              >课程名额修改</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="proness">
+        <el-pagination
+          background
+          layout="prev, pager, next"
+          @prev-click="prevPage()"
+          @next-click="nextPage()"
+          @current-change="curPageChange()"
+          :current-page.sync="page.cur"
+          :page-size="page.size"
+          :total="page.total"
+          :hide-on-single-page="false"
+        >
+        </el-pagination>
+      </div>
+    </el-container>
+    <el-dialog
+      :title="dealerInfo.name"
+      :visible.sync="eldiForm"
+      width="30%"
+      :close-on-click-modal="false"
+      :close-on-press-escape='false'
+      center
+      @close="cancleDi">
+      <el-form :model="dealerInfo" ref="form"  label-width="100px" :inline="false" size="normal">
+        <el-form-item label="用户名">
+          <el-input v-model="dealerInfo.name"></el-input>
+        </el-form-item>
+        <el-form-item label="绑定微信ID">
+          <el-input v-model="dealerInfo.wx_id"></el-input>
+        </el-form-item>
+        <el-form-item label="手机号">
+          <el-input v-model="dealerInfo.tel"></el-input>
+        </el-form-item>
+      </el-form>
+      <span slot="footer">
+        <el-button @click="cancleDi">取消</el-button>
+        <el-button type="primary" @click="confirmSave">保存</el-button>
+      </span>
+    </el-dialog>
+    
+  </div>
 </template>
 
 <script>
 export default {
-  name: '',
+  name: "dealerManage",
   components: {},
-    props: [],
-  data () {
+  props: [],
+  data() {
     return {
+      eldiForm:false,
+      dealerInfo:{
+        id: 0,
+        name: "",
+        wx_id: "",
+        tel: "",
+      },
+      curTeamTel: "",
+      isOuter: false,
+      page: {
+        total: 1000,
+        size: 10,
+        cur: 1,
+      },
+      teamValue: "",
+      courseList: [
+        {
+          id: 123455,
+          name: "燕小六",
+          wx_id: "wx1525155255",
+          tel: "15699847711",
+          teamNum: 8,
+        },
+        {
+          id: 123453,
+          name: "王五",
+          wx_id: "wx1525155255",
+          tel: "15699847721",
+          teamNum: 11,
+        },
+        {
+          id: 123452,
+          name: "李四",
+          wx_id: "wx1525155255",
+          tel: "15699847731",
+          teamNum: 21,
+        },
+        {
+          id: 123451,
+          name: "张三",
+          wx_id: "wx1525155255",
+          tel: "15699847751",
+          teamNum: 4,
+        },
+      ],
+    };
+  },
+  watch: {
+    $route:function(to,from){
+      this.init()
     }
   },
-  created () { },
-  mounted () { },
-  methods: { },
-  computed: {}
-}
+  created() {
+    this.init();
+  },
+  methods: {
+    // 修改经销商信息
+    confirmSave(){
+      this.$confirm('确定要修改经销商信息吗?', '提示', {
+        confirmButtonText: '确认',
+        cancelButtonText: '取消',
+        type: 'info',
+      }).then(action => {
+        this.$message({
+          message: '交易成功!',
+          type: 'success',
+          showClose: true,
+          duration: 1500,
+        });
+      this.cancleDi()
+      }).catch(() => {
+        this.cancleDi()
+      });
+      
+    },
+    // 取消修改并重置表单
+    cancleDi(){
+      let form = {
+        id: 0,
+        name: "",
+        wx_id: "",
+        tel: "",
+      }
+      this.dealerInfo = form
+      this.eldiForm = false
+    },
+    // 初始化
+    init() {
+      if (this.$route.params.id) {
+        this.isOuter = false;
+        this.curTeamTel = `${this.$route.query.tel}的团队`;
+      } else {
+        this.isOuter = true;
+      }
+    },
+    // 跳转到我的团队
+    toDealerTeam(row) {
+      console.log(row);
+      this.$router.push({
+        path: `/course/dealerTeam/${row.id}?tel=${row.tel}`,
+        params: {
+          tel: row.tel,
+        },
+      });
+    },
+    // 搜索
+    teamSearch() {
+      if (this.teamValue) {
+        console.log(this.teamValue);
+      }
+    },
+    // 创建二维码
+    createQr() {},
+    // 上一页
+    prevPage() {
+      console.log(this.page);
+    },
+    // 下一页
+    nextPage() {
+      console.log(this.page);
+    },
+    // 切换当前页
+    curPageChange() {
+      console.log(this.page);
+    },
+    // 打开弹窗修改个人信息
+    infoEdit(row) {
+      this.dealerInfo = row
+      this.eldiForm = true
+      console.log(row);
+    },
+    // 跳转查看交易详情
+    dealerPay(row) {
+      console.log(row);
+      this.$router.push(`/course/dealerEdit/${row.id}?tel=${row.tel}`)
+    },
+  },
+  computed: {},
+};
 </script>
-<style scoped lang='scss'>
-
+<style scoped lang="scss">
+.page {
+  padding: 15px;
+  background-color: #fff;
+  border-radius: 5px;
+  .search {
+    margin-left: 15px;
+  }
+  .course_data {
+    margin-top: 25px;
+    display: block;
+    .proness {
+      margin-top: 20px;
+      display: flex;
+      justify-content: center;
+    }
+  }
+}
 </style>

+ 128 - 0
src/course/dealerManage/record.vue

@@ -0,0 +1,128 @@
+<template>
+    <div class="page">
+      <el-page-header @back="$router.go(-1)" content='课程交易明细' style="margin-bottom: 20px;"></el-page-header>
+      <h3>{{ curTeamTel }}</h3>
+      <el-container class="course_data">
+        <el-table :data="courseRecord" border stripe highlight-current-row>
+          <el-table-column label="课程名额变动明细" align="center">
+            <template slot-scope="scope"> {{ scope.row.direction == 'to'?'-':'+' }}{{ scope.row.num }} </template>
+          </el-table-column>
+          <el-table-column label="备注" align="center">
+            <template slot-scope="scope"> {{ scope.row.beizhu }} </template>
+          </el-table-column>
+          <el-table-column label="记录时间" align="center">
+            <template slot-scope="scope"> {{ scope.row.create_time }} </template>
+          </el-table-column>
+        </el-table>
+        <div class="proness">
+          <el-pagination
+            background
+            layout="prev, pager, next"
+            @prev-click="prevPage()"
+            @next-click="nextPage()"
+            @current-change="curPageChange()"
+            :current-page.sync="page.cur"
+            :page-size="page.size"
+            :total="page.total"
+            :hide-on-single-page="false"
+          >
+          </el-pagination>
+        </div>
+      </el-container>
+    </div>
+  </template>
+  
+  <script>
+  export default {
+    name: "dealerRecord",
+    components: {},
+    props: [],
+    data() {
+      return {
+        curTeamTel: "经济讲堂1的交易明细",
+        page: {
+          total: 1000,
+          size: 10,
+          cur: 1,
+        },
+        courseRecord: [
+          {
+            id: 123455,
+            direction:"to",
+            num:12,
+            beizhu: "撒大大实打实大师大撒大大实打实大师大",
+            create_time: '2021-6-15',
+          },
+          {
+            id: 123453,
+            direction:"to",
+            num:22,
+            beizhu: "撒大大实打实大师大撒大大实打实大师大",
+            create_time: '2021-6-12',
+          },
+          {
+            id: 123452,
+            direction:"from",
+            num:50,
+            beizhu: "撒大大实打实大师大撒大大实打实大师大",
+            create_time: '2021-3-15',
+          },
+          {
+            id: 123451,
+            direction:"to",
+            num:42,
+            beizhu: "撒大大实打实大师大撒大大实打实大师大",
+            create_time: '2022-1-15',
+          },
+        ],
+      };
+    },
+    watch: {
+      $route:function(to,from){
+        this.init()
+      }
+    },
+    created() {
+      this.init();
+    },
+    methods: {
+      // 初始化
+      init() {
+        console.log(this.$route)
+          this.curTeamTel = `${this.$route.query.name}的交易明细`;
+      },
+      // 上一页
+      prevPage() {
+        console.log(this.page);
+      },
+      // 下一页
+      nextPage() {
+        console.log(this.page);
+      },
+      // 切换当前页
+      curPageChange() {
+        console.log(this.page);
+      },
+    },
+  };
+  </script>
+  <style scoped lang="scss">
+  .page {
+    padding: 15px;
+    background-color: #fff;
+    border-radius: 5px;
+    .search {
+      margin-left: 15px;
+    }
+    .course_data {
+      margin-top: 25px;
+      display: block;
+      .proness {
+        margin-top: 20px;
+        display: flex;
+        justify-content: center;
+      }
+    }
+  }
+  </style>
+  

+ 31 - 11
src/course/index.vue

@@ -12,7 +12,7 @@
           </div>
           <div class="flex-1"></div>
           <div class="right-menu">
-            <!-- 切换公司或退出账号 -->
+            <!-- 退出账号 -->
             <el-dropdown @command="logOut">
               <span class="el-dropdown-link" style="cursor: pointer;">
                 <userImage class="user_img"  width="40px" height="40px" fontSize="14" :user_name="course_account_info.name" :img_url="course_account_info.img_url"></userImage>
@@ -47,23 +47,32 @@
         </div>
       </div>
       <el-main class="main-content">
-        <router-view />
+        <keep-alive v-if="isRouterAlive">
+          <router-view />
+        </keep-alive>
       </el-main>
     </el-container>
   </div>
 </template>
 
 <script>
+import axiosKc from '@/utils/axiosKc'
 import { mapGetters, mapState } from 'vuex';
+import { setCourseToken, returnJSEncrypt,_debounce } from '@/utils/auth';
 export default {
-  name: "",
-  components: {},
-  props: [],
+  name: "courseIndex",
+  provide() {
+    //父组件中通过provide来提供变量,在子组件中通过inject来注入变量。
+    return {
+      reload: this.reload
+    }
+  },
   data() {
     return {
       loading: false,
       isLog:false,
       menuIndex:1,
+      isRouterAlive:true,
       menuArr:[
         {
           icon:'#icon-shouye',
@@ -107,6 +116,7 @@ export default {
     };
   },
   watch:{
+    //监视路由变化,有变化就缓存导航状态
     $route(to, from) {
       var str = to.path;
       this.menuArr.some((item, index) => {
@@ -119,25 +129,35 @@ export default {
     },
   },
   created() {
+    //如果当前页不是首页,则从缓存中取出导航栏状态,没有则为首页1
     if(this.$route.path!='/course'){
       this.menuIndex =this.$getCache('course_path')!=1? this.$getCache('course_path'):1;
     }
+    this.getAccountInfo()
   },
   methods: {
-    getToken(){
-      let url = '/mkt/demo/token/wo/'
-      let wxId = '11770'
-      this.$axiosKc('get',`${url}${wxId}`).then((res)=>{
+    //根据微信token获取当前登录用户数据
+    getAccountInfo(){
+      axiosKc('get','/mkt/admin/login').then(res=>{
         console.log(res)
       })
     },
+    //全局刷新不闪烁
+    reload() {
+      this.isRouterAlive = false;
+      this.$nextTick(function() {
+        this.isRouterAlive = true;
+      });
+    },
+    //退出账号
     logOut() {
       this.$store.dispatch('CourseLogOut');
     },
+    //回到首页
     homeUrl(){
-      this.getToken()
-      // this.$router.push({ path: '/course' });
+      this.$router.push({ path: '/course' });
     },
+    //跳转相应子页面并缓存当前状态
     openUrl(item){
       if(this.menuIndex==item.index||this.isLog){
         return false;

+ 292 - 14
src/course/setting/home.vue

@@ -1,24 +1,302 @@
 <template>
-<div>
-    setting
-</div>
+  <div class="page">
+    <el-header height="">
+      <el-button type="primary" size="default" @click="setManage" plain
+        >设置管理员</el-button
+      >
+    </el-header>
+    <el-container class="course_data">
+      <el-table :data="manageList" border stripe highlight-current-row>
+        <el-table-column prop="name" label="用户名" align="center">
+        </el-table-column>
+        <el-table-column label="手机号" align="center">
+          <template slot-scope="scope"> {{ scope.row.tel }} </template>
+        </el-table-column>
+        <el-table-column fixed="right" label="操作" width="250" align="center">
+          <template slot-scope="scope">
+            <el-button
+              type="text"
+              @click="courseDel(scope.row, scope.$index)"
+              >删除</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="proness">
+        <el-pagination
+          background
+          layout="prev, pager, next"
+          @prev-click="prevPage()"
+          @next-click="nextPage()"
+          @current-change="curPageChange()"
+          :current-page.sync="page.cur"
+          :page-size="page.size"
+          :total="page.total"
+          :hide-on-single-page="true"
+        >
+        </el-pagination>
+      </div>
+    </el-container>
+    <el-dialog
+      title="设置管理员"
+      :visible.sync="showSetting"
+      :close-on-press-escape='false'
+      width="32%"
+      @close="cancle()"
+    >
+      <el-input
+        v-model="searchTel"
+        placeholder="输入手机号精确查找"
+        size="normal"
+        clearable
+        @keyup.enter.native="userSearch"
+      >
+        <el-button
+          slot="append"
+          icon="el-icon-search"
+          @click="userSearch"
+        ></el-button>
+      </el-input>
+      <el-container direction="vertical">
+        <div class="flex-box">
+          <div
+            class="userLi"
+            v-for="(item, index) in userList"
+            :key="index"
+            :class="{ active: item.active }"
+            @click="selectMange(item, index)"
+          >
+            <userImage
+              class="user_img"
+              width="40px"
+              height="40px"
+              fontSize="14"
+              :user_name="item.name"
+              :img_url="item.img_url"
+            ></userImage>
+            <span>{{ item.name }}</span>
+          </div>
+        </div>
+      </el-container>
+
+      <span slot="footer">
+        <el-button @click="canle()">取消</el-button>
+        <el-button type="primary" @click="manageSetting()">保存</el-button>
+      </span>
+    </el-dialog>
+  </div>
 </template>
 
 <script>
 export default {
-  name: '',
+  name: "",
   components: {},
-    props: [],
-  data () {
+  props: [],
+  data() {
     return {
-    }
+      showSetting: false,
+      searchTel: "",
+      page: {
+        total: 1000,
+        size: 10,
+        cur: 1,
+      },
+      manageList: [
+        {
+          id: 1545545,
+          name: "张三",
+          tel: "15156664888",
+          img_ur: "../../assets/404_images/404.png",
+        },
+        {
+          id: 1545543,
+          name: "李四",
+          tel: "15156332211",
+          img_ur: "../../assets/404_images/404.png",
+        },
+        {
+          id: 1545544,
+          name: "王五",
+          tel: "15156954421",
+          img_ur: "../../assets/404_images/404.png",
+        },
+      ],
+      userList: [
+        {
+          id: 1454555,
+          name: "张三",
+          img_url: "../../assets/404_images/404.png",
+          tel: "15266664444",
+          active: false,
+        },
+        {
+          id: 1454553,
+          name: "李四",
+          img_url: "../../assets/404_images/404.png",
+          tel: "15266321144",
+          active: false,
+        },
+        {
+          id: 1454552,
+          name: "王五",
+          img_url: "../../assets/404_images/404.png",
+          tel: "15266611144",
+          active: true,
+        },
+        {
+          id: 1451555,
+          name: "燕小六",
+          img_url: "../../assets/404_images/404.png",
+          tel: "15266663333",
+          active: false,
+        },
+        {
+          id: 1453355,
+          name: "七剑下天山",
+          img_url: "../../assets/404_images/404.png",
+          tel: "15266662214",
+          active: false,
+        }
+      ],
+    };
   },
-  created () { },
-  mounted () { },
-  methods: { },
-  computed: {}
-}
-</script>
-<style scoped lang='scss'>
+  created() {},
+  methods: {
+    // 初始化表单并关闭弹窗
+    canle() {
+      // this.userList = []
+      this.showSetting = false;
+    },
+    // 点击用户为管理员
+    selectMange(item, index) {
+      // if(this.sureActiveUser() == 1 && ){
+      //   this.$message({
+      //     message: '只能选择一个用户!',
+      //     type: 'warn',
+      //     showClose: true,
+      //     duration: 2000,
+      //   });
 
+      //   return false
+      // }
+      this.userList[index].active = !this.userList[index].active;
+    },
+    // 用户手机号搜索
+    userSearch() {
+      console.log(this.searchTel);
+    },
+    // 关闭设置管理员弹窗
+    cancle() {
+      this.showSetting = false;
+    },
+    // 查询已选择管理员人数
+    sureActiveUser() {
+      let leng = 0;
+      this.userList.forEach((item) => {
+        item.active ? leng++ : "";
+      });
+      return leng;
+    },
+    //表单提交为管理员
+    manageSetting() {
+      if (this.sureActiveUser() == 1) {
+        this.$confirm("确定要将此用户设置为管理员吗?", "提示", {
+          confirmButtonText: "确认",
+          cancelButtonText: "取消",
+          type: "info",
+        })
+          .then((action) => {
+            this.$message({
+              message: "用户设置为管理员成功!",
+              type: "info",
+              showClose: true,
+              duration: 3000,
+            });
+            this.showSetting = false;
+          })
+          .catch(() => {});
+      } else {
+        this.$message({
+          message: "只能选择一个用户",
+          type: "info",
+          showClose: true,
+          duration: 2000,
+        });
+      }
+    },
+    //打开设置管理员弹窗
+    setManage() {
+      this.showSetting = true;
+    },
+    // 上一页
+    prevPage() {
+      console.log(this.page);
+    },
+    // 下一页
+    nextPage() {
+      console.log(this.page);
+    },
+    // 切换当前页
+    curPageChange() {
+      console.log(this.page);
+    },
+    // 删除管理员
+    courseDel(row) {
+      this.$confirm("确定要删除当前用户吗?", "提示", {
+        confirmButtonText: "确认",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then((action) => {
+          this.$message({
+            message: "删除成功!",
+            type: "success",
+            showClose: true,
+            duration: 1500,
+          });
+        })
+        .catch(() => {});
+    },
+  },
+};
+</script>
+<style scoped lang="scss">
+.page {
+  padding: 15px;
+  background-color: #fff;
+  border-radius: 5px;
+  .course_data {
+    margin-top: 25px;
+    display: block;
+    .proness {
+      margin-top: 20px;
+      display: flex;
+      justify-content: center;
+    }
+  }
+  .flex-box {
+    margin-top: 5px;
+    flex-wrap: wrap;
+    justify-content: space-between;
+    .userLi {
+      padding-top: 5px;
+      cursor: pointer;
+      width: 70px;
+      overflow: hidden;
+      text-overflow: ellipsis;
+      white-space: nowrap;
+      word-break: break-all;
+      text-align: center;
+      margin: 10px 5px;
+      border-radius: 5px;
+      box-sizing: border-box;
+      &.active {
+        border: 1px solid #409eff;
+        span {
+          color: #409eff;
+        }
+      }
+    }
+  }
+}
 </style>

+ 318 - 14
src/course/statistics/home.vue

@@ -1,24 +1,328 @@
 <template>
-<div>
-    statistics
-</div>
+  <div class="page">
+    <el-container direction="vertical">
+      <el-tabs v-model="activeIndex" @tab-click="handleClick">
+        <el-tab-pane label="经销商订购情况" name="1"> </el-tab-pane>
+        <el-tab-pane label="课程订购情况" name="2"></el-tab-pane>
+      </el-tabs>
+      <el-header height="40px">
+        <div class="flex-box">
+          <el-date-picker
+            v-model="searchTime"
+            type="daterange"
+            range-separator="至"
+            start-placeholder="开始日期"
+            end-placeholder="结束日期"
+          >
+          </el-date-picker>
+          <div class="search" v-if="activeIndex == '1'">
+            <el-input
+              placeholder="搜索课程"
+              v-model.trim="searchText"
+              @keyup.enter.native="courseSearch"
+            >
+              <i slot="prefix" class="el-input__icon el-icon-search"></i>
+            </el-input>
+          </div>
+          <div class="search" v-else>
+            <el-input
+              placeholder="搜索经销商"
+              v-model.trim="searchDealer"
+              @keyup.enter.native="dealerSearch"
+            >
+              <i slot="prefix" class="el-input__icon el-icon-search"></i>
+            </el-input>
+          </div>
+          <el-select v-model="sortValue" placeholder="排序">
+            <el-option
+              v-for="item in sortOptions"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            >
+            </el-option>
+          </el-select>
+        </div>
+      </el-header>
+      <el-container direction="vertical">
+        <el-table :data="recordList" border stripe>
+          <el-table-column label="经销商" align="center" v-if='activeIndex == "1"'>
+            <template slot-scope="scope">{{ scope.row.dealer_name }}</template>
+          </el-table-column>
+          <el-table-column
+            prop="course_name"
+            label="课程标题"
+            align="center"
+            v-if='activeIndex == "2"'
+          ></el-table-column>
+          <el-table-column label="时间区间" align="center">
+            <template slot-scope="scope"
+              >{{ scope.row.satet_time }}-{{ scope.row.end_time }}</template
+            >
+          </el-table-column>
+          <el-table-column
+            prop="sale"
+            label="经销商订购量(套)"
+            align="center"
+          ></el-table-column>
+          <el-table-column label="操作" align="center">
+            <template slot-scope="scope">
+              <el-button type="text" size="default" @click="toDetail(scope.row)"
+                >查看明细</el-button
+              >
+            </template>
+          </el-table-column>
+        </el-table>
+      </el-container>
+      <div class="proness">
+        <el-pagination
+          background
+          layout="prev, pager, next"
+          @prev-click="prevPage()"
+          @next-click="nextPage()"
+          @current-change="curPageChange()"
+          :current-page.sync="page.cur"
+          :page-size="page.size"
+          :total="page.total"
+          :hide-on-single-page="true"
+        >
+        </el-pagination>
+      </div>
+    </el-container>
+    <el-dialog
+      title="记录明细"
+      :visible.sync="showDetail"
+      width="50%"
+      center
+      @close="cancle()"
+    >
+      <el-table :data="recordDetails" border stripe>
+        <el-table-column label="经销商" align="center" v-if='activeIndex == "2"'>
+          <template slot-scope="scope">{{ scope.row.dealer_name }}</template>
+        </el-table-column>
+        <el-table-column
+          prop="course_name"
+          label="课程标题"
+          align="center"
+          v-if='activeIndex == "1"'
+        ></el-table-column>
+        <el-table-column label="名额变动数量" align="center">
+          <template slot-scope="scope"
+            >{{ scope.row.direction == 'to'?'-':'+' }}{{ scope.row.num }}</template
+          >
+        </el-table-column>
+        <el-table-column
+          prop="beizhu"
+          label="备注(套)"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="create_time"
+          label="创建时间"
+          align="center"
+        ></el-table-column>
+      </el-table>
+      <div class="proness">
+        <el-pagination
+          background
+          layout="prev, pager, next"
+          @prev-click="prevPage(1)"
+          @next-click="nextPage(1)"
+          @current-change="curPageChange(1)"
+          :current-page.sync="page1.cur"
+          :page-size="page1.size"
+          :total="page1.total"
+          :hide-on-single-page="true"
+        >
+        </el-pagination>
+      </div>
+    </el-dialog>
+  </div>
 </template>
 
 <script>
 export default {
-  name: '',
+  name: "",
   components: {},
-    props: [],
-  data () {
+  props: [],
+  data() {
     return {
-    }
+      page:{
+        total:1000,
+        size:10,
+        cur:1
+      },
+      page1:{
+        total:50,
+        size:10,
+        cur:1
+      },
+      showDetail: false,
+      searchTime: "",
+      searchText: "",
+      searchDealer: "",
+      activeIndex: "1",
+      sortValue: 0,
+      sortOptions: [
+        {
+          label: "默认",
+          value: 0,
+        },
+        {
+          label: "时间排序",
+          value: 1,
+        },
+        {
+          label: "卖出数量",
+          value: 2,
+        },
+      ],
+      recordList: [
+        {
+          id: 154465,
+          dealer_name: "张三",
+          satet_time: "2023-2-15",
+          end_time: "2023-5-11",
+          sale: 440,
+          course_name: "经济讲堂1",
+        },
+        {
+          id: 154433,
+          dealer_name: "李四",
+          satet_time: "2023-3-15",
+          end_time: "2023-4-11",
+          sale: 440,
+          course_name: "经济讲堂2",
+        },
+        {
+          id: 154123,
+          dealer_name: "王五",
+          satet_time: "2023-1-15",
+          end_time: "2023-3-11",
+          sale: 440,
+          course_name: "经济讲堂3",
+        },
+      ],
+      recordDetails: [
+        {
+          dealer_name: "张三",
+          course_name: "课程精讲5",
+          direction: "to",
+          num: 10,
+          sale: 100,
+          satet_time: "2022-5-4",
+          end_time: "2022-9-1",
+          beizhu:"哦哦kik尽快",
+          create_time:"2022-1-1"
+        },
+        {
+          dealer_name: "李四",
+          course_name: "课程精讲4",
+          direction: "from",
+          num: 10,
+          sale: 100,
+          satet_time: "2022-5-4",
+          end_time: "2022-9-1",
+          beizhu:"哦哦kik尽快",
+          create_time:"2022-2-1"
+        },
+        {
+          dealer_name: "王五",
+          course_name: "课程精讲3",
+          direction: "from",
+          num: 10,
+          sale: 100,
+          satet_time: "2022-5-4",
+          end_time: "2022-9-1",
+          beizhu:"哦哦kik尽快",
+          create_time:"2022-3-1"
+        },
+        {
+          dealer_name: "小六",
+          course_name: "课程精讲2",
+          direction: "to",
+          num: 10,
+          sale: 100,
+          satet_time: "2022-5-4",
+          end_time: "2022-9-1",
+          beizhu:"哦哦kik尽快",
+          create_time:"2022-6-1"
+        },
+      ],
+    };
   },
-  created () { },
-  mounted () { },
-  methods: { },
-  computed: {}
-}
+  created() {},
+  methods: {
+    // 上一页
+    prevPage(type){
+      if(type){
+        console.log(this.page1)
+      }else{
+        console.log(this.page)
+      }
+    },
+    // 下一页
+    nextPage(type){
+      if(type){
+        console.log(this.page1)
+      }else{
+        console.log(this.page)
+      }
+    },
+    // 切换当前页
+    curPageChange(type){
+      if(type){
+        console.log(this.page1)
+      }else{
+        console.log(this.page)
+      }
+    },
+    // 初始化明细表单并关闭弹窗
+    cancle() {
+      // this.recordDetails=[]
+      this.showDetail = false
+    },
+    // 查看明细
+    toDetail(row) {
+      console.log(row);
+      this.showDetail = true
+    },
+    // 课程搜索
+    courseSearch() {
+      if (this.searchText) {
+        console.log(this.searchText);
+      }
+    },
+    // 经销商名称搜索
+    dealerSearch() {
+      if (this.searchDealer) {
+        console.log(this.searchDealer);
+      }
+    },
+    // 导航标签切换
+    handleClick() {
+      this.searchTime = ''
+      console.log(this.activeIndex);
+    },
+  },
+};
 </script>
-<style scoped lang='scss'>
-
+<style scoped lang="scss">
+.page {
+  padding: 15px;
+  background-color: #fff;
+  border-radius: 5px;
+  .search {
+    margin: 0 20px;
+  }
+  .proness{
+    display: flex;
+    justify-content: center;
+    margin-top: 20px;
+  }
+}
+/deep/ .el-tabs__item.is-active,
+.el-tabs__item:hover {
+  font-weight: 600 !important;
+}
 </style>

+ 21 - 245
src/course/user/login.vue

@@ -32,7 +32,7 @@
       <div class="login-right flex-2" style="position: relative;">
         <div class="login_input">
           <div class="third-login-box">
-            <p class="third-account">微信扫码登录</p>
+            <p class="third-account" @click="getToken">微信扫码登录</p>
              <div class="account-login">
                  <a data-href="/thirdlogin/wechat.do?appId=1006" class="wechat-login" @click="openWx" style="background-image: url(static/images/wechat1.png);"></a>
              </div>
@@ -43,279 +43,55 @@
     <el-dialog title="微信登录" :visible.sync="isShowWxLogin" append-to-body width="500px">
       <div>
         <iframe :src="wxUrl" width="100%" height="400" frameborder="0"></iframe>
-        <!-- <div class="flex-box"><div @click="isShowWxLogin=false" style="color: rgb(0, 110, 255);width: 200px;text-align: center;margin: 0 auto;cursor: pointer;font-size: 16px;">账号登录 <i class="el-icon-right"></i></div></div> -->
       </div>
     </el-dialog>
 
-    <pastDue></pastDue>
   </div>
 </template>
 
 <script>
-import pastDue from '@/components/pastDue.vue';
-import QRCode from 'qrcodejs2';
-import { setToken, getUser, getPasw, setUser, setPasw } from '@/utils/auth';
-import { constants } from 'fs';
-import { timestamps } from '@/utils/index';
-import { validateTel } from '@/utils/validate';
+import { setCourseToken, returnJSEncrypt,_debounce } from '@/utils/auth';
 export default {
   data() {
-    const validatePassword = (rule, value, callback) => {
-      if (value.length < 5) {
-        callback(new Error('密码长度应至少在6位或以上'));
-      } else {
-        callback();
-      }
-    };
     return {
-      checked: true,
-      login_icon_show: false,
-      login_type: false,
-      dialogVisible: false,
-      site_list: [],
-      loginForm: {
-        tel: '',
-        password: ''
-      },
-      loginRules: {
-        tel: [{ required: true, validator: validateTel }],
-        password: [{ required: true, validator: validatePassword }]
-      },
-      passwordType: 'password',
-      loading: false,
-      code_loading: false,
-      code_overdue: false,
-      login_code: '',
-      login_disabled: true,
-      token: '',
       isShowWxLogin:false,
       // wxUrl:process.env.BASE_API+'/wechat/auth/web?ct=1',
       wxUrl:'https://oa.g107.com/wechat/auth/web?ct=1',
-
-      invite_list:{site:{}},//体验公司列表
-      isShowInvite:false,
     };
   },
-  components: { QRCode, pastDue },
   methods: {
-    send(type) {
-      this.$axios('post', '/api/pro/invite/bind', { sn: this.invite_list.sn, type: type }).then(res => {
-          if(type == 2){
-            this.isShowInvite=false;
-            if (this.site_list !== null && this.site_list.length == 0) {
-              //无企业--情况
-              this.$router.push({ name: 'tySelect' });//无企业进入体验账号
-            } else if (this.site_list.length == 1) {  //但企业
-              this.loginBySite(this.site_list[0].site.id);
-            } else {  //多企业
-              this.dialogVisible = true;
-            }
-          }else{
-            this.loginBySite(this.invite_list.site.id);
-          }
-
-      });
+    //临时指定id获取token
+    getToken(){
+      let url = '/mkt/demo/token/wo/'
+      let wxId = '11770'
+      this.$axiosKc('get',`${url}${wxId}`).then((res)=>{
+        // console.log(res)
+        let data = res.data
+        if(data.code == 1){
+          setCourseToken(data.data)
+          this.$message("登陆成功!")
+          this.$router.push('/course')
+        }else{
+          this.$message(data.message)
+        }
+      })
     },
+    // 微信扫码
     openWx(){
       this.isShowWxLogin=true;
     },
-    loginBySite(sid) {
-      this.$axios('post', '/api/pro/employee-login', { site_id: sid }).then(res => {
-        if (res.data.code == 1) {
-          setToken(res.data.data.token);
-          this.$router.push({ path: '/' });
-        }
-      });
-    },
-    showPwd() {
-      if (this.passwordType === 'password') {
-        this.passwordType = 'text';
-      } else {
-        this.passwordType = 'password';
-      }
-    },
-    // 获取邀请详情
-    get_invite() {
-      this.$axios('get', '/api/pro/invite/waiting').then(res => {
-          let list=res.data.data;
-          if(list.length>0){
-            this.invite_list = list[0];
-            this.isShowInvite=true;
-          }
-      });
-    },
-    // 姓名登录
-    handleLogin() {
-      this.$refs.loginForm.validate(valid => {
-        if (valid) {
-          this.loading = true;
-          this.$store.dispatch('LoginByUsername', this.loginForm).then(ret => {
-            if (this.checked) {
-              // 转成DB5并保持在Cookies
-              let user = window.btoa(this.random(5) + this.loginForm.tel + this.random(5));
-              let password = window.btoa(this.random(5) + this.loginForm.password);
-              setUser(user);
-              setPasw(password);
-            }
-            this.site_list = ret.data.account_site;
-            if(ret.data.invitation_wait_count){ //有邀请通知
-              this.get_invite()
-              return false
-            }
-            if (this.site_list !== null && this.site_list.length == 0) {
-              //无企业--情况
-              this.$router.replace({ name: 'tySelect' });//无企业进入体验账号
-            } else if (this.site_list.length == 1) {  //但企业
-              this.loginBySite(this.site_list[0].site.id);
-            } else {  //多企业
-              this.dialogVisible = true;
-            }
-
-        }).finally(err => {
-          this.loading = false;
-        });
-        } else {
-          return false;
-        }
-      });
-    },
-
-    random(num) {
-      let name = [];
-      for (let i = 0; i < num; i++) {
-        name.push(Math.floor(Math.random() * 10));
-      }
-      return name.join('');
-    },
-    switchbtn() {
-      this.login_icon_show = !this.login_icon_show;
-      this.$setCache('login_code', '1');
-      this.login_code = this.$getCache('login_code');
-    },
-    get_code() {
-      this.code_loading = true;
-      this.code_overdue = false;
-      this.$axiosUser('post', '/api/pro/generate/qrcode').then(res => {
-        this.token = res.data.data.token;
-        this.$nextTick(() => {
-          this.qrcode();
-        });
-        this.get_code_info();
-      }).finally(() => {
-          this.code_loading = false;
-      });
-    },
-    get_code_info() {
-      this.$axiosUser('get', '/api/pro/scan/info', { params: { token: this.token } })
-        .then(res => {
-          if (res.data.code == 1) {
-            switch (res.data.data.code) {
-              case 400:
-                this.code_overdue = true;
-                this.$message.error(res.data.data.code_remark);
-                break;
-              case 1200:
-                setTimeout(() => {
-                  this.get_code_info();
-                }, 600);
-                break;
-              case 1201:
-                this.code_overdue = true;
-                break;
-              case 1202:
-                setTimeout(() => {
-                  this.get_code_info();
-                }, 600);
-                break;
-              case 1203:
-                setTimeout(() => {
-                  this.get_code_info();
-                }, 600);
-                break;
-              case 1204:
-                this.code_overdue = true;
-                break;
-              default:
-                alert('');
-            }
-          }
-        })
-        .finally(() => {
-          this.code_loading = false;
-        });
-    },
-
-    //  生成二维码
-    qrcode() {
-      let code = this.$serverdomain + '/#/login_token?' + this.token;
-      let qrcode = new QRCode('qrcode', {
-        width: 200,
-        height: 200, // 高度
-        text: code // 二维码内容
-        // render: 'canvas' ,   // 设置渲染方式(有两种方式 table和canvas,默认是canvas)
-        // background: '#f0f',   // 背景色
-        // foreground: '#ff0'    // 前景色
-      });
-    },
+    // 清缓存
     clearData() {
-      const newNav = this.$getCache('newNav');
-      const initImg = this.$getCache('initImg');
-      const noticeId = this.$getCache('noticeId');
       localStorage.clear();
       sessionStorage.clear();
-      if (newNav) {
-        this.$setCache('newNav', true);
-      }
-      if (initImg) {
-        this.$setCache('initImg', true);
-      }
-      if (noticeId) {
-        this.$setCache('noticeId', noticeId);
-      }
-    }
-  },
-  watch: {
-    login_code(val) {
-      if (val == '1') {
-        this.get_code();
-      }
-    },
-    loginForm: {
-      handler(newV, oldV) {
-        if (newV.tel != '' && newV.tel != '') {
-          this.login_disabled = false;
-        } else {
-          this.login_disabled = true;
-        }
-      },
-      immediate: true,
-      deep: true
     }
   },
   created() {
     this.clearData(); //进入登录界面,清除本地缓存,主要是避免用户意外清除cookies后造成本地缓存依然存在,重新登陆后显示上次的缓存,或特殊情况本地缓存未清空又登录别的账号。
-    var lett = this;
-    document.onkeydown = function(e) {
-      var key = window.event.keyCode;
-      if (key == 13) {
-        lett.handleLogin();
-      }
-    };
-    document.title = '功道云-积分系统用户登录';
-    this.$setCache('login_code', '0');
-  },
-  mounted() {
-    if (getUser()) {
-      let getuser = window.atob(getUser());
-      this.loginForm.tel = getuser.substr(5, 11);
-    }
-    if (getPasw()) {
-      let getpasw = window.atob(getPasw());
-      this.loginForm.password = getpasw.slice(5);
-    }
+    document.title = '功道云-课程营销用户登录';
   },
   destroyed() {
-    this.$setCache('login_code', '0');
+    // this.$setCache('login_code', '0');
   }
 };
 </script>

+ 5 - 0
src/course/utils/index.js

@@ -0,0 +1,5 @@
+export function filterWhite(list,path){
+    return list.some((item)=>{
+        return item.includes(path)
+    })
+}

+ 23 - 14
src/permission.js

@@ -3,15 +3,18 @@ import store from './store'
 import Vue from 'vue'
 import NProgress from 'nprogress'
 import 'nprogress/nprogress.css'
-import {getToken,getCache} from '@/utils/auth'
+import { getToken, getCache, getCourseToken } from '@/utils/auth'
 
 NProgress.configure({
   showSpinner: false
 })
-
+function filterWhite(path) {
+  return (path.includes('/course/dealerTeam/') || path.includes('/course/courseEdit/') || path.includes('/course/dealerEdit/') || path.includes('/course/courseRecord/'))
+}
 // 免登名单
-const whiteList = ['/login','/loginbytoken','/course','/courseLogin','/reg','/forgetPwd','/resetPwd','/android','/bindingPhone','/demo','/swiperShow', '/weixin','/screen','/screenSan','/tySelect']
-
+const whiteList1 = ['/login', '/loginbytoken', '/reg', '/forgetPwd', '/resetPwd', '/courseLogin', '/android', '/bindingPhone', '/demo', '/swiperShow', '/weixin', '/screen', '/screenSan', '/tySelect']
+const whiteList2 = ['/course', '/course/statistics', '/course/adminSetting', '/course/courseManage','/course/courseCreate', '/course/dealerManage']
+const whiteList = whiteList1.concat(whiteList2)
 router.beforeEach((to, from, next) => {
   if (Vue.$axiosUserRequestList.length > 0) { // 强行中断时才向下执行
     Vue.$axiosUserRequestList.forEach(item => {
@@ -19,25 +22,31 @@ router.beforeEach((to, from, next) => {
     })
   }
   NProgress.start()
-  if (getToken()) {
-    store.dispatch('get_point_types').then((res) => {})
-    store.dispatch('get_site_info').then((res) => {})
-    store.dispatch('get_account_info').then((res) => {})
-    store.dispatch('get_employee_map').then((res) => {}) // 取得员工列表的地图
-    store.dispatch('get_employee_map_all').then((res) => {}) // 取得员工列表的地图
-    store.dispatch('get_dept_tree').then((res) => {}) // 获取部门树型结构列表
+  if (getToken() && (whiteList2.indexOf(to.path) == -1 || !filterWhite(to.path))) {
+    store.dispatch('get_point_types').then((res) => { })
+    store.dispatch('get_site_info').then((res) => { })
+    store.dispatch('get_account_info').then((res) => { })
+    store.dispatch('get_employee_map').then((res) => { }) // 取得员工列表的地图
+    store.dispatch('get_employee_map_all').then((res) => { }) // 取得员工列表的地图
+    store.dispatch('get_dept_tree').then((res) => { }) // 获取部门树型结构列表
     if (to.path === '/login') {
-      next({path: '/'})
+      next({ path: '/' })
       NProgress.done()
     } else {
       if (!store.getters.user_info.id) { // 判断当前用户是否已拉取完user_info信息
-        store.dispatch('getUserInfo').then(res =>{next()})
+        store.dispatch('getUserInfo').then(res => { next() })
       } else {
         next()
       }
     }
+  } else if (whiteList2.indexOf(to.path) !== -1 || filterWhite(to.path)) {
+    if (getCourseToken()) {
+      next()
+    } else {
+      next('courseLogin')
+    }
   } else {
-    if (whiteList.indexOf(to.path) !== -1 || window.location.href.indexOf('loginbytoken/') !== -1) { // 在免登录白名单,直接进入
+    if (whiteList1.indexOf(to.path) !== -1 || window.location.href.indexOf('loginbytoken/') !== -1) { // 在免登录白名单,直接进入
       next()
     } else {
       next('/login') // 否则全部重定向到登录页

+ 1 - 0
src/point/views/statistics/dept_rank.vue

@@ -706,6 +706,7 @@ export default {
       return data;
     },
     getEmployeeList() {
+      console.log(123)
       this.$axiosUser('get', '/api/pro/employee/index', { dept_id: this.formData.dept_id }, 'v2').then(res => {
           this.employee_map = res.data.data.list;
       })

+ 42 - 0
src/router/course.js

@@ -14,6 +14,20 @@ const routes = [
         label: '课程管理',
         meta: {},
     },
+    {
+        path: 'courseEdit/:id',
+        name: 'courseEdit',
+        component: () => import('@/course/courseManage/create'),
+        label: '编辑课程',
+        meta: {},
+    },
+    {
+        path: 'courseCreate',
+        name: 'courseCreate',
+        component: () => import('@/course/courseManage/create'),
+        label: '创建课程',
+        meta: {},
+    },
     {
         path: 'dealerManage',
         name: 'dealerManage',
@@ -21,6 +35,34 @@ const routes = [
         label: '经销商管理',
         meta: {},
     },
+    {
+        path: 'dealerTeam/:id',
+        name: 'dealerTeam',
+        component: () => import('@/course/dealerManage/home'),
+        label: '经销商团队',
+        meta: {},
+    },
+    {
+        path: 'dealerEdit/:id',
+        name: 'dealerEdit',
+        component: () => import('@/course/dealerManage/edit'),
+        label: '经销商编辑',
+        meta: {},
+    },
+    {
+        path: 'dealerCreate',
+        name: 'dealerCreate',
+        component: () => import('@/course/dealerManage/edit'),
+        label: '经销商创建',
+        meta: {},
+    },
+    {
+        path: 'courseRecord/:id',
+        name: 'courseRecord',
+        component: () => import('@/course/dealerManage/record'),
+        label: '课程交易明细',
+        meta: {},
+    },
     {
         path: 'statistics',
         name: 'courseManage',

+ 0 - 1
src/router/index.js

@@ -502,7 +502,6 @@ const constantRouterMap = [
 ]
 constantRouterMap[0].children.push(...performanceRouter, ...okrRouter, ...examineRouter);
 constantRouterMap[1].children.push(...courseRouter);
-console.log(constantRouterMap)
 export default new VueRouter({
   // mode: 'history',
   routes: constantRouterMap,

+ 2 - 2
src/utils/axiosKc.js

@@ -138,8 +138,8 @@ export default (type, url, data, versions, Content_Type, transform,isToken) => {
   if (transform) {
     transformRequest = transform
   }
-  if (getCache('courseAccountToken')) {
-    Token = getCache('courseAccountToken');
+  if (getCache('Course-Token')) {
+    Token = getCache('Course-Token');
   }
   if(isToken){
     Token=isToken