This commit is contained in:
2025-09-14 00:21:54 +08:00
commit d40b3bbd62
766 changed files with 36275 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
._dflex button {
margin: 10px 0;
}
._dflex > view {
margin: 6px 0;
}

View File

@@ -0,0 +1,30 @@
const __templateJs = require("./templates.js");
const __mergePageOptions = require("../../util/mergePageOptions.js");
Page(__mergePageOptions({
onShareAppMessage() {
return {
title: '获取手机系统信息',
path: '/api-case/get-system-info/get-system-info'
};
},
data: {
systemInfo: {}
},
getSystemInfo() {
xhs.getSystemInfo({
success: res => {
this.setData({
systemInfo: res
});
},
fail: res => {},
complete: res => {}
});
},
getSystemInfoSync() {
const data = xhs.getSystemInfoSync();
this.setData({
systemInfo: data
});
}
}, __templateJs));

View File

@@ -0,0 +1,8 @@
{
"navigationBarTitleText": "获取手机系统信息",
"usingComponents": {
"showbox": "../../common/component/showbox/index",
"box": "../../common/component/container/index",
"api-status": "../../common/component/api-status/index"
}
}

View File

@@ -0,0 +1,18 @@
<view class="container">
<showbox title="获取手机信息">
<box>
<view class="_ui-space">
<view>手机品牌:{{systemInfo.brand}}</view>
<view>手机型号:{{systemInfo.model}}</view>
<view>小红书语言:{{systemInfo.language}}</view>
<view>小红书版本:{{systemInfo.version}}</view>
<view>屏幕宽度:{{systemInfo.windowWidth}}</view>
<view>屏幕高度:{{systemInfo.windowHeight}}</view>
<view>DPR{{systemInfo.pixelRatio}}</view>
<button class="_ui-button" hover-class="_ui-button-hover" bindtap="getSystemInfo">获取手机系统信息</button>
<button class="_ui-button" hover-class="_ui-button-hover" bindtap="getSystemInfoSync">同步获取手机系统信息</button>
</view>
</box>
</showbox>
</view>
<include src="templates.xhsml" />

View File

@@ -0,0 +1,44 @@
/** 以下内容为自动生成,请勿手动修改 */
module.exports = {
data: {
page_data_0: false,
page_data_1: false,
page_data_2: false,
page_data_3: "",
},
page_fun_0() {
this.setData({
page_data_0: false,
page_data_1: false,
page_data_2: false,
});
xhs.getSystemInfo({
success: (res) => {
console.log("success", res);
this.setData({
page_data_0: true,
page_data_3: JSON.stringify(res),
});
},
fail: (res) => {
console.log("fail", res);
this.setData({
page_data_1: true,
page_data_3: JSON.stringify(res),
});
},
complete: (res) => {
console.log("complete", res);
this.setData({
page_data_2: true,
});
},
});
},
};

View File

@@ -0,0 +1,24 @@
<!-- 以下内容为自动生成,请勿手动修改 -->
<view class="container">
<showbox title="getSystemInfo演示">
<box>
<api-status
success="{{page_data_0}}"
complete="{{page_data_2}}"
fail="{{page_data_1}}"
text="{{page_data_3}}"
>
</api-status>
<view class="_ui-space _mt8">
<button
class="_ui-button"
hover-class="_ui-button-hover"
bindtap="page_fun_0"
>
触发
</button>
</view>
</box>
</showbox>
</view>