Bläddra i källkod

微调

master
xuqm 1 år sedan
förälder
incheckning
c012359975
3 ändrade filer med 6 tillägg och 6 borttagningar
  1. +1
    -1
      npm/package.json
  2. +1
    -0
      web/src/src/szyx-push-sdk.js
  3. +4
    -5
      web/src/view/Home.vue

+ 1
- 1
npm/package.json Visa fil

@@ -1,6 +1,6 @@
{
"name": "@szyx/szyx-push-web",
"version": "0.0.21",
"version": "0.0.22",
"description": "数字医信-即时通讯-im-js-sdk",
"main": "index.js",
"scripts": {


+ 1
- 0
web/src/src/szyx-push-sdk.js Visa fil

@@ -237,6 +237,7 @@ const SzyxPush = {
if (url && url.startsWith('http'))
this._baseUrl = url
}, install: function (app, tenantNo, osType, url) {
app.config.globalProperties.$SzyxPush = this;
return this.init(tenantNo, osType, url)
}, init: function (tenantNo, osType, url) {
if (url && url.startsWith('http'))


+ 4
- 5
web/src/view/Home.vue Visa fil

@@ -8,7 +8,6 @@

<script>
// import Stomp from "stompjs";
import {SzyxPush} from "@/index";
import {MsgType} from "@/src/szyx-push-sdk";
// import SzyxPush from "@szyx/szyx-push-web"

@@ -25,23 +24,23 @@ export default {
};
},
created() {
SzyxPush.register('xuqm').then(() => {
this.$SzyxPush.register('xuqm').then(() => {
console.log('>>>>>', 'IM连接成功')
}).catch(error => {
console.log('>>>>>', 'im连接失败', error)
})
this.callId = SzyxPush.onMessage((type, msg) => {
this.callId = this.$SzyxPush.onMessage((type, msg) => {
console.log('新消息送达', msg)
if (type === MsgType.text)
this.msg = msg.message.text
})
},
beforeUnmount() {
SzyxPush.unMessage(this.callId)
this.$SzyxPush.unMessage(this.callId)
},
methods: {
sendMsg() {
SzyxPush.sendTextMsg('xuqinmin', '你好!','sas').then((res) => {
this.$SzyxPush.sendTextMsg('xuqinmin', '你好!','sas').then((res) => {
console.log('>>>>>', '发送消息成功', res)
}).catch(error => {
console.log('>>>>>', '发送消息失败', error)


Laddar…
Avbryt
Spara