开放登录

parent 9a1a518e
......@@ -4,6 +4,9 @@ import { sgyOrderGetStatus } from './api/order';
import testJson from './static/json/test.json';
import { getToken } from './utils/auth';
import { setOrderDic } from './utils/orderDic';
// beforeMount(() => {
// if (!getToken()) signIn();
// });
onLaunch(() => {
if (!getToken()) signIn();
sgyOrderGetStatus().then((res) => {
......@@ -22,13 +25,19 @@ onHide(() => {
});
// 登录
const signIn = () => {
getTokenUser(testJson).then((res) => {
xma.xh.getUserProfile({
range: ['ACCOUNT', 'MOBILE', 'CITIZEN'],
async success(info) {
const info2 = JSON.stringify(info);
getTokenUser(info2).then((res) => {
const token = res.data.access_token;
const userInfo = res.data.user_info;
xma.setStorageSync('Authorization', token);
xma.setStorageSync('userInfo', userInfo);
console.log('登录...');
});
},
});
};
</script>
<style>
......
......@@ -9,7 +9,8 @@
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "小程序平台"
"navigationBarTitleText": "小程序平台",
"navigationStyle":"custom"
}
},
{
......
......@@ -322,6 +322,12 @@ const reset = () => {
cardData2.value = [];
show.value = false;
};
const toUse = () => {
xma.navigateTo({
url: '/pages/index/listFood?type=1',
});
};
// 商家列表分页-搜索列表
const getMerchantList = () => {
xma.showLoading({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment