接口联调
This commit is contained in:
@@ -4,6 +4,14 @@
|
||||
<view class="version">Version {{ appVersion }}</view>
|
||||
<!-- <view class="bottom-bg"></view> -->
|
||||
|
||||
<!-- 测试用 -->
|
||||
<!-- #ifdef APP-PLUS -->
|
||||
<button @click="saveValue">保存数据</button>
|
||||
<button @click="getValue">加载数据</button>
|
||||
<view>{{content}}--{{ app_device_id }}</view>
|
||||
<!-- #endif -->
|
||||
|
||||
|
||||
<!-- 检查版本弹窗 -->
|
||||
<view class="version-con" v-if="versionVisible">
|
||||
<view class="v-bg">
|
||||
@@ -27,6 +35,13 @@ import { formatIOS } from '@/utils/status.js'
|
||||
import { useUserStore } from '@/stores/user';
|
||||
const userStore = useUserStore();
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
// 获取 存储手机的module
|
||||
let safeSave = uni.requireNativePlugin("Tm-TmSafeSaveFileModule");
|
||||
let app_device_id = ref("7f47cfb4-59e2-4cb9-ac46-9da5e23c4de2");
|
||||
let content = ref('')
|
||||
// #endif
|
||||
|
||||
let appVersion = ref("1.0.0");//当前版本号
|
||||
let newVersion = ref('1.0.0');//最新版本号
|
||||
let versionVisible=ref(false);//版本弹窗
|
||||
@@ -67,6 +82,57 @@ onLoad(async(opt) => {
|
||||
|
||||
});
|
||||
|
||||
// 保存设备ID
|
||||
const saveValue = ()=>{
|
||||
console.log("saveValue",safeSave)
|
||||
safeSave.saveSafeFile({
|
||||
"key": "app_device_id",
|
||||
"value": app_device_id.value
|
||||
}, (res) => {
|
||||
console.log(res);
|
||||
if (res.code == 1) {
|
||||
uni.showModal({
|
||||
title: "保存成功",
|
||||
content:res.msg,
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
content.value("成功=>")
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
uni.showModal({
|
||||
title: "保存失败",
|
||||
content:res.msg,
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
// 读取设备ID
|
||||
const getValue =()=>{
|
||||
console.log(safeSave)
|
||||
safeSave.getSafeFile({
|
||||
"key": "app_device_id"
|
||||
}, (res) => {
|
||||
console.log(res);
|
||||
if (res.code == 1) {
|
||||
app_device_id.value = res.data;
|
||||
content.value = "aaaa==>"
|
||||
uni.showModal({
|
||||
title: "读取成功",
|
||||
content:res.data,
|
||||
})
|
||||
} else {
|
||||
uni.showModal({
|
||||
title: "读取失败",
|
||||
content: res.msg,
|
||||
})
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
// 检查版本是否是最新的
|
||||
let getOSVesion = async()=>{
|
||||
let systemInfo = uni.getSystemInfoSync();
|
||||
|
||||
Reference in New Issue
Block a user