This commit is contained in:
whitechiina 2025-09-28 17:47:24 +08:00
parent c76bb1ed5a
commit 853b494af5
22 changed files with 121 additions and 111 deletions

BIN
.DS_Store vendored

Binary file not shown.

84
App.vue
View File

@ -21,6 +21,7 @@
return false
}
}
import wx from 'weixin-js-sdk'
import store from '@/store/index';
import { HTTP_REQUEST_URL } from '@/config/app.js'
import { mapMutations} from 'vuex'
@ -98,7 +99,7 @@
} else {
console.log('没有参数')
}
store.commit('SETTOKEN', this['globalData']['parameters']['token']);
this.SETSPREAD(this['globalData']['parameters']['spread']);
// 分享者的参数
// if (this['globalData']['parameters']['spread']) {
@ -110,7 +111,6 @@
// }
}else{
console.log('登录token后存在的参数1997', querys)
setTimeout(() => {
console.log(querys.userinfor?.spread, '分享人分享人分享人分享人分享人分享人分享人分享人分享人')
if (querys.userinfor?.spread) {
@ -121,9 +121,8 @@
}
}, 2000)
if (!querys.token) {
if (!querys.token && querys.query) {
querys.query = querys.query.replace(/=/g, '')
console.log(querys)
for(let key in querys){
const value = querys[key];
querys[key] = JSON.parse(value);
@ -131,9 +130,8 @@
}
this['globalData']['parameters'] = { ...querys['userinfor'], ...querys['query'], timestamp:querys['timestamp']};
if (this['globalData']['parameters']['query']) {
store.commit('shopping/SETBRANDINFOR', { brand_id: this['globalData']['parameters']['query']['brand_id'], brand_name:decodeURIComponent(this['globalData']['parameters']['query']['brand_name'])});
store.commit('shopping/SETBRANDINFOR', { brand_id: querys.query.brand_id || this['globalData']['parameters']['query']['brand_id'], brand_name: querys.query.brand_name || decodeURIComponent(this['globalData']['parameters']['query']['brand_name'])});
store.commit('shopping/SETSHOPDETAIL', {
city_name: this['globalData']['parameters'].cityInfor.city,
is_open: 1,
@ -142,36 +140,39 @@
province_name: this['globalData']['parameters']['cityInfor'].province,
regoin_name: null,
restaurant_address: this['globalData']['parameters']['query'].restaurant_address,
restaurant_id: this['globalData']['parameters']['query'].restaurant_id,
restaurant_name: this['globalData']['parameters']['query'].restaurant_name,
restaurant_id: this['globalData']['parameters']['query'].restaurant_id || querys.query.brand_id,
restaurant_name: this['globalData']['parameters']['query'].restaurant_name || querys.query.brand_name,
special: false,
distance: this['globalData']['parameters']['query'].distance
})
}
// 小程序首页会直接进入店铺首页,首页无赋值店铺信息逻辑所再次处进入之后赋值
if(this['globalData']['parameters']?.brand_id){
store.commit('shopping/SETBRANDINFOR', { brand_id: this['globalData']['parameters']['brand_id'], brand_name:decodeURIComponent(this['globalData']['parameters']['brand_name'])});
// 设置店铺信息JIN
store.commit('shopping/SETSHOPDETAIL', {
city_name: this['globalData']['parameters'].cityInfor.city,
is_open: 1,
latitude: this['globalData']['parameters'].latitude,
longitude: this['globalData']['parameters'].longitude,
open_time: "07:00",
province_name: this['globalData']['parameters'].cityInfor.province,
regoin_name: null,
restaurant_address: this['globalData']['parameters'].restaurant_address,
restaurant_id: this['globalData']['parameters'].restaurant_id,
restaurant_name: this['globalData']['parameters'].restaurant_name,
special: false,
distance: this['globalData']['parameters'].distance
})
store.commit('SETTOKEN', this['globalData']['parameters']['token']);
};
wx.miniProgram.getEnv((wx) => {
if (wx.miniprogram) {
if(this['globalData']['parameters']?.brand_id){
store.commit('shopping/SETBRANDINFOR', { brand_id: this['globalData']['parameters']['brand_id'], brand_name:decodeURIComponent(this['globalData']['parameters']['brand_name'])});
// 设置店铺信息JIN
store.commit('shopping/SETSHOPDETAIL', {
city_name: this['globalData']['parameters'].cityInfor.city,
is_open: 1,
latitude: this['globalData']['parameters'].latitude,
longitude: this['globalData']['parameters'].longitude,
open_time: "07:00",
province_name: this['globalData']['parameters'].cityInfor.province,
regoin_name: null,
restaurant_address: this['globalData']['parameters'].restaurant_address,
restaurant_id: this['globalData']['parameters'].restaurant_id,
restaurant_name: this['globalData']['parameters'].restaurant_name,
special: false,
distance: this['globalData']['parameters'].distance
})
store.commit('SETTOKEN', this['globalData']['parameters']['token']);
};
}
})
}
};
console.log(this['globalData']['parameters']['spread'],'测试取参');
this.clearUrlParams();
return;
@ -214,13 +215,15 @@
let querys = basurl.query(true);
if (querys.token) return; // 从分享进入的
for(let key in querys){
querys[key] = JSON.parse(querys[key])
if (querys.query) {
querys.query = querys.query.replace(/=/g, '')
for(let key in querys){
querys[key] = JSON.parse(querys[key])
}
}
let parameters = { ...querys['userinfor'], ...querys['query']};
parameters.token = '';
console.log({...querys['query']}, '111111111111111111111111111111111111111')
const safeDecode = (value) => {
if (value == null) return ''; // 默认空值
try {
@ -229,13 +232,14 @@
return value; // 解码失败返回原值
}
};
const userinfor = {
cityInfor: {
lat: safeDecode(parameters.cityInfor.lat),
lng: safeDecode(parameters.cityInfor.lng),
city: safeDecode(parameters.cityInfor.address),
province: safeDecode(parameters.cityInfor.province),
adcode: safeDecode(parameters.cityInfor.adcode),
lat: safeDecode(parameters.cityInfor?.lat) || '',
lng: safeDecode(parameters.cityInfor?.lng) || '',
city: safeDecode(parameters.cityInfor?.address || ''),
province: safeDecode(parameters.cityInfor?.province || ''),
adcode: safeDecode(parameters.cityInfor?.adcode || ''),
},
isWechat: true,
query: {...querys['query']}
@ -259,7 +263,13 @@
if (getUrlParams(window.location.href)['token']) { // 优先登录后token
store.commit('SETTOKEN', decodeURIComponent(getUrlParams(window.location.href)['token']));
} else if (this['globalData']['parameters']['token']) { // 跳入token
store.commit('SETTOKEN', this['globalData']['parameters']['token']);
wx.miniProgram.getEnv((wx) => {
if (wx.miniprogram) {
store.commit('SETTOKEN', this['globalData']['parameters']['token']);
} else {
}
})
}
} else {
// 反之则代表从APP进入H5

View File

@ -19,8 +19,8 @@ app.$mount()
import uView from "uview-ui";
Vue.use(uView);
import VConsole from 'vconsole';
new VConsole();
// import VConsole from 'vconsole';
// new VConsole();
Vue.prototype.text = 1;
let wx = require('weixin-js-sdk');

BIN
unpackage/.DS_Store vendored

Binary file not shown.

Binary file not shown.

View File

@ -1,2 +1,2 @@
<!DOCTYPE html><html lang=zh-CN><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><title>在线点餐</title><script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><script src="https://h5.dhcc.wang/api/apilink-native.min.js?v=20200701"></script><link rel=stylesheet href=/privilege/static/index.883130ca.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/privilege/static/js/chunk-vendors.acc03eee.js></script><script src=/privilege/static/js/index.b20ca689.js></script></body></html>
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><script src="https://h5.dhcc.wang/api/apilink-native.min.js?v=20200701"></script><link rel=stylesheet href=/privilege/static/index.883130ca.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/privilege/static/js/chunk-vendors.05bba68b.js></script><script src=/privilege/static/js/index.d64407fb.js></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long