...
 
Commits (25)
    https://gitcode.net/sunhao1232856/uni-starter/-/commit/394628f23dad014b18e70f249d043df95dcb4827 feat: init project 2021-11-11T15:50:14+08:00 王亚琪 wangyaqi988@163.com https://gitcode.net/sunhao1232856/uni-starter/-/commit/cae0e903eba3cb0eb88d848a86869a1e94fa22da 删除中可选链操作符,解决vue3版本在hbuilderX内置浏览器不兼容的问题 2021-11-11T16:08:47+08:00 linju-json linju@dcloud.io https://gitcode.net/sunhao1232856/uni-starter/-/commit/044aca3c191478b245df5021c69983cac62fe403 重新整理后第1次提交 2021-11-11T16:24:16+08:00 linju-json linju@dcloud.io https://gitcode.net/sunhao1232856/uni-starter/-/commit/e9dce09ff93d0506b0a37fcc47675309e44611e4 Merge branch 'master' of https://codechina.csdn.net/dcloud/uni-starter 2021-11-11T16:24:35+08:00 linju-json linju@dcloud.io https://gitcode.net/sunhao1232856/uni-starter/-/commit/f547a4ed5225cac7358d8f12f32bafa587fc6765 - 使用优化一键登陆中,点击第三方登陆的逻辑:未勾选隐私政策时,toast提醒并阻止了一键登陆界面的close - 新增支持看激励视频广告签到 2021-11-20T20:48:42+08:00 linju-json linju@dcloud.io https://gitcode.net/sunhao1232856/uni-starter/-/commit/4c3fa175a98cf6169742e978c59e49d9bfa94671 - 使用优化一键登陆中,点击第三方登陆的逻辑:未勾选隐私政策时,toast提醒并阻止了一键登陆界面的close - 新增支持看激励视频广告签到 2021-11-20T20:50:17+08:00 linju-json linju@dcloud.io https://gitcode.net/sunhao1232856/uni-starter/-/commit/9618eeb3df896157a54aeafc93989c97d40e3d1f - 使用优化一键登陆中,点击第三方登陆的逻辑:未勾选隐私政策时,toast提醒并阻止了一键登陆界面的close - 新增支持看激励视频广告签到 2021-11-22T14:17:35+08:00 linju-json linju@dcloud.io https://gitcode.net/sunhao1232856/uni-starter/-/commit/3460a42344e86563bcd103a1e99204478d66129e - 使用优化一键登陆中,点击第三方登陆的逻辑:未勾选隐私政策时,toast提醒并阻止了一键登陆界面的close - 新增支持看激励视频广告签到 2021-11-27T17:27:36+08:00 linju-json linju@dcloud.io https://gitcode.net/sunhao1232856/uni-starter/-/commit/40b623e932978337216470b46b275d9e4c10583b - 新增注销用户账号的功能 - 修复在某些情况下,签到不连续7天,也获得60积分的问题 2021-11-29T17:12:47+08:00 linju-json linju@dcloud.io https://gitcode.net/sunhao1232856/uni-starter/-/commit/ac0db4599e70d34b2999b50badd2083d63c335d1 - 新增注销用户账号的功能 - 修复在某些情况下,签到不连续7天,也获得60积分的问题 2021-11-29T20:15:34+08:00 linju-json linju@dcloud.io https://gitcode.net/sunhao1232856/uni-starter/-/commit/90d9cb59e1784ac1816deee2d629cee39edc15c9 - 新增注销用户账号的功能 - 修复在某些情况下,签到不连续7天,也获得60积分的问题 2021-11-29T20:16:19+08:00 linju-json linju@dcloud.io https://gitcode.net/sunhao1232856/uni-starter/-/commit/a1968625f07b807ad013963e4c6bc5ceef8818e2 修复H5端在about页面,返回触发引发报错 2021-12-09T21:00:40+08:00 linju-json linju@dcloud.io https://gitcode.net/sunhao1232856/uni-starter/-/commit/e3b191a103285ae053814e4e9a8cdb26e0072624 修复H5端在about页面,返回触发引发报错 2021-12-09T21:05:34+08:00 linju-json linju@dcloud.io https://gitcode.net/sunhao1232856/uni-starter/-/commit/68755989311e8a25275f75e716665f8261517112 修复H5端在about页面,返回触发引发报错 2021-12-16T18:27:01+08:00 linju-json linju@dcloud.io https://gitcode.net/sunhao1232856/uni-starter/-/commit/ff1a1e5e01a4711dcba03bdb06a3e13b3c5c8895 -... 2021-12-29T17:50:47+08:00 linju-json linju@dcloud.io - 性能优化,list页面使用,[详情](<a href="https://uniapp.dcloud.io/uniCloud/unicloud-db?id=collection" rel="nofollow noreferrer noopener" target="_blank">https://uniapp.dcloud.io/uniCloud/unicloud-db?id=collection</a>) - 拉齐uni-starter和uni-admin的schema新增:uni-id-tag.schema.json,更新:opendb-verify-codes.schema.json - 修复首次登陆,用户id没存储到storage的问题 - 新增:执行退出登陆后,通过云函数调用 https://gitcode.net/sunhao1232856/uni-starter/-/commit/d31f1067359dc2252e4f0e76ef2dea597a450922 -... 2022-01-08T18:39:40+08:00 linju-json linju@dcloud.io - 性能优化,list页面使用,[详情](<a href="https://uniapp.dcloud.io/uniCloud/unicloud-db?id=collection" rel="nofollow noreferrer noopener" target="_blank">https://uniapp.dcloud.io/uniCloud/unicloud-db?id=collection</a>) - 拉齐uni-starter和uni-admin的schema新增:uni-id-tag.schema.json,更新:opendb-verify-codes.schema.json - 修复首次登陆,用户id没存储到storage的问题 - 新增:执行退出登陆后,通过云函数调用 https://gitcode.net/sunhao1232856/uni-starter/-/commit/15efd2733716502929abfa79e92d4ce9952f00c3 更新uni-id-cf为:1.0.10版,修复 限制只有 admin 用户可管理用户标签(不支持非 admin 用户操作managerMultiTag 接口) 2022-01-11T16:30:35+08:00 linju-json linju@dcloud.io https://gitcode.net/sunhao1232856/uni-starter/-/commit/c26635f7ff339f20996380d6718ccfefd16a64d0 删除list页第37行多了个引起的报错 2022-01-12T14:42:46+08:00 linju-json linju@dcloud.io https://gitcode.net/sunhao1232856/uni-starter/-/commit/e26e86acf88412890fad9178cde29da473412dc4 - 保存到改用异步方法,方便通过拦截器执行更新后的操作 - 新增通过拦截器监听更新,调用云函数刷新刷新设备信息token有效期的API - 删除留言板示... 2022-01-25T11:21:20+08:00 linju-json linju@dcloud.io https://gitcode.net/sunhao1232856/uni-starter/-/commit/f66473602f54311d6be62c715c1dd53b8d16e521 - 保存到改用异步方法,方便通过拦截器执行更新后的操作 - 新增通过拦截器监听更新,调用云函数刷新刷新设备信息token有效期的API - 删除留言板示... 2022-01-25T11:34:04+08:00 linju-json linju@dcloud.io https://gitcode.net/sunhao1232856/uni-starter/-/commit/bc3dcf0626514970bd2b59fd0087728b4905e4fe - 新增逻辑:调用uni-id-cf的logout接口后刷新设备信息中token的有效期 -... 2022-01-26T15:57:57+08:00 linju-json linju@dcloud.io - 新增逻辑:调用uni-id-cf的logout接口后刷新设备信息中token的有效期 - 修复某些情况下前端执行logout没调用uniID.logout的问题 - 修复某些情况下报push_clientid未定义的问题 https://gitcode.net/sunhao1232856/uni-starter/-/commit/6f6e3846cb00044977d2024e4b15b1b95b71120d - 新增逻辑:调用uni-id-cf的logout接口后刷新设备信息中token的有效期 -... 2022-02-16T14:16:02+08:00 linju-json linju@dcloud.io - 新增逻辑:调用uni-id-cf的logout接口后刷新设备信息中token的有效期 - 修复某些情况下前端执行logout没调用uniID.logout的问题 - 修复某些情况下报push_clientid未定义的问题 https://gitcode.net/sunhao1232856/uni-starter/-/commit/480d8e066f74c78a86ac752dc2982a2345be8fcf 修复微信小程序端,修改绑定的手机号码时表单验证不正常的问题 2022-02-16T14:20:53+08:00 linju-json linju@dcloud.io https://gitcode.net/sunhao1232856/uni-starter/-/commit/c589bfe63198b23437331992a405f830ca2fa43c - 删除多余文件: - 修复当用户选择验证码登陆方式,在输入验证码页面,点击微信登陆时报“你未同意隐私政策协议”的问题 2022-02-24T14:28:01+08:00 linju-json linju@dcloud.io https://gitcode.net/sunhao1232856/uni-starter/-/commit/f022c5f7b4c42dfac235e10d4f389f77b79bd689 Merge remote-tracking branch 'upstream/master' into CuanGeJu 2022-04-30T07:08:34+08:00 SUNHAO-NOTEBOOK\sunhao sunhao1232856@sina.com # Conflicts: # App.vue # README.md # changelog.md # common/appInit.js # common/openApp.js # components/uni-agreements/uni-agreements.vue # components/uni-load-state/uni-load-state.vue # components/uni-quick-login/uni-quick-login.vue # components/uni-send-sms-code/uni-send-sms-code.vue # main.js # manifest.json # package.json # pages.json # pages/common/webview/webview.vue # pages/grid/grid.vue # pages/list/detail.vue # pages/list/search/search.nvue # pages/ucenter/about/about.vue # pages/ucenter/invite/invite.vue # pages/ucenter/login-page/common/login-page.mixin.js # pages/ucenter/login-page/index/index.vue # pages/ucenter/login-page/phone-code/phone-code.vue # pages/ucenter/login-page/pwd-login/pwd-login.vue # pages/ucenter/login-page/pwd-retrieve/pwd-retrieve.vue # pages/ucenter/login-page/register/register.vue # pages/ucenter/read-news-log/read-news-log.vue # pages/ucenter/settings/settings.vue # pages/ucenter/ucenter.vue # pages/ucenter/userinfo/bind-mobile/bind-mobile.vue # pages/ucenter/userinfo/userinfo.vue # static/h5/download-app/android.png # static/h5/download-app/ios.png # static/h5/download-app/openImg.png # store/modules/user.js # uni-starter.config.js # uniCloud-aliyun/database/JQL数据库管理.jql # uniCloud-aliyun/database/db_init.json # uniCloud-aliyun/database/opendb-news-articles.schema.json # uniCloud-aliyun/database/opendb-news-comments.schema.json # uniCloud-aliyun/database/opendb-news-favorite.schema.json # uniCloud-aliyun/database/opendb-verify-codes.schema.json # uniCloud-aliyun/database/read-news-log.schema.json # uniCloud-aliyun/database/uni-id-scores.schema.json # uniCloud-aliyun/database/uni-id-users.schema.json # uni_modules/uni-badge/changelog.md # uni_modules/uni-badge/components/uni-badge/uni-badge.vue # uni_modules/uni-badge/package.json # uni_modules/uni-badge/readme.md # uni_modules/uni-calendar/changelog.md # uni_modules/uni-calendar/components/uni-calendar/uni-calendar-item.vue # uni_modules/uni-calendar/components/uni-calendar/uni-calendar.vue # uni_modules/uni-calendar/components/uni-calendar/util.js # uni_modules/uni-calendar/package.json # uni_modules/uni-captcha/uniCloud/cloudfunctions/common/uni-captcha/index.js # uni_modules/uni-captcha/uniCloud/cloudfunctions/common/uni-captcha/package.json # uni_modules/uni-card/changelog.md # uni_modules/uni-card/components/uni-card/uni-card.vue # uni_modules/uni-card/package.json # uni_modules/uni-card/readme.md # uni_modules/uni-collapse/changelog.md # uni_modules/uni-collapse/components/uni-collapse-item/uni-collapse-item.vue # uni_modules/uni-collapse/components/uni-collapse/uni-collapse.vue # uni_modules/uni-collapse/package.json # uni_modules/uni-collapse/readme.md # uni_modules/uni-combox/changelog.md # uni_modules/uni-combox/components/uni-combox/uni-combox.vue # uni_modules/uni-combox/package.json # uni_modules/uni-combox/readme.md # uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/package.json # uni_modules/uni-countdown/changelog.md # uni_modules/uni-countdown/components/uni-countdown/uni-countdown.vue # uni_modules/uni-countdown/package.json # uni_modules/uni-countdown/readme.md # uni_modules/uni-data-checkbox/changelog.md # uni_modules/uni-data-checkbox/components/uni-data-checkbox/uni-data-checkbox.vue # uni_modules/uni-data-checkbox/package.json # uni_modules/uni-data-checkbox/readme.md # uni_modules/uni-data-picker/changelog.md # uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue # uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-picker.js # uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.vue # uni_modules/uni-data-picker/package.json # uni_modules/uni-data-picker/readme.md # uni_modules/uni-dateformat/changelog.md # uni_modules/uni-dateformat/components/uni-dateformat/uni-dateformat.vue # uni_modules/uni-dateformat/package.json # uni_modules/uni-dateformat/readme.md # uni_modules/uni-datetime-picker/changelog.md # uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue # uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.vue # uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue # uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue # uni_modules/uni-datetime-picker/components/uni-datetime-picker/util.js # uni_modules/uni-datetime-picker/package.json # uni_modules/uni-datetime-picker/readme.md # uni_modules/uni-drawer/changelog.md # uni_modules/uni-drawer/components/uni-drawer/uni-drawer.vue # uni_modules/uni-drawer/package.json # uni_modules/uni-drawer/readme.md # uni_modules/uni-easyinput/changelog.md # uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue # uni_modules/uni-easyinput/package.json # uni_modules/uni-easyinput/readme.md # uni_modules/uni-fab/changelog.md # uni_modules/uni-fab/components/uni-fab/uni-fab.vue # uni_modules/uni-fab/package.json # uni_modules/uni-fab/readme.md # uni_modules/uni-fav/changelog.md # uni_modules/uni-fav/components/uni-fav/uni-fav.vue # uni_modules/uni-fav/package.json # uni_modules/uni-fav/readme.md # uni_modules/uni-feedback/changelog.md # uni_modules/uni-feedback/package.json # uni_modules/uni-feedback/uniCloud/database/opendb-feedback.schema.json # uni_modules/uni-file-picker/changelog.md # uni_modules/uni-file-picker/components/uni-file-picker/uni-file-picker.vue # uni_modules/uni-file-picker/components/uni-file-picker/upload-image.vue # uni_modules/uni-file-picker/package.json # uni_modules/uni-file-picker/readme.md # uni_modules/uni-forms/changelog.md # uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.vue # uni_modules/uni-forms/components/uni-forms/uni-forms.vue # uni_modules/uni-forms/package.json # uni_modules/uni-forms/readme.md # uni_modules/uni-goods-nav/changelog.md # uni_modules/uni-goods-nav/components/uni-goods-nav/uni-goods-nav.vue # uni_modules/uni-goods-nav/package.json # uni_modules/uni-goods-nav/readme.md # uni_modules/uni-grid/changelog.md # uni_modules/uni-grid/components/uni-grid-item/uni-grid-item.vue # uni_modules/uni-grid/components/uni-grid/uni-grid.vue # uni_modules/uni-grid/package.json # uni_modules/uni-grid/readme.md # uni_modules/uni-group/changelog.md # uni_modules/uni-group/components/uni-group/uni-group.vue # uni_modules/uni-group/package.json # uni_modules/uni-group/readme.md # uni_modules/uni-icons/changelog.md # uni_modules/uni-icons/components/uni-icons/icons.js # uni_modules/uni-icons/components/uni-icons/uni-icons.vue # uni_modules/uni-icons/package.json # uni_modules/uni-icons/readme.md # uni_modules/uni-id-cf/changelog.md # uni_modules/uni-id-cf/package.json # uni_modules/uni-id-cf/uniCloud/cloudfunctions/uni-id-cf/index.js # uni_modules/uni-id/changelog.md # uni_modules/uni-id/package.json # uni_modules/uni-id/uniCloud/cloudfunctions/common/uni-id/index.js # uni_modules/uni-id/uniCloud/cloudfunctions/common/uni-id/package.json # uni_modules/uni-indexed-list/changelog.md # uni_modules/uni-indexed-list/components/uni-indexed-list/uni-indexed-list-item.vue # uni_modules/uni-indexed-list/components/uni-indexed-list/uni-indexed-list.vue # uni_modules/uni-indexed-list/package.json # uni_modules/uni-indexed-list/readme.md # uni_modules/uni-link/changelog.md # uni_modules/uni-link/components/uni-link/uni-link.vue # uni_modules/uni-link/package.json # uni_modules/uni-link/readme.md # uni_modules/uni-list/changelog.md # uni_modules/uni-list/components/uni-list-chat/uni-list-chat.vue # uni_modules/uni-list/components/uni-list-item/uni-list-item.vue # uni_modules/uni-list/components/uni-list/uni-list.vue # uni_modules/uni-list/package.json # uni_modules/uni-list/readme.md # uni_modules/uni-load-more/changelog.md # uni_modules/uni-load-more/components/uni-load-more/uni-load-more.vue # uni_modules/uni-load-more/package.json # uni_modules/uni-load-more/readme.md # uni_modules/uni-nav-bar/changelog.md # uni_modules/uni-nav-bar/components/uni-nav-bar/uni-nav-bar.vue # uni_modules/uni-nav-bar/components/uni-nav-bar/uni-status-bar.vue # uni_modules/uni-nav-bar/package.json # uni_modules/uni-nav-bar/readme.md # uni_modules/uni-notice-bar/changelog.md # uni_modules/uni-notice-bar/components/uni-notice-bar/uni-notice-bar.vue # uni_modules/uni-notice-bar/package.json # uni_modules/uni-notice-bar/readme.md # uni_modules/uni-number-box/changelog.md # uni_modules/uni-number-box/components/uni-number-box/uni-number-box.vue # uni_modules/uni-number-box/package.json # uni_modules/uni-number-box/readme.md # uni_modules/uni-pagination/changelog.md # uni_modules/uni-pagination/components/uni-pagination/uni-pagination.vue # uni_modules/uni-pagination/package.json # uni_modules/uni-pagination/readme.md # uni_modules/uni-popup/changelog.md # uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue # uni_modules/uni-popup/components/uni-popup-message/uni-popup-message.vue # uni_modules/uni-popup/components/uni-popup-share/uni-popup-share.vue # uni_modules/uni-popup/components/uni-popup/uni-popup.vue # uni_modules/uni-popup/package.json # uni_modules/uni-popup/readme.md # uni_modules/uni-rate/changelog.md # uni_modules/uni-rate/components/uni-rate/uni-rate.vue # uni_modules/uni-rate/package.json # uni_modules/uni-rate/readme.md # uni_modules/uni-row/changelog.md # uni_modules/uni-row/package.json # uni_modules/uni-row/readme.md # uni_modules/uni-search-bar/changelog.md # uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.vue # uni_modules/uni-search-bar/package.json # uni_modules/uni-search-bar/readme.md # uni_modules/uni-segmented-control/changelog.md # uni_modules/uni-segmented-control/components/uni-segmented-control/uni-segmented-control.vue # uni_modules/uni-segmented-control/package.json # uni_modules/uni-segmented-control/readme.md # uni_modules/uni-share/changelog.md # uni_modules/uni-share/js_sdk/uni-image-menu.js # uni_modules/uni-share/js_sdk/uni-share.js # uni_modules/uni-share/package.json # uni_modules/uni-share/readme.md # uni_modules/uni-sign-in/changelog.md # uni_modules/uni-sign-in/components/uni-sign-in/uni-sign-in.vue # uni_modules/uni-sign-in/package.json # uni_modules/uni-sign-in/pages/demo/demo.vue # uni_modules/uni-sign-in/readme.md # uni_modules/uni-sign-in/uniCloud/cloudfunctions/uni-clientDB-actions/signIn.js # uni_modules/uni-sign-in/uniCloud/database/opendb-sign-in.schema.json # uni_modules/uni-steps/changelog.md # uni_modules/uni-steps/components/uni-steps/uni-steps.vue # uni_modules/uni-steps/package.json # uni_modules/uni-steps/readme.md # uni_modules/uni-swipe-action/changelog.md # uni_modules/uni-swipe-action/components/uni-swipe-action-item/bindingx.js # uni_modules/uni-swipe-action/components/uni-swipe-action-item/mpalipay.js # uni_modules/uni-swipe-action/components/uni-swipe-action-item/mpother.js # uni_modules/uni-swipe-action/components/uni-swipe-action-item/mpwxs.js # uni_modules/uni-swipe-action/components/uni-swipe-action-item/uni-swipe-action-item.vue # uni_modules/uni-swipe-action/components/uni-swipe-action/uni-swipe-action.vue # uni_modules/uni-swipe-action/package.json # uni_modules/uni-swipe-action/readme.md # uni_modules/uni-swiper-dot/changelog.md # uni_modules/uni-swiper-dot/components/uni-swiper-dot/uni-swiper-dot.vue # uni_modules/uni-swiper-dot/package.json # uni_modules/uni-swiper-dot/readme.md # uni_modules/uni-table/changelog.md # uni_modules/uni-table/components/uni-tr/uni-tr.vue # uni_modules/uni-table/package.json # uni_modules/uni-table/readme.md # uni_modules/uni-tag/changelog.md # uni_modules/uni-tag/components/uni-tag/uni-tag.vue # uni_modules/uni-tag/package.json # uni_modules/uni-tag/readme.md # uni_modules/uni-title/changelog.md # uni_modules/uni-title/package.json # uni_modules/uni-title/readme.md # uni_modules/uni-transition/changelog.md # uni_modules/uni-transition/components/uni-transition/uni-transition.vue # uni_modules/uni-transition/package.json # uni_modules/uni-transition/readme.md # uni_modules/uni-ui/changelog.md # uni_modules/uni-ui/components/uni-ui/uni-ui.vue # uni_modules/uni-ui/package.json # uni_modules/uni-ui/readme.md # uni_modules/uni-upgrade-center-app/changelog.md # uni_modules/uni-upgrade-center-app/package.json # uni_modules/uni-upgrade-center-app/pages/upgrade-popup.vue # uni_modules/uni-upgrade-center-app/readme.md # uni_modules/uni-upgrade-center-app/uniCloud/cloudfunctions/check-version/check-version.param.json # uni_modules/uni-upgrade-center-app/uniCloud/cloudfunctions/check-version/index.js # uni_modules/uni-upgrade-center-app/utils/call-check-version.js # uni_modules/uni-upgrade-center-app/utils/check-update.js
