From 8e2a23ed6937d99860f7e9e4bb1903116f55df4e Mon Sep 17 00:00:00 2001 From: sx <2427911852@qq.com> Date: Tue, 25 Feb 2025 18:39:55 +0800 Subject: [PATCH] =?UTF-8?q?2025.02.25=20=E5=B7=A5=E4=BD=9C=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E6=8F=90=E4=BA=A4=20app=E6=9D=83=E9=99=90=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E7=9A=84=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jiuyi2/App.vue | 155 ++- jiuyi2/api/index.js | 15 +- jiuyi2/common/js/util.js | 279 +---- jiuyi2/manifest.json | 1 - jiuyi2/pages.json | 2 +- jiuyi2/pages/mine/setting/bankCard.vue | 23 +- jiuyi2/pages/mine/setting/bankCardAdd.vue | 186 ++- jiuyi2/pages/news/chat/chat.vue | 1092 ++++++++--------- jiuyi2/pages/shop/store/index.vue | 5 +- .../changelog.md | 8 + .../package.json | 115 ++ .../readme.md | 95 ++ .../utssdk/app-android/AndroidManifest.xml | 3 + .../utssdk/app-android/config.json | 3 + .../utssdk/app-android/index.uts | 148 +++ .../res/anim/popupwindow_enter.xml | 6 + .../app-android/res/anim/popupwindow_exit.xml | 5 + .../drawable/dcloud_permission_background.xml | 6 + .../utssdk/interface.uts | 19 + 19 files changed, 1278 insertions(+), 888 deletions(-) create mode 100644 jiuyi2/uni_modules/uni-registerRequestPermissionTips/changelog.md create mode 100644 jiuyi2/uni_modules/uni-registerRequestPermissionTips/package.json create mode 100644 jiuyi2/uni_modules/uni-registerRequestPermissionTips/readme.md create mode 100644 jiuyi2/uni_modules/uni-registerRequestPermissionTips/utssdk/app-android/AndroidManifest.xml create mode 100644 jiuyi2/uni_modules/uni-registerRequestPermissionTips/utssdk/app-android/config.json create mode 100644 jiuyi2/uni_modules/uni-registerRequestPermissionTips/utssdk/app-android/index.uts create mode 100644 jiuyi2/uni_modules/uni-registerRequestPermissionTips/utssdk/app-android/res/anim/popupwindow_enter.xml create mode 100644 jiuyi2/uni_modules/uni-registerRequestPermissionTips/utssdk/app-android/res/anim/popupwindow_exit.xml create mode 100644 jiuyi2/uni_modules/uni-registerRequestPermissionTips/utssdk/app-android/res/drawable/dcloud_permission_background.xml create mode 100644 jiuyi2/uni_modules/uni-registerRequestPermissionTips/utssdk/interface.uts diff --git a/jiuyi2/App.vue b/jiuyi2/App.vue index edff6b17..6553fd87 100644 --- a/jiuyi2/App.vue +++ b/jiuyi2/App.vue @@ -1,59 +1,122 @@ \ No newline at end of file diff --git a/jiuyi2/api/index.js b/jiuyi2/api/index.js index 40b76bae..b5fb15a7 100644 --- a/jiuyi2/api/index.js +++ b/jiuyi2/api/index.js @@ -85,7 +85,20 @@ const api = { method: 'GET', }) }, - + + /** + * 获取带搜索的分类字典数据 + * @param {Object} param + */ + getDicFuzzy(param) { + return util.request({ + url: '/system/dict/data/type/fuzzy', + path: param.path, + query: param.query, + method: 'GET', + }) + }, + /** * 获取未读消息数量 * @param {Object} param diff --git a/jiuyi2/common/js/util.js b/jiuyi2/common/js/util.js index 62bdca84..2c59d799 100644 --- a/jiuyi2/common/js/util.js +++ b/jiuyi2/common/js/util.js @@ -66,14 +66,14 @@ const util = { showCancel: obj.showCancel, cancelText: obj.cancelText, success: res => { - obj.success ? obj.success(res) : () => { } + obj.success ? obj.success(res) : () => {} resolve(res) }, fail: err => { - obj.fail ? obj.fail(err) : () => { } + obj.fail ? obj.fail(err) : () => {} reject(err) }, - complete: res => { } + complete: res => {} }) }) }, @@ -881,32 +881,6 @@ const util = { }) }, - /** - * 预览文件 - * @param {String} url 文件路径 - */ - view_file(url) { - // 后缀 - let suffix = util.get_file_suffix(url).id - // - if (!['doc', 'xls', 'ppt', 'pdf', 'docx', 'xlsx', 'pptx'].includes(suffix)) { - util.alert('操作需要在web端') - console.log('Unsupported suffix', suffix) - return - } - uni.downloadFile({ - url, - success: res => { - uni.openDocument({ - filePath: res.tempFilePath, - fail: rs => { - console.log('rs', rs) - } - }) - } - }) - }, - /** * 通过路径获取文件后缀 * @param {Object} url 需要获取的文件路径 @@ -919,11 +893,12 @@ const util = { const file_suffix = util.config[{ 'file': 'file_suffix', 'audio': 'audio_suffix', - }[type]] + } [type]] let result = '' if (url) result = file_suffix.find(item => item.id === url.split('.').pop().toLowerCase()) return result }, + /** * 通过路径获取音频后缀 * @param {Object} url 需要获取的文件路径 @@ -1045,7 +1020,7 @@ const util = { obj.fail ? obj.fail('no data') : '' } break - // app支付 + // app支付 case "app": uni.requestPayment({ provider: "wxpay", @@ -1067,7 +1042,7 @@ const util = { break } break - // 支付宝支付 + // 支付宝支付 case "2": switch (obj.method) { // app支付 @@ -1092,7 +1067,7 @@ const util = { break } break - // 钱包支付 + // 钱包支付 case "4": obj.success ? obj.success(rs) : '' result_goto('success') @@ -1164,7 +1139,7 @@ const util = { util.alert("您拒绝了授权"); // 失败 - obj.fail ? obj.fail(res) : (res) => { }; + obj.fail ? obj.fail(res) : (res) => {}; }, complete() { // 结束 @@ -1173,235 +1148,6 @@ const util = { }); }, - /** - * 拉起授权请求: 微信小程序、app - */ - authorize(obj) { - // 返回promise对象 - return new Promise((resolve, reject) => { - // 对象 - obj ? obj : obj = {} - - // #ifdef APP-PLUS - let isAgreePrivacy = plus.runtime.isAgreePrivacy() - if (!isAgreePrivacy) { - resolve('未同意用户协议隐私政策') - return - } - // #endif - - // 菜单 - const menu = { - // 定位 - location: { - name: '定位服务', - scope: 'scope.userLocation', - txt: '需要获取您的地理位置', - }, - // 相册 - photosAlbum: { - name: '相册', - scope: 'scope.writePhotosAlbum', - txt: '需要访问您的相册', - }, - // 相机 - camera: { - name: '摄像头', - scope: 'scope.camera', - txt: '需要访问您的摄像头', - }, - } - - // 判断是否有键值 - if (obj.key) { - // 传参对象 - obj = { - ...obj, - ...menu[obj.key] - } - } - - let fnName = '' - - // #ifdef MP-WEIXIN - // 微信小程序授权 - fnName = 'weChatAuthorize' - // #endif - // #ifdef APP-PLUS - // app授权 - fnName = 'appAuthorize' - // #endif - - // - this[fnName](obj) - .then(rs => { - // 成功 - obj.success ? obj.success(rs) : '' - resolve(rs) - }) - .catch(err => { - // 失败 - obj.fail ? obj.fail(err) : '' - reject(err) - }) - }) - }, - - // app授权 - appAuthorize(obj) { - // 系统设置 - return new Promise((resolve, reject) => { - // 手机设置 - const systemSetting = uni.getSystemSetting() - - // 没开 - if (systemSetting.locationEnabled === false) { - this.alert(obj.txt) - // 失败 - reject({ - msg: '未授权对应功能', - }) - return - } - - // 用户是否开启定位权限 - const authorized = uni.getAppAuthorizeSetting().locationAuthorized - console.log('locationAuthorized', authorized); - - if (authorized === 'config error') { - // 开发者没有配置权限 https://uniapp.dcloud.net.cn/api/system/getappauthorizesetting.html - reject({ - msg: '开发者未勾选定位服务模块', - }) - return - } else if (authorized === 'denied') { - // reject({ - // msg: 'user denied', - // }) - // return - } else if (authorized === 'authorized') { - // 表示已经获得授权,无需再次请求授权 - resolve(obj) - return - } - - // 判断平台 - if (uni.getSystemInfoSync().platform == "android") { - // 请求权限配置 - plus.android.requestPermissions( - // 对应权限 - ['android.permission.ACCESS_FINE_LOCATION'], - // 成功 - (resultObj) => { - // 结果 - let result = null - - for (let i = 0; i < resultObj.granted.length; i++) { - let grantedPermission = resultObj.granted[i] - console.log('已获取的权限:' + grantedPermission) - if (result !== null) result = 1 - } - - for (let i = 0; i < resultObj.deniedPresent.length; i++) { - let deniedPresentPermission = resultObj.deniedPresent[ - i] - console.log('拒绝本次申请的权限:' + deniedPresentPermission) - if (result !== null) result = 0 - } - - for (let i = 0; i < resultObj.deniedAlways.length; i++) { - let deniedAlwaysPermission = resultObj.deniedAlways[i] - console.log('永久拒绝申请的权限:' + deniedAlwaysPermission) - if (result !== null) result = -1 - } - - // 成功 - if (result === 1) { - resolve() - } else if ([-1].includes(result)) { - // 若所需权限被拒绝,则打开APP设置界面,可以在APP设置界面打开相应权限 - // 引导用户打开设置页面 - uni.openAppAuthorizeSetting({ - success: rs => { - // 失败 - reject({ - msg: '引导用户打开设置页面', - info: rs, - }) - }, - fail: err => { - // 失败 - reject({ - msg: '用户设置页面打开失败', - info: err, - }) - }, - }) - } - }, - // 失败 - (error) => { - console.log('申请权限错误:' + error.code + " = " + error.message) - resolve({ - code: error.code, - message: error.message - }) - } - ) - } else { - this.alert('请在设置里允许打开定位信息') - resolve({ - msg: '用户未开启定位权限', - }) - return - } - }) - }, - - // 微信小程序授权 - weChatAuthorize(obj) { - // 成功 - return new Promise((resolve, reject) => { - // 是否在微信小程序限制范围内 - if (!['scope.userInfo', 'scope.userLocation', 'scope.userLocationBackground', - 'scope.address', - 'scope.record', 'scope.writePhotosAlbum', 'scope.camera', - 'scope.invoice', - 'scope.invoiceTitle', 'scope.werun' - ].includes(obj.scope)) { - resolve({ - msg: '不在限制范围内', - }) - return - } - - // 授权 - uni.authorize({ - scope: obj.scope, - success: rs => { - // 成功 - resolve(rs) - }, - fail: err => { - // 失败 - reject(err) - - // 弹窗提示 - util.alert({ - title: '系统提示', - value: obj.txt, - success: rs => { - if (rs.confirm) { - // 打开微信权限设置 - uni.openSetting() - } - }, - }) - }, - }) - }) - }, - /** * 最终登录 用于请求登录接口后统一调用的登录方法 * @param {Object} param 数据对象 @@ -1412,7 +1158,6 @@ const util = { const token = param.data // 缓存token uni.setStorageSync('token', token) - console.log('set token', token) // 开启加载 uni.showLoading({ @@ -1473,7 +1218,7 @@ const util = { // 验证sdk是否准备完毕 let isReady = uni.$chat.isReady(); if (!isReady) { - setTimeout(function () { + setTimeout(function() { util.updateMyProfile(userinfo); }, 800); return @@ -1485,7 +1230,7 @@ const util = { } uni.$chat.updateMyProfile(obj).then(res => { // console.log(res); - }) + }) }, /** @@ -1748,7 +1493,7 @@ const util = { } }); }, - showToastAndRedirect(title, icon = 'none', fun = () => { }) { + showToastAndRedirect(title, icon = 'none', fun = () => {}) { uni.showToast({ title, icon, diff --git a/jiuyi2/manifest.json b/jiuyi2/manifest.json index 216590c9..05cc222c 100644 --- a/jiuyi2/manifest.json +++ b/jiuyi2/manifest.json @@ -20,7 +20,6 @@ "modules" : { "Camera" : {}, "Payment" : {}, - "Share" : {}, "VideoPlayer" : {}, "Barcode" : {}, "Record" : {} diff --git a/jiuyi2/pages.json b/jiuyi2/pages.json index cea05112..3c9dd4a8 100644 --- a/jiuyi2/pages.json +++ b/jiuyi2/pages.json @@ -836,7 +836,7 @@ "list": [ { "name": "test", - "path": "pages/index/index" + "path": "pages/mine/homepage" } ] }, diff --git a/jiuyi2/pages/mine/setting/bankCard.vue b/jiuyi2/pages/mine/setting/bankCard.vue index 076ce6e6..95e48fa7 100644 --- a/jiuyi2/pages/mine/setting/bankCard.vue +++ b/jiuyi2/pages/mine/setting/bankCard.vue @@ -4,6 +4,7 @@ ref, computed, reactive, + getCurrentInstance } from 'vue' import { useStore @@ -16,6 +17,9 @@ import util from '@/common/js/util.js' // api import api from '@/api/index.js' + const { + proxy + } = getCurrentInstance() // 列表 const list = reactive([]) // 滑动菜单 @@ -57,18 +61,6 @@ api.mine.getBankCards({}).then(rs => { if (rs.code == 200) { Object.assign(list, rs.data) - list.push({ - bankName: "建设银行", - cardHolderName: "商旭", - cardId: "1", - cardNumber: "6217002270031535710", - cardType: "DEBIT", - createTime: null, - delFlag: "0", - isDefault: null, - updateTime: null, - userId: 13, - }) return } util.alert({ @@ -91,7 +83,8 @@ */ function handleItem(event, item) { console.log('event', event, item) - item.cb(item) + event.content.cb(item) + proxy.$refs.swipeAction.closeAll() } /** @@ -128,8 +121,10 @@ {{item.bankName}} - 储蓄卡 + 借记卡 信用卡 + 预付卡 + 准贷记卡 {{item.cardNumber}} diff --git a/jiuyi2/pages/mine/setting/bankCardAdd.vue b/jiuyi2/pages/mine/setting/bankCardAdd.vue index 5f7e0058..92bc68bb 100644 --- a/jiuyi2/pages/mine/setting/bankCardAdd.vue +++ b/jiuyi2/pages/mine/setting/bankCardAdd.vue @@ -4,6 +4,7 @@ ref, reactive, computed, + getCurrentInstance, } from 'vue' import { useStore @@ -17,17 +18,95 @@ import api from '@/api/index.js' // 获取验证码 import getCode from '@/components/getCode/getCode' - + // + const { + proxy + } = getCurrentInstance() + // 银行搜索 + const bankSearch = ref('') // 银行卡列表 const bankList = reactive([]) + // 银行卡类型列表 + const bankTypeList = reactive([]) + // 银行卡类型下标 + const bankTypeIndex = ref('') // 表单对象 const form = reactive({ + bankName: '', + cardType: '', cardNumber: '', phoneNumber: '', userIdCard: '', userRealName: '', }) + onLoad(() => { + // 获取字典 + getBankList() + // 获取银行卡类型 + getBankTypes() + }) + + // 获取银行卡 + function getBankList() { + api.getDicFuzzy({ + path: ['bank_type'], + query: { + dictLabel: bankSearch.value, + } + }).then(rs => { + if (rs.code == 200) { + bankList.length = 0 + bankList.push(...rs.data) + return + } + util.alert({ + content: rs.msg, + showCancel: false, + }) + }) + } + + // 获取银行卡类型 + function getBankTypes() { + api.getDict({ + path: ['card_type'], + }).then(rs => { + if (rs.code == 200) { + bankTypeList.length = 0 + bankTypeList.push(...rs.data.map(item => { + // 转大写 + item.dictValue = item.dictValue.toUpperCase() + return item + })) + return + } + util.alert({ + content: rs.msg, + showCancel: false, + }) + }) + } + + /** + * 选择银行 + * @param {Object} item 银行列表项 + */ + function handleSelectBank(item) { + if (form.bankName === item.bankName) return + form.bankName = item.dictLabel + proxy.$refs.bankRef.close() + } + + /** + * @param {Object} event + */ + function handleBankTypeIndex(event) { + const index = event.detail.value + if (bankTypeIndex.value === index) return + bankTypeIndex.value = index + } + // 绑定 function handleSubmit() { const data = { @@ -35,6 +114,14 @@ } // + if (!data.bankName) { + util.alert('银行卡名称不能为空') + return + } + if (bankTypeIndex.value === '') { + util.alert('银行卡类型不能为空') + return + } if (!data.phoneNumber) { util.alert('手机号不能为空') return @@ -51,6 +138,8 @@ util.alert('真实姓名不能为空') return } + // + data.cardType = bankTypeList[bankTypeIndex.value].dictValue // api.mine.addBankCard({ @@ -77,43 +166,57 @@ - + 银行卡卡号 - + 姓名 - + 身份证号 - + 手机号(银行绑定的手机号) - + @@ -127,11 +230,44 @@ --> + + + 温馨提示 + + 为保证账户资金安全,请仔细核对好填写信息,在点击绑定 + + + 绑定 + + + + + 选择银行卡 + + + + + + + {{item.dictLabel}} + + + + + + + + + 搜索 + + + \ No newline at end of file diff --git a/jiuyi2/pages/news/chat/chat.vue b/jiuyi2/pages/news/chat/chat.vue index 33a67513..8f168652 100644 --- a/jiuyi2/pages/news/chat/chat.vue +++ b/jiuyi2/pages/news/chat/chat.vue @@ -1,460 +1,458 @@