重构框架

This commit is contained in:
2024-08-14 06:39:28 +08:00
parent 24e63cf551
commit 10533eb67d
166 changed files with 11388 additions and 856 deletions
+101 -80
View File
@@ -3,7 +3,7 @@
<!-- 顶部距离 -->
<view class="header" :style="'margin-top: ' + statusBarHeight + 'px'"></view>
<!-- 用户信息 -->
<ws-user-card :data="userInfo" :users="users" :is-login="isLogin" @openLogin="openLogin" @done="reload"/>
<ws-user-card :data="userInfo" :users="users" :isLogin="isLogin" @openLogin="openLogin" @done="reload"/>
<block v-if="hideTools">
<uni-card :border="false" :padding="'18px 8px'">
<uv-skeleton rows="2" :loading="hideTools" :title="false"></uv-skeleton>
@@ -20,50 +20,50 @@
<!-- 我的订单 -->
<!-- <ws-user-order :order="order" :is-login="isLogin" @done="openLogin"></ws-user-order> -->
<!-- 其他功能 -->
<!-- <uni-card :border="false" :padding="0">-->
<!-- &lt;!&ndash; 场馆管理可见&ndash;&gt;-->
<!-- <block v-if="hasMerchantRole || hasMerchantClerkRole">-->
<!-- <view class="server" style="min-height: 200px">-->
<!-- <uni-list :border="false">-->
<!-- <block v-for="(item, index) in mpMenus" :key="index">-->
<!-- <block v-if="index === '1981'" v-for="(v,i) in item">-->
<!-- <uni-list-item :thumb="v.avatar" link @click="navTo(v)">-->
<!-- <template v-slot:body>-->
<!-- <view class="slot-box">-->
<!-- <text class="slot-text" :style="{ color: v.color ? v.color : '#333333' }">{{-->
<!-- v.title-->
<!-- }}-->
<!-- </text>-->
<!-- </view>-->
<!-- </template>-->
<!-- </uni-list-item>-->
<!-- </block>-->
<!-- </block>-->
<!-- </uni-list>-->
<!-- </view>-->
<!-- </block>-->
<!-- <block v-else>-->
<!-- &lt;!&ndash; 普通会员菜单 &ndash;&gt;-->
<!-- <view class="server" style="min-height: 200px">-->
<!-- <uni-list :border="false">-->
<!-- <block v-for="(item, index) in mpMenus" :key="index">-->
<!-- <block v-if="index === '1981'" v-for="(v,i) in item">-->
<!-- <uni-list-item :thumb="v.avatar" link @click="navTo(v)">-->
<!-- <template v-slot:body>-->
<!-- <view class="slot-box">-->
<!-- <text class="slot-text" :style="{ color: v.color ? v.color : '#333333' }">{{-->
<!-- v.title-->
<!-- }}-->
<!-- </text>-->
<!-- </view>-->
<!-- </template>-->
<!-- </uni-list-item>-->
<!-- </block>-->
<!-- </block>-->
<!-- </uni-list>-->
<!-- </view>-->
<!-- </block>-->
<!-- </uni-card>-->
<!-- <uni-card :border="false" :padding="0">-->
<!-- &lt;!&ndash; 场馆管理可见&ndash;&gt;-->
<!-- <block v-if="hasMerchantRole || hasMerchantClerkRole">-->
<!-- <view class="server" style="min-height: 200px">-->
<!-- <uni-list :border="false">-->
<!-- <block v-for="(item, index) in mpMenus" :key="index">-->
<!-- <block v-if="index === '1981'" v-for="(v,i) in item">-->
<!-- <uni-list-item :thumb="v.avatar" link @click="navTo(v)">-->
<!-- <template v-slot:body>-->
<!-- <view class="slot-box">-->
<!-- <text class="slot-text" :style="{ color: v.color ? v.color : '#333333' }">{{-->
<!-- v.title-->
<!-- }}-->
<!-- </text>-->
<!-- </view>-->
<!-- </template>-->
<!-- </uni-list-item>-->
<!-- </block>-->
<!-- </block>-->
<!-- </uni-list>-->
<!-- </view>-->
<!-- </block>-->
<!-- <block v-else>-->
<!-- &lt;!&ndash; 普通会员菜单 &ndash;&gt;-->
<!-- <view class="server" style="min-height: 200px">-->
<!-- <uni-list :border="false">-->
<!-- <block v-for="(item, index) in mpMenus" :key="index">-->
<!-- <block v-if="index === '1981'" v-for="(v,i) in item">-->
<!-- <uni-list-item :thumb="v.avatar" link @click="navTo(v)">-->
<!-- <template v-slot:body>-->
<!-- <view class="slot-box">-->
<!-- <text class="slot-text" :style="{ color: v.color ? v.color : '#333333' }">{{-->
<!-- v.title-->
<!-- }}-->
<!-- </text>-->
<!-- </view>-->
<!-- </template>-->
<!-- </uni-list-item>-->
<!-- </block>-->
<!-- </block>-->
<!-- </uni-list>-->
<!-- </view>-->
<!-- </block>-->
<!-- </uni-card>-->
<block v-for="(item, index) in mpMenus" :key="index">
<block v-if="index === '1981'">
@@ -71,8 +71,9 @@
<uv-skeleton rows="1" rowsHeight="30" rowsWidth="100%" :loading="mpMenus.length === 0" :title="false">
<div class="flex space-around py-6 flex-wrap">
<block v-for="(item,index) in item" :key="index">
<div class="service-item flex flex-col justify-center items-center web-cell-content web-text-center px-20"
@click="navTo(item)">
<div
class="service-item flex flex-col justify-center items-center web-cell-content web-text-center px-20"
@click="navTo(item)">
<image :src="item.avatar" style="width: 30px; height: 30px;" mode="widthFix"></image>
<text style="white-space: nowrap">{{ item.title }}</text>
</div>
@@ -87,8 +88,9 @@
<uv-skeleton rows="1" rowsHeight="30" rowsWidth="100%" :loading="mpMenus.length === 0" :title="false">
<div class="flex space-around py-6 flex-wrap">
<block v-for="(item,index) in item" :key="index">
<div class="service-item flex flex-col justify-center items-center web-cell-content web-text-center px-20"
@click="navTo(item)">
<div
class="service-item flex flex-col justify-center items-center web-cell-content web-text-center px-20"
@click="navTo(item)">
<image :src="item.avatar" style="width: 30px; height: 30px;" mode="widthFix"></image>
<text style="white-space: nowrap">{{ item.title }}</text>
</div>
@@ -98,9 +100,7 @@
</uv-skeleton>
</uni-card>
</block>
</block>
<!-- <ws-personal :form="users" ref="personal" @done="reload" />-->
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload"/>
@@ -112,13 +112,12 @@
<script>
import {useUserStore} from '@/store/modules/user';
import * as UserApi from '@/api/booking/users';
import * as MpMenuApi from '@/api/cms/mp-menu';
import * as UserCardApi from '@/api/booking/userCard';
import {updateUsers} from '@/api/shop/users';
import {getThinkUsers,updateThinkUsers} from '@/api/think/thinkUsers';
import {openUrl} from '@/utils/common';
import {useMpStore} from "@/store/modules/mp";
import {getWxOpenId} from '@/api/passport/login';
import {getWxOpenId, loginByOpenId} from '@/api/passport/login';
import Layout from "@/components/layout.vue";
import {useTenantStore} from '@/store/modules/tenant';
@@ -181,42 +180,64 @@ export default {
app.fields[key] = d.value;
});
}
if (uni.getStorageSync('phone')) {
app.isLogin = true;
}
// 获取旧系统用户信息
if(uni.getStorageSync('uid')){
await getThinkUsers(uni.getStorageSync('uid')).then(data => {
app.users = data;
console.log(app.users,'>>>>')
})
}
// 当前登录用户信息
const userInfo = await userStore.fetchUserInfo();
if (Object.keys(userInfo).length > 0) {
app.isLogin = true;
app.userInfo = userInfo;
app.userInfo.avatarUrl = uni.getStorageSync('avatarUrl')
uni.setStorageSync('user_id', app.userInfo.userId);
// 更新第三方系统的用户ID
if(!userInfo.uid && uni.getStorageSync('uid')){
await authUser({uid: uni.getStorageSync('uid')}).then(res => {
console.log('更新第三方系统的用户ID')
})
}
// 判断用户角色
app.hasMerchantRole = userInfo.roles.find((d) => d.roleCode === 'merchant');
app.hasMerchantClerkRole = userInfo.roles.find((d) => d.roleCode === 'merchantClerk');
app.hasSuperAdminRole = userInfo.roles.find((d) => d.roleCode === 'superAdmin');
// 获取用户副表信息
await UserApi.getByPhone({
openId: userInfo.openid
}).then((data) => {
if (data) {
app.users = data;
uni.setStorageSync('uid', data.id);
data.points = data.integral
data.balance = data.money
data.isAdmin = 2 === data.isAdmin
data.idCardNo = data.idCard
data.nickname = data.username
data.avatar = data.avatarUrl
data.createTime = uni.$uv.date(data.createTime,'yyyy-mm-dd hh:MM:ss')
authUser(data)
// app.userInfo = Object.assign({}, app.userInfo, data);
// if (!data.openId) {
// data.openId = app.userInfo.openid
// updateUsers(data);
// }
}
});
// app.users = {
// uid: uni.getStorageSync('uid'),
// phone: uni.getStorageSync('phone'),
// username: uni.getStorageSync('username'),
// avatarUrl: uni.getStorageSync('avatarUrl'),
// openid: uni.getStorageSync('openid')
// }
// await UserApi.getByPhone({
// openId: userInfo.openid
// }).then((data) => {
// if (data) {
// app.users = data;
// uni.setStorageSync('uid', data.id);
// data.points = data.integral
// data.balance = data.money
// data.isAdmin = 2 === data.isAdmin
// data.idCardNo = data.idCard
// data.nickname = data.username
// data.avatar = data.avatarUrl
// data.createTime = uni.$uv.date(data.createTime,'yyyy-mm-dd hh:MM:ss')
// authUser(data)
//
// // app.userInfo = Object.assign({}, app.userInfo, data);
// // if (!data.openId) {
// // data.openId = app.userInfo.openid
// // updateUsers(data);
// // }
// }
// });
if (!uni.getStorageSync('openid')) {
// 更新openid
@@ -305,7 +326,7 @@ page {
}
</style>
<style lang="scss">
.service-item{
.service-item {
width: 130rpx !important;
margin-bottom: 30rpx;
}