index.vue 6.13 KB
<template>
	<view class="page">
		<view>
			<view class="welcome">您好!<br />欢迎使用中跆协会员管理系统</view>
			<view class="flexbox">
				<view @click="goAddVip">添加会员</view>
				<view @click="goRenew">会员缴费</view>
				<view>缴费审核</view>
			</view>

		</view>
		<view>
			<uni-grid :column="4" :show-border="false" :square="false">
				<uni-grid-item v-for="(item ,index) in list" :index="index" :key="index">
					<view class="grid-item-box">
						<image class="image" :src="item.url" mode="aspectFill" />
						<text class="text">{{item.text}}</text>
						<view v-if="item.badge" class="grid-dot">
							<uni-badge :text="item.badge" :type="item.type" />
						</view>
					</view>
				</uni-grid-item>
			</uni-grid>
		</view>
		<uni-section title="待办提醒" padding>
			<template v-slot:right>
				<text @click="goMsgList" class="more">更多></text>
			</template>
			<view class="msglist">
				<view class="msgitem" v-for="n in messageList" @click="readMessage(n)">
					<text class="dot" :class="n.readFlag=='1'?'done':''"></text>
					<view class="tt esp">{{n.name}}</view>
					<view class="date">{{n.createTime}}</view>
				</view>
			</view>
		</uni-section>
	</view>
</template>

<script setup>
	import * as api from '@/common/api.js';
	import * as loginServer from '@/common/login.js';
	import {
		getWxUser,
		getWxUserPhone
	} from '@/common/login.js';
	import {
		onLoad,
		onShow,
		onReady,
		onShareAppMessage,
		onShareTimeline,
		onPullDownRefresh
	} from '@dcloudio/uni-app';
	import {
		ref,
		getCurrentInstance
	} from 'vue';


	const {
		proxy
	} = getCurrentInstance()
	const app = getApp();


	let proId;
	let goPath;
	const svId = ref(null);
	const list = ref([{
			url: '',
			text: '会员调动',
			badge: '0',
			type: "primary"
		},
		{
			url: '',
			text: '调动审核',
			badge: '1',
			type: "success"
		},
		{
			url: '',
			text: '级位考试申请',
			badge: '99',
			type: "warning"
		},
		{
			url: '',
			text: '级位考试审核',
			badge: '2',
			type: "error"
		},
		{
			url: '',
			text: '段位考试申请'
		},
		{
			url: '',
			text: '段位考试审核'
		},
		{
			url: '',
			text: '级位证书发送'
		},
		{
			url: '',
			text: '段位证书发送'
		}
	]);
	const messageList = ref([])
	onShow(() => {
		if (app.globalData.isLogin) {
			init();
		} else {

			app.firstLoadCallback = () => {
				init();
			};
		}
	})
	onLoad(option => {
		if (option.scene) {
			proId = decodeURIComponent(option.scene);
		} else {
			proId = option.proId;
		}

	});

	function gologin() {
		let path = '/pages/index/login';
		uni.navigateTo({
			url: path
		});
	}

	function goCenter() {
		let path = '/pages/usercenter/usercenter';
		uni.navigateTo({
			url: path
		});

	}

	function goAddVip() {
		let path = '/pages/personalVip/addVip';
		uni.navigateTo({
			url: path
		});
	}

	function goRenew() {
		let path = '/pages/personalVip/renew';
		uni.navigateTo({
			url: path
		});
	}

	function init() {
		api.getMessage({
			pageNum: 1,
			pageSize: 10
		}).then(res => {
			for (var d of res.rows) {
				switch (d.type) {
					case 30001:
						d.name = '你有一条会员缴费等待审批,点击去处理!'
						d.path = '/member/audit'
						break
					case 30002:
						d.name = '你有一条级位考试等待审批,点击去处理!'
						d.path = '/level/approval'
						break
					case 30003:
						d.name = '你有一条段位考试等待审批,点击去处理!'
						d.path = '/rank/approval'
						break
					case 30004:
						d.name = '你有一条会员调动等待审批,点击去处理!'
						d.path = '/member/mobillize'
						break
					case 30005:
						d.name = '你有一条团体会员认证等待审批,点击去处理!'
						d.path = '/group/authentication'
						break
					case 30006:
						d.name = '你有一条段位成绩等待审批,点击去处理!'
						d.path = '/rank/score/approval'
						break
					case 40001:
						d.name = '你有一条级位申请待提交,点击去处理!'
						d.path = '/level/apply/modify/' + d.eventId
						break
					case 40002:
						d.name = '你有一条段位申请待提交,点击去处理!'
						d.path = '/rank/apply/modify/' + d.eventId
						break
					case 40003:
						d.name = '你有一条成绩维护的数据待提交,点击去处理!'
						d.path = '/rank/score/modify/' + d.eventId
						break
					case 50001:
						d.name = '你有一条新的个人会员申请,点击去处理!'
						d.path = '/member/list'
						break
				}
			}
			messageList.value = res.rows
		})

	}

	function readMessage(item) {
		uni.navigateTo({
			url: item.path
		});
		api.reader({id: item.id}).then(res=>{
			item.readFlag = '1'
		})
	}

	function goMsgList() {
		let path = '/pages/index/msgList';
		uni.navigateTo({
			url: path
		});
	}

	function goItem(item) {
		if (item.path) {
			let path = item.path
			// if (checkUserPhone(path)) {
			uni.navigateTo({
				url: item.path
			});
			// }
		} else {
			uni.showToast({
				title: `暂未开放`,
				icon: 'none'
			});
		}

	}
</script>
<style scope lang="scss">
	.welcome {
		padding: 55rpx;
		line-height: 55rpx;
		font-size: 36rpx;
	}

	.flexbox {
		display: flex;
		justify-content: space-around;
	}

	.image {
		width: 25px;
		height: 25px;
	}

	.grid-item-box {
		flex: 1;
		// position: relative;
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding: 15px 0;
	}

	.grid-item-box-row {
		flex: 1;
		// position: relative;
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		align-items: center;
		justify-content: center;
		padding: 15px 0;
	}

	.grid-dot {
		position: absolute;
		top: 5px;
		right: 15px;
	}

	:deep(.uni-section) {
		background-color: transparent;
	}

	:deep(.uni-section .uni-section-header__content) {
		font-size: 36rpx;
		color: #29343C;
	}
</style>