魅力值榜单翻译
This commit is contained in:
BIN
view/peko/modules/charm/images/default-ar.png
Normal file
BIN
view/peko/modules/charm/images/default-ar.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.9 KiB |
BIN
view/peko/modules/charm/images/default-en.png
Normal file
BIN
view/peko/modules/charm/images/default-en.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
BIN
view/peko/modules/charm/images/default-id.png
Normal file
BIN
view/peko/modules/charm/images/default-id.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
BIN
view/peko/modules/charm/images/default-tr.png
Normal file
BIN
view/peko/modules/charm/images/default-tr.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.8 KiB |
@@ -30,6 +30,12 @@
|
||||
<script src="../../common/js/common2.js"></script>
|
||||
<script src="js/index.js?v=2.2"></script>
|
||||
<script src="../../common/js/vconsole.min.js"></script>
|
||||
<script src="./local/zh.js"></script>
|
||||
<script src="./local/en.js"></script>
|
||||
<script src="./local/ar.js"></script>
|
||||
<script src="./local/id.js"></script>
|
||||
<script src="./local/tr.js"></script>
|
||||
<script src="../../common/local/langHandler.js"></script>
|
||||
<script>
|
||||
|
||||
</script>
|
||||
|
@@ -8,23 +8,33 @@ $(function () {
|
||||
let pageSize = 12; //每页条数,这个数字是排行的基数
|
||||
let countPage; //用来判断加载的次数,跟res.data.totalPage比较,countPage为0时不再加载
|
||||
let isLock = true
|
||||
// if (EnvCheck() == 'test') { let vConsole = new VConsole };
|
||||
if (EnvCheck() === 'test') new VConsole
|
||||
|
||||
if (browser.app) {
|
||||
if (browser.ios) {
|
||||
info.uid = tools.cookieUtils.get('uid');
|
||||
window.webkit.messageHandlers.getTicket.postMessage(null);
|
||||
window.webkit.messageHandlers.getRoomUid.postMessage(null);
|
||||
window.webkit.messageHandlers.getDeviceInfo.postMessage(null);
|
||||
} else if (browser.android) {
|
||||
if (androidJsObj && typeof androidJsObj === 'object') {
|
||||
info.uid = parseInt(window.androidJsObj.getUid());
|
||||
info.ticket = window.androidJsObj.getTicket();
|
||||
info.roomUid = window.androidJsObj.getRoomUid();
|
||||
info.deviceInfo = JSON.parse(window.androidJsObj.getDeviceInfo());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
info.uid = 900143;
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
// 初始化国际化
|
||||
initLocalLang();
|
||||
translateFun();
|
||||
|
||||
}, 50)
|
||||
|
||||
//渲染数据
|
||||
const randerList = (data) => {
|
||||
// console.log(data);
|
||||
@@ -32,8 +42,8 @@ $(function () {
|
||||
let obj = {
|
||||
score: 0,
|
||||
user: {
|
||||
nick: "虚位以待",
|
||||
avatar: "./images/default.png",
|
||||
nick: translateObj.waiting,
|
||||
avatar: translateObj.noAvatar,
|
||||
userLevelVo: {
|
||||
experUrl: "",
|
||||
},
|
||||
@@ -56,17 +66,16 @@ $(function () {
|
||||
<img src="${item.user.avatar}" class="${item.user.avatar === 'url' ? 'un-url' : ''}" alt="" />
|
||||
</div>
|
||||
<p class="user-nick">
|
||||
${ item.user.nick.length > 6
|
||||
${item.user.nick.length > 6
|
||||
? item.user.nick.slice(0, 6) + "..."
|
||||
: item.user.nick}
|
||||
</p>
|
||||
<p class="user-grade">
|
||||
<img class="${item.user.userLevelVo.newUser ? '' : 'active'}" src="./images/new.png" alt="" />
|
||||
<img src="${item.user.userLevelVo.experUrl}" alt="" style='display:${ item.user.userLevelVo.experUrl ? "block" : "none"}' />
|
||||
<img src="${item.user.userLevelVo.experUrl}" alt="" style='display:${item.user.userLevelVo.experUrl ? "block" : "none"}' />
|
||||
</p>
|
||||
<p class="user-charm">
|
||||
<img src="./images/heart.png" alt="" />
|
||||
<span>${ item.score}</span>
|
||||
<span>${item.score}</span>
|
||||
</p>
|
||||
</div>`
|
||||
}
|
||||
@@ -81,12 +90,11 @@ $(function () {
|
||||
<img class="user-img" src="${item.user.avatar}" alt="" />
|
||||
<div class="user-detail">
|
||||
<p class="nick">
|
||||
${ item.user.nick.length > 6
|
||||
${item.user.nick.length > 6
|
||||
? item.user.nick.slice(0, 6) + "..."
|
||||
: item.user.nick}
|
||||
</p>
|
||||
<p class="user-grade">
|
||||
<img class="${item.user.userLevelVo.newUser ? '' : 'active'}" src="./images/new.png" alt="" />
|
||||
<img src="${item.user.userLevelVo.experUrl}" alt="" />
|
||||
</p>
|
||||
</div>
|
||||
@@ -98,13 +106,13 @@ $(function () {
|
||||
})
|
||||
// 渲染非前三
|
||||
// $('.renk-other').html(topOtherStr)
|
||||
|
||||
|
||||
$('.message').html('加载完成').fadeOut(500, () => {
|
||||
$('.renk-other')[0].innerHTML += topOtherStr
|
||||
|
||||
})
|
||||
|
||||
|
||||
$('.message').html(translateObj.message1).fadeOut(500, () => {
|
||||
$('.renk-other')[0].innerHTML += topOtherStr
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
//获取数据
|
||||
@@ -130,7 +138,7 @@ $(function () {
|
||||
if (res.data.totalPage >= pageNum) {
|
||||
randerList(res.data.ranking)
|
||||
countPage = res.data.totalPage - pageNum
|
||||
if(pageNum != 1){
|
||||
if (pageNum != 1) {
|
||||
isLock = true
|
||||
}
|
||||
}
|
||||
@@ -142,29 +150,29 @@ $(function () {
|
||||
}, 100)
|
||||
|
||||
//下拉加载
|
||||
$(window).scroll(function(){
|
||||
if(browser.ios){
|
||||
$(window).scroll(function () {
|
||||
if (browser.ios) {
|
||||
var scrollTop = $(this).scrollTop();//这一步是计算已经卷进去滚动条的的高度
|
||||
var scrollHeight = $(document).height();//这个就算当前页面的总高度
|
||||
var windowHeight = $(this).height();//这个是当前window也就是浏览器的高度
|
||||
if(scrollTop + windowHeight + 300 >= scrollHeight){
|
||||
if(isLock){
|
||||
if (scrollTop + windowHeight + 300 >= scrollHeight) {
|
||||
if (isLock) {
|
||||
getData(++pageNum);
|
||||
isLock = false
|
||||
}
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
var scrollTop = $(this).scrollTop();//这一步是计算已经卷进去滚动条的的高度
|
||||
var scrollHeight = $(document).height();//这个就算当前页面的总高度
|
||||
var windowHeight = $(this).height();//这个是当前window也就是浏览器的高度
|
||||
if(scrollTop + windowHeight >= scrollHeight -1 ){//如果这两个相等,不就意味着已经到了页面底部了吗? (发现在测试机(一加)上(scrollTop + windowHeight)永远不可能等于scrollHeight,所以这里 -1)
|
||||
if (scrollTop + windowHeight >= scrollHeight - 1) {//如果这两个相等,不就意味着已经到了页面底部了吗? (发现在测试机(一加)上(scrollTop + windowHeight)永远不可能等于scrollHeight,所以这里 -1)
|
||||
if (!countPage) {
|
||||
$('.message').html('到底啦...').fadeIn(() => {
|
||||
$('.message').html(translateObj.no_more).fadeIn(() => {
|
||||
$('.message').fadeOut()
|
||||
});
|
||||
return;
|
||||
}
|
||||
$('.message').html('加載中...').fadeIn(() => {
|
||||
$('.message').html(translateObj.loading).fadeIn(() => {
|
||||
getData(++pageNum);
|
||||
})
|
||||
}
|
||||
@@ -172,7 +180,48 @@ $(function () {
|
||||
})
|
||||
})
|
||||
|
||||
var translateObj = {
|
||||
charm_value: '魅力值',
|
||||
waiting: '虛位以待',
|
||||
message1: '加載完成',
|
||||
no_more: '沒有更多了',
|
||||
noAvatar: '',
|
||||
loading: '加载中...'
|
||||
}
|
||||
|
||||
// 进行文本替换
|
||||
function translateFun() {
|
||||
const langReplace = window.lang.replace;
|
||||
const localLang = window.lang;
|
||||
$('title').text(langReplace(localLang.demoModule.charm_value));
|
||||
translateObj.charm_value = langReplace(localLang.demoModule.charm_value)
|
||||
translateObj.waiting = langReplace(localLang.demoModule.waiting)
|
||||
translateObj.message1 = langReplace(localLang.demoModule.message1)
|
||||
translateObj.no_more = langReplace(localLang.demoModule.no_more)
|
||||
translateObj.noAvatar = langReplace(localLang.demoModule.noAvatar)
|
||||
}
|
||||
|
||||
// 判断国际化参数路径
|
||||
function fuzzyMatchUpdateQueryStringParameterFun() {
|
||||
const browser = checkVersion();
|
||||
if (browser.app) {
|
||||
if (browser.android) {
|
||||
console.log('info.deviceInfo', info.deviceInfo);
|
||||
let langCode = getLanguageCode(info.deviceInfo["Accept-Language"]);
|
||||
history.replaceState(null, null, updateQueryStringParameter(window.location.href, 'lang', langCode));
|
||||
|
||||
} else {
|
||||
setTimeout(function () {
|
||||
console.log('info.deviceInfo', info.deviceInfo);
|
||||
let langCode = getLanguageCode(info.deviceInfo["Accept-Language"]);
|
||||
history.replaceState(null, null, updateQueryStringParameter(window.location.href, 'lang', langCode));
|
||||
}, 40)
|
||||
}
|
||||
} else {
|
||||
let langCode = getLanguageCode();
|
||||
history.replaceState(null, null, updateQueryStringParameter(window.location.href, 'lang', langCode));
|
||||
}
|
||||
}
|
||||
|
||||
function getMessage(key, value) {
|
||||
info[key] = value;
|
||||
|
16
view/peko/modules/charm/local/ar.js
Normal file
16
view/peko/modules/charm/local/ar.js
Normal file
@@ -0,0 +1,16 @@
|
||||
// 阿拉伯
|
||||
langAr = {
|
||||
demoModule: {
|
||||
// 國際化內容對應的數據項:
|
||||
loading: 'تحميل',
|
||||
network: 'خطأ في الشبكة ، يرجى الخروج وإعادة الدخول',
|
||||
open_app: 'يرجى فتحه في التطبيق',
|
||||
// ===============index============
|
||||
charm_value:'قيمة سحر',
|
||||
waiting: 'منتظر',
|
||||
message1: ' تحميل كاملة',
|
||||
no_more:'لا أكثر',
|
||||
noAvatar:'./images/default-ar.png',
|
||||
|
||||
}
|
||||
}
|
16
view/peko/modules/charm/local/en.js
Normal file
16
view/peko/modules/charm/local/en.js
Normal file
@@ -0,0 +1,16 @@
|
||||
// 英文
|
||||
langEn = {
|
||||
demoModule: {
|
||||
// 國際化內容對應的數據項:
|
||||
loading: 'Loading',
|
||||
network: 'Network error, please exit and re-enter',
|
||||
open_app: 'Please open it in the app',
|
||||
// ===============index============
|
||||
charm_value:'Charm',
|
||||
waiting: 'waiting',
|
||||
message1: 'Loading completed',
|
||||
no_more:'no more',
|
||||
noAvatar:'./images/default-en.png',
|
||||
|
||||
}
|
||||
}
|
15
view/peko/modules/charm/local/id.js
Normal file
15
view/peko/modules/charm/local/id.js
Normal file
@@ -0,0 +1,15 @@
|
||||
// 印尼语
|
||||
langId = {
|
||||
demoModule: {
|
||||
// 國際化內容對應的數據項:
|
||||
loading: 'Memuat',
|
||||
network: 'Kesalahan jaringan, silakan keluar dan masuk kembali',
|
||||
open_app: 'Silakan buka di aplikasi',
|
||||
// ===============index============
|
||||
charm_value:'Nilai pesona',
|
||||
waiting: 'menunggu',
|
||||
message1: 'Memuatkan selesai',
|
||||
no_more:'tidak lagi',
|
||||
noAvatar:'./images/default-id.png',
|
||||
}
|
||||
}
|
15
view/peko/modules/charm/local/tr.js
Normal file
15
view/peko/modules/charm/local/tr.js
Normal file
@@ -0,0 +1,15 @@
|
||||
// 土耳其语
|
||||
langTr = {
|
||||
demoModule: {
|
||||
// 國際化內容對應的數據項:
|
||||
loading: 'Yükleniyor',
|
||||
network: 'Ağ hatası, lütfen çıkın ve tekrar girin',
|
||||
open_app: 'Lütfen uygulamada açın',
|
||||
// ===============index============
|
||||
charm_value:'Cazibe',
|
||||
waiting: 'beklemek',
|
||||
message1: 'Yükleme tamamlandı',
|
||||
no_more:'daha fazla yok',
|
||||
noAvatar:'./images/default-tr.png',
|
||||
}
|
||||
}
|
15
view/peko/modules/charm/local/zh.js
Normal file
15
view/peko/modules/charm/local/zh.js
Normal file
@@ -0,0 +1,15 @@
|
||||
// 繁体中文
|
||||
langZh = {
|
||||
demoModule: {
|
||||
// 國際化內容對應的數據項:
|
||||
loading: '加載中...',
|
||||
network: '網絡錯誤,請退出重進',
|
||||
open_app: '請在app內打開',
|
||||
// ===============index============
|
||||
charm_value:'魅力值',
|
||||
waiting: '虛位以待',
|
||||
message1: '加載完成',
|
||||
no_more:'沒有更多了',
|
||||
noAvatar:'./images/default.png',
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user