npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

sg-admin-template

v1.0.0

Published

后台管理系统

Downloads

9

Readme

web-admin-template

Latest stable version: v0.0.1


vue2 + vuex + vue-router + webpack + ES6 + axios + sass + Element UI + iconfont + ESlint

Features

  • 权限
  • mock
  • 支持多页

Requirement

nodeJS >= v10.8.0 npm =>6.2.0

  • IE6~10 ×
  • IE11 √
  • chrome √

Installation

git clone  http://git.mr.com/frontend/web-admin-template.git

Quick start


# Install dependencies
npm install

# 建议不要用cnpm  安装有各种诡异的bug 可以通过如下操作解决npm速度慢的问题
npm install --registry=https://registry.npm.taobao.org

# 启动mock服务器 localhost:9800
npm run dev:mock

# Serve with hot reload at localhost:9528
npm run dev

# Build for production with minification
npm run build

# Build for production and view the bundle analyzer report
npm run build --report

最终你可以使用 npm run build --report 查看效果 如图: demo

Cli options / Configs

根目录下创建.env.local, 配置代理环境

# 接口前缀
VUE_APP_BASE_API='/api'
# 联调环境
VUE_APP_BASE_TARGET='http://192.168.32.138:8080/bi'

VUE_APP_BASE_TARGET 注释后默认为本地mock

Release

nginx相关改动

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;

    keepalive_timeout  65;


    server {
        listen       80;
        # 访问域名
        server_name admin.sharegoodsmall.com;
        location /gateway {
            proxy_redirect     off;
            proxy_set_header   Host    $host;
            proxy_set_header   X-Real-IP   $remote_addr;
            proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_pass_header Set-Cookie;
            proxy_set_header Cookie $http_cookie;
            # 反向代理接口
    		proxy_pass   http://api.sharegoodsmall.com/gateway;
        }
        # vue history 模式需要配置 否则404错误
        location / {
            # todo
            root  /Users/damon/Documents/webapp/crm/web-admin-template/dist;
            index  index.html index.htm;
            try_files $uri $uri/ /index.html;

            # 首页禁止缓存
            if ($request_filename ~ .*\.(htm|html)$) {
                add_header Cache-Control "no-cache,no-store";
            } 
            # 静态资源默认缓存14天
            if ($request_filename ~ .*\.(js|css|png|jpg)$) {
                expires 336h;
            } 
            # proxy_pass http://127.0.0.1:9001;   
        }
     }

}

Route

分为固定路由以及权限路由 固定路由包括/login/404(src/layout/router/constant-router.js)

Pages

页面统一放在src/views

API Reference

e.g

import HttpMiddleware from '@/igrow/http/http-middleware';
const HTTP_CONFIG = {
    // 所有接口前缀
    baseURL: '/api',
    // 所有接口超时时间
    timeout: 30000,
    // 全局接口请求前的钩子
    transformRequest({ label, data }) {
        $console.log(`[HTTP请求:${label} start]`, data);
    },
    // 全局接口请求后的钩子
    transformResponse({ response, label }) {
        $console.log(`[HTTP请求:${label} end]`, data);
        return response;
    },
    // 全局接口请求数据成功条件
    getResponseSuccess(response) {
        if (response.code === 0 || response.code === 10000) {
            return true;
        }
        return false;
    },
    // 全局接口请求错误的钩子
    handleError({ response, meta }) {
        if(meta.isShowError) {
            $console.log(`[HTTP请求失败] : ${response.url}`, response);
        }
        
    },
    // 全局接口请求成功的钩子
    handleSuccess({ response, meta }) {
    }
};

const { API } = new HttpMiddleware(
    [
        {
            // name 必填
            name: 'userLevelListAll',
            // label 可选
            label: '用户等级',
            // path 必填
            path: '/data/userlevel',
            // method 可选 默认post
            method: 'get',
            // config 可选 接口自定义请求头以及配置
            config:{
                timeout:10000,
                headers:{test:1}
            },
            // processData 可选 接口请求前处理参数
            processData(data) {
                if (data.category && !data.grade) {
                    data.grade = 1;
                }
                return data;
            },
            // success 可选 接口成功后处理数据
            success(res) {
                const list = res.data || [];
                list.forEach(item => {
                    item._uuid = item.level;
                    item._label = item.remark;
                });
                return res;
            }
        }
    ], HTTP_CONFIG);

// 可选 接口额外参参数(自定义)与全局配置handleSuccess、handleError配合使用
let meta = {isShowError:true};
// 请求参数
let data = {account:'damon',password:'123456'};
API.userLevelListAll(data,meta).then(res => {
    console.log('成功信息', res);
}).catch(err => {
    console.log('错误信息', err.message);
});

Mock

mock下建立数据和路径的关联,路径既是API中配置的path,文件名既API中配置的name(放在mock文件夹下)

Account Reference

github账号

[email protected] Hzmrnet20180808!@#

Components

todo

Licence

MIT

踩坑记

[email protected]的顶级路由不被选中问题(没有出现router-link-active)