607 Star 734 Fork 238

shopTNT开源商城系统 / shopTNT电商系统-移动端(小程序 app 公众号)

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
App.vue 2.43 KB
一键复制 编辑 原始数据 按行查看 历史
“tnt” 提交于 2023-06-20 09:11 . 初始化
<script>
import Vue from 'vue'
import Cache, { Keys } from '@/utils/cache.js'
import * as API_Common from '@/api/common.js'
export default {
// 此处globalData为了演示其作用,不是uView框架的一部分
globalData: {
username: '白居易'
},
async onLaunch() {
this.getSiteData()
// #ifdef APP-PLUS
//app启动时打开启动广告页
// var w = plus.webview.open(
// 'hybrid/html/advertise/advertise.html',
// '本地地址',
// { top: 0, bottom: 0, zindex: 999 },
// 'fade-in',
// 500
// );
// //设置定时器,4s后关闭启动广告页
// setTimeout(function() {
// plus.webview.close(w);
// }, 5000);
// #endif
// 如果是H5 通过复制直接打开需要登录的页面
// #ifdef H5
const pathname = window.location.pathname
//如果是以下目录,需要验证是否已经登录
if (pathname.indexOf('/mine-module') == 0 || pathname.indexOf('/pages/order') == 0) {
const cacheUser = uni.getStorageSync(Keys.user)
//如果没有登录则跳转到登录页面
if (!cacheUser) {
uni.redirectTo({
url: 'pages/auth/login?back_url=' + pathname
})
}
}
// #endif
//初始化唯一uuid
const uuid = uni.getStorageSync(Keys.uuid)
if (!uuid) {
const strUUID = this.$u.guid(20)
console.log('全局UUID = ' + strUUID)
uni.setStorageSync(Keys.uuid, strUUID)
}
//获取手机状态栏、导航栏高度 statusBar:状态栏高度 customBar:状态栏高度 + 导航栏高度
uni.getSystemInfo({
success(res) {
Vue.prototype.statusBar = res.statusBarHeight
// #ifdef MP
let custom = wx.getMenuButtonBoundingClientRect()
Vue.prototype.customBar = custom.bottom + custom.top - res.statusBarHeight
// #endif
}
})
},
methods: {
// 站点信息
getSiteData() {
API_Common.getSiteData().then(site => {
Cache.setItem(Keys.site, site)
})
},
}
}
</script>
<style lang="scss">
@import "uview-ui/index.scss";
@import "static/common/css/demo.scss";
@import "static/common/css/floor-mobile.scss";
@import "static/common/css/iconfont.css";
/*每个页面公共css */
[type="search"]::-webkit-search-decoration,
[type="search"]::-webkit-search-cancel-button,
[type="search"]::-webkit-search-results-button,
[type="search"]::-webkit-search-results-decoration {
display: none !important;
}
</style>
1
https://gitee.com/bbc-se/mobile-ui.git
git@gitee.com:bbc-se/mobile-ui.git
bbc-se
mobile-ui
shopTNT电商系统-移动端(小程序 app 公众号)
5.2.3

搜索帮助