提交 ce6c6e9e 编写于 作者: taohebin@dcloud.io's avatar taohebin@dcloud.io

fix: 修改ext-api的测试页面

上级 23f789b1
......@@ -2,61 +2,13 @@
<view>
<page-head :title="title"></page-head>
<view class="uni-common-mt">
<view class="uni-list">
<view class="uni-list-cell">
<view class="uni-pd">
<view class="uni-label" style="width:180px;">AppId</view>
</view>
<view class="uni-list-cell-db">
<input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="appId"/>
</view>
</view>
<view class="uni-list-cell">
<view class="uni-list">
<view class="uni-list-cell" v-for="(item,_) in items" style="align-items: center;">
<view class="uni-pd">
<view class="uni-label" style="width:180px;">AppName</view>
<view class="uni-label" style="width:180px;">{{item.label}}</view>
</view>
<view class="uni-list-cell-db">
<input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="appName"/>
</view>
</view>
<view class="uni-list-cell">
<view class="uni-pd">
<view class="uni-label" style="width:180px;">App版本名</view>
</view>
<view class="uni-list-cell-db">
<input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="appVersion"/>
</view>
</view>
<view class="uni-list-cell">
<view class="uni-pd">
<view class="uni-label" style="width:180px;">App版本号VersionCode</view>
</view>
<view class="uni-list-cell-db">
<input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="appVersionCode"/>
</view>
</view>
<view class="uni-list-cell">
<view class="uni-pd">
<view class="uni-label" style="width:180px;">引擎版本号</view>
</view>
<view class="uni-list-cell-db">
<input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="version"/>
</view>
</view>
<view class="uni-list-cell">
<view class="uni-pd">
<view class="uni-label" style="width:180px;">应用设置的语言</view>
</view>
<view class="uni-list-cell-db">
<input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="appLanguage"/>
</view>
</view>
<view class="uni-list-cell">
<view class="uni-pd">
<view class="uni-label" style="width:180px;">是否uni-app x</view>
</view>
<view class="uni-list-cell-db">
<input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="isUniAppX"/>
<textarea :auto-height="true" :disabled="true" placeholder="未获取" :value="item.value" />
</view>
</view>
</view>
......@@ -69,17 +21,15 @@
</view>
</template>
<script>
type Item = {
label : string,
value : string,
}
export default {
data() {
return {
title: 'getAppBaseInfo',
appId:"",
appName:"",
appVersion:"",
appVersionCode:"",
appLanguage:"",
isUniAppX:"",
version:"",
items: [] as Item[],
}
},
onUnload:function(){
......@@ -87,13 +37,15 @@
methods: {
getAppBaseInfo: function () {
const res = uni.getAppBaseInfo();
this.appId = res.appId ?? "";
this.appName = res.appName ?? "";
this.appVersion = res.appVersion ?? "";
this.appVersionCode = res.appVersionCode ?? "";
this.appLanguage = res.appLanguage ?? "";
this.isUniAppX = res.isUniAppX ? "是": "否";
this.version = res.version ?? "";
const json = JSON.stringify(res);
const result = JSON.parse<Map<string, any>>(json);
result.forEach((value, key) => {
const item = {
label: key,
value: "" + value
} as Item;
this.items.push(item);
})
}
}
}
......
......@@ -3,68 +3,14 @@
<page-head :title="title"></page-head>
<view class="uni-common-mt">
<view class="uni-list">
<view class="uni-list-cell">
<view class="uni-pd">
<view class="uni-label" style="width:180px;">设备品牌</view>
</view>
<view class="uni-list-cell-db">
<input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="deviceBrand"/>
</view>
</view>
<view class="uni-list-cell">
<view class="uni-pd">
<view class="uni-label" style="width:180px;">设备 id </view>
</view>
<view class="uni-list-cell-db">
<input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="deviceId"/>
</view>
</view>
<view class="uni-list-cell">
<view class="uni-pd">
<view class="uni-label" style="width:180px;">设备型号</view>
</view>
<view class="uni-list-cell-db">
<input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="deviceModel"/>
</view>
</view>
<view class="uni-list-cell">
<view class="uni-pd">
<view class="uni-label" style="width:180px;">设备类型</view>
</view>
<view class="uni-list-cell-db">
<input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="deviceType"/>
</view>
</view>
<view class="uni-list-cell">
<view class="uni-pd">
<view class="uni-label" style="width:180px;">设备方向</view>
</view>
<view class="uni-list-cell-db">
<input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="deviceOrientation"/>
</view>
</view>
<view class="uni-list-cell">
<view class="uni-pd">
<view class="uni-label" style="width:180px;">设备像素比</view>
</view>
<view class="uni-list-cell-db">
<input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="devicePixelRatio"/>
</view>
</view>
<view class="uni-list-cell">
<view class="uni-pd">
<view class="uni-label" style="width:180px;">操作系统及版本</view>
</view>
<view class="uni-list-cell-db">
<input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="system"/>
</view>
</view>
<view class="uni-list-cell">
<view class="uni-pd">
<view class="uni-label" style="width:180px;">客户端平台</view>
</view>
<view class="uni-list-cell-db">
<input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="platform"/>
<view class="uni-list">
<view class="uni-list-cell" v-for="(item,_) in items" style="align-items: center;">
<view class="uni-pd">
<view class="uni-label" style="width:180px;">{{item.label}}</view>
</view>
<view class="uni-list-cell-db">
<textarea :auto-height="true" :disabled="true" placeholder="未获取" :value="item.value" />
</view>
</view>
</view>
</view>
......@@ -77,18 +23,15 @@
</view>
</template>
<script>
type Item = {
label : string,
value : string,
}
export default {
data() {
return {
title: 'getDeviceInfo',
deviceBrand:"",
deviceId:"",
deviceModel:"",
deviceType:"",
deviceOrientation:"",
devicePixelRatio:"",
system:"",
platform:""
items: [] as Item[],
}
},
onUnload:function(){
......@@ -96,14 +39,15 @@
methods: {
getDeviceInfo: function () {
const res = uni.getDeviceInfo();
this.deviceBrand = res.deviceBrand ?? "";
this.deviceId = res.deviceId ?? "";
this.deviceModel = res.deviceModel ?? "";
this.deviceType = res.deviceType ?? "";
this.deviceOrientation = res.deviceOrientation ?? "";
this.devicePixelRatio = res.devicePixelRatio + "";
this.system = res.system ?? "";
this.platform = res.platform ?? "";
const json = JSON.stringify(res);
const result = JSON.parse<Map<string, any>>(json);
result.forEach((value, key) => {
const item = {
label: key,
value: "" + value
} as Item;
this.items.push(item);
})
}
}
}
......
......@@ -3,100 +3,12 @@
<page-head :title="title"></page-head>
<view class="uni-common-mt">
<view class="uni-list">
<view class="uni-list-cell">
<view class="uni-list-cell" v-for="(item,_) in items" style="align-items: center;">
<view class="uni-pd">
<view class="uni-label" style="width:180px;">设备型号</view>
<view class="uni-label" style="width:180px;">{{item.label}}</view>
</view>
<view class="uni-list-cell-db">
<input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="model"/>
</view>
</view>
<view class="uni-list-cell">
<view class="uni-pd">
<view class="uni-label" style="width:180px;">客户端平台</view>
</view>
<view class="uni-list-cell-db">
<input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="platform"/>
</view>
</view>
<view class="uni-list-cell">
<view class="uni-pd">
<view class="uni-label" style="width:180px;">操作系统版本</view>
</view>
<view class="uni-list-cell-db">
<input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="system"/>
</view>
</view>
<view class="uni-list-cell">
<view class="uni-pd">
<view class="uni-label" style="width:180px;">语言</view>
</view>
<view class="uni-list-cell-db">
<input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="language"/>
</view>
</view>
<view class="uni-list-cell">
<view class="uni-pd">
<view class="uni-label" style="width:180px;">版本</view>
</view>
<view class="uni-list-cell-db">
<input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="version"/>
</view>
</view>
<view class="uni-list-cell">
<view class="uni-pd">
<view class="uni-label" style="width:180px;">屏幕宽度</view>
</view>
<view class="uni-list-cell-db">
<input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="screenWidth"/>
</view>
</view>
<view class="uni-list-cell">
<view class="uni-pd">
<view class="uni-label" style="width:180px;">屏幕高度</view>
</view>
<view class="uni-list-cell-db">
<input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="screenHeight"/>
</view>
</view>
<view class="uni-list-cell">
<view class="uni-pd">
<view class="uni-label" style="width:180px;">可使用窗口高度</view>
</view>
<view class="uni-list-cell-db">
<input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="windowHeight"/>
</view>
</view>
<view class="uni-list-cell">
<view class="uni-pd">
<view class="uni-label" style="width:180px;">可使用窗口的顶部位置</view>
</view>
<view class="uni-list-cell-db">
<input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="windowTop"/>
</view>
</view>
<view class="uni-list-cell">
<view class="uni-pd">
<view class="uni-label" style="width:180px;">可使用窗口的底部位置</view>
</view>
<view class="uni-list-cell-db">
<input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="windowBottom"/>
</view>
</view>
<view class="uni-list-cell">
<view class="uni-pd">
<view class="uni-label" style="width:180px;">状态栏的高度</view>
</view>
<view class="uni-list-cell-db">
<input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="statusBarHeight"/>
</view>
</view>
<view class="uni-list-cell">
<view class="uni-pd">
<view class="uni-label" style="width:180px;">DPI</view>
</view>
<view class="uni-list-cell-db">
<input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="pixelRatio"/>
<textarea :auto-height="true" :disabled="true" placeholder="未获取" :value="item.value" />
</view>
</view>
</view>
......@@ -108,52 +20,34 @@
</view>
</view>
</template>
<script>
<script>
type Item = {
label : string,
value : string,
}
export default {
data() {
return {
title: 'getSystemInfo',
model:"",
platform:"",
system:"",
language:"",
version:"",
screenWidth:"",
screenHeight:"",
windowHeight:"",
windowTop:"",
windowBottom:"",
statusBarHeight:"",
pixelRatio:"",
SDKVersion:""
items: [] as Item[],
}
},
onUnload:function(){
onUnload: function () {
},
methods: {
getSystemInfo: function () {
getSystemInfo: function () {
uni.getSystemInfo({
success: (res) => {
console.log('SystemInfo: ',res);
this.model = res.model;
this.platform = res.platform;
this.system = res.system;
this.language = res.language ?? "";
this.version = res.version;
this.screenWidth = res.screenWidth + "";
this.screenHeight = res.screenHeight + "";
this.windowHeight = res.windowHeight + "";
this.windowTop = res.windowTop + "";
this.windowBottom = res.windowBottom + "";
const statusBarHeight = res.statusBarHeight;
if (statusBarHeight == null){
this.statusBarHeight = "";
}else{
this.statusBarHeight = statusBarHeight + "";
}
this.pixelRatio = res.pixelRatio + "";
this.SDKVersion = res.SDKVersion;
}
const json = JSON.stringify(res);
const result = JSON.parse<Map<string, any>>(json);
result.forEach((value, key) => {
const item = {
label: key,
value: "" + value
} as Item;
this.items.push(item);
})
},
})
}
}
......@@ -164,4 +58,4 @@
.uni-pd {
padding-left: 30rpx;
}
</style>
</style>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册