提交 ed79d586 编写于 作者: Q qiang

Merge branch 'dev' into alpha

......@@ -25,6 +25,11 @@ const pageMode = {
add: 'add',
replace: 'replace'
}
const loadMode = {
auto: 'auto',
onready: 'onready',
manual: 'manual'
}
const attrs = [
'pageCurrent',
......@@ -90,7 +95,7 @@ export default {
default: false
},
gettree: {
type: [Boolean, String],
type: [Boolean, String, Object],
default: false
},
gettreepath: {
......@@ -117,6 +122,18 @@ export default {
type: [Boolean, String],
default: false
},
pageIndistinct: {
type: [Boolean, String],
default: false
},
exceptForeignKey: {
type: String,
default: ''
},
loadtime: {
type: String,
default: 'auto'
},
manual: {
type: Boolean,
default: false
......@@ -146,6 +163,10 @@ export default {
})
return al
}, (newValue, oldValue) => {
if (this.loadtime === loadMode.manual) {
return
}
this.paginationInternal.size = this.pageSize
let needReset = false
......@@ -206,7 +227,7 @@ export default {
}
// #endif
if (!this.manual) {
if (!this.manual && this.loadtime === loadMode.auto) {
this.loadData()
}
},
......@@ -461,6 +482,9 @@ export default {
if (this.field) {
db = db.field(this.field)
}
if (this.exceptForeignKey) {
db = db.exceptForeignKey(this.exceptForeignKey)
}
if (this.groupby) {
db = db.groupBy(this.groupby)
}
......
......@@ -21,7 +21,21 @@ function normalizeUniModulesPagesJson (pagesJson, pluginId) {
return pagesJson
}
function initUniModules () {
global.uniModules = []
try {
global.uniModules = fs
.readdirSync(path.resolve(process.env.UNI_INPUT_DIR, 'uni_modules'))
.filter(module =>
fs.existsSync(
path.resolve(process.env.UNI_INPUT_DIR, 'uni_modules', module, 'package.json')
)
)
} catch (e) {}
}
module.exports = {
initUniModules,
getPagesJson (content) {
const uniModulesDir = path.resolve(process.env.UNI_INPUT_DIR, 'uni_modules')
const pluginPagesJsons = []
......
......@@ -105,23 +105,18 @@ if (process.env.NODE_ENV === 'production') { // 发行模式,不启用 cache
delete process.env.UNI_USING_CACHE
}
global.uniModules = []
try {
global.uniModules = fs
.readdirSync(path.resolve(process.env.UNI_INPUT_DIR, 'uni_modules'))
.filter(module =>
fs.existsSync(
path.resolve(process.env.UNI_INPUT_DIR, 'uni_modules', module, 'package.json')
)
)
} catch (e) {}
const {
normalizePath,
isSupportSubPackages,
runByHBuilderX,
getPagesJson
} = require('@dcloudio/uni-cli-shared')
} = require('@dcloudio/uni-cli-shared')
const {
initUniModules
} = require('@dcloudio/uni-cli-shared/lib/uni_modules')
initUniModules()
const pagesJsonObj = getPagesJson()
// 读取分包
......
const {
initAutoImportScanComponents
} = require('@dcloudio/uni-cli-shared/lib/pages')
const {
initUniModules
} = require('@dcloudio/uni-cli-shared/lib/uni_modules')
let compiling = false
......@@ -37,6 +40,8 @@ class WebpackUniAppPlugin {
if (fileName && typeof fileName === 'string') {
if (fileName.indexOf('.vue') !== -1 || fileName.indexOf('.nvue') !== -1) {
if (process.UNI_AUTO_SCAN_COMPONENTS) {
// TODO 需要处理copy webpack
initUniModules()
initAutoImportScanComponents()
}
}
......
......@@ -13,7 +13,7 @@ export const uploadFile = {
type: String,
validator (value, params) {
if (value) {
params.type = getRealPath(value)
params.filePath = getRealPath(value)
}
}
},
......
......@@ -10,8 +10,7 @@ UniServiceJSBridge.subscribe('onAdMethodCallback', ({
callbackId,
data
}, pageId) => {
const { adpid, width, count } = data
getAdData(adpid, width, count, (res) => {
getAdData(data, (res) => {
operateAdView(pageId, callbackId, 'success', res)
}, (err) => {
operateAdView(pageId, callbackId, 'fail', err)
......@@ -20,7 +19,8 @@ UniServiceJSBridge.subscribe('onAdMethodCallback', ({
const _adDataCache = {}
function getAdData (adpid, width, count, onsuccess, onerror) {
function getAdData (data, onsuccess, onerror) {
const { adpid, width } = data
const key = adpid + '-' + width
const adDataList = _adDataCache[key]
if (adDataList && adDataList.length > 0) {
......@@ -29,11 +29,7 @@ function getAdData (adpid, width, count, onsuccess, onerror) {
}
plus.ad.getAds(
{
adpid,
count,
width
},
data,
(res) => {
const list = res.ads
onsuccess(list.splice(0, 1)[0])
......
......@@ -86,7 +86,7 @@ export function getSystemInfo () {
windowHeight,
statusBarHeight,
language: plus.os.language,
system: plus.os.version,
system: `${platform} ${plus.os.version}`,
version: plus.runtime.innerVersion,
fontSizeSetting: '',
platform,
......
......@@ -35,6 +35,10 @@ export default {
dataCount: {
type: Number,
default: 5
},
channel: {
type: String,
default: ''
}
},
data () {
......@@ -150,7 +154,10 @@ export default {
const data = {
adpid: adpid || this.adpid,
width: this.position.width,
count: this.dataCount
count: this.dataCount,
ext: {
channel: this.channel
}
}
UniViewJSBridge.publishHandler('onAdMethodCallback', {
callbackId: this._callbackId,
......
......@@ -11,6 +11,18 @@ const isAndroid = /android/i.test(ua)
* 是否iOS设备
*/
const isIOS = /iphone|ipad|ipod/i.test(ua)
/**
* 是否是Windows设备
*/
const isWindows = ua.match(/Windows NT ([\d|\d.\d]*)/i)
/**
* 是否是Mac设备
*/
const isMac = /Macintosh|Mac/i.test(ua)
/**
* 是否是Linux设备
*/
const isLinux = /Linux|X11/i.test(ua)
/**
* 获取系统信息-同步
*/
......@@ -69,6 +81,61 @@ export function getSystemInfoSync () {
break
}
}
} else if (isWindows || isMac || isLinux) {
model = 'PC'
const osversionFind = ua.match(/\((.+?)\)/)[1]
if (isWindows) {
osname = 'Windows'
osversion = ''
switch (isWindows[1]) {
case '5.1':
osversion = 'XP'
break
case '6.0':
osversion = 'Vista'
break
case '6.1':
osversion = '7'
break
case '6.2':
osversion = '8'
break
case '6.3':
osversion = '8.1'
break
case '10.0':
osversion = '10'
break
}
const framework = osversionFind.match(/[Win|WOW]([\d]+)/)
if (framework) {
osversion += ` x${framework[1]}`
}
} else if (isMac) {
osname = 'Mac'
osversion = osversionFind.match(/Mac OS X (.+)/) || ''
if (osversion) {
osversion = osversion[1].replace(/_/g, '.')
// '10_15_7' or '10.16; rv:86.0'
if (osversion.indexOf(';') !== -1) {
osversion = osversion.split(';')[0]
}
}
} else if (isLinux) {
osname = 'Linux'
osversion = osversionFind.match(/Linux (.*)/) || ''
if (osversion) {
osversion = osversion[1]
// 'x86_64' or 'x86_64; rv:79.0'
if (osversion.indexOf(';') !== -1) {
osversion = osversion.split(';')[0]
}
}
}
} else {
osname = 'Other'
osversion = '0'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册