import Vue from 'vue' import App from './App' import Mixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js' // import uView from "uview-ui" import { gotopage } from '@/common/gotopage.js' // 配置公共方法 Vue.prototype.gotoPage = gotopage // Vue.use(uView); // 配置公共方法 import common from '@/common/common.js' Vue.prototype.$noMultipleClicks = common.noMultipleClicks Vue.prototype.$c = common; //var loginPage = "http://api.zpc-xy.com/login.html"; // var loginPage="http://api.zpc-xy.com/login.html"; var loginPage="https://xinglanmh.shequtuangou.vip/login.html"; Vue.prototype.$loginPage = loginPage; Vue.prototype.$wxloginPage = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx0e33d80d35e4a3b1&redirect_uri=${escape(loginPage)}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`; //ttps://open.weixin.qq.com/connect/qrconnect?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect // https://open.weixin.qq.com/connect/oauth2/authorize? =wx520c15f417810387&redirect_uri=https%3A%2F%2Fchong.qq.com%2Fphp%2Findex.php%3Fd%3D%26c%3DwxAdapter%26m%3DmobileDeal%26showwxpaytitle%3D1%26vb2ctag%3D4_2030_5_1194_60&response_type=code&scope=snsapi_base&state=123#wechat_redirect Vue.prototype.req = function(param, backpage, backtype) { uni.getNetworkType({ success: function(res) { if (res.networkType == 'none') { uni.showToast({ title: '网络连接异常,请检查网络', icon: 'none' }) return } } }) var _self = this, url = param.url, method = 'POST', header = {}, data = param.data || {}, Loading = param.Loading || false var token = uni.getStorageSync('token') // 我 // var token = 'bf3dd927642ea5a7a9ad90f1e1d1faab4d61cd33'; // 客户 // var token = '801abe6ec37a36b3ff37ded44be13c7bf06b629e'; var client = ""; // #ifdef H5 client = "h5"; // #endif //拼接完整请求地址 var requestUrl = this.siteBaseUrl + url if (method) { method = method.toUpperCase() //小写改为大写 // console.log(token,11) if (method == 'POST') { header = { 'content-type': 'application/x-www-form-urlencoded', client: client, token: token, adid: uni.getStorageSync('_ad_id'), clickid: uni.getStorageSync('_click_id'), } // if (uni.getStorageSync('_ad_id')) { // header.adid = uni.getStorageSync('_ad_id') // } // if (uni.getStorageSync('_click_id')) { // header.clickid = uni.getStorageSync('_click_id') // } } else { header = { 'content-type': 'application/json' } } } else { method = 'GET' header = { 'content-type': 'application/json' } } //用户交互:加载圈 // console.log(!Loading) if (!Loading) { uni.showLoading({ title: '加载中...' }) } //网络请求 uni.request({ url: requestUrl, method: method, header: header, data: data, success: res => { // if (requestUrl.indexOf('coupon_ling') != -1) { // uni.showModal({ // title: '提示', // content: JSON.stringify(res), // showCancel: true, // success: ({ confirm, cancel }) => {} // }) // } console.log("res.data.status", res.data.status) if (res.data.status == 1) { //返回结果码code判断:1成功,-1错误 // uni.showToast({ // title: res.data.msg, // icon: 'none', // }) } else if (res.data.status == 2222) {} else if (res.data.status == -9) { let pages = getCurrentPages() console.log(pages[pages.length - 1].route) // uni.setStorageSync('page', pages[pages.length - 1].route) setTimeout(() => { uni.showToast({ title: res.data.msg, icon: 'none', success() { setTimeout(() => { // #ifdef H5 uni.navigateTo({ url: '/pages/user/bangdingweb' }) // #endif // #ifdef MP-WEIXIN uni.navigateTo({ url: '/pages/user/bangding' }) // #endif }, 1500) } }) }, 100) } else if (res.data.status == 0) { setTimeout(function() { uni.showToast({ title: res.data.msg, icon: 'none' }) }, 100) } else if (res.data.status < 0) { var pages = getCurrentPages() for (var a = 0; a < pages.length; a++) { console.log(pages[a].route) if (pages[a].route == 'pages/user/index') { uni.setStorageSync('lgurl', pages[a].route) uni.setStorageSync('lgurldata', JSON.stringify(pages[a].options)) } } setTimeout(() => { uni.showToast({ title: '请先登录', icon: 'none' }) }, 100) uni.redirectTo({ url: '/pages/user/login' }) } else { return } typeof param.success == 'function' && param.success(res.data) }, fail: e => { console.log('网络请求fail:' + JSON.stringify(e)) typeof param.fail == 'function' && param.fail(e.data) }, complete: () => { uni.hideLoading() typeof param.complete == 'function' && param.complete() return } }) } // #ifdef H5 function loadScript(url) { var script = document.createElement('script'); script.type = 'text/javascript'; script.src = url; document.head.appendChild(script); } loadScript('https://res.wx.qq.com/open/js/jweixin-1.6.0.js'); // #endif Vue.prototype.onBridgeReady = function(data) { var x = { "appId": "wx2421b1c4370ec43b", //公众号ID,由商户传入 "timeStamp": "1395712654", //时间戳,自1970年以来的秒数 "nonceStr": "e61463f8efa94090b1f366cccfbbb444", //随机串 "package": "prepay_id=u802345jgfjsdfgsdg888", "signType": "MD5", //微信签名方式: "paySign": "70EA570631E4BB79628FBCA90534C63FF7FADD89" //微信签名 }; WeixinJSBridge.invoke( 'getBrandWCPayRequest', data, function(res) { console.log(res); if (res.err_msg == "get_brand_wcpay_request:ok") { // 使用以上方式判断前端返回,微信团队郑重提示: //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。 } }); } // 测试 // const baseUrl = 'https://api.zpc-xy.com' // 正式 const baseUrl = 'https://bajiapi.onelight.vip' Vue.prototype.siteBaseUrl = baseUrl + '/api/' Vue.prototype.$z_img2 = baseUrl + '/zcq/' Vue.prototype.$baseUrl = baseUrl Vue.prototype.$img = url => baseUrl + '/static/web' + url // Vue.prototype.$img1 = url => baseUrl + '/static/web' + url Vue.prototype.$img1 = url => baseUrl + '/static/web/static/' + url Vue.prototype.$sys = () => uni.getSystemInfoSync() Vue.config.productionTip = false Vue.mixin(Mixin) App.mpType = 'app' const app = new Vue({ ...App }) app.$mount()