From d43fbd22fdf941bacc4a98203f77de4aa8c30545 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=90=E6=98=8E=E6=98=8E?= <970899069@qq.com> Date: Thu, 23 Mar 2023 14:43:22 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apis/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apis/index.js b/apis/index.js index bc86f66..917ef93 100644 --- a/apis/index.js +++ b/apis/index.js @@ -10,8 +10,8 @@ import router from '../router' // 基础配置 const config = { - // apiUrl : 'https://douhuo.douhuofalv.com/api/', - apiUrl : 'https://api.douhuotest.douhuofalv.com/api/', //测试环境 + apiUrl : 'https://douhuo.douhuofalv.com/api/', + // apiUrl : 'https://api.douhuotest.douhuofalv.com/api/', //测试环境 timeout : 60000 } From 7508bb7ce2bfc9523e69b8166dfdb9c24b41f3d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=90=E6=98=8E=E6=98=8E?= <970899069@qq.com> Date: Fri, 24 Mar 2023 10:06:59 +0800 Subject: [PATCH 02/11] =?UTF-8?q?im=E6=A8=A1=E5=9D=97=E5=A2=9E=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apis/index.js | 4 +-- apis/interfaces/yxim.js | 20 ++++++++++++++ im/INIT.js | 58 +++++++++++++++++++++++++++++++++++++++++ main.js | 28 +++++++++++--------- package-lock.json | 51 ++++++++++++++++++++++++++++++++++++ package.json | 1 + pages.json | 5 ++++ pages/im/chat.vue | 17 ------------ pages/im/msg.vue | 5 ++++ yarn.lock | 24 +++++++++++++++++ 10 files changed, 182 insertions(+), 31 deletions(-) create mode 100644 apis/interfaces/yxim.js create mode 100644 im/INIT.js diff --git a/apis/index.js b/apis/index.js index 917ef93..bc86f66 100644 --- a/apis/index.js +++ b/apis/index.js @@ -10,8 +10,8 @@ import router from '../router' // 基础配置 const config = { - apiUrl : 'https://douhuo.douhuofalv.com/api/', - // apiUrl : 'https://api.douhuotest.douhuofalv.com/api/', //测试环境 + // apiUrl : 'https://douhuo.douhuofalv.com/api/', + apiUrl : 'https://api.douhuotest.douhuofalv.com/api/', //测试环境 timeout : 60000 } diff --git a/apis/interfaces/yxim.js b/apis/interfaces/yxim.js new file mode 100644 index 0000000..6807e61 --- /dev/null +++ b/apis/interfaces/yxim.js @@ -0,0 +1,20 @@ + +/** + * Web唐明明 + * 匆匆数载恍如梦,岁月迢迢华发增。 + * 碌碌无为枉半生,一朝惊醒万事空。 + * moduleName: 网易云信IM + */ + +import { request } from '../index' + +// 获取im登录 +const imToken = data => { + return request({ + url : 'im/token' + }) +} + +export { + imToken +} diff --git a/im/INIT.js b/im/INIT.js new file mode 100644 index 0000000..30373af --- /dev/null +++ b/im/INIT.js @@ -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; +} diff --git a/main.js b/main.js index 6d5f2d2..821bf6c 100644 --- a/main.js +++ b/main.js @@ -7,16 +7,20 @@ import store from './store' import { router, RouterMount } from 'router' import Mylink from './node_modules/uni-simple-router/dist/link.vue' -Vue.component('my-link', Mylink) +import { INIT } from './im/INIT' -Vue.use(uView) -Vue.use(router) - -Vue.config.productionTip = false -App.mpType = 'app' -const app = new Vue({ - store, - ...App -}) - -app.$mount() +(async () => { + Vue.component('my-link', Mylink) + Vue.use(uView) + Vue.use(router) + + await INIT(); + + Vue.config.productionTip = false + App.mpType = 'app' + const app = new Vue({ + store, + ...App + }) + app.$mount() +})() diff --git a/package-lock.json b/package-lock.json index 9dc54dc..84c6e27 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "license": "MIT", "dependencies": { "moment": "^2.29.4", + "nim-web-sdk-ng": "^0.12.3", "uni-read-pages": "^1.0.5", "uni-simple-router": "^2.0.7", "uview-ui": "^2.0.31", @@ -164,6 +165,16 @@ "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", "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": { "version": "0.25.9", "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_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": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", "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": { "version": "8.4.20", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.20.tgz", @@ -457,6 +483,16 @@ "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", "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": { "version": "0.25.9", "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", "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": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", "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": { "version": "8.4.20", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.20.tgz", diff --git a/package.json b/package.json index 30c9a9a..63dcf7b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "dependencies": { "moment": "^2.29.4", + "nim-web-sdk-ng": "^0.12.3", "uni-read-pages": "^1.0.5", "uni-simple-router": "^2.0.7", "uview-ui": "^2.0.31", diff --git a/pages.json b/pages.json index 4df438c..0c59f36 100644 --- a/pages.json +++ b/pages.json @@ -599,6 +599,11 @@ "selectedIconPath": "static/icons/tabs_show_02.png", "pagePath": "pages/work/index", "text": "工作台" + },{ + "iconPath": "static/icons/tabs_icon_04.png", + "selectedIconPath": "static/icons/tabs_icon_04.png", + "pagePath": "pages/im/msg", + "text": "消息" }, { "iconPath": "static/icons/tabs_icon_03.png", "selectedIconPath": "static/icons/tabs_show_03.png", diff --git a/pages/im/chat.vue b/pages/im/chat.vue index 5388f64..714fafd 100644 --- a/pages/im/chat.vue +++ b/pages/im/chat.vue @@ -3,23 +3,6 @@ 消息{{index}} - diff --git a/pages/im/msg.vue b/pages/im/msg.vue index 3361986..0bdaa5d 100644 --- a/pages/im/msg.vue +++ b/pages/im/msg.vue @@ -58,6 +58,11 @@ } } }, + onShow() { + console.log() + + // this.$nim.msg() + }, methods: { onMsg(id){ let cartId = id || null diff --git a/yarn.lock b/yarn.lock index acaff64..5feaa1c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -131,6 +131,16 @@ "resolved" "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz" "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": "integrity" "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==" "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" "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": "integrity" "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" "resolved" "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz" "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": "integrity" "sha512-6Q04AXR1212bXr5fh03u8aAwbLxAQNGQ/Q1LNa0VfOI06ZAlhPHtQvE4OIdpj4kLThXilalPnmDSOD65DcHt+g==" "resolved" "https://registry.npmjs.org/postcss/-/postcss-8.4.20.tgz" From 7a253612492b19586e009ed4dcf9bac16054f7e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=90=E6=98=8E=E6=98=8E?= <970899069@qq.com> Date: Mon, 27 Mar 2023 17:54:12 +0800 Subject: [PATCH 03/11] merge --- main.js | 6 +- pages/account/withdraws.vue | 3 - pages/im/msg.vue | 2 - pages/index/index.vue | 22 +++++ pages/work/perfectBasis.vue | 6 +- uni_modules/oct-mechanism-picker/changelog.md | 0 .../oct-mechanism-picker.vue | 68 ++++++++++++++++ uni_modules/oct-mechanism-picker/package.json | 81 +++++++++++++++++++ uni_modules/oct-mechanism-picker/readme.md | 1 + 9 files changed, 178 insertions(+), 11 deletions(-) create mode 100644 uni_modules/oct-mechanism-picker/changelog.md create mode 100644 uni_modules/oct-mechanism-picker/components/oct-mechanism-picker/oct-mechanism-picker.vue create mode 100644 uni_modules/oct-mechanism-picker/package.json create mode 100644 uni_modules/oct-mechanism-picker/readme.md diff --git a/main.js b/main.js index 821bf6c..f37200f 100644 --- a/main.js +++ b/main.js @@ -9,12 +9,12 @@ import Mylink from './node_modules/uni-simple-router/dist/link.vue' import { INIT } from './im/INIT' -(async () => { +// (async () => { Vue.component('my-link', Mylink) Vue.use(uView) Vue.use(router) - await INIT(); + // await INIT(); Vue.config.productionTip = false App.mpType = 'app' @@ -23,4 +23,4 @@ import { INIT } from './im/INIT' ...App }) app.$mount() -})() +// })() diff --git a/pages/account/withdraws.vue b/pages/account/withdraws.vue index 8a3a630..9fe6f4a 100644 --- a/pages/account/withdraws.vue +++ b/pages/account/withdraws.vue @@ -106,9 +106,6 @@ uni.hideLoading() }).catch(err => { - - console.log(err) - uni.showModal({ content : err.message, showCancel : false, diff --git a/pages/im/msg.vue b/pages/im/msg.vue index 0bdaa5d..cf7c383 100644 --- a/pages/im/msg.vue +++ b/pages/im/msg.vue @@ -59,8 +59,6 @@ } }, onShow() { - console.log() - // this.$nim.msg() }, methods: { diff --git a/pages/index/index.vue b/pages/index/index.vue index ee95bd2..763a428 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -110,6 +110,13 @@ + + + @@ -119,6 +126,18 @@ export default { data() { return { + jgArr : [ + { name: '中信' }, + { name: '哈尔滨' }, + { name: '广州' }, + { name: '发展银行' }, + { name: '其他机构' }, + { name: '中信' }, + { name: '哈尔滨' }, + { name: '广州' }, + { name: '发展银行' }, + { name: '其他机构' } + ], theTabs : [ { category_id: '', title: '全部' } ], @@ -146,6 +165,9 @@ this.getZf() }, methods: { + onOpen(){ + this.$refs.MecanisPicker.open() + }, // 获取金法列表 getJf(){ let params = { diff --git a/pages/work/perfectBasis.vue b/pages/work/perfectBasis.vue index 0417aa1..ef00543 100644 --- a/pages/work/perfectBasis.vue +++ b/pages/work/perfectBasis.vue @@ -106,21 +106,21 @@ *现居住地址 - + - + - + diff --git a/uni_modules/oct-mechanism-picker/changelog.md b/uni_modules/oct-mechanism-picker/changelog.md new file mode 100644 index 0000000..e69de29 diff --git a/uni_modules/oct-mechanism-picker/components/oct-mechanism-picker/oct-mechanism-picker.vue b/uni_modules/oct-mechanism-picker/components/oct-mechanism-picker/oct-mechanism-picker.vue new file mode 100644 index 0000000..2785aea --- /dev/null +++ b/uni_modules/oct-mechanism-picker/components/oct-mechanism-picker/oct-mechanism-picker.vue @@ -0,0 +1,68 @@ + + + diff --git a/uni_modules/oct-mechanism-picker/package.json b/uni_modules/oct-mechanism-picker/package.json new file mode 100644 index 0000000..610cb64 --- /dev/null +++ b/uni_modules/oct-mechanism-picker/package.json @@ -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" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/oct-mechanism-picker/readme.md b/uni_modules/oct-mechanism-picker/readme.md new file mode 100644 index 0000000..cfa15d6 --- /dev/null +++ b/uni_modules/oct-mechanism-picker/readme.md @@ -0,0 +1 @@ +# oct-mechanism-picker \ No newline at end of file From 59dc853cdfa2f90e0e67c18754e59d1ad764cf9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=90=E6=98=8E=E6=98=8E?= <970899069@qq.com> Date: Tue, 28 Mar 2023 15:56:36 +0800 Subject: [PATCH 04/11] =?UTF-8?q?=E6=9C=BA=E6=9E=84=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.json | 5 - pages/index/index.vue | 22 ---- pages/work/generate.vue | 33 ++++- .../oct-mechanism-picker.vue | 117 +++++++++++++++++- 4 files changed, 141 insertions(+), 36 deletions(-) diff --git a/pages.json b/pages.json index 0c59f36..4df438c 100644 --- a/pages.json +++ b/pages.json @@ -599,11 +599,6 @@ "selectedIconPath": "static/icons/tabs_show_02.png", "pagePath": "pages/work/index", "text": "工作台" - },{ - "iconPath": "static/icons/tabs_icon_04.png", - "selectedIconPath": "static/icons/tabs_icon_04.png", - "pagePath": "pages/im/msg", - "text": "消息" }, { "iconPath": "static/icons/tabs_icon_03.png", "selectedIconPath": "static/icons/tabs_show_03.png", diff --git a/pages/index/index.vue b/pages/index/index.vue index 763a428..ee95bd2 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -110,13 +110,6 @@ - - - @@ -126,18 +119,6 @@ export default { data() { return { - jgArr : [ - { name: '中信' }, - { name: '哈尔滨' }, - { name: '广州' }, - { name: '发展银行' }, - { name: '其他机构' }, - { name: '中信' }, - { name: '哈尔滨' }, - { name: '广州' }, - { name: '发展银行' }, - { name: '其他机构' } - ], theTabs : [ { category_id: '', title: '全部' } ], @@ -165,9 +146,6 @@ this.getZf() }, methods: { - onOpen(){ - this.$refs.MecanisPicker.open() - }, // 获取金法列表 getJf(){ let params = { diff --git a/pages/work/generate.vue b/pages/work/generate.vue index 17b5e06..f8a0864 100644 --- a/pages/work/generate.vue +++ b/pages/work/generate.vue @@ -11,12 +11,16 @@ - + + + {{item.institution[item.institutionIndex].title}} + + @@ -103,6 +107,13 @@ + + @@ -113,9 +124,12 @@ components: { octpicker }, data() { return { + columns : [], businessArr: [], serviceUser: '', serviceArr : [], + old : {}, + cIndex : 0 }; }, created() { @@ -125,6 +139,13 @@ this.serviceUser = serviceUser }, methods: { + // 显示选择机构 + onShowInstitution(e, item, index){ + this.columns = e + this.old = item + this.cIndex = index + this.$refs.institutionPicker.open() + }, // 移出选项 onRemove(index){ this.serviceArr.splice(index, 1) @@ -202,10 +223,12 @@ }) }, // 机构变更更新业务 - institutionChange(e, old, index){ - let { value } = e.detail; + institutionChange(e){ + 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 forms = this.getForms(old.institution[value].institution_id) forms.then(institutionVal => { diff --git a/uni_modules/oct-mechanism-picker/components/oct-mechanism-picker/oct-mechanism-picker.vue b/uni_modules/oct-mechanism-picker/components/oct-mechanism-picker/oct-mechanism-picker.vue index 2785aea..7c78794 100644 --- a/uni_modules/oct-mechanism-picker/components/oct-mechanism-picker/oct-mechanism-picker.vue +++ b/uni_modules/oct-mechanism-picker/components/oct-mechanism-picker/oct-mechanism-picker.vue @@ -3,16 +3,42 @@ {{title}} + + + + + + - {{item.name}} + + + {{item.title}} + + + + 暂无与[{{searchValue}}]相关的搜索结果 + + + + + {{item.title}} + + + - + + + diff --git a/pages/user/index.vue b/pages/user/index.vue index 6e57c1e..0631be2 100644 --- a/pages/user/index.vue +++ b/pages/user/index.vue @@ -99,7 +99,16 @@ - + + + + 版本检测 + + + V{{version}} + + + 设置 @@ -160,23 +169,20 @@ @@ -446,7 +518,15 @@ margin-right: $margin; margin-top: 5rpx; } - } + } + .nav-text{ + display: flex; + justify-content: flex-end; + align-items: center; + color: #999; + font-size: 30rpx; + text{ padding-right: 10rpx; } + } } // 用户信息 diff --git a/pages/user/set.vue b/pages/user/set.vue index 3aaf955..36247c5 100644 --- a/pages/user/set.vue +++ b/pages/user/set.vue @@ -30,6 +30,14 @@ + + + + + + + + diff --git a/pages/user/signLog.vue b/pages/user/signLog.vue new file mode 100644 index 0000000..1213dd3 --- /dev/null +++ b/pages/user/signLog.vue @@ -0,0 +1,80 @@ + + + + + diff --git a/pages/user/team.vue b/pages/user/team.vue index 52a0724..0f802b6 100644 --- a/pages/user/team.vue +++ b/pages/user/team.vue @@ -19,6 +19,7 @@ 普通用户 顾问 + 团队业绩:{{ item.show_perf ? item.perf: '身份不符暂无业绩' }} 联系电话:{{item.username}} 注册时间:{{item.created_at}} @@ -74,6 +75,8 @@ page : this.page.current }).then(res => { let { users, count } = res; + + console.log(users) let atList = users.page.current == 1 ? [] : this.users this.count = count this.users = atList.concat(users.data) diff --git a/static/icons/user_nav_08.png b/static/icons/user_nav_08.png new file mode 100644 index 0000000000000000000000000000000000000000..9d77edb9490277b0ddded68802360146d43101a9 GIT binary patch literal 5246 zcmbVQ2UJtr(hh-84Im&&hft&iLJ~?MAV_E;9SfpDOoAYRge0_p8jvE=L;;m1MFG92 zNS7i(s-P4>0liA3D*}-wh{7MdUe|kXy}!IaD<@~4y}z0HX7+2sFjhgfqSYCXj{tCWxXh-UM<~-yUX9wjlWU+R!NkSGt26 zj_!v;;UW7?6^%pD90mRa8dfpXpBO+zhnhfs>P2(L+ta!b#h(zGp9#c#+o0kxdnZK; z5`~~>paX;AU@(NDAxcNj0I3f*)K-MU;4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#Lgjort6mP>V> z;wG)qR8>xXM&$o^u6!+V>nF zyyBTXh>|dQtKKmiU{ReIQyb^i)SmmjmbqtQ+JVAdT#FJk8Q9Y?E2$*YZuKW{I6AnF z5_BRFK>U`c#eBNWitPVpR}%hltWg%USPI% znbgShOoS2AHtfTcvVML0gB9zXqPw-KVF$B*INdBB&uyy!jcBIk3|ynNm@dMbeY^_|Hv@u+-364_2wZJD4@@xI?whB?8UceRw!_ezZzh8;iBU`XVH!r z%-cpB-$CE$@`RGzFGT?}=0m_HrHGk50nl0C=3CgW%-L9j%SPgJtv?Jhp&rrG?ug1W3&X757Iww>npN8Q zc@2@KU6+v{0G&-uz4bPzWH94m6wWwv{$xy1=$8EVujs)~5=+I`xw-onKXY}4Y_;V@ zm|lPU5U69m9_ym)&&Ak5=G}gg9w13-E*wKPHHok6JMLujN;)n2(UnVIn5;d~W8C!Z zm+6zA!z(LAYqQr@o#59%9Kk?gvMLPZAx#&WRBwy$<1J7#23ISNZh~7sf2g>6M}H&h z3gAi1TQ|y4tQ5Uk>zU1@MKzBTtJmj-A=oj$SEFL5NjJ|j@g_v;7Nc5XOyCr+juof- zW>hH$7r<)v*?3occEZ0aq4tsIj}2NI$!r)@`SxF$T2QdM>kkb}b5WiJ0;I_D?AGje+aQJ*SA*Sq}cR$Niw zc$b^J&`DbWD7b(&_Z8G(Gm$KJF*fAfB~m+C=H5h&a{@9U^ku7>73aj{aeVrdTw?WE zl<8Wy+@i){-jj<#?sV~Q86<&ZUJ3N3F&pwMF14fmi6Y~5snz`ZkrLHCvC(8QSt1zy z#{uDjD8)>MNWaXf&c=;X 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; +} diff --git a/uni_modules/uni-usercapturescreen/package.json b/uni_modules/uni-usercapturescreen/package.json new file mode 100644 index 0000000..3285c78 --- /dev/null +++ b/uni_modules/uni-usercapturescreen/package.json @@ -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" + } + } + } + } +} diff --git a/uni_modules/uni-usercapturescreen/readme.md b/uni_modules/uni-usercapturescreen/readme.md new file mode 100644 index 0000000..eda987a --- /dev/null +++ b/uni_modules/uni-usercapturescreen/readme.md @@ -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) diff --git a/uni_modules/uni-usercapturescreen/utssdk/app-android/config.json b/uni_modules/uni-usercapturescreen/utssdk/app-android/config.json new file mode 100644 index 0000000..7ed4299 --- /dev/null +++ b/uni_modules/uni-usercapturescreen/utssdk/app-android/config.json @@ -0,0 +1,3 @@ +{ + "minSdkVersion": "19" +} \ No newline at end of file diff --git a/uni_modules/uni-usercapturescreen/utssdk/app-android/index.uts b/uni_modules/uni-usercapturescreen/utssdk/app-android/index.uts new file mode 100644 index 0000000..99cf531 --- /dev/null +++ b/uni_modules/uni-usercapturescreen/utssdk/app-android/index.uts @@ -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); + } + } +} diff --git a/uni_modules/uni-usercapturescreen/utssdk/app-ios/config.json b/uni_modules/uni-usercapturescreen/utssdk/app-ios/config.json new file mode 100644 index 0000000..721b81e --- /dev/null +++ b/uni_modules/uni-usercapturescreen/utssdk/app-ios/config.json @@ -0,0 +1,3 @@ +{ + "deploymentTarget": "9" +} \ No newline at end of file diff --git a/uni_modules/uni-usercapturescreen/utssdk/app-ios/index.uts b/uni_modules/uni-usercapturescreen/utssdk/app-ios/index.uts new file mode 100644 index 0000000..544fb21 --- /dev/null +++ b/uni_modules/uni-usercapturescreen/utssdk/app-ios/index.uts @@ -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) + } + } +} + diff --git a/uni_modules/uni-usercapturescreen/utssdk/interface.uts b/uni_modules/uni-usercapturescreen/utssdk/interface.uts new file mode 100644 index 0000000..235b782 --- /dev/null +++ b/uni_modules/uni-usercapturescreen/utssdk/interface.uts @@ -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 +} \ No newline at end of file diff --git a/uni_modules/uni-usercapturescreen/utssdk/mp-weixin/index.js b/uni_modules/uni-usercapturescreen/utssdk/mp-weixin/index.js new file mode 100644 index 0000000..6aa57b3 --- /dev/null +++ b/uni_modules/uni-usercapturescreen/utssdk/mp-weixin/index.js @@ -0,0 +1,7 @@ +export function onUserCaptureScreen (callback) { + return wx.onUserCaptureScreen(callback) +} + +export function offUserCaptureScreen (callback) { + return wx.offUserCaptureScreen(callback) +} From c33712665ad4ee5d8d48625ebdc316581bb7948e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=90=E6=98=8E=E6=98=8E?= <970899069@qq.com> Date: Tue, 25 Apr 2023 15:32:13 +0800 Subject: [PATCH 10/11] =?UTF-8?q?=E5=90=88=E5=90=8C=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- manifest.json | 2 +- pages/user/signLog.vue | 68 ++++++++++++++++++++++++++++++++---------- 2 files changed, 53 insertions(+), 17 deletions(-) diff --git a/manifest.json b/manifest.json index 52e1489..1140d8b 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "name" : "抖火", "appid" : "__UNI__C305C03", "description" : "纵有疾风起,人生不言弃", - "versionName" : "1.4.2", + "versionName" : "1.4.3", "versionCode" : 104, "transformPx" : false, /* 5+App特有相关 */ diff --git a/pages/user/signLog.vue b/pages/user/signLog.vue index 1213dd3..a192594 100644 --- a/pages/user/signLog.vue +++ b/pages/user/signLog.vue @@ -1,21 +1,36 @@ @@ -24,7 +39,10 @@ export default { data() { return { - logs: [], + status : 'loading', + isLoding: false, + logs : [], + page : { current : 0 } }; }, created() { @@ -37,10 +55,14 @@ mask : true }) getSignLogs({ - page: 1 + page: this.page.current }).then(res => { - this.logs = res.data - this.page = res.page + let { data, page } = res; + let atArr = page.current == 1 ? [] : this.getLog + 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({ @@ -55,6 +77,13 @@ params : { id } }) } + }, + onReachBottom(){ + this.isLoding = true + if(this.page.has_more){ + this.page.current++ + this.getLog() + } } } @@ -68,6 +97,7 @@ border-radius: $radius; padding: $padding; position: relative; + margin-bottom: 20rpx; // .log-icon{ position: absolute; right: $margin; top: 50%; margin-top: -14rpx; } .flex{ display: flex; @@ -77,4 +107,10 @@ label{ color: gray; } } } + + // 分页加载 + .pages-loding{ padding: 10rpx; } + + // 记录为空 + .null-pages{ display: flex; align-items: center; justify-content: space-around; height: 80vh;} From 048b9987a7aad084d23c320766d9f7b89b628447 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=90=E6=98=8E=E6=98=8E?= <970899069@qq.com> Date: Tue, 25 Apr 2023 15:32:58 +0800 Subject: [PATCH 11/11] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/user/signLog.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/user/signLog.vue b/pages/user/signLog.vue index a192594..7093c20 100644 --- a/pages/user/signLog.vue +++ b/pages/user/signLog.vue @@ -58,7 +58,7 @@ page: this.page.current }).then(res => { let { data, page } = res; - let atArr = page.current == 1 ? [] : this.getLog + let atArr = page.current == 1 ? [] : this.logs this.logs = atArr.concat(data) this.page = page this.status = !page.has_more ? 'nomore': 'loading'