添加组件及页面
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
// pages/index/index.ts
|
||||
|
||||
import { menuConfig } from "@/utils/menuConfig";
|
||||
import { Subscribe } from "@/utils/subscribe";
|
||||
import { getDataSet, toObject } from "@/utils/util";
|
||||
import { loginStatus, post } from '@/utils/https';
|
||||
import { menuConfig } from '@/utils/menuConfig';
|
||||
import { getDataSet, toArray, toObject } from '@/utils/util';
|
||||
|
||||
// const app = getApp();
|
||||
// const Storage = app.Storage;
|
||||
@@ -11,94 +9,50 @@ Page({
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
isLogin: false,
|
||||
loading: true,
|
||||
BGColors: [
|
||||
"linear-gradient( 135deg, #FDEB71 10%, #F8D800 100%)",
|
||||
"linear-gradient( 135deg, #ABDCFF 10%, #0396FF 100%)",
|
||||
"linear-gradient( 135deg, #FEB692 10%, #EA5455 100%)",
|
||||
"linear-gradient( 135deg, #CE9FFC 10%, #7367F0 100%)",
|
||||
"linear-gradient( 135deg, #90F7EC 10%, #32CCBC 100%)",
|
||||
"linear-gradient( 135deg, #FFF6B7 10%, #F6416C 100%)",
|
||||
"linear-gradient( 135deg, #81FBB8 10%, #28C76F 100%)",
|
||||
"linear-gradient( 135deg, #E2B0FF 10%, #9F44D3 100%)",
|
||||
"linear-gradient( 135deg, #F97794 10%, #623AA2 100%)",
|
||||
"linear-gradient( 135deg, #FCCF31 10%, #F55555 100%)",
|
||||
"linear-gradient( 135deg, #F761A1 10%, #8C1BAB 100%)",
|
||||
"linear-gradient( 135deg, #43CBFF 10%, #9708CC 100%)",
|
||||
"linear-gradient( 135deg, #5EFCE8 10%, #736EFE 100%)",
|
||||
"linear-gradient( 135deg, #FAD7A1 10%, #E96D71 100%)",
|
||||
"linear-gradient( 135deg, #FFD26F 10%, #3677FF 100%)",
|
||||
"linear-gradient( 135deg, #A0FE65 10%, #FA016D 100%)",
|
||||
"linear-gradient( 135deg, #FFDB01 10%, #0E197D 100%)",
|
||||
"linear-gradient( 135deg, #FEC163 10%, #DE4313 100%)",
|
||||
"linear-gradient( 135deg, #92FFC0 10%, #002661 100%)",
|
||||
"linear-gradient( 135deg, #EEAD92 10%, #6018DC 100%)",
|
||||
"linear-gradient( 135deg, #F6CEEC 10%, #D939CD 100%)",
|
||||
"linear-gradient( 135deg, #52E5E7 10%, #130CB7 100%)",
|
||||
"linear-gradient( 135deg, #F1CA74 10%, #A64DB6 100%)",
|
||||
"linear-gradient( 135deg, #E8D07A 10%, #5312D6 100%)",
|
||||
"linear-gradient( 135deg, #EECE13 10%, #B210FF 100%)",
|
||||
"linear-gradient( 135deg, #79F1A4 10%, #0E5CAD 100%)",
|
||||
],
|
||||
params: {
|
||||
curr_page: 1,
|
||||
page_count: 20,
|
||||
},
|
||||
total: 100,
|
||||
current1: ["checkbox1", "checkbox2"],
|
||||
current2: "checkbox1",
|
||||
options: [
|
||||
{ label: "多选", value: "checkbox1" },
|
||||
{ label: "多选", value: "checkbox2" },
|
||||
{
|
||||
label:
|
||||
"多选标题多行多选标题多行多选标题多行多选标题多行多选标题多行多选标题多行",
|
||||
value: "checkbox3",
|
||||
maxLabelRow: 2,
|
||||
},
|
||||
{
|
||||
label: "多选",
|
||||
value: "checkbox4",
|
||||
content:
|
||||
"描述信息描述信息描述信息描述信息描述信息描述信息描述信息描述信息描述信息描述信息",
|
||||
maxContentRow: 2,
|
||||
},
|
||||
{ label: "多选", value: "checkbox11" },
|
||||
{ label: "多选", value: "checkbox21" },
|
||||
{
|
||||
label:
|
||||
"多选标题多行多选标题多行多选标题多行多选标题多行多选标题多行多选标题多行",
|
||||
value: "checkbox31",
|
||||
maxLabelRow: 2,
|
||||
},
|
||||
{
|
||||
label: "多选",
|
||||
value: "checkbox41",
|
||||
content:
|
||||
"描述信息描述信息描述信息描述信息描述信息描述信息描述信息描述信息描述信息描述信息",
|
||||
maxContentRow: 2,
|
||||
},
|
||||
'linear-gradient( 135deg, #FDEB71 10%, #F8D800 100%)',
|
||||
'linear-gradient( 135deg, #ABDCFF 10%, #0396FF 100%)',
|
||||
'linear-gradient( 135deg, #FEB692 10%, #EA5455 100%)',
|
||||
'linear-gradient( 135deg, #CE9FFC 10%, #7367F0 100%)',
|
||||
'linear-gradient( 135deg, #90F7EC 10%, #32CCBC 100%)',
|
||||
'linear-gradient( 135deg, #FFF6B7 10%, #F6416C 100%)',
|
||||
'linear-gradient( 135deg, #81FBB8 10%, #28C76F 100%)',
|
||||
'linear-gradient( 135deg, #E2B0FF 10%, #9F44D3 100%)',
|
||||
'linear-gradient( 135deg, #F97794 10%, #623AA2 100%)',
|
||||
'linear-gradient( 135deg, #FCCF31 10%, #F55555 100%)',
|
||||
'linear-gradient( 135deg, #F761A1 10%, #8C1BAB 100%)',
|
||||
'linear-gradient( 135deg, #43CBFF 10%, #9708CC 100%)',
|
||||
'linear-gradient( 135deg, #5EFCE8 10%, #736EFE 100%)',
|
||||
'linear-gradient( 135deg, #FAD7A1 10%, #E96D71 100%)',
|
||||
'linear-gradient( 135deg, #FFD26F 10%, #3677FF 100%)',
|
||||
'linear-gradient( 135deg, #A0FE65 10%, #FA016D 100%)',
|
||||
'linear-gradient( 135deg, #FFDB01 10%, #0E197D 100%)',
|
||||
'linear-gradient( 135deg, #FEC163 10%, #DE4313 100%)',
|
||||
'linear-gradient( 135deg, #92FFC0 10%, #002661 100%)',
|
||||
'linear-gradient( 135deg, #EEAD92 10%, #6018DC 100%)',
|
||||
'linear-gradient( 135deg, #F6CEEC 10%, #D939CD 100%)',
|
||||
'linear-gradient( 135deg, #52E5E7 10%, #130CB7 100%)',
|
||||
'linear-gradient( 135deg, #F1CA74 10%, #A64DB6 100%)',
|
||||
'linear-gradient( 135deg, #E8D07A 10%, #5312D6 100%)',
|
||||
'linear-gradient( 135deg, #EECE13 10%, #B210FF 100%)',
|
||||
'linear-gradient( 135deg, #79F1A4 10%, #0E5CAD 100%)',
|
||||
],
|
||||
block: [] as any[],
|
||||
authInfo: {} as any,
|
||||
menuList: [] as any,
|
||||
},
|
||||
handleLogin(e: any) {
|
||||
this.setData({ isLogin: e.detail });
|
||||
if (e.detail) {
|
||||
this.init();
|
||||
}
|
||||
},
|
||||
|
||||
change() {
|
||||
Subscribe.set("isLogin", "hello");
|
||||
// wx.navigateTo({ url: "/pages/my/my" });
|
||||
},
|
||||
changePage(e: any) {
|
||||
this.data.params.curr_page = e.detail.curr_page;
|
||||
this.setData({ params: this.data.params });
|
||||
},
|
||||
changeSelect(e: any) {
|
||||
console.log(e);
|
||||
},
|
||||
navToMy() {
|
||||
wx.navigateTo({ url: "/pages/my/my" });
|
||||
},
|
||||
init() {
|
||||
this.data.authInfo = {};
|
||||
const companyInfo = toObject(wx.getStorageSync("company_info"));
|
||||
const companyInfo = toObject(wx.getStorageSync('company_info'));
|
||||
this.data.menuList.length = 0;
|
||||
menuConfig.forEach((el) => {
|
||||
const children: any[] = [];
|
||||
@@ -115,22 +69,41 @@ Page({
|
||||
});
|
||||
}
|
||||
});
|
||||
// this.getIndex();
|
||||
this.getIndex();
|
||||
this.setData({
|
||||
authInfo: this.data.authInfo,
|
||||
menuList: this.data.menuList,
|
||||
hideTabKeys: companyInfo.staff_type == 3 ? ["2"] : [],
|
||||
hideTabKeys: companyInfo.staff_type == 3 ? ['2'] : [],
|
||||
});
|
||||
},
|
||||
getIndex() {
|
||||
post('Index/index', {}).then((res: any) => {
|
||||
const block = toArray(res?.block);
|
||||
if (block.length % 2 != 0) {
|
||||
block.push({ value: '', name: '敬请期待', unit: '' });
|
||||
}
|
||||
this.setData({ block });
|
||||
});
|
||||
},
|
||||
nav(e: any) {
|
||||
const url = getDataSet(e).url;
|
||||
wx.navigateTo({ url });
|
||||
const data = getDataSet(e);
|
||||
wx.navigateTo({ url: data.url });
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad() {},
|
||||
onLoad() {
|
||||
this.setData({ loading: true });
|
||||
loginStatus()
|
||||
.then(() => {
|
||||
this.setData({ isLogin: true, loading: false });
|
||||
this.init();
|
||||
})
|
||||
.catch((err) => {
|
||||
this.setData({ isLogin: false, loading: false });
|
||||
console.log('调用登录状态请求失败', err);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
@@ -142,7 +115,6 @@ Page({
|
||||
*/
|
||||
onShow() {
|
||||
wx.hideHomeButton();
|
||||
this.init();
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user