| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- <script>
- import md5 from '@/common/md5.js';
- export default {
- globalData: {
- shareUrl: 'https://xnh.xazhima.com/prod-api/wap/business/weixin/',
- globalTimestamp: Date.now().toString(),
- secret: 'AirQK_weichat_app_zhima',
- selectedIndex: 0,
- isSider: false,
- user_id: '',
- open_id: '',
- user_status: '',
- user_name: '',
- user_phone: '',
- user_headUrl: '',
- globalAuth: false,
- session_key: '',
- isAndroid: false,
- user_department: '',
- user_real_name: ''
- },
- onLaunch: function () {
- console.log('App Launch');
- // let equType = uni.getSystemInfoSync().platform;
- // switch(equType){
- // case 'android':
- // console.log('运行Android上')
- // setTimeout(()=>{
- // getApp().globalData.isAndroid = true
- // },100)
- // break;
- // case 'ios':
- // console.log('运行iOS上');
- // break;
- // default:
- // console.log('运行在开发者工具上')
- // break;
- // }
- this.loginLoad();
- },
- onShow: function () {
- console.log('App Show');
- // uni.hideTabBar({})
- },
- onHide: function () {
- console.log('App Hide');
- },
- methods: {
- loginLoad() {
- let that = this;
- uni.login({
- success(res) {
- that.loginRequest(res.code);
- }
- });
- },
- loginRequest(codeRes) {
- let that = this;
- let url = getApp().globalData.shareUrl + 'login/' + codeRes;
- uni.request({
- url: url,
- method: 'GET',
- header: {
- 'content-type': 'application/x-www-form-urlencoded'
- },
- success: (res) => {
- console.log(res);
- if (res.data.code === 200) {
- uni.setStorageSync('openid', res.data.data.openid);
- getApp().globalData.open_id = res.data.data.openid;
- getApp().globalData.session_key = res.data.data.session_key;
- that.$isResolve();
- // uni.hideLoading()
- }
- },
- fail: () => {
- console.log('连接失败');
- }
- });
- }
- }
- };
- </script>
- <style lang="scss">
- /*每个页面公共css */
- @import '@/common/uni.css';
- page {
- height: 100%;
- background: #f3f3f3;
- &:before {
- content: '';
- position: fixed;
- left: 0;
- right: 0;
- top: 0;
- z-index: 1;
- height: 1rpx;
- background: #e0e0e0;
- }
- }
- button::after {
- display: none;
- }
- .c-abnor {
- position: fixed;
- left: 50%;
- top: 50%;
- transform: translate(-50%, -50%);
- display: flex;
- flex-direction: column;
- white-space: nowrap;
- align-items: center;
- font-size: 27.47rpx;
- color: #999;
- .icon {
- width: 137.36rpx;
- height: 137.36rpx;
- margin-bottom: 41.21rpx;
- }
- }
- * {
- touch-action: none;
- }
- .display-flex-start {
- display: flex;
- align-items: center;
- }
- .display-flex-center {
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .display-flex-end {
- display: flex;
- justify-content: flex-end;
- align-items: center;
- }
- .display-between {
- display: flex;
- justify-content: space-between;
- }
- .display-around {
- display: flex;
- justify-content: space-around;
- }
- .display-between-column {
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- }
- .display-around-column {
- display: flex;
- flex-direction: column;
- justify-content: space-around;
- }
- .display-evenly-column {
- display: flex;
- flex-direction: column;
- justify-content: space-evenly;
- }
- .display-wrap {
- flex-wrap: wrap;
- }
- .items-center {
- align-items: center;
- }
- .margin-top-10 {
- margin-top: 10%;
- }
- .shareParent {
- width: 100%;
- height: 100%;
- position: fixed;
- }
- .margin-right-10 {
- margin-right: 10rpx;
- }
- .margin-top-1 {
- margin-top: 1%;
- }
- .margin-right-0 {
- margin-right: 0 !important;
- }
- .color-666 {
- color: #666666;
- }
- .color-999 {
- color: #999;
- }
- .width-55 {
- width: 55%;
- }
- </style>
|