打包优化
This commit is contained in:
@@ -51,21 +51,21 @@
|
||||
"mp-weixin": {
|
||||
"appid": "wxa8f5989dcd45cc23",
|
||||
"setting": {
|
||||
"urlCheck": false
|
||||
"urlCheck": false,
|
||||
"minified": true,
|
||||
"uglifyFileName": true,
|
||||
"useCompilerModule": true,
|
||||
"useIsolateContext": true
|
||||
},
|
||||
"lazyCodeLoading": "requiredComponents",
|
||||
"usingComponents": true,
|
||||
"darkmode": true,
|
||||
"themeLocation": "theme.json",
|
||||
"permission": {}
|
||||
},
|
||||
"mp-alipay": {
|
||||
"usingComponents": true
|
||||
},
|
||||
"mp-baidu": {
|
||||
"usingComponents": true
|
||||
},
|
||||
"mp-toutiao": {
|
||||
"usingComponents": true
|
||||
},
|
||||
"vueVersion": "3"
|
||||
"permission": {
|
||||
"scope.userInfo": {
|
||||
"desc": "用于完善用户资料"
|
||||
}
|
||||
},
|
||||
"requiredPrivateInfos": ["getLocation", "chooseLocation"]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,12 +24,6 @@
|
||||
"navigationBarTitleText": "用户信息"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/login",
|
||||
"style": {
|
||||
"navigationBarTitleText": "登录"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/orders",
|
||||
"style": {
|
||||
|
||||
@@ -1,122 +0,0 @@
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import Header from "@/components/Header.vue";
|
||||
import SButton from "@/components/SButton.vue";
|
||||
import useStore from "@/store";
|
||||
import { loginAPI } from "@/apis";
|
||||
const store = useStore();
|
||||
|
||||
const { updateUser } = store;
|
||||
const agree = ref(false);
|
||||
|
||||
const handleAgree = () => {
|
||||
agree.value = !agree.value;
|
||||
};
|
||||
const handleLogin = () => {
|
||||
if (!agree.value) {
|
||||
return uni.showToast({
|
||||
title: "请先同意协议",
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
// console.log("getUsername", store.getUsername);
|
||||
uni.getUserProfile({
|
||||
desc: "用于完善用户资料",
|
||||
success: (res) => {
|
||||
const { nickName, avatarUrl } = res.userInfo;
|
||||
// 获取登录凭证
|
||||
uni.login({
|
||||
provider: "weixin",
|
||||
success: async (loginRes) => {
|
||||
const { code } = loginRes;
|
||||
const result = await loginAPI(nickName, avatarUrl, code);
|
||||
updateUser({ ...result.user, nickName, avatarUrl });
|
||||
uni.navigateBack();
|
||||
},
|
||||
fail: (err) => {
|
||||
uni.showToast({
|
||||
title: "登录失败",
|
||||
icon: "none",
|
||||
});
|
||||
console.error("登录失败:", err);
|
||||
},
|
||||
});
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log("获取用户信息失败:", err);
|
||||
},
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="container">
|
||||
<image src="../static/login-bg.png" mode="widthFix" />
|
||||
<Header />
|
||||
<view>
|
||||
<SButton :rounded="20" width="80vw" :onClick="handleLogin">
|
||||
<image
|
||||
src="../static/wechat-icon.png"
|
||||
mode="widthFix"
|
||||
class="wechat-icon"
|
||||
/>
|
||||
<text>登录/注册</text>
|
||||
</SButton>
|
||||
<view class="protocol" @click="handleAgree">
|
||||
<view v-if="!agree" />
|
||||
<image v-if="agree" src="../static/checked.png" mode="widthFix" />
|
||||
<text
|
||||
>已同意并阅读<text :style="{ color: '#fff' }">《用户协议》</text
|
||||
>及<text :style="{ color: '#fff' }">《隐私协议》</text>内容</text
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.container {
|
||||
position: relative;
|
||||
}
|
||||
.container > image:first-child {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
z-index: -1;
|
||||
}
|
||||
.container > view:last-child {
|
||||
width: 100%;
|
||||
height: calc(100vh - 96px);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.protocol {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 13px;
|
||||
margin-top: 40px;
|
||||
color: #8a8a8a;
|
||||
}
|
||||
.protocol > image {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.protocol > view:first-child {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
border-radius: 50%;
|
||||
margin-right: 10px;
|
||||
border: 1px solid #fff;
|
||||
}
|
||||
.wechat-icon {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
</style>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 168 KiB |
Reference in New Issue
Block a user