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 🙏

© 2024 – Pkg Stats / Ryan Hefner

yuxun-store

v2.0.5

Published

> TODO: description

Downloads

1

Readme

yuxun-store

誉讯网 存储

引用

对应版本:[email protected]

重大更新--修改userStore引用方式

import Vue from "vue";
import Vuex from "vuex";
import $router from "@/config/router";
import {
    getters,
    appStore,
    userStore,
    publicStore,
    EStoreActions,
    EDictType,
} from "yuxun-store";
import gettersPrivate from "./modules/getters";
import { websiteUrl } from "yuxun-config";
import {
    AddressGetProvinceAndCity,
    ChangeCurrentEp,
    DictDataGet,
    GetMemberInfo,
    MemberGetMyEpList,
} from "@/common/service/usercenter.service";
const modulesFiles = require.context("./modules/service", false, /\.(ts|js)$/);
const modules = modulesFiles
    .keys()
    .reduce((modules: any, modulePath: string) => {
        const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, "$1");

        const value = modulesFiles(modulePath);
        modules[moduleName] = value.default;
        return modules;
    }, {});
Vue.use(Vuex);

const store = new Vuex.Store({
    modules,
    getters: Object.assign(getters, gettersPrivate) as any,
});
// 动态加载基础store
store.registerModule("app", appStore(store as any, $router) as any);
store.registerModule(
    "user",
    userStore({
        $store: store as any,
        $router: $router as any,
        logoutCallback: () => {
            window.location.href = `${websiteUrl.sk}/login?callback=${window.location.href}`;
        },
    }) as any
);
store.registerModule("public", publicStore(store as any, $router) as any);

/** 获取字典数据 */
export function dispatchDictData(type: EDictType) {
    return store.dispatch(EStoreActions.GET_DICT_DATA, {
        remote: DictDataGet,
        type,
    });
}

/** 获取地区数据 */
export function dispatchAddress() {
    return store.dispatch(EStoreActions.GET_CITY, AddressGetProvinceAndCity);
}

/** 切换企业 */
export function dispatchChangeCurrentEp(epId: string) {
    return store.dispatch(EStoreActions.CHANGE_CURRENT_EP, {
        remote: ChangeCurrentEp,
        epId,
    });
}

/** 获取用户信息 */
export function dispatchSetMemberInfo() {
    return store.dispatch(EStoreActions.SET_MEMBER_INFO, {
        remoteMemberGetMyEpList: MemberGetMyEpList,
        remoteGetMemberInfo: GetMemberInfo,
    });
}

export default store;

获取当前用户已加入企业

usercenter.service.ts;

import {
    IResponseMemberGetMyEpList,
    IResponseGetMemberInfo,
} from "yuxun-store";

/**
 * 基础资源 B端页面顶部使用 包含自己创建并通过审核、成功加入、并且关系为启用的企业 (Auth)
 * @property { string } epId 企业Id
 * @property { string } epName 企业名称
 * @property { string } epCode 企业code
 * @property { string } epCodePath 企业code路径
 * @property { string } epNamePath 企业name路径
 * @property { string } adminFlag 管理员标识 1管理员
 * @property { string } defaultFlag 默认企业 1默认企业
 * @property { string } audit 审核状态 101待审核,103审核不通过 ,104通过
 * @property { string } firstId 企业Id
 * @property { string } parentId 企业Id
 */
export function MemberGetMyEpList() {
    return $http<Array<IResponseMemberGetMyEpList>>({
        url: `${process.env.VUE_APP_API_USER_CENTER}/Member/GetMyEpList`,
        method: "GET",
        auth: true,
    });
}

/**
 * 用户登录后获取菜单权限企业
 * @property { Array<IResponseGetMenuList> } menuList 菜单信息
 * @property { Array<IResponseGetMenuList> } privilegeList 接口信息
 * @property { Array<IResponseGetMenuList> } epList 企业信息
 */
export function GetMemberInfo(): Promise<IResponse<IResponseGetMemberInfo>> {
    return $http<IResponseGetMemberInfo>({
        url: `${process.env.VUE_APP_API_USER_CENTER}/member/GetMemberInfo`,
        auth: true,
        method: "GET",
    });
}

切换当前企业

usercenter.service.ts;

/**
 * 切换企业
 * @param { string } epId 切换的企业id
 */
export function ChangeCurrentEp(epId: string) {
    return $http<string>({
        url: `${process.env.VUE_APP_API_USER_CENTER}/Member/ChangeCurrentEp`,
        method: "POST",
        auth: true,
        params: {
            epId,
        },
    });
}

获取省市

usercenter.service.ts;

/**
 * 获取省市给企业管理员地区授权
 * @property { string } code 地区code
 * @property { string } name 地区名称
 * @property { string } children? 地区子集
 */
export function AddressGetProvinceAndCity() {
    return $http<Array<IResponseAddressGetProvinceAndCity>>({
        url: `${process.env.VUE_APP_API_USER_CENTER}/Address/GetProvinceAndCity`,
        method: "GET",
    });
}

获取字典

/**
 * 字典(枚举)列表
 * @property { string } id 字典id
 * @property { string } key 字典标签 如:男
 * @property { string } value 字典值 如:1
 * @property { string } parentId 父级id
 * @property { 0 | 1 } defaultFlag 是否默认 0否 1是
 */
export function DictDataGet(dictType: EDictType) {
    return $http<Array<IResponseDictDataGet>>({
        url: `${process.env.VUE_APP_API_USER_CENTER}/DictData/Get`,
        method: "GET",
        auth: true,
        params: {
            dictType,
        },
    });
}