diff --git a/.DS_Store b/.DS_Store index 08094f2..0dbc7d9 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json index a97fd25..4bbcf3c 100644 --- a/.hbuilderx/launch.json +++ b/.hbuilderx/launch.json @@ -14,6 +14,10 @@ { "launchtype" : "local" }, + "mp-weixin" : + { + "launchtype" : "local" + }, "type" : "uniCloud" } ] diff --git a/apis/interfaces/im.js b/apis/interfaces/im.js index 1c46001..63bc538 100644 --- a/apis/interfaces/im.js +++ b/apis/interfaces/im.js @@ -11,6 +11,13 @@ import { // 获取好友列表 const getFriends = () => { + return request({ + url: 'im/friends', + }, true) +} + +// 获取好友列表 +const getFriendsLetter = () => { return request({ url: 'im/friends/letter', }, true) @@ -85,62 +92,98 @@ const pedingFriend = (recipient) => { }) } -/** - * 好友申请数量 - */ -const getPendingCount = () => { +// 以下是群组相关业务的接口 +const getMyGroups = () => { return request({ - url: 'im/friends/pending/count' + url: 'im/groups' }) } /** - * 上传聊天附件 - * 图片 - * 语音 - * 视频 + * 获取群信息,包含基础信息和 14 个用户 */ -// 基础配置 -const config = { - apiUrl: 'http://api.zh.shangkelian.cn/api/', // 正式环境 - timeout: 60000 -} - -const uploadMessageFile = (file, type) => { - config.header = { - 'Accept': 'application/json', - 'Authorization': store.getters.getToken || '' - } - return new Promise((resolve, reject) => { - uni.uploadFile({ - url: config.apiUrl + 'im/upload', - filePath: file, - name: 'upload', - formData: { - type - }, - header: config.header || {}, - success: (res) => { - if (res.statusCode === 200) { - let updData = JSON.parse(res.data) - if (updData.status_code === 200) { - resolve(updData.data) - } else { - reject(updData) - } - } - }, - fail: (err) => { - console.log('ERR', err); - } - }) +const getGroupInfo = (groupId) => { + return request({ + url: 'im/groups/' + groupId }) } +const getGroupUsers = (groupId) => { + return request({ + url: 'im/groups/' + groupId + '/users' + }) +} + +const getGroupAnnouncements = (groupId) => { + return request({ + url: 'im/groups/' + groupId + '/announcements' + }) +} + +const createGroupAnnouncement = (groupId, content) => { + return request({ + method: 'POST', + url: 'im/groups/' + groupId + '/announcements', + data: { + content: content + } + }) +} + +const deleteGroupAnnouncement = (groupId, announcementId) => { + return request({ + method: 'DELETE', + url: 'im/groups/' + groupId + '/announcements/' + announcementId + }) +} + +/** + * 创建群聊 + */ +const createGroup = (data) => { + return request({ + method: 'POST', + url: 'im/groups', + data: data + }) +} + +const updateGroup = (groupId, data) => { + return request({ + method: 'PUT', + url: 'im/groups/' + groupId, + data: data + }) +} + +/** + * 搜索群聊 + */ +const searchGroup = (name) => { + return request({ + url: 'im/groups/search?name=' + name + }) +} + +const joinGroup = (groupId) => { + return request({ + method: 'POST', + url: 'im/groups/' + groupId + '/join' + }) +} + +const quitGroup = (groupId) => { + return request({ + method: 'POST', + url: 'im/groups/' + groupId + '/quit' + }) +} + export { getImToken, deleteFriend, getFriends, + getFriendsLetter, getUserInfo, getFriendInfo, getPedings, @@ -148,6 +191,15 @@ export { rejectFriend, searchFriend, pedingFriend, - getPendingCount, - uploadMessageFile + getMyGroups, + createGroup, + updateGroup, + getGroupInfo, + getGroupUsers, + getGroupAnnouncements, + createGroupAnnouncement, + deleteGroupAnnouncement, + searchGroup, + joinGroup, + quitGroup } diff --git a/lib/emoji.js b/lib/emoji.js new file mode 100644 index 0000000..53a62a2 --- /dev/null +++ b/lib/emoji.js @@ -0,0 +1,33 @@ +export default [ + "😀", "😁", "😃", "😄", "😅", "😆", "😉", "😊", "😋", "😎", "😍", + "😘", "😗", "😙", "😚", "☺", "😇", "😐", "😑", "😶", "😏", "😣", "😥", "😮", "😯", "😪", + "😫", "😴", "😌", "😛", "😜", "😝", "😒", "😓", "😔", "😕", "😲", "😷", "😖", "😞", "😟", + "😤", "😢", "😭", "😦", "😧", "😨", "😬", "😰", "😱", "😳", "😵", "😡", "😠", + "👦", "👧", "👨", "👩", "👴", "👵", "👶", "👱", "👮", "👲", "👳", "👷", "👸", "💂", "🎅", "👰", "👼", + "💆", "💇", "🙍", "🙎", "🙅", "🙆", "💁", "🙋", "🙇", "🙌", "🙏", "👤", "👥", "🚶", "🏃", "👯", + "💃", "👫", "👬", "👭", "💏", "💑", "👪", "💪", "👈", "👉", "☝", "👆", "👇", "✌", "✋", "👌", + "👍", "👎", "✊", "👊", "👋", "👏", "👐", "✍", "👣", "👀", "👂", "👃", "👅", "👄", "💋", "👓", + "👔", "👙", "👛", "👜", "👝", "🎒", "💼", "👞", "👟", "👠", "👡", "👢", "👑", + "👒", "🎩", "🎓", "💄", "💅", "💍", "🌂", "📶", "📳", "📴", "♻", "🏧","🚮", "🚰", "♿", "🚹", "🚺", + "🚻", "🚼", "🚾", "⚠", "🚸", "⛔", "🚫", "🚳", "🚭", "🚯", "🚱", "🚷", "🔞", "💈", + "🙈", "🐒", "🐶", "🐕", "🐩", "🐺", "🐱","🐈", "🐯", "🐅", "🐆", "🐴", "🐎", "🐮", "🐂", + "🐃","🐄","🐷","🐖","🐗","🐽","🐏","🐑","🐐","🐪","🐫","🐘","🐭", + "🐁","🐀","🐹","🐰","🐇","🐻","🐨","🐼","🐾","🐔","🐓","🐣","🐤","🐥", + "🐦", "🐧", "🐸", "🐊","🐢", "🐍", "🐲", "🐉", "🐳", "🐋", "🐬", "🐟", "🐠", "🐡", + "🐙", "🐚", "🐌", "🐛", "🐜", "🐝", "🐞", "🦋", "💐", "🌸", "💮", "🌹", "🌺", + "🌻", "🌼", "🌷", "🌱", "🌲", "🌳", "🌴", "🌵", "🌾", "🌿", "🍀", "🍁", "🍂", "🍃", + "🌍","🌎","🌏","🌐","🌑","🌒","🌓","🌔","🌕","🌖","🌗","🌘","🌙","🌚", + "🌛","🌜","☀","🌝","🌞","⭐","🌟","🌠","☁","⛅","☔","⚡","❄","🔥","💧","🌊", + "🏀", "🏈", "🏉", "🎾", "🎱", "🎳", "⛳", "🎣", "🎽", "🎿", + "😈", "👿", "👹", "👺", "💀", "☠", "👻", "👽", "👾", "💣", + "🌋", "🗻", "🏠", "🏡", "🏢", "🏣", "🏤", "🏥", "🏦", "🏨", + "⛲", "🌁", "🌃", "🌆", "🌇", "🎠", "🎡", "🎢", "🚂", + "🚌", "🚍", "🚎", "🚏", "🚐", "🚑", "🚒", "🚓", "🚔", "🚕", "🚖", "🚗", "🚘", + "💌", "💎", "🔪", "💈", "🚪", "🚽", "🚿", "🛁", "⌛", "⏳", "⌚", "⏰", "🎈", "🎉", + "💤", "💢", "💬", "💭", "♨", "🌀", "🔔", "🔕", "✡", "✝", "🔯", "📛", "🔰", "🔱", "⭕", "✅", + "☑", "✔", "✖", "❌", "❎", "➕", "➖", "➗", "➰", "➿", "〽", "✳", "✴", "❇", "‼", "⁉", "❓", "❔", "❕", "❗", + "🕛", "🕧", "🕐", "🕜", "🕑", "🕝", "🕒", "🕞", "🕓", "🕟", "🕔", "🕠", "🕕", "🕡", + "🕖", "🕢", "🕗", "🕣", "🕘", "🕤", "🕙", "🕥", "🕚", "🕦", "⏱", "⏲", "🕰", + "💘", "❤", "💓", "💔", "💕", "💖", "💗", "💙", "💚", "💛", "💜", "💝", "💞", "💟❣", + "🍇", "🍈", "🍉", "🍊", "🍋", "🍌", "🍍", "🍎", "🍏", "🍐", "🍑", "🍒", "🍓", +] \ No newline at end of file diff --git a/manifest.json b/manifest.json index 38019e0..c65cec7 100644 --- a/manifest.json +++ b/manifest.json @@ -2,8 +2,8 @@ "name" : "ZH-HEALTH", "appid" : "__UNI__C29473D", "description" : "ZH-HEALTH,您手上的健康管理专家", - "versionName" : "1.0.7", - "versionCode" : 107, + "versionName" : "1.0.8", + "versionCode" : 108, "transformPx" : false, /* 5+App特有相关 */ "app-plus" : { @@ -22,7 +22,9 @@ "Payment" : {}, "Share" : {}, "SQLite" : {}, - "VideoPlayer" : {} + "VideoPlayer" : {}, + "Geolocation" : {}, + "Fingerprint" : {} }, /* 应用发布信息 */ "distribute" : { @@ -78,7 +80,17 @@ } }, "ad" : {}, - "push" : {} + "push" : {}, + "geolocation" : { + "amap" : { + "__platform__" : [ "android" ], + "appkey_ios" : "", + "appkey_android" : "05b7f32ca9c897c8b63c505d92cd654b" + }, + "system" : { + "__platform__" : [ "android" ] + } + } }, "icons" : { "android" : { diff --git a/package.json b/package.json index bbbbddf..92efc30 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,6 @@ "description": "ZH健康", "main": "main.js", "dependencies": { - "bitcore-lib": "^8.25.25", - "bitcore-mnemonic": "^8.25.25", "moment": "^2.29.1", "uni-read-pages": "^1.0.5", "uni-simple-router": "^2.0.7", diff --git a/pages.json b/pages.json index 03b0587..4dae9c8 100644 --- a/pages.json +++ b/pages.json @@ -266,7 +266,7 @@ "path": "pages/sign/index", "name": "signIndex", "style": { - "navigationBarTitleText": "每日签到", + "navigationBarTitleText": "每日打卡", "navigationBarBackgroundColor": "#FFFFFF" } }, @@ -367,28 +367,16 @@ "path": "pages/im/index", "name": "IM", "style": { - "navigationBarBackgroundColor": "#FFFFFF", "navigationStyle": "custom" } }, { - "path": "pages/im/private/index", - "name": "imPrivate", + "path": "pages/im/private/chat", "style": { - "navigationBarTitleText": "聊天", - "navigationBarBackgroundColor": "#F3F6FB", "disableScroll": true, - "app-plus": { - "titleNView": { - "type": "default", - "buttons": [{ - "float": "right", - "fontSrc": "/static/iconfont.ttf", - "text": "\ue607", - "fontSize": "20px" - }] - } - } + "navigationBarTitleText": "聊天", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#F3F6FB" } }, { @@ -420,24 +408,21 @@ "path": "pages/im/friends/pending", "name": "imFriendsPending", "style": { - "navigationBarTitleText": "新朋友", - "navigationBarBackgroundColor": "#F3F6FB" + "navigationBarTitleText": "新朋友" } }, { "path": "pages/im/friends/search", "name": "SearchFriend", "style": { - "navigationBarTitleText": "好友搜索", - "navigationBarBackgroundColor": "#F3F6FB" + "navigationBarTitleText": "好友搜索" } }, { "path": "pages/im/friends/info", "name": "imFriendsInfo", "style": { - "navigationBarTitleText": "好友资料", - "navigationBarBackgroundColor": "#FFFFFF" + "navigationBarTitleText": "用户资料" } }, { @@ -451,9 +436,84 @@ }, { "path": "pages/im/group/index", - "name": "imGroup", + "name": "imGroups", "style": { - "navigationBarTitleText": "我的群聊" + "navigationBarTitleText": "我的群聊", + "app-plus": { + "titleNView": { + "type": "default", + "buttons": [{ + "float": "right", + "fontSrc": "/static/iconfont.ttf", + "text": "\ue60a", + "fontSize": "20px" + }] + } + } + } + }, + { + "path": "pages/im/group/chat", + "name": "imGroupChat", + "style": { + "navigationBarTitleText": "群聊", + "app-plus": { + "titleNView": { + "type": "default", + "buttons": [{ + "float": "right", + "fontSrc": "/static/iconfont.ttf", + "text": "\ue607", + "fontSize": "20px" + }] + } + } + } + }, + { + "path": "pages/im/group/info", + "name": "imGroupInfo", + "style": { + "navigationBarTitleText": "群信息" + } + }, + { + "path": "pages/im/group/create", + "name": "imGroupCreate", + "style": { + "navigationBarTitleText": "创建群聊" + } + }, + { + "path": "pages/im/group/users", + "name": "imGroupUsers", + "style": { + "navigationBarTitleText": "群成员" + } + }, + { + "path": "pages/im/group/announcement", + "name": "imGroupAnnouncement", + "style": { + "navigationBarTitleText": "群公告", + "app-plus": { + "titleNView": { + "type": "default", + "buttons": [{ + "float": "right", + "fontSrc": "/static/iconfont.ttf", + "text": "\ue60a", + "fontSize": "20px" + }] + } + } + } + }, + { + "path": "pages/im/group/announceCreate", + "name": "imGroupAnnouncementCreate", + "style": { + "navigationBarTitleText": "发布群公告" } }, { @@ -566,14 +626,6 @@ "navigationBarBackgroundColor": "#34CE98", "navigationBarTextStyle": "white" } - }, { - "path": "pages/im/private/chat", - "style": { - "disableScroll": true, - "navigationBarTitleText": "聊天", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#F3F6FB" - } } ], "tabBar": { diff --git a/pages/.DS_Store b/pages/.DS_Store index 83144c2..2c2ce98 100644 Binary files a/pages/.DS_Store and b/pages/.DS_Store differ diff --git a/pages/im/components/conversationList.vue b/pages/im/components/conversationList.vue new file mode 100644 index 0000000..cf3eeca --- /dev/null +++ b/pages/im/components/conversationList.vue @@ -0,0 +1,163 @@ + + + + + diff --git a/pages/im/components/friendApplyCell.vue b/pages/im/components/friendApplyCell.vue new file mode 100644 index 0000000..94f3263 --- /dev/null +++ b/pages/im/components/friendApplyCell.vue @@ -0,0 +1,112 @@ + + + + + diff --git a/components/friend-apply-reject-agree/index.vue b/pages/im/components/friendApplyList.vue similarity index 86% rename from components/friend-apply-reject-agree/index.vue rename to pages/im/components/friendApplyList.vue index c05d136..10e2762 100644 --- a/components/friend-apply-reject-agree/index.vue +++ b/pages/im/components/friendApplyList.vue @@ -1,15 +1,14 @@ - + + + - + } + + + diff --git a/pages/user/index.vue b/pages/user/index.vue index 91ff793..9f92075 100644 --- a/pages/user/index.vue +++ b/pages/user/index.vue @@ -155,12 +155,10 @@ if (this.$store.state.token === '') return; info() .then(res => { - console.log(res); uni.setNavigationBarTitle({ title: res.nickname }); this.userInfo = res; - console.log(res); }) .catch(err => { uni.showToast({ diff --git a/pages/wallet/add.vue b/pages/wallet/add.vue index 5aca83c..9c2311c 100644 --- a/pages/wallet/add.vue +++ b/pages/wallet/add.vue @@ -1,64 +1,68 @@ - - - - - - - + + diff --git a/pages/wallet/create.vue b/pages/wallet/create.vue index 3594a7c..6b9cea7 100644 --- a/pages/wallet/create.vue +++ b/pages/wallet/create.vue @@ -1,187 +1,193 @@ - - - - - - - + + diff --git a/pages/wallet/mnemonic.vue b/pages/wallet/mnemonic.vue index 16d7dd0..7ff7c4b 100644 --- a/pages/wallet/mnemonic.vue +++ b/pages/wallet/mnemonic.vue @@ -1,112 +1,122 @@ - - - - - diff --git a/pages/wallet/privatekey.vue b/pages/wallet/privatekey.vue index 7c3def9..026db9e 100644 --- a/pages/wallet/privatekey.vue +++ b/pages/wallet/privatekey.vue @@ -1,119 +1,130 @@ - - - - - diff --git a/pages/wallet/property.vue b/pages/wallet/property.vue index 34b6d54..dc1374e 100644 --- a/pages/wallet/property.vue +++ b/pages/wallet/property.vue @@ -1,359 +1,386 @@ - - - - diff --git a/pages/wallet/resetPassword.vue b/pages/wallet/resetPassword.vue index b888d96..0f83b47 100644 --- a/pages/wallet/resetPassword.vue +++ b/pages/wallet/resetPassword.vue @@ -1,198 +1,203 @@ - - - - diff --git a/pages/wallet/validation.vue b/pages/wallet/validation.vue index 715c48f..46a1567 100644 --- a/pages/wallet/validation.vue +++ b/pages/wallet/validation.vue @@ -1,170 +1,178 @@ - - - - - diff --git a/router/index.js b/router/index.js index b3b5465..c9daf3f 100644 --- a/router/index.js +++ b/router/index.js @@ -4,16 +4,16 @@ import { } from 'uni-simple-router'; import store from '@/store/index' -// #ifdef APP-NVUE -// CALL 页面,必须是nvue,但是NVUE 不支持webpack的 ROUTES 注入 +// CALL 页面,必须是nvue,但是NVUE 不支持webpack的 ROUTES 注入 // https://github.com/SilurianYang/uni-read-pages/issues/20 +// #ifdef APP-NVUE const ROUTES = [{ - 'path': '/pages/im/private/call', - 'name': 'imPrivateCall' -},{ - 'path': '/pages/im/private/chat', - 'name': 'imPrivateChat' -}] + "path": "/pages/im/private/call" +}, { + "path": "/pages/im/private/chat" +}, { + "path": "/pages/im/group/chat" +}]; // #endif const router = createRouter({ diff --git a/static/.DS_Store b/static/.DS_Store index 7d1d99c..a81ade7 100644 Binary files a/static/.DS_Store and b/static/.DS_Store differ diff --git a/static/icon/clock_icon.png b/static/icon/clock_icon.png new file mode 100644 index 0000000..43c4066 Binary files /dev/null and b/static/icon/clock_icon.png differ diff --git a/static/icon/popups-icon-00.png b/static/icon/popups-icon-00.png new file mode 100644 index 0000000..152b069 Binary files /dev/null and b/static/icon/popups-icon-00.png differ diff --git a/static/icon/popups-icon-01.png b/static/icon/popups-icon-01.png new file mode 100644 index 0000000..105e953 Binary files /dev/null and b/static/icon/popups-icon-01.png differ diff --git a/static/icon/popups-icon-02.png b/static/icon/popups-icon-02.png new file mode 100644 index 0000000..359ff0f Binary files /dev/null and b/static/icon/popups-icon-02.png differ diff --git a/static/icon/popups-icon-03.png b/static/icon/popups-icon-03.png new file mode 100644 index 0000000..a545779 Binary files /dev/null and b/static/icon/popups-icon-03.png differ diff --git a/static/icon/popups-icon-04.png b/static/icon/popups-icon-04.png new file mode 100644 index 0000000..e49ecaf Binary files /dev/null and b/static/icon/popups-icon-04.png differ diff --git a/static/icon/popups-icon-05.png b/static/icon/popups-icon-05.png new file mode 100644 index 0000000..17ad1dd Binary files /dev/null and b/static/icon/popups-icon-05.png differ diff --git a/static/icon/popups-icon.png b/static/icon/popups-icon.png new file mode 100644 index 0000000..889c3e4 Binary files /dev/null and b/static/icon/popups-icon.png differ diff --git a/static/iconfont.css b/static/iconfont.css index e3beb58..8325c87 100644 --- a/static/iconfont.css +++ b/static/iconfont.css @@ -1,6 +1,6 @@ @font-face { font-family: "iconfont"; /* Project id 2869797 */ - src: url('@/static/iconfont.ttf') format('truetype'); + src: url('@/static/iconfont.ttf') format('truetype'), } .iconfont { @@ -11,6 +11,14 @@ -moz-osx-font-smoothing: grayscale; } +.icon-jia:before { + content: "\e60a"; +} + +.icon-dui:before { + content: "\e609"; +} + .icon-gengduo2:before { content: "\e608"; } diff --git a/static/iconfont.ttf b/static/iconfont.ttf index bc0ec3a..e226ba2 100644 Binary files a/static/iconfont.ttf and b/static/iconfont.ttf differ diff --git a/store/modules/im.js b/store/modules/im.js index e72b86e..4994c18 100644 --- a/store/modules/im.js +++ b/store/modules/im.js @@ -2,98 +2,138 @@ import im from "@/utils/im/index.js" export default { state: { - friends: {}, - sender: {}, + contacts: {}, + myInfo: {} }, getters: { - friends(state) { - return state.friends + contacts(state) { + return state.contacts }, - userInfo: (state) => (targetId) => { - if (state.friends[targetId]) { - return state.friends[targetId] + contactInfo: (state) => (targetId) => { + if (state.contacts[targetId]) { + const info = state.contacts[targetId] + + return { + name: info.name, + hash: info.hash, + portraitUrl: info.localAvatar ? info.localAvatar : require('@/static/user/cover.png') + } } else { - console.log('没找到,死循环了,得处理 todo', targetId); - // im.syncUserInfo(targetId) return { name: '', - address: '', hash: '', portraitUrl: '' } } }, - hasUser: (state) => (targetId) => { - return Boolean(state.friends[targetId]) + // 联系人是否存在 + contactIsExist: (state) => (targetId) => { + return Boolean(state.contacts[targetId]) }, sender(state) { - return state.sender + return state.myInfo } }, mutations: { - updateFriends(state, userInfo) { - Vue.set(state.friends, userInfo.userId, userInfo) + updateContactInfo(state, contactInfo) { + Vue.set(state.contacts, contactInfo.targetId, contactInfo) }, - SET_state_sender(state, userInfo) { - state.sender = userInfo + setSenderInfo(state, contactInfo) { + state.myInfo = { + userId: contactInfo.targetId, + name: contactInfo.name, + portraitUrl: contactInfo.portraitUrl + } } }, actions: { setSenderInfo({ commit - }, userInfo) { - commit('SET_state_sender', userInfo) + }, contactInfo) { + commit('setSenderInfo', contactInfo) }, - updateFriends({ + // 载入好友信息 + launchContact({ commit - }, userInfo) { - commit('updateFriends', userInfo) - const model = uni.model.friendModel - model.find('userId=' + userInfo.userId, (err, user) => { - if (!err && user.length == 0) { - saveAvatar(userInfo, (savedFilePath) => { - model.insert({ - userId: userInfo.userId, - name: userInfo.name, - hash: userInfo.hash, - address: userInfo.address, - portraitUrl: savedFilePath, - }, (err, result) => {}) - userInfo.portraitUrl = savedFilePath - commit('updateFriends', userInfo) - }) - } else if (!err && user[0].hash != userInfo.hash) { - saveAvatar(userInfo, (savedFilePath) => { - model.update('userId=' + userInfo.userId, { - name: userInfo.name, - hash: userInfo.hash, - portraitUrl: savedFilePath, - }, (err, result) => {}) - userInfo.portraitUrl = savedFilePath - commit('updateFriends', userInfo) - }) - } else if (!err && user[0].portraitUrl.length > 50) { - saveAvatar(userInfo, (savedFilePath) => { - model.update('userId=' + userInfo.userId, { - name: userInfo.name, - hash: userInfo.hash, - portraitUrl: savedFilePath, - }, (err, result) => {}) - - userInfo.portraitUrl = savedFilePath - commit('updateFriends', userInfo) - }) - } else { - console.log('不用操作', user[0]); - } + }, data) { + commit('updateContactInfo', data) + }, + // 更新好友信息,这个时候要校验hash值了 + updateContact({ + commit, + dispatch + }, contactInfo) { + const model = uni.model.contactModel + model.find('targetId="' + contactInfo.targetId + '"', (err, result) => { + if (result.length == 0) { + // 没有数据,直接新增一条 + dispatch('initContact', contactInfo) + } else if (contactInfo.hash != result[0].hash) { + commit('updateContactInfo', contactInfo) + if (contactInfo.portraitUrl && contactInfo.portraitUrl != result[0].portraitUrl) { + saveAvatar(contactInfo, (savedFilePath) => { + const info = { + targetId: contactInfo.targetId, + name: contactInfo.name, + hash: contactInfo.hash, + portraitUrl: contactInfo.portraitUrl, + localAvatar: savedFilePath + } + model.update('targetId=' + contactInfo.targetId, info, (err, res) => {}) + commit('updateContactInfo', info) + }) + } else { + const info = { + targetId: contactInfo.targetId, + name: contactInfo.name, + hash: contactInfo.hash, + portraitUrl: contactInfo.portraitUrl, + localAvatar: result[0].localAvatar + } + model.update('targetId="' + contactInfo.targetId + '"', info, (err, res) => {}) + } + } else {} }) + }, + // 初始化好友信息 + initContact({ + commit + }, contactInfo) { + // 将好友信息保存到vuex的内存中,方便立即使用 + commit('updateContactInfo', contactInfo) + const model = uni.model.contactModel + // 用户头像,是否需要下载到本地 + if (contactInfo.portraitUrl) { + saveAvatar(contactInfo, (savedFilePath) => { + const info = { + targetId: contactInfo.targetId, + name: contactInfo.name, + hash: contactInfo.hash, + portraitUrl: contactInfo.portraitUrl, + localAvatar: savedFilePath + } + model.insert(info, (err, res) => {}) + // 保存头像后,更新信息 + commit('updateContactInfo', info) + }) + } else { + // 直接将信息,写入数据库 + const info = { + targetId: contactInfo.targetId, + name: contactInfo.name, + hash: contactInfo.hash, + portraitUrl: contactInfo.portraitUrl, + localAvatar: '' + } + model.insert(info, (err, res) => {}) + } } } } -const saveAvatar = (userInfo, callback) => { +const saveAvatar = (contactInfo, callback) => { uni.downloadFile({ - url: userInfo.portraitUrl, + url: contactInfo.portraitUrl, success: ({ tempFilePath }) => { @@ -106,8 +146,6 @@ const saveAvatar = (userInfo, callback) => { } }) }, - fail: (err) => { - console.log('头像保存失败', err); - } + fail: (err) => {} }) } diff --git a/utils/im/data.js b/utils/im/data.js new file mode 100644 index 0000000..495c149 --- /dev/null +++ b/utils/im/data.js @@ -0,0 +1,16 @@ +// 获取新好友申请数量 +const getPendingCount = (callback) => { + RongIMLib.getConversationList([RongIMLib.ConversationType.SYSTEM], 100, 0, (res) => { + if (res.code === 0) { + const pendingCount = res.conversations.filter((item) => { + return item.objectName == RongIMLib.ObjectName.ContactNotification + }).length + + callback(pendingCount) + } + }) +} + +export default { + getPendingCount +} diff --git a/utils/im/historyMessages.json b/utils/im/historyMessages.json deleted file mode 100644 index 97f2e47..0000000 --- a/utils/im/historyMessages.json +++ /dev/null @@ -1,23 +0,0 @@ -[{ - "objectName": "RC:TxtMsg", - "receivedTime": 1643080237399, - "extra": "", - "messageUId": "BUFC-3FSU-OLE4-I31K", - "conversationType": 1, - "messageDirection": 2, - "senderUserId": "10041", - "content": { - "content": "你好,这是 1710 条消息条消息条消息条消息条消息条消息条消息条消息条消息0.97796900 1642741562", - "objectName": "RC:TxtMsg", - "userInfo": { - "userId": "10041", - "name": "我是eth", - "portraitUrl": "http://storage.zh.shangkelian.cn/images/2022/01/12/3d2a103386df6822db7e5290272e8bc2.png" - } - }, - "targetId": "10041", - "sentTime": 1642741563003, - "messageId": 2, - "receivedStatus": 1, - "sentStatus": 30 -}] diff --git a/utils/im/index.js b/utils/im/index.js index 78e8abe..4c22b53 100644 --- a/utils/im/index.js +++ b/utils/im/index.js @@ -2,6 +2,7 @@ import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index' import * as CallLib from '@/uni_modules/RongCloud-CallWrapper/lib/index' import store from '@/store/index.js' import message from './message.js' +import listeners from './listeners.js' import { getFriends, getUserInfo, @@ -10,7 +11,7 @@ import { const initIm = (KEY) => { RongIMLib.init(KEY) - CallLib.init() + // CallLib.init() addListeners() // 初始化的时候 自动链接 if (store.getters.getToken !== '') { @@ -47,25 +48,37 @@ const setNotifyBadge = () => { /** * 连接IM服务 * @param {string} token token - * @param {object} userInfo {userId: string, name: string, portraitUrl: string} + * @param {object} userInfo {targetId: string, name: string, portraitUrl: string} */ const connect = (token, userInfo, callback) => { RongIMLib.connect(token, res => { - console.log('连接结果', res); - callback(res) - }) + // 更新个人信息 + store.dispatch('setSenderInfo', userInfo) + // 设置未读消息数量 + setNotifyBadge() + // 首次运行获取好友列表 + const FK = 'IFT_' + userInfo.targetId - store.dispatch('setSenderInfo', userInfo) - - setNotifyBadge() - - const model = uni.model.friendModel - - model.find((err, results) => { - console.log('好友列表', results); - results.map(item => { - store.dispatch('updateFriends', item) + uni.getStorage({ + key: FK, + success: () => { + const model = uni.model.contactModel + model.find((err, results) => { + results.map(item => { + store.dispatch('launchContact', item) + }) + }) + }, + fail: () => { + // 程序是首次运行,初始化加载好友信息 + getFriends().then(res => { + res.map(item => { + store.dispatch('initContact', item) + }) + uni.setStorageSync(FK, userInfo.targetId) + }) + } }) }) } @@ -102,63 +115,88 @@ const notifyMsgTypes = [ function inArray(search, array) { for (var i in array) { if (array[i] == search) { - return true; + return true } } - return false; + return false } const addListeners = () => { // 添加连接状态监听函数 RongIMLib.addConnectionStatusListener((res) => { - console.log('连接状态监听', res.data.status); + console.log('连接状态监听', res.data.status) uni.$emit('onConnectionStatusChange', res.data.status) }) // 添加消息监听函数 RongIMLib.addReceiveMessageListener((res) => { - console.log('收到消息', res.data.message); const message = res.data.message + console.log('收到消息', message) if (inArray(message.objectName, notifyMsgTypes)) { - console.log('new Message'); + if (!store.getters.contactIsExist(message.targetId)) { + getUserInfo(message.targetId).then(res => { + store.dispatch('initContact', res) + }).catch(err => { + console.log('ERR', err) + }) + } newMessage(message) + } else if (message.objectName === RongIMLib.ObjectName.ProfileNotification) { + store.dispatch('updateContact', JSON.parse(message.content.data)) + // 调用完更新之后,删除这条消息 + RongIMLib.deleteMessagesByIds([message.messageId], ({ + code + }) => { + console.log('消息删除结果', code) + }) + } else if (message.objectName === RongIMLib.ObjectName.ContactNotification) { + // 触发一个新好友的通知事件 + uni.$emit('onContactNotification', message.content) } }) - // 音视频通话相关的 - // 监听通话呼入 - CallLib.onCallReceived(({ + + // 监听消息回执 + RongIMLib.addReadReceiptReceivedListener(({ data }) => { - uni.navigateTo({ - url: '/pages/im/private/call?targetId=' + data.targetId + '&mediaType=' + - data.mediaType - }) - }) - // 通话建立成功 - CallLib.onCallConnected(() => { - uni.$emit('onCallConnected'); - }) - // 外呼 - CallLib.onCallOutgoing((res) => { - uni.$emit('onCallOutgoing'); - }) - // 远端响铃 - CallLib.onRemoteUserRinging((res) => { - uni.$emit('onRemoteUserRinging'); - }) - // 远端加入 - CallLib.onRemoteUserJoined((res) => { - uni.$emit('onRemoteUserJoined'); - }) - // 断开链接 - CallLib.onCallDisconnected((res) => { - console.log('断开链接', res); - uni.$emit('onCallDisconnected'); - }) - // 远端挂断 - CallLib.onRemoteUserLeft((res) => { - console.log('远端离开', res); - uni.$emit('onRemoteUserLeft'); + uni.$emit('onReadReceiptReceived', data) }) + + // 音视频通话相关的 + // 监听通话呼入 + // CallLib.onCallReceived(({ + // data + // }) => { + // uni.navigateTo({ + // url: '/pages/im/private/call?targetId=' + data.targetId + '&mediaType=' + + // data.mediaType + // }) + // }) + // // 通话建立成功 + // CallLib.onCallConnected(() => { + // uni.$emit('onCallConnected') + // }) + // // 外呼 + // CallLib.onCallOutgoing((res) => { + // uni.$emit('onCallOutgoing') + // }) + // // 远端响铃 + // CallLib.onRemoteUserRinging((res) => { + // uni.$emit('onRemoteUserRinging') + // }) + // // 远端加入 + // CallLib.onRemoteUserJoined((res) => { + // uni.$emit('onRemoteUserJoined') + // }) + // // 断开链接 + // CallLib.onCallDisconnected((res) => { + // console.log('断开链接', res) + // uni.$emit('onCallDisconnected') + // }) + // // 远端挂断 + // CallLib.onRemoteUserLeft((res) => { + // console.log('远端离开', res) + // uni.$emit('onRemoteUserLeft') + // }) } // 维护消息列表,检查是否需要通知声音,设置新消息提醒的数量 @@ -168,25 +206,14 @@ const newMessage = (msg) => { status }) => { if (code === 0) { - if (status) { + if (status) { + uni.vibrateLong() triTone() } } - }); - - setNotifyBadge() - - if (!store.getters.hasUser(msg.targetId)) { - syncUserInfo(msg.targetId) - } - - uni.$emit('onReceiveMessage', msg); -} - -function syncUserInfo(targetId) { - getUserInfo(targetId).then(res => { - store.dispatch('updateFriends', res) }) + setNotifyBadge() + uni.$emit('onReceiveMessage', msg) } // 播放状态 @@ -201,29 +228,15 @@ const triTone = () => { tipState = true }) innerAudioContext.onEnded(() => { - tipState = false + tipState = false innerAudioContext.destroy() }) } } -/** - * 同步好友信息,保存头像地址等 - */ -const syncFriends = () => { - getFriends().then(res => { - res.map(item => { - console.log('item', item); - store.dispatch('updateFriends', item) - }) - }) -} - export default { initIm, connect, setNotifyBadge, - syncFriends, - syncUserInfo, ...message } diff --git a/utils/im/listeners.js b/utils/im/listeners.js new file mode 100644 index 0000000..e69de29 diff --git a/utils/im/message.js b/utils/im/message.js index 8b0069b..849b7cf 100644 --- a/utils/im/message.js +++ b/utils/im/message.js @@ -1,8 +1,9 @@ import store from '@/store/index.js' + import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index' -const getMessageList = (conversationType, targetId, callback) => { - // 获取消息列表 +const getMessageList = (conversationType, targetId, timeStamp, count, isForward, callback) => { + // 获取消息列表 https://doc.rongcloud.cn/imserver/server/v1/message/objectname#objectName const objectNames = [ 'RC:TxtMsg', 'RC:VcMsg', @@ -16,10 +17,12 @@ const getMessageList = (conversationType, targetId, callback) => { 'RC:ReferenceMsg', 'RC:CombineMsg' ] - const timeStamp = new Date().getTime() - const count = 10 // 获取的消息数量 - const isForward = true // 是否向前获取 - RongIMLib.getHistoryMessagesByTimestamp(conversationType, targetId, objectNames, timeStamp, + + RongIMLib.getHistoryMessagesByTimestamp( + conversationType, + targetId, + objectNames, + timeStamp + 1000, count, isForward, ({ @@ -45,27 +48,28 @@ const getMessageList = (conversationType, targetId, callback) => { * @param {string} content 消息内容 * @param {function} callback 回调函数 */ -const sentText = (conversationType, targetId, content, callback) => { - console.log('发送'); +const sentText = (conversationType, targetId, content, user, callback) => { const msg = { conversationType: conversationType, targetId: String(targetId), content: { objectName: 'RC:TxtMsg', content: content, - user: store.getters.sender + userInfo: user } - } + } + RongIMLib.sendMessage(msg, ({ code, messageId }) => { if (code === 0) { callback(messageId) - } else { + } else { + console.log('发送失败', msg); uni.showToast({ icon: 'none', - title: '发送失败' + title: '发送失败' + code }) } }) @@ -79,14 +83,15 @@ const sentText = (conversationType, targetId, content, callback) => { * @param {integer} time 录音时长 * @param {function} callback 录音时长 */ -const sentVoice = (conversationType, targetId, voiceUrl, time, callback) => { +const sentVoice = (conversationType, targetId, voiceUrl, time, user, callback) => { const msg = { conversationType: conversationType, targetId: String(targetId), content: { objectName: 'RC:HQVCMsg', local: 'file:///' + plus.io.convertLocalFileSystemURL(voiceUrl), - duration: time + duration: time, + userInfo: user } } RongIMLib.sendMediaMessage(msg, { @@ -105,14 +110,14 @@ const sentVoice = (conversationType, targetId, voiceUrl, time, callback) => { }) } -const sentImage = (conversationType, targetId, imageUrl, time, callback) => { +const sentImage = (conversationType, targetId, imageUrl, user, callback) => { const msg = { conversationType: conversationType, targetId: String(targetId), content: { objectName: 'RC:ImgMsg', local: 'file:///' + plus.io.convertLocalFileSystemURL(imageUrl), - duration: time + userInfo: user } } RongIMLib.sendMediaMessage(msg, { diff --git a/utils/im/models.js b/utils/im/models.js index a36e1bd..a7c6ef0 100644 --- a/utils/im/models.js +++ b/utils/im/models.js @@ -2,21 +2,21 @@ import { usqlite } from '@/uni_modules/onemue-USQLite/js_sdk/usqlite.js' -const friendModel = usqlite.model('friends', { - userId: { +const contactModel = usqlite.model('contacts', { + targetId: { type: String, primaryKey: true, unique: true }, name: String, - address: String, hash: { type: String, unique: true }, - portraitUrl: String -}) + portraitUrl: String, + localAvatar: String +}) export default { - friendModel + contactModel } diff --git a/utils/im/视频呼入.json b/utils/im/视频呼入.json deleted file mode 100644 index 97a4087..0000000 --- a/utils/im/视频呼入.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "type": "Engine:OnCallReceived", - "module": "RongCloud-Call-RCUniCall", - "data": { - "endTime": 0, - "users": [{ - "userId": "10051", - "enableCamera": false, - "mediaId": "420111350", - "mediaType": 1, - "userType": 0, - "enableMicrophone": false - }, { - "userId": "10047", - "enableCamera": false, - "mediaType": 1, - "userType": 0, - "enableMicrophone": false - }], - "inviter": { - "userId": "10051", - "enableCamera": false, - "mediaId": "420111350", - "mediaType": 1, - "userType": 0, - "enableMicrophone": false - }, - "caller": { - "userId": "10051", - "enableCamera": false, - "mediaId": "420111350", - "mediaType": 1, - "userType": 0, - "enableMicrophone": false - }, - "connectedTime": 0, - "extra": "", - "startTime": 0, - "mediaType": 1, - "callId": "c28cb9d8-6581-474c-bfa5-9872a4824b65", - "targetId": "10051", - "callType": 0, - "mine": { - "userId": "10047", - "enableCamera": false, - "mediaType": 1, - "userType": 0, - "enableMicrophone": false - } - } -} diff --git a/utils/im/语音呼入.json b/utils/im/语音呼入.json deleted file mode 100644 index 3c24ca0..0000000 --- a/utils/im/语音呼入.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "type": "Engine:OnCallReceived", - "module": "RongCloud-Call-RCUniCall", - "data": { - "endTime": 0, - "users": [{ - "userId": "10051", - "enableCamera": false, - "mediaId": "420068630", - "mediaType": 0, - "userType": 0, - "enableMicrophone": false - }, { - "userId": "10047", - "enableCamera": true, - "mediaType": 0, - "userType": 0, - "enableMicrophone": false - }], - "inviter": { - "userId": "10051", - "enableCamera": false, - "mediaId": "420068630", - "mediaType": 0, - "userType": 0, - "enableMicrophone": false - }, - "caller": { - "userId": "10051", - "enableCamera": false, - "mediaId": "420068630", - "mediaType": 0, - "userType": 0, - "enableMicrophone": false - }, - "connectedTime": 0, - "extra": "", - "startTime": 0, - "mediaType": 0, - "callId": "1a1462b8-b63b-40a9-bf95-963e810ac49a", - "targetId": "10051", - "callType": 0, - "mine": { - "userId": "10047", - "enableCamera": true, - "mediaType": 0, - "userType": 0, - "enableMicrophone": false - } - } -} diff --git a/utils/index.js b/utils/index.js index 4b0264d..665e4d5 100644 --- a/utils/index.js +++ b/utils/index.js @@ -1,221 +1,183 @@ -import sha1 from './sha1.js' -import env from './conf/env.js' -import * as RongIMLib from '@rongcloud/imlib-uni' +import env from './conf/env.js' + export default { - checkPhone: (phone) => { - let re = /^[0-9]+.?[0-9]*/; - if (phone.length === 11) { - return re.test(phone) - } - return false; - }, - jumpUrl(path) { - uni.navigateTo({ - url: path - }) - }, - connectIM() { - if(uni.getStorageSync('userInfo')) { - let userInfo = JSON.parse(uni.getStorageSync('userInfo')); - const im = getApp().globalData.im; - im.connect({ - token: userInfo.rongimToken - }).then(user => { - console.log('IM链接成功, 链接用户 id 为: ', user.id); - }).catch(error => { - uni.hideLoading(); - console.log('IM链接失败: ', error.code, error.msg); - }); - } - }, - handleTimeCustom(val) { - val = this.timeStamp(val, 'Y-m-d H:i:s') - let currentDate = new Date(); - let currentD = currentDate.getDate(); - let currentYear = currentDate.getFullYear(); - let currentMonth = currentDate.getMonth() + 1; - let date = val.substring(0,19); - date = date.replace(/-/g,'/'); - let valDate = new Date(date); - let valD = valDate.getDate(); - let valYear = valDate.getFullYear(); - let valMonth = valDate.getMonth() + 1; - // 判断是否属于今天,计算时分 - let difftime = (currentDate - valDate) / 1000; - let hour = valDate.getHours(); - hour = hour > 9 ? hour : '0' + hour; - let minute = valDate.getMinutes(); - minute = minute > 9 ? minute : '0' + minute; - if(currentYear === valYear && currentMonth === valMonth && currentD === valD) { - return hour + ':' + minute; - } else { - // 计算天 - if(currentYear === valYear && currentMonth === valMonth && currentD !== valD) { - return valMonth + '月' + valD + '日 ' + hour + '时' + minute; - } else { - return valYear + '年' + valMonth + '月' + valD + '日 ' + hour + ':' + minute; - } - - } - }, - handleTimeCustomCN(val) { - val = this.timeStamp(val, 'Y-m-d H:i:s') - console.log(val, '时间0000000'); - let currentDate = new Date(); - let currentD = currentDate.getDate(); - let currentYear = currentDate.getFullYear(); - let currentMonth = currentDate.getMonth() + 1; - let date = val.substring(0,19); - date = date.replace(/-/g,'/'); - let valDate = new Date(date); - let valD = valDate.getDate(); - let valYear = valDate.getFullYear(); - let valMonth = valDate.getMonth() + 1; - // 判断是否属于今天,计算时分 - let difftime = (currentDate - valDate) / 1000; - if(currentYear === valYear && currentMonth === valMonth && currentD === valD) { - let minute = parseInt(difftime % 3600 / 60); - if(minute <= 60) { - return minute === 0 ? '刚刚' : minute + '分钟前'; - } else { - return (minute * 60).toFixed(0) + '小时前'; - } - } else { - // 计算天 - if(currentYear === valYear && currentMonth === valMonth && currentD - 1 === valD) { - return '昨天'; - } else { - let days = Math.abs(currentDate.getTime() - valDate.getTime())/(1000*60*60*24); - return Math.ceil(days) + '天前'; - } - - } - }, - timeStamp(timestamp, formats) { - /* - ** 时间戳转换成指定格式日期 - ** eg. - ** dateFormat(11111111111111, 'Y年m月d日 H时i分') - ** → "2322年02月06日 03时45分" - */ - // formats格式包括 - // 1. Y-m-d - // 2. Y-m-d H:i:s - // 3. Y年m月d日 - // 4. Y年m月d日 H时i分 - formats = formats || 'Y-m-d'; + checkPhone: (phone) => { + let re = /^[0-9]+.?[0-9]*/; + if (phone.length === 11) { + return re.test(phone) + } + return false; + }, + jumpUrl(path) { + uni.navigateTo({ + url: path + }) + }, + handleTimeCustom(val) { + val = this.timeStamp(val, 'Y-m-d H:i:s') + let currentDate = new Date(); + let currentD = currentDate.getDate(); + let currentYear = currentDate.getFullYear(); + let currentMonth = currentDate.getMonth() + 1; + let date = val.substring(0, 19); + date = date.replace(/-/g, '/'); + let valDate = new Date(date); + let valD = valDate.getDate(); + let valYear = valDate.getFullYear(); + let valMonth = valDate.getMonth() + 1; + // 判断是否属于今天,计算时分 + let difftime = (currentDate - valDate) / 1000; + let hour = valDate.getHours(); + hour = hour > 9 ? hour : '0' + hour; + let minute = valDate.getMinutes(); + minute = minute > 9 ? minute : '0' + minute; + if (currentYear === valYear && currentMonth === valMonth && currentD === valD) { + return hour + ':' + minute; + } else { + // 计算天 + if (currentYear === valYear && currentMonth === valMonth && currentD !== valD) { + return valMonth + '月' + valD + '日 ' + hour + '时' + minute; + } else { + return valYear + '年' + valMonth + '月' + valD + '日 ' + hour + ':' + minute; + } - var zero = function(value) { - if (value < 10) { - return '0' + value; - } - return value; - }; - var myDate = timestamp ? new Date(timestamp) : new Date(); + } + }, + handleTimeCustomCN(val) { + val = this.timeStamp(val, 'Y-m-d H:i:s') + console.log(val, '时间0000000'); + let currentDate = new Date(); + let currentD = currentDate.getDate(); + let currentYear = currentDate.getFullYear(); + let currentMonth = currentDate.getMonth() + 1; + let date = val.substring(0, 19); + date = date.replace(/-/g, '/'); + let valDate = new Date(date); + let valD = valDate.getDate(); + let valYear = valDate.getFullYear(); + let valMonth = valDate.getMonth() + 1; + // 判断是否属于今天,计算时分 + let difftime = (currentDate - valDate) / 1000; + if (currentYear === valYear && currentMonth === valMonth && currentD === valD) { + let minute = parseInt(difftime % 3600 / 60); + if (minute <= 60) { + return minute === 0 ? '刚刚' : minute + '分钟前'; + } else { + return (minute * 60).toFixed(0) + '小时前'; + } + } else { + // 计算天 + if (currentYear === valYear && currentMonth === valMonth && currentD - 1 === valD) { + return '昨天'; + } else { + let days = Math.abs(currentDate.getTime() - valDate.getTime()) / (1000 * 60 * 60 * 24); + return Math.ceil(days) + '天前'; + } - var year = myDate.getFullYear(); - var month = zero(myDate.getMonth() + 1); - var day = zero(myDate.getDate()); + } + }, + timeStamp(timestamp, formats) { + /* + ** 时间戳转换成指定格式日期 + ** eg. + ** dateFormat(11111111111111, 'Y年m月d日 H时i分') + ** → "2322年02月06日 03时45分" + */ + // formats格式包括 + // 1. Y-m-d + // 2. Y-m-d H:i:s + // 3. Y年m月d日 + // 4. Y年m月d日 H时i分 + formats = formats || 'Y-m-d'; - var hour = zero(myDate.getHours()); - var minite = zero(myDate.getMinutes()); - var second = zero(myDate.getSeconds()); + var zero = function(value) { + if (value < 10) { + return '0' + value; + } + return value; + }; + var myDate = timestamp ? new Date(timestamp) : new Date(); - return formats.replace(/Y|m|d|H|i|s/ig, function(matches) { - return ({ - Y: year, - m: month, - d: day, - H: hour, - i: minite, - s: second - })[matches]; - }); - }, - // 时间字符串转换中文时间 - timeToDate(str) { - let date = str.substring(0, 19); - date = date.replace(/-/g, '/'); - date = new Date(str); - let dateObj = { - year: date.getFullYear(), - month: date.getMonth() + 1, - day: date.getDate(), - hour: date.getHours(), - minute: date.getMinutes(), - second: date.getSeconds() - } - let string = dateObj.year + '年' + dateObj.month + '月' + dateObj.day + '日 ' + dateObj.hour + '时' + dateObj - .minute + '分'; - return string - }, - getAge(strAge) { - let birArr = strAge.split("-"); - let birYear = birArr[0]; - let birMonth = birArr[1]; - let birDay = birArr[2]; + var year = myDate.getFullYear(); + var month = zero(myDate.getMonth() + 1); + var day = zero(myDate.getDate()); - d = new Date(); - let nowYear = d.getFullYear(); - let nowMonth = d.getMonth() + 1; //记得加1 - let nowDay = d.getDate(); - let returnAge; + var hour = zero(myDate.getHours()); + var minite = zero(myDate.getMinutes()); + var second = zero(myDate.getSeconds()); - if (birArr == null) { - return false - }; - let d = new Date(birYear, birMonth - 1, birDay); - if (d.getFullYear() == birYear && (d.getMonth() + 1) == birMonth && d.getDate() == birDay) { - if (nowYear == birYear) { - returnAge = 0; - } else { - let ageDiff = nowYear - birYear; - if (ageDiff > 0) { - if (nowMonth == birMonth) { - let dayDiff = nowDay - birDay; - if (dayDiff < 0) { - returnAge = ageDiff - 1; - } else { - returnAge = ageDiff; - } - } else { - let monthDiff = nowMonth - birMonth; - if (monthDiff < 0) { - returnAge = ageDiff - 1; - } else { - returnAge = ageDiff; - } - } - } else { - return "出生日期晚于今天,数据有误"; //返回-1 表示出生日期输入错误 晚于今天 - } - } - return returnAge; - } else { - return ("输入的日期格式错误!"); - } - }, - getImUserInfo(targetId) { - return new Promise((resolve, reject) => { - const Nonce = Date.now(); - const Timestamp = Date.now() * 1000; - uni.request({ - url: 'https://api2-cn.ronghub.com/user/info.json', //仅为示例,并非真实接口地址。 - data: { - userId: targetId - }, - method: 'POST', - header: { - 'Content-Type': 'application/x-www-form-urlencoded', - 'App-Key': '你的key', - 'Nonce': Nonce, - 'Timestamp': Timestamp, - 'Signature': sha1(env.IMsecret + Nonce + Timestamp) - }, - success: (res) => { - resolve(res.data) - } - }); - }) - } + return formats.replace(/Y|m|d|H|i|s/ig, function(matches) { + return ({ + Y: year, + m: month, + d: day, + H: hour, + i: minite, + s: second + })[matches]; + }); + }, + // 时间字符串转换中文时间 + timeToDate(str) { + let date = str.substring(0, 19); + date = date.replace(/-/g, '/'); + date = new Date(str); + let dateObj = { + year: date.getFullYear(), + month: date.getMonth() + 1, + day: date.getDate(), + hour: date.getHours(), + minute: date.getMinutes(), + second: date.getSeconds() + } + let string = dateObj.year + '年' + dateObj.month + '月' + dateObj.day + '日 ' + dateObj.hour + '时' + dateObj + .minute + '分'; + return string + }, + getAge(strAge) { + let birArr = strAge.split("-"); + let birYear = birArr[0]; + let birMonth = birArr[1]; + let birDay = birArr[2]; + + d = new Date(); + let nowYear = d.getFullYear(); + let nowMonth = d.getMonth() + 1; //记得加1 + let nowDay = d.getDate(); + let returnAge; + + if (birArr == null) { + return false + }; + let d = new Date(birYear, birMonth - 1, birDay); + if (d.getFullYear() == birYear && (d.getMonth() + 1) == birMonth && d.getDate() == birDay) { + if (nowYear == birYear) { + returnAge = 0; + } else { + let ageDiff = nowYear - birYear; + if (ageDiff > 0) { + if (nowMonth == birMonth) { + let dayDiff = nowDay - birDay; + if (dayDiff < 0) { + returnAge = ageDiff - 1; + } else { + returnAge = ageDiff; + } + } else { + let monthDiff = nowMonth - birMonth; + if (monthDiff < 0) { + returnAge = ageDiff - 1; + } else { + returnAge = ageDiff; + } + } + } else { + return "出生日期晚于今天,数据有误"; //返回-1 表示出生日期输入错误 晚于今天 + } + } + return returnAge; + } else { + return ("输入的日期格式错误!"); + } + } } diff --git a/js_sdk/wa-permission/permission.js b/utils/permission.js similarity index 100% rename from js_sdk/wa-permission/permission.js rename to utils/permission.js diff --git a/utils/sha1.js b/utils/sha1.js deleted file mode 100644 index 5fc4774..0000000 --- a/utils/sha1.js +++ /dev/null @@ -1,50 +0,0 @@ -function encodeUTF8(s) { - var i, r = [], c, x; - for (i = 0; i < s.length; i++) - if ((c = s.charCodeAt(i)) < 0x80) r.push(c); - else if (c < 0x800) r.push(0xC0 + (c >> 6 & 0x1F), 0x80 + (c & 0x3F)); - else { - if ((x = c ^ 0xD800) >> 10 == 0) //对四字节UTF-16转换为Unicode - c = (x << 10) + (s.charCodeAt(++i) ^ 0xDC00) + 0x10000, - r.push(0xF0 + (c >> 18 & 0x7), 0x80 + (c >> 12 & 0x3F)); - else r.push(0xE0 + (c >> 12 & 0xF)); - r.push(0x80 + (c >> 6 & 0x3F), 0x80 + (c & 0x3F)); - }; - return r; -} - -// 字符串加密成 hex 字符串 -function sha1(s) { - var data = new Uint8Array(encodeUTF8(s)) - var i, j, t; - var l = ((data.length + 8) >>> 6 << 4) + 16, s = new Uint8Array(l << 2); - s.set(new Uint8Array(data.buffer)), s = new Uint32Array(s.buffer); - for (t = new DataView(s.buffer), i = 0; i < l; i++)s[i] = t.getUint32(i << 2); - s[data.length >> 2] |= 0x80 << (24 - (data.length & 3) * 8); - s[l - 1] = data.length << 3; - var w = [], f = [ - function () { return m[1] & m[2] | ~m[1] & m[3]; }, - function () { return m[1] ^ m[2] ^ m[3]; }, - function () { return m[1] & m[2] | m[1] & m[3] | m[2] & m[3]; }, - function () { return m[1] ^ m[2] ^ m[3]; } - ], rol = function (n, c) { return n << c | n >>> (32 - c); }, - k = [1518500249, 1859775393, -1894007588, -899497514], - m = [1732584193, -271733879, null, null, -1009589776]; - m[2] = ~m[0], m[3] = ~m[1]; - for (i = 0; i < s.length; i += 16) { - var o = m.slice(0); - for (j = 0; j < 80; j++) - w[j] = j < 16 ? s[i + j] : rol(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1), - t = rol(m[0], 5) + f[j / 20 | 0]() + m[4] + w[j] + k[j / 20 | 0] | 0, - m[1] = rol(m[1], 30), m.pop(), m.unshift(t); - for (j = 0; j < 5; j++)m[j] = m[j] + o[j] | 0; - }; - t = new DataView(new Uint32Array(m).buffer); - for (var i = 0; i < 5; i++)m[i] = t.getUint32(i << 2); - - var hex = Array.prototype.map.call(new Uint8Array(new Uint32Array(m).buffer), function (e) { - return (e < 16 ? "0" : "") + e.toString(16); - }).join(""); - return hex; -} -export default sha1 \ No newline at end of file diff --git a/wallet/Wallet.js b/wallet/Wallet.js deleted file mode 100644 index 217e7fc..0000000 --- a/wallet/Wallet.js +++ /dev/null @@ -1,126 +0,0 @@ -import Bitcore from "bitcore-lib" -import Mnemonic from "bitcore-mnemonic" -import secp256k1 from 'secp256k1' -import { - Address, - pubToAddress, - toBuffer, - toChecksumAddress, - intToBuffer -} from 'ethereumjs-util' -import coinType from './networks.js' -import basex from 'base-x' - -export default class Wallet { - - static coinType = coinType - - /** - * 生成助记词 - * @param {Object} lang - */ - static generateMnemonic(lang) { - if (lang) { - return (new Mnemonic(this.getLanguage(lang))).toString(); - } else { - return (new Mnemonic()).toString(); - } - } - - /** - * 验证助记词 - * @param {Object} code - * @param {Object} lang - */ - static validMnemonic(code, lang) { - if (lang) { - return Mnemonic.isValid(code, this.getLanguage(lang)); - } else { - return Mnemonic.isValid(code); - } - } - - /** - * 获取助记词字典 - * @param {Object} lang - */ - static getLanguage(lang) { - return Mnemonic.Words[lang] - } - - /** - * 转成硬钱包私钥 - * @param {Object} code - */ - static toHDPrivateKey(code) { - return (new Mnemonic(code)).toHDPrivateKey() - } - - /** - * 验证地址是否合法 - * @param {Object} addr - */ - static isValidAddress(addr) { - return Bitcore.Address.isValid(addr) - } - - /** - * 硬钱包私钥转成对应网络的 地址 和 私钥 - * @param {Object} hdPrivateKey - * @param {Object} type - */ - static HDPrivateKeyToAddress(hdPrivateKey, type) { - const derived = hdPrivateKey.derive("m/44'/" + type.type + "'/0'/0/0"); - if (type.type === 195) { - const ethAddr = this.getEthereumAddress(derived) - const addressBuffer = Buffer.concat([intToBuffer(0x41), ethAddr.buf], 21) - return { - address: Bitcore.encoding.Base58Check.encode(addressBuffer), - public_key: derived.privateKey.publicKey.toString(), - private_key: derived.privateKey.toString() - } - } - if (type.type === 144) { - let addr = derived.privateKey.toAddress(type.network).toString() - let deco = Bitcore.encoding.Base58.decode(addr) - - return { - address: basex('rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz').encode(deco), - public_key: derived.privateKey.publicKey.toString(), - private_key: derived.privateKey.toString() - } - } - if (this.networkIsEthereum(type)) { - return { - address: toChecksumAddress(this.getEthereumAddress(derived).toString()), - public_key: derived.privateKey.publicKey.toString(), - private_key: derived.privateKey.toString() - } - } - return { - address: derived.privateKey.toAddress(type.network).toString(), - public_key: derived.privateKey.publicKey.toString(), - private_key: derived.privateKey.toString() - } - } - - /** - * 以太坊地址格式转换 - * @param {Object} derived - */ - static getEthereumAddress(derived) { - const publicKey = derived.hdPublicKey.publicKey.toBuffer() - const ethPublicKey = secp256k1.publicKeyConvert(publicKey, false) - .slice(1) - return Address.fromPublicKey(toBuffer(ethPublicKey)) - } - - /** - * 是否是以太坊网络 - * @param {Object} type - */ - static networkIsEthereum(type) { - return type.isEthereum - } - -} diff --git a/wallet/_test.js b/wallet/_test.js deleted file mode 100644 index a8c2e43..0000000 --- a/wallet/_test.js +++ /dev/null @@ -1,29 +0,0 @@ -import { - Wallet -} from "./Wallet.js" - -const code = Wallet.generateMnemonic(this.defaultLanguage) -this.mnemonicCode = code -const hdPrivateKey = Wallet.toHDPrivateKey(this.mnemonicCode) -// const derived = hdPrivateKey.derive("m/44'/61'/0'/0/0"); -// const publicKey = derived.hdPublicKey.publicKey.toBuffer() -// const ethPublicKey = secp256k1.publicKeyConvert(publicKey, false) -// .slice(1) - -// const ethAddr = Address.fromPublicKey(toBuffer(ethPublicKey)).toString(); - -// console.log(toChecksumAddress(ethAddr)); - -// console.log(Address.fromPrivateKey(hdPrivateKey.hdPublicKey.publicKey.toBuffer())); - -var addr = [] -for (var i in this.coinType) { - let whk = Wallet.HDPrivateKeyToAddress(hdPrivateKey, i) - let parmas = { - name: this.coinType[i], - address: whk.address, - private_key: whk.private_key, - } - addr.push(parmas) -} -this.address = addr diff --git a/wallet/index.js b/wallet/index.js deleted file mode 100644 index 62c9e5c..0000000 --- a/wallet/index.js +++ /dev/null @@ -1,24 +0,0 @@ -import store from "@/store/index.js" - -const USE_SOTER_AUTH_KEY = 'USE_SOTER_AUTH_KEY' - -/** - * 初始化配置 - */ -const initWalletConfigs = () => { - // 生物识别 - const USE_SOTER = Boolean(uni.getStorageSync(USE_SOTER_AUTH_KEY)) - store.dispatch('wallet/setSoterAuth', USE_SOTER) - // 获取默认钱包 -} - -const setSoterAuthStatus = (opt) => { - uni.setStorageSync(USE_SOTER_AUTH_KEY, opt) - store.dispatch('wallet/setSoterAuth', opt) -} - -export default { - USE_SOTER_AUTH_KEY, - setSoterAuthStatus, - initWalletConfigs -} \ No newline at end of file diff --git a/wallet/networks.js b/wallet/networks.js deleted file mode 100644 index 179e338..0000000 --- a/wallet/networks.js +++ /dev/null @@ -1,209 +0,0 @@ -import Bitcore from "bitcore-lib" - -export default [{ - type: 0, - name: '比特币', - symbol: 'BTC', - code: 'btc', - isEthereum: false, - network: Bitcore.Networks.mainnet - }, - { - type: 60, - name: '以太坊', - symbol: 'ETH', - code: 'eth', - isEthereum: true - }, - { - type: 61, - name: '以太经典', - symbol: 'ETC', - code: 'etc', - isEthereum: true - }, - { - type: 60, - name: '赤子心', - symbol: 'CZX', - code: 'eth_0x3a2a239b1bdaae768ffa06314d523e88e98d4d1f', - isEthereum: true - }, - // { - // type: 2, - // name: '莱特币', - // symbol: 'LTC', - // isEthereum: false, - // network: Bitcore.Networks.add({ - // name: 'LTC', - // alias: 'LTC', - // pubkeyhash: 0x30, - // privatekey: 0x32, - // scripthash: 0xb0, - // bech32prefix: 'ltc', - // xpubkey: 0x019da462, - // xprivkey: 0x019d9cfe, - // networkMagic: 0xdbb6c0fb - // }) - // }, - { - type: 3, - name: '狗狗币', - symbol: 'DOGE', - code: 'doge', - isEthereum: false, - network: Bitcore.Networks.add({ - name: 'DOGE', - alias: 'DOGE', - pubkeyhash: 0x1e, - privatekey: 0x16, - scripthash: 0x9e, - bech32prefix: 'doge', - xpubkey: 0x02facafd, - xprivkey: 0x02fac398, - networkMagic: 0xc0c0c0c0 - }) - }, - - // { - // type: 133, - // name: '零币', - // symbol: 'ZEC', - // isEthereum: false, - // network: Bitcore.Networks.add({ - // name: 'ZEC', - // alias: 'ZEC', - // pubkeyhash: 0x1e, - // privatekey: 0x16, - // scripthash: 0x9e, - // bech32prefix: 'doge', - // xpubkey: 0x02facafd, - // xprivkey: 0x02fac398, - // networkMagic: 0xc0c0c0c0 - // }) - // }, - // { - // type: 144, - // name: 'XPR - 瑞波币', - // symbol: 'XPR', - // isEthereum: false, - // network: Bitcore.Networks.add({ - // name: 'XPR', - // alias: 'XPR', - // pubkeyhash: 0x1e, - // privatekey: 0x16, - // scripthash: 0x9e, - // bech32prefix: 'doge', - // xpubkey: 0x02facafd, - // xprivkey: 0x02fac398, - // networkMagic: 0xc0c0c0c0 - // }) - // }, - // { - // type: 145, - // name: '比特现金', - // symbol: 'BCH', - // isEthereum: false, - // network: Bitcore.Networks.add({ - // name: 'BCH', - // alias: 'BCH', - // pubkeyhash: 0x00, - // privatekey: 0x05, - // scripthash: 0x80, - // bech32prefix: 'bitcoincash', - // xpubkey: 0x0488b21e, - // xprivkey: 0x0488ade4, - // networkMagic: 0xd9b4bef9 - // }) - // }, - // { - // type: 195, - // name: '波场', - // symbol: 'TRX', - // isEthereum: false, - // network: Bitcore.Networks.add({ - // name: 'TRX', - // alias: 'TRX', - // pubkeyhash: 0x41, - // privatekey: 0x05, - // scripthash: 0x80, - // bech32prefix: '', - // xpubkey: 0x0488b21e, - // xprivkey: 0x0488ade4 - // }) - // }, - { - type: 195, - name: 'USDT(TRC20)', - symbol: 'USDT', - code: 'trx_TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t', - isEthereum: false, - network: Bitcore.Networks.add({ - name: 'USDT', - alias: 'USDT', - pubkeyhash: 0x41, - privatekey: 0x05, - scripthash: 0x80, - bech32prefix: '', - xpubkey: 0x0488b21e, - xprivkey: 0x0488ade4 - }) - }, - { - type: 195, - name: 'USDT(ERC20)', - symbol: 'USDT', - code: 'eth_0xdac17f958d2ee523a2206206994597c13d831ec7', - isEthereum: true - }, - { - type: 0, - name: 'USDT(OMNI)', - symbol: 'USDT', - code: 'usdt', - isEthereum: false, - network: Bitcore.Networks.mainnet - }, - { - type: 13107, - name: '比特元', - symbol: 'BTY', - code: 'bty', - isEthereum: false, - network: Bitcore.Networks.add({ - name: 'BTY', - alias: 'BTY', - pubkeyhash: 0x00, - privatekey: 0x05, - scripthash: 0x80, - bech32prefix: 'bityuan', - xpubkey: 0x0488b21e, - xprivkey: 0x0488ade4, - networkMagic: 0xd9b4bef9 - }) - }, - // { - // type: 60, - // name: '元链', - // symbol: 'YCC', - // isEthereum: true - // }, - { - type: 13107, - name: 'JZC', - symbol: 'JZC', - code: 'bty', - isEthereum: false, - network: Bitcore.Networks.add({ - name: 'JZC', - alias: 'JZC', - pubkeyhash: 0x00, - privatekey: 0x05, - scripthash: 0x80, - bech32prefix: 'bityuan', - xpubkey: 0x0488b21e, - xprivkey: 0x0488ade4, - networkMagic: 0xd9b4bef9 - }) - } -] diff --git a/yarn.lock b/yarn.lock index dd0684d..4005bdf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,194 +2,27 @@ # yarn lockfile v1 -"base-x@^3.0.2": - "integrity" "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==" - "resolved" "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz" - "version" "3.0.9" - dependencies: - "safe-buffer" "^5.0.1" +moment@^2.29.1: + version "2.29.1" + resolved "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz" + integrity sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ== -"bech32@=2.0.0": - "integrity" "sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg==" - "resolved" "https://registry.npmjs.org/bech32/-/bech32-2.0.0.tgz" - "version" "2.0.0" +uni-read-pages@^1.0.5: + version "1.0.5" + resolved "https://registry.npmjs.org/uni-read-pages/-/uni-read-pages-1.0.5.tgz" + integrity sha512-GkrrZ0LX0vn9R5k6RKEi0Ez3Q3e2vUpjXQ8Z6/K/d28KudI9ajqgt8WEjQFlG5EPm1K6uTArN8LlqmZTEixDUA== -"bigi@^1.1.0", "bigi@^1.4.2": - "integrity" "sha1-nGZalfiLiwj8Bc/XMfVhhZ1yWCU=" - "resolved" "https://registry.npmjs.org/bigi/-/bigi-1.4.2.tgz" - "version" "1.4.2" +uni-simple-router@^2.0.7: + version "2.0.7" + resolved "https://registry.npmjs.org/uni-simple-router/-/uni-simple-router-2.0.7.tgz" + integrity sha512-8FKv5dw7Eoonm0gkO8udprrxzin0fNUI0+AvIphFkFRH5ZmP5ZWJ2pvnWzb2NiiqQSECTSU5VSB7HhvOSwD5eA== -"bip-schnorr@=0.6.4": - "integrity" "sha512-dNKw7Lea8B0wMIN4OjEmOk/Z5qUGqoPDY0P2QttLqGk1hmDPytLWW8PR5Pb6Vxy6CprcdEgfJpOjUu+ONQveyg==" - "resolved" "https://registry.npmjs.org/bip-schnorr/-/bip-schnorr-0.6.4.tgz" - "version" "0.6.4" - dependencies: - "bigi" "^1.4.2" - "ecurve" "^1.0.6" - "js-sha256" "^0.9.0" - "randombytes" "^2.1.0" - "safe-buffer" "^5.2.1" +uview-ui@^2.0.19: + version "2.0.19" + resolved "https://registry.npmjs.org/uview-ui/-/uview-ui-2.0.19.tgz" + integrity sha512-ddZiaP7R9wsUxMzAuhuXgh5OswgCm2lKuulTqjnRXFr0uUWsgL1iBifU3GbOwpwP0LtTHKJOo9rYv1LP0WXmzA== -"bitcore-lib@^8.25.25": - "integrity" "sha512-H6qNCVl4M8/MglXhvc04mmeus1d6nrmqTJGQ+xezJLvL7hs7R3dyBPtOqSP3YSw0iq/GWspMd8f5OOlyXVipJQ==" - "resolved" "https://registry.npmjs.org/bitcore-lib/-/bitcore-lib-8.25.25.tgz" - "version" "8.25.25" - dependencies: - "bech32" "=2.0.0" - "bip-schnorr" "=0.6.4" - "bn.js" "=4.11.8" - "bs58" "^4.0.1" - "buffer-compare" "=1.1.1" - "elliptic" "^6.5.3" - "inherits" "=2.0.1" - "lodash" "^4.17.20" - -"bitcore-mnemonic@^8.25.25": - "integrity" "sha512-7HvRxHrmd+Rh0Ohl0SEDMKQBAM+FoevXbCFnxGju6H+uZjtWMOToHA8vUg0+B91pfEMjdt9mQVB/wSA8GMqnCA==" - "resolved" "https://registry.npmjs.org/bitcore-mnemonic/-/bitcore-mnemonic-8.25.25.tgz" - "version" "8.25.25" - dependencies: - "bitcore-lib" "^8.25.25" - "unorm" "^1.4.1" - -"bn.js@^4.11.9": - "integrity" "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - "resolved" "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz" - "version" "4.12.0" - -"bn.js@=4.11.8": - "integrity" "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" - "resolved" "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz" - "version" "4.11.8" - -"brorand@^1.1.0": - "integrity" "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" - "resolved" "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz" - "version" "1.1.0" - -"bs58@^4.0.1": - "integrity" "sha1-vhYedsNU9veIrkBx9j806MTwpCo=" - "resolved" "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz" - "version" "4.0.1" - dependencies: - "base-x" "^3.0.2" - -"buffer-compare@=1.1.1": - "integrity" "sha1-W+e+hTr4kZjR9N3AkNHWakiu9ZY=" - "resolved" "https://registry.npmjs.org/buffer-compare/-/buffer-compare-1.1.1.tgz" - "version" "1.1.1" - -"ecurve@^1.0.6": - "integrity" "sha512-/BzEjNfiSuB7jIWKcS/z8FK9jNjmEWvUV2YZ4RLSmcDtP7Lq0m6FvDuSnJpBlDpGRpfRQeTLGLBI8H+kEv0r+w==" - "resolved" "https://registry.npmjs.org/ecurve/-/ecurve-1.0.6.tgz" - "version" "1.0.6" - dependencies: - "bigi" "^1.1.0" - "safe-buffer" "^5.0.1" - -"elliptic@^6.5.3": - "integrity" "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==" - "resolved" "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz" - "version" "6.5.4" - dependencies: - "bn.js" "^4.11.9" - "brorand" "^1.1.0" - "hash.js" "^1.0.0" - "hmac-drbg" "^1.0.1" - "inherits" "^2.0.4" - "minimalistic-assert" "^1.0.1" - "minimalistic-crypto-utils" "^1.0.1" - -"hash.js@^1.0.0", "hash.js@^1.0.3": - "integrity" "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==" - "resolved" "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz" - "version" "1.1.7" - dependencies: - "inherits" "^2.0.3" - "minimalistic-assert" "^1.0.1" - -"hmac-drbg@^1.0.1": - "integrity" "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=" - "resolved" "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz" - "version" "1.0.1" - dependencies: - "hash.js" "^1.0.3" - "minimalistic-assert" "^1.0.0" - "minimalistic-crypto-utils" "^1.0.1" - -"inherits@^2.0.3": - "integrity" "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - "resolved" "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz" - "version" "2.0.4" - -"inherits@^2.0.4": - "integrity" "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - "resolved" "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz" - "version" "2.0.4" - -"inherits@=2.0.1": - "integrity" "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=" - "resolved" "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" - "version" "2.0.1" - -"js-sha256@^0.9.0": - "integrity" "sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA==" - "resolved" "https://registry.npmjs.org/js-sha256/-/js-sha256-0.9.0.tgz" - "version" "0.9.0" - -"lodash@^4.17.20": - "integrity" "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - "resolved" "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz" - "version" "4.17.21" - -"minimalistic-assert@^1.0.0", "minimalistic-assert@^1.0.1": - "integrity" "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" - "resolved" "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz" - "version" "1.0.1" - -"minimalistic-crypto-utils@^1.0.1": - "integrity" "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" - "resolved" "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz" - "version" "1.0.1" - -"moment@^2.29.1": - "integrity" "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==" - "resolved" "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz" - "version" "2.29.1" - -"randombytes@^2.1.0": - "integrity" "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==" - "resolved" "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz" - "version" "2.1.0" - dependencies: - "safe-buffer" "^5.1.0" - -"safe-buffer@^5.0.1", "safe-buffer@^5.1.0", "safe-buffer@^5.2.1": - "integrity" "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" - "resolved" "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz" - "version" "5.2.1" - -"uni-read-pages@^1.0.5": - "integrity" "sha512-GkrrZ0LX0vn9R5k6RKEi0Ez3Q3e2vUpjXQ8Z6/K/d28KudI9ajqgt8WEjQFlG5EPm1K6uTArN8LlqmZTEixDUA==" - "resolved" "https://registry.npmjs.org/uni-read-pages/-/uni-read-pages-1.0.5.tgz" - "version" "1.0.5" - -"uni-simple-router@^2.0.7": - "integrity" "sha512-8FKv5dw7Eoonm0gkO8udprrxzin0fNUI0+AvIphFkFRH5ZmP5ZWJ2pvnWzb2NiiqQSECTSU5VSB7HhvOSwD5eA==" - "resolved" "https://registry.npmjs.org/uni-simple-router/-/uni-simple-router-2.0.7.tgz" - "version" "2.0.7" - -"unorm@^1.4.1": - "integrity" "sha512-b2/KCUlYZUeA7JFUuRJZPUtr4gZvBh7tavtv4fvk4+KV9pfGiR6CQAQAWl49ZpR3ts2dk4FYkP7EIgDJoiOLDA==" - "resolved" "https://registry.npmjs.org/unorm/-/unorm-1.6.0.tgz" - "version" "1.6.0" - -"uview-ui@^2.0.19": - "integrity" "sha512-ddZiaP7R9wsUxMzAuhuXgh5OswgCm2lKuulTqjnRXFr0uUWsgL1iBifU3GbOwpwP0LtTHKJOo9rYv1LP0WXmzA==" - "resolved" "https://registry.npmjs.org/uview-ui/-/uview-ui-2.0.19.tgz" - "version" "2.0.19" - -"vuex@^3.6.2": - "integrity" "sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw==" - "resolved" "https://registry.npmjs.org/vuex/-/vuex-3.6.2.tgz" - "version" "3.6.2" +vuex@^3.6.2: + version "3.6.2" + resolved "https://registry.npmjs.org/vuex/-/vuex-3.6.2.tgz" + integrity sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw==