107 lines
2.6 KiB
JavaScript
107 lines
2.6 KiB
JavaScript
let urlPrefix = getUrlPrefix()
|
|
let browser = checkVersion()
|
|
let env = EnvCheck();
|
|
if (env == 'test') {
|
|
new VConsole();
|
|
}
|
|
|
|
let appName = 'piko'
|
|
|
|
// 封装layer消息提醒框
|
|
let layerIndex
|
|
const showLoading = (content = '加載中...') => {
|
|
layer.open({
|
|
type: 2,
|
|
shadeClose: false,
|
|
content,
|
|
success(e) {
|
|
layerIndex = $(e).attr('index')
|
|
}
|
|
})
|
|
}
|
|
const hideLoading = (index) => {
|
|
layer.close(index)
|
|
}
|
|
const toastMsg = (content = '操作完成', time = 2) => {
|
|
layer.open({
|
|
content,
|
|
time,
|
|
skin: 'msg'
|
|
})
|
|
}
|
|
|
|
let dataList = []
|
|
const getData = () => {
|
|
networkRequest({
|
|
type: 'GET',
|
|
url: urlPrefix + '/clan/myJoinGuardsTeamList',
|
|
success(res) {
|
|
if (res.code === 200) {
|
|
console.log(res.data);
|
|
dataList = res.data
|
|
renderList()
|
|
} else {
|
|
toastMsg(res.message)
|
|
}
|
|
},
|
|
error(err) {
|
|
toastMsg('網絡錯誤')
|
|
}
|
|
})
|
|
}
|
|
|
|
const renderList = () => {
|
|
if(!dataList.length){
|
|
$('ul').hide().siblings('.no-item').show()
|
|
}else{
|
|
let str = ''
|
|
dataList.map((item) => {
|
|
str += `
|
|
<li>
|
|
<img src="${item.avatar}" alt="">
|
|
<div class="item-info">
|
|
<span>${item.type == 1 ? item.roomTitle : item.nick}</span>
|
|
<span>${appName}号:${item.erbanNo}</span>
|
|
</div>
|
|
<p data-type=${item.type} data-codes=${item.codes ? item.codes : ''}>查看流水>></p>
|
|
</li>
|
|
`
|
|
})
|
|
$('ul').html(str)
|
|
$('ul').show().siblings('.no-item').hide()
|
|
}
|
|
}
|
|
|
|
$(function () {
|
|
getInfoFromClient()
|
|
setTimeout(() => {
|
|
getData()
|
|
}, 50)
|
|
|
|
$('ul').on('click', 'li p', function(){
|
|
let type = $(this).data('type')
|
|
if(type == 0){
|
|
toastMsg('仅支持查看牌照房的流水')
|
|
}else if(type == -1){
|
|
toastMsg('该房间暂未生成,无法查看')
|
|
}else{
|
|
window.location.href = urlPrefix + '/peko/modules/statistic/serial.html?codes=' + $(this).data('codes')
|
|
}
|
|
})
|
|
|
|
$('.no-item p').click(() => {
|
|
$('.pop-up').show()
|
|
})
|
|
$('.btn').click(() => {
|
|
$('.pop-up').hide()
|
|
})
|
|
|
|
if(browser.app){
|
|
if(browser.android){
|
|
let channel = JSON.parse(pubInfo.deviceInfo).channel
|
|
if(channel.indexOf('toutiao') != -1 || channel.indexOf('kuaishou') != -1){
|
|
appName = 'piko'
|
|
}
|
|
}
|
|
}
|
|
}) |