guojy 1 年之前
父节点
当前提交
31ff9b614e

+ 11 - 2
src/components/upload.vue

@@ -46,6 +46,10 @@
         }
       },
       data: Object,
+      coursePath:{
+        type:String,
+        default:null
+      },
       multiple: Boolean,
       list_type:{
         type: String,
@@ -309,9 +313,14 @@
         const url = 'https://integralsys.oss-cn-shenzhen.aliyuncs.com'
         let date = moment().format('YYYY/MM/DD')
         let param = new FormData()
-        let site_id = this.$getCache('site_info').id
+        let site_id
+        if(this.coursePath){
+          site_id = this.coursePath
+        }else{
+          site_id = this.$getCache('site_info').id
+        }
         let randomStr = this.random_string(32)
-        let key = 'intesys/' + site_id+ '/' + date + '/' + randomStr +'/'+ photoName
+        let key = 'intesys/' + site_id + '/' + date + '/' + randomStr +'/'+ photoName
         // let loadingInstance = Loading.service({});
         param.append('Filename', photoName)
         param.append('key', key)

+ 101 - 86
src/course/courseManage/create.vue

@@ -2,29 +2,30 @@
 
 <template>
   <div class="pjc">
-    <el-page-header @back="$router.go(-1)" :content="title"></el-page-header>
-    <h3>{{ title }}</h3>
-    <el-form :model="courseDeail" label-width="110px">
-      <el-form-item label="课程名称:">
-        <el-input :maxlength="50" v-model.trim="courseDeail.name" style="width: 40%" placeholder="输入课程名称,最多50字符"></el-input>
+    <el-page-header @back="$router.go(-1)" :content="title" style="margin-bottom: 30px;"></el-page-header>
+    <!-- <h3>{{ title }}</h3> -->
+    <el-form :model="courseDeail" label-width="110px" :rules="rules">
+      <el-form-item label="课程名称:" prop="name">
+        <el-input :maxlength="30"  show-word-limit v-model.trim="courseDeail.name" style="width: 40%" placeholder="输入课程名称,最多30字符"></el-input>
       </el-form-item>
-      <el-form-item label="预览图:">
-        <div style="width: 68px" @click="showSelectImg(1)">
-          <userImage
+      <el-form-item label="预览图:" prop="thumb">
+        <div style="display: flex;">
+          <div style="cursor: pointer;margin-right: 10px;" @click="showApm(courseDeail.thumb)">
+            <userImage
             v-if="courseDeail.thumb"
-            width="68px"
-            height="68px"
+            width="100px"
+            height="100px"
             radius="5px"
             :img_url="courseDeail.thumb"
             :user_name="courseDeail.name"
-            style="cursor: pointer"
           ></userImage>
-          <div v-else class="cursor">
-            <div>+</div>
+          </div>
+          <div class="cursor"  @click="showSelectImg(1)">
+            <div><i class="el-icon-plus"></i></div>
           </div>
         </div>
       </el-form-item>
-      <el-form-item label="价格:">
+      <el-form-item label="价格:" prop="price">
         <el-input-number
           v-model="courseDeail.price"
           :min="0"
@@ -40,39 +41,18 @@
         >
         </el-switch>
       </el-form-item>
-      <el-form-item label="课程介绍:">
-        <div style="display: flex;">
-          <div class="img_all">
-            <template v-for="(item, index) in courseImages">
-              <div class="imgout">
-                <userImage
-                  width="68px"
-                  radius="5px"
-                  height="68px"
-                  :img_url="item"
-                ></userImage>
-                <div class="imgDelete" @click="imgsDelete(index)">
-                  <i class="el-icon-delete" style="color: #FFF;font-size: 18px;"></i>
-                </div>
-              </div>
-            </template>
-          </div>
-          <div class="cursor" @click="showSelectImg(2)">
-            <div>+</div>
-          </div>
-        </div>
-      </el-form-item>
-      <!-- <el-form-item label="课程介绍:">
+      <el-form-item label="课程介绍:" prop="images">
         <uploadOss
           :headers="$xtoken"
           :action="$action"
-          :limit="3"
+          :limit="23"
           list_type="picture-card"
           :accept="$acceptImg"
           :multiple="true"
           ref="clearPicture"
+          coursePath="course"
           :show-file-list="true"
-          :file-list="item.fileList"
+          :file-list="courseDeail.images"
           :on-success="handleFilesSuccess"
           :on-preview="onFilePreView"
           :before-upload="beforeUpload"
@@ -80,7 +60,7 @@
         >
           <i class="el-icon-plus"></i>
         </uploadOss>
-      </el-form-item> -->
+      </el-form-item>
       
       <el-form-item label="课程章节" size="normal">
         <div class="sectionout">
@@ -135,11 +115,12 @@
 </template>
 <script>
 import ImageCropper from "@/components/ImageCropper";
+import uploadOss from '@/components/upload';
 import { validateURL } from "@/utils/validate";
 import {createCourse,updataCourse,getCourseDetail} from '../api'
 export default {
   name: "courseEdit",
-  components: { ImageCropper },
+  components: { ImageCropper,uploadOss },
   data() {
     return {
       curId: 0,
@@ -155,12 +136,29 @@ export default {
         name: "",
         price: 0,
         thumb: "",
-        enable: false,
-        images: "",
+        enable: true,
+        images: [],
         sections: [],
       },
       dialogVisible: false,
       dialogImageUrl: "",
+      rules: {
+          name: [
+            { required: true, message: '请输入课程名称', trigger: 'blur' },
+            { min: 1, max: 30, message: '长度在 1 到 30 个字符', trigger: 'blur' }
+          ],
+          price: [
+            { required: true, message: '请输入课程价格', trigger: 'blur' },
+            { type:'number',min: 1, message: '价格至少为1', trigger: 'blur' }
+          ],
+          thumb: [
+            { required: true, message: '请选择预览图', trigger: 'change' }
+          ],
+          images: [
+            { required: true, message: '请选择介绍图', trigger: 'change' },
+            {type:'array',trigger:'change'}
+          ],
+        }
     };
   },
   computed: {
@@ -173,11 +171,32 @@ export default {
     },
   },
   methods: {
-    //删除介绍图片
-    imgsDelete(index){
-      let list = this.courseDeail.images.split(",");
-      list.splice(index,1)
-      this.courseDeail.images = list.join(',')
+    // 介绍图上传格式
+    beforeUpload(file) {
+      const isJPG = /^image\/(jpeg|png|jpg)$/.test(file.type);
+      const isLt2M = file.size / 1024 / 1024 < 5;
+      if (!isJPG) {
+        this.$message.error('上传图片只能是 JPG,PNG,JPEG 格式!');
+      }
+      if (!isLt2M) {
+        this.$message.error('上传图片大小不能超过 5MB!');
+      }
+      return isJPG && isLt2M;
+    },
+    //介绍图预览
+    onFilePreView(file) {
+      this.showApm(file.url)
+    },
+    // 介绍图删除
+    onFileRemove(file, fileList) {
+      this.courseDeail.images = fileList
+    },
+    // 介绍图上传
+    handleFilesSuccess(response, file, fileList) {
+      let fileListData = fileList.filter(e => {
+        return e.url;
+      });
+      this.courseDeail.images = fileListData
     },
     //章节信息校验
     validateURL() {
@@ -200,10 +219,14 @@ export default {
     uploadToData(data) {
       data.enable = data.enable == 1 ? true : false;
       data.price = Number(data.price);
-      data.images = data.images.join(",");
+      let arr = []
+      data.images.forEach(item=>{
+        arr.push({name:item,url:item})
+      })
+      data.images = arr
       return data;
     },
-    //图片上传成功回调
+    //预览图上传成功回调
     company_img_success(resData) {
       if (this.imgIndex == 1) {
         this.courseDeail.thumb = resData.url;
@@ -219,7 +242,13 @@ export default {
       }
       this.company_img_show = false;
     },
-    //打开上传图片组件
+    // 查看预览图
+    showApm(url){
+      console.log(123)
+      this.dialogVisible = true;
+      this.dialogImageUrl = url;
+    },
+    //打开上传预览图片组件
     showSelectImg(type) {
       this.imgIndex = type;
       this.company_img_show = true;
@@ -229,6 +258,10 @@ export default {
       let data = JSON.parse(JSON.stringify(this.courseDeail));
       data.enable = data.enable ? 1 : 0;
       data.sections = JSON.stringify(data.sections);
+      let arr = data.images.map(item=>{
+        return item.url
+      })
+      data.images = arr.join(',')
       return data;
     },
     // 添加课程
@@ -256,40 +289,17 @@ export default {
           });
         });
     },
-    // 删除图片
-    deleteImage(url, type) {
-      this.$confirm("确定删除图片?", "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning",
-      })
-        .then(() => {
-          if (type) {
-            let newList = this.courseDeail.images.filter((item) => {
-              return item.url !== url;
-            });
-            this.courseDeail.images = newList;
-          } else {
-            this.courseDeail.thumb = [];
-          }
-        })
-        .catch((err) => {
-          this.$message({
-            type: "info",
-            message: "已取消",
-          });
-        });
-    },
     //保存
     iffirm() {
       if (
         !this.courseDeail.name == "" &&
-        !this.courseDeail.images == "" &&
+        this.courseDeail.images.length &&
         !this.courseDeail.thumb == "" &&
-        !this.courseDeail.price !== 0 &&
+        this.courseDeail.price &&
+        this.courseDeail.price !== 0 &&
         this.validateURL()
       ) {
-        this.$confirm("确定保存当前页面信息?", "提示", {
+        this.$confirm("确定保存当前课程信息?", "提示", {
           confirmButtonText: "确定",
           cancelButtonText: "取消",
           type: "info",
@@ -315,7 +325,7 @@ export default {
       } else {
         this.$message({
           type: "warning",
-          message: "用户信息未填写完整",
+          message: "课程信息未填写完整",
         });
       }
     },
@@ -334,7 +344,7 @@ export default {
         console.error(err)
       })
     },
-    //新建课程
+    //保存新建课程
     saveCreate() {
       let data = this.toUpdata();
       createCourse(data).then(res=>{
@@ -352,13 +362,13 @@ export default {
     //判断新建/修改
     init() {
       if (this.$route.params.id == undefined) {
-        this.title = "创建课程";
+        this.title = "添加课程";
         this.courseDeail = {
           name: "",
           price: 0,
           thumb: "",
-          enable: false,
-          images: "",
+          enable: true,
+          images: [],
           sections: [],
         };
       } else {
@@ -453,14 +463,19 @@ export default {
 }
 .cursor {
   & > div {
-    height: 68px;
-    width: 68px;
-    border: 2px dashed #f1f1f1;
+    height: 100px;
+    width: 100px;
+    background-color: #fbfdff;
+    border: 1px dashed #c0ccda;
     border-radius: 5px;
     font-size: 30px;
     display: flex;
     justify-content: center;
     align-items: center;
+    i{
+      font-size: 28px;
+      color: #8c939d;
+    }
   }
 }
 </style>

+ 0 - 5
src/course/courseManage/home.vue

@@ -60,11 +60,6 @@ export default {
       courseList: [],
     };
   },
-  watch: {
-    $route: function () {
-      this.getCourseList();
-    },
-  },
   created() {
     this.getCourseList();
   },

+ 42 - 34
src/course/dealerManage/edit.vue

@@ -103,7 +103,7 @@
           <el-input-number
             v-model="eldiForm.num"
             size="normal"
-            :min="1"
+            :min="0"
             :step="1"
             :controls="true"
           >
@@ -114,9 +114,9 @@
             type="textarea"
             :rows="2"
             v-model="eldiForm.content"
-            placeholder="请输入备注"
-            :maxlength="-1"
-            :show-word-limit="false"
+            placeholder="请输入备注(限100字以内)"
+            :maxlength="100"
+            show-word-limit
             :autosize="{ minRows: 2, maxRows: 5 }"
           >
           </el-input>
@@ -241,7 +241,6 @@ export default {
     },
     //查看明细
     courseRecord(row, index) {
-      console.log(row)
       this.$router.push({
         path: `/course/courseRecord/${this.$route.params.id}/${row.subjectId}`,
         query: {
@@ -251,36 +250,45 @@ export default {
     },
     // 提交名额交易
     confirmSave() {
-      this.$confirm("确定要提交名额交易吗?", "提示", {
-        confirmButtonText: "确认",
-        cancelButtonText: "取消",
-        type: "info",
-      })
-        .then(() => {
-          let amount = Number(
-            `${this.eldiType ? "" : "-"}${this.eldiForm.num}`
-          );
-          let data = {
-            amount: amount,
-            content: this.eldiForm.content,
-          };
-          editDealerCourseNum(
-            this.$route.params.id,
-            this.eldiForm.id,
-            data
-          ).then((res) => {
-            this.$message({
-              message: "交易成功!",
-              type: "success",
-              showClose: true,
-              duration: 1500,
-            });
-            this.cancleDi();
-            this.loading = true
-            this.getList();
-          });
+      if(this.eldiForm.num && this.eldiForm.num>=1){
+        this.$confirm(`确定要提交名额交易吗?`, "提示", {
+          confirmButtonText: "确认",
+          cancelButtonText: "取消",
+          type: "info",
         })
-        .catch(() => {});
+          .then(() => {
+            let amount = Number(
+              `${this.eldiType ? "" : "-"}${this.eldiForm.num}`
+            );
+            let data = {
+              amount: amount,
+              content: this.eldiForm.content,
+            };
+            editDealerCourseNum(
+              this.$route.params.id,
+              this.eldiForm.id,
+              data
+            ).then((res) => {
+              this.$message({
+                message: "交易成功!",
+                type: "success",
+                showClose: true,
+                duration: 1500,
+              });
+              this.cancleDi();
+              this.loading = true
+              this.getList();
+            });
+          })
+          .catch(() => {});
+      }else{
+        this.$message({
+          message: "请输入正确的交易名额",
+          type: "warning",
+          showClose: true,
+          duration: 1500,
+        });
+      }
     },
     //取消弹窗
     cancleDi() {

+ 6 - 20
src/course/dealerManage/home.vue

@@ -36,9 +36,9 @@
       >
         <el-table-column prop="name" label="用户名" align="center">
         </el-table-column>
-        <el-table-column label="微信ID" align="center" min-width="100px">
+        <!-- <el-table-column label="微信ID" align="center" min-width="100px">
           <template slot-scope="scope"> {{ scope.row.unionid }} </template>
-        </el-table-column>
+        </el-table-column> -->
         <el-table-column label="手机号" align="center">
           <template slot-scope="scope"> {{ scope.row.mobile }} </template>
         </el-table-column>
@@ -158,24 +158,9 @@ export default {
         cur: 1,
       },
       teamValue: "",
-      dealerInfo: [
-        {
-          id: 123455,
-          name: "燕小六",
-          unionid: "wx1525155255",
-          mobile: "15699847711",
-          statistics: {
-            saleAmount: 15000,
-            teamAmount: 11,
-          },
-        },
-      ],
+      dealerInfo: [],
     };
   },
-  watch: {
-    // '$route':function(to,from){
-    // }
-  },
   created() {
     this.init();
   },
@@ -189,9 +174,9 @@ export default {
     cancleQr() {},
     creatQrCode() {
       if (!this.qrcodeStatus) {
-        console.log(`${window.location.href.split('/#')[0]}/m/#/courseHome?pid=0`)
+        console.log(`${process.env.BASE_API}/m/#/courseHome?pid=0`)
         this.qrcode = new QRCode(this.$refs.qrCodeUrl, {
-          text: `${window.location.href.split('/#')[0]}/m/#/courseHome?pid=0`, // 需要转换为二维码的内容
+          text: `${process.env.BASE_API}/m/#/courseHome?pid=0`, // 需要转换为二维码的内容
           width: 300,
           height: 300,
           colorDark: "#000000",
@@ -284,6 +269,7 @@ export default {
     // 搜索
     teamSearch() {
       this.loading = true;
+      this.page.cur = 1;
       this.getDealerMap();
     },
     // 切换当前页

+ 12 - 10
src/course/index.vue

@@ -95,16 +95,16 @@ export default {
     return {
       loading: false,
       isLog: false,
-      menuIndex: 1,
+      menuIndex: 2,
       isRouterAlive: true,
       menuArr: [
-        {
-          icon: "#icon-shouye",
-          index: 1,
-          name: "课程首页",
-          path: "/course",
-          show: true,
-        },
+        // {
+        //   icon: "#icon-shouye",
+        //   index: 1,
+        //   name: "课程首页",
+        //   path: "/course",
+        //   show: true,
+        // },
         {
           icon: "#icon-kecheng",
           index: 2,
@@ -129,7 +129,7 @@ export default {
         {
           icon: "#icon-shezhi-xianxing",
           index: 5,
-          name: "管理员设置",
+          name: "设置",
           path: "/course/adminSetting",
           show: true,
         },
@@ -140,6 +140,7 @@ export default {
   watch: {
     //监视路由变化,有变化就缓存导航状态
     $route(to, from) {
+      console.log(to.path)
       var str = to.path;
       this.menuArr.some((item, index) => {
         if (item.path == str) {
@@ -186,6 +187,7 @@ export default {
     //回到首页
     homeUrl() {
       this.$router.push({ path: "/course" });
+      this.$setCache("course_path", 2);
     },
     //跳转相应子页面并缓存当前状态
     openUrl(item) {
@@ -203,7 +205,7 @@ export default {
       }
       setTimeout(() => {
         this.isLog = false;
-      }, 1000);
+      }, 200);
     },
   },
   computed: {

+ 0 - 2
src/course/setting/home.vue

@@ -248,8 +248,6 @@ export default {
     },
     // 删除管理员
     courseDel(row) {
-      console.log(row)
-      console.log(localStorage.getItem('Course-Id'))
       this.$confirm("确定要删除当前用户吗?", "提示", {
         confirmButtonText: "确认",
         cancelButtonText: "取消",

+ 23 - 8
src/course/statistics/home.vue

@@ -105,7 +105,7 @@
       </div> -->
     </el-container>
     <el-dialog
-      title="记录明细"
+      :title="recordTit"
       :visible.sync="showDetail"
       width="70%"
       center
@@ -113,15 +113,26 @@
     >
       <el-table :data="recordDetails" border stripe v-loading="rLoading">
         <el-table-column
-          label="发起人(名额交易发起人)"
+          label="发起人姓名(名额交易发起人)"
+          align="center"
+        >
+          <template slot-scope="scope">{{ scope.row.fromUserName }}</template>
+        </el-table-column>
+        <el-table-column
+          label="发起人手机号"
           align="center"
         >
           <template slot-scope="scope">{{ scope.row.fromUserMobile===0?'平台增加':scope.row.fromUserMobile }}</template>
         </el-table-column>
         <el-table-column
-          label="接收人(名额交易接收人)"
+          label="接收人姓名(名额交易接收人)"
+          align="center"
+        >
+          <template slot-scope="scope">{{ scope.row.toUserName}}</template>
+        </el-table-column>
+        <el-table-column
+          label="接收人手机号"
           align="center"
-          v-if="activeIndex == '2'"
         >
           <template slot-scope="scope">{{ scope.row.toUserMobile===0?'平台扣除':scope.row.toUserMobile}}</template>
         </el-table-column>
@@ -186,6 +197,7 @@ export default {
         cur: 1,
       },
       showDetail: false,
+      recordTit:"记录明细",
       searchTime: null,
       searchText: "",
       searchDealer: "",
@@ -253,11 +265,11 @@ export default {
         data.keyword = this.searchDealer;
       }
       getDealerOrderList(data).then((res) => {
-        this.sortValue = 0;
         this.loading = false
-        this.recordList = res.list;
         this.page.cur = res.current;
         this.page.total = res.total;
+        res.list.sort(this.sortBy('amount', this.sortValue))
+        this.recordList = res.list;
       });
     },
     //获取课程统计列表
@@ -274,11 +286,11 @@ export default {
         data.keyword = this.searchText;
       }
       getCourseOrderList(data).then((res) => {
-        this.sortValue = 0;
         this.loading = false
-        this.recordList = res.list;
         this.page.cur = res.current;
         this.page.total = res.total;
+        res.list.sort(this.sortBy('amount', this.sortValue))
+        this.recordList = res.list;
       });
     },
     //获取指定经销商/课程的订购明细
@@ -330,8 +342,10 @@ export default {
       if (row.userId && !row.subjectId) {
         this.rLoading = true
         this.userId = row.userId;
+        this.recordTit = `${row.userName}的记录明细`
         this.getAssignDrtailList(1);
       } else if (!row.userId && row.subjectId) {
+        this.recordTit = `${row.subjectName}的记录明细`
         this.rLoading = true
         this.subjectId = row.subjectId;
         this.getAssignDrtailList(2);
@@ -350,6 +364,7 @@ export default {
     },
     // 导航标签切换
     handleClick() {
+      this.sortValue= 0;
       this.searchTime = null;
       this.searchText = "";
       this.searchDealer = "";

+ 2 - 3
src/course/user/login.vue

@@ -129,12 +129,11 @@ export default {
     getAccountIdToken(token) {
       getAdminTokenId(token)
         .then((res) => {
-          setCourseToken(res.auToken);
-          setCourseId(res.adminUserId);
           localStorage.setItem("Course-Token", res.auToken);
           localStorage.setItem("Course-Id", res.adminUserId);
+          localStorage.setItem("course_path", 2);
           this.$message({
-            message: "登成功!",
+            message: "登成功!",
             type: "success",
             showClose: true,
             duration: 2000,

+ 13 - 4
src/permission.js

@@ -2,6 +2,7 @@ import router from './router'
 import store from './store'
 import Vue from 'vue'
 import NProgress from 'nprogress'
+import { Message } from 'element-ui'
 import 'nprogress/nprogress.css'
 import { getToken, getCache, getCourseToken } from '@/utils/auth'
 
@@ -12,8 +13,8 @@ function filterWhite(path) {
   return (path.includes('/course/dealerTeam/') || path.includes('/course/courseEdit/') || path.includes('/course/dealerEdit/') || path.includes('/course/courseRecord/'))
 }
 // 免登名单
-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 whiteList1 = ['/login', '/loginbytoken', '/reg', '/forgetPwd', '/resetPwd', '/android', '/bindingPhone', '/demo', '/swiperShow', '/weixin', '/screen', '/screenSan', '/tySelect']
+const whiteList2 = ['/course', '/course/statistics', '/courseLogin', '/course/adminSetting', '/course/courseManage','/course/courseCreate', '/course/dealerManage']
 const whiteList = whiteList1.concat(whiteList2)
 router.beforeEach((to, from, next) => {
   if (Vue.$axiosUserRequestList.length > 0) { // 强行中断时才向下执行
@@ -40,10 +41,18 @@ router.beforeEach((to, from, next) => {
       }
     }
   } else if (whiteList2.indexOf(to.path) !== -1 || filterWhite(to.path)) {
-    if (getCourseToken()) {
+    console.log(to.path)
+    if (localStorage.getItem('Course-Token')||localStorage.getItem('Course-Id')|| to.path == '/courseLogin') {
+      console.log(12)
       next()
     } else {
-      next('courseLogin')
+      Message({
+        message: '未登录!',
+        type:'warning',
+        duration: 2000
+      })
+      console.log(13)
+      next('/courseLogin')
     }
   } else {
     if (whiteList1.indexOf(to.path) !== -1 || window.location.href.indexOf('loginbytoken/') !== -1) { // 在免登录白名单,直接进入

+ 3 - 2
src/router/course.js

@@ -3,8 +3,9 @@ const routes = [
     {
         path: '/',
         name: 'courseHome',
-        component: () => import('@/course/home'),
+        // component: () => import('@/course/home'),
         label: '课程营销首页',
+        redirect:"/course/courseManage",
         meta: {
             keepAlive: true
         },
@@ -15,7 +16,7 @@ const routes = [
         component: () => import('@/course/courseManage/home'),
         label: '课程管理',
         meta: {
-            keepAlive: true
+            keepAlive: false
         },
     },
     {

+ 9 - 1
src/store/modules/course.js

@@ -2,6 +2,8 @@ import {
     getUserInfo,
 } from '@/api/course'
 import { removeAllToken, getCache, setCache } from '@/utils/auth'
+import { Message } from 'element-ui'
+import router from '../../router'
 const courseStore = {
     state: {
         course_account_info: {
@@ -37,10 +39,16 @@ const courseStore = {
             // sessionStorage.clear()
             localStorage.removeItem("Course-Token")
             localStorage.removeItem("Course-Id")
+            router.push('/courseLogin')
+            localStorage.setItem('course_path', 2)
+            Message({
+                message: '退出登录',
+                duration: 2000
+            })
             // Cookies.remove('Course-Token')
             // Cookies.remove("Course-Id")
             // removeAllToken()
-            location.reload() // 重新刷新页面会清空VUEX数据,所以不用清空VUEX
+            // location.reload() // 重新刷新页面会清空VUEX数据,所以不用清空VUEX
         },
     }
 }

+ 16 - 0
src/store/modules/user.js

@@ -269,6 +269,22 @@ const user = {
       }
       location.reload() // 重新刷新页面会清空VUEX数据,所以不用清空VUEX
     },
+    // 清楚本地缓存
+    resetStorage(){
+      localStorage.removeItem('userInfo')
+      localStorage.removeItem('accountToken')
+      localStorage.removeItem('SET_POINT_TYPES')
+      localStorage.removeItem('SET_EMPLOYEE_MAP_ALL')
+      localStorage.removeItem('site_info')
+      localStorage.removeItem('dept_tree')
+      localStorage.removeItem('account_info')
+      localStorage.removeItem('SET_EMPLOYEE_MAP')
+      localStorage.removeItem('dept_tree_pin')
+      localStorage.removeItem('login_code')
+      localStorage.removeItem('loglevel:webpack-dev-server')
+      sessionStorage.clear()
+      removeAllToken()
+    }
   }
 }
 

+ 2 - 2
src/utils/axiosKc.js

@@ -12,10 +12,10 @@ import {
 import qs from 'qs'
 import Vue from 'vue'
 const service = axios.create({
-  // baseURL: process.env.BASE_API,
+  baseURL: process.env.BASE_API,
   // baseURL:'https://oa.g107.com',
   // baseURL:'https://3g954g5149.picp.vip',
-  baseURL:'http://192.168.0.66:8081',
+  // baseURL:'http://192.168.0.66:8081',
   
   timeout: 20000,
   headers: {