From a3cad55dcffa4975ed1acc38ea5ced9f3a5aed50 Mon Sep 17 00:00:00 2001 From: linju-json Date: Sun, 25 Apr 2021 17:21:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=84=E4=BB=B6=E5=90=8D?= =?UTF-8?q?=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 2 +- baseapp.config.js | 6 +- common/appInit.js | 6 +- .../send-sms-code.vue} | 46 ++---- js_sdk/request.js | 17 --- manifest.json | 25 ++- pages.json | 27 ++-- pages/grid/grid.vue | 4 +- .../ucenter/edit/bind-mobile/bind-mobile.vue | 61 ++++---- pages/ucenter/edit/edit.vue | 4 +- .../login-page/phone-code/phone-code.vue | 142 +++++++++--------- .../login-page/pwd-retrieve/pwd-retrieve.vue | 120 +++++++-------- pages/ucenter/ucenter.vue | 11 +- .../cloudfunctions/user-center/index.js | 29 ++-- 14 files changed, 242 insertions(+), 258 deletions(-) rename components/{login-short-code/login-short-code.vue => send-sms-code/send-sms-code.vue} (71%) diff --git a/App.vue b/App.vue index baa7332..c03cf91 100644 --- a/App.vue +++ b/App.vue @@ -10,7 +10,7 @@ console.log('App Launch') initApp(); // #ifdef APP-PLUS - checkIsAgree(); + //checkIsAgree(); 暂时先用默认生成的,自定义的等待原生支持后实现。因为启动vue界面时已经,请求了部分权限这并不符合国家的法规 // #endif //#ifdef APP-NVUE || H5 diff --git a/baseapp.config.js b/baseapp.config.js index b642c10..706a274 100644 --- a/baseapp.config.js +++ b/baseapp.config.js @@ -34,6 +34,10 @@ module.exports = { "url": "https://ask.dcloud.net.cn/protocol.html" } ], - "download": "https://m3w.cn/uniapp" + "download": "https://m3w.cn/uniapp" + }, + "marketId":{//用于打开应用市场评分界面 + "ios":"id1417078253", + "android":"123456" } } diff --git a/common/appInit.js b/common/appInit.js index ef3362f..8da6967 100644 --- a/common/appInit.js +++ b/common/appInit.js @@ -5,7 +5,11 @@ import callCheckVersion from '@/uni_modules/uni-upgrade-center-app/utils/call-ch // #endif export default function() { // 初始化appVersion(仅app生效) - initAppVersion(); + initAppVersion(); + + // baseappConfig挂载到getApp(). + getApp({allowDefault: true}).config = baseappConfig; + //自定义路由拦截 const { diff --git a/components/login-short-code/login-short-code.vue b/components/send-sms-code/send-sms-code.vue similarity index 71% rename from components/login-short-code/login-short-code.vue rename to components/send-sms-code/send-sms-code.vue index c8a37bf..9c56d17 100644 --- a/components/login-short-code/login-short-code.vue +++ b/components/send-sms-code/send-sms-code.vue @@ -20,7 +20,7 @@ } } export default { - name: "login-short-code", + name: "send-sms-code", props: { /** * 倒计时时长 s @@ -35,6 +35,15 @@ phone: { type: [String, Number], default: '' + }, + /* + 验证码类型,用于防止不同功能的验证码混用,目前支持的类型login登录、register注册、bind绑定手机、unbind解绑手机 + */ + codeType:{ + type: String, + default(){ + return 'login' + } } }, data() { @@ -69,7 +78,7 @@ this.request('user-center/sendSmsCode', { "mobile": this.phone, - "type": "login" + "type": this.codeType },(data,result)=>{ console.log(data,result); uni.showToast({ @@ -79,37 +88,8 @@ this.reverseNumber = Number(this.count); this.getCode(); this.$emit('getCode'); - }) - - // uniCloud.callFunction({ - // "name": "user-center", - // "data": { - // "action": "sendSmsCode", - // "params": { - // "mobile": this.phone, - // "type": "login" - // } - // }, - // success: (e) => { - // uni.showToast({ - // title: "短信验证码发送成功", - // icon: 'none' - // }); - // this.reverseNumber = Number(this.count); - // this.getCode(); - // this.$emit('getCode'); - // }, - // fail: (err) => { - // console.log(err); - // uni.showToast({ - // title: '短信验证码发送失败', - // icon: 'none' - // }); - // }, - // complete: () => { - // uni.hideLoading() - // } - // }) + } + ) }, getCode() { if (this.reverseNumber == 0) { diff --git a/js_sdk/request.js b/js_sdk/request.js index 74fe3e6..ffadc8f 100644 --- a/js_sdk/request.js +++ b/js_sdk/request.js @@ -9,7 +9,6 @@ const debug = true;//开启后,会alert错误信息 export default function request(name,params,callback=false,{showLoading=false,loadText='',fail=()=>{}}={}){ // console.log('request'); showLoading||loadText? uni.showLoading({title:loadText}):''; - let routers = name.split('/'); var action = false if (routers.length>1){ @@ -23,28 +22,12 @@ export default function request(name,params,callback=false,{showLoading=false,lo console.log(e); const {result:{data,code}} = e console.log(data,code); - if (code != 0 ) { - if(debug){ - uni.showModal({ - content: JSON.stringify(e), - showCancel: false, - confirmText: '知道了' - }) - } - } resolve(e) return callback(data,e.result,e) }, fail(err){ reject(err) console.log(err); - if(debug){ - uni.showModal({ - content: JSON.stringify(err), - showCancel: false, - confirmText: '知道了' - }) - } fail(err) }, complete() { diff --git a/manifest.json b/manifest.json index 01f0f87..cab672e 100644 --- a/manifest.json +++ b/manifest.json @@ -7,6 +7,15 @@ "transformPx" : false, /* 5+App特有相关 */ "app-plus" : { + "privacy" : { + "prompt" : "template", + "template" : { + "title" : "服务协议和隐私政策", + "message" : "  请你务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。
  你可阅读《服务协议》《隐私政策》了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。", + "buttonAccept" : "我知道了", + "buttonRefuse" : "暂不同意" + } + }, "compatible" : { "ignoreVersion" : true //true表示忽略版本检查提示框,HBuilderX1.9.0及以上版本支持 }, @@ -31,14 +40,14 @@ "distribute" : { /* android打包配置 */ "android" : { - "permissionExternalStorage" : { - "request" : "none", - "prompt" : "应用保存运行状态等信息,需要获取读写手机存储(系统提示为访问设备上的照片、媒体内容和文件)权限,请允许。" - }, - "permissionPhoneState" : { - "request" : "none", - "prompt" : "为保证您正常、安全地使用,需要获取设备识别码(部分手机提示为获取手机号码)使用权限,请允许。" - }, + // "permissionExternalStorage" : { + // "request" : "none", + // "prompt" : "应用保存运行状态等信息,需要获取读写手机存储(系统提示为访问设备上的照片、媒体内容和文件)权限,请允许。" + // }, + // "permissionPhoneState" : { + // "request" : "none", + // "prompt" : "为保证您正常、安全地使用,需要获取设备识别码(部分手机提示为获取手机号码)使用权限,请允许。" + // }, "permissions" : [ "", "", diff --git a/pages.json b/pages.json index f93fd4b..f4098a8 100644 --- a/pages.json +++ b/pages.json @@ -61,16 +61,16 @@ } }, { "path": "pages/ucenter/edit/bind-mobile/bind-mobile", + "style": { + "navigationBarTitleText": "绑定手机号码" + } + }, + { + "path": "pages/ucenter/ucenter", "style": { "navigationStyle": "custom" } - }, - { - "path": "pages/ucenter/ucenter", - "style": { - "navigationStyle": "custom" - } - },{ + }, { "path": "uni_modules/uni-feedback/pages/opendb-feedback/list", "style": { "navigationBarTitleText": "常见问题" @@ -90,8 +90,7 @@ "style": { "navigationBarTitleText": "关于" // #ifdef APP-PLUS - , - "app-plus": { + ,"app-plus": { "titleNView": { "buttons": [{ "type": "share" @@ -138,7 +137,9 @@ "path": "uni_modules/uni-agree/pages/uni-agree/uni-agree", "style": { "navigationStyle": "custom", - "app-plus":{"popGesture": "none"} + "app-plus": { + "popGesture": "none" + } } }, { "path": "pages/ucenter/settings/settings", @@ -195,8 +196,8 @@ }, { - "path":"uni_modules/uni-news-favorite/pages/uni-news-favorite/list", - "style":{ + "path": "uni_modules/uni-news-favorite/pages/uni-news-favorite/list", + "style": { "navigationBarTitleText": "阅读记录", "enablePullDownRefresh": false } @@ -246,4 +247,4 @@ "text": "我的" }] } -} +} diff --git a/pages/grid/grid.vue b/pages/grid/grid.vue index 99a925f..8e59303 100644 --- a/pages/grid/grid.vue +++ b/pages/grid/grid.vue @@ -9,7 +9,7 @@ disabled /> - @@ -88,8 +88,6 @@ text: 'Grid 9' } ], - - collection: 'opendb-banner', // 查询字段,多个字段用 , 分割 field: '_id,bannerfile,open_url,title', where: 'category_id==grid', diff --git a/pages/ucenter/edit/bind-mobile/bind-mobile.vue b/pages/ucenter/edit/bind-mobile/bind-mobile.vue index 4faf727..0cc472a 100644 --- a/pages/ucenter/edit/bind-mobile/bind-mobile.vue +++ b/pages/ucenter/edit/bind-mobile/bind-mobile.vue @@ -1,21 +1,21 @@ - - + diff --git a/pages/ucenter/login-page/pwd-retrieve/pwd-retrieve.vue b/pages/ucenter/login-page/pwd-retrieve/pwd-retrieve.vue index 168a0af..88dade8 100644 --- a/pages/ucenter/login-page/pwd-retrieve/pwd-retrieve.vue +++ b/pages/ucenter/login-page/pwd-retrieve/pwd-retrieve.vue @@ -3,46 +3,46 @@ - 重置密码 + 重置密码 - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - + diff --git a/pages/ucenter/ucenter.vue b/pages/ucenter/ucenter.vue index f15a88d..d73d51a 100644 --- a/pages/ucenter/ucenter.vue +++ b/pages/ucenter/ucenter.vue @@ -111,7 +111,10 @@ appVersion() { return getApp().appVersion } - // #endif + // #endif + ,appConfig(){ + return getApp().config + } }, methods: { ...mapMutations({ @@ -156,15 +159,15 @@ * 去应用市场评分 */ gotoMarket() { - // #ifdef APP-PLUS + // #ifdef APP-PLUS if (uni.getSystemInfoSync().platform == "ios") { // 这里填写appstore应用id - let appstoreid = 'id1417078253'; + let appstoreid = this.appConfig.marketId.ios;// 'id1417078253'; plus.runtime.openURL("itms-apps://" + 'itunes.apple.com/cn/app/wechat/' + appstoreid + '?mt=8'); } if (uni.getSystemInfoSync().platform == "android") { var Uri = plus.android.importClass("android.net.Uri"); - var uri = Uri.parse("market://details?id=" + plus.runtime.appid); + var uri = Uri.parse("market://details?id=" + this.appConfig.marketId.android); var Intent = plus.android.importClass('android.content.Intent'); var intent = new Intent(Intent.ACTION_VIEW, uri); var main = plus.android.runtimeMainActivity(); diff --git a/uniCloud-aliyun/cloudfunctions/user-center/index.js b/uniCloud-aliyun/cloudfunctions/user-center/index.js index f07c82c..6c7f986 100644 --- a/uniCloud-aliyun/cloudfunctions/user-center/index.js +++ b/uniCloud-aliyun/cloudfunctions/user-center/index.js @@ -124,19 +124,20 @@ exports.main = async (event, context) => { mobile: params.mobile, code: params.code }); - let verifyCode = await uniID.verifyCode({ - mobile: params.mobile, - code: params.code + // let verifyCode = await uniID.verifyCode({ + // mobile: params.mobile, + // code: params.code + // }) + // if (verifyCode.code === 0) { + // } else { + // res = verifyCode + // } + res = await uniID.bindMobile({ + uid: params.uid, + mobile: params.mobile, + code: params.code }) - if (verifyCode.code === 0) { - res = await uniID.bindMobile({ - uid: params.uid, - mobile: params.mobile - }) - } else { - res = verifyCode - } - console.log(res, verifyCode); + console.log(res); break; case 'register': let { @@ -210,10 +211,10 @@ exports.main = async (event, context) => { break; case 'sendSmsCode': - //123546 return uniID.setVerifyCode({ mobile: params.mobile, - code:'123456' + code:'123456', + type: params.type }) -- GitLab