{"id":21177675,"url":"https://github.com/iflycn/vr_wechat","last_synced_at":"2026-03-11T05:04:10.587Z","repository":{"id":51333972,"uuid":"116700579","full_name":"iflycn/vr_wechat","owner":"iflycn","description":"Blues VR - 微信小程序版","archived":false,"fork":false,"pushed_at":"2018-01-11T02:32:39.000Z","size":129,"stargazers_count":27,"open_issues_count":0,"forks_count":12,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-10T00:38:41.300Z","etag":null,"topics":["krpano","miniprogram","vr","weui"],"latest_commit_sha":null,"homepage":"https://github.com/iflycn/vr_wechat","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iflycn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-08T16:27:50.000Z","updated_at":"2023-11-28T15:28:19.000Z","dependencies_parsed_at":"2022-09-14T04:00:38.530Z","dependency_job_id":null,"html_url":"https://github.com/iflycn/vr_wechat","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/iflycn/vr_wechat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iflycn%2Fvr_wechat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iflycn%2Fvr_wechat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iflycn%2Fvr_wechat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iflycn%2Fvr_wechat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iflycn","download_url":"https://codeload.github.com/iflycn/vr_wechat/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iflycn%2Fvr_wechat/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30372127,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T21:41:54.280Z","status":"online","status_checked_at":"2026-03-11T02:00:07.027Z","response_time":84,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["krpano","miniprogram","vr","weui"],"created_at":"2024-11-20T17:16:54.955Z","updated_at":"2026-03-11T05:04:05.579Z","avatar_url":"https://github.com/iflycn.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BLUES VR for WeChat\n全景图片浏览微信小程序，支持 VR 模式。\n![](https://github.com/iflycn/vr_wechat/blob/master/images/vr_device.png)\n\n## 依赖\n基于 `WeUI`、`krpano` 实现。\n\n## 关键代码\n### 获取全景图列表\n```html\n\u003c!--pages/index/index.wxml--\u003e\n\n\u003cblock wx:for=\"{{pano_type}}\" wx:key=\"{{item.id}}\"\u003e\n  \u003cview\u003e{{item.type}}\u003c/view\u003e\n  \u003cview\u003e\n    \u003cnavigator url=\"url?v={{item.id}}\" wx:for=\"{{item.list}}\" wx:key=\"{{item.id}}\"\u003e\n      \u003cview\u003e{{item.title}}\u003c/view\u003e\n      \u003cview wx:if=\"{{item.isNew}}\"\u003eNew\u003c/view\u003e\n      ...\n    \u003c/navigator\u003e\n  \u003c/view\u003e\n\u003c/block\u003e\n```\n```javascript\n// pages/index/index.js\n\ndata: {\n  pano_type: []\n},\n\nonLoad: function (options) {\n  var that = this;\n  wx.request({\n    url: \"url\",\n    success: function (res) {\n      console.log(\"[res.data]: %o\", res.data);\n      that.setData({\n        pano_type: res.data.pano\n      })\n    }\n  });\n}\n```\n### 加入/移除收藏\n```html\n\u003c!--pages/index/index.wxml--\u003e\n\n\u003cnavigator bindlongpress=\"joinFavorite\" data-id=\"{{item.id}}\" data-title=\"{{item.title}}\"\u003e\n  ...\n\u003c/navigator\u003e\n```\n```javascript\n// pages/index/index.js\n\njoinFavorite: function (e) {\n  var id = e.currentTarget.dataset.id, favorites = wx.getStorageSync(\"favorites\") || [], i = favorites.indexOf(id);\n  wx.showModal({\n    title: i \u003c 0 ? \"加入收藏\" : \"移出收藏\",\n    content: \"将“\" + e.currentTarget.dataset.title + \"”\" + (i \u003c 0 ? \"加入\" : \"移出\") + \"个人收藏?\",\n    confirmText: i \u003c 0 ? \"加入\" : \"移出\",\n    cancelText: \"取消\",\n    success: function (res) {\n      if (res.confirm) {\n        i \u003c 0 ? favorites.unshift(id) : favorites.splice(i, 1);\n        wx.setStorageSync(\"favorites\", favorites);\n        console.log(\"[favorites]: %o\", favorites);\n      }\n    }\n  });\n}\n```\n### 获取收藏列表\n```html\n\u003c!--pages/index/my_favorites.wxml--\u003e\n\n\u003cblock wx:for=\"{{favorites_list}}\" wx:for-index=\"i\" wx:key=\"{{favorites_list[i][0]}}\"\u003e\n  \u003cnavigator url=\"url?v={{favorites_list[i][0]}}\"\u003e\n    \u003cview\u003e{{favorites_list[i][1]}}\u003c/view\u003e\n    ...\n  \u003c/navigator\u003e\n\u003c/block\u003e\n```\n```javascript\n// pages/my_favorites/my_favorites.js\n\ndata: {\n  favorites_list: []\n},\n\nonLoad: function (options) {\n  var that = this;\n  wx.request({\n    url: \"url\",\n    success: function (res) {\n      var favorites_list = [], favorites = wx.getStorageSync(\"favorites\") || [];\n      for (var i = 0; i \u003c res.data.pano.length; i++) {\n        for (var j = 0; j \u003c res.data.pano[i].list.length; j++) {\n          favorites.indexOf(res.data.pano[i].list[j].id) \u003e= 0 \u0026\u0026 favorites_list.push([res.data.pano[i].list[j].id, res.data.pano[i].list[j].title]);\n        };\n      };\n      console.log(\"[favorites_list]: %o\", favorites_list);\n      that.setData({\n        favorites_list: favorites_list\n      })\n    }\n  });\n}\n```\n\n## 嵌入 H5\n详见 [https://github.com/iflycn/vr](https://github.com/iflycn/vr)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiflycn%2Fvr_wechat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiflycn%2Fvr_wechat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiflycn%2Fvr_wechat/lists"}