diff --git a/pages/API/choose-location/choose-location.test.js b/pages/API/choose-location/choose-location.test.js index b4ad2ff05da0b0dc8bfc60be8413a49649510900..7277edf89893c9f39dca2d670b9b3d173eb21a24 100644 --- a/pages/API/choose-location/choose-location.test.js +++ b/pages/API/choose-location/choose-location.test.js @@ -1,5 +1,6 @@ const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase() const isMP = platformInfo.startsWith('mp') +const isIos = platformInfo.startsWith('ios') describe('dialog page', () => { if (process.env.UNI_AUTOMATOR_APP_WEBVIEW == 'true') { @@ -36,6 +37,16 @@ describe('dialog page', () => { const lifecycleNum = await page.callMethod('getLifeCycleNum') expect(lifecycleNum).toBe(originLifeCycleNum - 1) }) + if (isIos) { + it('call chooseLocation in uts plugin', async () => { + page = await program.reLaunch('/pages/API/choose-location/choose-location') + await page.waitFor('view'); + await page.callMethod('chooseLocationByPlugin') + await page.waitFor(1000) + const lifecycleNum = await page.callMethod('getLifeCycleNum') + expect(lifecycleNum).toBe(originLifeCycleNum - 1) + }) + } afterAll(async () => { await page.callMethod('setLifeCycleNum', originLifeCycleNum) diff --git a/pages/API/choose-location/choose-location.uvue b/pages/API/choose-location/choose-location.uvue index e1e897ead6484fd92697257f01807e86d77011ae..40dc1afb34f48ab83068fa32a520cfcb47f1e899 100644 --- a/pages/API/choose-location/choose-location.uvue +++ b/pages/API/choose-location/choose-location.uvue @@ -21,6 +21,9 @@ + + + @@ -117,6 +120,11 @@ changePayloadBoolean(checked : boolean) { this.hoverPayload = checked }, + // #ifdef APP-IOS + chooseLocationByPlugin(){ + uni.chooseLocationPlugin() + }, + // #endif // 自动化测试 test() { const pages = getCurrentPages() diff --git a/uni_modules/uni-chooseLocation-plugin/changelog.md b/uni_modules/uni-chooseLocation-plugin/changelog.md new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/uni_modules/uni-chooseLocation-plugin/package.json b/uni_modules/uni-chooseLocation-plugin/package.json new file mode 100644 index 0000000000000000000000000000000000000000..9234ed9aafb8efe70a552a657b51ad087d6bf3d2 --- /dev/null +++ b/uni_modules/uni-chooseLocation-plugin/package.json @@ -0,0 +1,96 @@ +{ + "id": "uni-chooseLocation-plugin", + "displayName": "uni-chooseLocation-plugin", + "version": "1.0.0", + "description": "uni-chooseLocation-plugin", + "keywords": [ + "uni-chooseLocation-plugin" + ], + "repository": "", + "engines": { + "HBuilderX": "^3.6.8" + }, + "dcloudext": { + "type": "uts", + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "", + "data": "", + "permissions": "" + }, + "npmurl": "" + }, + "uni_modules": { + "dependencies": [ + "uni-chooseLocation" + ], + "uni-ext-api": { + "uni": { + "chooseLocationPlugin": { + "name": "chooseLocationPlugin", + "app": { + "js": false, + "kotlin": false, + "swift": true, + "arkts": false + } + } + } + }, + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "u", + "aliyun": "u" + }, + "client": { + "Vue": { + "vue2": "u", + "vue3": "u" + }, + "App": { + "app-android": "u", + "app-ios": "u" + }, + "H5-mobile": { + "Safari": "u", + "Android Browser": "u", + "微信浏览器(Android)": "u", + "QQ浏览器(Android)": "u" + }, + "H5-pc": { + "Chrome": "u", + "IE": "u", + "Edge": "u", + "Firefox": "u", + "Safari": "u" + }, + "小程序": { + "微信": "u", + "阿里": "u", + "百度": "u", + "字节跳动": "u", + "QQ": "u", + "钉钉": "u", + "快手": "u", + "飞书": "u", + "京东": "u" + }, + "快应用": { + "华为": "u", + "联盟": "u" + } + } + } + } +} diff --git a/uni_modules/uni-chooseLocation-plugin/readme.md b/uni_modules/uni-chooseLocation-plugin/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..e6a2932f631ef65915d10dcc8331e9f9a630d649 --- /dev/null +++ b/uni_modules/uni-chooseLocation-plugin/readme.md @@ -0,0 +1,6 @@ +# uni-actionSheet +### 开发文档 +[UTS 语法](https://uniapp.dcloud.net.cn/tutorial/syntax-uts.html) +[UTS API插件](https://uniapp.dcloud.net.cn/plugin/uts-plugin.html) +[UTS 组件插件](https://uniapp.dcloud.net.cn/plugin/uts-component.html) +[Hello UTS](https://gitcode.net/dcloud/hello-uts) \ No newline at end of file diff --git a/uni_modules/uni-chooseLocation-plugin/utssdk/app-ios/index.uts b/uni_modules/uni-chooseLocation-plugin/utssdk/app-ios/index.uts new file mode 100644 index 0000000000000000000000000000000000000000..f2ad755fb8505f43645f71fcd52349c1573dbd45 --- /dev/null +++ b/uni_modules/uni-chooseLocation-plugin/utssdk/app-ios/index.uts @@ -0,0 +1,16 @@ +export const chooseLocationPlugin = () => { + uni.chooseLocation({ + latitude: 39.951372, + longitude: 116.39747, + keyword: '公园', + success(res){ + console.log('chooseLocation in plugin complete success', res); + }, + fail(err){ + console.log('chooseLocation in plugin complete fail', err); + }, + complete(res){ + console.log('chooseLocation in plugin complete res', res); + } + }) +};