| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <script>
- export default {
- onLaunch: function(options) {
- // console.log('App Launch')
- this.accredit(options)
- },
- onShow: function() {
- console.log('App Show')
- },
- onHide: function() {
- console.log('App Hide')
- },
- methods: {
- accredit(options) {
- // console.log('\'' + this.$utils.getEncryptedData('token') + '\'')
- // console.log('\'' + this.$utils.getEncryptedData('cardNumber') + '\'')
- // console.log('\'' + this.$utils.getEncryptedData('errorMsg') + '\'')
- var cardNumber = options.query.card_number;
- if (!this.$utils.isEmpty(cardNumber)) {
- this.$utils.storeEncryptedData('cardNumber', cardNumber);
- } else {
- cardNumber = this.$utils.getEncryptedData('cardNumber');
- if (this.$utils.isEmpty(cardNumber)) {
- uni.showToast({
- title: '未获得用户信息',
- duration: 3000
- })
- }
- }
- var token = this.$utils.getEncryptedData('token');
- var errorMsg = this.$utils.getEncryptedData('errorMsg');
- if (this.$utils.isEmpty(cardNumber) && this.$utils.isEmpty(token) && this.$utils.isEmpty(errorMsg)) {
- var url = 'https://chtech.ncjti.edu.cn/hotelReservation/zhotel/appopenid.action';
- var encodedUrl = encodeURIComponent(url);
- window.location.href = 'https://open.wecard.qq.com/connect/oauth/authorize' +
- '?app_key=9FFFACD6D09F15D2' +
- '&response_type=code' +
- '&scope=snsapi_userinfo' +
- '&ocode=1015730314' +
- '&redirect_uri=' + encodedUrl +
- '&state=' + url;
- } else if (this.$utils.isEmpty(cardNumber) && this.$utils.isEmpty(token) && this.$utils.containsString(errorMsg, '失败')) {
- uni.navigateTo({
- url: '/pages/p404/p404'
- })
- }
- }
- }
- }
- </script>
- <style lang="scss">
- /*每个页面公共css */
- @import '@/uni_modules/uni-scss/index.scss';
- /* #ifndef APP-NVUE */
- @import '@/static/customicons.css';
- // 设置整个项目的背景色
- page {
- background-color: #f5f5f5;
- }
- /* #endif */
- .example-info {
- font-size: 14px;
- color: #333;
- padding: 10px;
- }
- </style>
|