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 🙏

© 2026 – Pkg Stats / Ryan Hefner

hongshujs

v0.0.10

Published

cimos app js SDK 为cimos城市大脑 cimos鸿书 智慧产城提供功能服务

Readme

cimos_js

version : 0.0.10

SDK为H5⻚面在cimos城市大脑 cimos鸿书 智慧产城提供功能服务

CIMOS-JS 接入说明文档

此JS SDK为H5页面在CIMOS-APP环境中运行时提供与APP进行数据交互的方法。

安装

npm 安装

npm i hongshujs
import cimosApp from 'hongshujs'

版本适配

| SDK | CIMOS APP版本 | 鸿书 APP版本 | 青发产城 APP版本 | | ------ | ----------- | -------- |-------- | | v0.0.7 | v4.4.3+ | 1.2.0+ |1.3.0+ | | v0.0.6 | v4.4.3+ | 1.1.0+ |1.2.0+ | | v0.0.5 | v3.4.3+ | - |- |


功能介绍

1、验证是否是CIMOS APP环境

cimosApp.isAppContext().then(function(res) {
  alert(res);
})

2、打开摄像头功能

cimosApp.openCamera(type).then(function(res) {
  that.cameraUrl = res;
})
  • 参数type值:webUrl、base64。 当为webUrl的时候,将会上传拍照得到的图片,然后将链接地址返回。 当为base64的时候,照片将转换为base64格式返回。

3、获取定位

目前定位采取GCJ-02坐标系

cimosApp.getLocation().then(function(res){
  ///{"code": 0, "latitude": 0, "longitude": 0};
});

4、打电话

cimosApp.openTel(num).then(function(res){
	alert(res)
});

也可使用标签达到唤起电话的功能。例:

<a href="tel:133333333">打电话</a>

5、扫描二维码

cimosApp.openScanQrPage().then(function(res){
	alert(res)
});

6、退出页面

退出web容器页面

cimosApp.exitPage();

7、显示cimos对话框

cimosApp.showCimosDialog(content, title, leftBtnText rightBtnText, canWillPop).then(function(res) {
  alert(res)
});

点击左边按钮返回 0,点击右边按钮返回 1。

参数描述:

  • content为对话框提示内容,必填项。
  • title为对话框标题。必填项。
  • leftBtnText为左边按钮文字。选填。默认为‘取消’。
  • rightBtnText为右边按钮文字。选填。默认为‘确认’。
  • canWillPop为是否手机系统返回可关掉对话框。默认为false。

8、跳转用户信息页面

cimosApp.goToUserInfoPage();

9、获取用户令牌

cimosApp.getUserToken().then(function(res){
	alert(res)
});

10、打开登录页面

cimosApp.openLoginPage().then(function(res){
	alert(res)
});
  • 非登录状态下H5会跳转登录页(非一键登录)。登录状态下调用会直接返回数据。数据内容格式如下:
{'statue': true, 'token': "aaaadddsd"}

11、打开文件预览页面

打开app原生文件预览地址 支持格式如下:

| 格式 | android | ios | | ---- | ------- | --- | | doc | ✅ | ✅ | | docx | ✅ | ✅ | | ppt | ✅ | ✅ | | pptx | ✅ | ✅ | | xls | ✅ | ✅ | | xlsx | ✅ | ✅ | | pdf | ✅ | ✅ | | txt | ✅ | ✅ |

cimosApp.openPreviewFilePage(path);
  • path 文件地址 https/http开头、文件格式结尾的地址。

示例:

cimosApp.openPreviewFilePage("https://www.source.com/test/test.pdf");

12、分享文件

cimosApp.shareFile(fileUrl)
  • fileUrl 为待分享文件地址。必须以https/http开头、文件格式结尾。

13、分享图片

cimosApp.shareImage(imageUrl)
  • imageUrl 为待分享图片网络地址。

14、分享文字

cimosApp.shareText(content);
  • cantent 为待分享文字内容。

15、分享网页

cimosApp.shareWeb(webUrl, webTitle);
  • webUrl 为待分享网页地址。
  • webTitle 为分享标题。

16、下载文件

cimosApp.goToDownLoad(url).then(function(res){
	alert(res)
});
  • url为文件下载地址。
  • 下载文件会以打开手机内置浏览器下载.

17、修改标题

标题取html页面的title值为标题,本方法用于标题主动修改

cimosApp.changeTitle(str).then(function(res){
	alert(res)
});

18、是否显示分享按钮

分享按钮为H5页面头部右边位置,可分享微信朋友、分享微信朋友圈、复制链接。

cimosApp.showShareBtn(share).then(function(res){
	alert(res)
});
  • share值为'1'显示分享按钮,其它为隐藏分享按钮
  • H5链接URL中携带参数share也会在加载页面时判断是否显示分享按钮;
  • js方法优先级比参数方式高。

19、横竖屏切换

cimosApp.setScreenOrientations(screenDirection);
  • screenDirection参数值为landscape(横屏)portrait(竖屏)

20、跳转到通讯录

cimosApp.goToContact()

21、指定用户进入鸿书聊天页面

cimosApp.goToUserChat(mobileUserId, name, face);

参数说明:

  • mobileUserId为cimos系统中用户id。
  • name为用户昵称。
  • face为用户头像地址。

22、图片存储到手机相册

cimosApp.saverGallery(type,data)

参数说明:

  • type 数据类型: 0 为网络地址 1 为base64。
  • data 图片数据 当type为0时传入网络地址 当type为1时传入base64字符串。
v 0.0.6

23、H5页面标题栏样式修改

通过URL参数进行修改,例:
?frontColor=0xffFFB6C1&titleFontColor=0xffffffff&operateBgColor=0xff999999&operateBorderColor=0xff666666&operateShareEnableColor=0xff00FF00&operateShareDisableColor=0xffFFFF00

参数说明:

  • frontColor 标题栏背景色,默认0xffffffff。

  • titleFontColor 标题栏字体颜色,包括返回按钮,默认0xff000000。

  • operateBgColor 右边操作岛背景颜色,默认0x0A000000。

  • operateBorderColor 右边操作岛边框颜色,默认0x0D000000。

  • operateShareEnableColor 右边操作岛分享按钮可用状态颜色以及关闭按钮颜色,默认0xE6000000。

  • operateShareDisableColor 右边操作岛分享按钮不可用状态颜色,默认0x33000000。

v 0.0.7

24、打开导航地图列表

cimosApp.showMapNavigation(lat, lon, dec);

参数说明:

  • lat:维度。
  • lon:经度。
  • dec:位置描述。
v 0.0.7

25、弹出我的设置页面(用于自贸招商pad应用)

cimosApp.showUserInfo(isShow);

参数说明:

  • isShow:显示/隐藏。

26、跳转到要素页面的政策匹配(用于自贸招商pad应用)

cimosApp.pushElementPage();

参数说明:

  • 待补充