123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255 |
- <script>
- import { User } from '@/config/api.js'
- export default {
- onLaunch: function() {
- !this.$db.get('access_token') && this.getOpenid();
- // #ifdef MP
- this.checkVersion();
- // #endif
- },
- onShow: function() {
- },
- onHide: function() {
- },
- globalData:{
- isLogin:false,
- isAuth:null,//是否需要授权 uniid
- isBind:null,// 是否需要绑定手机号/邮箱
- userInfo:null,//用户信息
- access_token:'',
- loadOver:'',
- bgAudioManager:uni.getBackgroundAudioManager()
- },
- methods:{
- /* 微信code换临时token */
- getOpenid() {
- uni.login({
- success: result=> {
- User.wechatLog({
- Code:result.code
- }).then(res => {
- try {
- let token = res.Data.Authorization;
- this.$db.set('access_token',token)
- // this.$isResolve()
- }catch (e){
-
- }
- })
- }
- });
- },
- checkVersion() {
- const updateManager = uni.getUpdateManager();
- updateManager.onCheckForUpdate(function (res) {
- // 请求完新版本信息的回调
- // console.log(res.hasUpdate);
- });
- updateManager.onUpdateReady(function (res) {
- uni.showModal({
- title: '更新提示',
- content: '新版本已经准备好,是否重启应用?',
- success(res) {
- if (res.confirm) {
- // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
- updateManager.applyUpdate();
- }
- }
- });
-
- });
- updateManager.onUpdateFailed(function (res) {
- // 新的版本下载失败
- });
- }
- }
- }
- </script>
- <style lang="scss">
- @import "uview-ui/index.scss";
- /*每个页面公共css */
- * {
- margin: 0;padding: 0;
- box-sizing: border-box;
- }
- ::-webkit-scrollbar {
- display:none;
- width:0;
- height:0;
- color:transparent;
- }
- view,text {
- box-sizing: border-box;
- }
- input {
- box-sizing: border-box;
- }
- button {
- margin: 0;padding: 0;
- }
- button::after {
- border:none;
- }
- .container {
- width: 100%;
- min-height: 100vh;
- font-size: 28rpx;
- }
- text {
- display: block;
- }
- button {
- text-align: center;
- border-radius: 8rpx;
- }
- /* border 1px样式 */
- .border_bottom, .border_top, .border_all {
- position: relative;
- }
-
- .border_top::after {
- position: absolute;
- content: '';
- width: 100%;
- left: 0;
- top: 0;
- height: 1px;
- padding: 0 32rpx;
- box-sizing: border-box;
- background-color: #E5E5E5;
- -webkit-transform: scale(1, 0.5);
- transform: scale(1, 0.5);
- -webkit-transform-origin: center bottom;
- transform-origin: center bottom;
- }
-
- .border_bottom::after {
- position: absolute;
- content: '';
- width: 100%;
- left: 0;
- bottom: 0;
- height: 1px;
- padding: 0 32rpx;
- box-sizing: border-box;
- background-color: #E5E5E5;
- -webkit-transform: scale(1, 0.5);
- transform: scale(1, 0.5);
- -webkit-transform-origin: center bottom;
- transform-origin: center bottom;
- }
-
- .border_all::before {
- content: '';
- display: block;
- position: absolute;
- width: 200%;
- height: 200%;
- border: 1px solid #d9d9d9;
- border-radius: 10rpx;
- transform-origin: 0 0;
- transform: scale(0.5, 0.5);
- -webkit-transform: scale(0.5, 0.5);
- box-sizing: border-box;
- }
- //全屏蒙版
- .mask-diaog {
- position: fixed;
- left: 0;
- top: 0;
- bottom: 0;
- right: 0;
- overflow: hidden;
- background-color: rgba(0, 0, 0, 0.5);
- z-index: 1000;
- color: #fff;
- }
- // 底部确认按钮
- .bot-btn-cont {
- width: 100%;
- position: fixed;
- left:0;
- bottom: 122rpx;
- z-index: 9;
- .bot-btn {
- margin: 0 auto;
- width: 694rpx;
- height: 88rpx;
- line-height: 88rpx;
- text-align:center;
- font-size: 36rpx;
- color: #fff;
- background-color: #3385FF;
- }
- }
- // 无数据
- .nodata {
- text-align: center;
- display: block;
- color: #D8D8D8;
- padding: 200rpx 0;
- margin: 0 auto;
- .nodata_ico {
- width: 150rpx;
- height: 162rpx;
- margin-bottom: 50rpx;
- }
- }
- .nodata2 {
- margin-top: 300rpx;
- }
- // 单行省略
- .text_oneLine {
- overflow: hidden;
- text-overflow:ellipsis;
- white-space: nowrap;
- }
- /* 2行省略 */
- .text_twoLine {
- text-overflow: -o-ellipsis-lastline;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- line-clamp: 2;
- -webkit-box-orient: vertical;
- }
- /* 按钮空心样式 */
- .plain-style {
- background-color: #F2F2F2 !important;
- color: #07C160 !important;
- }
-
- .select-box{
- width: 100%;
- .box {
- height: 95prx;
- line-height: 95rpx;
- text-align: center;
- font-size: 32rpx;
- border-bottom: 1rpx solid #EBEBEB;
- }
-
- .box-bottom {
- border-bottom: none !important;
- }
- }
- .slot-content {
- width: 100%;
- padding: 50rpx;
- text-align: center;
- font-size: 32rpx;
- color: #0F1826;
- line-height: 48rpx;
-
- }
- .forbid-copy {
- -webkit-user-select: none;
- -khtml-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- user-select: none;
- }
-
- </style>
|