公司小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
1.9 KiB

import { post } from "./api.js"
import SkipData from './SkipData.js'
export default {
///是否在加载数据,默认为true,因为进来就会找服务器要东西
isLoading : true,
///品牌项目
brandpro : [],
///品牌风采
brandstyle : [],
///业务动态
busdyna : [],
//登录状态 0未登录 1已登录
loginstatus : 0,
///合伙人申请状态 0->未申请,1->已申请,但是尚未审核,2->审核通过,3->被拒绝
partnerstatus : 0,
///常见问题
question : [],
///英雄榜
ranklist : [],
toppic : {},
///更多的问题帮助是否已经获取过了,在帮助列表界面会有使用
isMoreQuestionGot : false,
///品牌风采的更多内容是否获取到了
isMoreBusinessStyleGot : false,
///业务动态的更多内容是否获取到了
isMoreBusinessDynamicGot : false,
3 years ago
clear : function(){
this.brandpro = [];
this.brandstyle = [];
this.busdyna = [];
this.question = [];
this.toppic = {};
this.isMoreQuestionGot = false;
this.isMoreBusinessStyleGot = false;
this.isMoreBusinessDynamicGot = false;
},
///获取主页信息
getMainPageData : async function(){
var res = await post("login/firstpages",{});
if(res.length <= 1){
///获取主页信息失败了
return;
}
var info = res[1];
var code = info.data.code;
if(code != 0){
return;
}
3 years ago
this.clear();
var data = info.data.data;
console.log("获取到首页信息:",data);
for(var key in data){
if(key == 'brandstyle' || key == 'busdyna' || key == 'question'){
//品牌风采,先处理下哦
var infos = data[key]; //这是一个对象数组
for(var i = 0;i<infos.length;i++){
var info = infos[i];
var skData = new SkipData();
skData.initWithNetData(info);
this[key].push(skData);
}
console.log(key,this[key]);
}else{
this[key] = data[key];
}
}
///拿到了所有的东西
this.isLoading = false;
}
}