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

yiyun-desktop-sdk

v0.0.13

Published

yiyun-desktop-sdk

Downloads

33

Readme

yiyun-desktop-sdk

亦云桌面端sdk补充说明:在亦云桌面端环境下才会返回yiyunSdk对象,否则为返回null,第三方应用也可以以此作为判断是否在桌面端环境下的依据

install

npm install yiyun-desktop-sdk

use example

import yiyunSdk from "yiyun-desktop-sdk"
yiyunSdk.file.previewImageAndVideo({
    imagesAndVideos: [
        {
            type: "image",
            src: "https://xxx.png",
        },
        {
            type: "video",
            src: "https://xxx.mp4",
        },
    ],
    index: 0,
});

1.File

previewImageAndVideo({imagesAndVideos,index})

预览图片和视频

yiyunSdk.file.previewImageAndVideo({
    imagesAndVideos: [
        {
            type: "image",
            src: "https://xxx.png",
        },
        {
            type: "video",
            src: "https://xxx.mp4",
        },
    ],
    index: 0,
});

请求参数说明

| 参数 | 类型 | 说明 | | --------------- | ------------- | ------------- | | imagesAndVideos | Array | 图片视频集合 | | index | Number | 初始索引 |

previewFile({ fileUrl, fileName, fileSize })

预览文件

yiyunSdk.file.previewFile({fileUrl:"https://xxx.mp3", fileName:"xxx.mp3", fileSize:10240})

请求参数说明

| 参数 | 类型 | 说明 | | --------------- | ------------- | ------------- | | fileUrl | String | 文件url | | fileName | String | 文件名称 | | fileSize | Number | 文件大小 |

openServerFileByLocalApp(fileUrl)

本地应用打开网络文件

await yiyunSdk.file.openServerFileByLocalApp("https://xxx.pdf");

请求参数说明

| 参数 | 类型 | 说明 | | --------------- | ------------- | ------------- | | fileUrl | String | 文件url |

返回参数说明

| 参数 | 类型 | 说明 | | --------------- | ------------- | ------------- | | code | Number | 0.失败 1.成功 | | message | String | 说明信息 | | data | Null | |

openServerFileByBrowser(fileUrl)

操作系统设置的默认浏览器打开网络文件

await yiyunSdk.file.openServerFileByBrowser("https://xxx.pdf");

请求参数说明

| 参数 | 类型 | 说明 | | --------------- | ------------- | ------------- | | fileUrl | String | 文件url |

返回参数说明

| 参数 | 类型 | 说明 | | --------------- | ------------- | ------------- | | code | Number | 0.失败 1.成功 | | message | String | 说明信息 | | data | Null | |

tips: 如果浏览器直接访问文件url,除pdf之外默认为下载,如需预览office,请自行拼接url, 例如: https://view.officeapps.live.com/op/view.aspx?src=https://xxx.docx

downloadServerFile(fileUrl)

下载网络文件到本地文件夹 - 无法指定下载到哪个目标文件夹

await yiyunSdk.file.downloadServerFile("https://xxx.pdf");

请求参数说明

| 参数 | 类型 | 说明 | | --------------- | ------------- | ------------- | | fileUrl | String | 文件url |

返回参数说明

| 参数 | 类型 | 说明 | | --------------- | ------------- | ------------- | | code | Number | 0.失败 1.成功 | | message | String | 说明信息 | | data | Null | |

saveAsServerFile(fileUrl)

网络文件另存为 - 可指定要下载到哪个目标文件夹

await yiyunSdk.file.saveAsServerFile("https://xxx.pdf");

请求参数说明

| 参数 | 类型 | 说明 | | --------------- | ------------- | ------------- | | fileUrl | String | 文件url |

返回参数说明

| 参数 | 类型 | 说明 | | --------------- | ------------- | ------------- | | code | Number | 0.失败 1.成功 | | message | String | 说明信息 | | data | Null | |

2.App

openApp({appId, path, fregment, openWay})

打开app

yiyunSdk.app.openApp({appId: "xxx", path: "", fregment: "", openWay: 0});

请求参数说明

