import App from './App' import {myRequest} from './utils/request.js' import {getUserDetail} from '@/api/common.js' import {getVipLog,mealList,getTmpVip} from '@/api/combo.js' function GetVip(){ console.log('cesjhio'); if(uni.getStorageSync('token')){ getVipLog().then(res=>{ let createTime = new Date(JSON.parse(uni.getStorageSync('userInfo')).createTime) if(res.content&&!res.content.length&&createTime>new Date('2024-12-01 00:00:00')){ this.showGetVip = true // uni.showModal({ // title:'提示', // content:'免费领取7天会员,畅享专属权益,点击“领取”体验!', // cancelText:'取消', // confirmText:'领取', // success: function (r) { // if (r.confirm) { // console.log('用户点击确定'); // mealList({source:2}).then(result=>{ // if(result.content.records.length){ // getTmpVip(result.content.records[0].setMealCode).then(res1=>{ // if(res1.state == 'Success'){ // getUserDetail().then(data => { // uni.setStorageSync('userInfo', JSON.stringify(data.content)) // }) // uni.showToast({ // title:'领取成功', // icon:'none' // }) // } // }) // }else{ // uni.showToast({ // title:'未配置临时会员', // icon:'none' // }) // } // }) // } // } // }) } }) } } function submit(){ mealList({source:2}).then(result=>{ if(result.content.records.length){ getTmpVip(result.content.records[0].setMealCode).then(res1=>{ if(res1.state == 'Success'){ getUserDetail().then(data => { uni.setStorageSync('userInfo', JSON.stringify(data.content)) }) this.showGetVip = false uni.showToast({ title:'领取成功', icon:'none' }) } }) }else{ uni.showToast({ title:'未配置临时会员', icon:'none' }) } }) } // #ifndef VUE3 import Vue from 'vue' import './uni.promisify.adaptor' Vue.config.productionTip = false App.mpType = 'app' //挂载,让全局可以使用 Vue.prototype.$req = myRequest Vue.prototype.$GetVip = GetVip Vue.prototype.$Submit = submit import uView from '@/uni_modules/uview-ui' Vue.use(uView) uni.$u.config.unit = 'rpx' const app = new Vue({ ...App }) app.$mount() // #endif // #ifdef VUE3 import { createSSRApp } from 'vue' export function createApp() { const app = createSSRApp(App) return { app } } // #endif