Commit a8116397 authored by zhengke's avatar zhengke

修改

parent de6255b2
......@@ -8,7 +8,7 @@ var serverPort = '10086';
*/
function initWebSocket() {
//ws地址
var wsuri = "ws://192.168.20.8:" + serverPort;
var wsuri = "ws://47.96.23.199:" + serverPort;
websock = new WebSocket(wsuri);
websock.onmessage = function (e) {
websocketonmessage(e);
......
......@@ -4,11 +4,11 @@
class="no-border-radius flex column">
<q-tabs v-model="tab" class="text-grey" active-color="secondary" indicator-color="secondary" align="justify"
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']"
src="icons/svg/Communication/Chat-check.svg"></inline-svg>
<span>消息</span>
</q-tab> -->
</q-tab>
<q-tab name="notify">
<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>
......@@ -23,22 +23,28 @@
<q-tab-panels v-model="tab" class="q-mt-none col" animated swipeable transition-prev="jump-up"
transition-next="jump-up">
<q-tab-panel name="msg" class="scroll _scrollbar">
<q-list v-if="dataList.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-list v-if="socektObj.length>0">
<q-item class="q-my-sm q-pa-xs items-start" v-for="(x,i) in socektObj" :key="i" clickable v-ripple
@click="undefinedGongneng">
<q-item-section avatar>
<!-- <q-item-section avatar>
<q-avatar :style="{'background-color':x.icons.backgroundColor}" rounded size="40px"
:text-color="x.icons.color">
<inline-svg :class="['svg-icon',`svg-icon-${x.icons.color}`]" :src="x.icons.icon"
v-if="x.icons.icon.length>1"></inline-svg>
<span v-else>{{x.icons.icon}}</span>
</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-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-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-list>
<none-data v-else></none-data>
......@@ -89,6 +95,10 @@
showObj: {
type: Object,
default: null
},
socektObj:{
type:Array,
default: null
}
},
components: {
......@@ -98,7 +108,7 @@
return {
persistent: true,
saveLoading: false,
tab: "notify",
tab: "msg",
icons: {
'退': {
backgroundColor: '#ffe2e5',
......@@ -250,6 +260,7 @@
created() {
this.init();
this.getNotify();
console.log(this.socektObj,'socektObj');
},
methods: {
init() {
......
......@@ -73,7 +73,7 @@
</div>
</q-page-container>
<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>
</template>
......@@ -112,6 +112,7 @@
isExpend: false,
IsShowLeft: true,
userCenterMenuList: [], //用户中心菜单
socketMsg:[]
}
},
components: {
......@@ -174,16 +175,18 @@
},
methods: {
getMsg() {
let userinfo = this.getLocalStorage();
var SendData = {
AppId: "JiaHeJiaoYu",
ClientId: "1",
ClientId: userinfo.Id,
};
//sendSock(SendData, this.getDataFunc)
sendSock(SendData, this.getDataFunc)
},
getDataFunc(e) {
if (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)
}
},
......@@ -194,9 +197,6 @@
* @param 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;
// 判断浏览器是否支持桌面通知
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