diff --git a/apis/interfaces/user.js b/apis/interfaces/user.js index d44b187..68b244d 100644 --- a/apis/interfaces/user.js +++ b/apis/interfaces/user.js @@ -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 { relations, code, @@ -176,4 +191,6 @@ export { submitTeamName, getTeam, getTeamLogs, + getSignLogs, + getFlows } 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..f37200f 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 1c05bc6..9eca141 100644 --- a/pages.json +++ b/pages.json @@ -1,609 +1,609 @@ -{ - "pages": [{ - "path": "pages/index/index", - "name": "Index", - "style": { - "navigationBarTitleText": "抖火法律咨询服务", - "navigationBarBackgroundColor": "#FFFFFF" - } - }, { - "path": "pages/index/introduces", - "name": "Introduces", - "style": { - "navigationStyle": "custom", - "navigationBarTitleText": "金法服务包介绍", - "app-plus": { - "titleNView": { - "backgroundColor": "#FFFFFF", - "type": "transparent" - } - } - } - }, { - "path": "pages/index/free", - "name": "FreeService", - "auth": true, - "style": { - "navigationStyle": "custom", - "navigationBarTitleText": "自由服务包介绍", - "app-plus": { - "titleNView": { - "backgroundColor": "#FFFFFF", - "type": "transparent" - } - } - } - }, { - "path": "pages/index/introduces", - "name": "Introduces", - "style": { - "navigationStyle": "custom", - "navigationBarTitleText": "介绍", - "app-plus": { - "titleNView": { - "backgroundColor": "#FFFFFF", - "type": "transparent" - } - } - } - }, { - "path": "pages/college/index", - "name": "College", - "style": { - "navigationBarTitleText": "商学院", - "navigationStyle": "custom" - } - }, { - "path": "pages/work/index", - "name": "Work", - "style": { - "navigationBarTitleText": "工作台", - "navigationStyle": "custom" - } - }, { - "path": "pages/user/index", - "name": "User", - "style": { - "navigationBarTitleText": "", - "navigationBarBackgroundColor": "#ffffff" - } - }, { - "path": "pages/auth/auth", - "name": "Auth", - "style": { - "navigationBarTitleText": "", - "disableScroll": false, - "navigationStyle": "custom", - "animationType": "slide-in-bottom" - } - }, { - "path": "pages/auth/registered", - "name": "Registered", - "style": { - "navigationBarTitleText": "注册", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#ffffff" - } - }, { - "path": "pages/auth/resetPassword", - "name": "ResetPassword", - "style": { - "navigationBarTitleText": "重置密码", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#ffffff" - } - }, { - "path": "pages/college/test", - "name": "CollegeTest", - "auth": true, - "style": { - "navigationBarTitleText": "考试", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#ffffff" - } - }, { - "path": "pages/richText/richText", - "name": "RichText", - "style": { - "navigationBarTitleText": "-", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#ffffff" - } - }, { - "path": "pages/work/create", - "name": "OrderCreate", - "auth": true, - "style": { - "navigationBarTitleText": "", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#ffffff" - } - }, { - "path": "pages/work/orders", - "name": "Orders", - "auth": true, - "style": { - "navigationBarTitleText": "订单管理", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#ffffff" - } - }, { - "path": "pages/work/service", - "name": "OrdersService", - "auth": true, - "style": { - "navigationBarTitleText": "分配服务包", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#ffffff", - "app-plus": { - "titleNView": { - "buttons": [{ - "text": "添加", - "color": "#446EFE", - "fontSize": "32rpx", - "width": "120rpx" - }] - } - } - } - }, { - "path": "pages/work/available", - "name": "OrderAvailable", - "auth": true, - "style": { - "navigationBarTitleText": "搜索用户", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#ffffff" - } - }, { - "path": "pages/work/generate", - "auth": true, - "name": "WorkGenerate", - "style": { - "navigationBarTitleText": "基础信息", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#ffffff" - } - }, { - "path": "pages/user/info", - "auth": true, - "name": "UserInfo", - "style": { - "navigationBarTitleText": "编辑", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#ffffff" - } - }, { - "path": "pages/user/code", - "auth": true, - "name": "UserCode", - "style": { - "navigationBarTitleText": "邀请二维码", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#1F25AE", - "navigationBarTextStyle": "white" - } - }, { - "path": "pages/user/certification", - "auth": true, - "name": "UserCertification", - "style": { - "navigationBarTitleText": "实名认证", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#ffffff" - } - }, { - "path": "pages/user/team", - "auth": true, - "name": "UserTeam", - "style": { - "navigationBarTitleText": "我的客户", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#ffffff" - } - }, { - "path": "pages/user/set", - "auth": true, - "name": "UserSet", - "style": { - "navigationBarTitleText": "设置", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#ffffff" - } - }, { - "path": "pages/account/bonus", - "auth": true, - "name": "AccountBonus", - "style": { - "navigationBarTitleText": "奖金账户", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#926fff", - "navigationBarTextStyle": "white" - } - }, { - "path": "pages/account/yunying", - "auth": true, - "name": "YunYing", - "style": { - "navigationBarTitleText": "", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#446EFE", - "navigationBarTextStyle": "white" - } - }, { - "path": "pages/account/cash", - "auth": true, - "name": "AccountCash", - "style": { - "navigationBarTitleText": "业绩账户", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#446EFE", - "navigationBarTextStyle": "white" - } - }, { - "path": "pages/account/integral", - "auth": true, - "name": "AccountIntegral", - "style": { - "navigationBarTitleText": "", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#ffffff", - "app-plus": { - "titleNView": { - "buttons": [{ - "text": "充值记录", - "color": "#111", - "fontSize": "32rpx", - "width": "180rpx" - }] - } - } - } - }, { - "path": "pages/college/answer", - "auth": true, - "name": "CollegeAnswer", - "style": { - "navigationBarTitleText": "答题", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#446EFE", - "navigationBarTextStyle": "white" - } - }, { - "path": "pages/college/testResults", - "auth": true, - "name": "CollegeResults", - "style": { - "navigationBarTitleText": "考试结果", - "navigationBarBackgroundColor": "#446EFE", - "navigationBarTextStyle": "white", - "enablePullDownRefresh": false - } - }, { - "path": "pages/account/logs", - "auth": true, - "name": "AccountLogs", - "style": { - "navigationBarTitleText": "账户记录", - "enablePullDownRefresh": false - } - - }, { - "path": "pages/pay/pay", - "auth": true, - "name": "Pay", - "style": { - "navigationBarTitleText": "收银台", - "enablePullDownRefresh": false - } - }, { - "path": "pages/work/orderInfo", - "auth": true, - "name": "OrderInfo", - "style": { - "navigationBarTitleText": "详情", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#446EFE", - "navigationBarTextStyle": "white" - } - }, { - "path": "pages/user/eSign", - "auth": true, - "name": "ESign", - "style": { - "navigationBarTitleText": "人脸认证", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#FFFFFF", - "app-plus": { - "titleNView": { - "buttons": [{ - "text": "\ue66c", - "float": "left", - "fontSrc": "/static/uniicons.ttf", - "fontSize": "20px" - }] - } - } - } - }, { - "path": "pages/work/perfectChoose", - "auth": true, - "name": "WorkPerfectChoose", - "style": { - "navigationBarTitleText": "", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#446EFE", - "navigationBarTextStyle": "white" - } - }, { - "path": "pages/work/perfectInstitutions", - "auth": true, - "name": "WorkPerfectInstitutions", - "style": { - "navigationBarTitleText": "机构信息", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#446EFE", - "navigationBarTextStyle": "white" - } - }, { - "path": "pages/work/perfectBasis", - "auth": true, - "name": "WorkPerfectBasis", - "style": { - "navigationBarTitleText": "基础信息", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#446EFE", - "navigationBarTextStyle": "white" - } - }, { - "path": "pages/transfers/lists", - "auth": true, - "name": "TransfersOrders", - "style": { - "navigationBarTitleText": "转让订单", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#ffffff" - } - }, { - "path": "pages/work/modifyOrder", - "auth": true, - "name": "ModifyOrder", - "style": { - "navigationBarTitleText": "修改资料订单", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#ffffff" - } - - }, { - "path": "pages/work/poorOrder", - "auth": true, - "name": "PoorOrder", - "style": { - "navigationBarTitleText": "补差价订单", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#ffffff" - } - - }, { - "path": "pages/work/refundOrder", - "auth": true, - "name": "RefundOrder", - "style": { - "navigationBarTitleText": "退款订单", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#ffffff" - } - - }, { - "path": "pages/work/mailed", - "auth": true, - "name": "MailedOrder", - "style": { - "navigationBarTitleText": "邮寄材料", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#446EFE", - "navigationBarTextStyle": "white" - } - }, { - "path": "pages/work/schemes", - "auth": true, - "name": "OrderSchemes", - "style": { - "navigationBarTitleText": "预估方案", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#446EFE", - "navigationBarTextStyle": "white" - } - }, { - "path": "pages/work/perfectBasisInfo", - "auth": true, - "name": "OrderPerfectBasisInfo", - "style": { - "navigationBarTitleText": "基础资料信息", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#ffffff" - } - - }, { - "path": "pages/work/perfectInstitutionsInfo", - "auth": true, - "name": "OrderPerfectInstitutionsInfo", - "style": { - "navigationBarTitleText": "机构资料信息", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#ffffff" - } - }, { - "path": "pages/user/userdata", - "auth": true, - "name": "UserData", - "style": { - "navigationBarTitleText": "账户信息", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#ffffff" - } - }, { - "path": "pages/user/userdataBase", - "auth": true, - "name": "UserDataBase", - "style": { - "navigationBarTitleText": "账户信息 - 基础信息", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#ffffff" - } - }, { - "path": "pages/user/userdataBanks", - "auth": true, - "name": "UserDataBank", - "style": { - "navigationBarTitleText": "账户信息 - 机构信息", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#ffffff" - } - }, { - "path": "pages/work/express", - "auth": true, - "name": "WorkExpress", - "style": { - "navigationBarTitleText": "邮寄状态", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#ffffff" - } - }, { - "path": "pages/work/expressInfo", - "auth": true, - "name": "WorkExpressInfo", - "style": { - "navigationBarTitleText": "快递详情", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#ffffff" - } - }, { - "path": "pages/work/confirmScheme", - "auth": true, - "name": "ConfirmScheme", - "style": { - "navigationBarTitleText": "结案方案", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#ffffff" - } - }, { - "path": "pages/work/confirmSchemeInfo", - "auth": true, - "name": "ConfirmSchemeInfo", - "style": { - "navigationBarTitleText": "方案详情", - "enablePullDownRefresh": false, - "navigationBarTextStyle": "white", - "navigationBarBackgroundColor": "#446EFE" - } - }, { - "path": "pages/user/salesmanCode", - "auth": true, - "name": "SalesmanCode", - "style": { - "navigationBarTitleText": "业务员邀请码", - "enablePullDownRefresh": false, - "navigationBarTextStyle": "white", - "navigationBarBackgroundColor": "#446EFE" - } - }, { - "path": "pages/user/weChat", - "auth": true, - "name": "WeChat", - "style": { - "navigationBarTitleText": "关注公众号", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#f8f8f8" - } - }, { - "path": "pages/account/withdraws", - "auth": true, - "name": "Withdraws", - "style": { - "navigationBarTitleText": "申请提现", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#FFFFFF" - } - }, { - "path": "pages/work/orderLog", - "auth": true, - "name": "OrderLog", - "style": { - "navigationBarTitleText": "记录", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#FFFFFF" - } - }, { - "path": "pages/im/chat", - "auth": true, - "name": "ImChat", - "style": { - "navigationBarTitleText": "聊天窗口", - "enablePullDownRefresh": false, - "disableScroll": true, - "navigationBarBackgroundColor": "#FFFFFF" - } - }, { - "path": "pages/im/msg", - "name": "ImMsg", - "style": { - "navigationBarTitleText": "消息", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#FFFFFF" - } - }, { - "path": "pages/user/signLog", - "name": "SignLog", - "style": { - "navigationBarTitleText": "合同记录", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#FFFFFF" - } - }, { +{ + "pages": [{ + "path": "pages/index/index", + "name": "Index", + "style": { + "navigationBarTitleText": "抖火法律咨询服务", + "navigationBarBackgroundColor": "#FFFFFF" + } + }, { + "path": "pages/index/introduces", + "name": "Introduces", + "style": { + "navigationStyle": "custom", + "navigationBarTitleText": "金法服务包介绍", + "app-plus": { + "titleNView": { + "backgroundColor": "#FFFFFF", + "type": "transparent" + } + } + } + }, { + "path": "pages/index/free", + "name": "FreeService", + "auth": true, + "style": { + "navigationStyle": "custom", + "navigationBarTitleText": "自由服务包介绍", + "app-plus": { + "titleNView": { + "backgroundColor": "#FFFFFF", + "type": "transparent" + } + } + } + }, { + "path": "pages/index/introduces", + "name": "Introduces", + "style": { + "navigationStyle": "custom", + "navigationBarTitleText": "介绍", + "app-plus": { + "titleNView": { + "backgroundColor": "#FFFFFF", + "type": "transparent" + } + } + } + }, { + "path": "pages/college/index", + "name": "College", + "style": { + "navigationBarTitleText": "商学院", + "navigationStyle": "custom" + } + }, { + "path": "pages/work/index", + "name": "Work", + "style": { + "navigationBarTitleText": "工作台", + "navigationStyle": "custom" + } + }, { + "path": "pages/user/index", + "name": "User", + "style": { + "navigationBarTitleText": "", + "navigationBarBackgroundColor": "#ffffff" + } + }, { + "path": "pages/auth/auth", + "name": "Auth", + "style": { + "navigationBarTitleText": "", + "disableScroll": false, + "navigationStyle": "custom", + "animationType": "slide-in-bottom" + } + }, { + "path": "pages/auth/registered", + "name": "Registered", + "style": { + "navigationBarTitleText": "注册", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#ffffff" + } + }, { + "path": "pages/auth/resetPassword", + "name": "ResetPassword", + "style": { + "navigationBarTitleText": "重置密码", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#ffffff" + } + }, { + "path": "pages/college/test", + "name": "CollegeTest", + "auth": true, + "style": { + "navigationBarTitleText": "考试", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#ffffff" + } + }, { + "path": "pages/richText/richText", + "name": "RichText", + "style": { + "navigationBarTitleText": "-", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#ffffff" + } + }, { + "path": "pages/work/create", + "name": "OrderCreate", + "auth": true, + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#ffffff" + } + }, { + "path": "pages/work/orders", + "name": "Orders", + "auth": true, + "style": { + "navigationBarTitleText": "订单管理", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#ffffff" + } + }, { + "path": "pages/work/service", + "name": "OrdersService", + "auth": true, + "style": { + "navigationBarTitleText": "分配服务包", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#ffffff", + "app-plus": { + "titleNView": { + "buttons": [{ + "text": "添加", + "color": "#446EFE", + "fontSize": "32rpx", + "width": "120rpx" + }] + } + } + } + }, { + "path": "pages/work/available", + "name": "OrderAvailable", + "auth": true, + "style": { + "navigationBarTitleText": "搜索用户", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#ffffff" + } + }, { + "path": "pages/work/generate", + "auth": true, + "name": "WorkGenerate", + "style": { + "navigationBarTitleText": "基础信息", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#ffffff" + } + }, { + "path": "pages/user/info", + "auth": true, + "name": "UserInfo", + "style": { + "navigationBarTitleText": "编辑", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#ffffff" + } + }, { + "path": "pages/user/code", + "auth": true, + "name": "UserCode", + "style": { + "navigationBarTitleText": "邀请二维码", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#1F25AE", + "navigationBarTextStyle": "white" + } + }, { + "path": "pages/user/certification", + "auth": true, + "name": "UserCertification", + "style": { + "navigationBarTitleText": "实名认证", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#ffffff" + } + }, { + "path": "pages/user/team", + "auth": true, + "name": "UserTeam", + "style": { + "navigationBarTitleText": "我的客户", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#ffffff" + } + }, { + "path": "pages/user/set", + "auth": true, + "name": "UserSet", + "style": { + "navigationBarTitleText": "设置", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#ffffff" + } + }, { + "path": "pages/account/bonus", + "auth": true, + "name": "AccountBonus", + "style": { + "navigationBarTitleText": "奖金账户", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#926fff", + "navigationBarTextStyle": "white" + } + }, { + "path": "pages/account/yunying", + "auth": true, + "name": "YunYing", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#446EFE", + "navigationBarTextStyle": "white" + } + }, { + "path": "pages/account/cash", + "auth": true, + "name": "AccountCash", + "style": { + "navigationBarTitleText": "业绩账户", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#446EFE", + "navigationBarTextStyle": "white" + } + }, { + "path": "pages/account/integral", + "auth": true, + "name": "AccountIntegral", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#ffffff", + "app-plus": { + "titleNView": { + "buttons": [{ + "text": "充值记录", + "color": "#111", + "fontSize": "32rpx", + "width": "180rpx" + }] + } + } + } + }, { + "path": "pages/college/answer", + "auth": true, + "name": "CollegeAnswer", + "style": { + "navigationBarTitleText": "答题", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#446EFE", + "navigationBarTextStyle": "white" + } + }, { + "path": "pages/college/testResults", + "auth": true, + "name": "CollegeResults", + "style": { + "navigationBarTitleText": "考试结果", + "navigationBarBackgroundColor": "#446EFE", + "navigationBarTextStyle": "white", + "enablePullDownRefresh": false + } + }, { + "path": "pages/account/logs", + "auth": true, + "name": "AccountLogs", + "style": { + "navigationBarTitleText": "账户记录", + "enablePullDownRefresh": false + } + + }, { + "path": "pages/pay/pay", + "auth": true, + "name": "Pay", + "style": { + "navigationBarTitleText": "收银台", + "enablePullDownRefresh": false + } + }, { + "path": "pages/work/orderInfo", + "auth": true, + "name": "OrderInfo", + "style": { + "navigationBarTitleText": "详情", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#446EFE", + "navigationBarTextStyle": "white" + } + }, { + "path": "pages/user/eSign", + "auth": true, + "name": "ESign", + "style": { + "navigationBarTitleText": "人脸认证", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#FFFFFF", + "app-plus": { + "titleNView": { + "buttons": [{ + "text": "\ue66c", + "float": "left", + "fontSrc": "/static/uniicons.ttf", + "fontSize": "20px" + }] + } + } + } + }, { + "path": "pages/work/perfectChoose", + "auth": true, + "name": "WorkPerfectChoose", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#446EFE", + "navigationBarTextStyle": "white" + } + }, { + "path": "pages/work/perfectInstitutions", + "auth": true, + "name": "WorkPerfectInstitutions", + "style": { + "navigationBarTitleText": "机构信息", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#446EFE", + "navigationBarTextStyle": "white" + } + }, { + "path": "pages/work/perfectBasis", + "auth": true, + "name": "WorkPerfectBasis", + "style": { + "navigationBarTitleText": "基础信息", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#446EFE", + "navigationBarTextStyle": "white" + } + }, { + "path": "pages/transfers/lists", + "auth": true, + "name": "TransfersOrders", + "style": { + "navigationBarTitleText": "转让订单", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#ffffff" + } + }, { + "path": "pages/work/modifyOrder", + "auth": true, + "name": "ModifyOrder", + "style": { + "navigationBarTitleText": "修改资料订单", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#ffffff" + } + + }, { + "path": "pages/work/poorOrder", + "auth": true, + "name": "PoorOrder", + "style": { + "navigationBarTitleText": "补差价订单", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#ffffff" + } + + }, { + "path": "pages/work/refundOrder", + "auth": true, + "name": "RefundOrder", + "style": { + "navigationBarTitleText": "退款订单", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#ffffff" + } + + }, { + "path": "pages/work/mailed", + "auth": true, + "name": "MailedOrder", + "style": { + "navigationBarTitleText": "邮寄材料", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#446EFE", + "navigationBarTextStyle": "white" + } + }, { + "path": "pages/work/schemes", + "auth": true, + "name": "OrderSchemes", + "style": { + "navigationBarTitleText": "预估方案", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#446EFE", + "navigationBarTextStyle": "white" + } + }, { + "path": "pages/work/perfectBasisInfo", + "auth": true, + "name": "OrderPerfectBasisInfo", + "style": { + "navigationBarTitleText": "基础资料信息", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#ffffff" + } + + }, { + "path": "pages/work/perfectInstitutionsInfo", + "auth": true, + "name": "OrderPerfectInstitutionsInfo", + "style": { + "navigationBarTitleText": "机构资料信息", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#ffffff" + } + }, { + "path": "pages/user/userdata", + "auth": true, + "name": "UserData", + "style": { + "navigationBarTitleText": "账户信息", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#ffffff" + } + }, { + "path": "pages/user/userdataBase", + "auth": true, + "name": "UserDataBase", + "style": { + "navigationBarTitleText": "账户信息 - 基础信息", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#ffffff" + } + }, { + "path": "pages/user/userdataBanks", + "auth": true, + "name": "UserDataBank", + "style": { + "navigationBarTitleText": "账户信息 - 机构信息", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#ffffff" + } + }, { + "path": "pages/work/express", + "auth": true, + "name": "WorkExpress", + "style": { + "navigationBarTitleText": "邮寄状态", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#ffffff" + } + }, { + "path": "pages/work/expressInfo", + "auth": true, + "name": "WorkExpressInfo", + "style": { + "navigationBarTitleText": "快递详情", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#ffffff" + } + }, { + "path": "pages/work/confirmScheme", + "auth": true, + "name": "ConfirmScheme", + "style": { + "navigationBarTitleText": "结案方案", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#ffffff" + } + }, { + "path": "pages/work/confirmSchemeInfo", + "auth": true, + "name": "ConfirmSchemeInfo", + "style": { + "navigationBarTitleText": "方案详情", + "enablePullDownRefresh": false, + "navigationBarTextStyle": "white", + "navigationBarBackgroundColor": "#446EFE" + } + }, { + "path": "pages/user/salesmanCode", + "auth": true, + "name": "SalesmanCode", + "style": { + "navigationBarTitleText": "业务员邀请码", + "enablePullDownRefresh": false, + "navigationBarTextStyle": "white", + "navigationBarBackgroundColor": "#446EFE" + } + }, { + "path": "pages/user/weChat", + "auth": true, + "name": "WeChat", + "style": { + "navigationBarTitleText": "关注公众号", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#f8f8f8" + } + }, { + "path": "pages/account/withdraws", + "auth": true, + "name": "Withdraws", + "style": { + "navigationBarTitleText": "申请提现", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#FFFFFF" + } + }, { + "path": "pages/work/orderLog", + "auth": true, + "name": "OrderLog", + "style": { + "navigationBarTitleText": "记录", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#FFFFFF" + } + }, { + "path": "pages/im/chat", + "auth": true, + "name": "ImChat", + "style": { + "navigationBarTitleText": "聊天窗口", + "enablePullDownRefresh": false, + "disableScroll": true, + "navigationBarBackgroundColor": "#FFFFFF" + } + }, { + "path": "pages/im/msg", + "name": "ImMsg", + "style": { + "navigationBarTitleText": "消息", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#FFFFFF" + } + }, { + "path": "pages/user/signLog", + "name": "SignLog", + "style": { + "navigationBarTitleText": "合同记录", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#FFFFFF" + } + }, { "path": "pages/user/contract", - "name": "SignContract", - "style": { - "navigationBarTitleText": "合同", + "name": "SignContract", + "style": { + "navigationBarTitleText": "合同", "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#FFFFFF" - } - }], - "globalStyle": { - "navigationBarTextStyle": "black", - "navigationBarTitleText": "抖火", - "navigationBarBackgroundColor": "#F8F8F8", - "backgroundColor": "#F8F8F8" - }, - "tabBar": { - "backgroundColor": "white", - "borderStyle": "white", - "color": "#999999", - "selectedColor": "#446EFE", - "list": [{ - "iconPath": "static/icons/tabs_icon_00.png", - "selectedIconPath": "static/icons/tabs_show_00.png", - "pagePath": "pages/index/index", - "text": "服务包" - }, { - "iconPath": "static/icons/tabs_icon_01.png", - "selectedIconPath": "static/icons/tabs_show_01.png", - "pagePath": "pages/college/test", - "text": "业务考试" - }, { - "iconPath": "static/icons/tabs_icon_02.png", - "selectedIconPath": "static/icons/tabs_show_02.png", - "pagePath": "pages/work/index", - "text": "工作台" - }, { - "iconPath": "static/icons/tabs_icon_03.png", - "selectedIconPath": "static/icons/tabs_show_03.png", - "pagePath": "pages/user/index", - "text": "我的" - }] - }, - "easycom": { - "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue" - }, - "uniIdRouter": {} + "navigationBarBackgroundColor": "#FFFFFF" + } + }], + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "抖火", + "navigationBarBackgroundColor": "#F8F8F8", + "backgroundColor": "#F8F8F8" + }, + "tabBar": { + "backgroundColor": "white", + "borderStyle": "white", + "color": "#999999", + "selectedColor": "#446EFE", + "list": [{ + "iconPath": "static/icons/tabs_icon_00.png", + "selectedIconPath": "static/icons/tabs_show_00.png", + "pagePath": "pages/index/index", + "text": "服务包" + }, { + "iconPath": "static/icons/tabs_icon_01.png", + "selectedIconPath": "static/icons/tabs_show_01.png", + "pagePath": "pages/college/test", + "text": "业务考试" + }, { + "iconPath": "static/icons/tabs_icon_02.png", + "selectedIconPath": "static/icons/tabs_show_02.png", + "pagePath": "pages/work/index", + "text": "工作台" + }, { + "iconPath": "static/icons/tabs_icon_03.png", + "selectedIconPath": "static/icons/tabs_show_03.png", + "pagePath": "pages/user/index", + "text": "我的" + }] + }, + "easycom": { + "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue" + }, + "uniIdRouter": {} } \ No newline at end of file diff --git a/pages/im/chat.vue b/pages/im/chat.vue index 5388f64..04c88c5 100644 --- a/pages/im/chat.vue +++ b/pages/im/chat.vue @@ -3,23 +3,18 @@ 消息{{index}} - + + 图片 + 视频 + 音频通话 + 视频通话 + + diff --git a/pages/im/msg.vue b/pages/im/msg.vue index 3361986..626e481 100644 --- a/pages/im/msg.vue +++ b/pages/im/msg.vue @@ -15,7 +15,7 @@ shape="square" randomBgColor > - + {{item.nickname}} {{item.time}} @@ -58,6 +58,9 @@ } } }, + onShow() { + // this.$nim.msg() + }, methods: { onMsg(id){ let cartId = id || null diff --git a/pages/pay/pay.vue b/pages/pay/pay.vue index 4494f1f..3425605 100644 --- a/pages/pay/pay.vue +++ b/pages/pay/pay.vue @@ -30,7 +30,7 @@ - - + + + + 版本检测 + + + 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..7093c20 --- /dev/null +++ b/pages/user/signLog.vue @@ -0,0 +1,116 @@ + + + + + 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/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/static/icons/user_nav_08.png b/static/icons/user_nav_08.png new file mode 100644 index 0000000..9d77edb Binary files /dev/null and b/static/icons/user_nav_08.png differ 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..7c78794 --- /dev/null +++ b/uni_modules/oct-mechanism-picker/components/oct-mechanism-picker/oct-mechanism-picker.vue @@ -0,0 +1,177 @@ + + + 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 diff --git a/uni_modules/uni-usercapturescreen/changelog.md b/uni_modules/uni-usercapturescreen/changelog.md new file mode 100644 index 0000000..51378b5 --- /dev/null +++ b/uni_modules/uni-usercapturescreen/changelog.md @@ -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、微信小程序平台 diff --git a/uni_modules/uni-usercapturescreen/index.d.ts b/uni_modules/uni-usercapturescreen/index.d.ts new file mode 100644 index 0000000..debf1a1 --- /dev/null +++ b/uni_modules/uni-usercapturescreen/index.d.ts @@ -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; +} 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) +} 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"