Commit 6091da0d authored by xishifeng's avatar xishifeng

业绩周排行暂存1

parent e5c75771
//公用js文件 //公用js文件
let ServerHost = 'https://dev.fujuhaofang.com'; let ServerHost = 'https://pre2.tonglianjituan.com';
if(location.origin === 'https://web.fujuhaofang.com' || location.origin === 'https://admin.fujuhaofang.com') { if(location.origin === 'https://api.tonglianjituan.com') {
ServerHost = location.origin; ServerHost = location.origin;
}; };
import axios from 'axios'; import axios from 'axios';
...@@ -44,6 +44,33 @@ export default { ...@@ -44,6 +44,33 @@ export default {
return 0; return 0;
}; };
}, },
h5PageC(token, fn){
let _this = this;
axios({
method: 'get',
url: _this.ServerHost + '/broker/getAgentsByPhone',
responseType: 'json',
data: {
'AuthToken': token
}
})
.then(function(response) {
if(response.data.code == 200){
localStorage.setItem('token', response.data.data.token);//存储登录的token值
localStorage.setItem('userid', response.data.data.id);//存储用户id
localStorage.setItem('userphone', response.data.data.phone);//存储用户名字
localStorage.setItem('username', response.data.data.name);//存储用户电话号码
localStorage.setItem('userinfo', encodeURIComponent(JSON.stringify(response.data.data)));//存储用户所有信息
fn && fn();
}else{
layer.tipsX(response.data.msg);
return false;
}
})
.catch(function(error) {
layer.tipsX(error);
});
},
Compatible(obj) { Compatible(obj) {
if(this.isIos()) { if(this.isIos()) {
try { try {
......
...@@ -2,19 +2,29 @@ ...@@ -2,19 +2,29 @@
<div> <div>
<header-pulic :data="headerData"></header-pulic> <header-pulic :data="headerData"></header-pulic>
<nav> <nav>
<div class="active">人员排行</div> <div v-for="(item, index) in mainData" :key="item.title" :class="{active:index === initTabNumMain}" @click="tabMain(index)">{{item.title}}</div>
<div>门店排行</div>
<div>区域排行</div>
</nav> </nav>
<main>
<section class="main-sec" v-for="(item, index) in mainData" :key="item.title" v-show="index === initTabNumMain">
<ul>
<li v-for="(item2, index2) in item.listData">
<achieve-fork-li :data="item2" :dataindex="index2"></achieve-fork-li>
</li>
</ul>
</section>
</main>
</div> </div>
</template> </template>
<script> <script>
import headerPulic from '@/components/publicEg/headPublic'; import headerPulic from '@/components/publicEg/headPublic';
import achieveForkLi from '@/components/achieveMain/achieveForkLi';
import '@/assets/js/layer041002.js';
export default { export default {
components: { components: {
'header-pulic': headerPulic 'header-pulic': headerPulic,
'achieve-fork-li': achieveForkLi
}, },
data() { data() {
return { return {
...@@ -23,10 +33,65 @@ ...@@ -23,10 +33,65 @@
'noborder': true, 'noborder': true,
'isBack': true 'isBack': true
}, },
token: '',
userid: '',
initTabNumMain: 0,
mainData:[{
'title': '人员排行',
'topLineNum': 5,
'listData': []
},{
'title': '门店排行',
'topLineNum': 5,
'listData': []
},{
'title': '部门排行',
'topLineNum': Number.POSITIVE_INFINITY,
'listData': []
}]
} }
}, },
created() {
let _this = this;
let _token = _this.$route.query.token;
if(!_token){
layer.tipsX('token获取出错');
return false;
};
_this.common.h5PageC(_token, function(){
_this.loadMain();
});
},
methods: { methods: {
loadMain() {
let _this = this;
_this.token = localStorage.getItem('token');
_this.userid = localStorage.getItem('userid');
_this.axios({
method: 'get',
url: '/broker/selectPerformanceByTime',
responseType: 'json',
data: {
'agent_id': _this.userid,
'type': 1,
'AuthToken': _this.token
}
})
.then(function(response) {
if(response.data.code == 200){
_this.mainData[0].listData = response.data.data.list;
}else{
layer.tipsX(response.data.msg);
}
})
.catch(function(error) {
layer.tipsX(error);
});
},
tabMain(index) {
let _this = this;
_this.initTabNumMain = index;
}
} }
} }
</script> </script>
......
<template>
<div class="rank-li oh">
<div>{{dataindex+1}}</div>
<div><img :src="data.img" /></div>
<div>
<p>{{data.name}}</p>
<p>{{data.district_name+data.store_name}}</p>
</div>
<div>
<p>{{data.performance_total}}</p>
<p>业绩</p>
</div>
</div>
</template>
<script>
export default {
name: '',
props: {
data: {
type: Object,
default: function() {
return {
message: 'hello'
}
}
},
dataindex: {
type: String,
default: function() {
return '0'
}
}
},
data() {
return {
}
},
methods: {
}
}
</script>
<style>
.rank-li{
background-color: white;
padding: 0 .3rem;
height: 1.4rem;
}
.rank-li>div{
float: left;
}
.rank-li>div:nth-of-type(1){
width: .4rem;
line-height: 1.4rem;
font-size: .3rem;
color: rgb(102, 102, 102);
}
.rank-li>div:nth-of-type(1){
width: 1.21rem;
height: 1.21rem;
overflow: hidden;
}
.rank-li>div:nth-of-type(1)>img{
float: left;
width: .98rem;
height: .98rem;
}
</style>
\ No newline at end of file
...@@ -22,7 +22,10 @@ axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded ...@@ -22,7 +22,10 @@ axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded
axios.interceptors.request.use((config) => { axios.interceptors.request.use((config) => {
if(config.method === 'post') { if(config.method === 'post') {
config.data = qs.stringify(config.data); config.data = qs.stringify(config.data);
}; }else if(config.method === 'get'){
config.params = config.data;
delete config.data;//删除原data属性
}else{};
return config; return config;
}, (error) => { }, (error) => {
return Promise.reject(error); return Promise.reject(error);
......
...@@ -30,7 +30,6 @@ define(['doT', 'jquery', 'text!temp/menu_template_tpl.html'], function (doT, $,t ...@@ -30,7 +30,6 @@ define(['doT', 'jquery', 'text!temp/menu_template_tpl.html'], function (doT, $,t
function menu_bar() { function menu_bar() {
var user_info_obj = JSON.parse(decodeURIComponent(sessionStorage.getItem('pcUserInfo'))); //读取缓存 var user_info_obj = JSON.parse(decodeURIComponent(sessionStorage.getItem('pcUserInfo'))); //读取缓存
console.log(user_info_obj);
$ ("#menu_bar").append (template); $ ("#menu_bar").append (template);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment