guojy 1 ano atrás
pai
commit
fc655bf222

+ 0 - 1
src/api/configget.js

@@ -2,7 +2,6 @@
 import request from '@/utils/request'
 import {getToken} from '@/utils/auth'
 export async function allocations(body){
-    console.log("请求配置")
     if(getToken()){
         let params = {url : body}
         // let params = {url : 'https://qywx.g107.net'}

+ 2 - 2
src/api/login.js

@@ -13,6 +13,6 @@ export function get_employee_map() {
 	return request('get','/api/employee/list')
 }
 //员工详细信息
-export function get_info(token) {
-  return request('get','/api/employee/detail','','token');
+export function get_info() {
+  return request('get','/api/employee/detail');
 }

+ 4 - 4
src/components/body/statistics.vue

@@ -169,7 +169,7 @@ export default {
     const u = navigator.userAgent;
     const isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端
     this.isIos = isIOS
-    this.$store.dispatch('get_user_info', getToken()).then(res => {
+    this.$store.dispatch('get_user_info').then(res => {
       this.getRole_three = getRole_three()
       this.getRole_two = getRole_two()
       this.getRole_four = getRole_four()
@@ -211,7 +211,7 @@ export default {
     getMenu (res) {
       if (!res) { return }
       var menuCommon = window.plus ? JSON.parse(plus.storage.getItem('menuCommon')) : JSON.parse(localStorage.getItem('menuCommon'))
-      var menus = []
+      var menus = [];
       if (menuCommon.length > 0) {
         menuCommon.forEach(itme => { menus.push(this.forEachMenu(itme)) })
       }
@@ -224,7 +224,7 @@ export default {
       }else{
         menus.unshift(this.new_list[0])
       }
-
+      console.log(getRole_four2(),this.getRole_two,'menus'+JSON.stringify(menus))
       this.common_menu = menus
     },
     // 遍历获取常用应用
@@ -609,7 +609,7 @@ export default {
       vm.clu();
     },
     update_message_list: function (vm, data) {
-      vm.$store.dispatch('get_user_info', getToken()).then(res => {
+      vm.$store.dispatch('get_user_info').then(res => {
         vm.chat_msg_session_list(function () {})
         vm.clu();
       })

+ 2 - 2
src/components/common/DateSelectorDropdown.vue

@@ -117,7 +117,7 @@
         } else if (type === 'month') {
           return `${val}月`
         }
-        return `${val}日`
+        return `日`
       },
       deepCopyDate (date) {
         return new Date(date.getFullYear(), date.getMonth(), date.getDate())
@@ -131,7 +131,7 @@
             this.$emit('update:title', startDate.getMonth()+1 +'月')
           }
         } else {
-          this.$emit('update:title', startDate.getDate() + '日')
+          this.$emit('update:title','日')
         }
       },
       onResetDate () {

+ 4 - 5
src/components/common/OssUploader.vue

@@ -2,7 +2,8 @@
   <van-uploader :disabled="disabled" :uploadText="uploadText" :beforeRead="beforeRead" :beforeDelete="image_del"
                 :after-read="_afterRead" :name="name" :accept="accept" v-model="oss_fileList" :maxSize="maxSize"
                 :maxCount="maxCount" :previewImage="previewImage" :previewFullImage="previewFullImage"
-                :imageFit="imageFit" :multiple="multiple" :resultType="resultType"   />
+                :imageFit="imageFit" :multiple="multiple" :resultType="resultType"   
+  />
 </template>
 
 <script>
@@ -94,9 +95,8 @@ export default {
     }
   },
   created () {
-    let self = this
     this.filelist = JSON.parse(JSON.stringify(this.fileList))
-    self.dealImage()
+    this.dealImage()
   },
   methods: {
     _afterRead (file) {
@@ -277,8 +277,6 @@ export default {
       } else {
         this.getSign(file)
       }
-      // 提交图片
-      // Some code
     },
 
     dealImage () {
@@ -333,6 +331,7 @@ export default {
         } else {
           this.oss_fileList = JSON.parse(JSON.stringify(this.fileObj))
         }
+        console.log(JSON.stringify(this.filelist))
         this.$toast.clear()
       }).catch(err => {
         this.$toast.clear()

+ 1 - 1
src/components/ems/invite.vue

@@ -15,7 +15,7 @@
 import request from '@/utils/request';
 import QrcodeVue from 'qrcode.vue';
 import plusShare from '../../../static/js/plusShare.js';
-import { getToken, getUserId } from '@/utils/auth';
+import { getToken } from '@/utils/auth';
 import Vue from 'vue';
 import axios from 'axios';
 

+ 8 - 1
src/components/integral/application_popup/integral.vue

@@ -210,10 +210,16 @@ export default {
       expiryPoints: null,
       reviewer: [],
       detail_data: {},
-      superior_list: this.$store.getters.user_info.employee_detail.superior_list
+      superior_list: [],
     }
   },
   methods: {
+    getUserPoint () {
+      request('get', '/api/employee/detail').then(res => {
+        console.log(res.data.data.user)
+        this.superior_list=res.data.data.user.employee_detail.superior_list
+      })
+    },
     item_del () {
       this.item_show = false
       for (let i in this.item_list) {
@@ -442,6 +448,7 @@ export default {
     }
     this.get_point_types()
     this.get_data()
+    this.getUserPoint();
   }
 }
 </script>

+ 0 - 2
src/components/integral/batchList.vue

@@ -96,7 +96,6 @@
                  v-model="item.reviewer_list"
                  :multi="false"
                  :max="1"
-                 :is_filtration_creator="true"
                  :use_employee_list="true"
                  :employee_list="superior_list"
                ></EmployeeSelectorCell>
@@ -229,7 +228,6 @@
                    v-model="item.reviewer_list"
                    :multi="false"
                    :max="1"
-                   :is_filtration_creator="true"
                    :use_employee_list="true"
                    :employee_list="superior_list">
                  </EmployeeSelectorCell>

+ 1 - 1
src/components/integral/event_detail.vue

@@ -118,7 +118,7 @@ export default {
   data () {
     return {
       loading: true,
-      eventInfo: {remark: {customize: ''}},
+      eventInfo: {remark: {customize: ''},process:[]},
       types_list: {}
     }
   },

+ 5 - 2
src/components/integral/event_list.vue

@@ -36,7 +36,7 @@
               <span>{{ item.remark }}</span>
             </div>
             <div class="event-time__text">
-              <span>{{ item.create_time }}</span>
+              <span>{{ moment(item.event_time).format('YYYY-MM-DD') }}</span>
             </div>
           </div>
         </van-cell-group>
@@ -70,6 +70,7 @@ export default {
       dateItemTitle: '本月',
       deptDropdownItemTitle: '全公司',
       eventData: [],
+      moment:moment,
       searchParams: {
         dept_ids: null,
         end_day: null,
@@ -124,7 +125,9 @@ export default {
     this.get_point_types()
   },
   methods: {
-    keyVal: _debounce(function () { this.refresh(function () {}) }),
+    keyVal:_debounce(function () {
+      this.refresh(function () {})
+    }),
     get_point_types () {
       let self = this
       for (let i in this.$store.getters.point_types) {

+ 8 - 10
src/components/integral/integral_application.vue

@@ -111,20 +111,18 @@ export default {
           self.$toast.clear()
           if (res.data.code == 1) {
             if (res.data.data.list.some(item => item.status != 0)) {
-              self.$toast.success(res.data.msg)
-              self.fromData = {
+              this.$toast.success("申请成功")
+              this.fromData = {
                 items: [{}]
               }
-              self.itemData = {}
-              if (window.plus) {
-                plus.storage.setItem('callback_data', JSON.stringify({detail_url: this.$route.path, result: res.data.data}))
-              } else {
-                localStorage.setItem('callback_data', JSON.stringify({detail_url: this.$route.path, result: res.data.data}))
-              }
-              this.$router.push({path: '/callback_new'})
+              this.itemData = {}
+              setTimeout(()=>{
+                this.$router.go(-1)
+              },500)
+              // localStorage.setItem('callback_data', JSON.stringify({detail_url: this.$route.path, result: res.data.data}))
+              // this.$router.push({path: '/callback_new'})
             } else {
               let index = res.data.data.list.findIndex(item => item.status == 0)
-              // self.$notify({ type: 'danger', message: '第' + (index + 1) + '条审批者超出管理范围'})
               self.$notify({ type: 'danger', message: res.data.data.list[0].msg})
             }
           } else {

+ 4 - 4
src/components/integral/integral_application_list.vue

@@ -24,10 +24,10 @@
               <span class="title" style="padding-right: 0.2rem;">{{item.remark.customize || item.remark.rule}}</span>
             </template>
             <template slot="right-icon">
-              <span class="point_text" v-show="item.status != 2" :class="item.review_point > 0 ? 'color_green':'color_red'">
-                <span v-show="item.review_point > 0">+</span>
-                {{item.review_point}} {{$isPt_id(item.pt_id)}}
-              </span>
+				<span class="point_text">
+				  <span class="red" v-if="item.review_point > 0">+{{ item.review_point }}{{$isPt_id(item.pt_id)}}</span>
+				  <span class="green" v-if="item.review_point < 0">{{ item.review_point }}{{$isPt_id(item.pt_id)}}</span>
+				</span>
             </template>
             <template slot="label">
               <div class="clear" style="margin-top: 0.3rem">

+ 2 - 4
src/components/integral/integral_entry_b.vue

@@ -23,8 +23,7 @@
             </template>
           </van-cell>
           <van-cell required>
-            <Mtextarea v-model="item.remark" placeholder="请输入申请事由(最多50字)" :text_max="100" :imgs_max="3" images speech
-                       :imgs.sync="item.files"></Mtextarea>
+            <Mtextarea v-model="item.remark" name="申请事由" v-validate="'required|max:100'" placeholder="请输入申请事由(最多100字)" :text_max="100" :imgs_max="3" images speech :imgs.sync="item.files"></Mtextarea>
           </van-cell>
           <van-field v-model="item.point" label="分值" placeholder="请输入分值" required/>
           <DateCell required title="选择日期" v-model="item.event_time"></DateCell>
@@ -39,8 +38,7 @@
             </template>
           </van-cell>
           <van-cell required>
-            <Mtextarea v-model="item.remark" placeholder="请输入申请事由(最多100字)" :text_max="100" :imgs_max="3" images speech
-                       :imgs.sync="item.files"></Mtextarea>
+            <Mtextarea v-model="item.remark" name="申请事由" v-validate="'required|max:100'" placeholder="请输入申请事由(最多100字)" :text_max="100" :imgs_max="3" images speech :imgs.sync="item.files"></Mtextarea>
           </van-cell>
           <CategorySelectorCell title="选择分类" v-model="item.rule_cate" :max="1" :multi="false" required></CategorySelectorCell>
           <van-field v-model="item.point" label="分值" placeholder="请输入分值" required/>

+ 4 - 2
src/components/integral/integral_entry_list.vue

@@ -23,7 +23,7 @@
             <div style="padding-left: 0.72rem; margin-left: 0.2rem; font-size: 0.32rem">
               <div class="remark re-item__status" style="font-size:0.32rem;color:#666">{{item.remark}}</div>
               <div class="clear" style="margin-top: 0.3rem; font-size: 0.28rem">
-                <span class="fl color_ccc">{{item.event_time}}</span>
+                <span class="fl color_ccc">{{moment(item.event_time).format('YYYY-MM-DD')}}</span>
                 <span v-if="item.point < 0" class="fr color_red bg">扣分成功</span>
                 <span v-else class="fr color_green bg">奖分成功</span>
                 <!-- <span class="fr color_green bg">{{item.point < 0?'扣分成功':'奖分成功'}}</span> -->
@@ -41,7 +41,7 @@
             <div style="padding-left: 0.72rem; margin-left: 0.2rem; font-size: 0.32rem">
               <div class="remark" v-show="item.remark" style="font-size:0.32rem;color:#666">{{item.remark.customize}}</div>
               <div class="clear" style="margin-top: 0.3rem; font-size: 0.24rem">
-                <span class="fl color_ccc">{{item.event_time}}</span>
+                <span class="fl color_ccc">{{moment(item.event_time).format('YYYY-MM-DD')}}</span>
                 <span class="fr color_yellow bg" v-show="item.status == 0" >待审批</span>
                 <span class="fr color_red bg" v-show="item.status == 2" >被驳回</span>
               </div>
@@ -60,6 +60,7 @@ import userImage from '@/components/common/user_image'
 import Vue from 'vue'
 import {Tab, Tabs, Search} from 'vant'
 import {_debounce} from '@/utils/auth'
+import moment from 'moment'
 Vue.use(Tab).use(Tabs).use(Search)
 export default {
   data () {
@@ -69,6 +70,7 @@ export default {
       type: 'all',
       show_list: false,
       isInfinite: true,
+      moment:moment,
       filter: {
         page: 1,
         type: 'all',

+ 1 - 1
src/components/integral/integral_entry_n.vue

@@ -88,7 +88,7 @@
               ></EmployeeSelectorCell>
             </div>
             <van-cell required>
-              <Mtextarea v-model="item.remark"  placeholder="请输入事件内容" name="申请事由"  v-validate="'required|max:100'" :text_max="100" :imgs_max="3" images speech:imgs.sync="item.files"></Mtextarea>
+              <Mtextarea v-model="item.remark"  placeholder="请输入事件内容" name="申请事由"  v-validate="'required|max:100'" :text_max="100" :imgs_max="3" images speech :imgs.sync="item.files"></Mtextarea>
             </van-cell>
           </van-cell-group>
         </div>

+ 15 - 23
src/components/pk/add_log.vue

@@ -5,7 +5,7 @@
       <scroller>
         <van-cell-group>
           <van-cell title="选择团队" required is-link @click="select_teams = true" :value="select_teams_item.name?select_teams_item.name:'请选择团队'"></van-cell>
-          <van-cell title="选择人员" v-if="log_type == 'employee'" required is-link @click="select_employee = true" :value="employee_btn">
+          <van-cell title="选择人员" v-if="log_type == 'employee'" required is-link @click="openUser" :value="employee_btn">
             <template slot="default">
               <span class=""><Wxopendata type="userName" :openid="employee_btn"></Wxopendata></span>
             </template>
@@ -56,28 +56,15 @@
 
       <van-calendar v-model="showCalendar" color="#238dfa" @confirm="calendarConfirm" />
 
-      <!-- 人员选择 -->
       <van-popup v-model="select_employee" class="employee_popup">
-        <div style="height: 20px;background-color: #26A2FF;"></div>
         <van-nav-bar title="选择员工" left-text="取消" @click-left="employee_cancel" right-text="完成" @click-right="employee_Confirm" ></van-nav-bar>
         <van-checkbox-group v-model="employee_result" ref="checkboxGroup" :max="10" :label-disabled="false">
           <van-cell-group>
-            <!--  -->
-            <van-cell v-for="(item, index) in employee_list" clickable :key="index" :title="item.name">
-              <van-checkbox slot="icon" :name="item" ref="checkboxes" />
-              <template slot="title">
-                <img src="static/images/join_review.jpg" class="employee_img" alt="">
-                <span class="employee_name"><Wxopendata type="userName" :openid="item.name"></Wxopendata></span>
-              </template>
-            </van-cell>
+            <div style="padding: 0.24rem 0.32rem;font-size: 0.32rem;" :key="index" class="userActive" v-for="(item, index) in employee_list">
+                <van-checkbox :name="item"><Wxopendata type="userName" :openid="item.name"></Wxopendata></van-checkbox>
+            </div>
           </van-cell-group>
         </van-checkbox-group>
-
-<!--
-        <van-checkbox-group v-model="result" ref="checkboxGroup" >
-          <van-checkbox v-for="(item,index) in employee_list" :key="index" :name="item.id">{{item.name}}</van-checkbox>
-        </van-checkbox-group> -->
-
       </van-popup>
 
     </div>
@@ -122,13 +109,14 @@ export default {
       remark: ''
     }
   },
-  mounted () {
-
-  },
-  // 组件
-  components: {},
-  // 方法
   methods: {
+    openUser(){
+      if(!this.select_teams_item.name){
+        this.$toast('请先选择团队');
+        return false
+      }
+      this.select_employee = true
+    },
     // 保存
     sava () {
       let self = this
@@ -166,6 +154,7 @@ export default {
       let arr_name = []
       this.employee_result_id = []
       this.employee_btn = ''
+      console.log(this.employee_result)
       for (let i = 0; i < this.employee_result.length; i++) {
         arr_name.push(this.employee_result[i].name)
         this.employee_result_id.push(this.employee_result[i].id)
@@ -236,6 +225,9 @@ export default {
 }
 </script>
 <style scoped>
+  .userActive:active{
+    background-color: #F2F3F5;
+  }
   .body_com {
     height: calc(100% - 1rem);
     position: relative;

+ 284 - 327
src/components/pk/list_pk.vue

@@ -2,10 +2,10 @@
   <div class="teampk_box">
     <van-nav-bar :title="title" left-text="返回" @click-left="$route_back" left-arrow style="font-size:0.32rem;"></van-nav-bar>
     <div class="body_com has_header">
-      <van-tabbar class="tabbar_list" v-model="active1" :fixed="false" @change="onChange">
+      <van-tabbar class="tabbar_list" v-model="active" :fixed="false">
         <van-tabbar-item name="running" class="list">进行中</van-tabbar-item>
-        <van-tabbar-item name="noStart" class="list">未开始</van-tabbar-item>
-        <van-tabbar-item name="over" class="list">已结束</van-tabbar-item>
+        <van-tabbar-item name="waiting" class="list">未开始</van-tabbar-item>
+        <van-tabbar-item name="end" class="list">已结束</van-tabbar-item>
       </van-tabbar>
       <div ref="pkNoticeRef" style="clear: both;">
         <van-notice-bar v-if="novice" wrapable mode="closeable" @close="closeNotice">团队PK的积分是独立的,不计入A、B分排名和统计</van-notice-bar>
@@ -13,375 +13,332 @@
       <van-search placeholder="请输入搜索团队名称" v-model="filter.keyword" />
 
       <div class="pk-list-block" :style="{ height: novice ? noviceHeight : 'calc(100% - 2.85rem)' }">
-        <scroller ref="my_scroller" :on-refresh="refresh" :on-infinite="infinite">
-          <noData :detail_text="tips" :list="list" />
+        <scroller ref="scroller" :on-refresh="refresh" :on-infinite="infinite" noDataText="没有了噢" :list="list">
           <van-panel class="pk_list" v-for="(item, index) in list" :key="index" :title="item.name">
             <div class="teams_list_time">时间:{{ item.start_time }} 至 {{ item.end_time }}</div>
             <div class="teams_btn">
               <van-button v-if="item.creator_id == employee_id && filter.status == 'waiting'" type="danger" @click="del_pk(item)" size="small">删除</van-button>
-
               <van-button
                 v-if="(item.creator_id == employee_id || returnEm(item.managers)) && (filter.status == 'waiting' || filter.status == 'running')"
-                class="set"
-                plain
-                hairline
-                type="info"
-                @click="set_pk(item)"
-                size="small"
-              >
+                class="set" plain hairline type="info" @click="set_pk(item)" size="small">
                 设置
               </van-button>
               <span><van-button class="see" type="info" @click="read_pk(item)" size="small">查看</van-button></span>
-
-              <!-- <span v-if="is_creator == 1 || item.creator_id == employee_id"><van-button class="see" type="info" @click="read_pk(item)" size="small">查看</van-button></span> -->
-<!--              <span v-else>
-                <van-button
-                  v-for="(d, i) in item.employees"
-                  :key="i"
-                  v-if="d.id == employee_id || item.managers[0].id == employee_id"
-                  class="see"
-                  type="info"
-                  @click="read_pk(item)"
-                  size="small"
-                >
-                  查看
-                </van-button>
-              </span> -->
             </div>
           </van-panel>
+           <noData :detail_text="tips" :list="list"/>
         </scroller>
       </div>
-      <div class="create_pk_box" :class="{ isIos: isIos }" v-if="this.getRole_noe"><van-button class="create_pk" type="info" block @click="create_pk">创建PK</van-button></div>
+      <div class="create_pk_box" :class="{ isIos: isIos }" v-if="this.getRole_noe"><van-button class="create_pk"
+          type="info" block @click="create_pk">创建PK</van-button></div>
     </div>
   </div>
 </template>
 
 <script>
-import request from '@/utils/request'
-import Vue from 'vue'
-import { getRole_noe, _debounce } from '@/utils/auth'
-import { Tab, Tabs, Search, List, Tabbar, TabbarItem, panel, NoticeBar } from 'vant'
-Vue.use(Tab)
-  .use(Tabs)
-  .use(Search)
-  .use(List)
-  .use(Tabbar)
-  .use(TabbarItem)
-  .use(panel)
-  .use(NoticeBar)
+  import request from '@/utils/request'
+  import Vue from 'vue'
+  import {getRole_noe, _debounce} from '@/utils/auth'
+  import {
+    Tab,
+    Tabs,
+    Search,
+    List,
+    Tabbar,
+    TabbarItem,
+    panel,
+    NoticeBar
+  } from 'vant'
+  Vue.use(Tab)
+    .use(Tabs)
+    .use(Search)
+    .use(List)
+    .use(Tabbar)
+    .use(TabbarItem)
+    .use(panel)
+    .use(NoticeBar)
 
-export default {
-  comments: {},
-  data () {
-    return {
-      getRole_noe: '', // 权限判断
-      tips: '暂无数据',
-      active: 0,
-      title: '团队PK',
-      list: null,
-      loading: false,
-      finished: false,
-      active1: 'running',
-      filter: {
-        page: 1,
-        type: 'all',
-        status: 'running',
-        keyword: ''
+  export default {
+    comments: {},
+    data() {
+      return {
+        getRole_noe: '', // 权限判断
+        tips: '暂无数据',
+        title: '团队PK',
+        list: [],
+        loading: false,
+        finished: false,
+        active: 'running',
+        filter: {
+          page: 1,
+          type: 'all',
+          status: 'running',
+          keyword: ''
+        },
+        create_pk_show: false,
+        employee_id: this.$store.getters.user_info.id,
+        is_creator: this.$store.getters.user_info.is_creator,
+        novice: false,
+        noviceHeight: null,
+        isIos: false
+      }
+    },
+    watch: {
+      active(val){
+        this.filter.status = val;
+        this.pullDown()
       },
-      create_pk_show: false,
-      employee_id: this.$store.getters.user_info.id,
-      is_creator: this.$store.getters.user_info.is_creator,
-      novice: false,
-      noviceHeight: null,
-      isIos: false
-    }
-  },
-  watch: {
-    'filter.keyword': {
-      deep: true,
-      handler: _debounce(function () {
-        this.$toast.loading({
-          message: '正在加载'
+      'filter.keyword': {
+        deep: true,
+        handler: _debounce(function(){
+          this.pullDown()
         })
-        this.refresh(function () {
-          self.$toast.clear()
-        })
-      })
-    }
-  },
-  mounted () {
-    // 有管理权限的人才可以设置PK
-    // if (this.$store.getters.user_info.employee_detail.manage_scope.length > 0) {
-    //   this.create_pk_show = true
-    // }
-    this.getLocalStorage()
-    this.$nextTick(() => {
-      setTimeout(() => {
-        if (this.novice) {
-          this.noviceHeight = 'calc(100% - 2.85rem - ' + this.$refs.pkNoticeRef.offsetHeight + 'px )'
-        }
-      }, 100)
-    })
-    if (window.plus) {
-      this.isIos = plus.storage.getItem('iPhone')
-    }
-  },
-  methods: {
-    returnEm: function (item) {
-      var is = false
-      item.forEach(d => {
-        if (d.id == this.employee_id) {
-          is = true
-        }
-      })
-      return is
-    },
-    getLocalStorage () {
-      if (!localStorage.getItem('pkNovice') || (window.plus && !plus.storage.getItem('pkNovice'))) {
-        this.novice = true
-      } else {
-        this.novice = false
       }
     },
-    closeNotice () {
-      window.plus ? plus.storage.setItem('pkNovice') : localStorage.setItem('pkNovice', true)
+    mounted() {
       this.getLocalStorage()
-    },
-    // 删除
-    del_pk (d) {
-      let self = this
-      this.$dialog
-        .confirm({
-          title: '删除',
-          message: '确认删除此团队PK?'
-        })
-        .then(() => {
-          self.showLoading()
-          request('delete', '/api/integral/pk', { pk_id: d.id })
-            .then(res => {
-              if (res.data.code == 1) {
-                self.$toast(res.data.msg)
-                self.get_pk_list()
-              } else {
-                self.$toast(res.data.msg)
-                Toast.clear()
-              }
-            })
-            .finally(() => this.$toast.clear())
-        })
-    },
-    read_pk (d) {
-      let status = this.filter.status
-      const managers = d.managers.map(o => o.id).join(',')
-      const creator_id = d.creator_id
-      const enbale_leader_record = d.leader_can_record
-
-      this.$router.push({ name: 'read_pk', query: { id: d.id, managers, creator_id, pk_status: status, enbale_leader_record } })
-    },
-    // 加载
-    showLoading () {
-      this.$toast.loading({
-        loadingType: 'spinner',
-        message: '正在处理'
-      })
-    },
-    // 监听切换
-    onChange (index) {
-      let self = this
-      this.list = null
-      this.$toast.loading({
-        loadingType: 'spinner',
-        message: '正在处理'
+      this.$nextTick(() => {
+        setTimeout(() => {
+          if (this.novice) {
+            this.noviceHeight = 'calc(100% - 2.85rem - ' + this.$refs.pkNoticeRef.offsetHeight + 'px )'
+          }
+        }, 100)
       })
-      switch (index) {
-        case 'noStart':
-          this.filter.status = 'waiting'
-          this.refresh(function () {
-            self.$toast.clear()
-          })
-          break
-        case 'over':
-          this.filter.status = 'end'
-          this.refresh(function () {
-            self.$toast.clear()
-          })
-          break
-        default:
-          this.filter.status = 'running'
-          this.refresh(function () {
-            self.$toast.clear()
-          })
+      if (window.plus) {
+        this.isIos = plus.storage.getItem('iPhone')
       }
     },
-    // 设置PK
-    set_pk (item) {
-      this.$router.push({ name: 'edit_pk', query: { id: item.id } })
-    },
-    // 创建PK
-    create_pk () {
-      this.$router.push({ name: 'create_pk' })
-    },
-    // 获取列表
-    get_pk_list (done) {
-      let self = this
-      if (!self.is_creator) {
-        self.filter.type = 'myself'
-      }
-      request('get', '/api/integral/pk/list', self.filter).then(res => {
-        done()
-        if (res.data.code == 1) {
-          self.$refs.my_scroller.finishInfinite(!res.data.data.list.length != '10') // 停止上滚加载下一页,由于服务器端没有统一空数据和正常数据的格式,所以通过total字段来判定数据是否存在下一页
-          if (res.data.data.list.total) {
-            for (let i in res.data.data.list.list) {
-              self.list.push(res.data.data.list.list[i])
-            }
+    methods: {
+      pullDown(){
+        console.log("下拉了")
+        setTimeout(() => {
+          this.$refs.scroller.triggerPullToRefresh();
+        }, 50);
+      },
+      returnEm: function(item) {
+        var is = false
+        item.forEach(d => {
+          if (d.id == this.employee_id) {
+            is = true
           }
-          self.filter.page++
+        })
+        return is
+      },
+      getLocalStorage() {
+        if (!localStorage.getItem('pkNovice') || (window.plus && !plus.storage.getItem('pkNovice'))) {
+          this.novice = true
         } else {
-          self.$refs.my_scroller.finishInfinite(true)
+          this.novice = false
         }
-      })
-    },
-    refresh (done) {
-      let self = this
-      setTimeout(() => {
-        this.filter.page = 1
-        this.get_pk_list(function () {
-          self.list = []
-          done()
+      },
+      closeNotice() {
+        window.plus ? plus.storage.setItem('pkNovice') : localStorage.setItem('pkNovice', true)
+        this.getLocalStorage()
+      },
+      // 删除
+      del_pk(d) {
+        this.$dialog .confirm({  title: '删除',  message: '确认删除此团队PK?'}).then(() => {
+            request('delete','/api/integral/pk',{pk_id: d.id}).then(res => {
+                this.$toast(res.data.msg)
+                this.get_pk_list()
+            })
+          })
+      },
+      read_pk(d) {
+        let status = this.filter.status
+        const managers = d.managers.map(o => o.id).join(',')
+        const creator_id = d.creator_id
+        const enbale_leader_record = d.leader_can_record
+        this.$router.push({
+          name: 'read_pk',
+          query: {
+            id: d.id,
+            managers,
+            creator_id,
+            pk_status: status,
+            enbale_leader_record
+          }
+        })
+      },
+      // 加载
+      showLoading() {
+        this.$toast.loading({
+          loadingType: 'spinner',
+          message: '正在处理'
+        })
+      },
+      // 设置PK
+      set_pk(item) {
+        this.$router.push({name: 'edit_pk',query: {  id: item.id}})
+      },
+      // 创建PK
+      create_pk() {
+        this.$router.push({name: 'create_pk'})
+      },
+      // 获取列表
+      get_pk_list(is,callback) {
+        let hasMore = true
+        is? '':this.filter.page=1;
+        if (!this.is_creator) {
+          this.filter.type = 'myself'
+        }
+        request('get', '/api/integral/pk/list',this.filter).then(res => {
+          let  list=res.data.data.list.list||[];
+          if (this.filter.page === 1) {
+            this.list = list
+          } else {
+            this.list = this.list.concat(list)
+          }
+        }).finally(()=>{
+         callback && callback(hasMore)
         })
-      }, 100)
+      },
+      // 上拉刷新
+      refresh (done) {
+        this.get_pk_list(false,done)
+      },
+      // 下拉加载
+      infinite (done) {
+        this.filter.page=this.filter.page+1;
+        this.get_pk_list(true,done)
+      },
     },
-    infinite (done) {
-      this.get_pk_list(done)
-    }
-  },
-  created () {
-    this.getRole_noe = getRole_noe()
-    this.$nextTick(() => {
-      this.$refs.my_scroller.finishInfinite(false)
-    })
-  },
-  keep_alive_update: {
-    add_pk_rules_list: function (vm, data) {
-      vm.refresh(function () {})
+    created() {
+      this.getRole_noe = getRole_noe()
     },
-    // 运用缓存更新方法来完成返回后的更新
-    update_list_pk: function (vm, data) {
-      for (let i in vm.list) {
-        if (vm.list[i].id == data.pk_id) {
-          vm.list[i].name = data.name
-          vm.list[i].end_time = data.end_time
-          vm.list[i].start_time = data.start_time
+    keep_alive_update: {
+      add_pk_rules_list: function(vm, data) {
+        vm.pullDown()
+      },
+      // 运用缓存更新方法来完成返回后的更新
+      update_list_pk: function(vm, data) {
+        for (let i in vm.list) {
+          if (vm.list[i].id == data.pk_id) {
+            vm.list[i].name = data.name
+            vm.list[i].end_time = data.end_time
+            vm.list[i].start_time = data.start_time
+          }
         }
       }
     }
   }
-}
 </script>
 
 <style scoped>
-.body_com {
-  position: relative;
-  height: calc(100% - 1.2rem);
-}
-.pk-list-block {
-  background-color: #f5f7fa;
-  padding: 0;
-  position: relative;
-  height: calc(100% - 2.85rem);
-}
+  .body_com {
+    position: relative;
+    height: calc(100% - 1.2rem);
+  }
 
-/* 顶部分类列表 */
-.teampk_box .tabbar_list {
-  height: 1rem;
-}
-.teampk_box .tabbar_list .list {
-  font-size: 0.28rem;
-  line-height: 0.88rem;
-  padding-bottom: 0.1rem;
-}
-.teampk_box /deep/ .van-tabbar-item {
-  border-bottom: 0.04rem solid transparent;
-}
-.teampk_box /deep/ .van-tabbar-item--active {
-  color: #26a2ff;
-  border-bottom: 0.04rem solid #26a2ff;
-}
+  .pk-list-block {
+    background-color: #f5f7fa;
+    padding: 0;
+    position: relative;
+    height: calc(100% - 2.85rem);
+  }
 
-/* 搜索 */
-.teampk_box /deep/ .scroller-blur {
-  background: transparent;
-}
-.teampk_box /deep/ .scroller-blur .van-search__content {
-  padding: 0.05rem 0.1rem;
-  background: #fff;
-  border-radius: 0.08rem;
-}
-.teampk_box /deep/ .scroller-blur .van-icon {
-  color: #909399;
-  padding-left: 0.1rem;
-}
-.teampk_box /deep/ .scroller-blur input::-webkit-input-placeholder {
-  color: #909399;
-  font-size: 0.28rem;
-}
+  /* 顶部分类列表 */
+  .teampk_box .tabbar_list {
+    height: 1rem;
+  }
 
-/* PK列表 */
-.teampk_box /deep/ .pk_list {
-  margin: 0.2rem 0.32rem 0.2rem;
-  padding: 0.2rem 0.32rem 0.4rem;
-  background: #fff;
-  border-radius: 0.08rem;
-}
-.teampk_box /deep/ .pk_list .van-cell {
-  padding: 0;
-}
-.teampk_box /deep/ .pk_list .van-cell .van-cell__title span {
-  font-size: 0.32rem;
-  font-weight: 500;
-  line-height: 0.72rem;
-}
-.teampk_box /deep/ .van-cell:not(:last-child)::after {
-  padding-left: 0;
-  left: 0;
-}
-.teampk_box /deep/ .pk_list .teams_list_time {
-  font-size: 0.28rem;
-  color: #909399;
-  padding: 0.2rem 0 0.3rem;
-}
-.teampk_box /deep/ .pk_list .teams_btn {
-  text-align: right;
-}
+  .teampk_box .tabbar_list .list {
+    font-size: 0.28rem;
+    line-height: 0.88rem;
+    padding-bottom: 0.1rem;
+  }
 
-.teampk_box /deep/ .pk_list .teams_btn .set:active {
-  color: #fff;
-  background: #1989fa;
-}
+  .teampk_box /deep/ .van-tabbar-item {
+    border-bottom: 0.04rem solid transparent;
+  }
 
-.teampk_box /deep/ .pk_list .teams_btn .see:active {
-  color: #fff;
-  background: #1276db;
-}
+  .teampk_box /deep/ .van-tabbar-item--active {
+    color: #26a2ff;
+    border-bottom: 0.04rem solid #26a2ff;
+  }
 
-.teampk_box .create_pk_box {
-  display: block;
-  text-align: center;
-  background: #e4e7eb;
-  position: fixed;
-  bottom: 0;
-  left: 0;
-  right: 0;
-  padding-bottom: 0.2rem;
-}
+  /* 搜索 */
+  .teampk_box /deep/ .scroller-blur {
+    background: transparent;
+  }
 
-.teampk_box .create_pk_box .create_pk {
-  display: inline-block;
-  width: calc(100vw - 0.64rem);
-  margin-top: 0.2rem;
-}
-.isIos {
-  padding-bottom: 0.4rem !important;
-}
+  .teampk_box /deep/ .scroller-blur .van-search__content {
+    padding: 0.05rem 0.1rem;
+    background: #fff;
+    border-radius: 0.08rem;
+  }
+
+  .teampk_box /deep/ .scroller-blur .van-icon {
+    color: #909399;
+    padding-left: 0.1rem;
+  }
+
+  .teampk_box /deep/ .scroller-blur input::-webkit-input-placeholder {
+    color: #909399;
+    font-size: 0.28rem;
+  }
+
+  /* PK列表 */
+  .teampk_box /deep/ .pk_list {
+    margin: 0.2rem 0.32rem 0.2rem;
+    padding: 0.2rem 0.32rem 0.4rem;
+    background: #fff;
+    border-radius: 0.08rem;
+  }
+
+  .teampk_box /deep/ .pk_list .van-cell {
+    padding: 0;
+  }
+
+  .teampk_box /deep/ .pk_list .van-cell .van-cell__title span {
+    font-size: 0.32rem;
+    font-weight: 500;
+    line-height: 0.72rem;
+  }
+
+  .teampk_box /deep/ .van-cell:not(:last-child)::after {
+    padding-left: 0;
+    left: 0;
+  }
+
+  .teampk_box /deep/ .pk_list .teams_list_time {
+    font-size: 0.28rem;
+    color: #909399;
+    padding: 0.2rem 0 0.3rem;
+  }
+
+  .teampk_box /deep/ .pk_list .teams_btn {
+    text-align: right;
+  }
+
+  .teampk_box /deep/ .pk_list .teams_btn .set:active {
+    color: #fff;
+    background: #1989fa;
+  }
+
+  .teampk_box /deep/ .pk_list .teams_btn .see:active {
+    color: #fff;
+    background: #1276db;
+  }
+
+  .teampk_box .create_pk_box {
+    display: block;
+    text-align: center;
+    background: #e4e7eb;
+    position: fixed;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    padding-bottom: 0.2rem;
+  }
+
+  .teampk_box .create_pk_box .create_pk {
+    display: inline-block;
+    width: calc(100vw - 0.64rem);
+    margin-top: 0.2rem;
+  }
+
+  .isIos {
+    padding-bottom: 0.4rem !important;
+  }
 </style>

+ 9 - 7
src/components/pk/pk_log.vue

@@ -5,7 +5,7 @@
         <div style="padding: 0 0.32rem">
           <van-panel v-for="(item,index) in list " :key="index" :title="item.target_name" :desc="item.remark" :status="item.point.toString()">
             <template slot="header">
-              <div class="panelHead" style="">
+              <div class="panelHead">
                 <div style="-webkit-box-flex: 1;flex: 1;">
                   <span style="font-size: .32rem;"><Wxopendata type="userName" :openid="item.target_name"></Wxopendata></span>
                   <div style="margin-top: .06rem;color: #969799;font-size: .24rem;line-height: .36rem;">
@@ -15,7 +15,6 @@
                 <div style="overflow: visible;color: #ee0a24;position: relative;text-align: right;vertical-align: middle;word-wrap: break-word;">
                   <span style="">{{item.point.toString()}}</span>
                 </div>
-                
               </div>
             </template>
 
@@ -26,8 +25,7 @@
                   <span class="flex-1"> 操作人:<Wxopendata type="userName" :openid="item.recorder_name"></Wxopendata></span>
                   <span v-if="item.target_id>0" class="color-blue">个</span>
                   <span v-else class="color-blue">团</span>
-               </span>
-
+              </span>
             </div>
           </van-panel>
         </div>
@@ -77,13 +75,16 @@ export default {
     hasPermission () {
       const { createInfo } = this
       const { is_creator, id } = this.$store.getters.user_info
-      return is_creator === 1 || id === createInfo.creatorId || createInfo.manages.has(id.toString())
+      let is=is_creator == 1 || id == createInfo.creatorId || createInfo.manages.has(id.toString())
+      console.log('hasPermission',is_creator, id,JSON.stringify(this.createInfo),is)
+      return is
     },
     enbaleLeaderRecord () {
       const { id } = this.$store.getters.user_info
       const { leader_can_record, leader_ids } = this.pk_info
-	   // console.log(leader_can_record,leader_ids)
-      return leader_can_record === 1 && leader_ids.findIndex(o => o === id) > -1
+      let is=leader_can_record == 1 && leader_ids.findIndex(o => o === id) > -1
+      console.log('enbaleLeaderRecord',id,leader_can_record, leader_ids,is)
+      return is
     }
   },
   // 方法
@@ -162,6 +163,7 @@ export default {
     this.$nextTick(() => {
       this.$refs.scroller.finishInfinite(false)
     })
+    console.log('filter',JSON.stringify(this.filter))
     this.get_pk_info()
   }
 }

+ 2 - 1
src/components/pk/pk_ranking.vue

@@ -114,6 +114,7 @@
 <style scoped>
 .body_com{height: calc(100% - 1rem); position: relative;}
 .scroller_top{
-  margin-top: .9rem;
+  height: calc(100vh - 2.9rem);
+  position: relative;
 }
 </style>

+ 4 - 13
src/components/pk/pk_rules.vue

@@ -21,18 +21,8 @@
     <div style="padding: 0 0.32rem;" v-if="hasPermission && pkStatus !== 'end'">
       <van-button type="info" block @click="add_rule_btn">新增规则</van-button>
     </div>
-    <div
-      style="padding: 0 0.32rem;"
-      v-else
-      v-for="(item,index) in pk_info.manager_ids"
-      :key="index"
-    >
-      <van-button
-        v-if="$store.getters.user_info.id == item && pkStatus !== 'end'"
-        type="info"
-        block
-        @click="add_rule_btn"
-      >新增规则</van-button>
+    <div style="padding: 0 0.32rem;" v-else v-for="(item,index) in pk_info.manager_ids" :key="index">
+      <van-button v-if="$store.getters.user_info.id == item && pkStatus !== 'end'" type="info" block @click="add_rule_btn">新增规则</van-button>
     </div>
 
     <!-- 添加规则弹窗 -->
@@ -100,7 +90,8 @@ export default {
     hasPermission() {
       const { createInfo } = this;
       const { is_creator, id } = this.$store.getters.user_info
-      return is_creator === 1 || id === createInfo.creatorId || createInfo.manages.has(id.toString())
+      console.log(JSON.stringify(createInfo),is_creator,id,this.pkStatus)
+      return is_creator == 1 || id == createInfo.creatorId || createInfo.manages.has(id.toString())
     }
   },
   // 方法

+ 0 - 1
src/components/pk/read_pk.vue

@@ -73,7 +73,6 @@ export default {
   computed: {
     createInfo() {
       const { creator_id, managers } = this.$route.query
-
       return {
         creatorId: creator_id,
         manages: new Set(managers ? managers.split(',') : undefined)

+ 25 - 32
src/components/user/login.vue

@@ -11,49 +11,42 @@
 
 <script>
 import request from '@/utils/request';
-import { getToken, setToken, cookGetToken } from '@/utils/auth';
-import { wxAuth } from '@/utils/wx-auth-two.js';
+import {getToken,setToken} from '@/utils/auth';
 
 export default {
   name: 'login',
   data() {
     return {
-      logImage: true,
-      loginButton: true
+
     };
   },
   created() {
-    let token=cookGetToken()
-    console.log('进入登录页:'+token);
-    if (token) {
-      setToken(token);
-      this.detailAxiox(1);
-    } else {
-      window.location.href = process.env.BASE_API; //重新授权
-    }
+    //初始化
+    sessionStorage.clear()
+    localStorage.removeItem('user_info')
+    window.sessionStorage.setItem('__VCKEEPALIVE__', JSON.stringify(['/']));
+    window.sessionStorage.setItem('routers', '/');
+  },
+  mounted() {
+  	let token=getToken()
+  	if (token) {
+  	  setToken(token);
+  	  this.detailAxiox();
+  	}
   },
   methods: {
-    detailAxiox(add) {
-      request('get', process.env.BASE_API + '/api/employee/detail').then(res => {
-        if (res.data.code == 1) {
-          if (res.data.data.user.is_official == 0) {
-            this.$router.push({
-              path: '/noAccess',
-              query: {
-                msg: '当前用户未授权进入系统,请联系管理员为您【启用积分管理】,<br/>如需咨询客服,请到您企业专属的功道云服务群咨询'
-              }
-            });
-          } else if (add == 1) {
-            this.$store.commit('SET_USERINFO', res.data.data.user); // 设置员工信息
-            window.sessionStorage.setItem('__VCKEEPALIVE__', JSON.stringify(['/']));
-            window.sessionStorage.setItem('routers', '/');
-            // this.$router.push({
-            //   name: 'home'
-            // })
-            wxAuth(true);
-          }
+    detailAxiox() {
+      this.$store.dispatch('get_user_info').then((res) => {
+        let data=this.$userInfo();
+        if (data.is_official == 0) {
+          this.$router.push({
+            path: '/noAccess',
+            query: { msg: '当前用户未授权进入系统,请联系管理员为您【启用积分管理】,<br/>如需咨询客服,请到您企业专属的功道云服务群咨询'}
+          });
+        } else{
+          this.$router.replace({ path: '/home' });
         }
-      });
+      })
     }
   }
 };

+ 0 - 2
src/components/user/safe.vue

@@ -29,7 +29,6 @@
 </template>
 
 <script>
-  import { removeToken } from '@/utils/auth'
   export default {
     filters:{
       mobile(tel){
@@ -46,7 +45,6 @@
           title: '退出登录',
           message: '您确定要退出吗?'
         }).then(() => {
-          removeToken()
           if (window.plus) {
             plus.storage.removeItem('user_info')
           } else {

+ 1 - 4
src/components/user/user_setting.vue

@@ -31,10 +31,8 @@
 </template>
 
 <script>
-
-  import { removeToken } from '@/utils/auth'
+	
   export default {
-
     methods:{
       clear_cache(){
         let self = this
@@ -54,7 +52,6 @@
           title: '退出登录',
           message: '您确定要退出吗?'
         }).then(() => {
-          removeToken()
           if (window.plus) {
             plus.storage.removeItem('user_info')
           } else {

+ 7 - 4
src/main.js

@@ -8,8 +8,14 @@ import './utils/validator'
 import '../css/reset.css'
 import echarts from 'echarts'
 
+// wx通讯录
+import wwOpenDAtas from '@/view/wxOpendata'
+Vue.component('Wxopendata', wwOpenDAtas)
+
 import VConsole from 'vconsole'
-new VConsole()
+if (process.env.NODE_ENV === 'development') {
+  new VConsole()
+}
 
 import {
   Tabbar,Empty, TabbarItem,Grid, GridItem,Field,NavBar,Row, Col,Cell, CellGroup,Toast,Popup,Dialog,RadioGroup, Radio,Notify,
@@ -29,9 +35,6 @@ Vue.prototype.$isPt_id = isPt_id
 Vue.prototype.$echarts = echarts
 Vue.prototype.$wx = (window).wx; // 全局使用
 
-// wx通讯录
-import wwOpenDAtas from '@/view/wxOpendata'
-Vue.component('Wxopendata', wwOpenDAtas)
 
 Vue.use(Button).use(Tabbar).use(TabbarItem).use(Grid).use(GridItem).use(Field).use(NavBar).use(Row).use(Col).use(Cell).use(CellGroup).use(Toast).use(Popup).use(Dialog).use(RadioGroup).use(Radio).use(Icon).use(Notify).use(Empty)
 Vue.use(VueScroller)

+ 12 - 56
src/permission.js

@@ -3,8 +3,7 @@ import Cookies from 'js-cookie'
 import router from './router'
 import store from './store'
 import request from '@/utils/request'
-import {getToken, setToken, cookGetToken} from '@/utils/auth'
-const stopPath = ['/login', '/noAccess', '/']
+import {getToken, setToken} from '@/utils/auth'
 import { wxAuth } from "@/utils/wx-auth-two.js";
 router.beforeEach((to, from, next) => {
   if (Vue.$httpRequestList.length > 0) { //强行中断时才向下执行
@@ -17,54 +16,21 @@ router.beforeEach((to, from, next) => {
     wx.closeWindow();//关闭当前网页窗口
     return false
   }
-  if(stopPath.indexOf(to.path) !== -1){
-    next()
-  }else{
-    if (cookGetToken()){//Cook中A-Token
-      setToken(cookGetToken())
-      detailAxiox()//员工详细信息
-      Cookies.remove('Admin-Token')
-      thens(to, from, next)
-    } else if (getToken()) {//local中A-Token
-      thens(to, from, next)
+  window.document.title =window.$routes_map[to.name]? window.$routes_map[to.name].label:'管理中心'
+  if (getToken()) {
+    // 初始一些数据
+    init();
+    wxAuth('',next)
+  } else {
+    if (!window.$routes_map[to.name].need_login) { // 在免登录白名单,直接进入
+      wxAuth('',next)
     } else {
-      if (!window.$routes_map[to.name].need_login) { // 在免登录白名单,直接进入
-        if(to.name=='init'&&localStorage.getItem('init')){
-          next('/login')
-        }else{
-          if (typeof(window.$routes_map[to.name]) != 'undefined') {
-            window.document.title = window.$routes_map[to.name].label
-          }
-          next()
-        }
-      } else {
-        window.location.href = process.env.BASE_API//直接重新授权
-      }
+      next('/login')
     }
   }
 })
-
-function thens(to, from, next){
-  if(to.name !== 'home'){
-    window.document.title = window.$routes_map[to.name].label
-  }
-  if (to.path == '/login' || to.name == 'init') { // 在免登录白名单,直接进入
-    next({ name: 'home'})
-  }
-  // 初始一些数据
-  init(to);
-  // next()
-  wxAuth(false,next,to)
-}
-
-function init(to) {
-  store.dispatch('get_user_info', getToken()).then((res) => { //获取用户信息
-    if (router.history.current.name == 'login' && to.name != 'home') {
-      router.push({
-        name: 'home'
-      })
-      return false
-    }
+function init() {
+  store.dispatch('get_user_info').then((res) => { //获取用户信息
     if (store.getters.user_info.try_user == 1) { //判断是否试用账号
       store.dispatch("setBuyPopup",true);
     }else{
@@ -76,13 +42,3 @@ function init(to) {
   store.dispatch('get_employee_map').then((res) => {}); //获取人员列表
 }
 
-function detailAxiox(){
-  request('get',process.env.BASE_API+'/api/employee/detail')
-  .then(res => {
-    if(res.data.code == 1){
-      store.commit("SET_USERINFO", res.data.data.user); // 设置员工信息
-      window.sessionStorage.setItem('__VCKEEPALIVE__', JSON.stringify(['/']))
-      window.sessionStorage.setItem('routers', '/')
-    }
-  })
-}

+ 2 - 1
src/router/index.js

@@ -8,7 +8,8 @@ let routes = [
     name: 'init',
     component: () => import('@/view/init'),
     label: '初始化',
-    need_login: false
+    need_login: false,
+    redirect: "login",
   },
   {
     path: '/home',

+ 5 - 30
src/store/modules/user.js

@@ -1,5 +1,5 @@
 import {get_info, get_point_types, get_employee_map,getMenu} from '@/api/login'
-import {setToken, setUserId, getToken} from '@/utils/auth'
+import {getToken} from '@/utils/auth'
 import moment from 'moment'
 import router from '@/router'
 
@@ -28,7 +28,6 @@ const user = {
 
   mutations: {
     BUYPOPUP:(state, data)=>{
-      // console.log(data);
       state.buyPopup = data
     },
     GET_MENU:(state, data) => {
@@ -181,7 +180,7 @@ const user = {
       }
     },
     update_user_info({dispatch,commit},data){
-          dispatch('get_user_info', getToken());
+          dispatch('get_user_info');
     },
     update_point_types({dispatch}){
       if(window.plus){
@@ -313,34 +312,10 @@ const user = {
 
       })
     },
-    get_user_info({commit},token) {
+    get_user_info({commit}) {
       return new Promise((resolve, reject) => {
         let user_info = null
         let nowDate = moment().format("YYYY-MM-DD HH:mm:ss");
-        if(token=='isShow'){
-            get_info(getToken()).then(response => {
-              if(response.data.data.user.is_official == 0){
-                router.push({
-                  path: '/noAccess',
-                  query: {
-                    msg: '当前用户未授权进入系统,请联系管理员为您【启用积分管理】,<br/>如需咨询客服,请到您企业专属的功道云服务群咨询'
-                  }
-                })
-                return
-              }
-              response.data.data.user.localStorageExpire = moment().add(Math.floor(Math.random() * (120 - 60 + 1)) + 60, "second").format("YYYY-MM-DD HH:mm:ss")
-              commit('SET_USERINFO', response.data.data.user)
-              if (window.plus) {
-                plus.storage.setItem('user_info', JSON.stringify(response.data.data.user))
-              } else {
-                localStorage.setItem('user_info', JSON.stringify(response.data.data.user))
-              }
-              resolve(response.data)
-            }).catch(error => {
-              reject(error)
-            })
-            return;
-        }
         if (window.plus) {
           user_info = JSON.parse(plus.storage.getItem('user_info'))
         } else {
@@ -350,8 +325,7 @@ const user = {
           commit('SET_USERINFO', user_info.data)
           resolve({code: 1, msg: '', data: {user: user_info}})
         }else{
-          if(typeof(token) == 'undefined'){ return false}
-          get_info(token).then(response => {
+          get_info().then(response => {
             response.data.data.user.localStorageExpire = moment().add(Math.floor(Math.random() * (120 - 60 + 1)) + 60, "second").format("YYYY-MM-DD HH:mm:ss");
             commit('SET_USERINFO', response.data.data.user)
             if (window.plus) {
@@ -359,6 +333,7 @@ const user = {
             } else {
               localStorage.setItem('user_info', JSON.stringify({data:response.data.data.user}))
             }
+            console.log('用户信息'+JSON.stringify(response.data.data.user.employee_detail.role_list))
             resolve(response.data)
           }).catch(error => {
             reject(error)

+ 25 - 90
src/utils/auth.js

@@ -5,20 +5,14 @@ import store from '@/store';
 
 // 获取当前用户详情
 export function getUserData() {
-  let data='';
-  if(window.plus){
-    if(plus.storage.getItem('user_info')){
-        data=JSON.parse(plus.storage.getItem('user_info')).data
-    }
-  }else{
-    if(localStorage.getItem('user_info')){
-       data=JSON.parse(localStorage.getItem('user_info')).data
-    }
+  let data=localStorage.getItem('user_info');
+  if(data){
+     data=JSON.parse(data).data
   }
   if(!data){
     data=store.getters.user_info;
   }
-  return  data
+  return data
 }
 
 // 获取积分类型
@@ -34,88 +28,36 @@ export function getTypes(id) {
   }
 }
 
-export function getToken() {
-  if (window.plus) {
-    return plus.storage.getItem(TokenKey)
-  } else {
-    return localStorage.getItem(TokenKey)
+export const checkPlatform = function() {
+  if (/android/i.test(navigator.userAgent)) {
+    return '1'
   }
-}
-export function cookGetToken() {
-  // return Cookies.get(TokenKey)|| getToken(TokenKey)
-  return Cookies.get(TokenKey)|| 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOm51bGwsImlhdCI6MTY3NTczNzEzOSwiZXhwIjoxNjc2MzM3MTM5LCJuYmYiOjE2NzU3MzcxMzksImp0aSI6InZZbmtIUHpFZ3JzS2lkWWkiLCJzdWIiOjc0LCJwcnYiOiJjYTY0ODlkNTBmMjQwN2E2NzgzMGU4MDkwZDAxNDg4MzU2ODU5NjJiIiwicm9sZSI6ImVtcGxveWVlIn0.Omz7v07Iox44cuTAPgflBjA-4GtT9aN8uf4619DoGzw'
-}
-
-export function getUserId() {
-  if (window.plus) {
-    return plus.storage.getItem(UserIdKey)
-  } else {
-    return localStorage.getItem(UserIdKey)
+  if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
+    return '2'
   }
 }
 
 export function setToken(token) {
-  if (window.plus) {
-    var timestamp = parseInt((new Date()).valueOf() / 1000)
-    plus.storage.setItem('token-expire', timestamp + 7200)
-    return plus.storage.setItem(TokenKey, token)
-  } else {
-    var timestamp = parseInt((new Date()).valueOf() / 1000)
-    localStorage.setItem('token-expire', timestamp + 7200)
-    return localStorage.setItem(TokenKey, token)
-  }
+  setCache(TokenKey,token)
+  Cookies.set(TokenKey, token)
 }
-
-export function setUserId(token) {
-  if (window.plus) {
-    return plus.storage.setItem(UserIdKey, token)
-  } else {
-    return localStorage.setItem(UserIdKey, token)
-  }
+export function getToken() {
+  return Cookies.get(TokenKey)|| getCache(TokenKey)
 }
 
-export function removeToken() {
-  if (window.plus) {
-    plus.storage.removeItem('user_info')
-    return plus.storage.removeItem(TokenKey)
-  } else {
-    localStorage.removeItem('user_info')
-    return localStorage.removeItem(TokenKey)
-  }
-}
+// 获取缓存
+export function getCache(key) {
 
-export function removeUserId() {
-  if (window.plus) {
-    return plus.storage.removeItem(UserIdKey)
-  } else {
-    return localStorage.removeItem(UserIdKey)
-  }
+  let tas="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOm51bGwsImlhdCI6MTY4MTk1OTcxMSwiZXhwIjoxNjgyNTU5NzExLCJuYmYiOjE2ODE5NTk3MTEsImp0aSI6Ijg3TEliV0NDOE1DSFlyQWQiLCJzdWIiOjc0LCJwcnYiOiJjYTY0ODlkNTBmMjQwN2E2NzgzMGU4MDkwZDAxNDg4MzU2ODU5NjJiIiwicm9sZSI6ImVtcGxveWVlIn0.2iALty8DawnjA-ImsapozVxHHu5e3Rc6ArAkydGRl1c"
+  return JSON.parse(localStorage.getItem(key))
 }
-
-export const checkPlatform = function() {
-  if (/android/i.test(navigator.userAgent)) {
-    return '1'
-  }
-  if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
-    return '2'
-  }
+// 设置缓存
+export function setCache(key,data) {
+  localStorage.setItem(key, JSON.stringify(data))
 }
 
-// cache
-export function set_cache(key, data) {
-  if (window.plus) {
-    return plus.storage.getItem(key, data)
-  } else {
-    return localStorage.getItem(key, JSON.stringify(data))
-  }
-}
-export function get_cache(key) {
-  if (window.plus) {
-    return plus.storage.getItem(key)
-  } else {
-    return JSON.parse(localStorage.getItem(key))
-  }
-}
+
+
 // 创始人:creator
 // 公司管理员:admin
 // 积分管理员:point_manager
@@ -125,6 +67,7 @@ export function get_cache(key) {
 export function getRole() {
   var roleArr = [];
   const role_list = store.getters.user_info.employee_detail.role_list;
+  console.log('role_list'+JSON.stringify(role_list))
   if (role_list.length > 0) {
     role_list.forEach(item => {
       roleArr.push(item.name.toString());
@@ -146,8 +89,7 @@ export function getRole_noe() {
 // 权限是否包含 创始人||公司管理员 ||积分管理员||部门管理员
 export function getRole_two() {
   var roleArr = getRole();
-  if (roleArr.indexOf("creator") >= 0 || roleArr.indexOf("admin") >= 0 || roleArr.indexOf("point_manager") >= 0 ||
-    roleArr.indexOf("dept_manager") >= 0) {
+  if (roleArr.indexOf("creator") >= 0 || roleArr.indexOf("admin") >= 0 || roleArr.indexOf("point_manager") >= 0 ||roleArr.indexOf("dept_manager") >= 0) {
     return true;
   } else {
     return false
@@ -212,6 +154,7 @@ export function _throttle(fn, interval=500) {
     }
   }
 }
+
 export function isPt_id(item){
   switch (item){
     case 1:
@@ -225,11 +168,3 @@ export function isPt_id(item){
       break;
   }
 }
-// 获取缓存
-export function getCache(key) {
-  return JSON.parse(localStorage.getItem(key))
-}
-// 设置缓存
-export function setCache(key,data) {
-   localStorage.setItem(key, JSON.stringify(data))
-}

+ 1 - 5
src/utils/request.js

@@ -1,10 +1,6 @@
 import axios from 'axios'
 import router from '@/router'
-import {
-  getToken,
-  getUserId,
-  setToken
-} from '@/utils/auth'
+import {getToken,setToken} from '@/utils/auth'
 import qs from 'qs'
 import Vue from 'vue'
 import Cookies from 'js-cookie'

+ 22 - 64
src/utils/wx-auth-two.js

@@ -1,48 +1,25 @@
 import Vue from 'vue';
 import {allocations} from '@/api/configget';
 import Router from '@/router'
-import {
-  getToken
-} from '@/utils/auth'
-let isfot = false
-export const wxAuth = async (ifHome, next, to) => {
-  if (isfot) return
+import {getToken} from '@/utils/auth'
+
+export const wxAuth = (pushindex, next) => {
   const wechatConfigUrl = location.href.split('#')[0]
-  if (window.wechatConfigUrl === wechatConfigUrl && window.WWOpenData) {
-    if (getToken()) {
-      if (ifHome) {
-        Router.push({
-          name: 'home'
-        })
-      } else {
-        if (next) {
-          next()
-        }
-      }
-    }
-    return Promise.resolve()
-  } else {
-    try {
-      await wxConfigByCorp(ifHome, wechatConfigUrl, next)
-      window.wechatConfigUrl = wechatConfigUrl
-      return Promise.resolve()
-    } catch (error) {
-      return Promise.reject(error)
-    }
+  if(!window.WWOpenData){
+    console.log('url:'+wechatConfigUrl)
+    wxConfigByCorp(wechatConfigUrl, pushindex, next)
+  }else{
+    next();
   }
 }
 
-async function wxConfigByCorp(ifHome, body, next) {
-  isfot = true
+async function wxConfigByCorp(url, pushindex, next) {
   var data;
-  await allocations(body).then((res) => {
-    if (res.data.code == 1) {
-      data = res.data.data
-    }
-  }).catch(() => {})
+  await allocations(url).then((res) => {data = res.data.data})
   const wxConfigParams = data.config
   const appSignature = data.agentConfig
-  await Vue.prototype.$wx.config({ // 鉴权(企业的身份与权限)
+
+  Vue.prototype.$wx.config({ // 鉴权(企业的身份与权限)
     beta: true, // 必须这么写,否则wx.invoke调用形式的jsapi会有问题
     debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
     appId: wxConfigParams.appId, // 必填,企业微信的corpID
@@ -57,9 +34,11 @@ async function wxConfigByCorp(ifHome, body, next) {
       'invoke',
       'hideOptionMenu',
       'showOptionMenu'
-    ] // 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
+    ]
   });
-  await Vue.prototype.$wx.ready(function() {
+
+
+  Vue.prototype.$wx.ready(function() {
     const u = navigator.userAgent;
     const isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; // 安卓
     const isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端
@@ -72,19 +51,9 @@ async function wxConfigByCorp(ifHome, body, next) {
         signature: appSignature.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
         jsApiList: ['selectExternalContact'], //必填
         success: function(res) { // 回调  //  wx.agentConfig成功回调后,WWOpenData 才会注入到 window 对象上面
-          isfot = false
-          if (next) {
-            next()
-          }
-          if (ifHome) {
-            console.log('--跳转首页--')
-            Router.push({
-              name: 'home'
-            })
-          }
+          if (next){next()}
         },
         fail: function(res) {
-          console.log('fail'+res)
           if (res.errMsg.indexOf('function not exist') > -1) {
             alert('版本过低请升级')
           }
@@ -98,25 +67,11 @@ async function wxConfigByCorp(ifHome, body, next) {
         timestamp: appSignature.timestamp, // 必填,生成签名的时间戳
         nonceStr: appSignature.nonceStr, // 必填,生成签名的随机串
         signature: appSignature.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
-        jsApiList: [
-          'openUserProfile',
-          'previewFile'
-        ], // 必填
+        jsApiList: ['openUserProfile','previewFile'], // 必填
         success(res) {
-          console.log('agentConfig', res);
-          isfot = false
-          if (next) {
-            next()
-          }
-          if (ifHome) {
-            console.log('跳转首页')
-            Router.push({
-              name: 'home'
-            })
-          }
+          if (next) {next()}
         },
         fail(res) {
-          console.log('err', res);
           if (res.errMsg.indexOf('function not exist') > -1) {
             alert('版本过低请升级');
           }
@@ -124,4 +79,7 @@ async function wxConfigByCorp(ifHome, body, next) {
       });
     }
   });
+  Vue.prototype.$wx.error(function(res){
+      console.log('$wx.error'+res);
+  });
 }

+ 1 - 1
src/view/init.vue

@@ -14,7 +14,7 @@ export default {
     // this.$router.replace({name: 'login'})
   },
   activated(){
-    this.$router.replace({name: 'login'})
+    // this.$router.replace({name: 'login'})
   },
   methods: {
   }