推送关联云服务空间、添加用户协议和隐私政策外部链接、修改活动状态和图片定位显示问题
This commit is contained in:
@@ -1,15 +1,25 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { onLaunch } from '@dcloudio/uni-app'
|
import { onLaunch,onShow,onHide } from '@dcloudio/uni-app'
|
||||||
|
|
||||||
// 应用启动时执行
|
// 应用启动时执行
|
||||||
onLaunch(() => {
|
onLaunch(() => {
|
||||||
console.log('App 启动')
|
console.log('App 启动')
|
||||||
|
uni.onPushMessage((res) => {
|
||||||
|
console.log("收到推送消息:",res) //监听推送消息
|
||||||
|
})
|
||||||
|
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
// 只有 App 平台才获取 CID
|
// 只有 App 平台才获取 CID
|
||||||
getPushCID()
|
getPushCID()
|
||||||
// #endif
|
// #endif
|
||||||
})
|
})
|
||||||
|
onShow(() =>{
|
||||||
|
console.log('App Show')
|
||||||
|
})
|
||||||
|
|
||||||
|
onHide(() =>{
|
||||||
|
console.log('App Hide')
|
||||||
|
})
|
||||||
|
|
||||||
// 获取 uniPush 2.0 CID
|
// 获取 uniPush 2.0 CID
|
||||||
function getPushCID() {
|
function getPushCID() {
|
||||||
|
|||||||
@@ -9,7 +9,8 @@
|
|||||||
<view class="popup-content">
|
<view class="popup-content">
|
||||||
<view class="section-text">
|
<view class="section-text">
|
||||||
我已仔细阅读并同意
|
我已仔细阅读并同意
|
||||||
<text class="privacy-link" @click="goToPrivacy">《用户协议》和《隐私政策》</text>
|
<text class="privacy-link" @click="goToUserAgreement">《用户协议》</text>和
|
||||||
|
<text class="privacy-link" @click="goToPrivacy">《隐私政策》</text>
|
||||||
全部内容。
|
全部内容。
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -50,8 +51,24 @@ const handleMaskClick = () => {
|
|||||||
emit('update:show', false)
|
emit('update:show', false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 打开用户协议
|
||||||
|
const goToUserAgreement = () => {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
plus.runtime.openURL('https://wuye.ckdzkj.com/parivw/ownler_xieyi.html')
|
||||||
|
// #endif
|
||||||
|
// #ifdef H5
|
||||||
|
window.open('https://wuye.ckdzkj.com/parivw/ownler_xieyi.html')
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// 打开隐私政策
|
||||||
const goToPrivacy = () => {
|
const goToPrivacy = () => {
|
||||||
uni.navigateTo({ url: '/pageSubPack/loginSub/privacy' })
|
// #ifdef APP-PLUS
|
||||||
|
plus.runtime.openURL('https://wuye.ckdzkj.com/parivw/owner.html')
|
||||||
|
// #endif
|
||||||
|
// #ifdef H5
|
||||||
|
window.open('https://wuye.ckdzkj.com/parivw/owner.html')
|
||||||
|
// #endif
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
{
|
{
|
||||||
"name" : "花开物业",
|
"name" : "花开物业",
|
||||||
"appid" : "__UNI__29C3D60",
|
"appid" : "__UNI__29C3D60",
|
||||||
"description" : "物业用户端app",
|
"description" : "智慧社区居民端面向小区业主使用,支持注册、验证码、账号密码多种登录方式,提供密码找回功能,账号使用安全便捷。支持多小区切换,首页设有轮播 banner、社区公告,集成远程开门、生活缴费、在线报修、访客邀请、社区活动常用服务。全服务板块统一涵盖门禁开门、线上缴费、报修申报、访客预约、投诉反馈、问卷调研、活动报名、社区公示、一键联系物业功能。个人中心可管理房屋、住户、车位、车辆信息,支持更换手机号、修改密码、消息通知设置、版本更新及账号退出,一站式满足业主居家生活、社区服务、房产车辆管理需求,实现社区生活数字化、便捷化。",
|
||||||
"versionName" : "1.0.1",
|
"versionName" : "1.0.1",
|
||||||
"versionCode" : 105,
|
"versionCode" : 105,
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
|
"uniCloud": {
|
||||||
|
"provider": "aliyun",
|
||||||
|
"spaceId": "mp-2d1912d1-5d25-47a9-a4c5-2669573cd0c2"
|
||||||
|
},
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
"app-plus" : {
|
"app-plus" : {
|
||||||
"usingComponents" : true,
|
"usingComponents" : true,
|
||||||
@@ -173,7 +177,14 @@
|
|||||||
"vueVersion" : "3",
|
"vueVersion" : "3",
|
||||||
"app-harmony" : {
|
"app-harmony" : {
|
||||||
"distribute" : {
|
"distribute" : {
|
||||||
"bundleName" : "com.chengkong.property.owner"
|
"bundleName" : "com.chengkong.property.owner",
|
||||||
|
"modules" : {
|
||||||
|
"uni-push" : {}
|
||||||
|
},
|
||||||
|
"icons" : {
|
||||||
|
"foreground" : "unpackage/res/icons/logo-app.png",
|
||||||
|
"background" : "unpackage/res/icons/background.png"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,9 +52,6 @@
|
|||||||
<!-- 活动卡片 -->
|
<!-- 活动卡片 -->
|
||||||
<view v-for="activity in displayedActivities" :key="activity.id" class="activity-card"
|
<view v-for="activity in displayedActivities" :key="activity.id" class="activity-card"
|
||||||
@tap="viewActivityDetail(activity)">
|
@tap="viewActivityDetail(activity)">
|
||||||
<view class="status-badge">
|
|
||||||
{{activity.statusText}}
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view v-if="activity.applied && activeTab === 'list'" class="signed-badge">
|
<view v-if="activity.applied && activeTab === 'list'" class="signed-badge">
|
||||||
<text>已报名</text>
|
<text>已报名</text>
|
||||||
@@ -65,6 +62,9 @@
|
|||||||
<up-row justify="space-between" customStyle="margin-bottom: 10px">
|
<up-row justify="space-between" customStyle="margin-bottom: 10px">
|
||||||
<up-col span="4">
|
<up-col span="4">
|
||||||
<view class="info-image-left">
|
<view class="info-image-left">
|
||||||
|
<view class="status-badge">
|
||||||
|
{{activity.statusText}}
|
||||||
|
</view>
|
||||||
<image :src="activity.coverImage" mode="aspectFill" style="width: 100%;height: 100%;border-radius: 16rpx;"></image>
|
<image :src="activity.coverImage" mode="aspectFill" style="width: 100%;height: 100%;border-radius: 16rpx;"></image>
|
||||||
</view>
|
</view>
|
||||||
</up-col>
|
</up-col>
|
||||||
@@ -522,8 +522,8 @@ watch(() => myFilter.value, () => {
|
|||||||
/* 活动状态标签 */
|
/* 活动状态标签 */
|
||||||
.status-badge {
|
.status-badge {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 33rpx;
|
top: 0;
|
||||||
left: 11rpx;
|
left: 0;
|
||||||
padding: 6rpx 20rpx;
|
padding: 6rpx 20rpx;
|
||||||
font-size: 22rpx;
|
font-size: 22rpx;
|
||||||
border-radius: 15rpx 0rpx 15rpx 0rpx;
|
border-radius: 15rpx 0rpx 15rpx 0rpx;
|
||||||
@@ -560,6 +560,7 @@ watch(() => myFilter.value, () => {
|
|||||||
.info-image-left {
|
.info-image-left {
|
||||||
width: 170rpx;
|
width: 170rpx;
|
||||||
height: 220rpx;
|
height: 220rpx;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.activity-title {
|
.activity-title {
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<text class="agreement-text" >我已阅读并同意
|
<text class="agreement-text" >我已阅读并同意
|
||||||
<text class="agreePrivacy" @click.stop="">《用户协议》</text>和
|
<text class="agreePrivacy" @click.stop="goToUserAgreement">《用户协议》</text>和
|
||||||
<text class="agreePrivacy" @click.stop="goToPrivacy">《隐私政策》</text>
|
<text class="agreePrivacy" @click.stop="goToPrivacy">《隐私政策》</text>
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -100,9 +100,24 @@ const toggleAgreement = () => {
|
|||||||
const showPrivacyPopup = ref(false)
|
const showPrivacyPopup = ref(false)
|
||||||
const pendingAction = ref('') // 记录待执行操作,如 'smsLogin'
|
const pendingAction = ref('') // 记录待执行操作,如 'smsLogin'
|
||||||
|
|
||||||
// 跳转隐私协议页面
|
// 打开用户协议
|
||||||
|
const goToUserAgreement = () => {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
plus.runtime.openURL('https://wuye.ckdzkj.com/parivw/ownler_xieyi.html')
|
||||||
|
// #endif
|
||||||
|
// #ifdef H5
|
||||||
|
window.open('https://wuye.ckdzkj.com/parivw/ownler_xieyi.html')
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// 打开隐私政策
|
||||||
const goToPrivacy = () => {
|
const goToPrivacy = () => {
|
||||||
uni.navigateTo({ url: "/pageSubPack/loginSub/privacy" })
|
// #ifdef APP-PLUS
|
||||||
|
plus.runtime.openURL('https://wuye.ckdzkj.com/parivw/owner.html')
|
||||||
|
// #endif
|
||||||
|
// #ifdef H5
|
||||||
|
window.open('https://wuye.ckdzkj.com/parivw/owner.html')
|
||||||
|
// #endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// 打开隐私弹窗(可传入待执行操作标识)
|
// 打开隐私弹窗(可传入待执行操作标识)
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ const goBack = () => {
|
|||||||
|
|
||||||
.card-img {
|
.card-img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 52px;
|
height: 56px;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -123,15 +123,13 @@
|
|||||||
<!-- 活动列表内容(去掉内层 scroll-view,由外层统一滚动) -->
|
<!-- 活动列表内容(去掉内层 scroll-view,由外层统一滚动) -->
|
||||||
<view class="activity-list">
|
<view class="activity-list">
|
||||||
<view class="eventListCard" v-for="(activity, index) in activityList" :key="activity.id">
|
<view class="eventListCard" v-for="(activity, index) in activityList" :key="activity.id">
|
||||||
<!-- 状态标签 -->
|
|
||||||
<view class="status-tag" :class="{}">
|
|
||||||
{{ activity.statusText }}
|
|
||||||
<!-- 进行中 -->
|
|
||||||
</view>
|
|
||||||
<view class="u-demo-block__content ">
|
<view class="u-demo-block__content ">
|
||||||
<up-row justify="space-between" customStyle="margin-bottom: 10px">
|
<up-row justify="space-between" customStyle="margin-bottom: 10px">
|
||||||
<up-col span="4">
|
<up-col span="4">
|
||||||
<view class="demo-layout bg-purple-light activity-img">
|
<view class="demo-layout bg-purple-light activity-img">
|
||||||
|
<view class="status-tag">
|
||||||
|
{{ activity.statusText }}
|
||||||
|
</view>
|
||||||
<image :src="activity.coverImage" style="width: 100%;height: 100%;border-radius: 16rpx;" mode="aspectFill"></image>
|
<image :src="activity.coverImage" style="width: 100%;height: 100%;border-radius: 16rpx;" mode="aspectFill"></image>
|
||||||
</view>
|
</view>
|
||||||
</up-col>
|
</up-col>
|
||||||
@@ -662,27 +660,26 @@ const moreClick = () =>{
|
|||||||
position: relative;
|
position: relative;
|
||||||
margin: 30rpx 0rpx;
|
margin: 30rpx 0rpx;
|
||||||
// overflow: hidden;
|
// overflow: hidden;
|
||||||
.status-tag {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
// padding: 6px 18px;
|
|
||||||
padding: 0px 7px 10px 11px;
|
|
||||||
border-radius: 10px 0px 10px 0px;
|
|
||||||
font-size: 12px;
|
|
||||||
color: #fff;
|
|
||||||
font-weight: 500;
|
|
||||||
width: 80rpx;
|
|
||||||
height: 20rpx;
|
|
||||||
// background-color: #FD7373 ;
|
|
||||||
background: repeating-linear-gradient(to right, #FD7373 , #FB3F3F);
|
|
||||||
z-index: 5;
|
|
||||||
}
|
|
||||||
.activity-img{
|
.activity-img{
|
||||||
width: 170rpx;
|
width: 170rpx;
|
||||||
height: 230rpx;
|
height: 230rpx;
|
||||||
|
position: relative;
|
||||||
// background-color: #333333;
|
// background-color: #333333;
|
||||||
}
|
}
|
||||||
|
.status-tag {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
padding: 0px 7px 10px 11px;
|
||||||
|
border-radius: 10px 0px 10px 0px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #fff;
|
||||||
|
font-weight: 500;
|
||||||
|
width: 80rpx;
|
||||||
|
height: 20rpx;
|
||||||
|
background: repeating-linear-gradient(to right, #FD7373 , #FB3F3F);
|
||||||
|
z-index: 5;
|
||||||
|
}
|
||||||
.activity-title{
|
.activity-title{
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|||||||
@@ -37,6 +37,9 @@
|
|||||||
|
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
<view class="icp-footer">
|
||||||
|
<text class="icp-text">ICP备案号:鲁ICP备2024131497号-4A</text>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
@@ -222,6 +225,18 @@
|
|||||||
<style scoped>
|
<style scoped>
|
||||||
.list-container {}
|
.list-container {}
|
||||||
|
|
||||||
|
.icp-footer {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
padding: 20rpx 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icp-text {
|
||||||
|
font-size: 22rpx;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
|
||||||
.status-bar {
|
.status-bar {
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
height: 46px;
|
height: 46px;
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
'use strict';
|
||||||
|
// 初始化推送管理器
|
||||||
|
const uniPush = uniCloud.getPushManager({
|
||||||
|
appId: "__UNI__29C3D60"
|
||||||
|
})
|
||||||
|
exports.main = async (event, context) => {
|
||||||
|
// event接收前端传入的推送参数
|
||||||
|
const res = await uniPush.sendMessage({
|
||||||
|
push_clientid: event.cid, // 客户端设备cid
|
||||||
|
title: "通知标题",
|
||||||
|
content: "通知内容",
|
||||||
|
force_notification: true // 离线厂商推送必填
|
||||||
|
})
|
||||||
|
return res
|
||||||
|
};
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"name": "push-send",
|
||||||
|
"dependencies": {},
|
||||||
|
"extensions": {
|
||||||
|
"uni-cloud-push": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
12
property-uniapp-project/uniCloud-aliyun/database/JQL查询.jql
Normal file
12
property-uniapp-project/uniCloud-aliyun/database/JQL查询.jql
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
// 本文件用于,使用JQL语法操作项目关联的uniCloud空间的数据库,方便开发调试和远程数据库管理
|
||||||
|
// 编写clientDB的js API(也支持常规js语法,比如var),可以对云数据库进行增删改查操作。不支持uniCloud-db组件写法
|
||||||
|
// 可以全部运行,也可以选中部分代码运行。点击工具栏上的运行按钮或者按下【F5】键运行代码
|
||||||
|
// 如果文档中存在多条JQL语句,只有最后一条语句生效
|
||||||
|
// 如果混写了普通js,最后一条语句需是数据库操作语句
|
||||||
|
// 此处代码运行不受DB Schema的权限控制,移植代码到实际业务中注意在schema中配好permission
|
||||||
|
// 不支持clientDB的action
|
||||||
|
// 数据库查询有最大返回条数限制,详见:https://uniapp.dcloud.net.cn/uniCloud/cf-database.html#limit
|
||||||
|
// 详细JQL语法,请参考:https://uniapp.dcloud.net.cn/uniCloud/jql.html
|
||||||
|
|
||||||
|
// 下面示例查询uni-id-users表的所有数据
|
||||||
|
db.collection('uni-id-users').get();
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
## 0.0.3(2022-11-11)
|
||||||
|
- 修复 config 方法获取根节点为数组格式配置时错误的转化为了对象的Bug
|
||||||
|
## 0.0.2(2021-04-16)
|
||||||
|
- 修改插件package信息
|
||||||
|
## 0.0.1(2021-03-15)
|
||||||
|
- 初始化项目
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
{
|
||||||
|
"id": "uni-config-center",
|
||||||
|
"displayName": "uni-config-center",
|
||||||
|
"version": "0.0.3",
|
||||||
|
"description": "uniCloud 配置中心",
|
||||||
|
"keywords": [
|
||||||
|
"配置",
|
||||||
|
"配置中心"
|
||||||
|
],
|
||||||
|
"repository": "",
|
||||||
|
"engines": {
|
||||||
|
"HBuilderX": "^3.1.0"
|
||||||
|
},
|
||||||
|
"dcloudext": {
|
||||||
|
"sale": {
|
||||||
|
"regular": {
|
||||||
|
"price": "0.00"
|
||||||
|
},
|
||||||
|
"sourcecode": {
|
||||||
|
"price": "0.00"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"contact": {
|
||||||
|
"qq": ""
|
||||||
|
},
|
||||||
|
"declaration": {
|
||||||
|
"ads": "无",
|
||||||
|
"data": "无",
|
||||||
|
"permissions": "无"
|
||||||
|
},
|
||||||
|
"npmurl": "",
|
||||||
|
"type": "unicloud-template-function"
|
||||||
|
},
|
||||||
|
"directories": {
|
||||||
|
"example": "../../../scripts/dist"
|
||||||
|
},
|
||||||
|
"uni_modules": {
|
||||||
|
"dependencies": [],
|
||||||
|
"encrypt": [],
|
||||||
|
"platforms": {
|
||||||
|
"cloud": {
|
||||||
|
"tcb": "y",
|
||||||
|
"aliyun": "y"
|
||||||
|
},
|
||||||
|
"client": {
|
||||||
|
"App": {
|
||||||
|
"app-vue": "u",
|
||||||
|
"app-nvue": "u"
|
||||||
|
},
|
||||||
|
"H5-mobile": {
|
||||||
|
"Safari": "u",
|
||||||
|
"Android Browser": "u",
|
||||||
|
"微信浏览器(Android)": "u",
|
||||||
|
"QQ浏览器(Android)": "u"
|
||||||
|
},
|
||||||
|
"H5-pc": {
|
||||||
|
"Chrome": "u",
|
||||||
|
"IE": "u",
|
||||||
|
"Edge": "u",
|
||||||
|
"Firefox": "u",
|
||||||
|
"Safari": "u"
|
||||||
|
},
|
||||||
|
"小程序": {
|
||||||
|
"微信": "u",
|
||||||
|
"阿里": "u",
|
||||||
|
"百度": "u",
|
||||||
|
"字节跳动": "u",
|
||||||
|
"QQ": "u"
|
||||||
|
},
|
||||||
|
"快应用": {
|
||||||
|
"华为": "u",
|
||||||
|
"联盟": "u"
|
||||||
|
},
|
||||||
|
"Vue": {
|
||||||
|
"vue2": "y",
|
||||||
|
"vue3": "u"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
# 为什么使用uni-config-center
|
||||||
|
|
||||||
|
实际开发中很多插件需要配置文件才可以正常运行,如果每个插件都单独进行配置的话就会产生下面这样的目录结构
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cloudfunctions
|
||||||
|
└─────common 公共模块
|
||||||
|
├─plugin-a // 插件A对应的目录
|
||||||
|
│ ├─index.js
|
||||||
|
│ ├─config.json // plugin-a对应的配置文件
|
||||||
|
│ └─other-file.cert // plugin-a依赖的其他文件
|
||||||
|
└─plugin-b // plugin-b对应的目录
|
||||||
|
├─index.js
|
||||||
|
└─config.json // plugin-b对应的配置文件
|
||||||
|
```
|
||||||
|
|
||||||
|
假设插件作者要发布一个项目模板,里面使用了很多需要配置的插件,无论是作者发布还是用户使用都是一个大麻烦。
|
||||||
|
|
||||||
|
uni-config-center就是用了统一管理这些配置文件的,使用uni-config-center后的目录结构如下
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cloudfunctions
|
||||||
|
└─────common 公共模块
|
||||||
|
├─plugin-a // 插件A对应的目录
|
||||||
|
│ └─index.js
|
||||||
|
├─plugin-b // plugin-b对应的目录
|
||||||
|
│ └─index.js
|
||||||
|
└─uni-config-center
|
||||||
|
├─index.js // config-center入口文件
|
||||||
|
├─plugin-a
|
||||||
|
│ ├─config.json // plugin-a对应的配置文件
|
||||||
|
│ └─other-file.cert // plugin-a依赖的其他文件
|
||||||
|
└─plugin-b
|
||||||
|
└─config.json // plugin-b对应的配置文件
|
||||||
|
```
|
||||||
|
|
||||||
|
使用uni-config-center后的优势
|
||||||
|
|
||||||
|
- 配置文件统一管理,分离插件主体和配置信息,更新插件更方便
|
||||||
|
- 支持对config.json设置schema,插件使用者在HBuilderX内编写config.json文件时会有更好的提示(后续HBuilderX会提供支持)
|
||||||
|
|
||||||
|
# 用法
|
||||||
|
|
||||||
|
在要使用uni-config-center的公共模块或云函数内引入uni-config-center依赖,请参考:[使用公共模块](https://uniapp.dcloud.net.cn/uniCloud/cf-common)
|
||||||
|
|
||||||
|
```js
|
||||||
|
const createConfig = require('uni-config-center')
|
||||||
|
|
||||||
|
const uniIdConfig = createConfig({
|
||||||
|
pluginId: 'uni-id', // 插件id
|
||||||
|
defaultConfig: { // 默认配置
|
||||||
|
tokenExpiresIn: 7200,
|
||||||
|
tokenExpiresThreshold: 600,
|
||||||
|
},
|
||||||
|
customMerge: function(defaultConfig, userConfig) { // 自定义默认配置和用户配置的合并规则,不设置的情况侠会对默认配置和用户配置进行深度合并
|
||||||
|
// defaudltConfig 默认配置
|
||||||
|
// userConfig 用户配置
|
||||||
|
return Object.assign(defaultConfig, userConfig)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// 以如下配置为例
|
||||||
|
// {
|
||||||
|
// "tokenExpiresIn": 7200,
|
||||||
|
// "passwordErrorLimit": 6,
|
||||||
|
// "bindTokenToDevice": false,
|
||||||
|
// "passwordErrorRetryTime": 3600,
|
||||||
|
// "app-plus": {
|
||||||
|
// "tokenExpiresIn": 2592000
|
||||||
|
// },
|
||||||
|
// "service": {
|
||||||
|
// "sms": {
|
||||||
|
// "codeExpiresIn": 300
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 获取配置
|
||||||
|
uniIdConfig.config() // 获取全部配置,注意:uni-config-center内不存在对应插件目录时会返回空对象
|
||||||
|
uniIdConfig.config('tokenExpiresIn') // 指定键值获取配置,返回:7200
|
||||||
|
uniIdConfig.config('service.sms.codeExpiresIn') // 指定键值获取配置,返回:300
|
||||||
|
uniIdConfig.config('tokenExpiresThreshold', 600) // 指定键值获取配置,如果不存在则取传入的默认值,返回:600
|
||||||
|
|
||||||
|
// 获取文件绝对路径
|
||||||
|
uniIdConfig.resolve('custom-token.js') // 获取uni-config-center/uni-id/custom-token.js文件的路径
|
||||||
|
|
||||||
|
// 引用文件(require)
|
||||||
|
uniIDConfig.requireFile('custom-token.js') // 使用require方式引用uni-config-center/uni-id/custom-token.js文件。文件不存在时返回undefined,文件内有其他错误导致require失败时会抛出错误。
|
||||||
|
|
||||||
|
// 判断是否包含某文件
|
||||||
|
uniIDConfig.hasFile('custom-token.js') // 配置目录是否包含某文件,true: 文件存在,false: 文件不存在
|
||||||
|
```
|
||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"name": "uni-config-center",
|
||||||
|
"version": "0.0.3",
|
||||||
|
"description": "配置中心",
|
||||||
|
"main": "index.js",
|
||||||
|
"keywords": [],
|
||||||
|
"author": "DCloud",
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"origin-plugin-dev-name": "uni-config-center",
|
||||||
|
"origin-plugin-version": "0.0.3",
|
||||||
|
"plugin-dev-name": "uni-config-center",
|
||||||
|
"plugin-version": "0.0.3"
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
## 1.0.19(2025-12-16)
|
||||||
|
- 增加配置参数缺失时的错误提示,指明配置文件路径
|
||||||
|
## 1.0.18(2024-07-08)
|
||||||
|
- checkToken时如果传入的token为空则返回uni-id-check-token-failed错误码以便uniIdRouter能正常跳转
|
||||||
|
## 1.0.17(2024-04-26)
|
||||||
|
- 兼容uni-app-x对客户端uniPlatform的调整(uni-app-x内uniPlatform区分app-android、app-ios)
|
||||||
|
## 1.0.16(2023-04-25)
|
||||||
|
- 新增maxTokenLength配置,用于限制数据库用户记录token数组的最大长度
|
||||||
|
## 1.0.15(2023-04-06)
|
||||||
|
- 修复部分语言国际化出错的Bug
|
||||||
|
## 1.0.14(2023-03-07)
|
||||||
|
- 修复 admin用户包含其他角色时未包含在token的Bug
|
||||||
|
## 1.0.13(2022-07-21)
|
||||||
|
- 修复 创建token时未传角色权限信息生成的token不正确的bug
|
||||||
|
## 1.0.12(2022-07-15)
|
||||||
|
- 提升与旧版本uni-id的兼容性(补充读取配置文件时回退平台app-plus、h5),但是仍推荐使用新平台名进行配置(app、web)
|
||||||
|
## 1.0.11(2022-07-14)
|
||||||
|
- 修复 部分情况下报`read property 'reduce' of undefined`的错误
|
||||||
|
## 1.0.10(2022-07-11)
|
||||||
|
- 将token存储在用户表的token字段内,与旧版本uni-id保持一致
|
||||||
|
## 1.0.9(2022-07-01)
|
||||||
|
- checkToken兼容token内未缓存角色权限的情况,此时将查库获取角色权限
|
||||||
|
## 1.0.8(2022-07-01)
|
||||||
|
- 修复clientDB默认依赖时部分情况下获取不到uni-id配置的Bug
|
||||||
|
## 1.0.7(2022-06-30)
|
||||||
|
- 修复config文件不合法时未抛出具体错误的Bug
|
||||||
|
## 1.0.6(2022-06-28)
|
||||||
|
- 移除插件内的数据表schema
|
||||||
|
## 1.0.5(2022-06-27)
|
||||||
|
- 修复使用多应用配置时报`Cannot read property 'appId' of undefined`的Bug
|
||||||
|
## 1.0.4(2022-06-27)
|
||||||
|
- 修复使用自定义token内容功能报错的Bug [详情](https://ask.dcloud.net.cn/question/147945)
|
||||||
|
## 1.0.2(2022-06-23)
|
||||||
|
- 对齐旧版本uni-id默认配置
|
||||||
|
## 1.0.1(2022-06-22)
|
||||||
|
- 补充对uni-config-center的依赖
|
||||||
|
## 1.0.0(2022-06-21)
|
||||||
|
- 提供uni-id token创建、校验、刷新接口,简化旧版uni-id公共模块
|
||||||
101
property-uniapp-project/uni_modules/uni-id-common/package.json
Normal file
101
property-uniapp-project/uni_modules/uni-id-common/package.json
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
{
|
||||||
|
"id": "uni-id-common",
|
||||||
|
"displayName": "uni-id-common",
|
||||||
|
"version": "1.0.19",
|
||||||
|
"description": "包含uni-id token生成、校验、刷新功能的云函数公共模块",
|
||||||
|
"keywords": [
|
||||||
|
"uni-id-common",
|
||||||
|
"uniCloud",
|
||||||
|
"token",
|
||||||
|
"权限"
|
||||||
|
],
|
||||||
|
"repository": "https://gitcode.net/dcloud/uni-id-common",
|
||||||
|
"engines": {
|
||||||
|
"uni-app": "^3.1.0",
|
||||||
|
"uni-app-x": "^3.1.0"
|
||||||
|
},
|
||||||
|
"dcloudext": {
|
||||||
|
"sale": {
|
||||||
|
"regular": {
|
||||||
|
"price": "0.00"
|
||||||
|
},
|
||||||
|
"sourcecode": {
|
||||||
|
"price": "0.00"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"contact": {
|
||||||
|
"qq": ""
|
||||||
|
},
|
||||||
|
"declaration": {
|
||||||
|
"ads": "无",
|
||||||
|
"data": "无",
|
||||||
|
"permissions": "无"
|
||||||
|
},
|
||||||
|
"npmurl": "",
|
||||||
|
"type": "unicloud-template-function",
|
||||||
|
"darkmode": "-",
|
||||||
|
"i18n": "-",
|
||||||
|
"widescreen": "-"
|
||||||
|
},
|
||||||
|
"uni_modules": {
|
||||||
|
"dependencies": [
|
||||||
|
"uni-config-center"
|
||||||
|
],
|
||||||
|
"encrypt": [],
|
||||||
|
"platforms": {
|
||||||
|
"cloud": {
|
||||||
|
"tcb": "√",
|
||||||
|
"aliyun": "√",
|
||||||
|
"alipay": "√"
|
||||||
|
},
|
||||||
|
"client": {
|
||||||
|
"uni-app": {
|
||||||
|
"vue": {
|
||||||
|
"vue2": "-",
|
||||||
|
"vue3": "-"
|
||||||
|
},
|
||||||
|
"web": {
|
||||||
|
"safari": "-",
|
||||||
|
"chrome": "-"
|
||||||
|
},
|
||||||
|
"app": {
|
||||||
|
"vue": "-",
|
||||||
|
"nvue": "-",
|
||||||
|
"android": "-",
|
||||||
|
"ios": "-",
|
||||||
|
"harmony": "-"
|
||||||
|
},
|
||||||
|
"mp": {
|
||||||
|
"weixin": "-",
|
||||||
|
"alipay": "-",
|
||||||
|
"toutiao": "-",
|
||||||
|
"baidu": "-",
|
||||||
|
"kuaishou": "-",
|
||||||
|
"jd": "-",
|
||||||
|
"harmony": "-",
|
||||||
|
"qq": "-",
|
||||||
|
"lark": "-"
|
||||||
|
},
|
||||||
|
"quickapp": {
|
||||||
|
"huawei": "-",
|
||||||
|
"union": "-"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"uni-app-x": {
|
||||||
|
"web": {
|
||||||
|
"safari": "-",
|
||||||
|
"chrome": "-"
|
||||||
|
},
|
||||||
|
"app": {
|
||||||
|
"android": "-",
|
||||||
|
"ios": "-",
|
||||||
|
"harmony": "-"
|
||||||
|
},
|
||||||
|
"mp": {
|
||||||
|
"weixin": "-"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# uni-id-common
|
||||||
|
|
||||||
|
文档请参考:[uni-id-common](https://uniapp.dcloud.net.cn/uniCloud/uni-id-common.html)
|
||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"name": "uni-id-common",
|
||||||
|
"version": "1.0.19",
|
||||||
|
"description": "uni-id token生成、校验、刷新",
|
||||||
|
"main": "index.js",
|
||||||
|
"homepage": "https:\/\/uniapp.dcloud.io\/uniCloud\/uni-id-common.html",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https:\/\/gitee.com\/dcloud\/uni-id-common.git"
|
||||||
|
},
|
||||||
|
"author": "DCloud",
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"dependencies": {
|
||||||
|
"uni-config-center": "file:..\/..\/..\/..\/..\/uni-config-center\/uniCloud\/cloudfunctions\/common\/uni-config-center"
|
||||||
|
},
|
||||||
|
"origin-plugin-dev-name": "uni-id-common",
|
||||||
|
"origin-plugin-version": "1.0.19",
|
||||||
|
"plugin-dev-name": "uni-id-common",
|
||||||
|
"plugin-version": "1.0.19"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user