Skip to content
  • Projects
  • Groups
  • Snippets
  • Help

汪沁然 / AmibaLight

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Settings
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Mainjs

Mainjs

Last edited by 汪沁然 Apr 24, 2018
Page history

main.js

Main.js 是整个 阿米巴·轻 的主代码

api

api 变量中为多个 API 服务的 Endpoint 地址,包括阿米巴系统本身的 API

  • amiba: 阿米巴系统接口地址
  • soulposion: 灵感服务
  • oldpstore: 旧版暂存
  • datastore: 新版暂存
  • notify: 通知中心

gtag

此处为 Google 分析服务的代码

const 定义

const 定义中均为子模板

函数

clearOld

清除旧版本的 LocalStorage 存储

getTemplate

动态加载模板并返回(异步)

notify

显示通知

backgroundSetup

连接到通知中心并监听

sidebarSetup

装载侧边栏自动隐藏

pageSetup

定义前端路由

page('*', function(ctx, next){ /* Code */ }) 为鉴权中间件,负责检查是否登录,以及在页面切换时发出 Google 统计请求

getDates

获取时间数组,用于请假中心

setupPermission

登录后配置侧边栏

setupNotification

请求通知权限

setupMountPoint

登录后切换页面并初始化相应的页面 url 为相对地址,这部分请对照 eft/console 查看

setupToTop

配置右下角回顶部按钮自动隐藏与显示

addZero

对日期补 0 用

transformPageUrl

已废弃

logout

登出

变量

pages

前端路由回调

pages.efp

ef 主挂载点组件

notfoundtimes

修复有时候未正常跳转显示 404 NotFound 问题的计数器

notifycenter

用于标记通知中心是否启动

notifycenterInv

通知中心连接实体

permisson_obj

权限渲染列表

sidebar_ef

侧边栏渲染用的 ef 组件

*_tpl

子模板

permissionSetuped

标记权限是否被正确设置渲染了

  Clone repository
  • Cdn
  • Css
  • Eft
  • Home
  • Mainjs
  • 主页面
More Pages
×

New Wiki Page

Tip: You can specify the full path for the new file. We will automatically create any missing directories.