个人中心的静态页面完成,登录逻辑完成

首页的登录逻辑判断
This commit is contained in:
wangzimeng 2025-07-21 18:24:42 +08:00
parent 1ad9951258
commit 4fe9dfa923
14 changed files with 663 additions and 282 deletions

View File

@ -20,6 +20,17 @@
"group": "商城" "group": "商城"
} }
}, },
{
"path": "pages/index/fabu",
"style": {
"navigationBarTitleText": "发布"
},
"meta": {
"sync": true,
"title": "发布",
"group": "商城"
}
},
{ {
"path": "pages/index/user", "path": "pages/index/user",
"style": { "style": {
@ -46,18 +57,7 @@
{ {
"path": "pages/index/cart", "path": "pages/index/cart",
"style": { "style": {
"navigationBarTitleText": "发布" "navigationBarTitleText": "购物车"
},
"meta": {
"sync": true,
"title": "购物车",
"group": "商城"
}
},
{
"path": "pages/index/fabu",
"style": {
"navigationBarTitleText": "发布"
}, },
"meta": { "meta": {
"sync": true, "sync": true,
@ -759,7 +759,7 @@
], ],
"globalStyle": { "globalStyle": {
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
"navigationBarTitleText": "星品购", "navigationBarTitleText": "酱小仙",
"navigationBarBackgroundColor": "#FFFFFF", "navigationBarBackgroundColor": "#FFFFFF",
"backgroundColor": "#FFFFFF", "backgroundColor": "#FFFFFF",
"navigationStyle": "custom" "navigationStyle": "custom"
@ -769,7 +769,7 @@
"pagePath": "pages/index/index" "pagePath": "pages/index/index"
}, },
{ {
"pagePath": "pages/index/cart" "pagePath": "pages/index/fabu"
}, },
{ {
"pagePath": "pages/index/user" "pagePath": "pages/index/user"

View File

@ -1,5 +1,6 @@
<template> <template>
<s-layout title="购物车" tabbar="/pages/index/cart" :bgStyle="{ color: '#fff' }"> <!-- tabbar="/pages/index/cart" -->
<s-layout title="购物车" :bgStyle="{ color: '#fff' }">
<s-empty <s-empty
v-if="state.list.length === 0" v-if="state.list.length === 0"
text="购物车空空如也,快去逛逛吧~" text="购物车空空如也,快去逛逛吧~"

View File

@ -1,5 +1,9 @@
<template> <template>
<view> 发布 </view> <!-- <view> 发布 </view> -->
<s-layout title="发布" tabbar="/pages/index/fabu" :bgStyle="{ color: '#fff' }">
</s-layout>
</template> </template>
<script> <script>

View File

@ -16,7 +16,7 @@
<view class="locTop-right"> <view class="locTop-right">
<uni-section style="border-radius: 192rpx;padding: 0;" type="line"> <uni-section style="border-radius: 192rpx;padding: 0;" type="line">
<uni-search-bar style="border-radius: 192rpx;" radius="23" placeholder="搜索您需要的信息" <uni-search-bar style="border-radius: 192rpx;" radius="23" placeholder="搜索您需要的信息"
bgColor="#EEEEEE" clearButton="none" cancelButton="none" @confirm="search" @focus="toPage()"/> bgColor="#EEEEEE" clearButton="none" cancelButton="none" @confirm="search" @focus="toPage('/packageA/search/index')"/>
</uni-section> </uni-section>
<!-- <uni-search-bar></uni-search-bar> @confirm="search"--> <!-- <uni-search-bar></uni-search-bar> @confirm="search"-->
</view> </view>
@ -118,7 +118,8 @@
<script setup> <script setup>
import { import {
computed computed,
ref
} from 'vue'; } from 'vue';
import { import {
onLoad, onLoad,
@ -134,6 +135,8 @@
}); });
const template = computed(() => sheep.$store('app').template?.home); const template = computed(() => sheep.$store('app').template?.home);
const isLogin = computed(() => sheep.$store('user').isLogin);
const qualification = ref(false)
onLoad((options) => { onLoad((options) => {
// #ifdef MP // #ifdef MP
@ -171,11 +174,41 @@
onPageScroll(() => {}); onPageScroll(() => {});
function toPage() { const toPage = (e) => {
uni.navigateTo({ if(isLogin.value == true) {
url:'/packageA/search/index' uni.navigateTo({
}) url: e
})
qualification.value = true;
}else{
uni.showToast({
title: '请先登录',
icon: 'none',
duration: 2000
})
setTimeout(function() {
uni.switchTab({
url: '/pages/index/user'
})
}, 2000);
}
// uni.navigateTo({
// url:'/packageA/search/index'
// })
} }
function haveQualification() {
console.log('qualification',isLogin.value);
if(isLogin.value == true) {
qualification.value = true;
}else{
qualification.value = true;
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -3,86 +3,173 @@
:navbarStyle="template.style?.navbar" onShareAppMessage :showFloatButton="true"> :navbarStyle="template.style?.navbar" onShareAppMessage :showFloatButton="true">
<!-- 登录信息 --> <!-- 登录信息 -->
<view class="myBox"> <view class="myBox">
<view @touchmove.prevent scroll-y="true" :show-scrollbar="true" <view @touchmove.prevent scroll-y="true" :show-scrollbar="true"
class="con-center flex flex-start flex-column"> class="con-center flex flex-start flex-column">
<view class="header"> <view class="header">
<!-- 用户信息 --> <!-- 用户信息 -->
<view class="hea-left flex"> <view class="hea-left flex">
<view class="head-avatar" @click="toLogin"> <view class="head-avatar" v-if="isLogin == true" @click="sheep.$router.go('/pages/user/info')">
<image style="width: 130rpx;height: 130rpx;border-radius: 152rpx;" <image style="width: 130rpx;height: 130rpx;border-radius: 152rpx;" :src="baseUrl + userInfo.avatar"></image>
src="/static/wechat.png"></image>
</view>
<view class="headAvatar-info justify-start">
<view class="info-name fs-36 weight8 flexD">会飞的蜗牛
<view class="authenticationBox weight8 fs-20">已认证</view>
</view>
<view class="fs-28 weight4" style="margin-top: 30rpx;">剩余拨打次数 10</view>
</view>
<view class="head-signInBox">
<image style="width: 46rpx;height: 44rpx;" src="https://jiangxiaoxian.0rui.cn/signIn.png" mode=""></image>
<view class="signInText" style="margin-left: 10rpx;">签到</view>
</view>
</view> </view>
<view class="head-avatar" v-else @click="toLogin">
<!-- 四个主内容 --> <image style="width: 130rpx;height: 130rpx;border-radius: 152rpx;" src="/static/wechat.png">
<view class="head-secondBox"> </image>
<view class="collect">
<view class="collect-num">14</view>
<view class="collect-text">收藏</view>
</view>
<view class="feetPrint">
<view class="feetPrint-num">14</view>
<view class="feetPrint-text">足迹</view>
</view>
<view class="feetPrint">
<view class="feetPrint-num">14</view>
<view class="feetPrint-text">积分</view>
</view>
<view class="collect">
<view class="collect-num">14</view>
<view class="collect-text">优惠券</view>
</view>
</view> </view>
</view> <view class="headAvatar-info justify-start">
<view class="info-name fs-36 weight8 flexD" v-if="isLogin == true">
<!-- 我的订单 --> <view style="font-weight: 800;" @click="toLogin">{{ userInfo.nickname}} </view>
<view class="myOrder"> <view class="UnAuthenBox weight8 fs-20" v-if="authenInfo.status == -1 ">未认证</view>
<view class="myOrder-first"> <view class="authenticationBox weight8 fs-20" v-if="authenInfo.status == 1 ">已认证</view>
<view style="font-weight: 800;font-size: 34rpx;line-height: 28rpx;color: #3d3d3d;">我的订单</view>
<view style="display: flex;align-items: center;justify-content: center;">
<view style="font-size: 26rpx;line-height: 26rpx;font-weight: 400;color: #999999;">全部订单</view>
<image style="width: 28rpx;height: 28rpx;margin-left: 10rpx;" src="https://jiangxiaoxian.0rui.cn/rightMore.png" mode=""></image>
<!-- <uni-icons type="arrowthinright" color="#999" style="line-height: 40px;"></uni-icons> -->
</view> </view>
<view class="info-name fs-36 weight8 flexD" v-else>
<view style="font-weight: 800;" @click="toLogin">登录/注册</view>
<!-- <view class="UnAuthenBox weight8 fs-20" v-if="authenInfo.status == -1 && isLogin == true">未认证</view>
<view class="authenticationBox weight8 fs-20" v-if="authenInfo.status == 1 && isLogin == true">已认证</view> -->
</view>
<view class="fs-28 weight4" style="margin-top: 30rpx;">剩余拨打次数 {{ userInfo.mobile_num ? userInfo.mobile_num : 0 }}</view>
</view> </view>
<view class="myOrder-second"> <view class="head-signInBox">
<view class="pendingBox"> <image style="width: 46rpx;height: 44rpx;" src="https://jiangxiaoxian.0rui.cn/signIn.png"
<image class="pendImg" src="https://jiangxiaoxian.0rui.cn/pendPay.png"></image> mode=""></image>
<view class="fs-28 weight4" style="margin-top: 20rpx;color: #3d3d3d;">待支付</view> <view class="signInText" style="margin-left: 10rpx;">签到</view>
</view>
<view class="pendingBox">
<image class="pendImg" src="https://jiangxiaoxian.0rui.cn/shipment.png"></image>
<view class="fs-28 weight4" style="margin-top: 20rpx;color: #3d3d3d;">待发货</view>
</view>
<view class="pendingBox">
<image class="pendImg" src="https://jiangxiaoxian.0rui.cn/pendingDoods.png"></image>
<view class="fs-28 weight4" style="margin-top: 20rpx;color: #3d3d3d;">待收货</view>
</view>
<view class="pendingBox">
<image class="pendImg" src="https://jiangxiaoxian.0rui.cn/completed.png"></image>
<view class="fs-28 weight4" style="margin-top: 20rpx;color: #3d3d3d;">已完成</view>
</view>
</view> </view>
</view> </view>
<!-- 四个主内容 -->
<view class="head-secondBox">
<view class="collect">
<view class="collect-num">14</view>
<view class="collect-text">收藏</view>
</view>
<view class="feetPrint">
<view class="feetPrint-num">14</view>
<view class="feetPrint-text">足迹</view>
</view>
<view class="feetPrint">
<view class="feetPrint-num">{{ userInfo.score ? userInfo.score : 0 }}</view>
<view class="feetPrint-text">积分</view>
</view>
<view class="collect">
<view class="collect-num">14</view>
<view class="collect-text">优惠券</view>
</view>
</view>
</view>
<!-- 我的订单 -->
<view class="myOrder">
<view class="myOrder-first">
<view style="font-weight: 800;font-size: 34rpx;line-height: 28rpx;color: #3d3d3d;">我的订单</view>
<view style="display: flex;align-items: center;justify-content: center;">
<view style="font-size: 26rpx;line-height: 26rpx;font-weight: 400;color: #999999;">全部订单
</view>
<image style="width: 28rpx;height: 28rpx;margin-left: 10rpx;"
src="https://jiangxiaoxian.0rui.cn/rightMore.png" mode=""></image>
<!-- <uni-icons type="arrowthinright" color="#999" style="line-height: 40px;"></uni-icons> -->
</view>
</view>
<view class="myOrder-second">
<view class="pendingBox">
<image class="pendImg" src="https://jiangxiaoxian.0rui.cn/pendPay.png"></image>
<view class="fs-28 weight4" style="margin-top: 20rpx;color: #3d3d3d;">待支付</view>
</view>
<view class="pendingBox">
<image class="pendImg" src="https://jiangxiaoxian.0rui.cn/shipment.png"></image>
<view class="fs-28 weight4" style="margin-top: 20rpx;color: #3d3d3d;">待发货</view>
</view>
<view class="pendingBox">
<image class="pendImg" src="https://jiangxiaoxian.0rui.cn/pendingDoods.png"></image>
<view class="fs-28 weight4" style="margin-top: 20rpx;color: #3d3d3d;">待收货</view>
</view>
<view class="pendingBox">
<image class="pendImg" src="https://jiangxiaoxian.0rui.cn/completed.png"></image>
<view class="fs-28 weight4" style="margin-top: 20rpx;color: #3d3d3d;">已完成</view>
</view>
</view>
</view>
<!-- 发布分享等 -->
<view class="sixBox">
<view class="fabuBox">
<view class="flex align-items">
<image style="width: 36rpx;height: 36rpx;margin-right: 20rpx;"
src="https://jiangxiaoxian.0rui.cn/myRelease.png"></image>
<view style="font-size: 30rpx;font-weight: 800;line-height: 28rpx;color: #333333;">我的发布
</view>
</view>
<image style="width: 28rpx;height: 28rpx;margin-left: 10rpx;"
src="https://jiangxiaoxian.0rui.cn/rightMore.png" mode=""></image>
</view>
<view class="line-row" style="margin: 30rpx 0;"></view>
<view class="fabuBox">
<view class="flex align-items">
<image style="width: 36rpx;height: 36rpx;margin-right: 20rpx;"
src="https://jiangxiaoxian.0rui.cn/points.png"></image>
<view style="font-size: 30rpx;font-weight: 800;line-height: 28rpx;color: #333333;">积分商城
</view>
</view>
<image style="width: 28rpx;height: 28rpx;margin-left: 10rpx;"
src="https://jiangxiaoxian.0rui.cn/rightMore.png" mode=""></image>
</view>
<view class="line-row" style="margin: 30rpx 0;"></view>
<view class="fabuBox">
<view class="flex align-items">
<image style="width: 36rpx;height: 36rpx;margin-right: 20rpx;"
src="https://jiangxiaoxian.0rui.cn/share.png"></image>
<view style="font-size: 30rpx;font-weight: 800;line-height: 28rpx;color: #333333;">分享好友
</view>
</view>
<image style="width: 28rpx;height: 28rpx;margin-left: 10rpx;"
src="https://jiangxiaoxian.0rui.cn/rightMore.png" mode=""></image>
</view>
<view class="line-row" style="margin: 30rpx 0;"></view>
<view class="fabuBox">
<view class="flex align-items">
<image style="width: 36rpx;height: 36rpx;margin-right: 20rpx;"
src="https://jiangxiaoxian.0rui.cn/service.png"></image>
<view style="font-size: 30rpx;font-weight: 800;line-height: 28rpx;color: #333333;">官方客服
</view>
</view>
<image style="width: 28rpx;height: 28rpx;margin-left: 10rpx;"
src="https://jiangxiaoxian.0rui.cn/rightMore.png" mode=""></image>
</view>
<view class="line-row" style="margin: 30rpx 0;"></view>
<view class="fabuBox">
<view class="flex align-items">
<image style="width: 36rpx;height: 36rpx;margin-right: 20rpx;"
src="https://jiangxiaoxian.0rui.cn/feedBack.png"></image>
<view style="font-size: 30rpx;font-weight: 800;line-height: 28rpx;color: #333333;">意见反馈
</view>
</view>
<image style="width: 28rpx;height: 28rpx;margin-left: 10rpx;"
src="https://jiangxiaoxian.0rui.cn/rightMore.png" mode=""></image>
</view>
<view class="line-row" style="margin: 30rpx 0;"></view>
<view class="fabuBox" @click="toSetting">
<view class="flex align-items">
<image style="width: 36rpx;height: 36rpx;margin-right: 20rpx;"
src="https://jiangxiaoxian.0rui.cn/setUp.png"></image>
<view style="font-size: 30rpx;font-weight: 800;line-height: 28rpx;color: #333333;" >设置</view>
</view>
<image style="width: 28rpx;height: 28rpx;margin-left: 10rpx;"
src="https://jiangxiaoxian.0rui.cn/rightMore.png" mode=""></image>
</view>
<view style="height: 80rpx;width: 100%;"></view>
</view> </view>
<view style="height: 180rpx;width: 100%;"></view>
</view>
<!-- 授权登录
<!-- 授权登录
<u-popup :show="showLogin == true" type="center" round="20" <u-popup :show="showLogin == true" type="center" round="20"
:customStyle="{ 'width': '644rpx', 'height': '426rpx','position': 'relative'}" :closeable="false" :customStyle="{ 'width': '644rpx', 'height': '426rpx','position': 'relative'}" :closeable="false"
@close="closeLogin" @open="openLogin"> @close="closeLogin" @open="openLogin">
@ -92,16 +179,16 @@
</button> </button>
</view> </view>
</u-popup>--> </u-popup>-->
<su-popup :show="showLogin == true" type="center" round="10" :isMaskClick="false"> <su-popup :show="showLogin == true" type="center" round="10" :isMaskClick="false">
<view class="popup"> <view class="popup">
<button class="texbut" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber"> <button class="texbut" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
授权登录 授权登录
</button> </button>
</view> </view>
</su-popup> </su-popup>
<!-- <u-toast ref="uToast"></u-toast> --> <!-- <u-toast ref="uToast"></u-toast> -->
</view> </view>
@ -114,7 +201,8 @@
<script setup> <script setup>
import { import {
computed, computed,
ref ref,
reactive
} from 'vue'; } from 'vue';
import { import {
onShow, onShow,
@ -122,9 +210,16 @@
onPullDownRefresh onPullDownRefresh
} from '@dcloudio/uni-app'; } from '@dcloudio/uni-app';
import sheep from '@/sheep'; import sheep from '@/sheep';
import userApi from '@/sheep/api/user';
import third from '@/sheep/api/third';
import {
baseUrl,
} from '@/sheep/config';
const showLogin = ref(false); const showLogin = ref(false);
const iv = ref('');
const wxCode = ref('');
const encryptedData = ref('');
// tabBar // tabBar
uni.hideTabBar({ uni.hideTabBar({
@ -133,6 +228,8 @@
const template = computed(() => sheep.$store('app').template.user); const template = computed(() => sheep.$store('app').template.user);
const isLogin = computed(() => sheep.$store('user').isLogin); const isLogin = computed(() => sheep.$store('user').isLogin);
const userInfo = computed(() => sheep.$store('user').userInfo);
const authenInfo = computed(() => sheep.$store('user').authenInfo);
onShow(() => { onShow(() => {
sheep.$store('user').updateUserData(); sheep.$store('user').updateUserData();
@ -146,21 +243,90 @@
}); });
onPageScroll(() => {}); onPageScroll(() => {});
//
function toLogin() { function toLogin() {
console.log('toLogin',showLogin.value); console.log('toLogin', showLogin.value);
showLogin.value = true; showLogin.value = true;
console.log('showLogin',showLogin.value); console.log('showLogin', showLogin.value);
} }
//
function closeLogin() { function closeLogin() {
console.log('closeLogin'); console.log('closeLogin');
showLogin.value = false; showLogin.value = false;
} }
//
function openLogin() { function openLogin() {
console.log('openLogin'); console.log('openLogin');
showLogin.value = true; showLogin.value = true;
} }
// 使
async function getPhoneNumber(e) {
console.log('获取手机号', e, e.detail.errMsg);
if (e.detail.errMsg !== 'getPhoneNumber:ok') {} else {
encryptedData.value = e.detail.encryptedData //
iv.value = e.detail.iv //
getCode()
// let result = await sheep.$platform.useProvider().bindUserPhoneNumber(e.detail);
// console.log('result', result);
// if (result) {
// sheep.$store('user').getInfo();
// // closeAuthModal();
// closeLogin();
// }
}
}
// codesessionId
function getCode() {
uni.login({
provider: 'weixin',
success: (res) => {
wxCode.value = res.code
// loginResult.value = res
// getSessionId();
Login();
}
})
}
//
function Login() {
const session_id = uni.getStorageSync('sessionId')
console.log('session_id', session_id);
return new Promise(async (resolve, reject) => {
const {
code
} = await third.wechat.wxLogin({
platform: 'miniProgram',
payload: encodeURIComponent(
JSON.stringify({
sessionId: session_id,
iv: iv.value,
encryptedData: encryptedData.value,
code: wxCode.code,
}),
),
});
if (code === 1) {
resolve(true);
showLogin.value = false;
}
resolve(false);
});
}
//
function toSetting() {
console.log('isLogin',isLogin.value);
if(isLogin.value == true){
uni.navigateTo({
url:'/pages/user/info'
})
}else {
uni.showToast({
title: '请先登录',
icon: 'none'
})
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -168,7 +334,7 @@
width: 70rpx; width: 70rpx;
height: 70rpx; height: 70rpx;
} }
.weight4 { .weight4 {
font-weight: 400; font-weight: 400;
} }
@ -227,7 +393,7 @@
.justify-start { .justify-start {
justify-content: start; justify-content: start;
} }
.myBox { .myBox {
position: fixed; position: fixed;
width: 750rpx; width: 750rpx;
@ -238,13 +404,15 @@
} }
.con-center { .con-center {
height: 1314rpx; min-height: 80vh;
// padding: 0 30rpx; padding: 30 30rpx;
.header { .header {
width: 93%; width: 93%;
height: 620rpx; height: 580rpx;
padding: 0 30rpx; padding: 0 30rpx;
position: relative;
// top: 100rpx;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
// margin: 0 auto; // margin: 0 auto;
@ -281,7 +449,20 @@
justify-content: flex-start; justify-content: flex-start;
font-weight: 900rpx; font-weight: 900rpx;
align-items: center; align-items: center;
.UnAuthenBox {
margin-left: 10rpx;
background-color: #EBECEE;
border-radius: 8rpx;
width: 80rpx;
height: 30rpx;
color: #8D93B3;
display: flex;
padding: 5rpx 10rpx 9rpx 10rpx;
align-items: center;
justify-content: center;
}
.authenticationBox { .authenticationBox {
margin-left: 10rpx; margin-left: 10rpx;
@ -297,7 +478,7 @@
} }
} }
} }
.head-signInBox { .head-signInBox {
width: 156rpx; width: 156rpx;
height: 70rpx; height: 70rpx;
@ -308,7 +489,7 @@
background-color: #fff; background-color: #fff;
align-items: center; align-items: center;
border-radius: 116rpx 0 0 116rpx; border-radius: 116rpx 0 0 116rpx;
.signInText { .signInText {
font-size: 30rpx; font-size: 30rpx;
font-weight: 800; font-weight: 800;
@ -316,9 +497,9 @@
color: #333333; color: #333333;
} }
} }
.line { .line {
width: 320rpx; width: 320rpx;
height: 1rpx; height: 1rpx;
@ -335,7 +516,7 @@
line-height: 32rpx; line-height: 32rpx;
} }
} }
.head-secondBox { .head-secondBox {
margin-top: 50rpx; margin-top: 50rpx;
display: flex; display: flex;
@ -345,7 +526,7 @@
width: 100%; width: 100%;
position: relative; position: relative;
top: 190rpx; top: 190rpx;
.collect { .collect {
display: grid; display: grid;
align-items: center; align-items: center;
@ -353,14 +534,14 @@
justify-content: center; justify-content: center;
width: 158rpx; width: 158rpx;
height: 100%; height: 100%;
.collect-num { .collect-num {
font-size: 34rpx; font-size: 34rpx;
font-weight: 800; font-weight: 800;
color: #333333; color: #333333;
line-height: 28rpx; line-height: 28rpx;
} }
.collect-text { .collect-text {
margin-top: 20rpx; margin-top: 20rpx;
font-size: 28rpx; font-size: 28rpx;
@ -369,7 +550,7 @@
line-height: 28rpx; line-height: 28rpx;
} }
} }
.feetPrint { .feetPrint {
display: grid; display: grid;
align-items: center; align-items: center;
@ -377,14 +558,14 @@
justify-content: center; justify-content: center;
width: 188rpx; width: 188rpx;
height: 100%; height: 100%;
.feetPrint-num { .feetPrint-num {
font-size: 34rpx; font-size: 34rpx;
font-weight: 800; font-weight: 800;
color: #333333; color: #333333;
line-height: 28rpx; line-height: 28rpx;
} }
.feetPrint-text { .feetPrint-text {
margin-top: 20rpx; margin-top: 20rpx;
font-size: 28rpx; font-size: 28rpx;
@ -398,40 +579,67 @@
.line {} .line {}
} }
.myOrder { .myOrder {
width: 630rpx; width: 630rpx;
height: 206rpx; height: 206rpx;
margin: 0 auto; margin: 0 auto;
position: relative; position: relative;
bottom: 108rpx; bottom: 90rpx;
background-color: #ffffff; background-color: #ffffff;
border-radius: 18rpx; border-radius: 18rpx;
display: block; display: block;
padding: 40rpx 30rpx; padding: 40rpx 30rpx;
.myOrder-first { .myOrder-first {
width: 100%; width: 100%;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
} }
.myOrder-second { .myOrder-second {
width: 100%; width: 100%;
display: flex; display: flex;
margin-top: 40rpx; margin-top: 40rpx;
justify-content: space-between; justify-content: space-between;
.pendingBox { .pendingBox {
display: block; display: block;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
} }
} }
.sixBox {
width: 630rpx;
// height: 637rpx;
display: block;
background-color: #ffffff;
border-radius: 18rpx;
padding: 30rpx;
margin: 0 auto;
position: relative;
bottom: 50rpx;
.fabuBox {
display: flex;
align-items: center;
justify-content: space-between;
}
.line-row {
width: 630rpx;
height: 1rpx;
background: #EEEEEE;
border-radius: 0rpx 0rpx 0rpx 0rpx;
margin: 30rpx 0;
}
}
} }
@ -481,10 +689,6 @@
align-items: center; align-items: center;
} }
} }
</style> </style>

View File

@ -104,7 +104,7 @@
</uni-easyinput> </uni-easyinput>
</uni-forms-item> </uni-forms-item>
<uni-forms-item name="password" label="登录密码" @tap="onSetPassword"> <!-- <uni-forms-item name="password" label="登录密码" @tap="onSetPassword">
<uni-easyinput <uni-easyinput
v-model="userInfo.password" v-model="userInfo.password"
:placeholder="userInfo.verification?.password ? '修改登录密码' : '点击设置登录密码'" :placeholder="userInfo.verification?.password ? '修改登录密码' : '点击设置登录密码'"
@ -128,7 +128,7 @@
</view> </view>
</template> </template>
</uni-easyinput> </uni-easyinput>
</uni-forms-item> </uni-forms-item> -->
</view> </view>
<view class="bg-white ss-m-t-14"> <view class="bg-white ss-m-t-14">
@ -153,7 +153,7 @@
</view> </view>
</uni-forms> </uni-forms>
<view v-if="sheep.$platform.name !== 'H5'"> <!-- <view v-if="sheep.$platform.name !== 'H5'">
<view class="title-box ss-p-l-30">第三方账号绑定</view> <view class="title-box ss-p-l-30">第三方账号绑定</view>
<view class="account-list ss-flex ss-row-between"> <view class="account-list ss-flex ss-row-between">
@ -204,11 +204,12 @@
</view> </view>
</view> </view>
</view> </view>
</view> </view> -->
<su-fixed bottom placeholder bg="none"> <su-fixed bottom placeholder bg="none">
<view class="footer-box ss-p-20"> <view class="footer-box ss-p-20">
<button class="ss-rest-button logout-btn ui-Shadow-Main" @tap="onSubmit">保存</button> <button class="ss-rest-button logout-btn " @click="onSubmit">保存</button>
<button class="ss-rest-button exit-btn " @click="onLogout">退出登录</button>
</view> </view>
</su-fixed> </su-fixed>
</s-layout> </s-layout>
@ -339,6 +340,23 @@ const getUserInfo = async () => {
} }
}; };
//退
function onLogout() {
uni.showModal({
title: '提示',
content: '确认退出账号?',
success: async function (res) {
if (res.confirm) {
const result = await sheep.$store('user').logout();
if (result) {
sheep.$router.go('/pages/index/user');
}
}
},
});
}
onBeforeMount(async () => { onBeforeMount(async () => {
getUserInfo(); getUserInfo();
}); });
@ -394,13 +412,25 @@ onBeforeMount(async () => {
.logout-btn { .logout-btn {
width: 710rpx; width: 710rpx;
height: 80rpx; height: 80rpx;
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient)); background: linear-gradient(90deg,#FCCA58, #FFBD25);
border-radius: 40rpx; border-radius: 40rpx;
font-size: 30rpx; font-size: 30rpx;
font-weight: 500; font-weight: 500;
color: $white; color: $white;
} }
.exit-btn {
width: 710rpx;
height: 80rpx;
background: #ffffff;
border-radius: 40rpx;
border: 2rpx solid #999999;
font-size: 30rpx;
font-weight: 800;
color: #999999;
margin-top: 30rpx;
}
.radio-dark { .radio-dark {
filter: grayscale(100%); filter: grayscale(100%);
filter: gray; filter: gray;

13
sheep/api/login.js Normal file
View File

@ -0,0 +1,13 @@
import request from '@/sheep/request';
import $platform from '@/sheep/platform';
export default {
wxLogin: (path) =>
`${baseUrl}${apiPath}third.wechat/loginByMobile?platform=miniProgram&payload=${encodeURIComponent(
JSON.stringify({
path,
}),
)}`,
};

View File

@ -1,129 +1,149 @@
import request from '@/sheep/request'; import request from '@/sheep/request';
import { baseUrl, apiPath } from '@/sheep/config'; import {
baseUrl,
apiPath
} from '@/sheep/config';
export default { export default {
// 微信相关 // 微信相关
wechat: { wechat: {
// 第三方登录 // 第三方登录
login: (params, data) => login: (params, data) =>
request({ request({
url: 'third.wechat/login', url: 'third.wechat/login',
method: 'POST', method: 'POST',
params, params,
data, data,
custom: { custom: {
showSuccess: true, showSuccess: true,
loadingMsg: '登陆中', loadingMsg: '登陆中',
}, },
}), }),
// 绑定微信 // 绑定微信
bind: (params, data) => bind: (params, data) =>
request({ request({
url: 'third.wechat/bind', url: 'third.wechat/bind',
method: 'POST', method: 'POST',
params, params,
data, data,
custom: { custom: {
showSuccess: true, showSuccess: true,
loadingMsg: '绑定中', loadingMsg: '绑定中',
}, },
}), }),
// 解除绑定微信 // 解除绑定微信
unbind: (data) => unbind: (data) =>
request({ request({
url: 'third.wechat/unbind', url: 'third.wechat/unbind',
method: 'POST', method: 'POST',
data, data,
custom: { custom: {
showSuccess: true, showSuccess: true,
loadingMsg: '解除绑定', loadingMsg: '解除绑定',
}, },
}), }),
// 公众号授权 // 公众号授权
oauthLogin: (data) => oauthLogin: (data) =>
request({ request({
url: 'third.wechat/oauthLogin', url: 'third.wechat/oauthLogin',
method: 'GET', method: 'GET',
data, data,
custom: { custom: {
showSuccess: true, showSuccess: true,
loadingMsg: '登陆中', loadingMsg: '登陆中',
}, },
}), }),
// 获取小程序sessionKey后端不会给前端返回真实的sessionKey // 获取小程序sessionKey后端不会给前端返回真实的sessionKey
getSessionId: (data) => getSessionId: (data) =>
request({ request({
url: 'third.wechat/getSessionId', url: 'third.wechat/getSessionId',
method: 'POST', method: 'POST',
data, data,
custom: { custom: {
showLoading: false, showLoading: false,
}, },
}), }),
// 微信小程序 绑定一键获取的手机号 // 微信小程序 绑定一键获取的手机号
bindUserPhoneNumber: (data) => bindUserPhoneNumber: (data) =>
request({ request({
url: 'third.wechat/bindUserPhoneNumber', url: 'third.wechat/bindUserPhoneNumber',
method: 'POST', method: 'POST',
data, data,
custom: { custom: {
showSuccess: true, showSuccess: true,
loadingMsg: '获取中', loadingMsg: '获取中',
}, },
}), }),
// 网页jssdk // 网页jssdk
jssdk: (data) => jssdk: (data) =>
request({ request({
url: 'third.wechat/jssdk', url: 'third.wechat/jssdk',
method: 'GET', method: 'GET',
data, data,
custom: { custom: {
showError: false, showError: false,
showLoading: false, showLoading: false,
}, },
}), }),
// 小程序订阅消息 // 小程序订阅消息
subscribeTemplate: (params) => subscribeTemplate: (params) =>
request({ request({
url: 'third.wechat/subscribeTemplate', url: 'third.wechat/subscribeTemplate',
method: 'GET', method: 'GET',
params: { params: {
platform: 'miniProgram', platform: 'miniProgram',
}, },
custom: { custom: {
showError: false, showError: false,
showLoading: false, showLoading: false,
}, },
}), }),
// 获取微信小程序码 // 获取微信小程序码
getWxacode: (path) => getWxacode: (path) =>
`${baseUrl}${apiPath}third.wechat/wxacode?platform=miniProgram&payload=${encodeURIComponent( `${baseUrl}${apiPath}third.wechat/wxacode?platform=miniProgram&payload=${encodeURIComponent(
JSON.stringify({ JSON.stringify({
path, path,
}), }),
)}`, )}`,
},
// 苹果相关
apple: { //自定义的登录接口
// 第三方登录 wxLogin: (data) =>
login: (data) => request({
request({ url: 'third.wechat/loginByMobile',
url: 'third.apple/login', method: 'POST',
method: 'POST', data,
data, custom: {
custom: { showSuccess: true,
showSuccess: true, loadingMsg: '登录中',
loadingMsg: '登陆中', },
}, }),
}), },
},
}; // 苹果相关
apple: {
// 第三方登录
login: (data) =>
request({
url: 'third.apple/login',
method: 'POST',
data,
custom: {
showSuccess: true,
loadingMsg: '登陆中',
},
}),
},
};

View File

@ -11,6 +11,15 @@ export default {
auth: true, auth: true,
}, },
}), }),
authen: () =>
request({
url: 'meal.auth/info',
method: 'GET',
custom: {
showLoading: false,
auth: true,
},
}),
update: (data) => update: (data) =>
request({ request({
url: 'user.user/update', url: 'user.user/update',
@ -337,4 +346,6 @@ export default {
auth: true, auth: true,
}, },
}), }),
}; };

View File

@ -1,15 +1,15 @@
<!-- 绑定/更换手机号 changeMobile --> <!-- 绑定/更换手机号 changeMobile -->
<template> <template>
<view> <view>
<!-- 标题栏 --> <!-- 标题栏
<view class="head-box ss-m-b-60"> <view class="head-box ss-m-b-60">
<view class="head-title ss-m-b-20"> <view class="head-title ss-m-b-20">
{{ userInfo.verification.mobile ? '更换手机号' : '绑定手机号' }} {{ userInfo.verification.mobile ? '更换手机号' : '绑定手机号' }}
</view> </view>
<view class="head-subtitle">为了您的账号安全请使用本人手机号码</view> <view class="head-subtitle">为了您的账号安全请使用本人手机号码</view>
</view> </view>-->
<!-- 表单项 --> <!-- 表单项
<uni-forms <uni-forms
ref="changeMobileRef" ref="changeMobileRef"
v-model="state.model" v-model="state.model"
@ -54,14 +54,15 @@
</uni-easyinput> </uni-easyinput>
</uni-forms-item> </uni-forms-item>
</uni-forms> </uni-forms>
<button -->
<!-- <button
v-if="'WechatMiniProgram' === sheep.$platform.name" v-if="'WechatMiniProgram' === sheep.$platform.name"
class="ss-reset-button type-btn" class="ss-reset-button type-btn"
open-type="getPhoneNumber" open-type="getPhoneNumber"
@getphonenumber="getPhoneNumber" @getphonenumber="getPhoneNumber"
> >
使用微信手机号 使用微信手机号
</button> </button> -->
</view> </view>
</template> </template>

View File

@ -2,12 +2,12 @@
<template> <template>
<view> <view>
<!-- 标题栏 --> <!-- 标题栏 -->
<view class="head-box ss-m-b-60"> <!-- <view class="head-box ss-m-b-60">
<view class="head-title ss-m-b-20">重置密码</view> <view class="head-title ss-m-b-20">重置密码</view>
<view class="head-subtitle">为了您的账号安全设置密码前请先进行安全验证</view> <view class="head-subtitle">为了您的账号安全设置密码前请先进行安全验证</view>
</view> </view> -->
<!-- 表单项 --> <!-- 表单项
<uni-forms <uni-forms
ref="resetPasswordRef" ref="resetPasswordRef"
v-model="state.model" v-model="state.model"
@ -61,10 +61,10 @@
</uni-easyinput> </uni-easyinput>
</uni-forms-item> </uni-forms-item>
</uni-forms> </uni-forms>
-->
<button v-if="!isLogin" class="ss-reset-button type-btn" @tap="showAuthModal('accountLogin')"> <!-- <button v-if="!isLogin" class="ss-reset-button type-btn" @tap="showAuthModal('accountLogin')">
返回登录 返回登录
</button> </button> -->
</view> </view>
</template> </template>

View File

@ -1,49 +1,58 @@
<template> <template>
<!-- 规格弹窗 --> <!-- 规格弹窗 -->
<su-popup :show="authType !== ''" round="10" :showClose="true" @close="closeAuthModal"> <su-popup :show="showLogin == true" type="center" round="10" :isMaskClick="false">
<view class="popup">
<button class="texbut" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
授权登录
</button>
</view>
</su-popup>
<!-- <su-popup :show="authType !== ''" round="10" :showClose="true" @close="closeAuthModal">
<view class="login-wrap"> <view class="login-wrap">
<!-- 1. 账号密码登录 accountLogin --> 1. 账号密码登录 accountLogin
<account-login <account-login
v-if="authType === 'accountLogin'" v-if="authType === 'accountLogin'"
:agreeStatus="state.protocol" :agreeStatus="state.protocol"
@onConfirm="onConfirm" @onConfirm="onConfirm"
/> />
<!-- 2.短信登录 smsLogin --> 2.短信登录 smsLogin
<sms-login <sms-login
v-if="authType === 'smsLogin'" v-if="authType === 'smsLogin'"
:agreeStatus="state.protocol" :agreeStatus="state.protocol"
@onConfirm="onConfirm" @onConfirm="onConfirm"
/> />
<!-- 3.短信注册 smsRegister--> 3.短信注册 smsRegister
<sms-register <sms-register
v-if="authType === 'smsRegister'" v-if="authType === 'smsRegister'"
:agreeStatus="state.protocol" :agreeStatus="state.protocol"
@onConfirm="onConfirm" @onConfirm="onConfirm"
/> />
<!-- 4.忘记密码 resetPassword--> 4.忘记密码 resetPassword
<reset-password v-if="authType === 'resetPassword'" /> <reset-password v-if="authType === 'resetPassword'" />
<!-- 5.绑定手机号 changeMobile --> 5.绑定手机号 changeMobile
<change-mobile v-if="authType === 'changeMobile'" /> <change-mobile v-if="authType === 'changeMobile'" />
<!-- 6.修改密码 changePassword--> 6.修改密码 changePassword
<change-password v-if="authType === 'changePassword'" /> <change-password v-if="authType === 'changePassword'" />
<!-- 7.修改用户名 changeUsername--> 7.修改用户名 changeUsername
<change-username v-if="authType === 'changeUsername'" /> <change-username v-if="authType === 'changeUsername'" />
<!-- 8.微信小程序授权 mpAuthorization--> 8.微信小程序授权 mpAuthorization
<mp-authorization v-if="authType === 'mpAuthorization'" /> <mp-authorization v-if="authType === 'mpAuthorization'" />
<!-- 第三方登录+注册 --> 第三方登录+注册
<view <view
v-if="['accountLogin', 'smsLogin'].includes(authType)" v-if="['accountLogin', 'smsLogin'].includes(authType)"
class="auto-login-box ss-flex ss-flex-col ss-row-center ss-col-center" class="auto-login-box ss-flex ss-flex-col ss-row-center ss-col-center"
> >
<!-- 立即注册&快捷登录 TextButton --> 立即注册&快捷登录 TextButton
<view v-if="sheep.$platform.name === 'WechatMiniProgram'" class="ss-flex register-box"> <view v-if="sheep.$platform.name === 'WechatMiniProgram'" class="ss-flex register-box">
<view class="register-title">还没有账号?</view> <view class="register-title">还没有账号?</view>
<button class="ss-reset-button register-btn" @tap="showAuthModal('smsRegister')" <button class="ss-reset-button register-btn" @tap="showAuthModal('smsRegister')"
@ -62,7 +71,7 @@
立即注册 立即注册
</button> </button>
<!-- 公众号|App微信登录 --> 公众号|App微信登录
<button <button
v-if=" v-if="
['WechatOfficialAccount', 'App'].includes(sheep.$platform.name) && ['WechatOfficialAccount', 'App'].includes(sheep.$platform.name) &&
@ -77,7 +86,7 @@
></image> ></image>
</button> </button>
<!-- iOS登录 --> iOS登录
<button <button
v-if="sheep.$platform.os === 'ios' && sheep.$platform.name === 'App'" v-if="sheep.$platform.os === 'ios' && sheep.$platform.name === 'App'"
@tap="thirdLogin('apple')" @tap="thirdLogin('apple')"
@ -122,7 +131,7 @@
</view> </view>
<view class="safe-box"></view> <view class="safe-box"></view>
</view> </view>
</su-popup> </su-popup> -->
</template> </template>
<script setup> <script setup>
@ -265,4 +274,50 @@
.agreement-text { .agreement-text {
color: $dark-9; color: $dark-9;
} }
.popup {
background-image: url('https://jiangxiaoxian.0rui.cn/showLogin.png');
background-size: 100%;
width: 600rpx;
height: 640rpx;
display: flex;
padding-bottom: 44rpx;
flex-direction: column;
align-items: baseline;
justify-content: flex-end;
padding-left: 73rpx;
padding-right: 73rpx;
.img_shouquan {
position: absolute;
width: 680rpx;
height: 857rpx;
left: -25rpx;
top: -390rpx;
}
#txt2 {
text-align: center;
margin-top: 200rpx;
font-size: 28rpx;
color: #525252;
margin-bottom: 60rpx;
position: relative;
font-weight: 500;
}
.texbut {
width: 507rpx;
height: 90rpx;
border-radius: 45rpx;
background: #ffbd25;
font-size: 34rpx;
color: #3d3d3d;
font-weight: bold;
display: flex;
justify-content: center;
align-items: center;
}
}
</style> </style>

View File

@ -50,7 +50,7 @@
<view class="page-modal"> <view class="page-modal">
<!-- 全局授权弹窗 --> <!-- 全局授权弹窗 -->
<s-auth-modal /> <!-- <s-auth-modal /> -->
<!-- 全局分享弹窗 --> <!-- 全局分享弹窗 -->
<s-share-modal :shareInfo="shareInfo" /> <s-share-modal :shareInfo="shareInfo" />
<!-- 全局快捷入口 --> <!-- 全局快捷入口 -->

View File

@ -63,9 +63,18 @@ const user = defineStore({
const { code, data } = await userApi.profile(); const { code, data } = await userApi.profile();
if (code !== 1) return; if (code !== 1) return;
this.userInfo = data; this.userInfo = data;
this.getAuthenInfo();
return Promise.resolve(data); return Promise.resolve(data);
}, },
// 获取个人认证信息
async getAuthenInfo() {
const { code, data } = await userApi.authen();
if (code !== 1) return;
this.authenInfo = data;
// this.authenInfo();
return Promise.resolve(data);
},
// 获取分销商信息 // 获取分销商信息
async getAgentInfo() { async getAgentInfo() {