diff --git a/pages/API/get-location/get-location.test.js b/pages/API/get-location/get-location.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..73bf95abf3b46dd8eb2e399cc3186de00d9b987e
--- /dev/null
+++ b/pages/API/get-location/get-location.test.js
@@ -0,0 +1,170 @@
+const PAGE_PATH = "/pages/API/get-location/get-location";
+const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
+const isAndroid = platformInfo.startsWith('android')
+const isIos = platformInfo.startsWith('ios')
+const isApp = isAndroid || isIos
+const isWeb = platformInfo.startsWith('web')
+
+describe("get-location", () => {
+ beforeAll(async () => {
+ page = await program.reLaunch(PAGE_PATH)
+ await page.waitFor(600)
+ });
+
+ //system 定位
+ it("system+type=wgs84+success", async () => {
+
+ await page.setData({
+ jest_provider: 'system',
+ jest_type: 'wgs84',
+ jest_isAltitude: true,
+ jest_isGeocode: false,
+ jest_isHighAccuracy: false
+ })
+ await page.callMethod('jestGetLocation')
+ await page.waitFor(async () => {
+ return await page.data('jest_complete') === true;
+ });
+
+ const data = await page.data()
+ const jest_errCode = data['jest_errCode']
+
+ if (jest_errCode > 0) {
+ expect((await page.data())['jest_errCode']).toEqual(expect.any(Number));
+ } else {
+ //判断经纬度是否在正常范围
+ expect((await page.data())['jest_longitude']).toBeGreaterThanOrEqual(-180);
+ expect((await page.data())['jest_longitude']).toBeLessThanOrEqual(180);
+ expect((await page.data())['jest_latitude']).toBeGreaterThanOrEqual(-90);
+ expect((await page.data())['jest_latitude']).toBeLessThanOrEqual(90);
+ //判断海拔是否正确
+ expect((await page.data())['jest_altitude']).toEqual(expect.any(Number));
+ expect((await page.data())['jest_altitude']).not.toEqual('0');
+ }
+ });
+
+ //system 定位
+ it("system+type=wgs84+success+geocode=true", async () => {
+
+ await page.setData({
+ jest_provider: 'system',
+ jest_type: 'wgs84',
+ jest_isAltitude: true,
+ jest_isGeocode: true,
+ jest_isHighAccuracy: false
+ })
+ await page.callMethod('jestGetLocation')
+ await page.waitFor(async () => {
+ return await page.data('jest_complete') === true;
+ });
+
+ const data = await page.data()
+ const jest_errCode = data['jest_errCode']
+
+ if (jest_errCode > 0) {
+ if (isIos) {
+ expect((await page.data())['jest_errCode']).toEqual(1505603);
+ } else if (isAndroid) {
+ expect((await page.data())['jest_errCode']).toEqual(1505700);
+ } else {
+ expect((await page.data())['jest_errCode']).toEqual(expect.any(Number));
+ }
+ }
+ });
+
+ //system 定位
+ it("system+type=wgs84+success+altitude=false", async () => {
+
+ await page.setData({
+ jest_provider: 'system',
+ jest_type: 'wgs84',
+ jest_isAltitude: false,
+ jest_isGeocode: true,
+ jest_isHighAccuracy: false
+ })
+ await page.callMethod('jestGetLocation')
+ await page.waitFor(async () => {
+ return await page.data('jest_complete') === true;
+ });
+
+ const data = await page.data()
+ const jest_errCode = data['jest_errCode']
+
+ if (jest_errCode > 0) {
+ //如果定位出错
+ expect((await page.data())['jest_errCode']).toEqual(expect.any(Number));
+ } else {
+ expect((await page.data())['jest_altitude']).toEqual('0');
+ }
+ });
+
+ //system 定位
+ it("system+type=gcj02+fail", async () => {
+ await page.setData({
+ jest_provider: 'system',
+ jest_type: 'gcj02',
+ jest_isAltitude: true,
+ jest_isGeocode: true,
+ jest_isHighAccuracy: false
+ })
+ await page.callMethod('jestGetLocation')
+ await page.waitFor(async () => {
+ return await page.data('jest_complete') === true;
+ });
+
+ expect((await page.data())['jest_errCode']).toEqual(1505601);
+ });
+
+
+ //tencent 定位
+ it("tencent+type=gcj02+success", async () => {
+ await page.setData({
+ jest_provider: 'tencent',
+ jest_type: 'gcj02',
+ jest_isAltitude: true,
+ jest_isGeocode: true,
+ jest_isHighAccuracy: true
+ })
+ await page.callMethod('jestGetLocation')
+ await page.waitFor(async () => {
+ return await page.data('jest_complete') === true;
+ });
+
+ const data = await page.data()
+ const jest_errCode = data['jest_errCode']
+
+ if (jest_errCode > 0) {
+ //如果定位出错
+ expect((await page.data())['jest_errCode']).toEqual(expect.any(Number));
+ } else {
+ //判断逆地理编码是否正确
+ expect((await page.data())['jest_address']).toEqual(expect.any(String));
+ //判断经纬度是否在正常范围
+ expect((await page.data())['jest_longitude']).toBeGreaterThanOrEqual(-180);
+ expect((await page.data())['jest_longitude']).toBeLessThanOrEqual(180);
+ expect((await page.data())['jest_latitude']).toBeGreaterThanOrEqual(-90);
+ expect((await page.data())['jest_latitude']).toBeLessThanOrEqual(90);
+ //判断海拔是否正确
+ expect((await page.data())['jest_altitude']).toEqual(expect.any(Number));
+ expect((await page.data())['jest_altitude']).not.toEqual('0');
+ }
+ });
+
+ //tencent 定位
+ it("tencent+type=wgs84+fail", async () => {
+ await page.setData({
+ jest_provider: 'tencent',
+ jest_type: 'wgs84',
+ jest_isAltitude: true,
+ jest_isGeocode: true,
+ jest_isHighAccuracy: true
+ })
+ await page.callMethod('jestGetLocation')
+ await page.waitFor(async () => {
+ return await page.data('jest_complete') === true;
+ });
+ if (isApp) {
+ expect((await page.data())['jest_errCode']).toEqual(1505607);
+ }
+ });
+});
diff --git a/pages/API/get-location/get-location.uvue b/pages/API/get-location/get-location.uvue
index 01056972e443ebdc62a6b85fbaccc699b02da0b2..e1891a241777aa26cc471196b6eeec50dcb3abc7 100644
--- a/pages/API/get-location/get-location.uvue
+++ b/pages/API/get-location/get-location.uvue
@@ -1,200 +1,231 @@
-
-
-
-
-
-
-
- 定位功能默认调用操作系统定位API实现, 也支持腾讯定位。\n
- 部分手机因gms兼容不好可能导致无法使用系统定位, gcj国标、逆地理信息等功能需调用内置腾讯定位。
-
-
-
-
- 定位服务商provider(如系统定位,腾讯定位等)
-
-
-
- {{ item.name }}
-
-
-
-
- 定位类型
-
-
-
- {{ item.name }}
-
-
-
-
- 高度信息
-
-
-
- 开启高精度定位
-
-
-
- 是否解析地址信息
-
-
- {{ exeRet }}
-
-
-
-
-
-
-
-
-