msb_prod
ch 3 years ago
parent 3636fc2958
commit b2bdc38c30

@ -2,12 +2,12 @@
* @Author: ch * @Author: ch
* @Date: 2022-07-08 11:46:30 * @Date: 2022-07-08 11:46:30
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-07-12 10:47:34 * @LastEditTime: 2022-07-12 10:55:29
* @Description: file content * @Description: file content
*/ */
import {FormatSearchJson} from '@/common/utils'; import { FormatSearchJson } from '@/common/utils';
import {ApiGetOpenId, ApiGetAuthUrl} from '@/common/api/auth'; import { ApiGetOpenId, ApiGetAuthUrl } from '@/common/api/auth';
import { ApiGetOrderInfo } from '@/common/api/pay'; import { ApiGetOrderInfo } from '@/common/api/pay';
import Vue from 'vue'; import Vue from 'vue';
import App from './App'; import App from './App';
@ -17,61 +17,46 @@ import '@/common/utils/uniUtilsIndex'
const ua = navigator ? navigator.userAgent.toLowerCase() : ''; const ua = navigator ? navigator.userAgent.toLowerCase() : '';
if (ua.includes('micromessenger')) { if (ua.includes('micromessenger')) {
const openId = localStorage.getItem('openId'); const openId = localStorage.getItem('openId');
if(!openId){ if (!openId) {
let query = FormatSearchJson(window.location.search); let query = FormatSearchJson(window.location.search);
if(query.code){
ApiGetOpenId({
code : query.code
}).then(({error, result}) => {
if(error){
// uni.$u.toast(error.message);
return false;
}
store.commit('SET_OPEN_ID', result.openId);
})
} else {
ApiGetOrderInfo({ payOrderNo: query.payOrderNo }).then(({result}) => {
ApiGetAuthUrl({ ApiGetOrderInfo({ payOrderNo: query.payOrderNo }).then(({ result }) => {
appid: result.prepayWxApp.prepayAppId, const appid = result.prepayWxApp.prepayAppId;
redirectUrl : window.location.href, if (query.code) {
scope : 'snsapi_base' ApiGetOpenId({
}).then(({result, error}) => { code: query.code,
if(error){ appid
// uni.$u.toast(error.message); }).then(({ error, result }) => {
uni.showToast({ if (error) {
title: error.message, // uni.$u.toast(error.message);
icon: 'none', return false;
duration : 2000 }
}) store.commit('SET_OPEN_ID', result.openId);
return false; })
} } else {
window.location.replace(result);
});
})
ApiGetAuthUrl({
appid,
redirectUrl: window.location.href,
scope: 'snsapi_base'
}).then(({ result, error }) => {
if (error) {
// uni.$u.toast(error.message);
uni.showToast({
title: error.message,
icon: 'none',
duration: 2000
})
return false;
}
window.location.replace(result);
});
// ApiGetOpenId({ payOrderNo: query.payOrderNo }).then(res => { }
// ApiGetAuthUrl({ })
// redirectUrl : window.location.href,
// scope : 'snsapi_base'
// }).then(({result, error}) => {
// if(error){
// // uni.$u.toast(error.message);
// uni.showToast({
// title: error.message,
// icon: 'none',
// duration : 2000
// })
// return false;
// }
// window.location.replace(result);
// })
// });
} }
}
} }
Vue.config.productionTip = false Vue.config.productionTip = false
@ -79,6 +64,6 @@ Vue.config.productionTip = false
App.mpType = 'app' App.mpType = 'app'
const app = new Vue({ const app = new Vue({
...App ...App
}) })
app.$mount() app.$mount()

Loading…
Cancel
Save