2 Star 0 Fork 0

SpaceObj / spaceobj-mini-programe

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
App.vue 1.45 KB
一键复制 编辑 原始数据 按行查看 历史
SpaceObj 提交于 2023-03-08 12:28 . uni-app 第一次提交
<script>
import sk from '@/common/StoryKeys.js'
import api from '@/common/api.js'
import su from '@/utils/StringUtils.js'
export default {
onLaunch: function() {
console.log('App Launch')
},
onShow: function() {
console.log('App Show')
// 获取广告
api.post({
}, api.jdList).then(res => {
if (res.code == 200) {
uni.setStorage({
key: sk.shopList,
data: res.data
})
}
})
// 获取ip
api.get({}, api.GET_IP).then(res => {
var ip = su.getIp(res);
console.log(ip);
// 获取ip属地
api.get({
ip: ip
}, api.ipTerritory).then(res => {
console.log("ip属地", res);
if (!su.isBlank(res)&&res.code == 200) {
var ip_Territory = res.country + res.province + res.city + res.isp;
uni.setStorage({
key: sk.ipTerritory,
data: ip_Territory
})
} else {
uni.setStorage({
key: sk.ipTerritory,
data: "中国大陆"
})
uni.setStorage({
key:sk.ip,
data:"未知"
})
}
});
});
// 获取设备信息
const res = uni.getSystemInfoSync();
uni.setStorage({
key: sk.deviceModel,
data: res
})
},
onHide: function() {
console.log('App Hide')
},
}
</script>
<style>
/*每个页面公共css */
* {
font-family: "arial, helvetica, sans-serif", "宋体";
padding: 0;
margin: 0;
outline: none;
text-decoration: none;
list-style: none;
}
</style>
1
https://gitee.com/BMKJ-ZHR/spaceobj-frontend.git
git@gitee.com:BMKJ-ZHR/spaceobj-frontend.git
BMKJ-ZHR
spaceobj-frontend
spaceobj-mini-programe
main

搜索帮助