Compare commits
2 Commits
a4a81a5873
...
89f64b5418
Author | SHA1 | Date | |
---|---|---|---|
89f64b5418 | |||
b8ff83019d |
8
env/.env
vendored
8
env/.env
vendored
@ -5,8 +5,8 @@ VITE_APP_TITLE=uniapp-vue3模板项目
|
||||
VITE_APP_ENV=development
|
||||
|
||||
# 接口地址
|
||||
VITE_API_BASE_URL=http://www.caipu.com:8545
|
||||
# VITE_API_BASE_URL=http://ceshi-recipeapi.lihaink.cn/
|
||||
# VITE_API_BASE_URL=http://www.caipu.com:8545
|
||||
VITE_API_BASE_URL=https://ceshi-recipeapi.lihaink.cn/
|
||||
|
||||
# 端口号
|
||||
VITE_APP_PORT=9527
|
||||
@ -15,8 +15,8 @@ VITE_APP_PORT=9527
|
||||
VITE_APP_PROXY=true
|
||||
|
||||
# API代理前缀
|
||||
VITE_API_PREFIX= http://www.caipu.com:8545
|
||||
# VITE_API_PREFIX= http://ceshi-recipeapi.lihaink.cn/
|
||||
# VITE_API_PREFIX= http://www.caipu.com:8545
|
||||
VITE_API_PREFIX= https://ceshi-recipeapi.lihaink.cn/
|
||||
|
||||
# 删除console
|
||||
VITE_DROP_CONSOLE=false
|
||||
|
2
env/.env.test
vendored
2
env/.env.test
vendored
@ -2,7 +2,7 @@
|
||||
VITE_APP_ENV=staging
|
||||
|
||||
# 接口地址
|
||||
VITE_API_BASE_URL=http://localhost:8080/staging
|
||||
VITE_API_BASE_URL=http://ceshi-recipeapi.lihaink.cn
|
||||
|
||||
# 删除console
|
||||
VITE_DROP_CONSOLE=true
|
||||
|
@ -10,7 +10,7 @@ export interface ProfileRes {
|
||||
user?: any;
|
||||
}
|
||||
export interface LoginReq {
|
||||
phone: string;
|
||||
account: string;
|
||||
code: string;
|
||||
}
|
||||
export interface LoginReqPassword {
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name" : "",
|
||||
"name" : "菜谱",
|
||||
"appid" : "",
|
||||
"description" : "",
|
||||
"versionName" : "1.0.0",
|
||||
@ -63,7 +63,7 @@
|
||||
"desc" : "获取您的位置"
|
||||
}
|
||||
},
|
||||
"requiredPrivateInfos" : ["login" ,"getLocation", "chooseAddress" , "chooseLocation" ]
|
||||
"requiredPrivateInfos" : [ "getLocation", "chooseAddress" , "chooseLocation" ]
|
||||
},
|
||||
"mp-alipay" : {
|
||||
"usingComponents" : true
|
||||
|
@ -44,6 +44,21 @@
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "login/user_privacy",
|
||||
"style": {
|
||||
"navigationBarTitleText": "用户协议",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "login/user_about",
|
||||
"style": {
|
||||
"navigationBarTitleText": "隐私政策",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "webview/index",
|
||||
"style": {
|
||||
|
@ -9,6 +9,11 @@
|
||||
white-space: nowrap;
|
||||
/* 确保元素有宽度 */
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
height: 0rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
@ -24,7 +29,7 @@
|
||||
maxlength="-1" height="60rpx" @change="searchSP()">
|
||||
</up-search>
|
||||
|
||||
<z-paging :fixed="false" height="calc(100vh - 320rpx)" width="calc(100vw - 50rpx)"
|
||||
<z-paging :fixed="false" height="calc(100vh - 380rpx)" width="calc(100vw - 50rpx)"
|
||||
:paging-style="{ 'background-color': '#FFFFFFFF', 'padding': '20rpx' }" ref="pagingRefSP"
|
||||
v-model="matchedItems_sp" @query="changeSP" class="fv-page flex-col ">
|
||||
<view v-for="(item, index) in matchedItems_sp" :key="index">
|
||||
|
@ -54,9 +54,10 @@
|
||||
<view class=" box-border flex" style="margin-top: 50rpx;">
|
||||
<view class="hint">
|
||||
登录代表同意
|
||||
<text class="link">
|
||||
用户协议、隐私政策,
|
||||
<text class="link" >
|
||||
<text @click="userAbount(0)">用户协议、</text ><text @click="userAbount(1)">隐私政策,</text>
|
||||
</text>
|
||||
|
||||
并授权使用您的账号信息(如昵称、头像、收获地址)以便您统一管理
|
||||
</view>
|
||||
</view>
|
||||
@ -79,20 +80,20 @@ isWechat.value = true;
|
||||
|
||||
|
||||
const loginType = ref(0);
|
||||
const account = ref<string>('18181941463');
|
||||
const code = ref<string>('1234');
|
||||
const password = ref<string>('123456');
|
||||
const account = ref<string>('');
|
||||
const code = ref<string>('');
|
||||
const password = ref<string>('');
|
||||
|
||||
const tips = ref<string>();
|
||||
const tips = ref<string>('');
|
||||
const uCodeRef = ref<InstanceType<typeof uCode> | null>(null);
|
||||
let redirect = HOME_PATH;
|
||||
|
||||
const inputStyle = computed<CSSProperties>(() => {
|
||||
const style = {} as CSSProperties;
|
||||
if (account.value && code.value) {
|
||||
// if (account.value && code.value) {
|
||||
style.color = '#fff';
|
||||
style.backgroundColor = uni.$u.color.success;
|
||||
}
|
||||
// }
|
||||
return style;
|
||||
});
|
||||
|
||||
@ -123,51 +124,21 @@ function getCode () {
|
||||
}
|
||||
|
||||
|
||||
//点击详情
|
||||
function userAbount (type ) {
|
||||
|
||||
async function wechatLogin () {
|
||||
|
||||
if (!isWechat.value) {
|
||||
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
// onlyAuthorize: true,// 微信登录仅请求授权认证
|
||||
success: function (event) {
|
||||
console.log('微信登录', event);
|
||||
// const { code } = event
|
||||
//客户端成功获取授权临时票据(code),向业务服务器发起登录请求。
|
||||
// uni.request({
|
||||
// url: 'https://www.example.com/loginByWeixin', //仅为示例,并非真实接口地址。
|
||||
// data: {
|
||||
// code: event.code
|
||||
// },
|
||||
// success: (res) => {
|
||||
// //获得token完成登录
|
||||
// uni.setStorageSync('token', res.token)
|
||||
// }
|
||||
// });
|
||||
userStore.login({ account: account.value, code: event.code }).catch(() => {
|
||||
if (res.code === 1) {
|
||||
// const token = res.data.token;
|
||||
// if (token) {
|
||||
// setToken(token.token_type+' '+token.token);
|
||||
// }
|
||||
uni.$u.toast('登录成功');
|
||||
}
|
||||
else {
|
||||
uni.$u.toast(`登录失败,${res.message}`);
|
||||
}
|
||||
if(type===0){
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/login/user_privacy`
|
||||
});
|
||||
}else{
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/login/user_about`
|
||||
});
|
||||
|
||||
},
|
||||
fail: function (err) {
|
||||
// 登录授权失败
|
||||
// err.code是错误码
|
||||
}
|
||||
})
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
async function wechatLogin () {
|
||||
if (isWechat.value === true) {
|
||||
if (!uni.$u.test.mobile(Number(account.value))) {
|
||||
uni.$u.toast('请输入正确的手机号');
|
||||
return;
|
||||
@ -187,7 +158,7 @@ async function wechatLogin () {
|
||||
uni.$u.toast('登录成功');
|
||||
}
|
||||
else {
|
||||
uni.$u.toast(`登录失败,${res.message}`);
|
||||
uni.$u.toast(`登录失败,${res.msg}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -205,7 +176,7 @@ async function wechatLogin () {
|
||||
uni.$u.toast('登录成功');
|
||||
}
|
||||
else {
|
||||
uni.$u.toast(`登录失败,${res.message}`);
|
||||
uni.$u.toast(`登录失败,${res.msg}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -222,6 +193,60 @@ async function wechatLogin () {
|
||||
setToken('');
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
// onlyAuthorize: true,// 微信登录仅请求授权认证
|
||||
success: function (event) {
|
||||
console.log('微信登录', event);
|
||||
// const { code } = event
|
||||
//客户端成功获取授权临时票据(code),向业务服务器发起登录请求。
|
||||
// uni.request({
|
||||
// url: 'https://www.example.com/loginByWeixin', //仅为示例,并非真实接口地址。
|
||||
// data: {
|
||||
// code: event.code
|
||||
// },
|
||||
// success: (res) => {
|
||||
// //获得token完成登录
|
||||
// uni.setStorageSync('token', res.token)
|
||||
// }
|
||||
// });
|
||||
userStore.login({ account: account.value, code: event.code }).catch((res) => {
|
||||
if (res.code === 1) {
|
||||
// const token = res.data.token;
|
||||
// if (token) {
|
||||
// setToken(token.token_type+' '+token.token);
|
||||
// }
|
||||
uni.$u.toast('登录成功');
|
||||
if (isLogin()) {
|
||||
// await userStore.info()
|
||||
setTimeout(() => {
|
||||
uni.$u.route({
|
||||
type: isTabBarPath(redirect) ? 'switchTab' : 'redirectTo',
|
||||
url: redirect,
|
||||
});
|
||||
}, 800);
|
||||
} else {
|
||||
uni.$u.toast(`登录失败,${res.msg}`);
|
||||
setToken('');
|
||||
}
|
||||
}
|
||||
else {
|
||||
uni.$u.toast(`登录失败,${res.msg}`);
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
fail: function (err) {
|
||||
// 登录授权失败
|
||||
// err.code是错误码
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
// setToken('1234567890');
|
||||
|
||||
}
|
||||
|
54
src/pages/common/login/user_about.vue
Normal file
54
src/pages/common/login/user_about.vue
Normal file
@ -0,0 +1,54 @@
|
||||
<style>
|
||||
.flex-sub-cart {
|
||||
flex: 1;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
/* height: 100%; */
|
||||
bottom: 10rpx;
|
||||
position: fixed;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.detail_box {
|
||||
border-top: 2rpx solid #dfdfdf;
|
||||
border-radius: 5rpx;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<view class="fv-page flex-col" style="">
|
||||
<up-navbar class=" " :autoBack="true" style="font-weight: bold;"
|
||||
leftIcon="arrow-left" title="隐私政策" titleColor="#303133" bgColor="#FFFFFFFF" titleWidth="600rpx"
|
||||
height="80rpx" leftIconSize="38rpx" leftIconColor="#303133" :safeAreaInsetTop="true" :placeholder="true"
|
||||
:fixed="true"></up-navbar>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from "vue";
|
||||
import { CommonApi, UserApi } from "@/api";
|
||||
import { setToken, getToken, isLogin } from '@/utils/auth';
|
||||
import { image } from "@/uni_modules/uview-plus/libs/function/test";
|
||||
import { url } from "inspector";
|
||||
export default defineComponent({
|
||||
data () {
|
||||
return {
|
||||
|
||||
};
|
||||
},
|
||||
onLoad (option) {
|
||||
|
||||
},
|
||||
created () {
|
||||
|
||||
},
|
||||
methods: {
|
||||
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
|
||||
</script>
|
54
src/pages/common/login/user_privacy.vue
Normal file
54
src/pages/common/login/user_privacy.vue
Normal file
@ -0,0 +1,54 @@
|
||||
<style>
|
||||
.flex-sub-cart {
|
||||
flex: 1;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
/* height: 100%; */
|
||||
bottom: 10rpx;
|
||||
position: fixed;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.detail_box {
|
||||
border-top: 2rpx solid #dfdfdf;
|
||||
border-radius: 5rpx;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<view class="fv-page flex-col" style="">
|
||||
<up-navbar class=" " :autoBack="true" style="font-weight: bold;"
|
||||
leftIcon="arrow-left" title="用户协议" titleColor="#303133" bgColor="#FFFFFFFF" titleWidth="600rpx"
|
||||
height="80rpx" leftIconSize="38rpx" leftIconColor="#303133" :safeAreaInsetTop="true" :placeholder="true"
|
||||
:fixed="true"></up-navbar>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from "vue";
|
||||
import { CommonApi, UserApi } from "@/api";
|
||||
import { setToken, getToken, isLogin } from '@/utils/auth';
|
||||
import { image } from "@/uni_modules/uview-plus/libs/function/test";
|
||||
import { url } from "inspector";
|
||||
export default defineComponent({
|
||||
data () {
|
||||
return {
|
||||
|
||||
};
|
||||
},
|
||||
onLoad (option) {
|
||||
|
||||
},
|
||||
created () {
|
||||
|
||||
},
|
||||
methods: {
|
||||
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
|
||||
</script>
|
@ -445,7 +445,8 @@ export default defineComponent({
|
||||
if (this.totalNum == 1) {
|
||||
this.totalNum = res.data.peopleNumber
|
||||
}
|
||||
|
||||
}else{
|
||||
uni.$u.toast(res.msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
@ -29,7 +29,7 @@ export function request<T = any>(config: HttpRequestConfig): Promise<T> {
|
||||
const { result } = res.data;
|
||||
resolve(result as T);
|
||||
}).catch((res: any) => {
|
||||
if(res.data.code==401){
|
||||
if(res.code==401){
|
||||
//未登录拦截跳转
|
||||
uni.$u.toast(res.data.msg);
|
||||
usePermission();
|
||||
|
Loading…
x
Reference in New Issue
Block a user