<script> <script>
import initApp from '@/common/appInit.js'; import initApp from '@/common/appInit.js';
import openApp from '@/common/openApp.js';
import checkIsAgree from '@/pages/uni-agree/utils/uni-agree.js'; import checkIsAgree from '@/pages/uni-agree/utils/uni-agree.js';
export default { export default {
globalData: { globalData: {
searchText: '', searchText: '',
appVersion: {}, appVersion: {},
config: {} config: {},
$i18n: {},
$t: {}
}, },
onLaunch: function() { onLaunch: function() {
console.log('App Launch') console.log('App Launch')
initApp(); this.globalData.$i18n = this.$i18n
this.globalData.$t = str => this.$t(str)
initApp();
// #ifdef H5
openApp() //创建在h5端全局悬浮引导用户下载app的功能
// #endif
// #ifdef APP-PLUS // #ifdef APP-PLUS
//checkIsAgree(); APP端暂时先用原生默认生成的。目前,自定义方式启动vue界面时,原生层已经请求了部分权限这并不符合国家的法规 //checkIsAgree(); APP端暂时先用原生默认生成的。目前,自定义方式启动vue界面时,原生层已经请求了部分权限这并不符合国家的法规
// #endif // #endif
// #ifdef H5 // #ifdef H5
// checkIsAgree(); // 默认不开启。目前全球,仅欧盟国家有网页端同意隐私权限的需要。如果需要 // checkIsAgree(); // 默认不开启。目前全球,仅欧盟国家有网页端同意隐私权限的需要。如果需要可以自己去掉注视后生效
// #endif // #endif
// #ifdef APP-PLUS // #ifdef APP-PLUS
...@@ -31,7 +41,7 @@ ...@@ -31,7 +41,7 @@
} }
}); });
}*/ }*/
// #endif // #endif
}, },
onShow: function() { onShow: function() {
console.log('App Show') console.log('App Show')
......
此差异已折叠。
{
"prompt" : "template"
}
## 1.1.32(2022-02-24)
- 删除多余文件:`uniCloud/database/opendb-news-articles-detail.schema.json`
- 修复当用户选择验证码登陆方式,在输入验证码页面,点击微信登陆时报“你未同意隐私政策协议”的问题
## 1.1.31(2022-02-16)
修复微信小程序端,修改绑定的手机号码时表单验证不正常的问题
## 1.1.30(2022-01-26)
- 新增逻辑:调用uni-id-cf的logout接口后刷新设备信息中token的有效期
- 修复某些情况下前端执行logout没调用uniID.logout的问题
- 修复某些情况下报push_clientid未定义的问题
## 1.1.29(2022-01-25)
- 保存`uni_id_token``storage`改用异步方法,方便通过拦截器执行`token`更新后的操作
- 新增通过拦截器监听`uni_id_token`更新,调用云函数刷新刷新设备信息token有效期的API `renewDeviceTokenExpired`
- 删除留言板示例
- 修复图片验证码样式问题
## 1.1.28(2022-01-12)
删除list页第37行多了个`?`引起的报错
## 1.1.27(2022-01-11)
更新uni-id-cf为:1.0.10版,修复 限制只有 admin 用户可管理用户标签(不支持非 admin 用户操作managerMultiTag 接口)
## 1.1.26(2021-12-29)
- 性能优化,list页面使用`getTemp`[详情](https://uniapp.dcloud.io/uniCloud/unicloud-db?id=collection)
- 拉齐uni-starter和uni-admin的schema新增:uni-id-tag.schema.json,更新:opendb-verify-codes.schema.json
- 修复首次登陆,用户id没存储到storage的问题
- 新增:执行退出登陆后,通过云函数调用`uniID.logout`
## 1.1.25(2021-12-09)
修复H5端在about页面,返回触发`uniShare.hide()`引发报错
## 1.1.24(2021-11-29)
- 新增注销用户账号的功能
- 修复在某些情况下,签到不连续7天,也获得60积分的问题
## 1.1.23(2021-11-20)
- 使用`uni.getUniverifyManager`优化一键登陆中,点击第三方登陆的逻辑:未勾选隐私政策时,toast提醒并阻止了一键登陆界面的close
- 新增支持看激励视频广告签到
## 1.1.22(2021-11-10)
删除`common/openApp.js`中可选链操作符,解决vue3版本在hbuilderX内置浏览器不兼容的问题
## 1.1.21(2021-11-10)
新增app端列表页面使用原生list下拉刷新
## 1.1.20(2021-11-08)
修复vue3版某些情况下i18n报错的问题
## 1.1.19(2021-11-08)
配置文件`uni-starter.config.js`默认关闭i18n多语言国际化
## 1.1.18(2021-10-14)
使用2.0版`uni-share`。当显示分享窗口时,监听返回操作(如:物理返回,全面屏手机侧滑)关闭分享窗口,而不是关闭当前页面。
## 1.1.17(2021-10-12)
- 更新文档
- 修复list页面where条件中缺少&符,导致的错误
## 1.1.16(2021-10-05)
在控制台提示:开启多语言国际化,将获取i18n中配置的tabbar的值覆盖pages.json中配置的tabbar的值
## 1.1.15(2021-10-02)
新增,支持配置是否开启i18n多语言国际化。
配置文件:`uni-starter.config.js`
`
"i18n":{
"enable":true //默认启用,国际化。如果你不想使用国际化相关功能,请改为false
}
`
## 1.1.14(2021-09-30)
1. 通过微信小程序登录自动保存`sessionKey``uni-id-users`
2. 我的-设置-个人资料 点击绑定手机号码,完善账号信息支持以下三种策略:
- APP端,(如果支持)使用"通过运营商一键获取手机号码"
- 微信小程序端,支持"一键获取微信绑定的手机号"
- 其他端,通过手机验证码
## 1.1.13(2021-09-29)
修复search页面因多语言国际化导致的白屏问题
## 1.1.12(2021-09-28)
1. 改造微信登录逻辑,直接使用`uni.login`参数`"onlyAuthorize":true`实现
2. 修复,一键登录弹出层,已勾选“同意隐私政策协议”点击自定义登录按钮,报“你未同意隐私政策协议”的bug
## 1.1.11(2021-09-24)
优化邀请下载app页(`pages/ucenter/invite`)下载按钮闪烁的问题
## 1.1.10(2021-09-23)
修复获取验证码按钮的文字,在中文模式下显示为英文的问题
## 1.1.9(2021-09-16)
修复由多语言切换功能引起的隐私政策协议标题链接被重写的问题
## 1.1.8(2021-09-15)
更新数据表guestbook的schema中更新权限的配置
## 1.1.7(2021-09-14)
更新数据表opendb-news-articles的schema中的权限配置
## 1.1.6(2021-09-13)
纠正错误schema权限表达式`doc.uid``doc.user_id`
## 1.1.5(2021-09-01)
为了更直观理解路由拦截。移除路由拦截器中,默认过滤登录相关页面拦截的逻辑。确保所有白名单页面均在配置文件router.visitor中体现
## 1.1.4(2021-08-31)
修改错误的文章表`SChema`的读权限表达式
## 1.1.3(2021-08-31)
修复在微信小程序端默认语言为英文的问题
## 1.1.2(2021-08-30)
修复在微信小程序下切换语言报`locale`不存在的问题
## 1.1.1(2021-08-30)
- 解决3.2.6以下版本hbuilderx,编译的项目报`uni.setLocale`不存在的问题
## 1.1.0(2021-08-27)
- APP端支持vue3 (hbuilderx 3.2.5+)
- 支持国际化 中英文切换
- 新增留言板示例
- 修复签到的时区问题
## 1.0.48(2021-08-10) ## 1.0.48(2021-08-10)
- 修复登成功后响应体包含`userInfo.password`的问题 - 修复登成功后响应体包含`userInfo.password`的问题
- 修改了`uni-id-users`表的schema中字段username的编辑权限,防止用户通过clientDB绕过用户名不能重复的规则更新用户名的问题 - 修改了`uni-id-users`表的schema中字段username的编辑权限,防止用户通过clientDB绕过用户名不能重复的规则更新用户名的问题
## 1.0.47(2021-08-09) ## 1.0.47(2021-08-09)
- 更新文档快速体验部署流程 - 更新文档快速体验部署流程
- 修复一键登优先时报变量找不到的问题 - 修复一键登优先时报变量找不到的问题
## 1.0.46(2021-08-05) ## 1.0.46(2021-08-05)
清理多余文件 清理多余文件
## 1.0.45(2021-08-05) ## 1.0.45(2021-08-05)
...@@ -12,8 +104,8 @@ ...@@ -12,8 +104,8 @@
解决首页为非nvue页面时白屏的问题。 解决首页为非nvue页面时白屏的问题。
- 注意:本次在`common/appInit.js`中修改了路由拦截的逻辑,是个兼容方案;当首页为非nvue页面,路由拦截器逻辑会在加载首页时执行。接下来新版本的hx编译的uni-app项目无论首页是否为nvue都不走拦截器,保持各端逻辑一致。 - 注意:本次在`common/appInit.js`中修改了路由拦截的逻辑,是个兼容方案;当首页为非nvue页面,路由拦截器逻辑会在加载首页时执行。接下来新版本的hx编译的uni-app项目无论首页是否为nvue都不走拦截器,保持各端逻辑一致。
## 1.0.43(2021-08-02) ## 1.0.43(2021-08-02)
1. 微信小程序端,新增:微信登成功后,弹出是否"获取微信头像和昵称,完善个人资料"的弹框 1. 微信小程序端,新增:微信登成功后,弹出是否"获取微信头像和昵称,完善个人资料"的弹框
2. APP端,新增逻辑:微信登成功后,自动获取用户的微信昵称和头像完善用户个人资料 2. APP端,新增逻辑:微信登成功后,自动获取用户的微信昵称和头像完善用户个人资料
- 提示:因为微信的头像一旦更换,微信返回的头像url会失效。所以,以上两示例功能将url(客户端:下载到临时目录/服务端:转为Buffer)再上传到uniCloud云存储中再使用。 - 提示:因为微信的头像一旦更换,微信返回的头像url会失效。所以,以上两示例功能将url(客户端:下载到临时目录/服务端:转为Buffer)再上传到uniCloud云存储中再使用。
## 1.0.42(2021-07-29) ## 1.0.42(2021-07-29)
新增绑定手机号码页面前端校验 新增绑定手机号码页面前端校验
...@@ -21,11 +113,11 @@ ...@@ -21,11 +113,11 @@
1. 支持vue3.0 1. 支持vue3.0
2. 去掉App.vue全局样式,避免与非flex布局的页面样式冲突 2. 去掉App.vue全局样式,避免与非flex布局的页面样式冲突
## 1.0.40(2021-07-22) ## 1.0.40(2021-07-22)
1. 调整使用正则表达式配置强制登功能的写法,解决在小程序端的兼容问题。 1. 调整使用正则表达式配置强制登功能的写法,解决在小程序端的兼容问题。
2. 新增签到功能(培养用户习惯,提升用户粘性)。支持:每日签到奖励、周期性连续7日签到,奖励翻倍。 2. 新增签到功能(培养用户习惯,提升用户粘性)。支持:每日签到奖励、周期性连续7日签到,奖励翻倍。
## 1.0.39(2021-07-19) ## 1.0.39(2021-07-19)
1. 强制登配置,新增白名单模式 1. 强制登配置,新增白名单模式
2. 强制登配置,支持正则表达式 2. 强制登配置,支持正则表达式
## 1.0.38(2021-07-17) ## 1.0.38(2021-07-17)
删除多余文件 删除多余文件
## 1.0.37(2021-07-14) ## 1.0.37(2021-07-14)
...@@ -36,9 +128,9 @@ ...@@ -36,9 +128,9 @@
1. H5端默认不开启,隐私权限协议签署页面。因为网页端没有什么隐私权限能被获取,目前全球仅欧盟有要求;如有需要请手动开启 1. H5端默认不开启,隐私权限协议签署页面。因为网页端没有什么隐私权限能被获取,目前全球仅欧盟有要求;如有需要请手动开启
2. 在列表页演示,如何在onShow生命周期获取设备位置,并在设备或者应用没有权限时自动引导。设置完毕自动重新获取。[更多点此查看插件介绍](https://ext.dcloud.net.cn/plugin?name=json-gps) 2. 在列表页演示,如何在onShow生命周期获取设备位置,并在设备或者应用没有权限时自动引导。设置完毕自动重新获取。[更多点此查看插件介绍](https://ext.dcloud.net.cn/plugin?name=json-gps)
## 1.0.34(2021-07-08) ## 1.0.34(2021-07-08)
修复,打开登陆页时携带参数,导致的快捷登陆方式重复的问题 修复,打开登录页时携带参数,导致的快捷登录方式重复的问题
## 1.0.33(2021-07-06) ## 1.0.33(2021-07-06)
修复,点击短信验证码登打开的页面不正确的问题 修复,点击短信验证码登打开的页面不正确的问题
## 1.0.32(2021-07-06) ## 1.0.32(2021-07-06)
修复,仅配置一种快捷登录时的错误 修复,仅配置一种快捷登录时的错误
## 1.0.31(2021-07-02) ## 1.0.31(2021-07-02)
...@@ -48,7 +140,7 @@ ...@@ -48,7 +140,7 @@
2. uni-id-cf发送短信验证码api,默认注释掉:虚拟发送短信验证码的代码块。 2. uni-id-cf发送短信验证码api,默认注释掉:虚拟发送短信验证码的代码块。
3. uni-id-cf统一action名称为驼峰法 3. uni-id-cf统一action名称为驼峰法
## 1.0.29(2021-06-29) ## 1.0.29(2021-06-29)
1. 修复在安卓10以下设备,操作登陆获取不到oaid会直接导致登陆失败的bug 1. 修复在安卓10以下设备,操作登录获取不到oaid会直接导致登录失败的bug
2. 修复uniCloud版本为阿里云版时删除头像设置失败,腾讯云版删除头像后二次上传失败的问题 2. 修复uniCloud版本为阿里云版时删除头像设置失败,腾讯云版删除头像后二次上传失败的问题
## 1.0.28(2021-06-28) ## 1.0.28(2021-06-28)
修复云函数uni-id-cf的resetPwdBySmsCode接口,未注册过的用户也能调用的问题 修复云函数uni-id-cf的resetPwdBySmsCode接口,未注册过的用户也能调用的问题
...@@ -63,41 +155,41 @@ ...@@ -63,41 +155,41 @@
## 1.0.23(2021-06-22) ## 1.0.23(2021-06-22)
更正调试遗留的uni-config-center/uni-id/config.json的tokenExpiresIn=1配置问题,改为默认值7200 更正调试遗留的uni-config-center/uni-id/config.json的tokenExpiresIn=1配置问题,改为默认值7200
## 1.0.22(2021-06-22) ## 1.0.22(2021-06-22)
1. 新增一键登录授权界面的其他快捷登按钮 1. 新增一键登录授权界面的其他快捷登按钮
2. 优化uni-quick-login组件代码 2. 优化uni-quick-login组件代码
3. 调整隐私政策协议框勾选逻辑:在登页面已勾选,同步勾选。如果没勾选需要手动勾选(为符合应用市场上架要求) 3. 调整隐私政策协议框勾选逻辑:在登页面已勾选,同步勾选。如果没勾选需要手动勾选(为符合应用市场上架要求)
4. 调整登页隐私政策协议框位置。 4. 调整登页隐私政策协议框位置。
5. 增强路由拦截,新增判断token是否过期。 5. 增强路由拦截,新增判断token是否过期。
## 1.0.21(2021-06-21) ## 1.0.21(2021-06-21)
优化:uni_modules模式使用uni-id-cf,方便uni-starter与uniCloud-admin的uni-id-cf同步更新。 优化:uni_modules模式使用uni-id-cf,方便uni-starter与uniCloud-admin的uni-id-cf同步更新。
## 1.0.20(2021-06-18) ## 1.0.20(2021-06-18)
1.H5端新增,强制要求用户同意隐私协议 2.兼容ios端自动设置打开下载页用户的剪切板为邀请者的inviteCode 3.成功注册用户,且请求体含邀请码inviteCode自动关联裂变关系 1.H5端新增,强制要求用户同意隐私协议 2.兼容ios端自动设置打开下载页用户的剪切板为邀请者的inviteCode 3.成功注册用户,且请求体含邀请码inviteCode自动关联裂变关系
## 1.0.19(2021-06-17) ## 1.0.19(2021-06-17)
1.新增获取邀请码接口getUserInviteCode 2.在邀请用户下载应用页面,自动设置被邀请用户的剪切板为邀请者的code(仅支持安卓端) 3.在注册或登并注册请求时自动添加剪切板中的请求参数 4.统一接口名称为驼峰法 1.新增获取邀请码接口getUserInviteCode 2.在邀请用户下载应用页面,自动设置被邀请用户的剪切板为邀请者的code(仅支持安卓端) 3.在注册或登并注册请求时自动添加剪切板中的请求参数 4.统一接口名称为驼峰法
## 1.0.18(2021-06-15) ## 1.0.18(2021-06-15)
修复,APP端有安装微信客户端但未显示微信登快捷键的问题 修复,APP端有安装微信客户端但未显示微信登快捷键的问题
## 1.0.17(2021-06-09) ## 1.0.17(2021-06-09)
修复,非APP端deviceInfo为空引起的登失败问题 修复,非APP端deviceInfo为空引起的登失败问题
## 1.0.16(2021-06-08) ## 1.0.16(2021-06-08)
新增,操作注册/登陆操作自动获取客户端设备:push_clientid、imei、oaid、idfa新增/更新到数据表uni-id-device新增,操作注册/登陆操作自动获取客户端设备:push_clientid、imei、oaid、idfa新增/更新到数据表uni-id-device 新增,操作注册/登录操作自动获取客户端设备:push_clientid、imei、oaid、idfa新增/更新到数据表uni-id-device新增,操作注册/登录操作自动获取客户端设备:push_clientid、imei、oaid、idfa新增/更新到数据表uni-id-device
## 1.0.15(2021-06-07) ## 1.0.15(2021-06-07)
为迎合苹果App Store的规则,登陆与分享功能项显示之前自动检测是否安装了对应客户端。比如:设备未安装微信则不显示微信快捷登陆和微信分享选项。为迎合苹果App Store的规则,登陆与分享功能项显示之前自动检测是否安装了对应客户端。比如:设备未安装微信则不显示微信快捷登陆和微信分享选项。 为迎合苹果App Store的规则,登录与分享功能项显示之前自动检测是否安装了对应客户端。比如:设备未安装微信则不显示微信快捷登录和微信分享选项。为迎合苹果App Store的规则,登录与分享功能项显示之前自动检测是否安装了对应客户端。比如:设备未安装微信则不显示微信快捷登录和微信分享选项。
## 1.0.14(2021-06-07) ## 1.0.14(2021-06-07)
修改错误的表名称uni-verify为opendb-verify-codes 修改错误的表名称uni-verify为opendb-verify-codes
## 1.0.13(2021-06-04) ## 1.0.13(2021-06-04)
新增一键登陆界面的第三方快捷登陆按钮 新增一键登录界面的第三方快捷登录按钮
## 1.0.12(2021-05-28) ## 1.0.12(2021-05-28)
修复拦截器在ios app端会报错:Unhandled promise...的问题 修复拦截器在ios app端会报错:Unhandled promise...的问题
## 1.0.10(2021-05-27) ## 1.0.10(2021-05-27)
新增callfunction的拦截器废除this.request的写法。为callFunction添加:请求失败是否断网判断并提示、恢复网络自动重新执行、自动处理响应体:token过期自动跳转到登页面、token自动续期 新增callfunction的拦截器废除this.request的写法。为callFunction添加:请求失败是否断网判断并提示、恢复网络自动重新执行、自动处理响应体:token过期自动跳转到登页面、token自动续期
## 1.0.9(2021-05-23) ## 1.0.9(2021-05-23)
修复变量被重复定义的问题 修复变量被重复定义的问题
## 1.0.8(2021-05-22) ## 1.0.8(2021-05-22)
宫格页(/pages/grid/grid),新增根据当前用户是否登、是否为管理员的角色来决定是否显示的示范 宫格页(/pages/grid/grid),新增根据当前用户是否登、是否为管理员的角色来决定是否显示的示范
## 1.0.7(2021-05-22) ## 1.0.7(2021-05-22)
删除多余数据 删除多余数据
## 1.0.6(2021-05-22) ## 1.0.6(2021-05-22)
修复当username(用户名&密码)为第一优先级的登陆方式时。无法切换到smsCode(短信验证码)登陆方式 修复当username(用户名&密码)为第一优先级的登录方式时。无法切换到smsCode(短信验证码)登录方式
## 1.0.5(2021-05-20) ## 1.0.5(2021-05-20)
改用uni_modules方式处理图片选择api时无权限,引导用户快捷打开系统设置 改用uni_modules方式处理图片选择api时无权限,引导用户快捷打开系统设置
## 1.0.4(2021-05-19) ## 1.0.4(2021-05-19)
......
...@@ -9,7 +9,7 @@ import interceptorChooseImage from '@/uni_modules/json-interceptor-chooseImage/j ...@@ -9,7 +9,7 @@ import interceptorChooseImage from '@/uni_modules/json-interceptor-chooseImage/j
const db = uniCloud.database() const db = uniCloud.database()
export default async function() { export default async function() {
let loginConfig = uniStarterConfig.router.login let loginConfig = uniStarterConfig.router.login
//清除有配置但设备环境不支持的登 //清除有配置但设备环境不支持的登
// #ifdef APP-PLUS // #ifdef APP-PLUS
await new Promise((callBack) => { await new Promise((callBack) => {
plus.oauth.getServices(oauthServices => { plus.oauth.getServices(oauthServices => {
...@@ -40,7 +40,7 @@ export default async function() { ...@@ -40,7 +40,7 @@ export default async function() {
}) })
// #endif // #endif
//非app移除:一键登录、苹果登陆;h5移除微信登陆,如果你做微信公众号登陆需要将此行移除 //非app移除:一键登录、苹果登录;h5移除微信登录,如果你做微信公众号登录需要将此行移除
// #ifndef APP-PLUS // #ifndef APP-PLUS
loginConfig = loginConfig.filter(item => { loginConfig = loginConfig.filter(item => {
return ![ return ![
...@@ -77,15 +77,18 @@ export default async function() { ...@@ -77,15 +77,18 @@ export default async function() {
code, // 错误码详见https://uniapp.dcloud.net.cn/uniCloud/clientdb?id=returnvalue code, // 错误码详见https://uniapp.dcloud.net.cn/uniCloud/clientdb?id=returnvalue
message message
}) { }) {
console.log('onDBError'); console.log('onDBError', {
code,
message
});
// 处理错误 // 处理错误
console.log(code, message); console.error(code, message);
if ([ if ([
'TOKEN_INVALID_INVALID_CLIENTID', 'TOKEN_INVALID_INVALID_CLIENTID',
'TOKEN_INVALID', 'TOKEN_INVALID',
'TOKEN_INVALID_TOKEN_EXPIRED', 'TOKEN_INVALID_TOKEN_EXPIRED',
'TOKEN_INVALID_WRONG_TOKEN', 'TOKEN_INVALID_WRONG_TOKEN',
'TOKEN_INVALID_ANONYMOUS_USER', 'TOKEN_INVALID_ANONYMOUS_USER'
].includes(code)) { ].includes(code)) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/ucenter/login-page/index/index' url: '/pages/ucenter/login-page/index/index'
...@@ -110,75 +113,57 @@ export default async function() { ...@@ -110,75 +113,57 @@ export default async function() {
tokenExpired tokenExpired
}) })
}) })
uni.addInterceptor('setStorage', {
invoke(args) {
if (args.data && args.key == 'uni_id_token') {
let oldToken = uni.getStorageSync('uni_id_token')
if(oldToken.length){
console.log('监听到token更新,就刷新push_clientid的有效期');
// #ifdef APP-PLUS
let push_clientid;
try {
push_clientid = plus.push.getClientInfo().clientid
} catch (e) {
uni.showModal({
content: '获取推送标识失败。如果你的应用不需要推送功能,请注释掉本代码块',
showCancel: false,
confirmText: "好的"
});
console.log(e)
}
uniCloud.callFunction({
name:'uni-id-cf',
data:{
"action": "renewDeviceTokenExpiredxpired",
"params": {push_clientid}
},
complete: (e) => {
console.log(e);
}
})
// #endif
}
}
// console.log('interceptor-complete', args)
},
complete(e) {
// console.log(e);
}
})
const Debug = true; const Debug = false;
//拦截器封装callFunction //拦截器封装callFunction
let callFunctionOption; let callFunctionOption;
uniCloud.addInterceptor('callFunction', { uniCloud.addInterceptor('callFunction', {
async invoke(option) { async invoke(option) {
// #ifdef APP-PLUS // 判断如果是执行登录(无论是哪种登录方式),就记录用户的相关设备id
// 判断如果是执行登陆(无论是哪种登陆方式),就记录用户的相关设备id // 注意:注册可能不仅仅走register接口,还有登录并注册的接口
if (option.name == 'uni-id-cf' && (option.data.action == 'register' || option.data.action if (option.name == 'uni-id-cf' &&
.slice(0, 5) == 'login')) { (option.data.action == 'register' || option.data.action.slice(0, 5) == 'login')
let oaid = await new Promise((callBack, fail) => { ) {
if (uni.getSystemInfoSync().platform == "android") { option.data.deviceInfo = await getDeviceInfo()
plus.device.getOAID({ console.log("重新登录/注册,获取设备id", option.data.deviceInfo);
success: function(e) {
callBack(e.oaid)
// console.log('getOAID success: '+JSON.stringify(e));
},
fail: function(e) {
callBack()
console.log('getOAID failed: ' + JSON.stringify(e));
}
});
} else {
callBack()
}
})
let imei = await new Promise((callBack, fail) => {
if (uni.getSystemInfoSync().platform == "android") {
plus.device.getInfo({
success: function(e) {
callBack(e.imei)
// console.log('getOAID success: '+JSON.stringify(e));
},
fail: function(e) {
callBack()
console.log('getOAID failed: ' + JSON.stringify(e));
}
});
} else {
callBack()
}
})
let push_clientid = '',
idfa = plus.storage.getItem('idfa') || ''; //idfa有需要的用户在应用首次启动时自己获取存储到storage中
try {
push_clientid = plus.push.getClientInfo().clientid
} catch (e) {
uni.showModal({
content: '获取推送标识失败。如果你的应用不需要推送功能,请注释掉本代码块',
showCancel: false,
confirmText: "好的"
});
console.log(e)
}
let deviceInfo = {
push_clientid, // 获取匿名设备标识符
imei,
oaid,
idfa
}
console.log("重新登陆/注册,获取设备id", deviceInfo);
option.data.deviceInfo = deviceInfo
// #ifndef H5
//注册可能不仅仅走register接口,还有登陆并注册的接口
option.data.inviteCode = await new Promise((callBack) => { option.data.inviteCode = await new Promise((callBack) => {
uni.getClipboardData({ uni.getClipboardData({
success: function(res) { success: function(res) {
...@@ -198,12 +183,15 @@ export default async function() { ...@@ -198,12 +183,15 @@ export default async function() {
}, },
fail() { fail() {
callBack(false) callBack(false)
},
complete(){
// #ifdef MP-WEIXIN
uni.hideToast()
// #endif
} }
}); });
}) })
// #endif
} }
// #endif
// console.log(JSON.stringify(option)); // console.log(JSON.stringify(option));
callFunctionOption = option callFunctionOption = option
}, },
...@@ -256,7 +244,6 @@ export default async function() { ...@@ -256,7 +244,6 @@ export default async function() {
}); });
}, },
success: (e) => { success: (e) => {
console.log(e);
const { const {
token, token,
tokenExpired tokenExpired
...@@ -286,7 +273,21 @@ export default async function() { ...@@ -286,7 +273,21 @@ export default async function() {
}); });
break; break;
default: default:
console.log('code的值是:' + e.result.code, '可以在这里插入,自动处理响应体'); console.log('code的值是:' + e.result.code, '可以在上面添加case,自动处理响应体');
break;
}
switch (e.result.errCode) {
case 'uni-id-token-not-exist':
uni.showToast({
title: '登录信息失效',
icon: 'none'
});
uni.navigateTo({
url: "/pages/ucenter/login-page/index/index"
})
break;
default:
break; break;
} }
} }
...@@ -314,6 +315,7 @@ export default async function() { ...@@ -314,6 +315,7 @@ export default async function() {
//获取要前往的页面路径(即url去掉"?"和"?"后的参数) //获取要前往的页面路径(即url去掉"?"和"?"后的参数)
const pages = getCurrentPages(); const pages = getCurrentPages();
if (!pages.length) { if (!pages.length) {
console.log("首页启动调用了");
return e return e
} }
const fromUrl = pages[pages.length - 1].route; const fromUrl = pages[pages.length - 1].route;
...@@ -321,7 +323,7 @@ export default async function() { ...@@ -321,7 +323,7 @@ export default async function() {
let inLoginPage = fromUrl.split('/')[2] == 'login-page' let inLoginPage = fromUrl.split('/')[2] == 'login-page'
//控制登录优先级 //控制登录优先级
if ( //判断当前窗口是否为登页面,如果是则不重定向路由 if ( //判断当前窗口是否为登页面,如果是则不重定向路由
url == '/pages/ucenter/login-page/index/index' && url == '/pages/ucenter/login-page/index/index' &&
!inLoginPage !inLoginPage
) { ) {
...@@ -347,7 +349,7 @@ export default async function() { ...@@ -347,7 +349,7 @@ export default async function() {
}) })
// console.log({pass}) // console.log({pass})
} }
if (visitor && !inLoginPage) { if (visitor) {
pass = visitor.some((item) => { pass = visitor.some((item) => {
if (typeof(item) == 'object' && item.pattern) { if (typeof(item) == 'object' && item.pattern) {
return item.pattern.test(url) return item.pattern.test(url)
...@@ -434,4 +436,78 @@ function initAppVersion() { ...@@ -434,4 +436,78 @@ function initAppVersion() {
}); });
// 检查更新 // 检查更新
// #endif // #endif
} }
async function getDeviceInfo() {
let deviceInfo = {
"uuid": '',
"vendor": '',
"push_clientid": '',
"imei": '',
"oaid": '',
"idfa": '',
"model": '',
"platform": '',
}
const {
model,
platform,
} = uni.getSystemInfoSync();
Object.assign(deviceInfo, {
model,
platform
});
// #ifdef APP-PLUS
const oaid = await new Promise((callBack, fail) => {
if (deviceInfo.platform == "android") {
plus.device.getOAID({
success: function(e) {
callBack(e.oaid)
// console.log('getOAID success: '+JSON.stringify(e));
},
fail: function(e) {
callBack()
console.log('getOAID failed: ' + JSON.stringify(e));
}
});
} else {
callBack()
}
}),
{
imei,
uuid
} = await new Promise((callBack, fail) => {
plus.device.getInfo({
success: function(e) {
callBack(e)
// console.log('getOAID success: '+JSON.stringify(e));
},
fail: function(e) {
callBack()
console.log('getOAID failed: ' + JSON.stringify(e));
}
});
}),
idfa = plus.storage.getItem('idfa') || '', //idfa有需要的用户在应用首次启动时自己获取存储到storage中
vendor = plus.device.vendor;
try {
deviceInfo.push_clientid = plus.push.getClientInfo().clientid
} catch (e) {
uni.showModal({
content: '获取推送标识失败。如果你的应用不需要推送功能,请注释掉本代码块',
showCancel: false,
confirmText: "好的"
});
console.log(e)
}
Object.assign(deviceInfo, {
imei,
uuid,
idfa,
vendor
});
// #endif
return deviceInfo
}
\ No newline at end of file
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
import CONFIG from '../uni-starter.config.js'; import CONFIG from '../uni-starter.config.js';
const CONFIG_OPEN = CONFIG?.h5?.openApp?.openUrl ? CONFIG.h5.openApp : {}; const CONFIG_OPEN = CONFIG.h5.openApp || {};
// 仅H5端添加"打开APP" // 仅H5端添加"打开APP"
export default function() { export default function() {
// #ifdef H5 // #ifdef H5
......
<template>
<view @click="onClick" :style="{width,height}">
<image v-if="cSrc" :style="{width,height}" :src="cSrc" :mode="mode"></image>
</view>
</template>
<script>
export default {
name: "cloud-image",
emits:['click','switchChange'],
props: {
mode: {
type:String,
default () {
return 'widthFix'
}
},
src: {
// type:String,
default () {
return ""
}
},
width: {
type:String,
default () {
return '100rpx'
}
},
height: {
type:String,
default () {
return '100rpx'
}
}
},
watch: {
src:{
handler(src) {
// console.log(src);
// console.log(src.substring(0, 8));
if (src&&src.substring(0, 8) == "cloud://") {
uniCloud.getTempFileURL({
fileList: [src]
}).then(res=>{
// console.log(res);
this.cSrc = res.fileList[0].tempFileURL
})
}else{
this.cSrc = src
}
},
immediate: true
}
},
async mounted() {
},
methods:{
onClick(){
this.$emit('click')
}
},
data() {
return {
cSrc:false
};
}
}
</script>
\ No newline at end of file
<template>
<refresh @refresh="refresh" @pullingdown="onpullingdown" :display="showRefresh ? 'show' : 'hide'">
<view class="refreshBox">
<!-- 可以自己添加图片路径或base64实现图片 <image class="refreshImg" :src="config[state].img" mode="widthFix" resize="cover"></image> -->
<text class="refreshText">{{config[state].text}}</text>
</view>
</refresh>
</template>
<script>
export default {
data() {
return {
showRefresh:false,
state:0
}
},
methods:{
onpullingdown({pullingDistance,viewHeight}) {
if(pullingDistance < viewHeight){
this.state = 0
}else{
this.state = 1
}
},
refresh(){
// console.log('refresh');
this.showRefresh = true
this.state = 2
this.$emit('refresh')
}
},
watch: {
loading(loading, oldValue) {
if(!loading){
this.showRefresh = false
this.state = 3
}
}
},
props: {
loading: {
type:Boolean,
default(){
return false
}
},
config: {
type: Array,
default(){
return [
{
text:"继续下拉执行刷新",
img:""//可以自己添加图片路径或base64实现图片
},
{
text:"释放立即刷新",
img:""//可以自己添加图片路径或base64实现图片
},
{
text:"正在疯狂的加载中",
img:""//可以自己添加图片路径或base64实现图片
},
{
text:"加载成功",
img:""//可以自己添加图片路径或base64实现图片
}
]
}
},
},
}
</script>
<style lang="scss" scoped>
.refreshBox{
width: 750rpx;
height: 50px;
justify-content: center;
align-items: center;
flex-direction: row;
/* #ifndef APP-PLUS */
margin-top: -50px;
/* #endif */
}
.refreshImg{
width: 55rpx;
height: 55rpx;
z-index: 111;
}
.refreshText{
font-size: 26rpx;
color: #999999;
padding-left: 6rpx;
}
</style>
<template> <template>
<view class="root"> <view class="root">
<checkbox-group @change="setAgree" class="checkbox-group"> <checkbox-group @change="setAgree" class="checkbox-group">
<checkbox style="transform: scale(0.7);" /> <checkbox :checked="isAgree" style="transform: scale(0.7);" />
<text>同意</text> <text>{{$t('common.agree')}}</text>
</checkbox-group> </checkbox-group>
<view class="item" v-for="(agreement,index) in agreements" :key="index"> <view class="item" v-for="(agreement,index) in agreements" :key="index">
<text class="agreement" @click="navigateTo(agreement)">{{agreement.title}}</text> <text class="agreement" @click="navigateTo(agreement)">{{agreement.title}}</text>
<text class="hint" v-if="hasAnd(agreements,index)"></text> <text class="hint" v-if="hasAnd(agreements,index)">&</text>
</view> </view>
</view> </view>
</template> </template>
...@@ -36,6 +36,13 @@ ...@@ -36,6 +36,13 @@
this.$emit('setAgree',this.isAgree) this.$emit('setAgree',this.isAgree)
} }
}, },
created() {
uni.$on('setAgreementsAgree',state=>{
console.log('setAgreementsAgree',state);
this.isAgree = state
this.$emit('setAgree',state)
})
},
data() { data() {
return { return {
isAgree:false isAgree:false
......
<template>
<uni-popup ref="popup" type="bottom">
<view class="box">
<text class="headBox">绑定资料</text>
<text class="tip">将一键获取你的手机号码绑定你的个人资料</text>
<view class="btnBox">
<text @click="closeMe" class="close">关闭</text>
<button class="agree" type="warn" @click="beforeGetphonenumber" open-type="getPhoneNumber"
@getphonenumber="bindMobileByMpWeixin">获取</button>
</view>
</view>
</uni-popup>
</template>
<script>
import {
mapMutations,
mapGetters
} from 'vuex';
const db = uniCloud.database();
const usersTable = db.collection('uni-id-users')
let userId = ''
export default {
emits: ['next'],
computed: {
...mapGetters({
userInfo: 'user/info',
login: 'user/hasLogin'
})
},
data() {
return {}
},
methods: {
...mapMutations({
setUserInfo: 'user/login'
}),
beforeGetphonenumber() {
uni.showLoading({
mask:true
})
wx.checkSession({
success() {
console.log('session_key 未过期');
uni.hideLoading()
},
fail() {
console.log('session_key 已经失效,正在执行更新');
wx.login({
success({code}) {
uniCloud.callFunction({
name: "uni-id-cf",
data: {
"action": "refreshSessionKey",
"params": {
code
}
},
complete: (e) => {
console.log(e);
uni.hideLoading()
}
})
},
fail: (err) => {
console.error(err);
}
})
}
})
},
bindMobileByMpWeixin(e) {
console.log(e.detail);
uniCloud.callFunction({
name: "uni-id-cf",
data: {
"action": "bindMobileByMpWeixin",
"params": e.detail
},
complete: (e) => {
console.log(e);
},
success: (e) => {
uni.showToast({
title: e.result.msg||'绑定成功',
icon: 'none'
});
if(e.result.code === 0){
this.setUserInfo({
"mobile": e.result.mobile
})
}
this.closeMe()
}
})
},
async open(uid) {
userId = uid
this.$refs.popup.open()
this.beforeGetphonenumber()
},
closeMe(e) {
this.$refs.popup.close()
},
}
}
</script>
<style lang="scss" scoped>
view {
display: flex;
}
.box {
background-color: #FFFFFF;
height: 200px;
width: 750rpx;
flex-direction: column;
border-top-left-radius: 15px;
border-top-right-radius: 15px;
}
.headBox {
padding: 20rpx;
height: 80rpx;
line-height: 80rpx;
text-align: left;
font-size: 32upx;
color: #333333;
margin-left: 15rpx;
}
.tip {
color: #666666;
text-align: left;
justify-content: center;
margin: 10rpx 30rpx;
font-size: 36rpx;
}
.btnBox {
margin-top: 45rpx;
justify-content: center;
flex-direction: row;
}
.close,
.agree {
text-align: center;
width: 200rpx;
height: 80upx;
line-height: 80upx;
border-radius: 50px;
margin: 0 20rpx;
font-size: 36rpx;
}
.close {
color: #999999;
border-color: #EEEEEE;
border-style: solid;
border-width: 1px;
background-color: #FFFFFF;
}
.close:active {
color: #989898;
background-color: #E2E2E2;
}
.agree {
background-color: #DD524D;
color: #FFFFFF;
}
/* #ifdef MP */
.agree::after {
border: none;
}
.agree {
background-color: #DD524D;
}
/* #endif */
.agree:active {
background-color: #F5F5F6;
}
</style>
{
"noData": "No Data",
"noNetwork": "Network error",
"toSet": "Go to settings",
"error": "error"
}
import en from './en.json'
import zhHans from './zh-Hans.json'
export default {
en,
'zh-Hans': zhHans
}
{
"noData": "暂无数据",
"noNetwork": "网络异常",
"toSet": "前往设置",
"error": "错误"
}
<template> <template>
<view style="width: 750rpx;"> <view @appear="appear">
<template v-if="!state.error"> <view v-if="state.error">
<uni-load-more v-if="state.loading||state.pagination.current!=1||state.data.length!=0" :status="state.loading?'loading':(state.hasMore?'hasMore':'noMore')"></uni-load-more> <view class="box" v-if="networkType == 'none'">
<text class="noData" v-else>暂无数据</text> <image class="icon-image" src="@/static/uni-load-state/disconnection.png" mode="widthFix"></image>
</template> <text class="tip-text">{{noNetwork}}</text>
<view v-else> <view class="btn btn-default" @click="openSettings">
<view class="box" v-if="networkType == 'none'"> <text class="btn-text">{{toSet}}</text>
<image class="icon-image" src="@/static/uni-load-state/disconnection.png" mode="widthFix"></image> </view>
<text class="tip-text">网络异常</text> </view>
<view class="btn btn-default" @click="openSettings"> <text class="error" v-else>{{error}}{{JSON.stringify(state.error)}}</text>
<text class="btn-text">前往设置</text>
</view>
</view>
<text class="err" v-else>错误:{{JSON.stringify(state.error)}}</text>
</view> </view>
</view> <template v-else>
<!-- #ifdef APP-NVUE -->
<text class="state-text">{{state.loading?'加载中...':(state.hasMore?'上拉加载更多':'没有更多数据了')}}</text>
<!-- #endif -->
<!-- #ifndef APP-NVUE -->
<uni-load-more class="uni-load-more" :status="state.loading?'loading':(state.hasMore?'hasMore':'noMore')"></uni-load-more>
<!-- #endif -->
</template>
</view>
</template> </template>
<script> <script>
import {
initVueI18n
} from '@dcloudio/uni-i18n'
import messages from './i18n/index.js'
const {
t
} = initVueI18n(messages)
export default { export default {
name: "uni-load-state", name: "uni-load-state",
computed: {
noData() {
return t('noData')
},
noNetwork() {
return t('noNetwork')
},
toSet() {
return t('toSet')
},
error() {
return t('error')
}
},
data() { data() {
return { return {
"networkType": "" "networkType": ""
}; };
},
props: {
state:{
type: Object,
default(){
return {
"loading":true,
"hasMore":false,
"pagination":{"pages":0},
"data":[],
"error":{}
}
}
}
}, },
mounted() { props: {
state: {
type: Object,
default () {
return {
"loading": true,
"hasMore": false,
"pagination": {
"pages": 0
},
"data": [],
"error": {}
}
}
}
},
mounted() {
uni.onNetworkStatusChange(({ uni.onNetworkStatusChange(({
networkType networkType
}) => { }) => {
if(this.networkType == 'none' && networkType != 'none'){ //之前没网现在有了 if (this.networkType == 'none' && networkType != 'none') { //之前没网现在有了
this.$emit('networkResume') this.$emit('networkResume')
} }
this.networkType = networkType; this.networkType = networkType;
}); });
...@@ -55,48 +84,65 @@ ...@@ -55,48 +84,65 @@
this.networkType = networkType; this.networkType = networkType;
} }
}); });
}, },
methods:{ methods: {
openSettings(){ appear() {
if (uni.getSystemInfoSync().platform == "ios") { if (!this.state.loading && this.state.hasMore) {
var UIApplication = plus.ios.import("UIApplication"); this.$emit('loadMore')
var application2 = UIApplication.sharedApplication(); }
var NSURL2 = plus.ios.import("NSURL"); },
var setting2 = NSURL2.URLWithString("App-prefs:root=General"); openSettings() {
application2.openURL(setting2); if (uni.getSystemInfoSync().platform == "ios") {
plus.ios.deleteObject(setting2); var UIApplication = plus.ios.import("UIApplication");
plus.ios.deleteObject(NSURL2); var application2 = UIApplication.sharedApplication();
var NSURL2 = plus.ios.import("NSURL");
var setting2 = NSURL2.URLWithString("App-prefs:root=General");
application2.openURL(setting2);
plus.ios.deleteObject(setting2);
plus.ios.deleteObject(NSURL2);
plus.ios.deleteObject(application2); plus.ios.deleteObject(application2);
} else { } else {
var Intent = plus.android.importClass("android.content.Intent"); var Intent = plus.android.importClass("android.content.Intent");
var Settings = plus.android.importClass("android.provider.Settings"); var Settings = plus.android.importClass("android.provider.Settings");
var mainActivity = plus.android.runtimeMainActivity(); var mainActivity = plus.android.runtimeMainActivity();
var intent = new Intent(Settings.ACTION_SETTINGS); var intent = new Intent(Settings.ACTION_SETTINGS);
mainActivity.startActivity(intent); mainActivity.startActivity(intent);
} }
} }
} }
} }
</script> </script>
<style scoped> <style scoped>
.box{ .box {
flex: 1; flex: 1;
margin:100rpx 0; flex-direction: column;
flex-direction: column; align-items: center;
justify-content: center;
}
.uni-load-more{
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 690rpx;
} }
.state-text {
.icon-image{ text-align: center;
width: 300rpx; font-size: 26rpx;
} width: 690rpx;
.tip-text{ padding: 10rpx;
color: #999999; color: #999999;
font-size: 32rpx; }
margin-bottom: 30rpx;
} .icon-image {
width: 300rpx;
}
.tip-text {
color: #999999;
font-size: 32rpx;
margin-bottom: 30rpx;
}
.btn { .btn {
padding: 5px 10px; padding: 5px 10px;
width: 128px; width: 128px;
...@@ -116,14 +162,10 @@ ...@@ -116,14 +162,10 @@
border-style: solid; border-style: solid;
border-width: 1px; border-width: 1px;
border-radius: 3px; border-radius: 3px;
} }
.noData{ .error {
text-align: center; width: 690rpx;
padding: 30rpx; color: #DD524D;
}
.err{
width: 750rpx;
color: #DD524D;
} }
</style> </style>
{
"accountLogin": "Account",
"SMSLogin": "SMS",
"wechatLogin": "wechat",
"appleLogin": "Apple",
"oneClickLogin": "One click login",
"QQLogin": "QQ",
"xiaomiLogin": "Xiaomi",
"getProviderFail": "Failed to get service provider",
"loginErr": "Login service initialization error",
"chooseOtherLogin": "Click the third-party login",
"weibo":"weibo",
"noAgree": "You have not agreed to the privacy policy agreement",
"gotIt": "got it"
}
import en from './en.json'
import zhHans from './zh-Hans.json'
export default {
en,
'zh-Hans': zhHans
}
{
"accountLogin": "账号登录",
"SMSLogin": "短信验证码",
"wechatLogin": "微信登录",
"appleLogin": "苹果登录",
"oneClickLogin": "一键登录",
"QQLogin": "QQ登录",
"xiaomiLogin": "小米登录",
"getProviderFail": "获取服务供应商失败",
"loginErr": "登录服务初始化错误",
"chooseOtherLogin": "点击了第三方登录",
"weibo": "微博",
"noAgree": "你未同意隐私政策协议",
"gotIt": "知道了"
}
<template> <template>
<view> <view>
<view class="quick-login-box"> <view class="quick-login-box">
<view class="item" v-for="(item,index) in servicesList" :key="index" <view class="item" v-for="(item,index) in servicesList" :key="index"
@click="item.path?to(item.path):login_before(item.id,false)"> @click="item.path?to(item.path):login_before(item.id,false)">
<image class="logo" :src="item.logo" mode="widthFix"></image> <image class="logo" :src="item.logo" mode="widthFix"></image>
<text class="login-title">{{item.text}}</text> <text class="login-title">{{item.text}}</text>
</view> </view>
</view> </view>
<!-- #ifdef MP-WEIXIN --> <!-- #ifdef MP-WEIXIN -->
<uni-user-profile @next="doUserProfileNext" ref="userProfile"></uni-user-profile> <uni-user-profile @next="doUserProfileNext" ref="userProfile"></uni-user-profile>
<!-- #endif --> <!-- #endif -->
</view> </view>
</template> </template>
<script> <script>
import {
initVueI18n
} from '@dcloudio/uni-i18n'
import messages from './i18n/index.js'
const {
t
} = initVueI18n(messages)
import { import {
mapGetters, mapGetters,
mapMutations mapMutations
...@@ -20,7 +27,8 @@ ...@@ -20,7 +27,8 @@
//前一个窗口的页面地址。控制点击切换快捷登录方式是创建还是返回 //前一个窗口的页面地址。控制点击切换快捷登录方式是创建还是返回
import loginSuccess from '@/pages/ucenter/login-page/common/loginSuccess.js'; import loginSuccess from '@/pages/ucenter/login-page/common/loginSuccess.js';
const db = uniCloud.database(); const db = uniCloud.database();
const usersTable = db.collection('uni-id-users') const usersTable = db.collection('uni-id-users')
let allServicesList = []
export default { export default {
computed: { computed: {
loginConfig() { loginConfig() {
...@@ -34,53 +42,52 @@ ...@@ -34,53 +42,52 @@
return { return {
servicesList: [{ servicesList: [{
"id": "username", "id": "username",
"text": "账号登录", "text": t('accountLogin'),
"logo": "/static/uni-quick-login/user.png", "logo": "/static/uni-quick-login/user.png",
"path": "/pages/ucenter/login-page/pwd-login/pwd-login" "path": "/pages/ucenter/login-page/pwd-login/pwd-login"
}, },
{ {
"id": "smsCode", "id": "smsCode",
"text": "短信验证码", "text": t('SMSLogin'),
"logo": "/static/uni-quick-login/sms.png", "logo": "/static/uni-quick-login/sms.png",
"path": "/pages/ucenter/login-page/index/index?type=smsCode" "path": "/pages/ucenter/login-page/index/index?type=smsCode"
}, },
{ {
"id": "weixin", "id": "weixin",
"text": "微信登录", "text": t('wechatLogin'),
"logo": "/static/uni-quick-login/wechat.png", "logo": "/static/uni-quick-login/wechat.png",
}, },
{ {
"id": "apple", "id": "apple",
"text": "苹果登录", "text": t('appleLogin'),
"logo": "/static/uni-quick-login/apple.png", "logo": "/static/uni-quick-login/apple.png",
}, },
{ {
"id": "univerify", "id": "univerify",
"text": "一键登录", "text": t('oneClickLogin'),
"logo": "/static/uni-quick-login/univerify.png", "logo": "/static/uni-quick-login/univerify.png",
}, },
{ {
"id": "qq", "id": "qq",
"text": "QQ登录", //暂未提供该登录方式的接口示例 "text": t('QQLogin'), //暂未提供该登录方式的接口示例
"logo": "/static/uni-quick-login/univerify.png", "logo": "/static/uni-quick-login/univerify.png",
}, },
{ {
"id": "xiaomi", "id": "xiaomi",
"text": "小米登录", //暂未提供该登录方式的接口示例 "text": t('xiaomiLogin'), //暂未提供该登录方式的接口示例
"logo": "/static/uni-quick-login/univerify.png", "logo": "/static/uni-quick-login/univerify.png",
}, },
{ {
"id": "sinaweibo", "id": "sinaweibo",
"text": "微博登录", //暂未提供该登录方式的接口示例 "text": t('weibo'), //暂未提供该登录方式的接口示例
"logo": "/static/uni-quick-login/univerify.png", "logo": "/static/uni-quick-login/univerify.png",
} }
], ],
oauthServices: [],
config: {}, config: {},
univerifyStyle: { //一键登录弹出窗的样式配置参数 univerifyStyle: { //一键登录弹出窗的样式配置参数
"fullScreen": true, // 是否全屏显示,true表示全屏模式,false表示非全屏模式,默认值为false。 "fullScreen": true, // 是否全屏显示,true表示全屏模式,false表示非全屏模式,默认值为false。
"backgroundColor": "#ffffff", // 授权页面背景颜色,默认值:#ffffff "backgroundColor": "#ffffff", // 授权页面背景颜色,默认值:#ffffff
"buttons": { // 自定义登按钮 "buttons": { // 自定义登按钮
"iconWidth": "45px", // 图标宽度(高度等比例缩放) 默认值:45px "iconWidth": "45px", // 图标宽度(高度等比例缩放) 默认值:45px
"list": [] "list": []
}, },
...@@ -110,25 +117,28 @@ ...@@ -110,25 +117,28 @@
}, },
async created() { async created() {
let servicesList = this.servicesList let servicesList = this.servicesList
//去掉配置中不存在的 //去掉配置中不存在的 注意,在/common/appInit.js中已清除有配置但设备环境不支持的登录项
servicesList = servicesList.filter(item => this.loginConfig.includes(item.id)) servicesList = servicesList.filter(item => this.loginConfig.includes(item.id))
//处理一键登录 //处理一键登录
if (this.loginConfig.includes('univerify')) { if (this.loginConfig.includes('univerify')) {
this.univerifyStyle.privacyTerms.privacyItems = this.agreements this.univerifyStyle.privacyTerms.privacyItems = this.agreements
//设置一键登录功能底下的快捷登按钮 //设置一键登录功能底下的快捷登按钮
servicesList.forEach(({ servicesList.forEach(({
id, id,
logo logo,
path
}) => { }) => {
if (id != 'univerify') { if (id != 'univerify') {
this.univerifyStyle.buttons.list.push({ this.univerifyStyle.buttons.list.push({
"iconPath": logo, "iconPath": logo,
"provider": id "provider": id,
// path
}) })
} }
}) })
} }
//如果当前页面为默认登陆界面。当前第一优先级的“微信和苹果登陆”要隐藏,因为他已经被渲染在默认登陆界面顶部 console.log(servicesList);
//如果当前页面为默认登录界面。当前第一优先级的“微信和苹果登录”要隐藏,因为他已经被渲染在默认登录界面顶部
if ( if (
this.getRoute(1) == '/pages/ucenter/login-page/index/index' && ['weixin', 'apple'].includes(this this.getRoute(1) == '/pages/ucenter/login-page/index/index' && ['weixin', 'apple'].includes(this
.loginConfig[0]) .loginConfig[0])
...@@ -142,20 +152,7 @@ ...@@ -142,20 +152,7 @@
}) })
console.log('servicesList', servicesList, this.servicesList); console.log('servicesList', servicesList, this.servicesList);
}, },
mounted() { mounted() {},
// #ifdef APP-PLUS
plus.oauth.getServices(oauthServices => {
this.oauthServices = oauthServices
}, err => {
uni.showModal({
title: '获取服务供应商失败:' + JSON.stringify(err),
showCancel: false,
confirmText: '知道了'
});
console.error('获取服务供应商失败:' + JSON.stringify(err));
})
// #endif
},
methods: { methods: {
...mapMutations({ ...mapMutations({
setUserInfo: 'user/login' setUserInfo: 'user/login'
...@@ -169,57 +166,98 @@ ...@@ -169,57 +166,98 @@
return '/' + pages[pages.length - n].route return '/' + pages[pages.length - n].route
}, },
to(path) { to(path) {
// console.log('比较', this.getRoute(2), path) console.log('比较', this.getRoute(1),this.getRoute(2), path)
if (this.getRoute(2) == path) { // 控制路由是重新打开还是返回,避免重复打开页面 if(this.getRoute(1) == path.split('?')[0] && this.getRoute(1) == '/pages/ucenter/login-page/index/index'){
//如果要被打开的页面已经打开,且这个页面是 /pages/ucenter/login-page/index/index 则把类型参数传给他
let type = path.split('?')[1].split('=')[1]
uni.$emit('setLoginType',type)
}else if(this.getRoute(2) == path) { // 如果上一个页面就是,马上要打开的页面,直接返回。防止重复开启
uni.navigateBack(); uni.navigateBack();
} else { }else if(this.getRoute(1) != path) {
uni.navigateTo({ uni.navigateTo({
url: path, url: path,
animationType: 'slide-in-left' animationType: 'slide-in-left'
}) })
}else{
console.log('出乎意料的情况,path:'+path);
} }
}, },
login_before(type, navigateBack = true) { login_before(type, navigateBack = true) {
console.log(type);
if (!this.agree && type != 'univerify') { if (!this.agree && type != 'univerify') {
return uni.showToast({ return uni.showToast({
title: '你未同意隐私政策协议', title: t('noAgree'),
icon: 'none' icon: 'none'
}); });
} }
uni.showLoading({ uni.showLoading({mask: true})
mask: true if (type == 'univerify' && uni.getUniverifyManager) {
}) let univerifyManager = uni.getUniverifyManager()
// console.log(arguments); console.log('是新版');
let oauthService = this.oauthServices.find((service) => service.id == type) let onButtonsClickFn = async res =>{
// console.log(type); console.log('点击了第三方登录,provider:',res, res.provider,this.univerifyStyle.buttons.list);
//同步一键登录弹出层隐私协议框是否打勾
// #ifdef APP-PLUS let agree = (await uni.getCheckBoxState())[1].state
//请勿直接使用前端获取的unionid或openid直接用于登录,前端的数据都是不可靠的 console.log('agree',agree);
if (type == 'weixin') { uni.$emit('setAgreementsAgree', agree)
return oauthService.authorize(({ let {
code path
}) => { } = this.univerifyStyle.buttons.list[res.index]
// console.log(code); console.log('path', path,this.getRoute(1));
this.login({ if (path) {
code this.to(path)
}, type) closeUniverify()
}, } else {
err => { if(agree){
uni.hideLoading() closeUniverify()
console.error(err); setTimeout(() => {
uni.showModal({ console.log('login_before');
content: JSON.stringify(err), this.login_before(res.provider)
showCancel: false }, 500)
}); }else{
}) console.log(t('noAgree'));
uni.showToast({
title: t('noAgree'),
icon: 'none'
});
}
}
}
function closeUniverify(){
uni.hideLoading()
univerifyManager.close()
// 取消订阅自定义按钮点击事件
univerifyManager.offButtonsClick(onButtonsClickFn)
}
// 订阅自定义按钮点击事件
univerifyManager.onButtonsClick(onButtonsClickFn)
// 调用一键登录弹框
return univerifyManager.login({
"univerifyStyle": this.univerifyStyle,
success:res=> {
console.log('login success', res)
this.login(res.authResult, 'univerify')
},
fail(err) {
uni.showToast({
title: JSON.stringify(err),
icon: 'none'
});
},
complete(e){
uni.hideLoading()
// 取消订阅自定义按钮点击事件
univerifyManager.offButtonsClick(onButtonsClickFn)
}
})
} }
// #endif
uni.login({ uni.login({
"provider": type, "provider": type,
"onlyAuthorize": true, //请勿直接使用前端获取的unionid或openid直接用于登录,前端的数据都是不可靠的
"univerifyStyle": this.univerifyStyle, "univerifyStyle": this.univerifyStyle,
complete: (e) => { complete: (e) => {
console.log(e); console.log(e);
uni.hideLoading()
}, },
success: async e => { success: async e => {
console.log(e); console.log(e);
...@@ -227,32 +265,23 @@ ...@@ -227,32 +265,23 @@
let res = await this.getUserInfo({ let res = await this.getUserInfo({
provider: "apple" provider: "apple"
}) })
uni.hideLoading()
Object.assign(e.authResult, res.userInfo) Object.assign(e.authResult, res.userInfo)
} }
// #ifdef MP-WEIXIN this.login(type == 'weixin' ? e.code : e.authResult, type)
if (type == 'weixin') {
return this.login({
code: e.code
}, type)
}
// #endif
this.login(e.authResult, type)
}, },
fail: (err) => { fail: async (err) => {
uni.hideLoading()
console.log(err); console.log(err);
// 以下代码为兼容旧版(HBuilderX3.2.13之前)HBuilderX3.2.13以上版本可直接删除
if (type == 'univerify') { if (type == 'univerify'&& !uni.getUniverifyManager) {
if (err.metadata && err.metadata.error_data) { if (err.metadata && err.metadata.error_data) {
uni.showToast({ uni.showToast({
title: "一键登录:" + err.metadata.error_data, title: t('oneClickLogin') + ":" + err.metadata.error_data,
icon: 'none' icon: 'none'
}); });
} }
if (err.errMsg) { if (err.errMsg) {
uni.showToast({ uni.showToast({
title: "一键登录:" + err.errMsg, title: t('oneClickLogin') + ":" + err.errMsg,
icon: 'none' icon: 'none'
}); });
} }
...@@ -268,33 +297,37 @@ ...@@ -268,33 +297,37 @@
break; break;
case 30006: case 30006:
uni.showModal({ uni.showModal({
title: "登录服务初始化错误", title: t('loginErr'),
content: err.metadata.error_data, content: err.metadata.error_data,
showCancel: false, showCancel: false,
confirmText: '知道了', confirmText: t('gotIt'),
}); });
break; break;
case "30008": case "30008":
uni.showToast({ console.log('点击了第三方登录,provider:', err.provider);
title: '点击了第三方登陆', //同步一键登录弹出层隐私协议框是否打勾
icon: 'none' let agree = (await uni.getCheckBoxState())[1].state
}); console.log('agree', agree);
console.log('点击了第三方登陆,provider:', err.provider); uni.$emit('setAgreementsAgree', agree)
let { let {
path path
} = this.servicesList.find(item => item.id == err.provider) || {} } = this.univerifyStyle.buttons.list[res.index]
console.log('path', path); console.log('path', path);
if (path && path != this.getRoute(1)) { //存在路径,且并不是当前已经打开的路径 if (path) {
this.to(path) this.to(path)
} else { } else {
this.login_before(err.provider) setTimeout(() => {
console.log('agree', this.agree);
this.login_before(err.provider)
}, 500)
} }
break; break;
default: default:
console.log(err); console.log(err);
break; break;
} }
} }
// 以上代码为兼容旧版(HBuilderX3.2.13之前)HBuilderX3.2.13以上版本可直接删除
} }
}) })
}, },
...@@ -315,18 +348,15 @@ ...@@ -315,18 +348,15 @@
}) => { }) => {
console.log("login-result", result); console.log("login-result", result);
if (result.code === 0) { if (result.code === 0) {
if (type == 'univerify') { delete result.userInfo.token
uni.closeAuthView()
}
uni.hideLoading()
delete result.userInfo.token
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
if (type == 'weixin' && !result.userInfo.nickname) { if (type == 'weixin' && !result.userInfo.nickname) {
return this.$refs.userProfile.open(result.uid) return this.$refs.userProfile.open(result.uid)
} }
// #endif // #endif
if (result.type == "register") {
result.userInfo._id = result.uid
}
this.setUserInfo(result.userInfo) this.setUserInfo(result.userInfo)
loginSuccess(result) loginSuccess(result)
} else { } else {
...@@ -336,14 +366,18 @@ ...@@ -336,14 +366,18 @@
}); });
} }
}, },
complete: () => { complete: (e) => {
console.log(e);
if (type == 'univerify') {
uni.closeAuthView()
}
uni.hideLoading() uni.hideLoading()
} }
}) })
}, },
doUserProfileNext(){ doUserProfileNext() {
loginSuccess() loginSuccess()
}, },
async getUserInfo(e) { async getUserInfo(e) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.getUserInfo({ uni.getUserInfo({
......
...@@ -52,10 +52,10 @@ ...@@ -52,10 +52,10 @@
reverseTimer: null reverseTimer: null
}; };
}, },
computed: { computed: {
innerText() { innerText() {
if (this.reverseNumber == 0) return '获取验证码'; if (this.reverseNumber == 0) return this.$t('common.getVerifyCode');
return '重新发送('+this.reverseNumber+'s)'; return this.$t('smsCode.resendVerifyCode')+ '('+this.reverseNumber+'s)';
} }
}, },
created() { created() {
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
sendMsg() { sendMsg() {
let reg_phone = /^1\d{10}$/; let reg_phone = /^1\d{10}$/;
if(!reg_phone.test(this.phone))return uni.showToast({ if(!reg_phone.test(this.phone))return uni.showToast({
title: '手机号格式错误', title: this.$t('smsCode.phoneErrTip'),
icon: 'none' icon: 'none'
}); });
uniCloud.callFunction({ uniCloud.callFunction({
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
console.log(result); console.log(result);
if(result.code===0){ if(result.code===0){
uni.showToast({ uni.showToast({
title: "短信验证码发送成功", title: this.$t('smsCode.sendSuccessTip'),
icon: 'none' icon: 'none'
}); });
this.reverseNumber = Number(this.count); this.reverseNumber = Number(this.count);
......
export default {
tabbar:'List,Grid,contacts,Mine',
agreementsTitle:'User service agreement,Privacy policy',
common: {
wechatFriends: "friends",
wechatBbs: "bbs",
weibo: "weibo",
more: "more",
agree:"agree",
copy: "copy",
wechatApplet: "applet",
cancelShare: "cancel sharing",
updateSucceeded: "update succeeded",
phonePlaceholder: "Please enter your mobile phone number",
verifyCodePlaceholder: "Please enter the verification code",
newPasswordPlaceholder: "Please enter a new password",
confirmNewPasswordPlaceholder: "Please confirm the new password",
confirmPassword: "Please confirm the password",
verifyCodeSend: "Verification code has been sent to via SMS",
passwordDigits: "The password is 6 - 20 digits",
getVerifyCode: "Get Code",
noAgree: "You have not agreed to the privacy policy agreement",
gotIt: "got it",
login: "sign in",
error: "error",
complete: "complete",
submit: "Submit",
formatErr: "Incorrect mobile phone number format",
sixDigitCode: "Please enter a 6-digit verification code",
resetNavTitle:"Reset password"
},
list: {
inputPlaceholder: "Please enter the search content",
},
search: {
cancelText: "cancel",
searchHistory: "search history",
searchDiscovery: "search discovery",
deleteAll: "delete all",
delete: "delete",
deleteTip: "Are you sure to clear the search history ?",
complete: "complete",
searchHiddenTip: "Current search found hidden",
},
grid: {
grid: "Grid Assembly",
visibleToAll: "Visible to all",
invisibleToTourists: "Invisible to tourists",
adminVisible: "Admin visible",
clickTip: "Click the",
clickTipGrid: "grid",
},
mine: {
showText: "Text",
signIn: "Check In Reward",
signInByAd:"Check In Reward By AD",
toEvaluate: "To Evaluate",
readArticles: "Read Articles",
myScore: "My Score",
invite: "Invite Friends",
feedback: "Problems And Feedback",
settings: "Settings",
about: "About",
checkUpdate: "Check for Updates",
clicked: "You Clicked",
checkScore: "Please check your points after logging in",
currentScore: "The current score is ",
noScore: "There are currently no points",
notLogged: "not logged in",
},
userinfo: {
navigationBarTitle:"My Profile",
ProfilePhoto: "Profile Photo",
nickname: "Nickname",
notSet: "not set",
phoneNumber: "Phone Number",
notSpecified: "Not Specified",
setNickname: "Set Nickname ",
setNicknamePlaceholder: "Please enter a nickname to set",
bindPhoneNumber: "One click binding of local number",
bindOtherLogin: "Other number binding",
noChange: "No change",
uploading: "uploading",
requestFail: "Request for service failed",
setting: "setting",
deleteSucceeded: "Delete succeeded",
setSucceeded: "Set successfully",
},
smsCode: {
resendVerifyCode: "resend",
phoneErrTip: "Mobile phone number format error",
sendSuccessTip: "SMS verification code sent successfully",
},
loadMore: {
noData: "No Data",
noNetwork: "Network error",
toSet: "Go to settings",
error: "error",
},
uniFeedback: {
navigationBarTitle: "Problems and feedback",
msgTitle: "Message content",
imgTitle: "Picture list",
contacts: "contacts",
phone: "contact number",
submit: "submit",
},
settings: {
navigationBarTitle:"Settings",
userInfo: "Personal Data",
changePassword: "change password",
clearTmp: "clean cache",
pushServer: "push function",
fingerPrint: "fingerprint unlock",
facial: "face unlock",
deactivate: "Deactivate",
logOut: "Logout",
login: "Login",
changeLanguage: "Language",
please: "please",
successText: "success",
failTip: "Authentication failed. Please try again",
authFailed: "authentication failed",
deviceNoOpen: "The device is not turned on",
fail: "fail",
tips: "tips",
exitLogin: "Do you want to log out?",
cancelText: "cancel",
confirmText: "confirm",
clearing: "clearing",
clearedSuccessed: "Cleared successfully",
},
deactivate: {
cancelText: "cancel",
nextStep: "next step",
navigationBarTitle:"Logout prompt"
},
about: {
sacnQR: "Scan the QR Code and your friends can also download it",
client: "applCantion",
and: "And",
about: "About",
},
invite: {
download: "Download",
},
login: {
phoneLogin: "After logging in, you can show yourself",
phoneLoginTip: "Unregistered mobile phone numbers will be automatically registered after verification",
getVerifyCode: "Get Code",
},
uniQuickLogin: {
accountLogin: "Account",
SMSLogin: "SMS",
wechatLogin: "wechat",
appleLogin: "Apple",
oneClickLogin: "One click login",
QQLogin: "QQ",
xiaomiLogin: "Xiaomi",
getProviderFail: "Failed to get service provider",
loginErr: "Login service initialization error",
chooseOtherLogin: "Click the third-party login",
},
pwdLogin: {
pwdLogin: "User name password login",
placeholder: "Please enter mobile number / user name",
passwordPlaceholder: "Please input a password",
verifyCodePlaceholder: "Please enter the verification code",
login: "sign in",
forgetPassword: "Forget password",
register: "Registered account",
},
register: {
navigationBarTitle:"register",
usernamePlaceholder: "Please enter user name",
nicknamePlaceholder: "Please enter user nickname",
passwordDigitsPlaceholder: "Please enter a 6-20 digit password",
passwordAgain: "Enter the password again",
registerAndLogin: "Register and log in",
},
listDetail: {
follow: "Click follow",
newsErr: "Error, news ID is empty",
},
newsLog:{
navigationBarTitle:"Reading Log"
},
bindMobile:{
navigationBarTitle:"Bind Mobile"
}
}
import langEn from './en'
import zhHans from './zh-Hans'
import uniStarterConfig from '../uni-starter.config.js'
const {i18n:{enable:i18nEnable} }= uniStarterConfig
const messages = {
'en': langEn,
'zh-Hans': zhHans
}
let currentLang
if(i18nEnable){
currentLang = uni.getStorageSync('CURRENT_LANG')
}else{
currentLang = "zh-Hans"
}
// console.log(uni.getStorageSync('CURRENT_LANG'),currentLang);
if (!currentLang) {
if (uni.getLocale) {
console.log('获取应用语言:', uni.getLocale());
let language = 'en'
if (uni.getLocale() != 'en') {
language = 'zh-Hans'
}
uni.setStorageSync('CURRENT_LANG', language)
currentLang = language
} else {
uni.getSystemInfo({
success: function(res) {
console.log('获取设备信息:', res);
let language = 'zh-Hans'
if (res.language == 'en') {
language = 'en'
}
uni.setStorageSync('CURRENT_LANG', language)
currentLang = language
},
fail: (err) => {
console.error(err)
}
})
}
}
let i18nConfig = {
locale: currentLang, // set locale
messages // set locale messages
}
// #ifdef VUE2
import Vue from 'vue'
import VueI18n from 'vue-i18n'
Vue.use(VueI18n)
const i18n = new VueI18n(i18nConfig)
// #endif
// #ifdef VUE3
import {
createI18n
} from 'vue-i18n'
const i18n = createI18n(i18nConfig)
// #endif
export default i18n
if(i18nEnable){
console.log(`
你已开启多语言国际化,将自动根据语言获取【lang/en.js】或【lang/en.js】文件中配置的tabbar的值,
覆盖你在pages.json中的tabbar的值
如果你不需要多语言国际化,请打开配置文件uni-starter.config.js找到 -> i18n -> enable把值设置为false
`);
let initLanguageAfter = () => {
function $i18n(e){
// #ifdef VUE3
return i18n.global.messages[i18n.global.locale][e]
// #endif
return i18n.messages[i18n.locale][e]
}
setTimeout(function(){
//底部tabbar更新
$i18n('tabbar').split(',').forEach((text, index) => {
// console.log(text);
uni.setTabBarItem({
index,
text,
complete: e => {
// console.log("e: " + JSON.stringify(e));
}
})
})
},1)
//更新 uni-starter.config agreements
let agreementsTitle = $i18n('agreementsTitle').split(',')
let agreements = uniStarterConfig.about.agreements
agreements[0].title = agreementsTitle[0]
agreements[1].title = agreementsTitle[1]
uniStarterConfig.about.agreements = agreements
}
initLanguageAfter()
uni.$on('changeLanguage', e => {
console.log('changeLanguage', e);
initLanguageAfter(e)
})
}
\ No newline at end of file
export default {
tabbar:'列表,宫格,通讯录,我的',
agreementsTitle:'用户服务协议,隐私政策',
common:{
wechatFriends: "微信好友",
wechatBbs: "微信朋友圈",
weibo:"微博",
more: "更多",
agree:"同意",
copy: "复制",
wechatApplet: "微信小程序",
cancelShare: "取消分享",
updateSucceeded: "更新成功",
phonePlaceholder: "请输入手机号",
verifyCodePlaceholder: "请输入验证码",
newPasswordPlaceholder: "请输入新密码",
confirmNewPasswordPlaceholder: "请确认新密码",
confirmPassword: "请确认密码",
verifyCodeSend: "验证码已通过短信发送至",
passwordDigits: "密码为6 - 20位",
getVerifyCode: "获取验证码",
noAgree: "你未同意隐私政策协议",
gotIt: "知道了",
login: "登录",
error: "错误",
complete: "完成",
submit: "提交",
formatErr:"手机号码格式不正确",
sixDigitCode:"请输入6位验证码",
resetNavTitle:"重置密码"
},
list: {
inputPlaceholder: "请输入搜索内容",
},
search:{
cancelText: '取消',
searchHistory: "搜索历史",
searchDiscovery: "搜索发现",
deleteAll: "全部删除",
delete: "删除",
deleteTip: "确认清空搜索历史吗?",
complete: "完成",
searchHiddenTip: "当前搜索发现已隐藏",
},
grid:{
grid: "宫格组件",
visibleToAll: "所有人可见",
invisibleToTourists: "游客不可见",
adminVisible: "管理员可见",
clickTip: "点击第",
clickTipGrid: "个宫格",
},
mine:{
showText: "文字",
signIn: "普通签到",
signInByAd:"看广告签到",
toEvaluate: "去评分",
readArticles: "阅读过的文章",
myScore: "我的积分",
invite: "分销推荐",
feedback: "问题与反馈",
settings: "设置",
checkUpdate: "检查更新",
about: "关于",
clicked: "你点击了",
checkScore: "请登录后查看积分",
currentScore: "当前积分为",
noScore: "当前无积分",
notLogged: "未登录",
},
userinfo:{
navigationBarTitle:"个人资料",
ProfilePhoto: "头像",
nickname: "昵称",
notSet: "未设置",
phoneNumber: "手机号",
notSpecified: "未绑定",
setNickname: "设置昵称",
setNicknamePlaceholder: "请输入要设置的昵称",
bindPhoneNumber: "本机号码一键绑定",
bindOtherLogin: "其他号码绑定",
noChange: "没有变化",
uploading: "正在上传",
requestFail: "请求服务失败",
setting: "设置中",
deleteSucceeded: "删除成功",
setSucceeded: "设置成功",
},
smsCode:{
resendVerifyCode: "重新发送",
phoneErrTip: "手机号格式错误",
sendSuccessTip: "短信验证码发送成功",
},
loadMore:{
noData: "暂无数据",
noNetwork: "网络异常",
toSet: "前往设置",
error: "错误",
},
uniFeedback:{
navigationBarTitle:"问题与反馈",
msgTitle: "留言内容",
imgTitle: "图片列表",
contacts: "联系人",
phone: "联系电话",
submit: "提交",
},
settings:{
navigationBarTitle:"设置",
userInfo: "个人资料",
changePassword: "修改密码",
clearTmp: "清理缓存",
pushServer: "推送功能",
fingerPrint: "指纹解锁",
facial: "人脸解锁",
deactivate: "注销账号",
logOut: "退出登录",
login: "登录",
failTip: "认证失败请重试",
authFailed: "认证失败",
changeLanguage: "切换语言",
please: "请用",
successText: "成功",
deviceNoOpen: "设备未开启",
fail: "失败",
tips: "提示",
exitLogin: "是否退出登录?",
clearing: "清除中",
clearedSuccessed: "清除成功",
confirmText: "确定",
cancelText: '取消',
},
deactivate:{
cancelText: '取消',
nextStep: "下一步",
navigationBarTitle:"注销提示"
},
about:{
sacnQR: "扫描二维码,您的朋友也可以下载",
client: "客户端",
and: "",
about: "关于",
},
invite:{
download: "下载",
},
login:{
phoneLogin: "登录后即可展示自己",
phoneLoginTip: "未注册的手机号验证通过后将自动注册",
getVerifyCode: "获取验证码",
},
uniQuickLogin:{
accountLogin: "账号登录",
SMSLogin: "短信验证码",
wechatLogin: "微信登录",
appleLogin: "苹果登录",
oneClickLogin: "一键登录",
QQLogin: "QQ登录",
xiaomiLogin: "小米登录",
getProviderFail: "获取服务供应商失败",
loginErr: "登录服务初始化错误",
chooseOtherLogin: "点击了第三方登录",
},
pwdLogin:{
pwdLogin: "用户名密码登录",
placeholder: "请输入手机号/用户名",
passwordPlaceholder: "请输入密码",
verifyCodePlaceholder: "请输入验证码",
login: "登录",
forgetPassword: "忘记密码",
register: "注册账号",
},
register:{
navigationBarTitle:"注册",
usernamePlaceholder: "请输入用户名",
nicknamePlaceholder: "请输入用户昵称",
registerAndLogin: "注册并登录",
passwordDigitsPlaceholder: "请输入6-20位密码",
passwordAgain: "再次输入密码",
},
listDetail:{
follow: "点击关注",
newsErr: "出错了,新闻ID为空",
},
newsLog:{
navigationBarTitle:"阅读记录"
},
bindMobile:{
navigationBarTitle:"绑定手机号码"
}
}
import App from './App' import App from './App'
import store from './store' import store from './store'
import i18n from './lang/i18n'
// #ifndef VUE3 // #ifndef VUE3
import Vue from 'vue' import Vue from 'vue'
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.prototype.$store = store Vue.prototype.$store = store
App.mpType = 'app' App.mpType = 'app'
const app = new Vue({ const app = new Vue({
i18n,
store, store,
...App ...App
}) })
...@@ -16,12 +18,11 @@ app.$mount() ...@@ -16,12 +18,11 @@ app.$mount()
// #ifdef VUE3 // #ifdef VUE3
import { import {createSSRApp} from 'vue'
createSSRApp
} from 'vue'
export function createApp() { export function createApp() {
const app = createSSRApp(App) const app = createSSRApp(App)
app.use(i18n)
app.use(store) app.use(store)
return {app} return {app}
} }
......
...@@ -6,6 +6,27 @@ ...@@ -6,6 +6,27 @@
"versionCode": "100", "versionCode": "100",
"transformPx": false, "transformPx": false,
"app-plus": { "app-plus": {
"locales": {
"en": {
"name": "uni-starter",
"android": {
"strings": {
"CustomKey": "CustomValue"
}
},
"ios": {
"privacyDescription": {
"NSPhotoLibraryUsageDescription": "access to the user’s photo library(read)"
},
"infoPlist": {
"CustomKey": "CustomValue"
}
}
},
"zh": {
"name": "统一应用基本项目"
}
},
"privacy": { "privacy": {
"prompt": "template", "prompt": "template",
"template": { "template": {
...@@ -28,12 +49,20 @@ ...@@ -28,12 +49,20 @@
"delay": 0 "delay": 0
}, },
"modules": { "modules": {
"Fingerprint": {}, "Fingerprint": {
"Share": {}, },
"OAuth": {}, "Share": {
"FaceID": {}, },
"Push": {}, "OAuth": {
"Geolocation": {} },
"FaceID": {
},
"Geolocation": {
},
"Bluetooth": {
},
"Push": {
}
}, },
"distribute": { "distribute": {
"android": { "android": {
...@@ -55,7 +84,11 @@ ...@@ -55,7 +84,11 @@
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>", "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>" "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
], ],
"abiFilters": ["armeabi-v7a", "arm64-v8a", "x86"] "abiFilters": [
"armeabi-v7a",
"arm64-v8a",
"x86"
]
}, },
"ios": { "ios": {
"capabilities": { "capabilities": {
...@@ -68,22 +101,40 @@ ...@@ -68,22 +101,40 @@
}, },
"sdkConfigs": { "sdkConfigs": {
"oauth": { "oauth": {
"apple": {}, "apple": {
"univerify": {} },
}, "weixin": {
"ad": {}, "appid": "",
"share": {}, "appsecret": "",
"UniversalLinks": ""
},
"univerify": {
}
},
"ad": {
},
"share": {
"weixin": {
"appid": "",
"UniversalLinks": ""
}
},
"geolocation": { "geolocation": {
"baidu": { "baidu": {
"__platform__": ["ios", "android"], "__platform__": [
"ios",
"android"
],
"appkey_ios": "请填写地图的key", "appkey_ios": "请填写地图的key",
"appkey_android": "请填写地图的key" "appkey_android": "请填写地图的key"
} }
}, },
"push": { "push": {
"unipush": {} "unipush": {
}, }
"payment": {} },
"payment": {
}
}, },
"icons": { "icons": {
"android": { "android": {
...@@ -119,12 +170,14 @@ ...@@ -119,12 +170,14 @@
}, },
"splashscreen": { "splashscreen": {
"iosStyle": "common", "iosStyle": "common",
"androidStyle": "common" "androidStyle": "common",
"useOriginalMsgbox": true
} }
}, },
"nvueLaunchMode": "" "nvueLaunchMode": ""
}, },
"quickapp": {}, "quickapp": {
},
"mp-weixin": { "mp-weixin": {
"appid": "", "appid": "",
"setting": { "setting": {
...@@ -159,6 +212,12 @@ ...@@ -159,6 +212,12 @@
"key": "" "key": ""
} }
} }
},
"router": {
"base": ""
},
"uniStatistics": {
"enable": true
} }
}, },
"_spaceID": "", "_spaceID": "",
......
{ {
"id": "uni-starter", "id": "uni-starter",
"displayName": "uni-starter", "displayName": "uni-starter",
"version": "1.0.48", "version": "1.1.32",
"description": "云端一体应用快速开发基本项目模版", "description": "云端一体应用快速开发基本项目模版",
"keywords": [ "keywords": [
"login", "login",
"登录", "登录",
"搜索", "搜索",
"uni-id例子" "uni-id实例",
"留言板"
], ],
"repository": "https://codechina.csdn.net/dcloud/uni-starter.git", "repository": "https://gitcode.net/dcloud/uni-starter",
"engines": { "engines": {
"HBuilderX": "^3.1.20" "HBuilderX": "^3.2.6"
}, },
"dcloudext": { "dcloudext": {
"category": [ "category": [
...@@ -57,7 +58,7 @@ ...@@ -57,7 +58,7 @@
}, },
"H5-pc": { "H5-pc": {
"Chrome": "y", "Chrome": "y",
"IE": "u", "IE": "n",
"Edge": "u", "Edge": "u",
"Firefox": "u", "Firefox": "u",
"Safari": "u" "Safari": "u"
...@@ -72,12 +73,13 @@ ...@@ -72,12 +73,13 @@
"快应用": { "快应用": {
"华为": "u", "华为": "u",
"联盟": "u" "联盟": "u"
}, },
"Vue": { "Vue": {
"vue2": "y", "vue2": "y",
"vue3": "y" "vue3": "y"
} }
} }
} }
} },
"dependencies": {}
} }
{ {
"pages": [{ "pages": [{
"path": "pages/list/list", "path": "pages/list/list",
"style": { "style": {
"navigationStyle": "custom", // #ifndef APP-PLUS
"enablePullDownRefresh": true "enablePullDownRefresh": true,
} // #endif
}, "navigationStyle": "custom"
{
"path": "pages/product/product",
"style": {
"navigationStyle": "custom",
"enablePullDownRefresh": true
} }
}, },
{ {
...@@ -31,10 +26,8 @@ ...@@ -31,10 +26,8 @@
} }
}, { }, {
"path": "pages/list/search/search", "path": "pages/list/search/search",
"style": { "style": {
//#ifndef MP "navigationBarTitleText":"搜索"
"navigationStyle": "custom"
//#endif
} }
}, { }, {
"path": "pages/list/detail", "path": "pages/list/detail",
...@@ -65,11 +58,6 @@ ...@@ -65,11 +58,6 @@
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, {
"path": "uni_modules/uni-feedback/pages/uni-feedback/uni-feedback",
"style": {
"navigationBarTitleText": "问题反馈"
}
}, { }, {
"path": "pages/ucenter/about/about", "path": "pages/ucenter/about/about",
"style": { "style": {
...@@ -169,8 +157,20 @@ ...@@ -169,8 +157,20 @@
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
}, {
"path": "pages/ucenter/settings/deactivate/deactivate",
"style": {
"navigationBarTitleText": "注销提醒",
"enablePullDownRefresh": false
}
}, {
"path": "uni_modules/uni-feedback/pages/opendb-feedback/opendb-feedback",
"style": {
"navigationBarTitleText": "意见反馈",
"enablePullDownRefresh": false
}
} }
], ],
"globalStyle": { "globalStyle": {
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-starter", "navigationBarTitleText": "uni-starter",
...@@ -184,9 +184,6 @@ ...@@ -184,9 +184,6 @@
}, { }, {
"path": "pages/list/list" "path": "pages/list/list"
}, },
{
"path": "pages/product/product"
},
{ {
"path": "pages/ucenter/login-page/index/index" "path": "pages/ucenter/login-page/index/index"
}, { }, {
...@@ -208,17 +205,13 @@ ...@@ -208,17 +205,13 @@
"iconPath": "static/tabbar/list.png", "iconPath": "static/tabbar/list.png",
"selectedIconPath": "static/tabbar/list_active.png", "selectedIconPath": "static/tabbar/list_active.png",
"text": "列表" "text": "列表"
}, {
"pagePath": "pages/product/product",
"iconPath": "static/tabbar/list.png",
"selectedIconPath": "static/tabbar/list_active.png",
"text": "列表"
}, { }, {
"pagePath": "pages/grid/grid", "pagePath": "pages/grid/grid",
"iconPath": "static/tabbar/grid.png", "iconPath": "static/tabbar/grid.png",
"selectedIconPath": "static/tabbar/grid_active.png", "selectedIconPath": "static/tabbar/grid_active.png",
"text": "宫格" "text": "宫格"
}, { }
, {
"pagePath": "pages/ucenter/ucenter", "pagePath": "pages/ucenter/ucenter",
"iconPath": "static/tabbar/me.png", "iconPath": "static/tabbar/me.png",
"selectedIconPath": "static/tabbar/me_active.png", "selectedIconPath": "static/tabbar/me_active.png",
......
<template> <template>
<view> <view>
<web-view :src="url"></web-view> <web-view v-if="url" :src="url"></web-view>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
onLoad({url,title}) { onLoad({url,title}) {
console.log(url,title); if(url.substring(0, 4) != 'http'){
this.url = url; uni.showModal({
title:"错误",
content: '不是一个有效的网站链接,'+'"'+url+'"',
showCancel: false,
confirmText:"知道了",
complete: () => {
uni.navigateBack()
}
});
title = "页面路径错误"
}else{
console.log(url,title);
this.url = url;
}
if(title){ if(title){
uni.setNavigationBarTitle({title}); uni.setNavigationBarTitle({title});
} }
......
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
</unicloud-db> </unicloud-db>
<!-- 宫格 --> <!-- 宫格 -->
<uni-section title="宫格组件" style="margin: 0;" type="line"></uni-section> <uni-section :title="$t('grid.grid')" style="margin: 0;" type="line"></uni-section>
<view class="example-body"> <view class="example-body">
<uni-grid :column="3" :highlight="true" @change="change"> <uni-grid :column="3" :highlight="true" @change="change">
<template v-for="(item,i) in gridList"> <template v-for="(item,i) in gridList">
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
}, },
data() { data() {
return { return {
gridList: ['所有人可见','所有人可见','所有人可见', '游客不可见', '游客不可见', '游客不可见','管理员可见','管理员可见','管理员可见'], gridList: [],
current: 0, current: 0,
swiperDotIndex: 0 swiperDotIndex: 0
} }
...@@ -60,12 +60,25 @@ ...@@ -60,12 +60,25 @@
computed: { computed: {
...mapGetters({ ...mapGetters({
hasLogin: 'user/hasLogin' hasLogin: 'user/hasLogin'
}) })
},
onLoad() {
let gridList = []
for (var i = 0; i < 3; i++) {
gridList.push( this.$t('grid.visibleToAll') )
}
for (var i = 0; i < 3; i++) {
gridList.push( this.$t('grid.invisibleToTourists') )
}
for (var i = 0; i < 3; i++) {
gridList.push( this.$t('grid.adminVisible') )
}
this.gridList = gridList
}, },
methods: { methods: {
change(e) { change(e) {
uni.showToast({ uni.showToast({
title: `点击第${e.detail.index}个宫格`, title:this.$t('grid.clickTip') + " " + `${e.detail.index}` + " " + this.$t('grid.clickTipGrid'),
icon: 'none' icon: 'none'
}) })
}, },
...@@ -144,6 +157,7 @@ ...@@ -144,6 +157,7 @@
} }
.text { .text {
text-align: center;
font-size: 26rpx; font-size: 26rpx;
margin-top: 10rpx; margin-top: 10rpx;
} }
......
...@@ -17,18 +17,22 @@ ...@@ -17,18 +17,22 @@
<template v-if="!loading && data"> <template v-if="!loading && data">
<uni-list :border="false"> <uni-list :border="false">
<uni-list-item thumbSize="lg" :thumb="data.image"> <uni-list-item thumbSize="lg" :thumb="data.image">
<!-- 通过body插槽定义作者信息内容 --> <!-- 通过body插槽定义作者信息内容 -->
<view slot="body" class="header-content"> <template v-slot:body>
<view class="uni-title">{{data.user_id && data.user_id[0].username}}</view> <view class="header-content">
</view> <view class="uni-title">{{data.user_id && data.user_id[0].username}}</view>
<view slot="footer" class="footer"> </view>
<view class="uni-note">更新于 </template>
<uni-dateformat :date="data.last_modify_date" format="yyyy-MM-dd hh:mm" <template v-slot:footer>
:threshold="[60000, 2592000000]" /> <view class="footer">
</view> <view class="uni-note">更新于
</view> <uni-dateformat :date="data.last_modify_date" format="yyyy-MM-dd hh:mm"
:threshold="[60000, 2592000000]" />
</view>
</view>
</template>
</uni-list-item> </uni-list-item>
</uni-list> </uni-list>
<view class="banner"> <view class="banner">
<!-- 文章开头,缩略图 --> <!-- 文章开头,缩略图 -->
<image class="banner-img" :src="data.avatar" mode="widthFix"></image> <image class="banner-img" :src="data.avatar" mode="widthFix"></image>
...@@ -37,7 +41,7 @@ ...@@ -37,7 +41,7 @@
<text class="uni-ellipsis">{{data.excerpt}}</text> <text class="uni-ellipsis">{{data.excerpt}}</text>
</view> </view>
</view> </view>
<view class="article-content"> <view class="article-content">
<rich-text :nodes="data.content"></rich-text> <rich-text :nodes="data.content"></rich-text>
</view> </view>
</template> </template>
...@@ -46,14 +50,29 @@ ...@@ -46,14 +50,29 @@
</template> </template>
<script> <script>
import uniShare from '@/uni_modules/uni-share/js_sdk/uni-share.js'; // #ifdef APP
import UniShare from '@/uni_modules/uni-share/js_sdk/uni-share.js';
const uniShare = new UniShare()
// #endif
const db = uniCloud.database(); const db = uniCloud.database();
const readNewsLog = db.collection('read-news-log') const readNewsLog = db.collection('read-news-log')
import { import {
mapGetters mapGetters
} from 'vuex'; } from 'vuex';
export default { export default {
// #ifdef APP
onBackPress({from}) {
if(from == 'backbutton'){
if(uniShare.isShow){
this.$nextTick(function(){
console.log(uniShare);
uniShare.hide()
})
}
return uniShare.isShow;
}
},
// #endif
data() { data() {
return { return {
// 当前显示 _id // 当前显示 _id
...@@ -64,29 +83,28 @@ ...@@ -64,29 +83,28 @@
field: 'user_id.username,user_id._id,avatar,excerpt,last_modify_date,comment_count,like_count,title,content', field: 'user_id.username,user_id._id,avatar,excerpt,last_modify_date,comment_count,like_count,title,content',
formData: { formData: {
noData: '<p style="text-align:center;color:#666">详情加载中...</p>' noData: '<p style="text-align:center;color:#666">详情加载中...</p>'
}, }
} }
}, },
computed: { computed: {
//拼接where条件
//查询条件 ,更多详见 :https://uniapp.dcloud.net.cn/uniCloud/unicloud-db?id=jsquery
where() {
return `_id =="${this.id}"`
},
...mapGetters({ ...mapGetters({
'userInfo': 'user/info', 'userInfo': 'user/info',
'hasLogin': 'user/hasLogin' 'hasLogin': 'user/hasLogin'
}), }),
uniStarterConfig() { uniStarterConfig() {
return getApp().globalData.config return getApp().globalData.config
},
where(){
//拼接where条件 查询条件 ,更多详见 :https://uniapp.dcloud.net.cn/uniCloud/unicloud-db?id=jsquery
return `_id =="${this.id}"`
} }
}, },
onLoad(event) { onLoad(event) {
console.log(event); console.log(event);
// event = {"id":"60783c5cb781700001375672","title":"阿里小程序IDE官方内嵌uni-app,为开发者提供多端开发服务","excerpt":"阿里小程序IDE官方内嵌uni-app,为开发者提供多端开发服务","avatar":"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-aliyun-gacrhzeynhss7c6d04/249516a0-3941-11eb-899d-733ae62bed2f.jpg"} // event = {"id":"60783c5cb781700001375672","title":"阿里小程序IDE官方内嵌uni-app,为开发者提供多端开发服务","excerpt":"阿里小程序IDE官方内嵌uni-app,为开发者提供多端开发服务","avatar":"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-aliyun-gacrhzeynhss7c6d04/249516a0-3941-11eb-899d-733ae62bed2f.jpg"}
//获取真实新闻id,通常 id 来自上一个页面 //获取真实新闻id,通常 id 来自上一个页面
if (event.id) { if (event.id) {
this.id = event.id this.id = event.id
} }
//若上一页传递了标题过来,则设置导航栏标题 //若上一页传递了标题过来,则设置导航栏标题
if (event.title) { if (event.title) {
...@@ -96,23 +114,26 @@ ...@@ -96,23 +114,26 @@
}) })
} }
}, },
onNavigationBarButtonTap(event) {
if (event.type == 'share') {
this.shareClick();
}
},
onReady() { onReady() {
// 开始加载数据,修改 where 条件后才开始去加载 clinetDB 的数据 ,需要等组件渲染完毕后才开始执行 loadData,所以不能再 onLoad 中执行 // 开始加载数据,修改 where 条件后才开始去加载 clinetDB 的数据 ,需要等组件渲染完毕后才开始执行 loadData,所以不能再 onLoad 中执行
if (this.id) { // ID 不为空,则发起查询 if (this.id) { // ID 不为空,则发起查询
this.$refs.detail.loadData() this.$refs.detail.loadData()
} else { } else {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: '出错了,新闻ID为空' title: this.$t('listDetail').newsErr
}) })
} }
},
onNavigationBarButtonTap(event) {
if (event.type == 'share') {
this.shareClick();
}
}, },
methods: { methods: {
$log(...args){
console.log('args',...args,this.id)
},
setReadNewsLog(){ setReadNewsLog(){
let item = { let item = {
"article_id":this.id, "article_id":this.id,
...@@ -172,96 +193,98 @@ ...@@ -172,96 +193,98 @@
*/ */
followClick() { followClick() {
uni.showToast({ uni.showToast({
title: '点击关注', title:this.$t('listDetail').follow,
icon: 'none' icon: 'none'
}); });
}, },
/** /**
* 分享该文章 * 分享该文章
*/ */
shareClick() { // #ifdef APP
let { shareClick() {
_id, let {
title, _id,
excerpt, title,
avatar excerpt,
avatar
} = this.$refs.detail.dataList } = this.$refs.detail.dataList
console.log( JSON.stringify({ console.log( JSON.stringify({
_id, _id,
title, title,
excerpt, excerpt,
avatar avatar
}) ); }) );
uniShare({ uniShare.show({
content: { //公共的分享类型(type)、链接(herf)、标题(title)、summary(描述)、imageUrl(缩略图) content: { //公共的分享类型(type)、链接(herf)、标题(title)、summary(描述)、imageUrl(缩略图)
type: 0, type: 0,
href: this.uniStarterConfig.h5.url + `/#/pages/list/detail?id=${_id}&title=${title}`, href: this.uniStarterConfig.h5.url + `/#/pages/list/detail?id=${_id}&title=${title}`,
title: this.title, title: this.title,
summary: excerpt, summary: excerpt,
imageUrl: avatar + '?x-oss-process=image/resize,m_fill,h_100,w_100' //压缩图片解决,在ios端分享图过大导致的图片失效问题 imageUrl: avatar + '?x-oss-process=image/resize,m_fill,h_100,w_100' //压缩图片解决,在ios端分享图过大导致的图片失效问题
}, },
menus: [{ menus: [{
"img": "/static/app-plus/sharemenu/wechatfriend.png", "img": "/static/app-plus/sharemenu/wechatfriend.png",
"text": "微信好友", "text": this.$t('common').wechatFriends,
"share": { "share": {
"provider": "weixin", "provider": "weixin",
"scene": "WXSceneSession" "scene": "WXSceneSession"
} }
}, },
{ {
"img": "/static/app-plus/sharemenu/wechatmoments.png", "img": "/static/app-plus/sharemenu/wechatmoments.png",
"text": "微信朋友圈", "text": this.$t('common').wechatBbs,
"share": { "share": {
"provider": "weixin", "provider": "weixin",
"scene": "WXSenceTimeline" "scene": "WXSceneTimeline"
} }
}, },
{ {
"img": "/static/app-plus/sharemenu/mp_weixin.png", "img": "/static/app-plus/sharemenu/mp_weixin.png",
"text": "微信小程序", "text": this.$t('common').wechatApplet,
"share": { "share": {
provider: "weixin", provider: "weixin",
scene: "WXSceneSession", scene: "WXSceneSession",
type: 5, type: 5,
miniProgram: { miniProgram: {
id: this.uniStarterConfig.mp.weixin.id, id: this.uniStarterConfig.mp.weixin.id,
path: `/pages/list/detail?id=${_id}&title=${title}`, path: `/pages/list/detail?id=${_id}&title=${title}`,
webUrl: this.uniStarterConfig.h5.url + webUrl: this.uniStarterConfig.h5.url +
`/#/pages/list/detail?id=${_id}&title=${title}`, `/#/pages/list/detail?id=${_id}&title=${title}`,
type: 0 type: 0
}, },
} }
}, },
{ {
"img": "/static/app-plus/sharemenu/weibo.png", "img": "/static/app-plus/sharemenu/weibo.png",
"text": "微博", "text": this.$t('common').weibo,
"share": { "share": {
"provider": "sinaweibo" "provider": "sinaweibo"
} }
}, },
{ {
"img": "/static/app-plus/sharemenu/qq.png", "img": "/static/app-plus/sharemenu/qq.png",
"text": "QQ", "text": "QQ",
"share": { "share": {
"provider": "qq" "provider": "qq"
} }
}, },
{ {
"img": "/static/app-plus/sharemenu/copyurl.png", "img": "/static/app-plus/sharemenu/copyurl.png",
"text": "复制", "text": this.$t('common').copy,
"share": "copyurl" "share": "copyurl"
}, },
{ {
"img": "/static/app-plus/sharemenu/more.png", "img": "/static/app-plus/sharemenu/more.png",
"text": "更多", "text": this.$t('common').more,
"share": "shareSystem" "share": "shareSystem"
} }
], ],
cancelText: "取消分享", cancelText: this.$t('common').cancelShare,
}, e => { //callback }, e => { //callback
// console.log(e); console.log(e);
}) })
}, }
// #endif
} }
} }
</script> </script>
......
<template>
<view class="pages">
<!-- #ifndef H5 -->
<statusBar></statusBar>
<!-- #endif -->
<!-- 搜索功能 -->
<view class="uni-search-box">
<uni-search-bar v-model="keyword" ref="searchBar" radius="100" cancelButton="none" disabled
:placeholder="inputPlaceholder" />
<view class="cover-search-bar" @click="searchClick"></view>
</view>
<unicloud-db ref='udb' v-slot:default="{data,pagination,hasMore, loading, error, options}" @error="onqueryerror"
:collection="colList" :page-size="10"
>
<!-- 基于 uni-list 的页面布局 field="user_id.username"-->
<uni-list class="uni-list" :border="false" :style="{height:listHight}">
<!-- 作用于app端nvue页面的下拉加载 -->
<!-- #ifdef APP-NVUE -->
<refreshBox @refresh="refresh" :loading="loading"></refreshBox>
<!-- #endif -->
<!-- 列表渲染 -->
<uni-list-item :to="'/pages/list/detail?id='+item._id+'&title='+item.title" v-for="(item,index) in data"
:key="index">
<!-- 通过header插槽定义列表左侧图片 -->
<template v-slot:header>
<image class="avatar" :src="item.avatar" mode="aspectFill"></image>
</template>
<!-- 通过body插槽定义布局 -->
<template v-slot:body>
<view class="main">
<text class="title">{{item.title}}</text>
<view class="info">
<text class="author">{{item.user_id[0]?item.user_id[0].username:''}}</text>
<uni-dateformat class="last_modify_date" :date="item.last_modify_date"
format="yyyy-MM-dd" :threshold="[60000, 2592000000]" />
</view>
</view>
</template>
</uni-list-item>
<!-- 加载状态:上拉加载更多,加载中,没有更多数据了,加载错误 -->
<!-- #ifdef APP-PLUS -->
<uni-list-item>
<template v-slot:body>
<!-- #endif -->
<uni-load-state @networkResume="refresh" :state="{data,pagination,hasMore, loading, error}"
@loadMore="loadMore">
</uni-load-state>
<!-- #ifdef APP-PLUS -->
</template>
</uni-list-item>
<!-- #endif -->
</uni-list>
</unicloud-db>
</view>
</template>
<script>
var cdbRef, currentWebview;
import statusBar from "@/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-status-bar";
import Gps from '@/uni_modules/json-gps/js_sdk/gps.js';
const gps = new Gps(),db = uniCloud.database();
export default {
components: {
statusBar
},
computed: {
inputPlaceholder(e) {
if (uni.getStorageSync('CURRENT_LANG') == "en") {
return 'Please enter the search content'
} else {
return '请输入搜索内容'
}
},
colList(){
return [
db.collection('opendb-news-articles').where(this.where).field('avatar,title,last_modify_date,user_id').getTemp(),
db.collection('uni-id-users').field('_id,username').getTemp()
]
}
},
data() {
return {
where: '"article_status" == 1',
keyword: "",
showRefresh: false,
listHight: 0
}
},
watch: {
keyword(keyword, oldValue) {
let where = '"article_status" == 1 '
if (keyword) {
this.where = where + `&& /${keyword}/.test(title)`;
} else {
this.where = where;
}
}
},
async onReady() {
// #ifdef APP-NVUE
/* 可用窗口高度 - 搜索框高 - 状态栏高 */
this.listHight = uni.getSystemInfoSync().windowHeight - uni.getSystemInfoSync().statusBarHeight - 50 + 'px';
// #endif
// #ifndef APP-NVUE
this.listHight = 'auto'
// #endif
cdbRef = this.$refs.udb
},
async onShow() {
this.keyword = getApp().globalData.searchText
getApp().globalData.searchText = ''
//这里仅演示如何,在onShow生命周期获取设备位置,并在设备或者应用没有权限时自动引导。设置完毕自动重新获取。
//你可以基于他做自己的业务,比如:根据距离由近到远排序列表数据等
// uni.showLoading({
// title:"获取定位中"
// });
//默认h5端不获取定位
// #ifndef H5
let location = await gps.getLocation({
geocode: true
})
console.log(location);
// #endif
// if(location){
// uni.showToast({
// title: JSON.stringify(location),
// icon: 'none'
// });
// }
// uni.hideLoading()
},
methods: {
searchClick(e) { //点击搜索框
uni.hideKeyboard();
uni.navigateTo({
url: '/pages/list/search/search',
animationType: 'fade-in'
});
},
retry() {
this.refresh()
},
refresh() {
cdbRef.loadData({
clear: true
}, () => {
uni.stopPullDownRefresh()
// #ifdef APP-NVUE
this.showRefresh = false
// #endif
console.log('end');
})
console.log('refresh');
},
loadMore() {
cdbRef.loadMore()
},
onqueryerror(e) {
console.error(e);
},
onpullingdown(e) {
console.log(e);
this.showRefresh = true
if(e.pullingDistance>100){
this.refresh()
}
}
},
// #ifndef APP-NVUE
onPullDownRefresh() {
this.refresh()
},
onReachBottom() {
this.loadMore()
}
// #endif
}
</script>
<style scoped>
/* #ifndef APP-NVUE */
view {
display: flex;
box-sizing: border-box;
flex-direction: column;
}
/* #endif */
.pages {
background-color: #FFFFFF;
}
.avatar {
width: 200rpx;
height: 200rpx;
margin-right: 10rpx;
}
.main {
justify-content: space-between;
}
.title {
width: 480rpx;
font-size: 32rpx;
}
.info {
flex-direction: row;
justify-content: space-between;
}
.author,
.last_modify_date {
font-size: 28rpx;
color: #999999;
}
.uni-search-box {
background-color: #FFFFFF;
position: sticky;
height: 50px;
top: 0;
left: 0;
/* #ifndef APP-PLUS */
z-index: 9;
/* #endif */
/* #ifdef MP-WEIXIN */
width: 580rpx;
/* #endif */
}
.cover-search-bar {
height: 50px;
position: relative;
top: -50px;
margin-bottom: -50px;
/* #ifndef APP-NVUE */
z-index: 999;
/* #endif */
}
</style>
<template> <template>
<view class="container"> <view class="container">
<view class="status-bar" :style="{height:statusBarHeight}"></view>
<view class="search-container"> <view class="search-container">
<!-- 搜索框 --> <!-- 搜索框 -->
<view class="search-container-bar"> <view class="search-container-bar">
...@@ -9,7 +8,7 @@ ...@@ -9,7 +8,7 @@
<!-- #endif --> <!-- #endif -->
<!-- :cancelText="keyBoardPopup ? '取消' : '搜索'" --> <!-- :cancelText="keyBoardPopup ? '取消' : '搜索'" -->
<uni-search-bar ref="searchBar" style="flex:1;" radius="100" v-model="searchText" :focus="focus" :placeholder="hotWorld" <uni-search-bar ref="searchBar" style="flex:1;" radius="100" v-model="searchText" :focus="focus" :placeholder="hotWorld"
clearButton="auto" cancelButton="always" @clear="clear" @confirm="confirm" @cancel="backPage" /> clearButton="auto" cancelButton="always" @clear="clear" @confirm="confirm" @cancel="cancel" />
</view> </view>
</view> </view>
<view class="search-body"> <view class="search-body">
...@@ -24,7 +23,7 @@ ...@@ -24,7 +23,7 @@
<text style="font-size: 22rpx;color: #c0402b;padding-top:4rpx;padding-bottom:4rpx;padding-left:20rpx;" @click="localSearchListDel = false">完成</text> <text style="font-size: 22rpx;color: #c0402b;padding-top:4rpx;padding-bottom:4rpx;padding-left:20rpx;" @click="localSearchListDel = false">完成</text>
</view> </view>
</view> </view>
<view class="word-container_body"> <view class="word-container_body">
<view class="flex-center flex-row word-container_body-text" v-for="(word,index) in localSearchList" :key="index" <view class="flex-center flex-row word-container_body-text" v-for="(word,index) in localSearchList" :key="index"
@click="LocalSearchlistItemClick(word,index)"> @click="LocalSearchlistItemClick(word,index)">
...@@ -43,7 +42,7 @@ ...@@ -43,7 +42,7 @@
<uni-icons class="search-icons" style="padding-right: 0;" :color="iconColor" size="18" :type="netHotListIsHide ? 'eye-slash' : 'eye'" <uni-icons class="search-icons" style="padding-right: 0;" :color="iconColor" size="18" :type="netHotListIsHide ? 'eye-slash' : 'eye'"
@click="netHotListIsHide = !netHotListIsHide"></uni-icons> @click="netHotListIsHide = !netHotListIsHide"></uni-icons>
</view> </view>
<unicloud-db ref="udb" #default="{data, loading, error, options}" field="content" collection="opendb-search-hot" <unicloud-db ref="udb" #default="{data, loading, error, options}" field="content" collection="opendb-search-hot"
orderby="create_date desc,count desc" page-data="replace" :page-size="10"> orderby="create_date desc,count desc" page-data="replace" :page-size="10">
<text v-if="loading && !netHotListIsHide" class="word-container_body-info">正在加载...</text> <text v-if="loading && !netHotListIsHide" class="word-container_body-info">正在加载...</text>
...@@ -62,9 +61,11 @@ ...@@ -62,9 +61,11 @@
</view> </view>
</view> </view>
<!-- 搜索联想 --> <!-- 搜索联想 -->
<view class="search-associative" :style="{marginTop:statusBarHeight}" v-if="associativeShow"> <view class="search-associative" v-if="associativeShow">
<uni-list> <uni-list>
<uni-list-item v-for="(item,index) in associativeList" :key="item._id" :ellipsis="1" :title="item.title" @click="associativeClick(item)" show-extra-icon clickable :extra-icon="{size:18,color:iconColor,type:'search'}" /> <uni-list-item v-for="(item,index) in associativeList" :key="item._id" :ellipsis="1" :title="item.name" @click="associativeClick(item)" show-extra-icon
clickable :extra-icon="{size:18,color:iconColor,type:'search'}" >
</uni-list-item>
</uni-list> </uni-list>
</view> </view>
</view> </view>
...@@ -139,7 +140,6 @@ ...@@ -139,7 +140,6 @@
iconColor: '#999999', iconColor: '#999999',
associativeList: [], associativeList: [],
keyBoardPopup: false, keyBoardPopup: false,
hotWorld: 'DCloud', // 搜索热词,如果没有输入即回车,则搜索热词,但是不会加入搜索记录 hotWorld: 'DCloud', // 搜索热词,如果没有输入即回车,则搜索热词,但是不会加入搜索记录
focus: true, // 是否自动聚焦 focus: true, // 是否自动聚焦
speechEngine: 'iFly' // 语音识别引擎 iFly 讯飞 baidu 百度 speechEngine: 'iFly' // 语音识别引擎 iFly 讯飞 baidu 百度
...@@ -157,6 +157,11 @@ ...@@ -157,6 +157,11 @@
this.searchText = getApp().globalData.searchText; this.searchText = getApp().globalData.searchText;
}, },
computed: {
associativeShow() {
return this.searchText && this.associativeList.length;
}
},
onLoad() { onLoad() {
//#ifdef APP-PLUS //#ifdef APP-PLUS
this.statusBarHeight = `${uni.getSystemInfoSync().statusBarHeight}px`; this.statusBarHeight = `${uni.getSystemInfoSync().statusBarHeight}px`;
...@@ -209,8 +214,8 @@ ...@@ -209,8 +214,8 @@
}, },
LocalSearchListClear() { LocalSearchListClear() {
uni.showModal({ uni.showModal({
content: '确认清空搜索历史吗?', content: "确认清空搜索历史吗",
confirmText: '删除', confirmText: "删除",
confirmColor: 'red', confirmColor: 'red',
cancelColor: '#808080', cancelColor: '#808080',
success: res => { success: res => {
...@@ -302,11 +307,7 @@ ...@@ -302,11 +307,7 @@
uni.navigateBack(); uni.navigateBack();
} }
}, },
computed: {
associativeShow() {
return this.searchText && this.associativeList.length;
}
},
watch: { watch: {
searchText: debounce(function(value) { searchText: debounce(function(value) {
if (value) { if (value) {
......
...@@ -6,12 +6,12 @@ ...@@ -6,12 +6,12 @@
<text class="tip">Version {{version}}</text> <text class="tip">Version {{version}}</text>
<!--Sansnn-uQRCode组件来源,插件市场:https://ext.dcloud.net.cn/plugin?id=1287 微调后--> <!--Sansnn-uQRCode组件来源,插件市场:https://ext.dcloud.net.cn/plugin?id=1287 微调后-->
<Sansnn-uQRCode :text="about.download" :makeOnLoad="true" class="qrcode"></Sansnn-uQRCode> <Sansnn-uQRCode :text="about.download" :makeOnLoad="true" class="qrcode"></Sansnn-uQRCode>
<text class="tip">扫描二维码,您的朋友也可以下载{{about.appName}}客户端</text> <text class="tip">{{$t('about.sacnQR')}} {{about.appName}} {{$t('about.client')}}</text>
</view> </view>
<view class="copyright"> <view class="copyright">
<view class="agreement-box" v-for="(agreement,index) in about.agreements" :key="index"> <view class="agreement-box" v-for="(agreement,index) in about.agreements" :key="index">
<text class="agreement" @click="navigateTo(agreement)">{{agreement.title}}</text> <text class="agreement" @click="navigateTo(agreement)">{{agreement.title}}</text>
<text class="hint" v-if="about.agreements.length-1>index"></text> <text class="hint" v-if="about.agreements.length-1>index">{{$t('about.and')}}</text>
</view> </view>
<text class="hint">Copyright © {{year}}</text> <text class="hint">Copyright © {{year}}</text>
<text class="hint">{{about.company}}</text> <text class="hint">{{about.company}}</text>
...@@ -19,8 +19,21 @@ ...@@ -19,8 +19,21 @@
</view> </view>
</template> </template>
<script> <script>
import uniShare from '@/uni_modules/uni-share/js_sdk/uni-share.js'; // #ifdef APP
export default { import UniShare from '@/uni_modules/uni-share/js_sdk/uni-share.js';
const uniShare = new UniShare()
// #endif
export default {
// #ifdef APP
onBackPress({from}) {
if(from=='backbutton'){
this.$nextTick(function(){
uniShare.hide()
})
return uniShare.isShow;
}
},
// #endif
onLoad() { onLoad() {
// #ifdef APP-PLUS // #ifdef APP-PLUS
this.version = plus.runtime.version this.version = plus.runtime.version
...@@ -42,7 +55,7 @@ ...@@ -42,7 +55,7 @@
created() { created() {
this.about = this.uniStarterConfig.about this.about = this.uniStarterConfig.about
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: '关于' + this.about.appName title: this.$t('about.about')+ " " + this.about.appName
}) })
this.year = (new Date).getFullYear() this.year = (new Date).getFullYear()
}, },
...@@ -53,7 +66,7 @@ ...@@ -53,7 +66,7 @@
slogan, slogan,
logo logo
} = this.about } = this.about
uniShare({ uniShare.show({
content: { //公共的分享类型(type)、链接(herf)、标题(title)、summary(描述)、imageUrl(缩略图) content: { //公共的分享类型(type)、链接(herf)、标题(title)、summary(描述)、imageUrl(缩略图)
type: 0, type: 0,
href: download, href: download,
...@@ -63,7 +76,7 @@ ...@@ -63,7 +76,7 @@
}, },
menus: [{ menus: [{
"img": "/static/app-plus/sharemenu/wechatfriend.png", "img": "/static/app-plus/sharemenu/wechatfriend.png",
"text": "微信好友", "text": this.$t('common').wechatFriends,
"share": { "share": {
"provider": "weixin", "provider": "weixin",
"scene": "WXSceneSession" "scene": "WXSceneSession"
...@@ -71,15 +84,15 @@ ...@@ -71,15 +84,15 @@
}, },
{ {
"img": "/static/app-plus/sharemenu/wechatmoments.png", "img": "/static/app-plus/sharemenu/wechatmoments.png",
"text": "微信朋友圈", "text": this.$t('common').wechatBbs,
"share": { "share": {
"provider": "weixin", "provider": "weixin",
"scene": "WXSenceTimeline" "scene": "WXSceneTimeline"
} }
}, },
{ {
"img": "/static/app-plus/sharemenu/weibo.png", "img": "/static/app-plus/sharemenu/weibo.png",
"text": "微博", "text": this.$t('common').weibo,
"share": { "share": {
"provider": "sinaweibo" "provider": "sinaweibo"
} }
...@@ -93,16 +106,16 @@ ...@@ -93,16 +106,16 @@
}, },
{ {
"img": "/static/app-plus/sharemenu/copyurl.png", "img": "/static/app-plus/sharemenu/copyurl.png",
"text": "复制", "text": this.$t('common').copy,
"share": "copyurl" "share": "copyurl"
}, },
{ {
"img": "/static/app-plus/sharemenu/more.png", "img": "/static/app-plus/sharemenu/more.png",
"text": "更多", "text": this.$t('common').more,
"share": "shareSystem" "share": "shareSystem"
} }
], ],
cancelText: "取消分享", cancelText: this.$t('common').cancelShare,
}, e => { //callback }, e => { //callback
console.log(e); console.log(e);
}) })
...@@ -131,27 +144,29 @@ ...@@ -131,27 +144,29 @@
} }
/* #endif */ /* #endif */
.about { .about {
width: 750upx; width: 750rpx;
flex-direction: column; flex-direction: column;
} }
.box { .box {
margin-top: 100px; margin-top: 60px;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.logoImg { .logoImg {
margin-bottom: 10upx; margin-bottom: 10rpx;
width: 160upx; width: 160rpx;
height: 160upx; height: 160rpx;
border-radius: 15px; border-radius: 15px;
} }
.tip { .tip {
text-align: center;
font-size: 24rpx; font-size: 24rpx;
margin-top: 10px; margin-top: 10px;
padding: 10rpx;
} }
.appName { .appName {
...@@ -161,11 +176,11 @@ ...@@ -161,11 +176,11 @@
} }
.qrcode { .qrcode {
margin-top: 50px; margin-top: 60rpx;
} }
.copyright { .copyright {
width: 750upx; width: 750rpx;
font-size: 32rpx; font-size: 32rpx;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
...@@ -189,4 +204,4 @@ ...@@ -189,4 +204,4 @@
color: #999999; color: #999999;
font-size: 26rpx; font-size: 26rpx;
} }
</style> </style>
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
<image class="logoImg" :src="about.logo"></image> <image class="logoImg" :src="about.logo"></image>
<text class="tip appName">{{about.appName}}</text> <text class="tip appName">{{about.appName}}</text>
<text class="tip">{{about.slogan}}</text> <text class="tip">{{about.slogan}}</text>
<view @click="download" type="default" id="download"> <view @click="download" id="download">
<image v-if="isIos" class="icon" src="@/static/h5/download-app/ios.png" mode="widthFix"></image> <image v-if="isIos" class="icon" src="@/static/h5/download-app/ios.png" mode="widthFix"></image>
<image v-else class="icon" src="@/static/h5/download-app/android.png" mode="widthFix"></image> <image v-else class="icon" src="@/static/h5/download-app/android.png" mode="widthFix"></image>
<text class="download-text">下载</text> <text class="download-text">{{$t('invite.download')}}</text>
</view> </view>
<text class="tip">version {{about.version}}</text> <text class="tip">version {{about.version}}</text>
</view> </view>
...@@ -21,20 +21,20 @@ ...@@ -21,20 +21,20 @@
</template> </template>
<script> <script>
export default { export default {
computed:{ computed: {
uniStarterConfig(){ uniStarterConfig() {
return getApp().globalData.config return getApp().globalData.config
} }
}, },
data() { data() {
return { return {
about:{}, about: {},
code:"", code: "",
isIos:"", isIos: "",
showMask:false, showMask: false,
downloadUrl:{ downloadUrl: {
"ios":"", "ios": "",
"android":"" "android": ""
} }
}; };
}, },
...@@ -42,53 +42,43 @@ ...@@ -42,53 +42,43 @@
this.about = this.uniStarterConfig.about this.about = this.uniStarterConfig.about
this.downloadUrl = this.uniStarterConfig.download this.downloadUrl = this.uniStarterConfig.download
this.year = (new Date).getFullYear() this.year = (new Date).getFullYear()
//判断是否在微信中打开 //判断是否在微信中打开
var userAgent = navigator.userAgent; var userAgent = navigator.userAgent;
var ua = userAgent.toLowerCase(); var ua = userAgent.toLowerCase();
this.isWeixin = ua.indexOf('micromessenger') != -1; this.isWeixin = ua.indexOf('micromessenger') != -1;
if( this.isWeixin ){
//执行逻辑
}else{
//执行逻辑
}
//判断是否在ios或者安卓打开 //判断是否在ios或者安卓打开
this.isIos = !!userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); this.isIos = !!userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
}, },
onLoad({code}) { onLoad({
this.code = code||'123456' code
}) {
this.code = code
document.getElementById("openApp").style.display = 'none' document.getElementById("openApp").style.display = 'none'
document.getElementsByTagName("body")[0].style = "" document.getElementsByTagName("body")[0].style = ""
}, },
methods:{ methods: {
download(){ download() {
if(this.code){ if (this.code) {
uni.setClipboardData({ uni.setClipboardData({
data:this.code, data: this.code,
complete: (e) => { complete: (e) => {
console.log(e); console.log(e);
// uni.showToast({
// title: JSON.stringify(e),
// icon: 'none'
// });
uni.hideToast() uni.hideToast()
/* 以下临时解决setClipboardData h5端样式和键盘弹出端错误解决方案,后续会直接内置*/ /* 以下临时解决setClipboardData h5端样式和键盘弹出端错误解决方案,后续会直接内置*/
document.getElementById("#clipboard").style.top = '-999px'; document.getElementById("#clipboard").style.top = '-999px';
uni.hideKeyboard() uni.hideKeyboard()
} }
}) })
} }
if(this.isIos){ if (this.isIos) {
window.location.href = this.downloadUrl.ios window.location.href = this.downloadUrl.ios
}else{ } else {
if(this.isWeixin){ if (this.isWeixin) {
//显示浮层 //显示浮层
this.showMask = true this.showMask = true
}else{ } else {
window.location.href = this.downloadUrl.android window.location.href = this.downloadUrl.android
} }
} }
...@@ -97,73 +87,93 @@ ...@@ -97,73 +87,93 @@
} }
</script> </script>
<style lang="scss"> <style lang="scss">
.about { /* #ifndef APP-NVUE */
width: 750rpx; view {
flex-direction: column; display: flex;
} box-sizing: border-box;
.box { flex-direction: column;
margin-top: 100px; }
flex-direction: column;
justify-content: center; /* #endif */
align-items: center; .about {
} width: 750rpx;
.logoImg{ flex-direction: column;
margin-bottom: 10upx; }
width:160upx;
height:160upx; .box {
border-radius: 15px; margin-top: 100px;
} flex-direction: column;
.tip{ justify-content: center;
font-size:24rpx; align-items: center;
margin-top: 10px; }
}
.appName{ .logoImg {
margin-top: 20px; margin-bottom: 10upx;
font-size:42rpx; width: 160upx;
font-weight: 500; height: 160upx;
} border-radius: 15px;
.copyright { }
width: 750upx;
font-size:32rpx; .tip {
flex-direction: column; font-size: 24rpx;
justify-content: center; margin-top: 10px;
align-items: center; }
bottom:20px;
left: 0; .appName {
position: fixed; margin-top: 20px;
} font-size: 42rpx;
.hint { font-weight: 500;
color:#999999; }
font-size:26rpx;
} .copyright {
.icon{ width: 750upx;
width: 34rpx; font-size: 32rpx;
} flex-direction: column;
#download{ justify-content: center;
background-color: #2A9839; align-items: center;
color: #FFFFFF; bottom: 20px;
margin: 55rpx; left: 0;
padding: 5px; position: fixed;
width: 200rpx; }
border-radius: 100px;
flex-direction: row; .hint {
align-items: center; color: #999999;
justify-content: center; font-size: 26rpx;
} }
.download-text{
font-size: 32rpx; .icon {
} width: 34rpx;
.mask{ }
position: fixed;
top: 0; #download {
left: 0; background-color: #2A9839;
width: 750rpx; color: #FFFFFF;
height: 100vh; margin: 55rpx;
flex-direction: row; padding: 5px;
justify-content: flex-end; height: 30px;
background-color: rgba(0,0,0,0.6); width: 160rpx;
} border-radius: 100px;
.mask image{ flex-direction: row;
width: 600rpx; align-items: center;
} justify-content: center;
</style> }
\ No newline at end of file
.download-text {
font-size: 32rpx;
}
.mask {
position: fixed;
top: 0;
left: 0;
width: 750rpx;
height: 100vh;
flex-direction: row;
justify-content: flex-end;
background-color: rgba(0, 0, 0, 0.6);
}
.mask image {
width: 600rpx;
}
</style>
...@@ -8,6 +8,9 @@ let mixin = { ...@@ -8,6 +8,9 @@ let mixin = {
loginSuccess(result){ loginSuccess(result){
loginSuccess(result) loginSuccess(result)
delete result.userInfo.token delete result.userInfo.token
if (result.type == "register") {
result.userInfo._id = result.uid
}
this.setUserInfo(result.userInfo) this.setUserInfo(result.userInfo)
} }
} }
......
<template> <template>
<view class="content"> <view class="content">
<!-- 顶部文字 --> <!-- 顶部文字 -->
<text class="title">登录后即可展示自己</text> <text class="title">{{$t('login.phoneLogin')}}</text>
<!-- 登录框 --> <!-- 登录框 -->
<view v-if="['apple','weixin'].includes(type)" class="quickLogin"> <view v-if="['apple','weixin'].includes(type)" class="quickLogin">
<image @click="quickLogin" :src="imgSrc" mode="widthFix" class="quickLoginBtn"></image> <image @click="quickLogin" :src="imgSrc" mode="widthFix" class="quickLoginBtn"></image>
...@@ -9,11 +9,11 @@ ...@@ -9,11 +9,11 @@
</view> </view>
<template v-else> <template v-else>
<input type="number" class="input-box" :inputBorder="false" v-model="phone" maxlength="11" <input type="number" class="input-box" :inputBorder="false" v-model="phone" maxlength="11"
placeholder="请输入手机号" /> :placeholder="$t('common.phonePlaceholder')" />
<uni-agreements @setAgree="agree = $event"></uni-agreements> <uni-agreements @setAgree="agree = $event"></uni-agreements>
<button class="get-code" :disabled="!isPhone" :type="isPhone?'primary':'default'" <button class="get-code" :disabled="!isPhone" :type="isPhone?'primary':'default'"
@click="sendShortMsg">获取短信验证码</button> @click="sendShortMsg">{{$t('login.getVerifyCode')}}</button>
<text class="tip">未注册的手机号验证通过后将自动注册</text> <text class="tip">{{$t('login.phoneLoginTip')}}</text>
</template> </template>
<!-- 快捷登录按钮弹窗 --> <!-- 快捷登录按钮弹窗 -->
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
}, },
imgSrc() { imgSrc() {
return '/static/login-index/' + this.type + '.png' return '/static/login-index/' + this.type + '.png'
} }
}, },
onLoad(e) { onLoad(e) {
this.type = e.type this.type = e.type
...@@ -54,7 +54,13 @@ ...@@ -54,7 +54,13 @@
"top": "2000px" //隐藏当前页面窗体 "top": "2000px" //隐藏当前页面窗体
}) })
} }
//#endif //#endif
uni.$on('setLoginType',type=>{
this.type = type
})
},
onUnload() {
uni.$off('setLoginType')
}, },
onReady() { onReady() {
//#ifdef APP-PLUS //#ifdef APP-PLUS
...@@ -85,7 +91,7 @@ ...@@ -85,7 +91,7 @@
sendShortMsg() { sendShortMsg() {
if (!this.agree) { if (!this.agree) {
return uni.showToast({ return uni.showToast({
title: '你未同意隐私政策协议', title: this.$t('common').noAgree,
icon: 'none' icon: 'none'
}); });
} }
......
<template> <template>
<view class="content"> <view class="content">
<!-- 顶部文字 --> <!-- 顶部文字 -->
<text class="tit">请输入验证码</text> <text class="tit">{{$t('common.verifyCodePlaceholder')}}</text>
<text class="tip">{{tipText}}</text> <text class="tip">{{tipText}}</text>
<uni-forms> <uni-forms>
<!-- 登录框 (选择手机号所属国家和地区需要另行实现) --> <!-- 登录框 (选择手机号所属国家和地区需要另行实现) -->
<uni-easyinput type="number" class="easyinput" :inputBorder="false" <uni-easyinput type="number" class="easyinput" :inputBorder="false"
v-model="code" maxlength="6" placeholder="请输入验证码"> v-model="code" maxlength="6" :placeholder="$t('common.verifyCodePlaceholder')">
<template v-slot:right> <template v-slot:right>
<uni-send-sms-code :phone="phone" ref="sendSmsCode"></uni-send-sms-code> <uni-send-sms-code :phone="phone" ref="sendSmsCode"></uni-send-sms-code>
</template> </template>
</uni-easyinput> </uni-easyinput>
<button class="send-btn" :disabled="!canSubmit" :type="canSubmit?'primary':'default'" <button class="send-btn" :disabled="!canSubmit" :type="canSubmit?'primary':'default'"
@click="submit">登录</button> @click="submit">{{$t('common.login')}}</button>
</uni-forms> </uni-forms>
<uni-quick-login></uni-quick-login> <uni-quick-login agree></uni-quick-login>
</view> </view>
</template> </template>
<script> <script>
...@@ -29,17 +29,19 @@ ...@@ -29,17 +29,19 @@
}, },
computed: { computed: {
tipText() { tipText() {
return `验证码已通过短信发送至${this.phone}。`; return this.$t('common.verifyCodeSend')+ `${this.phone}。`;
}, },
canSubmit(){ canSubmit(){
return this.code.length==6; return this.code.length==6;
} }
}, },
onLoad({phoneNumber,phoneArea}) { onLoad({phoneNumber,phoneArea}) {
this.phone = phoneNumber; this.phone = phoneNumber;
}, },
onReady() { onReady() {
this.$refs.sendSmsCode.start(); if(this.phone.length==11){
this.$refs.sendSmsCode.start();
}
}, },
methods: { methods: {
submit(){ //完成并提交 submit(){ //完成并提交
...@@ -63,7 +65,6 @@ ...@@ -63,7 +65,6 @@
} }
} }
}) })
} }
} }
} }
......
<template> <template>
<view class="content"> <view class="content">
<!-- 顶部文字 --> <!-- 顶部文字 -->
<text class="title">用户名密码登录</text> <text class="title">{{$t('pwdLogin.pwdLogin')}}</text>
<input class="input-box" :inputBorder="false" v-model="username" placeholder="请输入手机号/用户名"/> <input class="input-box" :inputBorder="false" v-model="username" :placeholder="$t('pwdLogin.placeholder')"/>
<input type="password" class="input-box" :inputBorder="false" v-model="password" placeholder="请输入密码"/> <input type="password" class="input-box" :inputBorder="false" v-model="password" :placeholder="$t('pwdLogin.passwordPlaceholder')"/>
<view class="captcha-box" v-if="captchaBase64"> <view class="captcha-box" v-if="captchaBase64">
<image class="captcha-img" @click="createCaptcha" :src="captchaBase64" mode="widthFix"></image> <image class="captcha-img" @click="createCaptcha" :src="captchaBase64" mode="widthFix"></image>
<input type="text" class="input-box captcha" :inputBorder="false" v-model="captcha" placeholder="请输入验证码"/> <input type="text" class="input-box captcha" :inputBorder="false" v-model="captcha" :placeholder="$t('pwdLogin.verifyCodePlaceholder')"/>
</view> </view>
<uni-agreements @setAgree="agree = $event"></uni-agreements> <uni-agreements @setAgree="agree = $event"></uni-agreements>
<button class="send-btn" :disabled="!canLogin" :type="canLogin?'primary':'default'" <button class="send-btn" :disabled="!canLogin" :type="canLogin?'primary':'default'"
@click="pwdLogin">登录</button> @click="pwdLogin">{{$t('pwdLogin.login')}}</button>
<!-- 忘记密码 --> <!-- 忘记密码 -->
<view class="auth-box"> <view class="auth-box">
<text class="link" @click="toRetrievePwd">忘记密码</text> <text class="link" @click="toRetrievePwd">{{$t('pwdLogin.forgetPassword')}}</text>
<text class="link" @click="toRegister">注册账号</text> <text class="link" @click="toRegister">{{$t('pwdLogin.register')}}</text>
</view> </view>
<uni-quick-login :agree="agree" ref="uniQuickLogin"></uni-quick-login> <uni-quick-login :agree="agree" ref="uniQuickLogin"></uni-quick-login>
</view> </view>
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
pwdLogin() { pwdLogin() {
if (!this.agree) { if (!this.agree) {
return uni.showToast({ return uni.showToast({
title: '你未同意隐私政策协议', title: this.$t('common').noAgree,
icon: 'none' icon: 'none'
}); });
} }
...@@ -80,16 +80,16 @@ ...@@ -80,16 +80,16 @@
} else { } else {
if (result.needCaptcha) { if (result.needCaptcha) {
uni.showToast({ uni.showToast({
title: result.msg, title: result.msg||'完成',
icon: 'none' icon: 'none'
}); });
this.createCaptcha() this.createCaptcha()
}else{ }else{
uni.showModal({ uni.showModal({
title: '错误', title: this.$t('common').error,
content: result.msg, content: result.msg,
showCancel: false, showCancel: false,
confirmText: '知道了' confirmText: this.$t('common').gotIt
}); });
} }
} }
...@@ -155,7 +155,7 @@ ...@@ -155,7 +155,7 @@
justify-content: flex-end; justify-content: flex-end;
} }
.captcha-img{ .captcha-img{
margin:15px 15px 0 0; margin: 0 15px 10px 0;
width: 250rpx; width: 250rpx;
} }
.captcha{ .captcha{
......
...@@ -2,30 +2,30 @@ ...@@ -2,30 +2,30 @@
<view class="content"> <view class="content">
<!-- 顶部文字 --> <!-- 顶部文字 -->
<!-- 登录框 (选择手机号所属国家和地区需要另行实现) --> <!-- 登录框 (选择手机号所属国家和地区需要另行实现) -->
<uni-forms ref="form" :value="formData" :rules="rules"> <uni-forms ref="form" :value="formData" >
<uni-forms-item name="phone"> <uni-forms-item name="phone">
<!-- focus规则如果上一页携带来“手机号码”数据就focus验证码输入框,否则focus手机号码输入框 --> <!-- focus规则如果上一页携带来“手机号码”数据就focus验证码输入框,否则focus手机号码输入框 -->
<uni-easyinput :disabled="lock" :focus="formData.phone.length!=11" type="number" class="easyinput" :inputBorder="false" <uni-easyinput :disabled="lock" :focus="formData.phone.length!=11" type="number" class="easyinput" :inputBorder="false"
v-model="formData.phone" maxlength="11" placeholder="请输入手机号"></uni-easyinput> v-model="formData.phone" maxlength="11" :placeholder="$t('common.phonePlaceholder')"></uni-easyinput>
</uni-forms-item> </uni-forms-item>
<uni-forms-item name="code"> <uni-forms-item name="code">
<uni-easyinput :focus="formData.phone.length==11" type="number" class="easyinput" :inputBorder="false" <uni-easyinput :focus="formData.phone.length==11" type="number" class="easyinput" :inputBorder="false"
v-model="formData.code" maxlength="6" placeholder="请输入验证码"> v-model="formData.code" maxlength="6" :placeholder="$t('common.verifyCodePlaceholder')">
<template slot="right"> <template v-slot:right>
<uni-send-sms-code ref="shortCode" :phone="formData.phone"></uni-send-sms-code> <uni-send-sms-code ref="shortCode" :phone="formData.phone"></uni-send-sms-code>
</template> </template>
</uni-easyinput> </uni-easyinput>
</uni-forms-item> </uni-forms-item>
<uni-forms-item name="pwd"> <uni-forms-item name="pwd">
<uni-easyinput type="password" class="easyinput" :inputBorder="false" v-model="formData.pwd" <uni-easyinput type="password" class="easyinput" :inputBorder="false" v-model="formData.pwd"
placeholder="请输入新密码"></uni-easyinput> :placeholder="$t('common.newPasswordPlaceholder')"></uni-easyinput>
</uni-forms-item> </uni-forms-item>
<uni-forms-item name="pwd2"> <uni-forms-item name="pwd2">
<uni-easyinput type="password" class="easyinput" :inputBorder="false" v-model="formData.pwd2" <uni-easyinput type="password" class="easyinput" :inputBorder="false" v-model="formData.pwd2"
placeholder="请确认新密码"></uni-easyinput> :placeholder="$t('common.confirmNewPasswordPlaceholder')"></uni-easyinput>
</uni-forms-item> </uni-forms-item>
<button class="send-btn-box" :disabled="!canSubmit" :type="canSubmit?'primary':'default'" <button class="send-btn-box" :disabled="!canSubmit" :type="canSubmit?'primary':'default'"
@click="submit">完成</button> @click="submit">{{$t('common.complete')}}</button>
</uni-forms> </uni-forms>
</view> </view>
</template> </template>
...@@ -38,7 +38,8 @@ ...@@ -38,7 +38,8 @@
return { return {
lock:false, lock:false,
formData: { formData: {
"phone": "", "phone": "",
"code":"",
'pwd': '', 'pwd': '',
'pwd2': '' 'pwd2': ''
}, },
...@@ -46,44 +47,44 @@ ...@@ -46,44 +47,44 @@
phone: { phone: {
rules: [{ rules: [{
required: true, required: true,
errorMessage: '请输入手机号', errorMessage: this.$t('common.phonePlaceholder'),
}, },
{ {
pattern: /^1\d{10}$/, pattern: /^1\d{10}$/,
errorMessage: '手机号格式不正确', errorMessage: this.$t('common.formatErr'),
} }
] ]
}, },
code: { code: {
rules: [{ rules: [{
required: true, required: true,
errorMessage: '请输入验证码', errorMessage: this.$t('common.verifyCodePlaceholder'),
}, },
{ {
pattern: /^.{6}$/, pattern: /^.{6}$/,
errorMessage: '请输入6位验证码', errorMessage: this.$t('common.sixDigitCode'),
} }
] ]
}, },
pwd: { pwd: {
rules: [{ rules: [{
required: true, required: true,
errorMessage: '请输入密码', errorMessage:this.$t('common.newPasswordPlaceholder'),
}, },
{ {
pattern: /^.{6,20}$/, pattern: /^.{6,20}$/,
errorMessage: '密码应为6到20位', errorMessage: this.$t('common.passwordDigits'),
} }
] ]
}, },
pwd2: { pwd2: {
rules: [{ rules: [{
required: true, required: true,
errorMessage: '请确认密码', errorMessage:this.$t('common.confirmPassword'),
}, },
{ {
pattern: /^.{6,20}$/, pattern: /^.{6,20}$/,
errorMessage: '密码应为6到20位', errorMessage: this.$t('common.passwordDigits'),
}, },
{ {
validateFunction: function(rule, value, data, callback) { validateFunction: function(rule, value, data, callback) {
...@@ -99,8 +100,8 @@ ...@@ -99,8 +100,8 @@
} }
} }
}, },
computed: { computed: {
canSubmit() { canSubmit() {
return this.isPhone && this.isPwd && this.isCode; return this.isPhone && this.isPwd && this.isCode;
}, },
isPhone() { isPhone() {
...@@ -115,7 +116,7 @@ ...@@ -115,7 +116,7 @@
}, },
isCode() { isCode() {
let reg_code = /^\d{6}$/; let reg_code = /^\d{6}$/;
let isCode = reg_code.test(this.formData.code); let isCode = reg_code.test(this.formData.code);
return isCode; return isCode;
} }
}, },
...@@ -124,17 +125,23 @@ ...@@ -124,17 +125,23 @@
this.formData.phone = event.phoneNumber; this.formData.phone = event.phoneNumber;
this.lock = true this.lock = true
} }
uni.setNavigationBarTitle({
title: this.$t('common.resetNavTitle')
})
}, },
onReady() { onReady() {
if (this.formData.phone) { if (this.formData.phone) {
this.$refs.shortCode.start(); this.$refs.shortCode.start();
} }
this.$refs.form.setRules(this.rules)
}, },
methods: { methods: {
/** /**
* 完成并提交 * 完成并提交
*/ */
submit() { submit() {
console.log("formData",this.formData);
console.log('rules',this.rules);
this.$refs.form.validate() this.$refs.form.validate()
.then(res => { .then(res => {
uniCloud.callFunction({ uniCloud.callFunction({
...@@ -150,7 +157,7 @@ ...@@ -150,7 +157,7 @@
success: ({result}) => { success: ({result}) => {
console.log(result); console.log(result);
uni.showToast({ uni.showToast({
title: result.msg, title: result.msg||'更新成功',
icon: 'none' icon: 'none'
}); });
if (result.code === 0) { if (result.code === 0) {
...@@ -166,7 +173,6 @@ ...@@ -166,7 +173,6 @@
<style> <style>
@import url("../common/login-page.css"); @import url("../common/login-page.css");
.content{ .content{
padding-top: 36rpx; padding-top: 36rpx;
} }
......
...@@ -2,19 +2,19 @@ ...@@ -2,19 +2,19 @@
<view class="uni-container"> <view class="uni-container">
<uni-forms ref="form" :value="formData" :rules="rules" validate-trigger="submit" err-show-type="undertext"> <uni-forms ref="form" :value="formData" :rules="rules" validate-trigger="submit" err-show-type="undertext">
<uni-forms-item name="username" required> <uni-forms-item name="username" required>
<uni-easyinput :inputBorder="false" class="easyinput" placeholder="请输入用户名" v-model="formData.username" trim="both" /> <uni-easyinput :inputBorder="false" class="easyinput" :placeholder="$t('register.usernamePlaceholder')" v-model="formData.username" trim="both" />
</uni-forms-item> </uni-forms-item>
<uni-forms-item name="nickname"> <uni-forms-item name="nickname">
<uni-easyinput :inputBorder="false" class="easyinput" placeholder="请输入用户昵称" v-model="formData.nickname" trim="both" /> <uni-easyinput :inputBorder="false" class="easyinput" :placeholder="$t('register.nicknamePlaceholder')" v-model="formData.nickname" trim="both" style="width: 660rpx;" />
</uni-forms-item> </uni-forms-item>
<uni-forms-item name="password" v-model="formData.password" required> <uni-forms-item name="password" v-model="formData.password" required>
<uni-easyinput :inputBorder="false" class="easyinput" placeholder="请输入6-20位密码" type="password" v-model="formData.password" trim="both" /> <uni-easyinput :inputBorder="false" class="easyinput" :placeholder="$t('register.passwordDigitsPlaceholder')" type="password" v-model="formData.password" trim="both" />
</uni-forms-item> </uni-forms-item>
<uni-forms-item name="pwd2" v-model="formData.pwd2" required> <uni-forms-item name="pwd2" v-model="formData.pwd2" required>
<uni-easyinput :inputBorder="false" class="easyinput" placeholder="再次输入密码" type="password" v-model="formData.pwd2" trim="both" /> <uni-easyinput :inputBorder="false" class="easyinput" :placeholder="$t('register.passwordAgain')" type="password" v-model="formData.pwd2" trim="both" />
</uni-forms-item> </uni-forms-item>
<uni-agreements @setAgree="agree = $event"></uni-agreements> <uni-agreements @setAgree="agree = $event"></uni-agreements>
<button class="send-btn" type="primary" @click="submit">注册并登录</button> <button class="send-btn" type="primary" @click="submit">{{$t('register.registerAndLogin')}}</button>
</uni-forms> </uni-forms>
</view> </view>
</template> </template>
...@@ -39,6 +39,11 @@ import mixin from '../common/login-page.mixin.js'; ...@@ -39,6 +39,11 @@ import mixin from '../common/login-page.mixin.js';
onReady() { onReady() {
this.$refs.form.setRules(this.rules) this.$refs.form.setRules(this.rules)
}, },
onLoad() {
uni.setNavigationBarTitle({
title: this.$t('register.navigationBarTitle')
})
},
methods: { methods: {
/** /**
* 触发表单提交 * 触发表单提交
...@@ -46,7 +51,7 @@ import mixin from '../common/login-page.mixin.js'; ...@@ -46,7 +51,7 @@ import mixin from '../common/login-page.mixin.js';
submit() { submit() {
if(!this.agree){ if(!this.agree){
return uni.showToast({ return uni.showToast({
title: '你未同意隐私政策协议', title: this.$t('common').noAgree,
icon: 'none' icon: 'none'
}); });
} }
...@@ -93,5 +98,8 @@ import mixin from '../common/login-page.mixin.js'; ...@@ -93,5 +98,8 @@ import mixin from '../common/login-page.mixin.js';
} }
.send-btn{ .send-btn{
margin-top: 5px; margin-top: 5px;
}
.uni-container ::v-deep .uni-forms-item__label{
width: 15px !important;
} }
</style> </style>
...@@ -38,7 +38,10 @@ ...@@ -38,7 +38,10 @@
this.readNewsLog = uni.getStorageSync('readNewsLog')||[]; this.readNewsLog = uni.getStorageSync('readNewsLog')||[];
let readNewsLogIds = this.readNewsLog.map(({article_id})=>article_id) let readNewsLogIds = this.readNewsLog.map(({article_id})=>article_id)
console.log(typeof readNewsLogIds,readNewsLogIds); console.log(typeof readNewsLogIds,readNewsLogIds);
this.udbWhere = `"_id" in ${JSON.stringify(readNewsLogIds)}` this.udbWhere = `"_id" in ${JSON.stringify(readNewsLogIds)}`
uni.setNavigationBarTitle({
title: this.$t('newsLog.navigationBarTitle')
})
}, },
onPullDownRefresh() { onPullDownRefresh() {
this.refreshData(); this.refreshData();
...@@ -55,7 +58,8 @@ ...@@ -55,7 +58,8 @@
uni.stopPullDownRefresh() uni.stopPullDownRefresh()
}) })
}, },
handleItemClick(item) { handleItemClick(item) {
console.log(item);
uni.navigateTo({ uni.navigateTo({
url: '/pages/list/detail?id=' + item._id + '&title=' + item.title url: '/pages/list/detail?id=' + item._id + '&title=' + item.title
}) })
......
<template>
<view class="content">
<text class="words" space="emsp">
一、注销是不可逆操作,注销后:\n
1.帐号将无法登录、无法找回。\n
2.帐号所有信息都会清除(个人身份信息、粉丝数等;发布的作品、评论、点赞等;交易信息等),你
的朋友将无法通过本应用帐号联系你,请自行备份相关
信息和数据。\n
二、重要提示\n
1.封禁帐号(永久封禁、社交封禁、直播权限封禁)不能申请注销。\n
2.注销后,你的身份证、三方帐号(微信、QQ、微博、支付宝)、手机号等绑定关系将解除,解除后可以绑定到其他帐号。\n
3.注销后,手机号可以注册新的帐号,新帐号不会存在之前帐号的任何信息(作品、粉丝、评论、个人信息等)。\n
4.注销本应用帐号前,需尽快处理帐号下的资金问题。\n
5.视具体帐号情况而定,注销最多需要7天。\n
</text>
<view class="button-group">
<button @click="nextStep" class="next" type="default">{{$t('deactivate.nextStep')}}</button>
<button @click="cancel" type="warn">{{$t('deactivate.cancelText')}}</button>
</view>
</view>
</template>
<script>
import {
mapActions
} from 'vuex';
export default {
data() {
return {
}
},
onLoad() {
uni.setNavigationBarTitle({
title: this.$t('deactivate.navigationBarTitle')
})
},
methods: {
...mapActions({
logout: 'user/logout'
}),
cancel(){
uni.navigateBack()
},
nextStep(){
uni.showModal({
content: '已经仔细阅读注销提示,知晓可能带来的后果,并确认要注销',
complete: (e) => {
if(e.confirm){
uniCloud.callFunction({
name:'uni-id-cf',
data:{
"action":"closeAccount"
},
complete: (e) => {
console.log(e);
if(e.result.code === 0){
uni.showToast({
title: '注销成功'
});
this.logout();
uni.navigateTo({
url:"/pages/ucenter/login-page/index/index"
})
}else{
uni.showToast({
icon:'error',
title: e.result.errMsg
});
}
}
})
}else{
uni.navigateBack()
}
}
});
}
}
}
</script>
<style>
.content{
display: flex;
flex-direction: column;
font-size: 28rpx;
}
.words{
padding: 0 26rpx;
line-height:46rpx;
margin-top:20rpx;
margin-bottom: 80px;
}
.button-group{
display: flex;
flex-direction: row;
position: fixed;
height: 50px;
bottom: 10px;
width: 750rpx;
justify-content: center;
align-items: center;
border-top: solid 1px #e4e6ec;
padding-top: 10px;
background-color: #FFFFFF;
}
.button-group button{
border-radius: 100px;
border: none;
width: 300rpx;
height: 42px;
line-height: 42px;
font-size: 32rpx;
}
.button-group button:after{
border: none;
}
.button-group button.next{
color: #e64340;
border:solid 1px #e64340 ;
}
</style>
<template> <template>
<view class="content"> <view class="content">
<!-- 功能列表 --> <!-- 功能列表 -->
<uni-list class="mt10" :border="false"> <uni-list class="mt10" :border="false">
<uni-list-item title="个人资料" to="/pages/ucenter/userinfo/userinfo" link="navigateTo"></uni-list-item> <uni-list-item :title="$t('settings.userInfo')" to="/pages/ucenter/userinfo/userinfo" link="navigateTo"></uni-list-item>
<uni-list-item v-if="userInfo.mobile" title="修改密码" :to="'/pages/ucenter/login-page/pwd-retrieve/pwd-retrieve?phoneNumber='+ userInfo.mobile" link="navigateTo"></uni-list-item> <uni-list-item v-if="userInfo.mobile" :title="$t('settings.changePassword')" :to="'/pages/ucenter/login-page/pwd-retrieve/pwd-retrieve?phoneNumber='+ userInfo.mobile" link="navigateTo"></uni-list-item>
</uni-list> </uni-list>
<!-- #ifndef H5 -->
<uni-list class="mt10" :border="false"> <uni-list class="mt10" :border="false">
<!-- #ifndef H5 -->
<!-- #ifdef APP-PLUS --> <!-- #ifdef APP-PLUS -->
<!-- 检查push过程未结束不显示,push设置项 --> <!-- 检查push过程未结束不显示,push设置项 -->
<uni-list-item title="清理缓存" @click="clearTmp" link></uni-list-item> <uni-list-item :title="$t('settings.clearTmp')" @click="clearTmp" link></uni-list-item>
<uni-list-item v-if="pushIsOn != 'wait'" @click.native="pushIsOn?pushServer.off():pushServer.on()" title="推送功能" showSwitch :switchChecked="pushIsOn"></uni-list-item> <uni-list-item v-show="pushIsOn != 'wait'" :title="$t('settings.pushServer')" @click.native="pushIsOn?pushServer.off():pushServer.on()" showSwitch :switchChecked="pushIsOn"></uni-list-item>
<!-- #endif --> <!-- #endif -->
<uni-list-item v-if="supportMode.includes('fingerPrint')" title="指纹解锁" @click.native="startSoterAuthentication('fingerPrint')" link></uni-list-item> <uni-list-item v-if="supportMode.includes('fingerPrint')" :title="$t('settings.fingerPrint')" @click.native="startSoterAuthentication('fingerPrint')" link></uni-list-item>
<uni-list-item v-if="supportMode.includes('facial')" title="人脸解锁" @click="startSoterAuthentication('facial')" link></uni-list-item> <uni-list-item v-if="supportMode.includes('facial')" :title="$t('settings.facial')" @click="startSoterAuthentication('facial')" link></uni-list-item>
</uni-list>
<!-- #endif --> <!-- #endif -->
<uni-list-item v-if="i18nEnable" :title="$t('settings.changeLanguage')" @click="changeLanguage" :rightText="currentLanguage" link></uni-list-item>
</uni-list>
<uni-list class="mt10" :border="false">
<uni-list-item @click="deactivate" :title="$t('settings.deactivate')" link="navigateTo"></uni-list-item>
</uni-list>
<!-- 退出/登录 按钮 --> <!-- 退出/登录 按钮 -->
<view class="bottom-back" @click="clickLogout"> <view class="bottom-back" @click="clickLogout">
<text class="bottom-back-text" v-if="hasLogin">退出登录</text> <text class="bottom-back-text" v-if="hasLogin">{{$t('settings.logOut')}}</text>
<text class="bottom-back-text" v-else>登录</text> <text class="bottom-back-text" v-else>{{$t('settings.login')}}</text>
</view> </view>
</view> </view>
</template> </template>
...@@ -29,23 +34,33 @@ ...@@ -29,23 +34,33 @@
import pushServer from './dc-push/push.js'; import pushServer from './dc-push/push.js';
import { import {
mapMutations, mapMutations,
mapGetters mapGetters,
mapActions
} from 'vuex'; } from 'vuex';
export default { export default {
data() { data() {
return { return {
pushServer:pushServer, pushServer:pushServer,
supportMode:[], supportMode:[],
pushIsOn:"wait" pushIsOn:"wait",
currentLanguage:""
} }
}, },
computed: { computed: {
...mapGetters({ ...mapGetters({
'userInfo': 'user/info', 'userInfo': 'user/info',
'hasLogin': 'user/hasLogin', 'hasLogin': 'user/hasLogin',
}) }),
i18nEnable(){
return getApp().globalData.config.i18n.enable
}
}, },
onLoad() { onLoad() {
this.currentLanguage = uni.getStorageSync('CURRENT_LANG') == "en"?'English':'简体中文'
uni.setNavigationBarTitle({
title: this.$t('settings.navigationBarTitle')
})
// #ifdef APP-PLUS || MP-WEIXIN // #ifdef APP-PLUS || MP-WEIXIN
uni.checkIsSupportSoterAuthentication({ uni.checkIsSupportSoterAuthentication({
success: (res) => { success: (res) => {
...@@ -67,14 +82,19 @@ ...@@ -67,14 +82,19 @@
//#endif //#endif
}, },
methods: { methods: {
...mapMutations({ ...mapActions({
logout: 'user/logout' logout: 'user/logout'
}), }),
toEdit() { toEdit() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/ucenter/userinfo/userinfo' url: '/pages/ucenter/userinfo/userinfo'
}); });
}, },
deactivate(){
uni.navigateTo({
url:"/pages/ucenter/settings/deactivate/deactivate"
})
},
changePwd() { changePwd() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/ucenter/login-page/pwd-retrieve/pwd-retrieve?phoneNumber=' url: '/pages/ucenter/login-page/pwd-retrieve/pwd-retrieve?phoneNumber='
...@@ -89,7 +109,7 @@ ...@@ -89,7 +109,7 @@
*/ */
startSoterAuthentication(checkAuthMode) { startSoterAuthentication(checkAuthMode) {
console.log(checkAuthMode); console.log(checkAuthMode);
let title = {"fingerPrint":"指纹解锁","facial":"人脸解锁"}[checkAuthMode] let title = {"fingerPrint":this.$t('settings.fingerPrint'),"facial":this.$t('settings.facial')}[checkAuthMode]
// 检查是否开启认证 // 检查是否开启认证
this.checkIsSoterEnrolledInDevice({checkAuthMode,title}) this.checkIsSoterEnrolledInDevice({checkAuthMode,title})
.then(() => { .then(() => {
...@@ -98,7 +118,7 @@ ...@@ -98,7 +118,7 @@
uni.startSoterAuthentication({ uni.startSoterAuthentication({
requestAuthModes: [checkAuthMode], requestAuthModes: [checkAuthMode],
challenge: '123456', // 微信端挑战因子 challenge: '123456', // 微信端挑战因子
authContent: `请用${title}`, authContent: this.$t('settings.please')+ " " + `${title}`,
complete: (res) => { complete: (res) => {
console.log(res); console.log(res);
}, },
...@@ -113,12 +133,12 @@ ...@@ -113,12 +133,12 @@
* 微信小程序需要再次通过后台验证resultJSON与resultJSONSignature获取最终结果 * 微信小程序需要再次通过后台验证resultJSON与resultJSONSignature获取最终结果
*/ */
return uni.showToast({ return uni.showToast({
title: `${title}成功`, title: `${title}`+this.$t('settings.successText'),
icon: 'none' icon: 'none'
}); });
} }
uni.showToast({ uni.showToast({
title: '认证失败请重试', title:this.$t('settings.failTip'),
icon: 'none' icon: 'none'
}); });
}, },
...@@ -126,7 +146,8 @@ ...@@ -126,7 +146,8 @@
console.log(err); console.log(err);
console.log(`认证失败:${err.errCode}`); console.log(`认证失败:${err.errCode}`);
uni.showToast({ uni.showToast({
title: `认证失败`, title:this.$t('settings.authFailed'),
// title: `认证失败`,
icon: 'none' icon: 'none'
}); });
} }
...@@ -143,7 +164,7 @@ ...@@ -143,7 +164,7 @@
return resolve(res); return resolve(res);
} }
uni.showToast({ uni.showToast({
title: `设备未开启${title}`, title: this.$t('settings.deviceNoOpen')+ `${title}`,
icon: 'none' icon: 'none'
}); });
reject(res); reject(res);
...@@ -151,7 +172,7 @@ ...@@ -151,7 +172,7 @@
fail: (err) => { fail: (err) => {
console.log(err); console.log(err);
uni.showToast({ uni.showToast({
title: `${title}失败`, title: `${title}` + this.$t('settings.fail'),
icon: 'none' icon: 'none'
}); });
reject(err); reject(err);
...@@ -162,13 +183,13 @@ ...@@ -162,13 +183,13 @@
clickLogout() { clickLogout() {
if (this.hasLogin) { if (this.hasLogin) {
uni.showModal({ uni.showModal({
title: '提示', title: this.$t('settings.tips'),
content: '是否退出登录', content: this.$t('settings.exitLogin'),
cancelText: '取消', cancelText: this.$t('settings.cancelText'),
confirmText: '确定', confirmText: this.$t('settings.confirmText'),
success: res => { success: res => {
if (res.confirm) { if (res.confirm) {
this.logout(); this.logout()
uni.navigateBack(); uni.navigateBack();
} }
}, },
...@@ -183,7 +204,7 @@ ...@@ -183,7 +204,7 @@
}, },
clearTmp() { clearTmp() {
uni.showLoading({ uni.showLoading({
title: '清除中', title: this.$t('settings.clearing'),
mask: true mask: true
}); });
/* /*
...@@ -206,7 +227,7 @@ ...@@ -206,7 +227,7 @@
console.log(res); console.log(res);
uni.hideLoading() uni.hideLoading()
uni.showToast({ uni.showToast({
title: '清除成功', title: this.$t('settings.clearedSuccessed'),
icon: 'none' icon: 'none'
}); });
} }
...@@ -214,7 +235,7 @@ ...@@ -214,7 +235,7 @@
}else{ }else{
uni.hideLoading() uni.hideLoading()
uni.showToast({ uni.showToast({
title: '清除成功', title: this.$t('settings.clearedSuccessed'),
icon: 'none' icon: 'none'
}); });
} }
...@@ -223,6 +244,40 @@ ...@@ -223,6 +244,40 @@
console.log(e); console.log(e);
} }
}); });
},
changeLanguage(){
console.log('语言切换')
uni.showActionSheet({
itemList: ["English","简体中文"],
success: res => {
console.log(res.tapIndex);
let language = uni.getStorageSync('CURRENT_LANG')
if(
!res.tapIndex && language=='zh-Hans' || res.tapIndex && language=='en'
){
const globalData = getApp().globalData
if (language === 'en') {
language = globalData.locale = 'zh-Hans'
} else {
language = globalData.locale = 'en'
}
uni.setStorageSync('CURRENT_LANG', language)
getApp().globalData.$i18n.locale = language
this.currentLanguage = res.tapIndex?'简体中文':'English'
if(uni.setLocale){
uni.setLocale(language)
}
uni.reLaunch({
url: '/pages/list/list',
complete: () => {
uni.$emit("changeLanguage",language)
}
})
}
},
fail: () => {},
complete: () => {}
});
} }
} }
} }
...@@ -277,14 +332,14 @@ ...@@ -277,14 +332,14 @@
.mt10 { .mt10 {
margin-top: 10px; margin-top: 10px;
} }
/* #ifndef APP-NVUE || VUE3 */ /* #ifndef APP-NVUE || VUE3 */
.content /deep/ .uni-list { .content /deep/ .uni-list {
background-color: #F9F9F9; background-color: #F9F9F9;
} }
.content /deep/ .uni-list-item--disabled,.list-item { .content /deep/ .uni-list-item--disabled,.list-item {
height: 50px; height: 50px;
margin-bottom: 1px; margin-bottom: 1px;
} }
/* #endif */ /* #endif */
</style> </style>
\ No newline at end of file
此差异已折叠。
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
<view class="box"> <view class="box">
<!-- 登录框 (选择手机号所属国家和地区需要另行实现) --> <!-- 登录框 (选择手机号所属国家和地区需要另行实现) -->
<uni-easyinput clearable focus type="number" class="input-box" :inputBorder="false" v-model="formData.phone" <uni-easyinput clearable focus type="number" class="input-box" :inputBorder="false" v-model="formData.phone"
maxlength="11" placeholder="请输入手机号"></uni-easyinput> maxlength="11" :placeholder="$t('common.phonePlaceholder')"></uni-easyinput>
<uni-easyinput clearable type="number" class="input-box" :inputBorder="false" v-model="formData.code" maxlength="6" <uni-easyinput clearable type="number" class="input-box" :inputBorder="false" v-model="formData.code" maxlength="6"
placeholder="请输入验证码"> :placeholder="$t('common.verifyCodePlaceholder')">
<template slot="right"> <template v-slot:right>
<uni-send-sms-code ref="shortCode" code-type="bind" :phone="formData.phone"></uni-send-sms-code> <uni-send-sms-code ref="shortCode" code-type="bind" :phone="formData.phone"></uni-send-sms-code>
</template> </template>
</uni-easyinput> </uni-easyinput>
<button class="send-btn-box" :disabled="!canSubmit" :type="canSubmit?'primary':'default'" @click="submit">提交</button> <button class="send-btn-box" :disabled="!canSubmit" :type="canSubmit?'primary':'default'" @click="submit">{{$t('common.submit')}}</button>
</view> </view>
</template> </template>
<script> <script>
...@@ -27,15 +27,18 @@ ...@@ -27,15 +27,18 @@
} }
} }
}, },
computed: { computed: {
tipText() { tipText() {
return `验证码已通过短信发送至${this.currenPhoneArea} ${this.formData.phone}。密码为6 - 20位` return this.$t('common.verifyCodeSend')+ `${this.currenPhoneArea} ${this.formData.phone}。` + this.$t('common.passwordDigits')
}, },
canSubmit() { canSubmit() {
return true//this.isPhone() && this.isCode(); return true//this.isPhone() && this.isCode();
} }
}, },
onLoad(event) { onLoad(event) {
uni.setNavigationBarTitle({
title:this.$t('bindMobile.navigationBarTitle')
})
}, },
onReady() { onReady() {
}, },
...@@ -61,7 +64,7 @@ ...@@ -61,7 +64,7 @@
console.log(result); console.log(result);
this.setUserInfo({"mobile":result.mobile}) this.setUserInfo({"mobile":result.mobile})
uni.showToast({ uni.showToast({
title: result.msg, title: result.msg||'完成',
icon: 'none' icon: 'none'
}); });
if (result.code === 0) { if (result.code === 0) {
......
此差异已折叠。
文件已添加
...@@ -24,20 +24,38 @@ let state = { ...@@ -24,20 +24,38 @@ let state = {
console.log('state.info',state.info); console.log('state.info',state.info);
//存储最新的用户数据到本地持久化存储 //存储最新的用户数据到本地持久化存储
uni.setStorageSync('userInfo', state.info); uni.setStorageSync('userInfo', state.info);
uni.setStorageSync('uni_id_token', state.info.token) if(info.token){
uni.setStorageSync('uni_id_token_expired', state.info.tokenExpired) uni.setStorage({
key: 'uni_id_token',
data: state.info.token,
complete(e){
// console.log('setStorage-------',e);
}
});
uni.setStorageSync('uni_id_token_expired', state.info.tokenExpired)
}
}, },
logout(state) { logout(state) {
state.info = {}; state.info = {};
state.hasLogin = false; state.hasLogin = false;
uni.setStorageSync('userInfo', {}); uni.setStorageSync('userInfo', {});
uni.setStorageSync('uni_id_token', ''); uni.removeStorageSync('uni_id_token');
uni.setStorageSync('uni_id_token_expired', 0) uni.setStorageSync('uni_id_token_expired', 0)
} }
}, },
actions = { actions = {
logout(context){
uni.showLoading({mask:true})
uniCloud.callFunction({
name:'uni-id-cf',
data:{action:'logout'},
complete: (e) => {
console.log(e);
context.commit('logout')
uni.hideLoading()
}
})
}
} }
export default { export default {
namespaced: true, namespaced: true,
......
此差异已折叠。
...@@ -9,4 +9,4 @@ ...@@ -9,4 +9,4 @@
// 详细JQL语法,请参考 https://uniapp.dcloud.net.cn/uniCloud/clientdb?id=jsquery // 详细JQL语法,请参考 https://uniapp.dcloud.net.cn/uniCloud/clientdb?id=jsquery
// 下面示例查询uni-id-users表的所有数据 // 下面示例查询uni-id-users表的所有数据
db.collection('cuangeju-product').get(); db.collection('uni-id-users').where('user_id._id=="610a6daa506cc7000100c07f"').get();
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
"bsonType": "object", "bsonType": "object",
"required": ["user_id", "title", "content"], "required": ["user_id", "title", "content"],
"permission": { "permission": {
"read": "doc.article_status == 0 || doc.article_status == 1", "read": "doc.uid == auth.uid && doc.article_status == 0 || doc.article_status == 1",
"create": "auth.uid != null", "create": "auth.uid != null",
"update": "doc.uid == auth.uid", "update": "doc.user_id == auth.uid",
"delete": "doc.uid == auth.uid" "delete": "doc.user_id == auth.uid"
}, },
"properties": { "properties": {
"_id": { "_id": {
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
"permission": { "permission": {
"read": true, "read": true,
"create": "auth.uid != null && get(`database.opendb-news-article.${doc.article_id}`).comment_status == 1", "create": "auth.uid != null && get(`database.opendb-news-article.${doc.article_id}`).comment_status == 1",
"update": "doc.uid == auth.uid", "update": "doc.user_id == auth.uid",
"delete": "doc.uid == auth.uid" "delete": "doc.user_id == auth.uid"
}, },
"properties": { "properties": {
"_id": { "_id": {
...@@ -65,4 +65,4 @@ ...@@ -65,4 +65,4 @@
} }
} }
} }
} }
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
"bsonType": "object", "bsonType": "object",
"required": ["user_id", "article_id"], "required": ["user_id", "article_id"],
"permission": { "permission": {
"read": "doc.uid == auth.uid", "read": "doc.user_id == auth.uid",
"create": "auth.uid != null", "create": "auth.uid != null",
"update": "doc.uid == auth.uid", "update": "doc.user_id == auth.uid",
"delete": "doc.uid == auth.uid" "delete": "doc.user_id == auth.uid"
}, },
"properties": { "properties": {
"_id": { "_id": {
...@@ -43,4 +43,4 @@ ...@@ -43,4 +43,4 @@
} }
} }
} }
} }
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。