Compare commits
8 Commits
a6a98eb2b6
...
test
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1f8245ab2c | ||
|
|
afdb3cb724 | ||
|
|
612de69d7b | ||
|
|
d244f20aac | ||
|
|
c205422420 | ||
|
|
426ac9171d | ||
|
|
45b0117f5f | ||
|
|
95a1187b8a |
@@ -1,6 +1,12 @@
|
||||
|
||||
#调用后台地址
|
||||
# VITE_APP_BASE_URL = 'http://118.186.13.120:31302'
|
||||
VITE_APP_BASE_URL = 'https://app-test.718yousheng.com'
|
||||
# 公司
|
||||
VITE_APP_BASE_URL = 'http://118.186.13.120:31302'
|
||||
# VITE_APP_BASE_URL = "http://192.168.236.71:31302"
|
||||
# VITE_APP_BASE_URL = "http://123.57.20.168:3000"
|
||||
|
||||
# 友晟外网
|
||||
# VITE_APP_BASE_URL = 'https://app-test.718yousheng.com/app'
|
||||
# 友晟内网
|
||||
# VITE_APP_BASE_URL = 'https://appi-test.718yousheng.com/app'
|
||||
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
|
||||
#调用后台地址
|
||||
VITE_APP_BASE_URL = 'https://app-test.718yousheng.com'
|
||||
# 公司
|
||||
# VITE_APP_BASE_URL = 'http://118.186.13.120:31302'
|
||||
# VITE_APP_BASE_URL = "http://192.168.236.71:31302"
|
||||
# VITE_APP_BASE_URL = "http://123.57.20.168:3000"
|
||||
|
||||
# 友晟外网
|
||||
VITE_APP_BASE_URL = 'https://app-test.718yousheng.com/app'
|
||||
# 友晟内网
|
||||
# VITE_APP_BASE_URL = 'https://appi-test.718yousheng.com/app'
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -8,6 +8,7 @@ pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
.hbuilderx
|
||||
.DS_Store
|
||||
dist
|
||||
*.local
|
||||
|
||||
@@ -4,6 +4,16 @@
|
||||
{
|
||||
"playground" : "custom",
|
||||
"type" : "uni-app:app-android"
|
||||
},
|
||||
{
|
||||
"app" : {
|
||||
"launchtype" : "remote"
|
||||
},
|
||||
"default" : {
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"provider" : "aliyun",
|
||||
"type" : "uniCloud"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Binary file not shown.
31
src/App.vue
31
src/App.vue
@@ -4,17 +4,40 @@
|
||||
|
||||
|
||||
<script setup>
|
||||
// import { onLaunch } from '@dcloudio/uni-app';
|
||||
// onLaunch((opt) => {
|
||||
// console.log("onLaunch")
|
||||
|
||||
import {showAlert} from '@/utils/message.js'
|
||||
import { onLaunch } from '@dcloudio/uni-app';
|
||||
onLaunch((opt) => {
|
||||
// uni.preloadPage({ url: "/pages/login/login" });
|
||||
// uni.preloadPage({ url: "/pages/home/home" });
|
||||
// uni.preloadPage({ url: "/pages/business/business" });
|
||||
// uni.preloadPage({ url: "/pages/notice/notice" });
|
||||
// uni.preloadPage({ url: "/pages/userinfo/userinfo" });
|
||||
console.log("APP onLaunch")
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
// uni.getPushClientId({
|
||||
// success: (res) => {
|
||||
// let push_clientid = res.cid
|
||||
// showAlert(push_clientid)
|
||||
// console.log('客户端推送标识:', push_clientid);
|
||||
// },
|
||||
// fail(err) {
|
||||
// console.log(err)
|
||||
// }
|
||||
// })
|
||||
|
||||
uni.onPushMessage(res => {
|
||||
console.log("收到推送消息:", res) //监听推送消息
|
||||
// uni.createPushMessage({
|
||||
// title: res.data.title,
|
||||
// content: res.data.content,
|
||||
// payload: res.data.payload
|
||||
// })
|
||||
})
|
||||
// #endif
|
||||
})
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
<style>
|
||||
|
||||
@@ -21,7 +21,9 @@
|
||||
"delay" : 0
|
||||
},
|
||||
/* 模块配置 */
|
||||
"modules" : {},
|
||||
"modules" : {
|
||||
"Push" : {}
|
||||
},
|
||||
/* 应用发布信息 */
|
||||
"distribute" : {
|
||||
/* android打包配置 */
|
||||
@@ -41,17 +43,31 @@
|
||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.INTERNET\" />",
|
||||
"<uses-permission android:name=\"android.permission.RECEIVE_BOOT_COMPLETED\" />",
|
||||
"<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" />",
|
||||
"<uses-permission android:name=\"android.permission.GET_TASKS\" />",
|
||||
"<uses-permission android:name=\"android.permission.BLUETOOTH\" />",
|
||||
"<uses-permission android:name=\"android.permission.BLUETOOTH_ADMIN\" />",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\" />",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\" />",
|
||||
"<uses-permission android:name=\"android.permission.BROADCAST_PACKAGE_ADDED\" />",
|
||||
"<uses-permission android:name=\"android.permission.BROADCAST_PACKAGE_CHANGED\" />",
|
||||
"<uses-permission android:name=\"android.permission.BROADCAST_PACKAGE_INSTALL\" />",
|
||||
"<uses-permission android:name=\"android.permission.BROADCAST_PACKAGE_REPLACED\" />",
|
||||
"<uses-permission android:name=\"android.permission.RESTART_PACKAGES\" />",
|
||||
"<uses-permission android:name=\"android.permission.REQUEST_INSTALL_PACKAGES\" />"
|
||||
],
|
||||
"abiFilters" : [ "armeabi-v7a", "arm64-v8a" ],
|
||||
"minSdkVersion" : 26,
|
||||
"targetSdkVersion" : 35,
|
||||
"icons" : {
|
||||
"android" : {
|
||||
"hdpi" : "static/icons/72x72.png",
|
||||
"xhdpi" : "static/icons/96x96.png",
|
||||
"xxhdpi" : "static/icons/144x144.png",
|
||||
"xxxhdpi" : "static/icons/192x192.png"
|
||||
"hdpi" : "/static/images/icon.png",
|
||||
"xhdpi" : "/static/images/icon.png",
|
||||
"xxhdpi" : "/static/images/icon.png",
|
||||
"xxxhdpi" : "/static/images/icon.png"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -60,7 +76,23 @@
|
||||
"dSYMs" : false
|
||||
},
|
||||
/* SDK配置 */
|
||||
"sdkConfigs" : {}
|
||||
"sdkConfigs" : {
|
||||
"push" : {
|
||||
"unipush" : {
|
||||
"version" : "2",
|
||||
"offline" : true,
|
||||
"icons" : {
|
||||
"small" : {
|
||||
"ldpi" : "/static/images/icon.png",
|
||||
"mdpi" : "/static/images/icon.png",
|
||||
"hdpi" : "/static/images/icon.png",
|
||||
"xhdpi" : "/static/images/icon.png",
|
||||
"xxhdpi" : "/static/images/icon.png"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"nativePlugins" : {
|
||||
"Tm-TmSafeSaveFileModule" : {
|
||||
|
||||
@@ -54,6 +54,12 @@
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/notice/noticeDetail",
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/notice/waitApprove",
|
||||
"style": {
|
||||
|
||||
@@ -157,6 +157,7 @@ const handleSubmit= async()=>{
|
||||
await bizFavoriteSetting({bizIds:bizIds.value.join(",")});
|
||||
showAlert("操作成功")
|
||||
hideLoading();
|
||||
uni.navigateBack();
|
||||
} catch (error) {
|
||||
hideLoading();
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@
|
||||
|
||||
<script setup>
|
||||
import { ref,onMounted } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { onLoad,onShow } from '@dcloudio/uni-app';
|
||||
import customHeader from '@/components/customHeader.vue'
|
||||
import MescrollUni from 'mescroll-uni/mescroll-uni.vue';
|
||||
import customSteps from '@/components/customSteps.vue'
|
||||
@@ -185,6 +185,9 @@ onLoad(async(opt) => {
|
||||
uni.setStorageSync('page_cache',true);
|
||||
// initLoad();
|
||||
})
|
||||
onShow(()=>{
|
||||
initLoad();
|
||||
})
|
||||
|
||||
// 初始化调用方法
|
||||
const initLoad =()=>{
|
||||
@@ -517,7 +520,7 @@ const formatDateStr =(times)=>{
|
||||
margin-top:10rpx;
|
||||
}
|
||||
|
||||
.white-bg .logo-list{
|
||||
/* .white-bg .logo-list{
|
||||
margin-left:-25rpx;
|
||||
margin-right:-25rpx;
|
||||
padding:0 20rpx;
|
||||
@@ -535,5 +538,5 @@ const formatDateStr =(times)=>{
|
||||
.white-bg .logo-list .l-l-item img{
|
||||
width:110rpx;
|
||||
height:110rpx;
|
||||
}
|
||||
} */
|
||||
</style>
|
||||
|
||||
@@ -134,6 +134,7 @@ const selectDeviceId = async()=>{
|
||||
// 查询本地缓存的设备状态是否绑定过
|
||||
// let deviceId = uni.getStorageSync('app_device_id');// 本地设备ID
|
||||
try {
|
||||
// showAlert("safeSave=>"+safeSave)
|
||||
safeSave.getSafeFile({ "key": "app_device_id" }, res2 => {
|
||||
// showAlert(JSON.stringify(res2));
|
||||
if (res2.code == 1) {
|
||||
@@ -177,7 +178,7 @@ const selectDeviceId = async()=>{
|
||||
})
|
||||
} catch (error) {
|
||||
console.log("getSafeFile=>",error)
|
||||
showAlert(error)
|
||||
// showAlert("getSafeFile=>"+error)
|
||||
}
|
||||
}
|
||||
// 下载最新版本
|
||||
|
||||
@@ -264,9 +264,9 @@ const submitForm = () => {
|
||||
|
||||
// #ifdef H5
|
||||
//h5测试用 内网-sn123456
|
||||
//公司外网 '9516053c-b441-465b-9781-06e7b8031811'
|
||||
//公司外网 'f3fca83f-bf56-47f4-a98b-a602ed8bddee'
|
||||
//友晟外网 'b97527c8-2ad4-493c-a01c-5f9d0aabaff2'
|
||||
param.uniqCode = 'b97527c8-2ad4-493c-a01c-5f9d0aabaff2';
|
||||
param.uniqCode = 'f3fca83f-bf56-47f4-a98b-a602ed8bddee';
|
||||
let res = await login(param);
|
||||
userStore.login(res);
|
||||
uni.switchTab({ url: '/pages/home/home' })
|
||||
@@ -278,10 +278,16 @@ const submitForm = () => {
|
||||
// 读取设备ID
|
||||
safeSave.getSafeFile({ "key": "app_device_id" }, res3 => {
|
||||
if (res3.code == 1) {
|
||||
let deviceId = res3.data;//'b97527c8-2ad4-493c-a01c-5f9d0aabaff2' //
|
||||
let deviceId = res3.data;
|
||||
// showAlert("读取成功=>"+deviceId);
|
||||
param.uniqCode = deviceId;
|
||||
uni.getPushClientId({
|
||||
success: (res) => {
|
||||
let push_clientid = res.cid
|
||||
console.log('客户端推送标识:', push_clientid);
|
||||
console.log("param=>",param)
|
||||
param.cid = push_clientid
|
||||
// showAlert("客户端推送标识=>"+push_clientid);
|
||||
login(param).then(res=>{
|
||||
userStore.login(res);
|
||||
uni.switchTab({ url: '/pages/home/home' })
|
||||
@@ -289,6 +295,11 @@ const submitForm = () => {
|
||||
}).finally(()=>{
|
||||
btnLoading.value = false;
|
||||
})
|
||||
},
|
||||
fail(err) {
|
||||
console.log(err)
|
||||
}
|
||||
})
|
||||
|
||||
} else {
|
||||
// showAlert('读取失败:'+res3.msg)
|
||||
|
||||
@@ -214,7 +214,8 @@ const getNoticeList = (pageIndex, pageSize) => {
|
||||
// 跳转webview
|
||||
const handleJump = (item)=>{
|
||||
uni.navigateTo({
|
||||
url: '/pages/h5-webview/h5-webview?url=' + item.mobileLink+"&title="+item.subject
|
||||
// url: '/pages/h5-webview/h5-webview?url=' + item.mobileLink+"&title="+item.subject
|
||||
url:'/pages/notice/noticeDetail?title='+item.subject+'&time='+item.createTime+'&appName='+item.appName
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
84
src/pages/notice/noticeDetail.vue
Normal file
84
src/pages/notice/noticeDetail.vue
Normal file
@@ -0,0 +1,84 @@
|
||||
<template>
|
||||
<view class="con-body">
|
||||
<view class="con-bg">
|
||||
<!-- 头部 -->
|
||||
<customHeader ref="customHeaderRef" :title="'消息通知'" :leftFlag="true" :rightFlag="false"></customHeader>
|
||||
|
||||
<!-- 高度来避免头部遮挡 -->
|
||||
<view class="top-height"></view>
|
||||
|
||||
<!-- 正文内容 -->
|
||||
<view class="white-bg">
|
||||
<view class="n-title">{{ title }}</view>
|
||||
<view class="n-time">
|
||||
<text>来自:{{appName}}</text> {{ time }}
|
||||
</view>
|
||||
<view class="btn-blue" @click="handleJump">跳转详情页</view>
|
||||
</view>
|
||||
|
||||
<!-- 底部加高度来避免tabbar遮挡 -->
|
||||
<view class="bottom-height"></view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import customHeader from '@/components/customHeader.vue'
|
||||
import {showToast} from '@/utils/message.js'
|
||||
|
||||
// 加载后调用
|
||||
let title = ref(null);
|
||||
let time = ref(null);
|
||||
let appName = ref(null);
|
||||
onLoad((options) => {
|
||||
console.log(options)
|
||||
title.value = options.title;
|
||||
time.value = options.time;
|
||||
appName.value = options.appName
|
||||
})
|
||||
|
||||
// 跳转webview
|
||||
const handleJump = ()=>{
|
||||
showToast('暂不支持跳转');
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.white-bg {
|
||||
width: 650rpx;
|
||||
padding:30rpx 50rpx;
|
||||
height:100vh;
|
||||
margin: 0;
|
||||
border-radius: 8px 8px 0 0;
|
||||
|
||||
}
|
||||
.white-bg .n-title{
|
||||
font-size:40rpx;
|
||||
font-weight: bold;
|
||||
padding:20rpx 0 25rpx;
|
||||
text-align: center;
|
||||
border-bottom: 1px solid #BFBFBF;
|
||||
}
|
||||
.white-bg .n-time{
|
||||
text-align: center;
|
||||
color:#919191;
|
||||
font-size:26rpx;
|
||||
padding:20rpx;
|
||||
}
|
||||
.white-bg .n-time text{
|
||||
margin-right:50rpx;
|
||||
}
|
||||
.btn-blue {
|
||||
background-color: #05A3F4;
|
||||
color: #fff;
|
||||
width:380rpx;
|
||||
height:80rpx;
|
||||
line-height: 80rpx;
|
||||
margin:300rpx auto 0;
|
||||
text-align: center;
|
||||
border-radius: 40rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -59,6 +59,7 @@ import customHeader from '@/components/customHeader.vue'
|
||||
import { getNavBarPaddingTop } from '@/utils/system.js'
|
||||
import {formatLevel} from '@/utils/status.js'
|
||||
import { parseTime } from '@/utils/datetime.js'
|
||||
import {showToast} from '@/utils/message.js'
|
||||
|
||||
|
||||
let detail = ref({})
|
||||
@@ -80,10 +81,11 @@ onMounted(() => {
|
||||
|
||||
// 跳转webview
|
||||
const handleJump = ()=>{
|
||||
let item = detail.value;
|
||||
uni.navigateTo({
|
||||
url: `/pages/h5-webview/h5-webview?url=${item.mobileLink}&title=${item.subject}`
|
||||
});
|
||||
showToast('暂不支持跳转');
|
||||
// let item = detail.value;
|
||||
// uni.navigateTo({
|
||||
// url: `/pages/h5-webview/h5-webview?url=${item.mobileLink}&title=${item.subject}`
|
||||
// });
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
6
src/uni_modules/uni-config-center/changelog.md
Normal file
6
src/uni_modules/uni-config-center/changelog.md
Normal file
@@ -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)
|
||||
- 初始化项目
|
||||
81
src/uni_modules/uni-config-center/package.json
Normal file
81
src/uni_modules/uni-config-center/package.json
Normal file
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
93
src/uni_modules/uni-config-center/readme.md
Normal file
93
src/uni_modules/uni-config-center/readme.md
Normal file
@@ -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"
|
||||
}
|
||||
36
src/uni_modules/uni-id-common/changelog.md
Normal file
36
src/uni_modules/uni-id-common/changelog.md
Normal file
@@ -0,0 +1,36 @@
|
||||
## 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公共模块
|
||||
84
src/uni_modules/uni-id-common/package.json
Normal file
84
src/uni_modules/uni-id-common/package.json
Normal file
@@ -0,0 +1,84 @@
|
||||
{
|
||||
"id": "uni-id-common",
|
||||
"displayName": "uni-id-common",
|
||||
"version": "1.0.18",
|
||||
"description": "包含uni-id token生成、校验、刷新功能的云函数公共模块",
|
||||
"keywords": [
|
||||
"uni-id-common",
|
||||
"uniCloud",
|
||||
"token",
|
||||
"权限"
|
||||
],
|
||||
"repository": "https://gitcode.net/dcloud/uni-id-common",
|
||||
"engines": {
|
||||
},
|
||||
"dcloudext": {
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": 0
|
||||
},
|
||||
"sourcecode": {
|
||||
"price": 0
|
||||
}
|
||||
},
|
||||
"contact": {
|
||||
"qq": ""
|
||||
},
|
||||
"declaration": {
|
||||
"ads": "无",
|
||||
"data": "无",
|
||||
"permissions": "无"
|
||||
},
|
||||
"npmurl": "",
|
||||
"type": "unicloud-template-function"
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": ["uni-config-center"],
|
||||
"encrypt": [],
|
||||
"platforms": {
|
||||
"cloud": {
|
||||
"tcb": "y",
|
||||
"aliyun": "y",
|
||||
"alipay": "n"
|
||||
},
|
||||
"client": {
|
||||
"Vue": {
|
||||
"vue2": "u",
|
||||
"vue3": "u"
|
||||
},
|
||||
"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",
|
||||
"飞书": "u",
|
||||
"京东": "u"
|
||||
},
|
||||
"快应用": {
|
||||
"华为": "u",
|
||||
"联盟": "u"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
3
src/uni_modules/uni-id-common/readme.md
Normal file
3
src/uni_modules/uni-id-common/readme.md
Normal file
@@ -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.18",
|
||||
"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.18",
|
||||
"plugin-dev-name": "uni-id-common",
|
||||
"plugin-version": "1.0.18"
|
||||
}
|
||||
@@ -60,7 +60,10 @@ const requestHooks = {
|
||||
return Promise.reject();
|
||||
|
||||
default:
|
||||
if(msg)
|
||||
message.alert(msg)
|
||||
else
|
||||
message.alert("网络连接失败,请稍后再试!")
|
||||
// return data;
|
||||
return Promise.reject(msg);
|
||||
}
|
||||
|
||||
46
uniCloud-aliyun/cloudfunctions/testUnipush2/index.js
Normal file
46
uniCloud-aliyun/cloudfunctions/testUnipush2/index.js
Normal file
@@ -0,0 +1,46 @@
|
||||
|
||||
// 'use strict';
|
||||
// const uniPush = uniCloud.getPushManager({appId:"__UNI__4C459F4"}) //注意这里需要传入你的应用appId
|
||||
// exports.main = async (event) => {
|
||||
// console.log(event)
|
||||
// if(event.cid){
|
||||
// let obj = JSON.parse(event.body);
|
||||
// console.log(obj)
|
||||
// const res = await uniPush.sendMessage({
|
||||
// "push_clientid": obj.cids, // 设备id,支持多个以数组的形式指定多个设备,如["cid-1","cid-2"],数组长度不大于1000
|
||||
// "title": obj.title, // 标题
|
||||
// "content": obj.content, // 内容
|
||||
// "settings": obj.settings, // 消息有效期
|
||||
// "payload": obj.payload, // 数据
|
||||
// "category": obj.category, // HarmonyOS NEXT系统(纯血鸿蒙、非安卓鸿蒙)的消息分类,要给鸿蒙设备推送时才必传
|
||||
// "force_notification": true, //填写true,客户端就会对在线消息自动创建“通知栏消息”,不填写则需要客户端自己处理。
|
||||
// "request_id": obj.request_id ,//请求唯一标识号,10-32位之间;如果request_id重复,会导致消息丢失
|
||||
// "options":obj.options //消息分类,没申请可以不传这个参数
|
||||
// })
|
||||
// return res;
|
||||
// }
|
||||
// return {}
|
||||
// };
|
||||
|
||||
// 简单的使用示例 appId: "__UNI__4C459F4"
|
||||
'use strict';
|
||||
const uniPush = uniCloud.getPushManager({
|
||||
appId: "__UNI__0B682E1"
|
||||
})
|
||||
exports.main = async (event) => {
|
||||
console.log(event)
|
||||
let obj = JSON.parse(event.body)
|
||||
const res = await uniPush.sendMessage({
|
||||
"push_clientid": obj.cids, // 设备id,支持多个以数组的形式指定多个设备,如["cid-1","cid-2"],数组长度不大于1000
|
||||
"title": obj.title, // 标题
|
||||
"content": obj.content, // 内容
|
||||
"settings": obj.settings, // 消息有效期
|
||||
"payload": obj.payload, // 数据
|
||||
"category": obj.category, // HarmonyOS NEXT系统(纯血鸿蒙、非安卓鸿蒙)的消息分类,要给鸿蒙设备推送时才必传
|
||||
"force_notification": true, //填写true,客户端就会对在线消息自动创建“通知栏消息”,不填写则需要客户端自己处理。
|
||||
"request_id": obj.request_id ,//请求唯一标识号,10-32位之间;如果request_id重复,会导致消息丢失
|
||||
"options":obj.options //消息分类,没申请可以不传这个参数
|
||||
})
|
||||
return res;
|
||||
};
|
||||
|
||||
7
uniCloud-aliyun/cloudfunctions/testUnipush2/package.json
Normal file
7
uniCloud-aliyun/cloudfunctions/testUnipush2/package.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "testUnipush2",
|
||||
"dependencies": {},
|
||||
"extensions": {
|
||||
"uni-cloud-push": {}
|
||||
}
|
||||
}
|
||||
12
uniCloud-aliyun/database/JQL查询.jql
Normal file
12
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();
|
||||
Reference in New Issue
Block a user