diff --git a/view/molistar/activity/act-nameplate/css/index.css b/view/molistar/activity/act-nameplate/css/index.css index d84d73d..e760ffb 100644 --- a/view/molistar/activity/act-nameplate/css/index.css +++ b/view/molistar/activity/act-nameplate/css/index.css @@ -12,7 +12,7 @@ .max { width: 10rem; - height: 30.84rem; + height: 34.02667rem; background: url("../images/max.png?v=1.0") no-repeat; background-size: 100% 100%; font-family: 'pingfang-bold'; @@ -21,10 +21,10 @@ .max .record { position: absolute; position: absolute; - top: 5.9rem; + top: 6.61333rem; right: 0; - width: 1.5rem; - height: 1.4rem; + width: 1.64rem; + height: 0.57333rem; } .max .record img { @@ -34,23 +34,23 @@ .max .btn { position: absolute; - top: 15.8rem; - left: 1.68rem; - width: 2.53333rem; - height: 1.01333rem; + top: 16.1rem; + left: 1.61rem; + width: 2.94667rem; + height: 1.46667rem; } .max .btn.basics-receive { - left: 5.6rem; + left: 5rem; } .max .btn.advance-send { - top: 22.34667rem; + top: 23.34667rem; } .max .btn.advance-receive { - top: 22.34667rem; - left: 5.6rem; + top: 23.34667rem; + left: 5rem; } .max .btn img { @@ -257,8 +257,8 @@ .max .shade-mask-new .shade-content .apply-btn, .max .shade-mask-new .shade-content-delay .apply-btn, .max .shade-mask-new .shade-content-new .apply-btn { - width: 4.90667rem; - height: 1.2rem; + width: 6.37333rem; + height: 0.82667rem; background: url("../images/apply-new.png") no-repeat 0 0/100% 100%; margin: 0.64rem auto 0; } @@ -367,9 +367,9 @@ } .max .shade-mask-delay .shade-content-delay .apply-btn { - width: 4.90667rem; - height: 1.2rem; - background: url("../images/confirm.png") no-repeat 0 0/100% 100%; + width: 6.37333rem; + height: 0.82667rem; + background: url("../images/apply-new.png") no-repeat 0 0/100% 100%; margin: 0.85333rem auto 0; } @@ -484,9 +484,9 @@ } .max .shade-mask-new .shade-content-new .apply-btn { - width: 4.90667rem; - height: 1.2rem; - background: url("../images/confirm.png") no-repeat 0 0/100% 100%; + width: 6.37333rem; + height: 0.82667rem; + background: url("../images/apply-new.png") no-repeat 0 0/100% 100%; margin: 0.61333rem auto 0; } @@ -510,3 +510,7 @@ ::-webkit-scrollbar { display: none; } + +.english .max { + height: 35.76rem; +} diff --git a/view/molistar/activity/act-nameplate/css/index.scss b/view/molistar/activity/act-nameplate/css/index.scss index f1c702a..467da2f 100644 --- a/view/molistar/activity/act-nameplate/css/index.scss +++ b/view/molistar/activity/act-nameplate/css/index.scss @@ -21,7 +21,7 @@ // @import '../../../common/css/flex.scss'; .max { width: px2rem(750); - height: px2rem(2313); + height: px2rem(2552); background: url('../images/max.png?v=1.0') no-repeat; background-size: 100% 100%; font-family: 'pingfang-bold'; @@ -29,10 +29,10 @@ .record { position: absolute; position: absolute; - top: 5.9rem; + top: px2rem(496); right: 0; - width: 1.5rem; - height: 1.4rem; + width: px2rem(123); + height: px2rem(43); img { width: 100%; @@ -42,22 +42,22 @@ .btn { position: absolute; - top: 15.8rem; - left: px2rem(126); - width: px2rem(190); - height: px2rem(76); + top: 16.1rem; + left: 1.61rem; + width: px2rem(221); + height: px2rem(110); &.basics-receive { - left: 5.6rem; + left: 5rem; } &.advance-send { - top: 22.34667rem; + top: 23.34667rem; } &.advance-receive { - top: 22.34667rem; - left: 5.6rem; + top: 23.34667rem; + left: 5rem; } img { @@ -181,8 +181,8 @@ } .apply-btn { - width: px2rem(368); - height: px2rem(90); + width: px2rem(478); + height: px2rem(62); background: url('../images/apply-new.png') no-repeat 0 0/100% 100%; margin: px2rem(48) auto 0; } @@ -277,9 +277,9 @@ } .apply-btn { - width: px2rem(368); - height: px2rem(90); - background: url('../images/confirm.png') no-repeat 0 0/100% 100%; + width: px2rem(478); + height: px2rem(62); + background: url('../images/apply-new.png') no-repeat 0 0/100% 100%; margin: px2rem(64) auto 0; } } @@ -397,9 +397,9 @@ } .apply-btn { - width: px2rem(368); - height: px2rem(90); - background: url('../images/confirm.png') no-repeat 0 0/100% 100%; + width: px2rem(478); + height: px2rem(62); + background: url('../images/apply-new.png') no-repeat 0 0/100% 100%; margin: px2rem(46) auto 0; } } @@ -425,4 +425,10 @@ ::-webkit-scrollbar { display: none; +} + +.english{ + .max{ + height: px2rem(2682); + } } \ No newline at end of file diff --git a/view/molistar/activity/act-nameplate/images/apply-btn-basics-ar.png b/view/molistar/activity/act-nameplate/images/apply-btn-basics-ar.png new file mode 100644 index 0000000..def2091 Binary files /dev/null and b/view/molistar/activity/act-nameplate/images/apply-btn-basics-ar.png differ diff --git a/view/molistar/activity/act-nameplate/images/apply-btn-basics-en.png b/view/molistar/activity/act-nameplate/images/apply-btn-basics-en.png new file mode 100644 index 0000000..6951946 Binary files /dev/null and b/view/molistar/activity/act-nameplate/images/apply-btn-basics-en.png differ diff --git a/view/molistar/activity/act-nameplate/images/apply-btn-basics.png b/view/molistar/activity/act-nameplate/images/apply-btn-basics.png index 950f2b4..0182062 100644 Binary files a/view/molistar/activity/act-nameplate/images/apply-btn-basics.png and b/view/molistar/activity/act-nameplate/images/apply-btn-basics.png differ diff --git a/view/molistar/activity/act-nameplate/images/apply-new-ar.png b/view/molistar/activity/act-nameplate/images/apply-new-ar.png new file mode 100644 index 0000000..6e9210f Binary files /dev/null and b/view/molistar/activity/act-nameplate/images/apply-new-ar.png differ diff --git a/view/molistar/activity/act-nameplate/images/apply-new-en.png b/view/molistar/activity/act-nameplate/images/apply-new-en.png new file mode 100644 index 0000000..4fd92f5 Binary files /dev/null and b/view/molistar/activity/act-nameplate/images/apply-new-en.png differ diff --git a/view/molistar/activity/act-nameplate/images/apply-new.png b/view/molistar/activity/act-nameplate/images/apply-new.png index 3d345e3..3eababb 100644 Binary files a/view/molistar/activity/act-nameplate/images/apply-new.png and b/view/molistar/activity/act-nameplate/images/apply-new.png differ diff --git a/view/molistar/activity/act-nameplate/images/disabled-btn-ar.png b/view/molistar/activity/act-nameplate/images/disabled-btn-ar.png new file mode 100644 index 0000000..c7e33ec Binary files /dev/null and b/view/molistar/activity/act-nameplate/images/disabled-btn-ar.png differ diff --git a/view/molistar/activity/act-nameplate/images/disabled-btn-en.png b/view/molistar/activity/act-nameplate/images/disabled-btn-en.png new file mode 100644 index 0000000..146a121 Binary files /dev/null and b/view/molistar/activity/act-nameplate/images/disabled-btn-en.png differ diff --git a/view/molistar/activity/act-nameplate/images/disabled-btn.png b/view/molistar/activity/act-nameplate/images/disabled-btn.png index d0a367b..a45fc39 100644 Binary files a/view/molistar/activity/act-nameplate/images/disabled-btn.png and b/view/molistar/activity/act-nameplate/images/disabled-btn.png differ diff --git a/view/molistar/activity/act-nameplate/images/max-ar.png b/view/molistar/activity/act-nameplate/images/max-ar.png new file mode 100644 index 0000000..0452cb3 Binary files /dev/null and b/view/molistar/activity/act-nameplate/images/max-ar.png differ diff --git a/view/molistar/activity/act-nameplate/images/max-en.png b/view/molistar/activity/act-nameplate/images/max-en.png new file mode 100644 index 0000000..47145f3 Binary files /dev/null and b/view/molistar/activity/act-nameplate/images/max-en.png differ diff --git a/view/molistar/activity/act-nameplate/images/max.png b/view/molistar/activity/act-nameplate/images/max.png index 76ada91..2b02371 100644 Binary files a/view/molistar/activity/act-nameplate/images/max.png and b/view/molistar/activity/act-nameplate/images/max.png differ diff --git a/view/molistar/activity/act-nameplate/images/new-bg-ar.png b/view/molistar/activity/act-nameplate/images/new-bg-ar.png new file mode 100644 index 0000000..8f3218d Binary files /dev/null and b/view/molistar/activity/act-nameplate/images/new-bg-ar.png differ diff --git a/view/molistar/activity/act-nameplate/images/new-bg-en.png b/view/molistar/activity/act-nameplate/images/new-bg-en.png new file mode 100644 index 0000000..5f25664 Binary files /dev/null and b/view/molistar/activity/act-nameplate/images/new-bg-en.png differ diff --git a/view/molistar/activity/act-nameplate/images/new-bg.png b/view/molistar/activity/act-nameplate/images/new-bg.png index 97d4888..7eb59e0 100644 Binary files a/view/molistar/activity/act-nameplate/images/new-bg.png and b/view/molistar/activity/act-nameplate/images/new-bg.png differ diff --git a/view/molistar/activity/act-nameplate/images/record-ar.png b/view/molistar/activity/act-nameplate/images/record-ar.png new file mode 100644 index 0000000..eb06550 Binary files /dev/null and b/view/molistar/activity/act-nameplate/images/record-ar.png differ diff --git a/view/molistar/activity/act-nameplate/images/record-en.png b/view/molistar/activity/act-nameplate/images/record-en.png new file mode 100644 index 0000000..588c09e Binary files /dev/null and b/view/molistar/activity/act-nameplate/images/record-en.png differ diff --git a/view/molistar/activity/act-nameplate/images/record.png b/view/molistar/activity/act-nameplate/images/record.png new file mode 100644 index 0000000..9ca3d9e Binary files /dev/null and b/view/molistar/activity/act-nameplate/images/record.png differ diff --git a/view/molistar/activity/act-nameplate/images/select-bg-ar.png b/view/molistar/activity/act-nameplate/images/select-bg-ar.png new file mode 100644 index 0000000..8e71000 Binary files /dev/null and b/view/molistar/activity/act-nameplate/images/select-bg-ar.png differ diff --git a/view/molistar/activity/act-nameplate/images/select-bg-en.png b/view/molistar/activity/act-nameplate/images/select-bg-en.png new file mode 100644 index 0000000..dff3e56 Binary files /dev/null and b/view/molistar/activity/act-nameplate/images/select-bg-en.png differ diff --git a/view/molistar/activity/act-nameplate/images/select-bg.png b/view/molistar/activity/act-nameplate/images/select-bg.png index 5feb284..ccc153f 100644 Binary files a/view/molistar/activity/act-nameplate/images/select-bg.png and b/view/molistar/activity/act-nameplate/images/select-bg.png differ diff --git a/view/molistar/activity/act-nameplate/index.html b/view/molistar/activity/act-nameplate/index.html index cb5690b..7758c7f 100644 --- a/view/molistar/activity/act-nameplate/index.html +++ b/view/molistar/activity/act-nameplate/index.html @@ -17,7 +17,8 @@ - 精美铭牌送不停 + + @@ -28,7 +29,7 @@
- +
@@ -62,7 +63,7 @@
- 铭牌样式: + 铭牌样式:

@@ -71,10 +72,10 @@

- 申请时长: + 申请时长:
-

+

@@ -88,20 +89,20 @@
- 铭牌样式: +
- 铭牌文字: - + +
- 申请时长: +
-

+

@@ -114,7 +115,11 @@ + + + + \ No newline at end of file diff --git a/view/molistar/activity/act-nameplate/js/public.js b/view/molistar/activity/act-nameplate/js/public.js index 8319819..c2e8e04 100644 --- a/view/molistar/activity/act-nameplate/js/public.js +++ b/view/molistar/activity/act-nameplate/js/public.js @@ -4,31 +4,215 @@ var browser = checkVersion(); var info = {}; if (EnvCheck() === 'test') new VConsole // 封裝layer消息提醒框 -let layerIndex -const showLoading = (content = '加載中...') => { - layer.open({ - type: 2, - shadeClose: false, - content, - success(e) { - layerIndex = $(e).attr('index') - } - }) +let layerIndex; +var langReplace; +var localLang; +const showLoading = (content = langReplace(localLang.demoModule.layerIndex1)) => { + layer.open({ + type: 2, + shadeClose: false, + content, + success(e) { + layerIndex = $(e).attr('index') + } + }) } const hideLoading = (index) => { - layer.close(index) + layer.close(index) } -const toastMsg = (content = '操作完成', time = 2) => { - layer.open({ - content, - time, - skin: 'msg' - }) +const toastMsg = (content = langReplace(localLang.demoModule.layerIndex2), time = 2) => { + layer.open({ + content, + time, + skin: 'msg' + }) } let delayLock = false, newApplyLock = false - let btnStatus = [] +var partitionId = null; +$(function () { + getInfoFromClient() + fuzzyMatchUpdateQueryStringParameterFun(); // 判断语言 + setTimeout(() => { + langReplace = window.lang.replace; + localLang = window.lang; + fuzzyMatchUpdateQueryStringParameterFun(); // 判断语言 + translateFun(); + getUserNameplateInfo() + userGet() + }, 50) + function translateFun() { + var langReplace = window.lang.replace; + var localLang = window.lang; + $('.max').attr('style', langReplace(localLang.demoModule.max)) + $('.max .shade-mask-new .shade-content-new').attr('style', langReplace(localLang.demoModule.img4)) + $('.max .shade-mask .shade-content, .max .shade-mask-delay .shade-content-delay').attr('style', langReplace(localLang.demoModule.img44)) + $('.apply-btn').attr('style', langReplace(localLang.demoModule.img5)) + $('.max .btn img').attr('src', langReplace(localLang.demoModule.img2)) + $('.max .record img').attr('src', langReplace(localLang.demoModule.img6)) + $('.title_t').html(langReplace(localLang.demoModule.title_t)); + $('.text1').html(langReplace(localLang.demoModule.text1)); + $('.text2').html(langReplace(localLang.demoModule.text2)); + $('.text3').html(langReplace(localLang.demoModule.text3)); + $('.text4').html(langReplace(localLang.demoModule.text4)); + $('.text5').attr('placeholder', partitionId == 1 ? '請輸入4個字' : partitionId == 2) ? `يرجى إدخال 13 أحرف` : `Enter 13 characters`; + if (partitionId == 1 || partitionId == 2) { + $('.text5').attr('maxlength', 13); + } else { + $('.text5').attr('maxlength', 4); + } + + } + if (browser.app) { + _hmt.push(['_trackEvent', 'client', 'click', "act_nameplate"]); + } + + // 點擊申請記錄按鈕 + $('.record').on('click', function () { + window.location.href = './record.html' + }) + + // 關閉彈窗 + $('.shade-mask .close').on('click', () => { + $('.shade-mask').hide() + $('body').css('overflow', 'auto') + }) + $('.shade-mask-delay .close').on('click', () => { + $('.shade-mask-delay').hide() + $('body').css('overflow', 'auto') + }) + $('.shade-mask-new .close').on('click', () => { + $('.shade-mask-new').hide() + $('body').css('overflow', 'auto') + newNameplateId = '' + $(this).find('input').val('') + }) + + let maxApplyDay, nameplateId, type, text + // 監聽 延長期限 按鈕點擊事件 + $('.select-ul').on('click', '.delay-btn', function () { + let li = $(this).parent(); + let src = li.find('.nameplate img').attr('src'); + let desc = li.find('.nameplate span').html(); + maxApplyDay = li.data('applyDay'); + nameplateId = li.data('nameplateId'); + type = li.data('type'); + text = li.data('text'); + + $('.shade-mask-delay .nameplate-style img').attr('src', src); + $('.shade-mask-delay .nameplate-style p span').html(desc); + $('.shade-mask-delay .delay-time p span').html(maxApplyDay); + + $('.shade-mask-delay').show().siblings('.shade-mask, .shade-mask-new').hide() + }) + + // 延期彈窗 點擊減按鈕 + $('.shade-mask-delay').on('click', '.decrease', function () { + let applyDay = parseInt($(this).parent().find('span').html()); + if (applyDay > 7) { + applyDay -= 7; + } else { + toastMsg(langReplace(localLang.demoModule.text6)) + } + $('.shade-mask-delay .delay-time p span').html(applyDay); + }) + //延期彈窗 點擊加按鈕 + $('.shade-mask-delay').on('click', '.increase', function () { + let applyDay = parseInt($(this).parent().find('span').html()); + if (applyDay >= maxApplyDay) { + toastMsg(langReplace(localLang.demoModule.text7)) + } else { + applyDay += 7; + } + $('.shade-mask-delay .delay-time p span').html(applyDay); + }) + // 監聽申請延期確定按鈕點擊事件 + $('.shade-mask-delay').on('click', '.apply-btn', function () { + // applyType 1申請新銘牌,2延長 + if (!delayLock) { + delayLock = true + let params = { + type, + nameplateId, + applyDay: parseInt($(this).parent().find('.delay-time div p span').html()), + applyType: 2, + text + }; + delayNamaplateConfirm(params) + } + }) + + /************************* ******************************/ + + // 監聽 申請新銘牌 按鈕點擊事件 + $('.shade-mask').on('click', '.apply-btn', function () { + let type = $(this).parent().find('.select-ul li').eq(0).data('type'); + getNewNameplateList(type) + }) + + // 申請新銘牌彈窗 點擊減按鈕 + $('.shade-mask-new').on('click', '.decrease', function () { + let applyDay = parseInt($(this).parent().find('span').html()); + if (applyDay > 7) { + applyDay -= 7; + } else { + toastMsg(langReplace(localLang.demoModule.text6)) + } + $('.shade-mask-new .delay-time p span').html(applyDay); + }) + // 申請新銘牌彈窗 點擊加按鈕 + $('.shade-mask-new').on('click', '.increase', function () { + let applyDay = parseInt($(this).parent().find('span').html()); + let maxApplyDay = parseInt($(this).parent().parent().parent().find('.apply-new-ul li').eq(0).data('applyDay')); + if (applyDay >= maxApplyDay) { + toastMsg(langReplace(localLang.demoModule.text7)) + } else { + applyDay += 7; + } + $('.shade-mask-new .delay-time p span').html(applyDay); + }) + + // 申請新銘牌彈窗 點擊銘牌列錶事件 + $('.shade-mask-new').on('click', 'li', function () { + $(this).addClass('active').siblings('li').removeClass('active'); + newNameplateId = $(this).data('nameplateId'); + }) + + // 申請新銘牌彈窗 確定申請 按鈕點擊事件 + $('.shade-mask-new').on('click', '.apply-btn', function () { + let content = $(this).parent(); + let ipt = content.find('input.new-nameplate-desc').val() + if (!newNameplateId) { + toastMsg(langReplace(localLang.demoModule.text8)); + return + } + if (!ipt) { + toastMsg(langReplace(localLang.demoModule.text9)); + return + } + // else { + // if (ipt.length !== 4) { + // toastMsg(langReplace(localLang.demoModule.text10)); + // return + // } + // } + + // applyType 1申請新銘牌,2延長 + if (!newApplyLock) { + newApplyLock = true + let params = { + applyType: 1, + nameplateId: newNameplateId, + text: ipt, + type: parseInt(content.find('ul.apply-new-ul li').eq(0).data('type')), + applyDay: parseInt(content.find('.delay-time div p span').html()) + } + applyNewNamaplateConfirm(params) + } + }) + +}); // 獲取用戶銘牌狀態 const getUserNameplateInfo = () => { showLoading() @@ -38,42 +222,65 @@ const getUserNameplateInfo = () => { data: { uid: pubInfo.uid }, - success(res){ + success(res) { hideLoading(layerIndex); - if(res.code === 200){ + if (res.code === 200) { btnStatus = res.data renderBtnStatus() - }else{ + } else { toastMsg(res.message) } }, - error(){ + error() { hideLoading(layerIndex); - toastMsg('網絡錯誤') + toastMsg(langReplace(localLang.demoModule.layerIndex3)) + } + }) +} +const userGet = () => { + showLoading() + networkRequest({ + type: 'GET', + url: urlPrefix + '/user/get', + data: { + uid: 2615 + }, + success(res) { + hideLoading(layerIndex); + if (res.code === 200) { + partitionId = res.data.partitionId + renderBtnStatus() + } else { + toastMsg(res.message) + } + }, + error() { + hideLoading(layerIndex); + toastMsg(langReplace(localLang.demoModule.layerIndex3)) } }) } // 渲染首頁按鈕狀態 const renderBtnStatus = () => { - btnStatus.map( (item,index) => { - if(index > 1){ - // 進階款式 - $('.btn').eq(index).find('img').attr('src', `${item > 0 ? './images/apply-btn-basics.png' : './images/disabled-btn.png'}`) - if(item > 0){ - $('.btn').eq(index).on('click', () => { - getUserNameplateList(index+1) - }) - } - }else{ - // 基礎款式 - $('.btn').eq(index).find('img').attr('src', `${item > 0 ? './images/apply-btn-basics.png' : './images/disabled-btn.png'}`) - if(item > 0){ - $('.btn').eq(index).on('click', () => { - getUserNameplateList(index+1) - }) - } + btnStatus.map((item, index) => { + if (index > 1) { + // 進階款式 + $('.btn').eq(index).find('img').attr('src', `${item > 0 ? langReplace(localLang.demoModule.img3) : langReplace(localLang.demoModule.img2)}`) + if (item > 0) { + $('.btn').eq(index).on('click', () => { + getUserNameplateList(index + 1) + }) } + } else { + // 基礎款式 + $('.btn').eq(index).find('img').attr('src', `${item > 0 ? langReplace(localLang.demoModule.img3) : langReplace(localLang.demoModule.img2)}`) + if (item > 0) { + $('.btn').eq(index).on('click', () => { + getUserNameplateList(index + 1) + }) + } + } }) } @@ -88,22 +295,22 @@ const getUserNameplateList = (type) => { uid: pubInfo.uid, type }, - success(res){ + success(res) { hideLoading(layerIndex) - if(res.code === 200){ - if(!res.data.length){ + if (res.code === 200) { + if (!res.data.length) { getNewNameplateList(type) - }else{ + } else { userNameplateList = res.data renderNameplateList() } - }else{ + } else { toastMsg(res.message) } }, - error(){ + error() { hideLoading(layerIndex); - toastMsg('網絡錯誤') + toastMsg(langReplace(localLang.demoModule.layerIndex3)) } }) } @@ -111,10 +318,10 @@ const getUserNameplateList = (type) => { // 渲染銘牌列錶(選擇彈窗) const renderNameplateList = () => { let str = '' - userNameplateList.map( item => { + userNameplateList.map(item => { str += `
  • -

    剩余${item.expireDays}天

    +

    剩余${item.expireDays}${langReplace(localLang.demoModule.text3)}

    ${item.word} @@ -143,22 +350,22 @@ const getNewNameplateList = (type) => { uid: pubInfo.uid, type }, - success(res){ + success(res) { hideLoading(layerIndex) - if(res.code === 200){ - if(!res.data.length){ - toastMsg('暫時沒有銘牌可申請') + if (res.code === 200) { + if (!res.data.length) { + toastMsg(langReplace(localLang.demoModule.text11)) return } newNameplateList = res.data renderNewNameplateList() - }else{ + } else { toastMsg(res.message) } }, - error(){ + error() { hideLoading(layerIndex); - toastMsg('網絡錯誤') + toastMsg(langReplace(localLang.demoModule.layerIndex3)) } }) } @@ -167,7 +374,7 @@ let newNameplateId //只有一個可選時,默認選中 // 渲染申請新銘牌彈窗 const renderNewNameplateList = () => { let str = ''; - newNameplateList.map( item => { + newNameplateList.map(item => { str += `
  • @@ -177,7 +384,7 @@ const renderNewNameplateList = () => { ` }) $('.apply-new-ul').html(str) - if(newNameplateList.length === 1){ + if (newNameplateList.length === 1) { let onlyLi = $('.apply-new-ul').find('li').eq(0); newNameplateId = onlyLi.data('nameplateId'); onlyLi.addClass('active') @@ -201,23 +408,23 @@ const delayNamaplateConfirm = (params) => { applyType: params.applyType, text: params.text }, - success(res){ + success(res) { hideLoading(layerIndex) - if(res.code === 200){ - toastMsg('申請成功') + if (res.code === 200) { + toastMsg(langReplace(localLang.demoModule.text12)) $('.shade-mask-delay').hide() $('body').css('overflow', 'auto') delayLock = false - setTimeout(()=>{ + setTimeout(() => { location.reload() }, 500) - }else{ + } else { toastMsg(res.message) } }, - error(){ + error() { hideLoading(layerIndex); - toastMsg('網絡錯誤') + toastMsg(langReplace(localLang.demoModule.layerIndex3)) } }) } @@ -236,180 +443,26 @@ const applyNewNamaplateConfirm = (params) => { applyType: params.applyType, text: params.text }, - success(res){ + success(res) { hideLoading(layerIndex) - if(res.code === 200){ - toastMsg('申請成功') + if (res.code === 200) { + toastMsg(langReplace(localLang.demoModule.text12)) $('.shade-mask-new').hide() $('body').css('overflow', 'auto') - newApplyLock = false - setTimeout(()=>{ + newApplyLock = false + setTimeout(() => { location.reload() }, 500) - }else{ - newApplyLock = false + } else { + newApplyLock = false toastMsg(res.message) } }, - error(){ + error() { hideLoading(layerIndex); - toastMsg('網絡錯誤,請退出重進') + toastMsg(langReplace(localLang.demoModule.layerIndex3)) } }) } -$(function () { - getInfoFromClient() - setTimeout( () => { - getUserNameplateInfo() - }, 50) - - if (browser.app) { - _hmt.push(['_trackEvent', 'client', 'click', "act_nameplate"]); - } - - // 點擊申請記錄按鈕 - $('.record').on('click', function(){ - window.location.href = './record.html' - }) - - // 關閉彈窗 - $('.shade-mask .close').on('click', () => { - $('.shade-mask').hide() - $('body').css('overflow', 'auto') - }) - $('.shade-mask-delay .close').on('click', () => { - $('.shade-mask-delay').hide() - $('body').css('overflow', 'auto') - }) - $('.shade-mask-new .close').on('click', () => { - $('.shade-mask-new').hide() - $('body').css('overflow', 'auto') - newNameplateId = '' - $(this).find('input').val('') - }) - - let maxApplyDay, nameplateId, type, text - // 監聽 延長期限 按鈕點擊事件 - $('.select-ul').on('click', '.delay-btn', function() { - let li = $(this).parent(); - let src = li.find('.nameplate img').attr('src'); - let desc = li.find('.nameplate span').html(); - maxApplyDay = li.data('applyDay'); - nameplateId = li.data('nameplateId'); - type = li.data('type'); - text = li.data('text'); - - $('.shade-mask-delay .nameplate-style img').attr('src', src); - $('.shade-mask-delay .nameplate-style p span').html(desc); - $('.shade-mask-delay .delay-time p span').html(maxApplyDay); - - $('.shade-mask-delay').show().siblings('.shade-mask, .shade-mask-new').hide() - }) - - // 延期彈窗 點擊減按鈕 - $('.shade-mask-delay').on('click', '.decrease', function(){ - let applyDay = parseInt( $(this).parent().find('span').html() ); - if(applyDay > 7){ - applyDay -= 7; - }else{ - toastMsg('銘牌至少申請7天') - } - $('.shade-mask-delay .delay-time p span').html(applyDay); - }) - //延期彈窗 點擊加按鈕 - $('.shade-mask-delay').on('click', '.increase', function(){ - let applyDay = parseInt( $(this).parent().find('span').html() ); - if(applyDay >= maxApplyDay){ - toastMsg('已達最大申請時長') - }else{ - applyDay += 7; - } - $('.shade-mask-delay .delay-time p span').html(applyDay); - }) - // 監聽申請延期確定按鈕點擊事件 - $('.shade-mask-delay').on('click', '.apply-btn', function(){ - // applyType 1申請新銘牌,2延長 - if(!delayLock){ - delayLock = true - let params = { - type, - nameplateId, - applyDay: parseInt( $(this).parent().find('.delay-time div p span').html() ), - applyType: 2, - text - }; - delayNamaplateConfirm(params) - } - }) - - /************************* ******************************/ - - // 監聽 申請新銘牌 按鈕點擊事件 - $('.shade-mask').on('click', '.apply-btn', function(){ - let type = $(this).parent().find('.select-ul li').eq(0).data('type'); - getNewNameplateList(type) - }) - - // 申請新銘牌彈窗 點擊減按鈕 - $('.shade-mask-new').on('click', '.decrease', function(){ - let applyDay = parseInt( $(this).parent().find('span').html() ); - if(applyDay > 7){ - applyDay -= 7; - }else{ - toastMsg('銘牌至少申請7天') - } - $('.shade-mask-new .delay-time p span').html(applyDay); - }) - // 申請新銘牌彈窗 點擊加按鈕 - $('.shade-mask-new').on('click', '.increase', function(){ - let applyDay = parseInt( $(this).parent().find('span').html() ); - let maxApplyDay = parseInt( $(this).parent().parent().parent().find('.apply-new-ul li').eq(0).data('applyDay') ); - if(applyDay >= maxApplyDay){ - toastMsg('已達最大申請時長') - }else{ - applyDay += 7; - } - $('.shade-mask-new .delay-time p span').html(applyDay); - }) - - // 申請新銘牌彈窗 點擊銘牌列錶事件 - $('.shade-mask-new').on('click', 'li', function(){ - $(this).addClass('active').siblings('li').removeClass('active'); - newNameplateId = $(this).data('nameplateId'); - }) - - // 申請新銘牌彈窗 確定申請 按鈕點擊事件 - $('.shade-mask-new').on('click', '.apply-btn', function(){ - let content = $(this).parent(); - let ipt = content.find('input.new-nameplate-desc').val() - if(!newNameplateId){ - toastMsg('請選擇樣式'); - return - } - if(!ipt){ - toastMsg('請添加銘牌文字'); - return - }else{ - if(ipt.length !== 4){ - toastMsg('請添加4個字的銘牌文字'); - return - } - } - - // applyType 1申請新銘牌,2延長 - if(!newApplyLock){ - newApplyLock = true - let params = { - applyType: 1, - nameplateId: newNameplateId, - text: ipt, - type: parseInt( content.find('ul.apply-new-ul li').eq(0).data('type') ), - applyDay: parseInt( content.find('.delay-time div p span').html() ) - } - applyNewNamaplateConfirm(params) - } - }) - -}); diff --git a/view/molistar/activity/act-nameplate/local/ar.js b/view/molistar/activity/act-nameplate/local/ar.js new file mode 100644 index 0000000..602e50f --- /dev/null +++ b/view/molistar/activity/act-nameplate/local/ar.js @@ -0,0 +1,31 @@ +// 阿拉伯 +langAr = { + // 模块 + demoModule: { + layerIndex1: `التحميل...`, + layerIndex2: `اكتمال العملية`, + layerIndex3: `خطأ في الشبكة`, + max: `background:url("./images/max-ar.png") no-repeat;background-size:100% 100%;`, + img4: `background-image: url(./images/new-bg-ar.png);`, + img44: `background-image: url(./images/select-bg-ar.png);`, + img5: `background: url('./images/apply-new-ar.png') no-repeat 0 0/100% 100%;`, + img2: `./images/disabled-btn-ar.png`, + img3: `./images/apply-btn-basics-ar.png`, + img6: `./images/record-ar.png`, + title_t: `مخصص`, + text1: `نمط اللوحة:`, + text2: `مدة التطبيق:`, + text3: `أيام`, + text4: `نص اللوحة:`, + text5: `يرجى إدخال 13 أحرف`, + text55: `13`, + text6: `يجب تطبيق اللوحة لمدة 7 أيام على الأقل`, + text7: `تم بلوغ أقصى مدة للتطبيق`, + text8: `يرجى اختيار نمط`, + text9: `يرجى إضافة نص اللوحة`, + text10: `يرجى إضافة نص اللوحة من 4 أحرف`, + text11: `لا توجد لوحات متاحة حالياً`, + text12: `تم التطبيق بنجاح`, + } + +} \ No newline at end of file diff --git a/view/molistar/activity/act-nameplate/local/en.js b/view/molistar/activity/act-nameplate/local/en.js new file mode 100644 index 0000000..f41d8c1 --- /dev/null +++ b/view/molistar/activity/act-nameplate/local/en.js @@ -0,0 +1,31 @@ +// 英文 +langEn = { + // 模块 + demoModule: { + layerIndex1: `Loading...`, + layerIndex2: `Operation completed`, + layerIndex3: `Network error`, + max: `background:url("./images/max-en.png") no-repeat;background-size:100% 100%;`, + img4: `background-image: url(./images/new-bg-en.png);`, + img44: `background-image: url(./images/select-bg-en.png);`, + img5: `background: url('./images/apply-new-en.png') no-repeat 0 0/100% 100%;`, + img2: `./images/disabled-btn-en.png`, + img3: `./images/apply-btn-basics-en.png`, + img6: `./images/record-en.png`, + title_t: `Customized`, + text1: `Style: `, + text2: `Duration: `, + text3: `days`, + text4: `Text: `, + text5: `Enter 13 characters`, + text55: `13`, + text6: `Minimum 7 days required`, + text7: `Maximum duration reached`, + text8: `Select a style`, + text9: `Add text`, + text10: `Add 4 characters of text`, + text11: `No nameplates available`, + text12: `Successful`, + } + +} \ No newline at end of file diff --git a/view/molistar/activity/act-nameplate/local/zh.js b/view/molistar/activity/act-nameplate/local/zh.js new file mode 100644 index 0000000..7804152 --- /dev/null +++ b/view/molistar/activity/act-nameplate/local/zh.js @@ -0,0 +1,30 @@ +// 中文 +langZh = { + // 模塊 + demoModule: { + layerIndex1: `加載中...`, + layerIndex2: `操作完成`, + layerIndex3: `網路錯誤`, + max: `background:url("./images/max.png") no-repeat;background-size:100% 100%;`, + img4: `background-image: url(./images/new-bg.png);`, + img44: `background-image: url(./images/select-bg.png);`, + img5: `background: url('./images/apply-new.png') no-repeat 0 0/100% 100%;`, + img2: `./images/disabled-btn.png`, + img3: `./images/apply-btn-basics.png`, + img6: `./images/record.png`, + title_t: `私人訂製`, + text1: `銘牌樣式:`, + text2: `申請時長:`, + text3: `天`, + text4: `銘牌文字:`, + text5: `請輸入4個字`, + text55: `4`, + text6: `銘牌至少申請7天`, + text7: `已達最大申請時長`, + text8: `請選擇樣式`, + text9: `請添加銘牌文字`, + text10: `請添加4個字的銘牌文字`, + text11: `暫時沒有銘牌可申請`, + text12: `申請成功`, + } +} \ No newline at end of file diff --git a/view/molistar/common/js/common2.js b/view/molistar/common/js/common2.js index bf60be3..62c301c 100644 --- a/view/molistar/common/js/common2.js +++ b/view/molistar/common/js/common2.js @@ -261,7 +261,7 @@ function convert(_url) { // 根据域名适配环境 function EnvCheck() { if (window.location.href) { - if(window.location.pathname.match(/payAr/)){ + if (window.location.pathname.match(/payAr/)) { pubInfo['Accept-Language'] = "ar"; } var _url = window.location.host; @@ -838,9 +838,11 @@ function langCodeFun(langCode) { document.documentElement.setAttribute("dir", "rtl"); document.body.classList.add('arabic'); - if (window.location.href.match(/guildAr/)) { - document.documentElement.setAttribute("dir", "ltr"); - } + }else if(langCode == "en"){ + document.body.classList.add('english'); + } + if (window.location.href.match(/guildAr/)) { + document.documentElement.setAttribute("dir", "ltr"); } } // 获取整条url