项目库详情加一个红点
This commit is contained in:
parent
3598d4d623
commit
9b1f0680d9
9
app.js
9
app.js
@ -163,9 +163,13 @@ App({
|
||||
}).catch(res => {})
|
||||
|
||||
// 判断socket从后台打开 并且已经断开链接了,需要重启
|
||||
if (this.globalData.isHideState && this.globalData.socketTask && this.globalData.socketTask['readyState'] != 1) {
|
||||
// if (this.globalData.isHideState && this.globalData.socketTask && this.globalData.socketTask['readyState'] != 1) {
|
||||
// miucms.useSocket()
|
||||
// }
|
||||
miucms.pageStart(this).then(() => {
|
||||
miucms.useSocket()
|
||||
}
|
||||
})
|
||||
|
||||
this.globalData.isHideState = false
|
||||
},
|
||||
onHide: function () {
|
||||
@ -311,5 +315,6 @@ App({
|
||||
popup: undefined, // 全局弹窗数据 undefined 是还没获取到 null 是没有弹窗 {} 是数据
|
||||
offerkaipingadvertisement: {}, // 开屏广告 数据
|
||||
offerkaipingadvertisementState: false, // 开屏广告 状态
|
||||
isConnected: false,
|
||||
}
|
||||
})
|
@ -113,8 +113,6 @@ Page({
|
||||
if (element.scholarship) element['scholarshipText'] = this.JudgmentScholarshipText(element.scholarship)
|
||||
element['disciplinename'] = obj[element.disciplineid] || ''
|
||||
})
|
||||
|
||||
console.log("list", list[0].disciplineid);
|
||||
this.setData({
|
||||
isquick: data.isquick,
|
||||
list,
|
||||
|
@ -88,7 +88,9 @@ Page({
|
||||
sideFixed: false,
|
||||
rpx30: 30,
|
||||
user: {},
|
||||
offerList: []
|
||||
offerList: [],
|
||||
sideNum: {},
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
@ -133,7 +135,7 @@ Page({
|
||||
const data = res.data
|
||||
common.decodeKey(data.info).then(res => {
|
||||
data.info = res
|
||||
|
||||
console.log(res);
|
||||
let course = {
|
||||
required: [],
|
||||
requiredCount: 0,
|
||||
@ -199,6 +201,7 @@ Page({
|
||||
if (month > semester.month && year + 1 <= semester.year) info['semesterState'] = true
|
||||
|
||||
let scores = info.language_proficiency_scores || []
|
||||
console.log("scores", scores);
|
||||
const scoresList = scores
|
||||
.map(element => {
|
||||
let text = ""
|
||||
@ -641,9 +644,13 @@ Page({
|
||||
element["timestamp"] = util.strtimeago(element["timestamp"], 3)
|
||||
})
|
||||
|
||||
|
||||
let sideNum = this.data.sideNum
|
||||
sideNum['consult'] = data.count
|
||||
this.setData({
|
||||
offerList: list,
|
||||
side,
|
||||
sideNum,
|
||||
})
|
||||
})
|
||||
},
|
||||
|
@ -108,6 +108,27 @@ navigator {
|
||||
z-index: 1;
|
||||
height: 100%;
|
||||
|
||||
.red-amount {
|
||||
padding: 0 8rpx;
|
||||
background-color: #f95d5d;
|
||||
height: 24rpx;
|
||||
line-height: 24rpx;
|
||||
font-size: 18rpx;
|
||||
border-radius: 15rpx;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
font-weight: 400;
|
||||
|
||||
&.red-round {
|
||||
padding: 0;
|
||||
width: 24rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
&.sideFixed {
|
||||
position: fixed;
|
||||
border-radius: 0;
|
||||
|
@ -31,7 +31,9 @@
|
||||
<view class="side {{ sideFixed ? 'sideFixed' : '' }}" style="top: {{ sideFixed ? totalTopHeight : 0 }}px;">
|
||||
<view class="side-fill {{ sideKey == 'pivotal' ? 'side-fill-white' : '' }}"></view>
|
||||
<view class="item flexcenter {{ index == sideKey ? 'pitch' : '' }}" wx:for="{{ side }}" bind:tap="handSide" data-key="{{ index }}" wx:key="index">
|
||||
<view class="text">{{ item }}</view>
|
||||
<view class="text">{{ item }}
|
||||
<view wx:if="{{ sideNum[index] }}" class="red-amount {{ sideNum[index] < 10 ? 'red-round' : '' }}">{{ sideNum[index] }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -89,6 +89,25 @@ navigator {
|
||||
z-index: 1;
|
||||
height: 100%;
|
||||
}
|
||||
.side .red-amount {
|
||||
padding: 0 8rpx;
|
||||
background-color: #f95d5d;
|
||||
height: 24rpx;
|
||||
line-height: 24rpx;
|
||||
font-size: 18rpx;
|
||||
border-radius: 15rpx;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
font-weight: 400;
|
||||
}
|
||||
.side .red-amount.red-round {
|
||||
padding: 0;
|
||||
width: 24rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.side.sideFixed {
|
||||
position: fixed;
|
||||
border-radius: 0;
|
||||
|
@ -5,5 +5,17 @@
|
||||
"compileHotReLoad": false,
|
||||
"urlCheck": false
|
||||
},
|
||||
"condition": {}
|
||||
"condition": {
|
||||
"miniprogram": {
|
||||
"list": [
|
||||
{
|
||||
"name": "pages/projectDetails/projectDetails",
|
||||
"pathName": "pages/projectDetails/projectDetails",
|
||||
"query": "uniqid=IwdCOvZ08KUhkXtjXQ5vhAPHczKrcBN5pT_y_7MIdipV21AHwG_5tr-Khp8EdxCnmMHk8uHJtNw-knkCuWIyYTU~",
|
||||
"launchMode": "default",
|
||||
"scene": null
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
@ -201,7 +201,7 @@ function pageStart(app) {
|
||||
if (app.globalData.code == 200) {
|
||||
resolve()
|
||||
} else {
|
||||
timer = setInterval(function () {
|
||||
const timer = setInterval(function () {
|
||||
if (app.globalData.code == 200) {
|
||||
app.globalData.canGetData = true;
|
||||
resolve()
|
||||
@ -404,22 +404,29 @@ let restartCount = 0 // 重启次数 超过5次不在重启
|
||||
|
||||
// 开启socket
|
||||
const useSocket = () => {
|
||||
if (app.globalData.isConnected) {
|
||||
console.log("已经连接,不再重复连接")
|
||||
return // 如果已经连接,则不再创建新的 socketTask
|
||||
}
|
||||
app.globalData.socketTask = wx.connectSocket({
|
||||
url: `wss://socket.gter.net/?token=${wx.getStorageSync('Authorization') || ''}`,
|
||||
success: function (res) {
|
||||
restartCount = 0
|
||||
app.globalData.isConnected = true // 连接成功,设置为 true
|
||||
},
|
||||
fail: function (err) {}
|
||||
fail: function (err) {
|
||||
app.globalData.isConnected = false // 连接成功,设置为 true
|
||||
}
|
||||
})
|
||||
app.globalData.socketTask.onOpen(function () {
|
||||
let user = app.globalData.user || {}
|
||||
// 初始化发消息
|
||||
if (user && wx.getStorageSync('Authorization')) {
|
||||
if (wx.getStorageSync('Authorization')) {
|
||||
let dataToSend = {
|
||||
type: "bind",
|
||||
data: {
|
||||
token: wx.getStorageSync('Authorization') || '',
|
||||
uid: user.uid || 0
|
||||
app: "wxd7ebf76a0a87057d",
|
||||
// uid: user.uid || 0
|
||||
}
|
||||
}
|
||||
app.globalData.socketTask.send({
|
||||
@ -516,6 +523,8 @@ const useSocket = () => {
|
||||
// 断连后 10秒重连接
|
||||
if (restartCount <= 5) setTimeout(() => useSocket(), 10000);
|
||||
// setTimeout(() => useSocket(), 10000);
|
||||
app.globalData.isConnected = false // 连接关闭,重置为 false
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user