提交 4c96efe7 编写于 作者: Q qiang

Merge branch 'dev' into alpha

# Conflicts:
#	packages/uni-h5/dist/index.umd.min.js
......@@ -425,6 +425,16 @@ function initAutoComponents () {
function initAutoImportScanComponents () {
const components = initAutoComponents()
const {
initUTSComponents
} = require('./uts/uts.js')
initUTSComponents(process.env.UNI_INPUT_DIR, process.env.UNI_PLATFORM).forEach((item) => {
components[item.pattern.source] = item.replacement.replace('\0', '').replace('?uts-proxy',
'/package.json?uts-proxy')
})
if (process.env.UNI_PLATFORM === 'quickapp-native') {
if (!uniQuickAppAutoImportScanComponents) {
uniQuickAppAutoImportScanComponents = getAutoComponentsByDir(
......@@ -463,8 +473,7 @@ function initAutoImportComponents (easycom = {}) {
}
initBuiltInEasycom(BUILT_IN_EASYCOMS, usingAutoImportComponents)
// 目前仅 mp-weixin 内置支持 page-meta 等组件
if (process.env.UNI_PLATFORM === 'mp-weixin') {
} else if (process.env.UNI_PLATFORM === 'mp-alipay') {
if (process.env.UNI_PLATFORM === 'mp-weixin') {} else if (process.env.UNI_PLATFORM === 'mp-alipay') {
initBuiltInEasycom(BUILT_IN_COMPONENTS_ALIPAY, usingAutoImportComponents)
} else {
initBuiltInEasycom(BUILT_IN_COMPONENTS, usingAutoImportComponents)
......
......@@ -3,9 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveUTSCompiler = exports.resolveUtsModule = exports.resolveUtsAppModule = void 0;
exports.initUTSComponents = exports.resolveUTSCompiler = exports.resolveUtsModule = exports.resolveUtsAppModule = void 0;
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
const fast_glob_1 = __importDefault(require("fast-glob"));
const hbx_1 = require("./hbx");
const utils_1 = require("./utils");
/**
......@@ -99,3 +100,65 @@ function resolveUTSCompiler() {
return require(compilerPath);
}
exports.resolveUTSCompiler = resolveUTSCompiler;
function initUTSComponents(inputDir, platform) {
const components = [];
if (platform !== 'app' && platform !== 'app-plus') {
return components;
}
const easycomsObj = Object.create(null);
const dirs = resolveUTSComponentDirs(inputDir);
dirs.forEach((dir) => {
const is_uni_modules_utssdk = dir.endsWith('utssdk');
const is_ussdk = !is_uni_modules_utssdk && path_1.default.dirname(dir).endsWith('utssdk');
if (is_uni_modules_utssdk || is_ussdk) {
fast_glob_1.default
.sync('**/*.vue', {
cwd: dir,
absolute: true,
})
.forEach((file) => {
let name = parseVueComponentName(file);
if (!name) {
if (file.endsWith('index.vue')) {
name = path_1.default.basename(is_uni_modules_utssdk ? path_1.default.dirname(dir) : dir);
}
}
if (name) {
const importDir = (0, utils_1.normalizePath)(is_uni_modules_utssdk ? path_1.default.dirname(dir) : dir);
easycomsObj[`^${name}$`] = `\0${importDir}?uts-proxy`;
}
});
}
});
Object.keys(easycomsObj).forEach((name) => {
components.push({
pattern: new RegExp(name),
replacement: easycomsObj[name],
});
});
return components;
}
exports.initUTSComponents = initUTSComponents;
function resolveUTSComponentDirs(inputDir) {
const utssdkDir = path_1.default.resolve(inputDir, 'utssdk');
const uniModulesDir = path_1.default.resolve(inputDir, 'uni_modules');
return fast_glob_1.default
.sync('*', {
cwd: utssdkDir,
absolute: true,
onlyDirectories: true,
})
.concat(fast_glob_1.default.sync('*/utssdk', {
cwd: uniModulesDir,
absolute: true,
onlyDirectories: true,
}));
}
const nameRE = /name\s*:\s*['|"](.*)['|"]/;
function parseVueComponentName(file) {
const content = fs_1.default.readFileSync(file, 'utf8');
const matches = content.match(nameRE);
if (matches) {
return matches[1];
}
}
......@@ -19,7 +19,8 @@
"author": "fxy060608",
"license": "Apache-2.0",
"dependencies": {
"escape-string-regexp": "^4.0.0",
"escape-string-regexp": "^4.0.0",
"fast-glob": "^3.2.11",
"glob-escape": "^0.0.2",
"hash-sum": "^1.0.2",
"postcss-urlrewrite": "^0.2.2",
......
......@@ -32,7 +32,8 @@ const pagesJson2AppJson = {
tabBar: function (name, value, json) {
json.tabBar = parseTabBar(value)
},
preloadRule: defaultCopy
preloadRule: defaultCopy,
entryPagePath: defaultCopy
}
function copyToJson (json, fromJson, options) {
......@@ -96,10 +97,6 @@ module.exports = function (pagesJson, manifestJson) {
if (fs.existsSync(projectPath)) {
project = require(projectPath)
} else {
if (platformJson.appid) {
project.appid = platformJson.appid
}
project.component2 = hasOwn(platformJson, 'component2') ? platformJson.component2 : true
project.enableAppxNg = hasOwn(platformJson, 'enableAppxNg') ? platformJson.enableAppxNg : true
}
......@@ -111,4 +108,4 @@ module.exports = function (pagesJson, manifestJson) {
name: 'mini.project',
content: project
}]
}
}
......@@ -95,7 +95,8 @@ const pagesJson2AppJson = {
},
preloadRule: defaultCopy,
workers: defaultCopy,
plugins: defaultCopy
plugins: defaultCopy,
entryPagePath: defaultCopy
}
const manifestJson2AppJson = {
......
......@@ -405,8 +405,8 @@ export default {
}
.button-hover[type="primary"][plain] {
color: rgba(26, 173, 25, 0.6);
border-color: rgba(26, 173, 25, 0.6);
color: rgba(0, 122, 255, 0.6);
border-color: rgba(0, 122, 255, 0.6);
background-color: transparent;
}
......
......@@ -237,10 +237,14 @@ export default {
// 数字类型输入错误时无法获取具体的值,自定义校验和纠正。
this.__clearCachedValue && $event.target.removeEventListener('blur', this.__clearCachedValue)
if ($event.target.validity && !$event.target.validity.valid) {
if ((!this.cachedValue && $event.data === '-') || (this.cachedValue[0] === '-' && $event.inputType === 'deleteContentBackward')) {
if (
((!this.cachedValue || !$event.target.value) && $event.data === '-') ||
(this.cachedValue[0] === '-' && $event.inputType === 'deleteContentBackward')
) {
this.cachedValue = '-'
this.valueSync = ''
const clearCachedValue = this.__clearCachedValue = () => {
this.cachedValue = ''
this.cachedValue = $event.target.value = ''
}
$event.target.addEventListener('blur', clearCachedValue)
return
......
......@@ -9,7 +9,7 @@
>
<div
class="map-move"
@click="moveToLocation"
@click="setCenter(location)"
>
<i>&#xec32;</i>
</div>
......@@ -99,6 +99,15 @@ export default {
}
}
},
mounted () {
uni.getLocation({
type: 'gcj02',
success: ({ latitude, longitude }) => {
this.location.latitude = latitude
this.location.longitude = longitude
}
})
},
methods: {
onRegionChange (event) {
const centerLocation = event.detail.centerLocation
......@@ -111,23 +120,6 @@ export default {
this.center.latitude = latitude
this.center.longitude = longitude
},
moveToLocation () {
uni.getLocation({
type: 'gcj02',
success: this.move.bind(this),
fail: () => {
// move({
// latitude: 0,
// longitude: 0
// })
}
})
},
move ({ latitude, longitude }) {
this.location.latitude = latitude
this.location.longitude = longitude
this.setCenter({ latitude, longitude })
},
back () {
getApp().$router.back()
},
......
......@@ -6,6 +6,7 @@ import {
getMapInfo,
translateGeo
} from '../../../helpers/location'
import { loadMaps } from '../../../view/components/map/maps'
/**
* 获取定位信息
......@@ -68,6 +69,27 @@ export function getLocation ({
reject(new Error('network error'))
}
})
} else if (mapInfo.type === MapType.AMAP) {
loadMaps([], () => {
window.AMap.plugin('AMap.Geolocation', () => {
const geolocation = new window.AMap.Geolocation({
enableHighAccuracy: true,
timeout: 10000
})
geolocation.getCurrentPosition((status, data) => {
if (status === 'complete') {
resolve({
latitude: data.position.lat,
longitude: data.position.lng,
accuracy: data.accuracy
})
} else {
reject(new Error(data.message))
}
})
})
})
} else {
reject(new Error('network error'))
}
......
......@@ -171,7 +171,7 @@ function getYearStartEnd (props) {
}
}
if (props.end) {
const _year = new Date(props.start).getFullYear()
const _year = new Date(props.end).getFullYear()
if (!isNaN(_year) && _year > end) {
end = _year
}
......
......@@ -51,10 +51,14 @@
class="uni-video-control-button"
@click.stop="trigger"
/>
<div class="uni-video-current-time">
<div
v-show="showProgress"
class="uni-video-current-time"
>
{{ currentTime|time }}
</div>
<div
v-show="showProgress"
ref="progress"
class="uni-video-progress-container"
@click.stop="clickProgress($event)"
......@@ -73,7 +77,10 @@
</div>
</div>
</div>
<div class="uni-video-duration">
<div
v-show="showProgress"
class="uni-video-duration"
>
{{ (duration||durationTime)|time }}
</div>
</div>
......
......@@ -484,6 +484,16 @@ const protocols = { // 需要做转换的 API 列表
}
}
// 钉钉小程序处理
if (!my.canIUse('saveImageToPhotosAlbum')) {
protocols.saveImageToPhotosAlbum = {
name: 'saveImage',
args: {
filePath: 'url'
}
}
}
export {
protocols,
todos,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册