|
@@ -1,7 +1,20 @@
|
|
|
$(function() {
|
|
|
var __page = {
|
|
|
powerList: [],
|
|
|
- needPower: ['yyszb'],
|
|
|
+ powerMap: {
|
|
|
+ yyszb: {
|
|
|
+ powerKey: 'bi_sj_yyszs',
|
|
|
+ redirectFnName: 'goToYYSZBPage',
|
|
|
+ },
|
|
|
+ qbgl: {
|
|
|
+ powerKey: 'bi_yx',
|
|
|
+ redirectFnName: 'goToYingXiao',
|
|
|
+ },
|
|
|
+ yxgl: {
|
|
|
+ powerKey: 'bi_yx',
|
|
|
+ redirectFnName: 'goToYingXiao',
|
|
|
+ },
|
|
|
+ },
|
|
|
data: {},
|
|
|
imageViewer: null,
|
|
|
lastScrollCall: null,
|
|
@@ -25,7 +38,7 @@ $(function() {
|
|
|
this.code = code
|
|
|
this.data = __page_config[code] || __page_config.yxgl
|
|
|
$('.page--product--introduce').addClass('style-' + code)
|
|
|
- if (this.needPower.indexOf(code) !== -1) {
|
|
|
+ if (Object.keys(this.powerMap).indexOf(code) !== -1) {
|
|
|
this.getPowerList()
|
|
|
}
|
|
|
return true
|
|
@@ -55,15 +68,15 @@ $(function() {
|
|
|
$('.desc-module-nav-tabs .desc-module-nav-tab:eq(' + tab + ')').trigger('click')
|
|
|
}
|
|
|
},
|
|
|
- checkHasPower: function(c) {
|
|
|
+ checkHasPower: function() {
|
|
|
var code = this.code
|
|
|
- if (this.needPower.indexOf(code) !== -1) {
|
|
|
- return this.powerList.indexOf(c) > -1
|
|
|
+ var conf = this.powerMap[code] || {}
|
|
|
+ var powerKey = conf.powerKey || ''
|
|
|
+ var needPower = Object.keys(this.powerMap)
|
|
|
+ if (needPower.indexOf(code) !== -1) {
|
|
|
+ return this.powerList.indexOf(powerKey) > -1
|
|
|
}
|
|
|
},
|
|
|
- checkHasYYSZBPower: function() {
|
|
|
- return this.checkHasPower('bi_sj_yyszs')
|
|
|
- },
|
|
|
getPowerList: function() {
|
|
|
var _this = this
|
|
|
$.ajax({
|
|
@@ -72,7 +85,7 @@ $(function() {
|
|
|
success: function(res) {
|
|
|
if (res && Array.isArray(res.data)) {
|
|
|
_this.powerList = res.data
|
|
|
- if (_this.checkHasYYSZBPower()) {
|
|
|
+ if (_this.checkHasPower()) {
|
|
|
$('.experience-button').text('立即使用')
|
|
|
}
|
|
|
}
|
|
@@ -224,17 +237,32 @@ $(function() {
|
|
|
var options = options || {}
|
|
|
simpleLeaveSource.doLeaveInfo(source, options)
|
|
|
},
|
|
|
+ redirectToPage: function() {
|
|
|
+ var code = this.code
|
|
|
+ var conf = this.powerMap[code] || {}
|
|
|
+ var redirectFnName = conf.redirectFnName || ''
|
|
|
+ if (redirectFnName && typeof this[redirectFnName] === 'function') {
|
|
|
+ this[redirectFnName]()
|
|
|
+ } else {
|
|
|
+ console.warn('未定义的跳转方法: ' + redirectFnName)
|
|
|
+ }
|
|
|
+ },
|
|
|
goToYYSZBPage: function() {
|
|
|
var iframeUrl = location.origin + '/succbi/yyssjdz/app/sjdz.app/sjqd.spg'
|
|
|
var workUrl = '/page_workDesktop/work-bench/page?link=' + encodeURIComponent(iframeUrl)
|
|
|
window.open(workUrl)
|
|
|
},
|
|
|
+ goToYingXiao: function() {
|
|
|
+ var iframeUrl = location.origin + '/succbi/crm_system/app/crm.app/一级菜单/potential_business_opportunity.spg'
|
|
|
+ var workUrl = '/page_workDesktop/work-bench/page?link=' + encodeURIComponent(iframeUrl)
|
|
|
+ window.open(workUrl)
|
|
|
+ },
|
|
|
initEvents: function() {
|
|
|
var _this = this
|
|
|
$('.experience-button').on('click', function() {
|
|
|
var source = $(this).attr('data-source')
|
|
|
- if (_this.checkHasYYSZBPower()) {
|
|
|
- _this.goToYYSZBPage()
|
|
|
+ if (_this.checkHasPower()) {
|
|
|
+ _this.redirectToPage()
|
|
|
} else {
|
|
|
_this.doLeaveInfo(source)
|
|
|
}
|