| 参数 | 类型 | 说明 | | --------------- | ------------- | ------------- | | appId | String | 应用id | | openWay | Number | 打开方式 - 0: 工作台打开 1 :独立窗口打开 | | path | String | 要跳转的html文件 如:index.html | | fregment | String | 前端路由及参数(#后的内容)如:/detail?id=1|

isFullscreen()

获取目前窗口是否为最大化

const isFullscreen = await yiyunSdk.app.isFullscreen();

返回参数说明

| 参数 | 类型 | 说明 | | --------------- | ------------- | ------------- | | isFullscreen | Boolean | 是否为最大化 |

requestFullscreen()

设置最大化窗口

yiyunSdk.app.requestFullscreen();

exitFullscreen()

取消最大化窗口

yiyunSdk.app.exitFullscreen();

3.View

openEDiskSelector({ checkMode, selectKeys, fileTypeOptional })

打开E盘选择文件组件

const { data } = await yiyunSdk.view.openEDiskSelector({
    checkMode: 0,
    selectKeys: ["/19", "/17/31"],
    fileTypeOptional: ['pdf', 'png', '...'],
})
console.log(data)
/** 
 [{
    diskId: "xxx",
    fileId: "1",
    mimeType: "image/png",
    name: "xxx.png",
    path: "/1",
    size: 35151,
    sizeFormat: "34.3K",
    src: "https://xxx.png",
 }]
**/

请求参数说明

| 参数 | 类型 | 说明 | | --------------- | ------------- | ------------- | | checkMode | Number | 选择模式 - 0: 单选 1 :多选 | | selectKeys | Array | 已选文件key集合 | | fileTypeOptional| Array | 可见的文件类型, 默认全部可见 |

tips: 若要使用selectKeys,需提供完整文件路径,该路径会在文件选择时提供,参数名为path

返回参数说明

| 参数 | 类型 | 说明 | | --------------- | ------------- | ------------- | | code | Number | 0.失败 1.成功 | | message | String | 说明信息 | | data | Array | 已选文件集合 |

openEnterpriseModelSelector({ data, selectKeys })

打开企业模型组件

const { data } = await yiyunSdk.view.openEnterpriseModelSelector({
    data: [
        {
            key: "1",
            label: "一级 1",
            children: [
            {
                key: "1-1",
                label: "二级 1-1",
                children: [
                {
                    key: "1-1-1",
                    label: "三级 1-1-1",
                },
                ],
            },
            ],
        },
    ],
    selectKeys: ["1-1"],
})
console.log(data)
/** 
 [{
    key: "xxx",
    label: "xxx",
    ...property
 }]
**/

请求参数说明

| 参数 | 类型 | 说明 | | --------------- | ------------- | ------------- | | data | Array | 企业模型树 | | selectKeys | Array | 已选企业模型节点key集合 |

tips: key为树中全局唯一标识, label为节点名称, children对应节点的子节点集合, 其余所有属性不做要求,原样返回

返回参数说明

| 参数 | 类型 | 说明 | | --------------- | ------------- | ------------- | | code | Number | 0.失败 1.成功 | | message | String | 说明信息 | | data | Array | 已选企业模型节点集合 |

openDepartmentSelector({ data, selectKeys, checkMode })

打开组织架构 部门 组件

const { data } = await yiyunSdk.view.openDepartmentSelector({
    data: [
        {
            key: "1",
            label: "一级 1",
            children: [
            {
                key: "1-1",
                label: "二级 1-1",
                children: [
                {
                    key: "1-1-1",
                    label: "三级 1-1-1",
                },
                ],
            },
            ],
        },
    ],
    selectKeys: ["1-1"],
})
console.log(data)
/** 
 [{
    key: "xxx",
    label: "xxx",
    ...property
 }]
**/

请求参数说明

| 参数 | 类型 | 说明 | | --------------- | ------------- | ------------- | | data | Array | 组织架构部门树 | | selectKeys | Array | 已选组织架构部门key集合 | | checkMode | Number | 选择模式 - 0: 单选 1 :多选 |

tips: key为树中全局唯一标识, label为节点名称, children对应节点的子节点集合, 其余所有属性不做要求,原样返回

返回参数说明

| 参数 | 类型 | 说明 | | --------------- | ------------- | ------------- | | code | Number | 0.失败 1.成功 | | message | String | 说明信息 | | data | Array | 已选组织架构部门节点集合 |

openMemberOfDepartmentSelector({ data, selectKeys, checkMode })

打开组织架构 部门-成员 组件

const { data } = await yiyunSdk.view.openMemberOfDepartmentSelector({
    data: [
        {
            key: "1",
            parentKey: ""
            label: "部门1",
            type: 1,
            icon: null,
            children: [
                {
                    key: "1-1",
                    parentKey: "1",
                    label: "部门1-1",
                    type: 1,
                    icon: null,
                    children: [],
                },
                {
                    key: "1-2",  //全局唯一标识
                    parentKey: "1",
                    label: "张三",  //节点名称
                    type: 0,  // 0.成员 1.部门
                    icon: "https://xxx.png",  //成员头像 
                    id: "2",  //成员唯一标识
                    children: [], //子节点集合
                },                
            ],
        },
        {
            key: "2",
            parentKey: "",
            label: "张三",
            type: 0,
            icon: "https://xxx.png",
            id: "2"
        },  
    ],
    selectKeys: ["2"],
})
console.log(data)
/** 
 [{
    key: "2",
    parentKey: "",
    label: "张三",
    type: 0,
    icon: "https://xxx.png",
    id: "2",
    ...property
 }]
**/

请求参数说明

| 参数 | 类型 | 说明 | | --------------- | ------------- | ------------- | | data | Array | 组织架构部门-成员树 | | selectKeys | Array | 已选组织架构成员id集合 | | checkMode | Number | 选择模式 - 0: 单选 1 :多选 |

返回参数说明

| 参数 | 类型 | 说明 | | --------------- | ------------- | ------------- | | code | Number | 0.失败 1.成功 | | message | String | 说明信息 | | data | Array | 已选组织架构成员节点集合 |

closeAppViewLayer()

关闭应用视图层

yiyunSdk.view.closeAppViewLayer();

4.Data

getUserInfo()

获取用户信息

const { data } = await yiyunSdk.data.getUserInfo();
/** 
 {
    id: "xxx",
    name: "xxx",
    profilePicture: "xxx",
    phone: "123123123",
    token: "xxx",
    ...property
}
**/

返回参数说明

| 参数 | 类型 | 说明 | | --------------- | ------------- | ------------- | | code | Number | 0.失败 1.成功 | | message | String | 说明信息 | | data | Object | 用户信息 |

5.Event

  1. Event: 'scaned' - 扫码事件
  • return:Object - 返回
    • isPlatformQrCode: Boolean - 是否为平台二维码
    • data: String | Object - 平台二维码data为Object,反之为String

on

注册事件

export default {
    methods: {
        scanedHandler(data) {
            console.log(data)
        },
    },
    created() {
        yiyunSdk.event.on("scaned", this.scanedHandler)
    },
}

off

注销事件

export default {
    methods: {
        scanedHandler(data) {
            console.log(data)
        },
    },
    beforeDestroy() {
        yiyunSdk.event.off("scaned", this.scanedHandler)
    },
}