合并分支冲突
This commit is contained in:
@@ -157,6 +157,21 @@ const getTeamLogs = data => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 签约记录
|
||||||
|
const getSignLogs = data => {
|
||||||
|
return request({
|
||||||
|
url: 'business/flows',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取签约合同
|
||||||
|
const getFlows = id => {
|
||||||
|
return request({
|
||||||
|
url: 'e-signs/flows/' + id
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
relations,
|
relations,
|
||||||
code,
|
code,
|
||||||
@@ -176,4 +191,6 @@ export {
|
|||||||
submitTeamName,
|
submitTeamName,
|
||||||
getTeam,
|
getTeam,
|
||||||
getTeamLogs,
|
getTeamLogs,
|
||||||
|
getSignLogs,
|
||||||
|
getFlows
|
||||||
}
|
}
|
||||||
|
|||||||
20
apis/interfaces/yxim.js
Normal file
20
apis/interfaces/yxim.js
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
/**
|
||||||
|
* Web唐明明
|
||||||
|
* 匆匆数载恍如梦,岁月迢迢华发增。
|
||||||
|
* 碌碌无为枉半生,一朝惊醒万事空。
|
||||||
|
* moduleName: 网易云信IM
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { request } from '../index'
|
||||||
|
|
||||||
|
// 获取im登录
|
||||||
|
const imToken = data => {
|
||||||
|
return request({
|
||||||
|
url : 'im/token'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
imToken
|
||||||
|
}
|
||||||
58
im/INIT.js
Normal file
58
im/INIT.js
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
|
||||||
|
import Vue from 'vue'
|
||||||
|
import store from '@/store';
|
||||||
|
import NIMSDK from 'nim-web-sdk-ng/dist/NIM_UNIAPP_SDK'
|
||||||
|
import { imToken } from '@/apis/interfaces/yxim.js'
|
||||||
|
|
||||||
|
export const INIT = async () => {
|
||||||
|
|
||||||
|
let APPKEY = ''
|
||||||
|
let TOKEN = ''
|
||||||
|
let UID = ''
|
||||||
|
|
||||||
|
if( store.getters.getToken == '' || uni.getStorageSync('token') == '' ){
|
||||||
|
return '用户未登录'
|
||||||
|
}
|
||||||
|
|
||||||
|
await imToken().then(res => {
|
||||||
|
let { app_key, token, uid } = res;
|
||||||
|
APPKEY = app_key
|
||||||
|
TOKEN = token
|
||||||
|
UID = uid
|
||||||
|
}).catch(err => {
|
||||||
|
uni.showToast({
|
||||||
|
title: 'IM INIT ERR' + err.code,
|
||||||
|
icon : 'none'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
const yxim = new NIMSDK({
|
||||||
|
appkey : APPKEY,
|
||||||
|
account : UID,
|
||||||
|
token : TOKEN,
|
||||||
|
debugLevel : 'debug',
|
||||||
|
needReconnect : true,
|
||||||
|
reconnectionAttempts: 5
|
||||||
|
})
|
||||||
|
|
||||||
|
// 注册监听事件
|
||||||
|
const eventList = [
|
||||||
|
'logined',
|
||||||
|
'kicked',
|
||||||
|
'willReconnect',
|
||||||
|
'disconnect',
|
||||||
|
'msg',
|
||||||
|
'syncdone',
|
||||||
|
]
|
||||||
|
|
||||||
|
eventList.forEach(key => {
|
||||||
|
yxim.on(key, res => {
|
||||||
|
console.log(`{$key}:`, res ? JSON.parse(JSON.stringify(res)): res)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
await yxim.connect();
|
||||||
|
|
||||||
|
// 挂载全局变量方法
|
||||||
|
Vue.prototype.$nim = yxim;
|
||||||
|
}
|
||||||
28
main.js
28
main.js
@@ -7,16 +7,20 @@ import store from './store'
|
|||||||
import { router, RouterMount } from 'router'
|
import { router, RouterMount } from 'router'
|
||||||
import Mylink from './node_modules/uni-simple-router/dist/link.vue'
|
import Mylink from './node_modules/uni-simple-router/dist/link.vue'
|
||||||
|
|
||||||
Vue.component('my-link', Mylink)
|
import { INIT } from './im/INIT'
|
||||||
|
|
||||||
Vue.use(uView)
|
// (async () => {
|
||||||
Vue.use(router)
|
Vue.component('my-link', Mylink)
|
||||||
|
Vue.use(uView)
|
||||||
Vue.config.productionTip = false
|
Vue.use(router)
|
||||||
App.mpType = 'app'
|
|
||||||
const app = new Vue({
|
// await INIT();
|
||||||
store,
|
|
||||||
...App
|
Vue.config.productionTip = false
|
||||||
})
|
App.mpType = 'app'
|
||||||
|
const app = new Vue({
|
||||||
app.$mount()
|
store,
|
||||||
|
...App
|
||||||
|
})
|
||||||
|
app.$mount()
|
||||||
|
// })()
|
||||||
|
|||||||
51
package-lock.json
generated
51
package-lock.json
generated
@@ -10,6 +10,7 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"moment": "^2.29.4",
|
"moment": "^2.29.4",
|
||||||
|
"nim-web-sdk-ng": "^0.12.3",
|
||||||
"uni-read-pages": "^1.0.5",
|
"uni-read-pages": "^1.0.5",
|
||||||
"uni-simple-router": "^2.0.7",
|
"uni-simple-router": "^2.0.7",
|
||||||
"uview-ui": "^2.0.31",
|
"uview-ui": "^2.0.31",
|
||||||
@@ -164,6 +165,16 @@
|
|||||||
"integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",
|
"integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",
|
||||||
"peer": true
|
"peer": true
|
||||||
},
|
},
|
||||||
|
"node_modules/eventemitter3": {
|
||||||
|
"version": "4.0.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
|
||||||
|
"integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw=="
|
||||||
|
},
|
||||||
|
"node_modules/lodash-es": {
|
||||||
|
"version": "4.17.21",
|
||||||
|
"resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz",
|
||||||
|
"integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw=="
|
||||||
|
},
|
||||||
"node_modules/magic-string": {
|
"node_modules/magic-string": {
|
||||||
"version": "0.25.9",
|
"version": "0.25.9",
|
||||||
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz",
|
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz",
|
||||||
@@ -192,11 +203,26 @@
|
|||||||
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
|
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/nim-web-sdk-ng": {
|
||||||
|
"version": "0.12.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/nim-web-sdk-ng/-/nim-web-sdk-ng-0.12.3.tgz",
|
||||||
|
"integrity": "sha512-S1RYQDz5n/tCqdHVv5fIBKBB60hdvySLTLo1xSgPVrk725GrGSXXyblWZeaWazUoFuLzfSKyrK0LRCJoAMcHYw==",
|
||||||
|
"dependencies": {
|
||||||
|
"eventemitter3": "^4.0.7",
|
||||||
|
"lodash-es": "^4.17.21",
|
||||||
|
"platform": "^1.3.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/picocolors": {
|
"node_modules/picocolors": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz",
|
||||||
"integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ=="
|
"integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ=="
|
||||||
},
|
},
|
||||||
|
"node_modules/platform": {
|
||||||
|
"version": "1.3.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz",
|
||||||
|
"integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg=="
|
||||||
|
},
|
||||||
"node_modules/postcss": {
|
"node_modules/postcss": {
|
||||||
"version": "8.4.20",
|
"version": "8.4.20",
|
||||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.20.tgz",
|
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.20.tgz",
|
||||||
@@ -457,6 +483,16 @@
|
|||||||
"integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",
|
"integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",
|
||||||
"peer": true
|
"peer": true
|
||||||
},
|
},
|
||||||
|
"eventemitter3": {
|
||||||
|
"version": "4.0.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
|
||||||
|
"integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw=="
|
||||||
|
},
|
||||||
|
"lodash-es": {
|
||||||
|
"version": "4.17.21",
|
||||||
|
"resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz",
|
||||||
|
"integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw=="
|
||||||
|
},
|
||||||
"magic-string": {
|
"magic-string": {
|
||||||
"version": "0.25.9",
|
"version": "0.25.9",
|
||||||
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz",
|
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz",
|
||||||
@@ -476,11 +512,26 @@
|
|||||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz",
|
||||||
"integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw=="
|
"integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw=="
|
||||||
},
|
},
|
||||||
|
"nim-web-sdk-ng": {
|
||||||
|
"version": "0.12.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/nim-web-sdk-ng/-/nim-web-sdk-ng-0.12.3.tgz",
|
||||||
|
"integrity": "sha512-S1RYQDz5n/tCqdHVv5fIBKBB60hdvySLTLo1xSgPVrk725GrGSXXyblWZeaWazUoFuLzfSKyrK0LRCJoAMcHYw==",
|
||||||
|
"requires": {
|
||||||
|
"eventemitter3": "^4.0.7",
|
||||||
|
"lodash-es": "^4.17.21",
|
||||||
|
"platform": "^1.3.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"picocolors": {
|
"picocolors": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz",
|
||||||
"integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ=="
|
"integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ=="
|
||||||
},
|
},
|
||||||
|
"platform": {
|
||||||
|
"version": "1.3.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz",
|
||||||
|
"integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg=="
|
||||||
|
},
|
||||||
"postcss": {
|
"postcss": {
|
||||||
"version": "8.4.20",
|
"version": "8.4.20",
|
||||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.20.tgz",
|
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.20.tgz",
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"moment": "^2.29.4",
|
"moment": "^2.29.4",
|
||||||
|
"nim-web-sdk-ng": "^0.12.3",
|
||||||
"uni-read-pages": "^1.0.5",
|
"uni-read-pages": "^1.0.5",
|
||||||
"uni-simple-router": "^2.0.7",
|
"uni-simple-router": "^2.0.7",
|
||||||
"uview-ui": "^2.0.31",
|
"uview-ui": "^2.0.31",
|
||||||
|
|||||||
1212
pages.json
1212
pages.json
File diff suppressed because it is too large
Load Diff
@@ -3,23 +3,18 @@
|
|||||||
<list>
|
<list>
|
||||||
<cell v-for="(item, index) in 99" :key="index">消息{{index}}</cell>
|
<cell v-for="(item, index) in 99" :key="index">消息{{index}}</cell>
|
||||||
</list>
|
</list>
|
||||||
<!-- <view class="chat-soll">
|
<view class="footer">
|
||||||
<view v-for="(item, index) in 50" :key="index">{{item}}滚动的聊天记录</view>
|
<input type="text" placeholder="输入聊天消息">
|
||||||
</view>
|
<view class="">
|
||||||
<view class="chat-footer">
|
表情包组件
|
||||||
<view class="chat-inputs">
|
|
||||||
<view class="chat-icon">
|
|
||||||
<image src="@/static/im/icon_01.png" mode="widthFix"></image>
|
|
||||||
</view>
|
|
||||||
<input class="chat-input" type="text" placeholder="输入框" confirm-type="send">
|
|
||||||
<view class="chat-icon">
|
|
||||||
<image src="@/static/im/icon_02.png" mode="widthFix"></image>
|
|
||||||
</view>
|
|
||||||
<view class="chat-icon">
|
|
||||||
<image src="@/static/im/icon_00.png" mode="widthFix"></image>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view> -->
|
<view class="">
|
||||||
|
<view>图片</view>
|
||||||
|
<view>视频</view>
|
||||||
|
<view>音频通话</view>
|
||||||
|
<view>视频通话</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
shape="square"
|
shape="square"
|
||||||
randomBgColor
|
randomBgColor
|
||||||
></u-avatar>
|
></u-avatar>
|
||||||
<view class="item-content">
|
<view class="item-content">
|
||||||
<view class="nickname nowrap">
|
<view class="nickname nowrap">
|
||||||
<view class="nowrap">{{item.nickname}}</view>
|
<view class="nowrap">{{item.nickname}}</view>
|
||||||
<view class="time">{{item.time}}</view>
|
<view class="time">{{item.time}}</view>
|
||||||
@@ -58,6 +58,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
onShow() {
|
||||||
|
// this.$nim.msg()
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onMsg(id){
|
onMsg(id){
|
||||||
let cartId = id || null
|
let cartId = id || null
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<radio class="choose-radio" value="wx" :checked="payMethod == 'wx'"></radio>
|
<radio class="choose-radio" value="wx" :checked="payMethod == 'wx'"></radio>
|
||||||
</label>
|
</label>
|
||||||
<label class="choose-item nowrap">
|
<label class="choose-item nowrap" v-if="Number(total) <= 5000">
|
||||||
<view class="choose-text">
|
<view class="choose-text">
|
||||||
<image src="@/static/icons/pay_ali.png" mode="aspectFill"></image>
|
<image src="@/static/icons/pay_ali.png" mode="aspectFill"></image>
|
||||||
支付宝支付
|
支付宝支付
|
||||||
|
|||||||
146
pages/user/contract.vue
Normal file
146
pages/user/contract.vue
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
<template>
|
||||||
|
<view class="content">
|
||||||
|
<!-- 合同信息 -->
|
||||||
|
<view class="block">
|
||||||
|
<view class="block-flex">
|
||||||
|
<label>合同ID</label>
|
||||||
|
<view class="block-val">{{id}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="block-flex">
|
||||||
|
<label>合同数量</label>
|
||||||
|
<view class="nowrap block-val">{{files.length}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="block-flex">
|
||||||
|
<label>附件数量</label>
|
||||||
|
<view class="nowrap block-val">{{attachments.length}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="block-flex">
|
||||||
|
<label>创建时间</label>
|
||||||
|
<view class="nowrap block-val">{{created_at || '-'}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="block-flex">
|
||||||
|
<label>更新时间</label>
|
||||||
|
<view class="nowrap block-val">{{updated_at || '-'}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 合同文件 -->
|
||||||
|
<view class="files-title">合同文件列表</view>
|
||||||
|
<view class="files">
|
||||||
|
<view class="files-flex" v-for="(item, index) in files" :key="index" @click="onPdf(item.fileName, item.downloadUrl)">
|
||||||
|
<view class="files-flex-title">{{item.fileName}}</view>
|
||||||
|
<view class="files-flex-id">{{item.fileId}}</view>
|
||||||
|
<u-icon class="files-flex-icon" name="arrow-right" size="28rpx"></u-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 附件文件 -->
|
||||||
|
<view class="files-title">附件文件列表</view>
|
||||||
|
<view class="files">
|
||||||
|
<view class="files-flex" v-for="(item, index) in attachments" :key="index" @click="onPdf(item.fileName, item.downloadUrl)">
|
||||||
|
<view class="files-flex-title">{{item.fileName}}</view>
|
||||||
|
<view class="files-flex-id">{{item.fileId}}</view>
|
||||||
|
<u-icon class="files-flex-icon" name="arrow-right" size="28rpx"></u-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const plugin = uni.requireNativePlugin('Pdf-Plugin')
|
||||||
|
import { getFlows } from '@/apis/interfaces/user.js'
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
user : { name: '', mobile: '' },
|
||||||
|
id : '',
|
||||||
|
created_at : '',
|
||||||
|
updated_at : '',
|
||||||
|
files : [],
|
||||||
|
attachments : []
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
uni.setUserCaptureScreen({
|
||||||
|
enable: false,
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
// 获取合同数据
|
||||||
|
uni.showLoading({
|
||||||
|
title: '加载中...',
|
||||||
|
mask : true
|
||||||
|
})
|
||||||
|
getFlows(this.$Route.query.id).then(res => {
|
||||||
|
const { sign_flow_id, files, attachments, created_at, updated_at, user } = res
|
||||||
|
this.user = user
|
||||||
|
this.id = sign_flow_id
|
||||||
|
this.created_at = created_at
|
||||||
|
this.updated_at = updated_at
|
||||||
|
this.files = files
|
||||||
|
this.attachments = attachments
|
||||||
|
uni.hideLoading()
|
||||||
|
}).catch(err => {
|
||||||
|
uni.showToast({
|
||||||
|
title: err.message,
|
||||||
|
icon : 'none'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onPdf(name, url){
|
||||||
|
plugin.showPdf({
|
||||||
|
title : name,
|
||||||
|
url : url,
|
||||||
|
maxScale : '20',
|
||||||
|
waterMark : '河北抖火法律咨询服务有限公司',
|
||||||
|
// this.user.name + ' ' + this.user.mobile,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onUnload() {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
uni.setUserCaptureScreen({
|
||||||
|
enable: true
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.content{ padding: 10rpx 30rpx; }
|
||||||
|
|
||||||
|
// 合同信息统计
|
||||||
|
.block {
|
||||||
|
background: white;
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
padding: 30rpx;
|
||||||
|
border-radius: $radius;
|
||||||
|
&-flex{
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
font-size: 30rpx;
|
||||||
|
line-height: 60rpx;
|
||||||
|
label{ color: gray; }
|
||||||
|
.block-val{ width: calc(100% - 200rpx); text-align: right; word-break:break-all; word-wrap: break-word; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 合同列表
|
||||||
|
.files{
|
||||||
|
background: white;
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
padding: 30rpx;
|
||||||
|
border-radius: $radius;
|
||||||
|
&-flex{
|
||||||
|
position: relative;
|
||||||
|
padding-right: 40rpx;
|
||||||
|
.files-flex-title{ font-weight: bold; font-size: 32rpx; }
|
||||||
|
.files-flex-id{ font-size: 28rpx; color: gray; }
|
||||||
|
.files-flex-icon{ position: absolute; right: 0; top: 50%; margin-top: -14rpx;}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.files-title{ padding-bottom: 20rpx; color: gray; font-size: 28rpx; }
|
||||||
|
</style>
|
||||||
@@ -99,7 +99,16 @@
|
|||||||
</view>
|
</view>
|
||||||
<u-icon name="arrow-right" color="#cacaca" size="34rpx" bold></u-icon>
|
<u-icon name="arrow-right" color="#cacaca" size="34rpx" bold></u-icon>
|
||||||
</view>
|
</view>
|
||||||
<view class="border-solid-empty"></view>
|
<view class="border-solid-empty"></view>
|
||||||
|
<view class="nav-flex" @click="updateApp">
|
||||||
|
<view class="nav-icon">
|
||||||
|
<image class="nav-icon-src" src="@/static/icons/user_nav_08.png"></image>版本检测
|
||||||
|
</view>
|
||||||
|
<view class="nav-text">
|
||||||
|
<text>V{{version}}</text>
|
||||||
|
<u-icon name="arrow-right" color="#cacaca" size="34rpx" bold></u-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<view class="nav-flex" @click="onNav('UserSet')">
|
<view class="nav-flex" @click="onNav('UserSet')">
|
||||||
<view class="nav-icon">
|
<view class="nav-icon">
|
||||||
<image class="nav-icon-src" src="@/static/icons/user_nav_05.png"></image>设置
|
<image class="nav-icon-src" src="@/static/icons/user_nav_05.png"></image>设置
|
||||||
@@ -160,23 +169,20 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import { info, relationsVerify, relationsBind, submitTeamName } from '@/apis/interfaces/user.js'
|
||||||
info,
|
import { getVersions } from '@/apis/interfaces/versions'
|
||||||
relationsVerify,
|
|
||||||
relationsBind,
|
|
||||||
submitTeamName,
|
|
||||||
} from '@/apis/interfaces/user.js'
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isAuth: false,
|
version : plus.runtime.version,
|
||||||
nickname: '',
|
isAuth : false,
|
||||||
identity: '',
|
nickname : '',
|
||||||
team_name:'',
|
identity : '',
|
||||||
avatar: '',
|
team_name :'',
|
||||||
certification: '',
|
avatar : '',
|
||||||
|
certification : '',
|
||||||
// 绑定关系
|
// 绑定关系
|
||||||
bindTypeArr: [{
|
bindTypeArr : [{
|
||||||
name: '手机号',
|
name: '手机号',
|
||||||
value: 'mobile'
|
value: 'mobile'
|
||||||
},
|
},
|
||||||
@@ -185,22 +191,22 @@
|
|||||||
value: 'verify'
|
value: 'verify'
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
bindTypeVal: 'mobile',
|
bindTypeVal : 'mobile',
|
||||||
showBind: false,
|
showBind : false,
|
||||||
isInvitation: true,
|
isInvitation : true,
|
||||||
parent: '',
|
parent : '',
|
||||||
invitationUser: {
|
invitationUser : {
|
||||||
avatar: '',
|
avatar : '',
|
||||||
nickname: '',
|
nickname : '',
|
||||||
username: ''
|
username : ''
|
||||||
},
|
},
|
||||||
invitation: '',
|
invitation : '',
|
||||||
yunyingShow:false, // 运营中心是否展示
|
yunyingShow :false, // 运营中心是否展示
|
||||||
yunying_name:'', // 运营名称
|
yunying_name :'', // 运营名称
|
||||||
team_status:'', // 状态 0 不展示运营中心 1可以申请但是没有完善,2申请完,审核中,3已通过,已修改
|
team_status :'', // 状态 0 不展示运营中心 1可以申请但是没有完善,2申请完,审核中,3已通过,已修改
|
||||||
team_id:'',
|
team_id :'',
|
||||||
region_status:'', // 状态 0 不展示 大区中心 1可以申请但是没有完善,2申请完,审核中,3已通过,已修改
|
region_status :'', // 状态 0 不展示 大区中心 1可以申请但是没有完善,2申请完,审核中,3已通过,已修改
|
||||||
region_id:'',
|
region_id :'',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
@@ -421,7 +427,73 @@
|
|||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// 检查版本更新
|
||||||
|
updateApp() {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '检查更新'
|
||||||
|
})
|
||||||
|
//#ifdef APP-PLUS
|
||||||
|
// 获取系统版本号
|
||||||
|
getVersions({
|
||||||
|
platform: plus.os.name,
|
||||||
|
version : plus.runtime.version
|
||||||
|
}).then(res => {
|
||||||
|
uni.hideLoading()
|
||||||
|
if (res.update) {
|
||||||
|
uni.showModal({
|
||||||
|
title: "更新提示",
|
||||||
|
content: res.note || '版本更新信息',
|
||||||
|
confirmText: "更新",
|
||||||
|
success: modalRes => {
|
||||||
|
if (modalRes.confirm) {
|
||||||
|
if (plus.os.name == "Android") {
|
||||||
|
uni.showToast({
|
||||||
|
title: '新版本下载中,将在下载完成后自动为您安装更新包',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
uni.downloadFile({
|
||||||
|
url: res.info.download,
|
||||||
|
success: apkPick => {
|
||||||
|
plus.runtime.install(apkPick
|
||||||
|
.tempFilePath, '',
|
||||||
|
installRES => {
|
||||||
|
// 安装完成用于提示新版本引导,暂时无用
|
||||||
|
}, installERR => {
|
||||||
|
// 安装失败
|
||||||
|
})
|
||||||
|
},
|
||||||
|
fail(err) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '安装包下载失败,请检查您的网络或稍后重试',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '暂无ios版本这块留着后续用',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
uni.showModal({
|
||||||
|
title: "提示",
|
||||||
|
content: "当前已是最新版本",
|
||||||
|
showCancel: false,
|
||||||
|
})
|
||||||
|
}).catch(err => {
|
||||||
|
uni.showToast({
|
||||||
|
title: err.message,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
//#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -446,7 +518,15 @@
|
|||||||
margin-right: $margin;
|
margin-right: $margin;
|
||||||
margin-top: 5rpx;
|
margin-top: 5rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.nav-text{
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
align-items: center;
|
||||||
|
color: #999;
|
||||||
|
font-size: 30rpx;
|
||||||
|
text{ padding-right: 10rpx; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 用户信息
|
// 用户信息
|
||||||
|
|||||||
@@ -30,6 +30,14 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="set-nav-block">
|
||||||
|
<view class="set-nav" @click="onNav('SignLog')">
|
||||||
|
<label>合同记录</label>
|
||||||
|
<view class="value nowrap">
|
||||||
|
<uni-icons type="right" color="gray"></uni-icons>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<view class="set-nav-block">
|
<view class="set-nav-block">
|
||||||
<view class="set-nav" @click="onLogout">
|
<view class="set-nav" @click="onLogout">
|
||||||
<label>退出登录</label>
|
<label>退出登录</label>
|
||||||
|
|||||||
116
pages/user/signLog.vue
Normal file
116
pages/user/signLog.vue
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
<template>
|
||||||
|
<view class="content">
|
||||||
|
<block v-if="logs.length <= 0">
|
||||||
|
<view class="null-pages">
|
||||||
|
<u-empty
|
||||||
|
mode="history"
|
||||||
|
icon="http://cdn.uviewui.com/uview/empty/history.png"
|
||||||
|
text="暂无合同签约记录"
|
||||||
|
>
|
||||||
|
</u-empty>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
<block v-else>
|
||||||
|
<view class="log-blcok" v-for="(item, index) in logs" :key="index" @click="onInfo(item.business_order_id)">
|
||||||
|
<view class="flex">
|
||||||
|
<label>订单编号:</label>
|
||||||
|
<view class="val">{{item.order_no}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="flex">
|
||||||
|
<label>业务类型:</label>
|
||||||
|
<view class="val">
|
||||||
|
<text v-for="(titem, tindex) in item.item_type" :key="tindex">{{titem.title}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="flex">
|
||||||
|
<label>签约时间:</label>
|
||||||
|
<view class="val">{{item.created_at}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="pages-loding" v-if="isLoding">
|
||||||
|
<u-loadmore :status="status" loadingIcon="semicircle" />
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getSignLogs, getFlows } from '@/apis/interfaces/user.js'
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
status : 'loading',
|
||||||
|
isLoding: false,
|
||||||
|
logs : [],
|
||||||
|
page : { current : 0 }
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getLog()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getLog(){
|
||||||
|
uni.showLoading({
|
||||||
|
title: '加载中...',
|
||||||
|
mask : true
|
||||||
|
})
|
||||||
|
getSignLogs({
|
||||||
|
page: this.page.current
|
||||||
|
}).then(res => {
|
||||||
|
let { data, page } = res;
|
||||||
|
let atArr = page.current == 1 ? [] : this.logs
|
||||||
|
this.logs = atArr.concat(data)
|
||||||
|
this.page = page
|
||||||
|
this.status = !page.has_more ? 'nomore': 'loading'
|
||||||
|
this.isLoding = !page.has_more
|
||||||
|
uni.hideLoading()
|
||||||
|
}).catch(err => {
|
||||||
|
uni.showToast({
|
||||||
|
title: err.message,
|
||||||
|
icon : 'none'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onInfo(id){
|
||||||
|
this.$Router.push({
|
||||||
|
name : 'SignContract',
|
||||||
|
params : { id }
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onReachBottom(){
|
||||||
|
this.isLoding = true
|
||||||
|
if(this.page.has_more){
|
||||||
|
this.page.current++
|
||||||
|
this.getLog()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.content{ padding: 30rpx 30rpx 10rpx; box-sizing: border-box; }
|
||||||
|
|
||||||
|
// 订单列表
|
||||||
|
.log-blcok{
|
||||||
|
background: white;
|
||||||
|
border-radius: $radius;
|
||||||
|
padding: $padding;
|
||||||
|
position: relative;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
// .log-icon{ position: absolute; right: $margin; top: 50%; margin-top: -14rpx; }
|
||||||
|
.flex{
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
font-size: 30rpx;
|
||||||
|
line-height: 60rpx;
|
||||||
|
label{ color: gray; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 分页加载
|
||||||
|
.pages-loding{ padding: 10rpx; }
|
||||||
|
|
||||||
|
// 记录为空
|
||||||
|
.null-pages{ display: flex; align-items: center; justify-content: space-around; height: 80vh;}
|
||||||
|
</style>
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
<text class="identity identity-1" v-if="item.identity.order == 1">普通用户</text>
|
<text class="identity identity-1" v-if="item.identity.order == 1">普通用户</text>
|
||||||
<text class="identity identity-3" v-if="item.identity.order == 3">顾问</text>
|
<text class="identity identity-3" v-if="item.identity.order == 3">顾问</text>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="nowrap submit">团队业绩:{{ item.show_perf ? item.perf: '身份不符暂无业绩' }}</view>
|
||||||
<view class="nowrap submit">联系电话:{{item.username}}</view>
|
<view class="nowrap submit">联系电话:{{item.username}}</view>
|
||||||
<view class="nowrap submit">注册时间:{{item.created_at}}</view>
|
<view class="nowrap submit">注册时间:{{item.created_at}}</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -74,6 +75,8 @@
|
|||||||
page : this.page.current
|
page : this.page.current
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
let { users, count } = res;
|
let { users, count } = res;
|
||||||
|
|
||||||
|
console.log(users)
|
||||||
let atList = users.page.current == 1 ? [] : this.users
|
let atList = users.page.current == 1 ? [] : this.users
|
||||||
this.count = count
|
this.count = count
|
||||||
this.users = atList.concat(users.data)
|
this.users = atList.concat(users.data)
|
||||||
|
|||||||
@@ -11,12 +11,16 @@
|
|||||||
<!-- 机构 -->
|
<!-- 机构 -->
|
||||||
<view class="block-item">
|
<view class="block-item">
|
||||||
<label class="block-item-label"><text>*</text>机构</label>
|
<label class="block-item-label"><text>*</text>机构</label>
|
||||||
<picker :range="item.institution" range-key="title" :value="item.institutionIndex" @change="institutionChange($event, item, index)">
|
<!-- <picker :range="item.institution" range-key="title" :value="item.institutionIndex" @change="institutionChange($event, item, index)">
|
||||||
<view class="institution-picker">
|
<view class="institution-picker">
|
||||||
<view class="institution-picker-text nowrap">{{item.institution[item.institutionIndex].title}}</view>
|
<view class="institution-picker-text nowrap">{{item.institution[item.institutionIndex].title}}</view>
|
||||||
<u-icon size="12" color="#999" name="arrow-down-fill"></u-icon>
|
<u-icon size="12" color="#999" name="arrow-down-fill"></u-icon>
|
||||||
</view>
|
</view>
|
||||||
</picker>
|
</picker> -->
|
||||||
|
<view class="institution-picker" @click="onShowInstitution(item.institution, item, index)">
|
||||||
|
<view class="institution-picker-text nowrap">{{item.institution[item.institutionIndex].title}}</view>
|
||||||
|
<u-icon size="12" color="#999" name="arrow-down-fill"></u-icon>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 业务类型 -->
|
<!-- 业务类型 -->
|
||||||
<view class="block-item">
|
<view class="block-item">
|
||||||
@@ -103,6 +107,13 @@
|
|||||||
<button @click="onSubmit">提交</button>
|
<button @click="onSubmit">提交</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- 机构弹出层 -->
|
||||||
|
<oct-mechanism-picker
|
||||||
|
ref="institutionPicker"
|
||||||
|
title="选择办理机构"
|
||||||
|
:columns="columns"
|
||||||
|
@choose="institutionChange"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -113,9 +124,12 @@
|
|||||||
components: { octpicker },
|
components: { octpicker },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
columns : [],
|
||||||
businessArr: [],
|
businessArr: [],
|
||||||
serviceUser: '',
|
serviceUser: '',
|
||||||
serviceArr : [],
|
serviceArr : [],
|
||||||
|
old : {},
|
||||||
|
cIndex : 0
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@@ -125,6 +139,13 @@
|
|||||||
this.serviceUser = serviceUser
|
this.serviceUser = serviceUser
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 显示选择机构
|
||||||
|
onShowInstitution(e, item, index){
|
||||||
|
this.columns = e
|
||||||
|
this.old = item
|
||||||
|
this.cIndex = index
|
||||||
|
this.$refs.institutionPicker.open()
|
||||||
|
},
|
||||||
// 移出选项
|
// 移出选项
|
||||||
onRemove(index){
|
onRemove(index){
|
||||||
this.serviceArr.splice(index, 1)
|
this.serviceArr.splice(index, 1)
|
||||||
@@ -202,10 +223,12 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 机构变更更新业务
|
// 机构变更更新业务
|
||||||
institutionChange(e, old, index){
|
institutionChange(e){
|
||||||
let { value } = e.detail;
|
let index = this.cIndex
|
||||||
|
let old = this.old
|
||||||
|
let value = old.institution.findIndex(val => val.institution_id === e.val.institution_id);
|
||||||
let businessId = old.subVal.business_id
|
let businessId = old.subVal.business_id
|
||||||
|
|
||||||
// 获取机构的子业务类型
|
// 获取机构的子业务类型
|
||||||
let forms = this.getForms(old.institution[value].institution_id)
|
let forms = this.getForms(old.institution[value].institution_id)
|
||||||
forms.then(institutionVal => {
|
forms.then(institutionVal => {
|
||||||
|
|||||||
BIN
static/icons/user_nav_08.png
Normal file
BIN
static/icons/user_nav_08.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.1 KiB |
0
uni_modules/oct-mechanism-picker/changelog.md
Normal file
0
uni_modules/oct-mechanism-picker/changelog.md
Normal file
@@ -0,0 +1,177 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<uni-popup ref="octMechanismPicker">
|
||||||
|
<view class="mechanism--content">
|
||||||
|
<view class="mechanism--title" v-if="title != null">{{title}}</view>
|
||||||
|
<view class="mechanism--input">
|
||||||
|
<input type="text" placeholder="输入关键字筛选" v-model="searchValue" @input="onSearch($event)">
|
||||||
|
<view class="mechanism--clear" @click="onClear" v-if="searchValue.length > 0">
|
||||||
|
<uni-icons type="clear" size="20" color="#c3c3c3"></uni-icons>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<scroll-view class="mechanism--scroll" scroll-y show-scrollbar>
|
||||||
|
<block v-if="searchValue.length > 0">
|
||||||
|
<view class="mechanism--item" v-for="(item, index) in searchArr" :key="index" v-if="searchArr.length > 0" @click="onChoose(item, index)">
|
||||||
|
<view class="mechanism--text">{{item.title}}</view>
|
||||||
|
<uni-icons type="right" size="20" color="#c3c3c3"></uni-icons>
|
||||||
|
</view>
|
||||||
|
<view class="mechanism--null" v-if="searchArr.length <= 0">
|
||||||
|
<view>暂无与<text>[{{searchValue}}]</text>相关的搜索结果</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
<block v-else>
|
||||||
|
<view class="mechanism--item" v-for="(item, index) in columns" :key="index" @click="onChoose(item, index)">
|
||||||
|
<view class="mechanism--text">{{item.title}}</view>
|
||||||
|
<uni-icons type="right" size="20" color="#c3c3c3"></uni-icons>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</scroll-view>
|
||||||
|
<button class="mechanism--button" @click="clear">取消</button>
|
||||||
|
</view>
|
||||||
|
</uni-popup>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default{
|
||||||
|
data(){
|
||||||
|
return{
|
||||||
|
searchValue: '',
|
||||||
|
searchArr : []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
props : {
|
||||||
|
// 弹出层标题
|
||||||
|
title : {
|
||||||
|
type : String,
|
||||||
|
default : null
|
||||||
|
},
|
||||||
|
// 默认值
|
||||||
|
value : {
|
||||||
|
type : Number,
|
||||||
|
default : 0
|
||||||
|
},
|
||||||
|
// 选项
|
||||||
|
columns : {
|
||||||
|
type : Array,
|
||||||
|
default : () => {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods : {
|
||||||
|
// 弹出层
|
||||||
|
open(type){
|
||||||
|
this.$refs.octMechanismPicker.open(type || 'bottom')
|
||||||
|
},
|
||||||
|
// 关闭弹出层
|
||||||
|
clear(){
|
||||||
|
this.$refs.octMechanismPicker.close()
|
||||||
|
this.onClear()
|
||||||
|
},
|
||||||
|
// 选择选项
|
||||||
|
onChoose(val, index){
|
||||||
|
this.$emit('choose', {val, index})
|
||||||
|
this.clear()
|
||||||
|
},
|
||||||
|
// 筛选输入框
|
||||||
|
onSearch(e){
|
||||||
|
let { value } = e.target
|
||||||
|
let columns = this.columns
|
||||||
|
let searchArr = []
|
||||||
|
for(let obj of columns){
|
||||||
|
if(obj.title.includes(value)){
|
||||||
|
searchArr.push(obj)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.searchArr = searchArr
|
||||||
|
},
|
||||||
|
// 清理搜索内容
|
||||||
|
onClear(){
|
||||||
|
this.searchValue = ''
|
||||||
|
this.searchArr = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.mechanism--content{
|
||||||
|
background: white;
|
||||||
|
border-radius: 20rpx 20rpx 0 0;
|
||||||
|
overflow: hidden;
|
||||||
|
.mechanism--title{
|
||||||
|
text-align: center;
|
||||||
|
position: relative;
|
||||||
|
padding: 30rpx 50rpx;
|
||||||
|
font-size: 34rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
&::after {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 1rpx;
|
||||||
|
background-image: linear-gradient(0deg, $border-color 50%, transparent 50%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.mechanism--input{
|
||||||
|
padding: 30rpx 50rpx;
|
||||||
|
position: relative;
|
||||||
|
& > input{
|
||||||
|
background: #f8f8f8;
|
||||||
|
padding: 0 30rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
font-size: 30rpx;
|
||||||
|
}
|
||||||
|
.mechanism--clear{
|
||||||
|
position: absolute;
|
||||||
|
top: 30rpx;
|
||||||
|
right: 50rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
width: 80rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.mechanism--scroll{
|
||||||
|
padding: 0 50rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
height: 50vh;
|
||||||
|
.mechanism--item{
|
||||||
|
line-height: 90rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
.mechanism--text{
|
||||||
|
width: 80%;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.mechanism--null{
|
||||||
|
height: 40vh;
|
||||||
|
line-height: 40vh;
|
||||||
|
font-size: 30rpx;
|
||||||
|
color: gray;
|
||||||
|
text-align: center;
|
||||||
|
text{
|
||||||
|
color: #446EFE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.mechanism--button{
|
||||||
|
margin: 30rpx 50rpx;
|
||||||
|
background: #446EFE;
|
||||||
|
color: white;
|
||||||
|
font-size: 34rpx;
|
||||||
|
height: 90rpx;
|
||||||
|
line-height: 90rpx;
|
||||||
|
padding: 0;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
&::after{ display: none; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
81
uni_modules/oct-mechanism-picker/package.json
Normal file
81
uni_modules/oct-mechanism-picker/package.json
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
{
|
||||||
|
"id": "oct-mechanism-picker",
|
||||||
|
"displayName": "oct-mechanism-picker",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "oct-mechanism-picker",
|
||||||
|
"keywords": [
|
||||||
|
"oct-mechanism-picker"
|
||||||
|
],
|
||||||
|
"repository": "",
|
||||||
|
"engines": {
|
||||||
|
"HBuilderX": "^3.1.0"
|
||||||
|
},
|
||||||
|
"dcloudext": {
|
||||||
|
"type": "component-vue",
|
||||||
|
"sale": {
|
||||||
|
"regular": {
|
||||||
|
"price": "0.00"
|
||||||
|
},
|
||||||
|
"sourcecode": {
|
||||||
|
"price": "0.00"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"contact": {
|
||||||
|
"qq": ""
|
||||||
|
},
|
||||||
|
"declaration": {
|
||||||
|
"ads": "",
|
||||||
|
"data": "",
|
||||||
|
"permissions": ""
|
||||||
|
},
|
||||||
|
"npmurl": ""
|
||||||
|
},
|
||||||
|
"uni_modules": {
|
||||||
|
"dependencies": [],
|
||||||
|
"encrypt": [],
|
||||||
|
"platforms": {
|
||||||
|
"cloud": {
|
||||||
|
"tcb": "u",
|
||||||
|
"aliyun": "u"
|
||||||
|
},
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1
uni_modules/oct-mechanism-picker/readme.md
Normal file
1
uni_modules/oct-mechanism-picker/readme.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# oct-mechanism-picker
|
||||||
10
uni_modules/uni-usercapturescreen/changelog.md
Normal file
10
uni_modules/uni-usercapturescreen/changelog.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
## 1.0.4(2023-03-24)
|
||||||
|
新增开启/关闭防截屏功能
|
||||||
|
## 1.0.3(2023-03-17)
|
||||||
|
修复android平台 部分场景下js可能报错的问题
|
||||||
|
## 1.0.2(2023-03-16)
|
||||||
|
修复Android平台在小米设备无法监听的问题 修复Android平台调用uni.onUserCaptureScreen必然会触发回调的问题
|
||||||
|
## 1.0.1(2022-10-27)
|
||||||
|
修改插件描述
|
||||||
|
## 1.0.0(2022-10-26)
|
||||||
|
支持安卓、iOS、微信小程序平台
|
||||||
18
uni_modules/uni-usercapturescreen/index.d.ts
vendored
Normal file
18
uni_modules/uni-usercapturescreen/index.d.ts
vendored
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
declare namespace UniNamespace {
|
||||||
|
type OnUserCaptureScreenCallback = (res?: { errMsg: string }) => void
|
||||||
|
}
|
||||||
|
|
||||||
|
declare interface Uni {
|
||||||
|
/**
|
||||||
|
* 监听用户主动截屏事件,用户使用系统截屏按键截屏时触发此事件。
|
||||||
|
*
|
||||||
|
* 文档: [https://uniapp.dcloud.net.cn/api/system/capture-screen.html#onusercapturescreen](https://uniapp.dcloud.net.cn/api/system/capture-screen.html#onusercapturescreen)
|
||||||
|
*/
|
||||||
|
onUserCaptureScreen(callback: UniNamespace.OnUserCaptureScreenCallback): void;
|
||||||
|
/**
|
||||||
|
* 用户主动截屏事件。取消事件监听。
|
||||||
|
*
|
||||||
|
* 文档: [https://uniapp.dcloud.net.cn/api/system/capture-screen.html#offusercapturescreen](https://uniapp.dcloud.net.cn/api/system/capture-screen.html#offusercapturescreen)
|
||||||
|
*/
|
||||||
|
offUserCaptureScreen(callback: UniNamespace.OnUserCaptureScreenCallback): void;
|
||||||
|
}
|
||||||
92
uni_modules/uni-usercapturescreen/package.json
Normal file
92
uni_modules/uni-usercapturescreen/package.json
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
{
|
||||||
|
"id": "uni-usercapturescreen",
|
||||||
|
"displayName": "uni-usercapturescreen",
|
||||||
|
"version": "1.0.4",
|
||||||
|
"description": "用户主动截屏事件监听",
|
||||||
|
"keywords": [
|
||||||
|
"截屏"
|
||||||
|
],
|
||||||
|
"repository": "",
|
||||||
|
"engines": {
|
||||||
|
"HBuilderX": "^3.7.7"
|
||||||
|
},
|
||||||
|
"dcloudext": {
|
||||||
|
"type": "uts",
|
||||||
|
"sale": {
|
||||||
|
"regular": {
|
||||||
|
"price": "0.00"
|
||||||
|
},
|
||||||
|
"sourcecode": {
|
||||||
|
"price": "0.00"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"contact": {
|
||||||
|
"qq": ""
|
||||||
|
},
|
||||||
|
"declaration": {
|
||||||
|
"ads": "无",
|
||||||
|
"data": "插件不采集任何数据",
|
||||||
|
"permissions": "无"
|
||||||
|
},
|
||||||
|
"npmurl": ""
|
||||||
|
},
|
||||||
|
"uni_modules": {
|
||||||
|
"uni-ext-api":{
|
||||||
|
"uni": {
|
||||||
|
"onUserCaptureScreen": "onUserCaptureScreen",
|
||||||
|
"offUserCaptureScreen": "offUserCaptureScreen",
|
||||||
|
"setUserCaptureScreen": "setUserCaptureScreen"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dependencies": [],
|
||||||
|
"encrypt": [],
|
||||||
|
"platforms": {
|
||||||
|
"cloud": {
|
||||||
|
"tcb": "y",
|
||||||
|
"aliyun": "y"
|
||||||
|
},
|
||||||
|
"client": {
|
||||||
|
"Vue": {
|
||||||
|
"vue2": "n",
|
||||||
|
"vue3": "y"
|
||||||
|
},
|
||||||
|
"App": {
|
||||||
|
"app-android": {
|
||||||
|
"minVersion": "19"
|
||||||
|
},
|
||||||
|
"app-ios": {
|
||||||
|
"minVersion": "9"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"H5-mobile": {
|
||||||
|
"Safari": "n",
|
||||||
|
"Android Browser": "n",
|
||||||
|
"微信浏览器(Android)": "n",
|
||||||
|
"QQ浏览器(Android)": "n"
|
||||||
|
},
|
||||||
|
"H5-pc": {
|
||||||
|
"Chrome": "n",
|
||||||
|
"IE": "n",
|
||||||
|
"Edge": "n",
|
||||||
|
"Firefox": "n",
|
||||||
|
"Safari": "n"
|
||||||
|
},
|
||||||
|
"小程序": {
|
||||||
|
"微信": "y",
|
||||||
|
"阿里": "n",
|
||||||
|
"百度": "n",
|
||||||
|
"字节跳动": "n",
|
||||||
|
"QQ": "n",
|
||||||
|
"钉钉": "n",
|
||||||
|
"快手": "n",
|
||||||
|
"飞书": "n",
|
||||||
|
"京东": "n"
|
||||||
|
},
|
||||||
|
"快应用": {
|
||||||
|
"华为": "n",
|
||||||
|
"联盟": "n"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
21
uni_modules/uni-usercapturescreen/readme.md
Normal file
21
uni_modules/uni-usercapturescreen/readme.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# uni-usercapturescreen
|
||||||
|
|
||||||
|
用户主动截屏事件监听
|
||||||
|
|
||||||
|
### uni.onUserCaptureScreen
|
||||||
|
|
||||||
|
监听用户主动截屏事件,用户使用系统截屏按键截屏时触发此事件。
|
||||||
|
|
||||||
|
> 使用文档:[https://uniapp.dcloud.net.cn/api/system/capture-screen.html#onusercapturescreen](https://uniapp.dcloud.net.cn/api/system/capture-screen.html#onusercapturescreen)
|
||||||
|
|
||||||
|
### uni.offUserCaptureScreen
|
||||||
|
|
||||||
|
用户主动截屏事件。取消事件监听。
|
||||||
|
|
||||||
|
> 使用文档:[https://uniapp.dcloud.net.cn/api/system/capture-screen.html#offusercapturescreen](https://uniapp.dcloud.net.cn/api/system/capture-screen.html#offusercapturescreen)
|
||||||
|
|
||||||
|
### uni.setUserCaptureScreen
|
||||||
|
|
||||||
|
开启/关闭防截屏。
|
||||||
|
|
||||||
|
> 使用文档:[https://uniapp.dcloud.net.cn/api/system/capture-screen.html#setusercapturescreen](https://uniapp.dcloud.net.cn/api/system/capture-screen.html#setusercapturescreen)
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"minSdkVersion": "19"
|
||||||
|
}
|
||||||
139
uni_modules/uni-usercapturescreen/utssdk/app-android/index.uts
Normal file
139
uni_modules/uni-usercapturescreen/utssdk/app-android/index.uts
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
import { UTSAndroid } from "io.dcloud.uts";
|
||||||
|
import ActivityCompat from "androidx.core.app.ActivityCompat";
|
||||||
|
import Manifest from "android.Manifest";
|
||||||
|
import PackageManager from "android.content.pm.PackageManager";
|
||||||
|
import Build from "android.os.Build";
|
||||||
|
import FileObserver from "android.os.FileObserver";
|
||||||
|
import File from "java.io.File";
|
||||||
|
import Environment from "android.os.Environment";
|
||||||
|
import System from 'java.lang.System';
|
||||||
|
import WindowManager from 'android.view.WindowManager';
|
||||||
|
import { OnUserCaptureScreenCallbackResult, UserCaptureScreenCallback, OnUserCaptureScreen, OffUserCaptureScreen, SetUserCaptureScreenSuccess, SetUserCaptureScreenOptions, SetUserCaptureScreen } from "../interface.uts";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件监听器
|
||||||
|
*/
|
||||||
|
let observer : ScreenFileObserver | null = null;
|
||||||
|
/**
|
||||||
|
* 记录文件监听器上次监听的时间戳,避免重复监听
|
||||||
|
*/
|
||||||
|
let lastObserverTime : number = 0;
|
||||||
|
/**
|
||||||
|
* 截屏回调
|
||||||
|
*/
|
||||||
|
let listener : UserCaptureScreenCallback | null = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* android 文件监听实现
|
||||||
|
*/
|
||||||
|
class ScreenFileObserver extends FileObserver {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 截屏文件目录
|
||||||
|
*/
|
||||||
|
private screenFile : File;
|
||||||
|
|
||||||
|
constructor(screenFile : File) {
|
||||||
|
super(screenFile);
|
||||||
|
this.screenFile = screenFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
override onEvent(event : Int, path : string | null) : void {
|
||||||
|
// 只监听文件新增事件
|
||||||
|
if (event == FileObserver.CREATE) {
|
||||||
|
if (path != null) {
|
||||||
|
const currentTime = System.currentTimeMillis();
|
||||||
|
if ((currentTime - lastObserverTime) < 1000) {
|
||||||
|
// 本地截屏行为比上一次超过1000ms, 才认为是一个有效的时间
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
lastObserverTime = currentTime;
|
||||||
|
|
||||||
|
const screenShotPath = new File(this.screenFile, path).getPath();
|
||||||
|
const res : OnUserCaptureScreenCallbackResult = {
|
||||||
|
path: screenShotPath
|
||||||
|
}
|
||||||
|
listener?.(res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开启截图监听
|
||||||
|
*/
|
||||||
|
export const onUserCaptureScreen : OnUserCaptureScreen = function (callback : UserCaptureScreenCallback | null) {
|
||||||
|
// 检查相关权限是否已授予
|
||||||
|
if (ActivityCompat.checkSelfPermission(UTSAndroid.getAppContext()!, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
// 无权限,申请权限
|
||||||
|
ActivityCompat.requestPermissions(UTSAndroid.getUniActivity()!, arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE), 1001);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 更新监听
|
||||||
|
listener = callback;
|
||||||
|
|
||||||
|
let directory_screenshot : File;
|
||||||
|
if (Build.MANUFACTURER.toLowerCase() == "xiaomi") {
|
||||||
|
// @Suppress("DEPRECATION")
|
||||||
|
directory_screenshot = new File(new File(Environment.getExternalStorageDirectory(), Environment.DIRECTORY_DCIM), "Screenshots");
|
||||||
|
} else {
|
||||||
|
// @Suppress("DEPRECATION")
|
||||||
|
directory_screenshot = new File(new File(Environment.getExternalStorageDirectory(), Environment.DIRECTORY_PICTURES), "Screenshots");
|
||||||
|
}
|
||||||
|
// 先结束监听 再开启监听
|
||||||
|
observer?.stopWatching();
|
||||||
|
observer = new ScreenFileObserver(directory_screenshot);
|
||||||
|
observer?.startWatching();
|
||||||
|
|
||||||
|
|
||||||
|
UTSAndroid.onAppActivityDestroy(function(){
|
||||||
|
observer?.stopWatching()
|
||||||
|
observer = null
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭截屏监听
|
||||||
|
*/
|
||||||
|
export const offUserCaptureScreen : OffUserCaptureScreen = function (_ : UserCaptureScreenCallback | null) {
|
||||||
|
// android10以上,关闭监听通过移除文件监听器实现
|
||||||
|
observer?.stopWatching();
|
||||||
|
observer = null;
|
||||||
|
lastObserverTime = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置是否禁止截屏
|
||||||
|
*/
|
||||||
|
export const setUserCaptureScreen : SetUserCaptureScreen = function (option : SetUserCaptureScreenOptions) {
|
||||||
|
// 切换到UI线程
|
||||||
|
UTSAndroid.getUniActivity()?.runOnUiThread(new SetUserCaptureScreenRunnable(option.enable));
|
||||||
|
const res : SetUserCaptureScreenSuccess = {}
|
||||||
|
option.success?.(res);
|
||||||
|
option.complete?.(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
class SetUserCaptureScreenRunnable extends Runnable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ture: 允许用户截屏
|
||||||
|
* false: 不允许用户截屏,防止用户截屏到应用页面内容
|
||||||
|
*/
|
||||||
|
private enable : boolean;
|
||||||
|
|
||||||
|
constructor(enable : boolean) {
|
||||||
|
super();
|
||||||
|
this.enable = enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
override run() : void {
|
||||||
|
if (this.enable) {
|
||||||
|
UTSAndroid.getUniActivity()?.getWindow()?.clearFlags(WindowManager.LayoutParams.FLAG_SECURE);
|
||||||
|
} else {
|
||||||
|
UTSAndroid.getUniActivity()?.getWindow()?.addFlags(WindowManager.LayoutParams.FLAG_SECURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"deploymentTarget": "9"
|
||||||
|
}
|
||||||
146
uni_modules/uni-usercapturescreen/utssdk/app-ios/index.uts
Normal file
146
uni_modules/uni-usercapturescreen/utssdk/app-ios/index.uts
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
import { NotificationCenter } from 'Foundation';
|
||||||
|
import { CGRect } from "CoreFoundation";
|
||||||
|
import { UIApplication, UIView, UITextField, UIScreen, UIDevice } from "UIKit"
|
||||||
|
import { UTSiOS } from "DCloudUTSFoundation"
|
||||||
|
import { DispatchQueue } from 'Dispatch';
|
||||||
|
import { SetUserCaptureScreenOptions, OnUserCaptureScreenCallbackResult, OnUserCaptureScreen, OffUserCaptureScreen, SetUserCaptureScreen, UserCaptureScreenCallback, SetUserCaptureScreenSuccess, SetUserCaptureScreenFail } from "../interface.uts"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义监听截屏事件工具类
|
||||||
|
*/
|
||||||
|
class CaptureScreenTool {
|
||||||
|
static listener : UserCaptureScreenCallback | null;
|
||||||
|
static secureView : UIView | null;
|
||||||
|
|
||||||
|
// 监听截屏
|
||||||
|
static listenCaptureScreen(callback : UserCaptureScreenCallback | null) {
|
||||||
|
this.listener = callback
|
||||||
|
|
||||||
|
// 注册监听截屏事件及回调方法
|
||||||
|
// target-action 回调方法需要通过 Selector("方法名") 构建
|
||||||
|
const method = Selector("userDidTakeScreenshot")
|
||||||
|
NotificationCenter.default.addObserver(this, selector = method, name = UIApplication.userDidTakeScreenshotNotification, object = null)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 捕获截屏回调的方法
|
||||||
|
// target-action 的方法前需要添加 @objc 前缀
|
||||||
|
@objc static userDidTakeScreenshot() {
|
||||||
|
// 回调
|
||||||
|
const res: OnUserCaptureScreenCallbackResult = {
|
||||||
|
}
|
||||||
|
this.listener?.(res)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 移除监听事件
|
||||||
|
static removeListen(callback : UserCaptureScreenCallback | null) {
|
||||||
|
this.listener = null
|
||||||
|
NotificationCenter.default.removeObserver(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
static createSecureView() : UIView | null {
|
||||||
|
let field = new UITextField(frame = CGRect.zero)
|
||||||
|
field.isSecureTextEntry = true
|
||||||
|
if (field.subviews.length > 0 && UIDevice.current.systemVersion != '15.1') {
|
||||||
|
let view = field.subviews[0]
|
||||||
|
view.subviews.forEach((item) => {
|
||||||
|
item.removeFromSuperview()
|
||||||
|
})
|
||||||
|
view.isUserInteractionEnabled = true
|
||||||
|
return view
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
// 开启防截屏
|
||||||
|
static onAntiScreenshot(option : SetUserCaptureScreenOptions) {
|
||||||
|
// uts方法默认会在子线程中执行,涉及 UI 操作必须在主线程中运行,通过 DispatchQueue.main.async 方法可将代码在主线程中运行
|
||||||
|
DispatchQueue.main.async(execute = () : void => {
|
||||||
|
let secureView = this.createSecureView()
|
||||||
|
let window = UTSiOS.getKeyWindow()
|
||||||
|
let rootView = window.rootViewController == null ? null : window.rootViewController!.view
|
||||||
|
if (secureView != null && rootView != null) {
|
||||||
|
let rootSuperview = rootView!.superview
|
||||||
|
if (rootSuperview != null) {
|
||||||
|
this.secureView = secureView
|
||||||
|
rootSuperview!.addSubview(secureView!)
|
||||||
|
rootView!.removeFromSuperview()
|
||||||
|
secureView!.addSubview(rootView!)
|
||||||
|
let rect = rootView!.frame
|
||||||
|
secureView!.frame = UIScreen.main.bounds
|
||||||
|
rootView!.frame = rect
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let res: SetUserCaptureScreenSuccess = {
|
||||||
|
}
|
||||||
|
option.success?.(res)
|
||||||
|
option.complete?.(res)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 关闭防截屏
|
||||||
|
static offAntiScreenshot(option : SetUserCaptureScreenOptions) {
|
||||||
|
DispatchQueue.main.async(execute = () : void => {
|
||||||
|
if (this.secureView != null) {
|
||||||
|
let window = UTSiOS.getKeyWindow()
|
||||||
|
let rootView = window.rootViewController == null ? null : window.rootViewController!.view
|
||||||
|
if (rootView != null && this.secureView!.superview != null) {
|
||||||
|
let rootSuperview = this.secureView!.superview
|
||||||
|
if (rootSuperview != null) {
|
||||||
|
rootSuperview!.addSubview(rootView!)
|
||||||
|
this.secureView!.removeFromSuperview()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.secureView = null
|
||||||
|
}
|
||||||
|
let res: SetUserCaptureScreenSuccess = {
|
||||||
|
}
|
||||||
|
option.success?.(res)
|
||||||
|
option.complete?.(res)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开启截图监听
|
||||||
|
*/
|
||||||
|
export const onUserCaptureScreen : OnUserCaptureScreen = function (callback : UserCaptureScreenCallback | null) {
|
||||||
|
CaptureScreenTool.listenCaptureScreen(callback)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭截屏监听
|
||||||
|
*/
|
||||||
|
export const offUserCaptureScreen : OffUserCaptureScreen = function (callback : UserCaptureScreenCallback | null) {
|
||||||
|
CaptureScreenTool.removeListen(callback)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开启/关闭防截屏
|
||||||
|
*/
|
||||||
|
export const setUserCaptureScreen : SetUserCaptureScreen = function (options : SetUserCaptureScreenOptions) {
|
||||||
|
if (UIDevice.current.systemVersion < "13.0") {
|
||||||
|
let res: SetUserCaptureScreenFail = {
|
||||||
|
errCode: 12001,
|
||||||
|
errSubject: "uni-usercapturescreen",
|
||||||
|
errMsg: "setUserCaptureScreen:system not support"
|
||||||
|
}
|
||||||
|
options.fail?.(res);
|
||||||
|
options.complete?.(res);
|
||||||
|
|
||||||
|
} else if (UIDevice.current.systemVersion == "15.1") {
|
||||||
|
let res: SetUserCaptureScreenFail = {
|
||||||
|
errCode: 12010,
|
||||||
|
errSubject: "uni-usercapturescreen",
|
||||||
|
errMsg: "setUserCaptureScreen:system internal error"
|
||||||
|
}
|
||||||
|
options.fail?.(res);
|
||||||
|
options.complete?.(res);
|
||||||
|
} else {
|
||||||
|
if (options.enable == true) {
|
||||||
|
CaptureScreenTool.offAntiScreenshot(options)
|
||||||
|
} else {
|
||||||
|
CaptureScreenTool.onAntiScreenshot(options)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
122
uni_modules/uni-usercapturescreen/utssdk/interface.uts
Normal file
122
uni_modules/uni-usercapturescreen/utssdk/interface.uts
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
/**
|
||||||
|
* uni.onUserCaptureScreen/uni.offUserCaptureScreen回调参数
|
||||||
|
*/
|
||||||
|
export type OnUserCaptureScreenCallbackResult = {
|
||||||
|
/**
|
||||||
|
* 截屏文件路径(仅Android返回)
|
||||||
|
*/
|
||||||
|
path ?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* uni.onUserCaptureScreen/uni.offUserCaptureScreen回调函数定义
|
||||||
|
*/
|
||||||
|
export type UserCaptureScreenCallback = (res : OnUserCaptureScreenCallbackResult) => void
|
||||||
|
|
||||||
|
/**
|
||||||
|
* uni.onUserCaptureScreen函数定义
|
||||||
|
* 开启截屏监听
|
||||||
|
*
|
||||||
|
* @param {UserCaptureScreenCallback} callback
|
||||||
|
* @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#onusercapturescreen
|
||||||
|
* @platforms APP-IOS = ^9.0,APP-ANDROID = ^4.4
|
||||||
|
* @since 3.7.7
|
||||||
|
*/
|
||||||
|
export type OnUserCaptureScreen = (callback : UserCaptureScreenCallback | null) => void
|
||||||
|
|
||||||
|
/**
|
||||||
|
* uni.offUserCaptureScreen函数定义
|
||||||
|
* 关闭截屏监听
|
||||||
|
*
|
||||||
|
* @param {UserCaptureScreenCallback} callback
|
||||||
|
* @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#offusercapturescreen
|
||||||
|
* @platforms APP-IOS = ^9.0,APP-ANDROID = ^4.4
|
||||||
|
* @since 3.7.7
|
||||||
|
*/
|
||||||
|
export type OffUserCaptureScreen = (callback : UserCaptureScreenCallback | null) => void
|
||||||
|
|
||||||
|
/**
|
||||||
|
* uni.setUserCaptureScreen成功回调参数
|
||||||
|
*/
|
||||||
|
export type SetUserCaptureScreenSuccess = {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* uni.setUserCaptureScreen失败回调参数
|
||||||
|
*/
|
||||||
|
export type SetUserCaptureScreenFail = {
|
||||||
|
/**
|
||||||
|
* 错误码
|
||||||
|
* 12001:system not support
|
||||||
|
* 12010:system internal error
|
||||||
|
*/
|
||||||
|
errCode : number,
|
||||||
|
/**
|
||||||
|
* 调用API的名称
|
||||||
|
*/
|
||||||
|
errSubject : string,
|
||||||
|
/**
|
||||||
|
* 错误的详细信息
|
||||||
|
*/
|
||||||
|
errMsg : string,
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* uni.setUserCaptureScreen成功回调函数定义
|
||||||
|
*/
|
||||||
|
export type SetUserCaptureScreenSuccessCallback = (res : SetUserCaptureScreenSuccess) => void
|
||||||
|
|
||||||
|
/**
|
||||||
|
* uni.setUserCaptureScreen失败回调函数定义
|
||||||
|
*/
|
||||||
|
export type SetUserCaptureScreenFailCallback = (res : SetUserCaptureScreenFail) => void
|
||||||
|
|
||||||
|
/**
|
||||||
|
* uni.setUserCaptureScreen完成回调函数定义
|
||||||
|
*/
|
||||||
|
export type SetUserCaptureScreenCompleteCallback = (res : any) => void
|
||||||
|
|
||||||
|
/**
|
||||||
|
* uni.setUserCaptureScreen参数
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type SetUserCaptureScreenOptions = {
|
||||||
|
/**
|
||||||
|
* true: 允许用户截屏 false: 不允许用户截屏,防止用户截屏到应用页面内容
|
||||||
|
*/
|
||||||
|
enable : boolean;
|
||||||
|
/**
|
||||||
|
* 接口调用成功的回调函数
|
||||||
|
*/
|
||||||
|
// success : SetUserCaptureScreenSuccessCallback | null,
|
||||||
|
success ?: SetUserCaptureScreenSuccessCallback,
|
||||||
|
/**
|
||||||
|
* 接口调用失败的回调函数
|
||||||
|
*/
|
||||||
|
// fail : SetUserCaptureScreenFailCallback | null,
|
||||||
|
fail ?: SetUserCaptureScreenFailCallback,
|
||||||
|
/**
|
||||||
|
* 接口调用结束的回调函数(调用成功、失败都会执行)
|
||||||
|
*/
|
||||||
|
// complete : SetUserCaptureScreenSuccessCallback | SetUserCaptureScreenFailCallback | null
|
||||||
|
complete ?: SetUserCaptureScreenCompleteCallback
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * uni.setUserCaptureScreen函数定义
|
||||||
|
|
||||||
|
* 设置防截屏
|
||||||
|
*
|
||||||
|
* @param {SetUserCaptureScreenOptions} options
|
||||||
|
* @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#setusercapturescreen
|
||||||
|
* @platforms APP-IOS = ^13.0,APP-ANDROID = ^4.4
|
||||||
|
* @since 3.7.7
|
||||||
|
*/
|
||||||
|
export type SetUserCaptureScreen = (options : SetUserCaptureScreenOptions) => void
|
||||||
|
|
||||||
|
export interface Uni {
|
||||||
|
onUserCaptureScreen : OnUserCaptureScreen,
|
||||||
|
offUserCaptureScreen : OffUserCaptureScreen,
|
||||||
|
setUserCaptureScreen : SetUserCaptureScreen
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
export function onUserCaptureScreen (callback) {
|
||||||
|
return wx.onUserCaptureScreen(callback)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function offUserCaptureScreen (callback) {
|
||||||
|
return wx.offUserCaptureScreen(callback)
|
||||||
|
}
|
||||||
24
yarn.lock
24
yarn.lock
@@ -131,6 +131,16 @@
|
|||||||
"resolved" "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz"
|
"resolved" "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz"
|
||||||
"version" "2.0.2"
|
"version" "2.0.2"
|
||||||
|
|
||||||
|
"eventemitter3@^4.0.7":
|
||||||
|
"integrity" "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw=="
|
||||||
|
"resolved" "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz"
|
||||||
|
"version" "4.0.7"
|
||||||
|
|
||||||
|
"lodash-es@^4.17.21":
|
||||||
|
"integrity" "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw=="
|
||||||
|
"resolved" "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz"
|
||||||
|
"version" "4.17.21"
|
||||||
|
|
||||||
"magic-string@^0.25.7":
|
"magic-string@^0.25.7":
|
||||||
"integrity" "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ=="
|
"integrity" "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ=="
|
||||||
"resolved" "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz"
|
"resolved" "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz"
|
||||||
@@ -148,11 +158,25 @@
|
|||||||
"resolved" "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz"
|
"resolved" "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz"
|
||||||
"version" "3.3.4"
|
"version" "3.3.4"
|
||||||
|
|
||||||
|
"nim-web-sdk-ng@^0.12.3":
|
||||||
|
"integrity" "sha512-S1RYQDz5n/tCqdHVv5fIBKBB60hdvySLTLo1xSgPVrk725GrGSXXyblWZeaWazUoFuLzfSKyrK0LRCJoAMcHYw=="
|
||||||
|
"resolved" "https://registry.npmjs.org/nim-web-sdk-ng/-/nim-web-sdk-ng-0.12.3.tgz"
|
||||||
|
"version" "0.12.3"
|
||||||
|
dependencies:
|
||||||
|
"eventemitter3" "^4.0.7"
|
||||||
|
"lodash-es" "^4.17.21"
|
||||||
|
"platform" "^1.3.6"
|
||||||
|
|
||||||
"picocolors@^1.0.0":
|
"picocolors@^1.0.0":
|
||||||
"integrity" "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ=="
|
"integrity" "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ=="
|
||||||
"resolved" "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz"
|
"resolved" "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz"
|
||||||
"version" "1.0.0"
|
"version" "1.0.0"
|
||||||
|
|
||||||
|
"platform@^1.3.6":
|
||||||
|
"integrity" "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg=="
|
||||||
|
"resolved" "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz"
|
||||||
|
"version" "1.3.6"
|
||||||
|
|
||||||
"postcss@^8.1.10", "postcss@^8.4.14":
|
"postcss@^8.1.10", "postcss@^8.4.14":
|
||||||
"integrity" "sha512-6Q04AXR1212bXr5fh03u8aAwbLxAQNGQ/Q1LNa0VfOI06ZAlhPHtQvE4OIdpj4kLThXilalPnmDSOD65DcHt+g=="
|
"integrity" "sha512-6Q04AXR1212bXr5fh03u8aAwbLxAQNGQ/Q1LNa0VfOI06ZAlhPHtQvE4OIdpj4kLThXilalPnmDSOD65DcHt+g=="
|
||||||
"resolved" "https://registry.npmjs.org/postcss/-/postcss-8.4.20.tgz"
|
"resolved" "https://registry.npmjs.org/postcss/-/postcss-8.4.20.tgz"
|
||||||
|
|||||||
Reference in New Issue
Block a user