123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- <script>
- export default {
- //全局变量
- globalData: {
- baseUrl: 'https://qingyujiankang.baomihua222.top/api',
- imageUrl: 'https://qingyujiankang.baomihua222.top/storage/',
- is_auth: '',
- b_minute_money: '',
- ab_minute_money: '',
- a_minute_money: '',
- modelList: []
- },
- onLaunch: function() {
- let that = this
- setTimeout(function() {
- uni.request({
- url: that.globalData.baseUrl + '/common/maps',
- method: 'GET',
- header: {
- 'content-type': 'application/json',
- 'Accept': 'application/json',
- },
- success(res) {
- console.log(res.data.data.PayStatusEnum, '所有状态')
- console.log(res.data, '所有状态')
- }
- })
- }, 500)
- console.log('App Launch')
- this.tokens()
- },
- onShow: function() {
- console.log('App Show')
- },
- onHide: function() {
- console.log('App Hide')
- },
- methods: {
- tokens: function() {
- let that = this
- uni.login({
- success(res) {
- console.log(res, '888888888')
- if (res.code) {
- uni.request({
- url: that.globalData.baseUrl + '/auth/weapp-login',
- method: 'POST',
- header: {
- 'content-type': 'application/x-www-form-urlencoded',
- },
- data: {
- code: res.code,
- },
- success(res) {
- console.log(res, '-----------')
- console.log(res, '-----------')
- uni.setStorageSync('token', res.data.data.token),
- uni.setStorageSync('session_key', res.data.data.session_key)
- // uni.setStorageSync('is_auth', res.data.data.is_auth)
- that.globalData.is_auth = res.data.data.is_auth
- }
- })
- }
- }
- })
- },
- request(api, params, method) {
- var that = this;
- return new Promise((resolve, reject) => {
- uni.request({
- url: that.globalData.baseUrl + api,
- data: params,
- header: {
- 'Accept': 'application/json',
- 'content-type': 'application/json',
- 'Authorization': uni.getStorageSync('token'),
- },
- method: method,
- success: (res) => {
- resolve(res)
- // console.log(res)
- if (res.statusCode == 450) {
- return;
- }
- if (res.statusCode != 200) {
- if (res.statusCode == 401) {
- uni.removeStorageSync('token')
- this.tokens();
- uni.showToast({
- title: '登录过期,重试',
- icon: 'none',
- mask: true,
- success: function() {
- uni.switchTab({
- url: "pages/order/order"
- })
- }
- })
- } else {
- if (res.message != undefined) {
- uni.showModal({
- showCancel: false,
- title: '提示',
- content: res.message
- })
- } else if (res.data.message != undefined) {
- uni.showModal({
- showCancel: false,
- title: '提示',
- content: res.data.message
- })
- }
- }
- }
- },
- fail: (err) => {
- reject("请求失败")
- }
- })
- })
- },
- }
- }
- </script>
- <style>
- /* #02B7CA */
- page {
- height: 100vh;
- background-color: #f6f6f6;
- }
- @font-face {
- font-family: "iconfont";
- src: url('~@/static/font/iconfont.eot?t=1618301166239');
- /* IE9 */
- src: url('~@/static/font/iconfont.eot?t=1618301166239#iefix') format('embedded-opentype'),
- /* IE6-IE8 */
- url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAK4AAsAAAAABmAAAAJuAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCCcApgbAE2AiQDCAsGAAQgBYRtBzobnAUR1Ytjsr8kcBMGbh21zElHLWZZtWb2Nay/eEDoCGVSodH5r61OpFilgscEIazpJZ8RgFv9AEgTqQnFqMgT+gmFvp0EErpEsWu2DU4x9EAC8Cf+BihY4LL/m/ZrEaY2XZYl+zyojmmZCezQEHp3ymxhT8rT1xM8gPZ65JK5Ww+M8P7LByL3AMghCAEDLqc/gR5k1AHltieNNXlMwMDSAPfCKE6khDJuGLvAJdyHAIGkKiZVQVMXg2EtE0Amq5E+JhfGMJbzR/Ct2WvINuKvKxqGrfD78oufAcXHwWpoo+pBzr9vF/C87RNEQECHfQAHKAYG0lWbbjFFGOcQmN5kYl+1Ah/++y5kr3aE/XVWdTAAyVBxT0pXdavVCoDF4/EgddRbQeNyP8SDWHp/ODmOwXx/+nQtrpg7n33jZk3uznpzH39tlyV5nk2bv2uYRTaUoZ+pWw8gEDz/9h7x988AcP88Dm1GPy/89+QR+CPKnn2mqy2nmqqs9Srxo5YqEEgg4MX+SO9jLTGnzwv+xNyE14+UFA7+ZJPGFsOHIFzwxZ9SBFKk9nAQUaZMEQsACi0ACOGuoYTyCIdwT6SxHvgQ6x++hKcIpGfGmUHkxqosgoliDukbVBn35LjVimrPWExtIll1yN9RxioGnu0WcyH2KHNsGJ+Fr0pAwh0E4DFsW4ZBuMZM7VJ12DoO1b3IzrgzFoKJYg7pG1QZ9+SPVqv0+TMWU5tIS1NN9o4yVpODZ7s9yNDQ92q6l2fGZ+GrEpBwBwGYhW3LMNTPqjFTuxyRHLaOPYz6Guz1Td0HlLM2LGuxffWdT6mrpFeefGMA') format('woff2'),
- url('~@/static/font/iconfont.woff?t=1618301166239') format('woff'),
- url('~@/static/font/iconfont.ttf?t=1618301166239') format('truetype'),
- /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */
- url('~@/static/font/iconfont.svg?t=1618301166239#iconfont') format('svg');
- /* iOS 4.1- */
- }
- .iconfont {
- font-family: "iconfont" !important;
- font-size: 16px;
- font-style: normal;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- }
- .icon-iconfontjiantou2:before {
- content: "\e632";
- }
- </style>
|