Commit a8116397 authored by zhengke's avatar zhengke

修改

parent de6255b2
...@@ -8,7 +8,7 @@ var serverPort = '10086'; ...@@ -8,7 +8,7 @@ var serverPort = '10086';
*/ */
function initWebSocket() { function initWebSocket() {
//ws地址 //ws地址
var wsuri = "ws://192.168.20.8:" + serverPort; var wsuri = "ws://47.96.23.199:" + serverPort;
websock = new WebSocket(wsuri); websock = new WebSocket(wsuri);
websock.onmessage = function (e) { websock.onmessage = function (e) {
websocketonmessage(e); websocketonmessage(e);
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
class="no-border-radius flex column"> class="no-border-radius flex column">
<q-tabs v-model="tab" class="text-grey" active-color="secondary" indicator-color="secondary" align="justify" <q-tabs v-model="tab" class="text-grey" active-color="secondary" indicator-color="secondary" align="justify"
narrow-indicator inline-label> narrow-indicator inline-label>
<!-- <q-tab alert="negative" name="msg"> <q-tab alert="negative" name="msg">
<inline-svg class="svg-icon q-mr-xs" :class="[tab=='msg'?'svg-icon-secondary':'svg-icon-grey']" <inline-svg class="svg-icon q-mr-xs" :class="[tab=='msg'?'svg-icon-secondary':'svg-icon-grey']"
src="icons/svg/Communication/Chat-check.svg"></inline-svg> src="icons/svg/Communication/Chat-check.svg"></inline-svg>
<span>消息</span> <span>消息</span>
</q-tab> --> </q-tab>
<q-tab name="notify"> <q-tab name="notify">
<inline-svg class="svg-icon q-mr-xs" :class="[tab=='notify'?'svg-icon-secondary':'svg-icon-grey']" <inline-svg class="svg-icon q-mr-xs" :class="[tab=='notify'?'svg-icon-secondary':'svg-icon-grey']"
src="icons/svg/Communication/Urgent-mail.svg"></inline-svg> src="icons/svg/Communication/Urgent-mail.svg"></inline-svg>
...@@ -23,22 +23,28 @@ ...@@ -23,22 +23,28 @@
<q-tab-panels v-model="tab" class="q-mt-none col" animated swipeable transition-prev="jump-up" <q-tab-panels v-model="tab" class="q-mt-none col" animated swipeable transition-prev="jump-up"
transition-next="jump-up"> transition-next="jump-up">
<q-tab-panel name="msg" class="scroll _scrollbar"> <q-tab-panel name="msg" class="scroll _scrollbar">
<q-list v-if="dataList.length>0"> <q-list v-if="socektObj.length>0">
<q-item class="q-my-sm q-pa-xs items-start" v-for="(x,i) in dataList" :key="i" clickable v-ripple <q-item class="q-my-sm q-pa-xs items-start" v-for="(x,i) in socektObj" :key="i" clickable v-ripple
@click="undefinedGongneng"> @click="undefinedGongneng">
<q-item-section avatar> <!-- <q-item-section avatar>
<q-avatar :style="{'background-color':x.icons.backgroundColor}" rounded size="40px" <q-avatar :style="{'background-color':x.icons.backgroundColor}" rounded size="40px"
:text-color="x.icons.color"> :text-color="x.icons.color">
<inline-svg :class="['svg-icon',`svg-icon-${x.icons.color}`]" :src="x.icons.icon" <inline-svg :class="['svg-icon',`svg-icon-${x.icons.color}`]" :src="x.icons.icon"
v-if="x.icons.icon.length>1"></inline-svg> v-if="x.icons.icon.length>1"></inline-svg>
<span v-else>{{x.icons.icon}}</span> <span v-else>{{x.icons.icon}}</span>
</q-avatar> </q-avatar>
</q-item-section> -->
<q-item-section avatar>
<q-avatar :style="{'background-color':'#e1f0ff'}" rounded size="40px"
text-color="negative">
<inline-svg :class="['svg-icon',`svg-icon-primary`]" src="icons/svg/Shopping/Bag2.svg"></inline-svg>
</q-avatar>
</q-item-section> </q-item-section>
<q-item-section> <q-item-section>
<q-item-label class="text-weight-bold">{{x.Title}}</q-item-label> <q-item-label class="text-weight-bold">{{x.Title}}</q-item-label>
<q-item-label caption lines="3" class="remark-font">{{x.Content}}</q-item-label> <q-item-label caption lines="3" class="remark-font">{{x.Content}}</q-item-label>
</q-item-section> </q-item-section>
<q-item-section side class="remark-font">{{x.Time}}</q-item-section> <q-item-section side class="remark-font">{{x.SendTime}}</q-item-section>
</q-item> </q-item>
</q-list> </q-list>
<none-data v-else></none-data> <none-data v-else></none-data>
...@@ -89,6 +95,10 @@ ...@@ -89,6 +95,10 @@
showObj: { showObj: {
type: Object, type: Object,
default: null default: null
},
socektObj:{
type:Array,
default: null
} }
}, },
components: { components: {
...@@ -98,7 +108,7 @@ ...@@ -98,7 +108,7 @@
return { return {
persistent: true, persistent: true,
saveLoading: false, saveLoading: false,
tab: "notify", tab: "msg",
icons: { icons: {
'退': { '退': {
backgroundColor: '#ffe2e5', backgroundColor: '#ffe2e5',
...@@ -250,6 +260,7 @@ ...@@ -250,6 +260,7 @@
created() { created() {
this.init(); this.init();
this.getNotify(); this.getNotify();
console.log(this.socektObj,'socektObj');
}, },
methods: { methods: {
init() { init() {
......
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
</div> </div>
</q-page-container> </q-page-container>
<user-info-box v-if="persistent" :show-obj="userInfo" @close="closeSaveForm"></user-info-box> <user-info-box v-if="persistent" :show-obj="userInfo" @close="closeSaveForm"></user-info-box>
<notify v-if="persistentNotify" :show-obj="userInfo" @close="closeSaveForm"></notify> <notify v-if="persistentNotify" :show-obj="userInfo" :socekt-obj="socketMsg" @close="closeSaveForm"></notify>
</q-layout> </q-layout>
</template> </template>
...@@ -112,6 +112,7 @@ ...@@ -112,6 +112,7 @@
isExpend: false, isExpend: false,
IsShowLeft: true, IsShowLeft: true,
userCenterMenuList: [], //用户中心菜单 userCenterMenuList: [], //用户中心菜单
socketMsg:[]
} }
}, },
components: { components: {
...@@ -174,16 +175,18 @@ ...@@ -174,16 +175,18 @@
}, },
methods: { methods: {
getMsg() { getMsg() {
let userinfo = this.getLocalStorage();
var SendData = { var SendData = {
AppId: "JiaHeJiaoYu", AppId: "JiaHeJiaoYu",
ClientId: "1", ClientId: userinfo.Id,
}; };
//sendSock(SendData, this.getDataFunc) sendSock(SendData, this.getDataFunc)
}, },
getDataFunc(e) { getDataFunc(e) {
if (e.data) { if (e.data) {
var newData = JSON.parse(e.data) var newData = JSON.parse(e.data)
console.log("getDataFunc", newData) console.log("getDataFunc", newData);
this.socketMsg = newData;
this.showNotification(newData[0].Title, newData[0].Content, newData.CoverImg) this.showNotification(newData[0].Title, newData[0].Content, newData.CoverImg)
} }
}, },
...@@ -194,9 +197,6 @@ ...@@ -194,9 +197,6 @@
* @param imgUrl * @param imgUrl
*/ */
showNotification(title, msg, imgUrl) { showNotification(title, msg, imgUrl) {
console.log("title", title)
console.log("msg", msg)
console.log("imgUrl", imgUrl)
var Notification = window.Notification || window.mozNotification || window.webkitNotification; var Notification = window.Notification || window.mozNotification || window.webkitNotification;
// 判断浏览器是否支持桌面通知 // 判断浏览器是否支持桌面通知
if (Notification) { if (Notification) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment