微信小程序发布试用版本
This commit is contained in:
@@ -1,235 +0,0 @@
|
||||
<template>
|
||||
<view class="about">
|
||||
<view class="box">
|
||||
<image class="logoImg" :src="about.logo"></image>
|
||||
<text class="tip appName">{{about.appName}}</text>
|
||||
<text class="tip">Version {{version}}</text>
|
||||
<view class="qrcode">
|
||||
<!--uqrcode 组件来源,插件Sansnn-uQRCode 链接地址:https://ext.dcloud.net.cn/plugin?id=1287-->
|
||||
<uqrcode :size="100" canvas-id="qrcode" :value="about.download"></uqrcode>
|
||||
</view>
|
||||
|
||||
<text class="tip">{{$t('about.sacnQR')}} {{about.appName}} {{$t('about.client')}}</text>
|
||||
</view>
|
||||
<view class="copyright">
|
||||
<view class="agreement-box" v-for="(agreement,index) in agreements" :key="index">
|
||||
<text class="agreement" @click="navigateTo(agreement)">《{{agreement.title}}》</text>
|
||||
<text class="hint" v-if="agreements.length-1>index">{{$t('about.and')}}</text>
|
||||
</view>
|
||||
<text class="hint">Copyright © {{year}}</text>
|
||||
<text class="hint">{{about.company}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
// #ifdef APP
|
||||
import UniShare from '@/uni_modules/uni-share/js_sdk/uni-share.js';
|
||||
const uniShare = new UniShare()
|
||||
// #endif
|
||||
import uniIdPagesConfig from '@/uni_modules/uni-id-pages/config.js';
|
||||
import uqrcode from "@/uni_modules/Sansnn-uQRCode/components/uqrcode/uqrcode"
|
||||
export default {
|
||||
components:{
|
||||
uqrcode
|
||||
},
|
||||
// #ifdef APP
|
||||
onBackPress({from}) {
|
||||
if(from=='backbutton'){
|
||||
this.$nextTick(function(){
|
||||
uniShare.hide()
|
||||
})
|
||||
return uniShare.isShow;
|
||||
}
|
||||
},
|
||||
// #endif
|
||||
onLoad() {
|
||||
// #ifdef APP-PLUS
|
||||
this.version = plus.runtime.version
|
||||
// #endif
|
||||
},
|
||||
computed: {
|
||||
uniStarterConfig() {
|
||||
return getApp().globalData.config
|
||||
},
|
||||
agreements() {
|
||||
if(!uniIdPagesConfig.agreements){
|
||||
return []
|
||||
}
|
||||
let {serviceUrl,privacyUrl} = uniIdPagesConfig.agreements
|
||||
return [
|
||||
{
|
||||
url:serviceUrl,
|
||||
title:"用户服务协议"
|
||||
},
|
||||
{
|
||||
url:privacyUrl,
|
||||
title:"隐私政策条款"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
version: "V1.0.0",
|
||||
year: "2020",
|
||||
about: {}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.about = this.uniStarterConfig.about
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.$t('about.about')+ " " + this.about.appName
|
||||
})
|
||||
this.year = (new Date).getFullYear()
|
||||
},
|
||||
onNavigationBarButtonTap() {
|
||||
let {
|
||||
download,
|
||||
appName,
|
||||
slogan,
|
||||
logo
|
||||
} = this.about
|
||||
uniShare.show({
|
||||
content: { //公共的分享类型(type)、链接(herf)、标题(title)、summary(描述)、imageUrl(缩略图)
|
||||
type: 0,
|
||||
href: download,
|
||||
title: appName,
|
||||
summary: slogan,
|
||||
imageUrl: logo + '?x-oss-process=image/resize,m_fill,h_100,w_100' //压缩图片解决,在ios端分享图过大导致的图片失效问题
|
||||
},
|
||||
menus: [{
|
||||
"img": "/static/app/sharemenu/wechatfriend.png",
|
||||
"text": this.$t('common.wechatFriends'),
|
||||
"share": {
|
||||
"provider": "weixin",
|
||||
"scene": "WXSceneSession"
|
||||
}
|
||||
},
|
||||
{
|
||||
"img": "/static/app/sharemenu/wechatmoments.png",
|
||||
"text": this.$t('common.wechatBbs'),
|
||||
"share": {
|
||||
"provider": "weixin",
|
||||
"scene": "WXSceneTimeline"
|
||||
}
|
||||
},
|
||||
{
|
||||
"img": "/static/app/sharemenu/weibo.png",
|
||||
"text": this.$t('common.weibo'),
|
||||
"share": {
|
||||
"provider": "sinaweibo"
|
||||
}
|
||||
},
|
||||
{
|
||||
"img": "/static/app/sharemenu/qq.png",
|
||||
"text": "QQ",
|
||||
"share": {
|
||||
"provider": "qq"
|
||||
}
|
||||
},
|
||||
{
|
||||
"img": "/static/app/sharemenu/copyurl.png",
|
||||
"text": this.$t('common.copy'),
|
||||
"share": "copyurl"
|
||||
},
|
||||
{
|
||||
"img": "/static/app/sharemenu/more.png",
|
||||
"text": this.$t('common.more'),
|
||||
"share": "shareSystem"
|
||||
}
|
||||
],
|
||||
cancelText: this.$t('common.cancelShare'),
|
||||
}, e => { //callback
|
||||
console.log(e);
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
navigateTo({
|
||||
url,
|
||||
title
|
||||
}) {
|
||||
uni.navigateTo({
|
||||
url: '/uni_modules/uni-id-pages/pages/common/webview/webview?url=' + url + '&title=' + title,
|
||||
success: res => {},
|
||||
fail: () => {},
|
||||
complete: () => {}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
/* #ifndef APP-NVUE */
|
||||
view{
|
||||
display: flex;
|
||||
box-sizing: border-box;
|
||||
flex-direction: column;
|
||||
}
|
||||
/* #endif */
|
||||
.about {
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.box {
|
||||
margin-top: 60px;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.logoImg {
|
||||
margin-bottom: 10rpx;
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
border-radius: 15px;
|
||||
}
|
||||
|
||||
.tip {
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
margin-top: 10px;
|
||||
padding: 10rpx;
|
||||
}
|
||||
|
||||
.appName {
|
||||
margin-top: 20px;
|
||||
font-size: 42rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.qrcode ,.qrcode .uqrcode{
|
||||
margin: 10px 0;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
/* #ifndef APP-NVUE */
|
||||
display: block;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.copyright {
|
||||
font-size: 32rpx;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
bottom: 20px;
|
||||
// left: 0;
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
.agreement-box {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.agreement {
|
||||
color: #2285ff;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.hint {
|
||||
text-align: center;
|
||||
color: #999999;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -1,179 +0,0 @@
|
||||
<template>
|
||||
<view class="about">
|
||||
<view class="box">
|
||||
<image class="logoImg" :src="about.logo"></image>
|
||||
<text class="tip appName">{{about.appName}}</text>
|
||||
<text class="tip">{{about.slogan}}</text>
|
||||
<view @click="download" id="download">
|
||||
<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>
|
||||
<text class="download-text">{{$t('invite.download')}}</text>
|
||||
</view>
|
||||
<text class="tip">version {{about.version}}</text>
|
||||
</view>
|
||||
<view class="copyright">
|
||||
<text class="hint">{{about.company}}</text>
|
||||
</view>
|
||||
<view class="mask" v-if="showMask">
|
||||
<image src="../../../static/h5/download-app/openImg.png" mode="widthFix"></image>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
computed: {
|
||||
uniStarterConfig() {
|
||||
return getApp().globalData.config
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
about: {},
|
||||
code: "",
|
||||
isIos: "",
|
||||
showMask: false,
|
||||
downloadUrl: {
|
||||
"ios": "",
|
||||
"android": ""
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.about = this.uniStarterConfig.about
|
||||
this.downloadUrl = this.uniStarterConfig.download
|
||||
this.year = (new Date).getFullYear()
|
||||
|
||||
//判断是否在微信中打开
|
||||
var userAgent = navigator.userAgent;
|
||||
var ua = userAgent.toLowerCase();
|
||||
this.isWeixin = ua.indexOf('micromessenger') != -1;
|
||||
//判断是否在ios或者安卓打开
|
||||
this.isIos = !!userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
|
||||
},
|
||||
onLoad({
|
||||
code
|
||||
}) {
|
||||
this.code = code
|
||||
document.getElementById("openApp").style.display = 'none'
|
||||
document.getElementsByTagName("body")[0].style = ""
|
||||
},
|
||||
methods: {
|
||||
download() {
|
||||
if (this.code) {
|
||||
uni.setClipboardData({
|
||||
data: this.code,
|
||||
complete: (e) => {
|
||||
console.log(e);
|
||||
uni.hideToast()
|
||||
/* 以下临时解决setClipboardData h5端样式和键盘弹出端错误解决方案,后续会直接内置*/
|
||||
document.getElementById("#clipboard").style.top = '-999px';
|
||||
uni.hideKeyboard()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (this.isIos) {
|
||||
window.location.href = this.downloadUrl.ios
|
||||
} else {
|
||||
if (this.isWeixin) {
|
||||
//显示浮层
|
||||
this.showMask = true
|
||||
} else {
|
||||
window.location.href = this.downloadUrl.android
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
/* #ifndef APP-NVUE */
|
||||
view {
|
||||
display: flex;
|
||||
box-sizing: border-box;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
.about {
|
||||
width: 750rpx;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.box {
|
||||
margin-top: 100px;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.logoImg {
|
||||
margin-bottom: 10upx;
|
||||
width: 160upx;
|
||||
height: 160upx;
|
||||
border-radius: 15px;
|
||||
}
|
||||
|
||||
.tip {
|
||||
font-size: 24rpx;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.appName {
|
||||
margin-top: 20px;
|
||||
font-size: 42rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.copyright {
|
||||
width: 750upx;
|
||||
font-size: 32rpx;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
bottom: 20px;
|
||||
left: 0;
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
.hint {
|
||||
color: #999999;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.icon {
|
||||
width: 34rpx;
|
||||
}
|
||||
|
||||
#download {
|
||||
background-color: #2A9839;
|
||||
color: #FFFFFF;
|
||||
margin: 55rpx;
|
||||
padding: 5px;
|
||||
height: 30px;
|
||||
width: 160rpx;
|
||||
border-radius: 100px;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.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>
|
||||
@@ -1,77 +0,0 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<unicloud-db ref="udb" v-slot:default="{data, pagination, loading, hasMore, error}" :where="udbWhere"
|
||||
collection="opendb-news-articles" @load="isLoading == false" @error="isLoading == false"
|
||||
field="title,_id" :page-size="10">
|
||||
<uni-list>
|
||||
<uni-list-item v-for="(item, index) in data" :key="index" :clickable="true"
|
||||
@click="handleItemClick(item)">
|
||||
<template v-slot:body>
|
||||
<view class="item">
|
||||
<text>{{item.title}}</text>
|
||||
<uni-dateformat class="article-date" :date="readNewsLog[index].last_time" format="yyyy-MM-dd hh:mm"
|
||||
:threshold="[0, 0]" />
|
||||
</view>
|
||||
</template>
|
||||
</uni-list-item>
|
||||
</uni-list>
|
||||
<uni-load-state @networkResume="refreshData" :state="{data,pagination,hasMore, loading, error}"></uni-load-state>
|
||||
</unicloud-db>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
isLoading: true,
|
||||
loadMore: {
|
||||
contentdown: '',
|
||||
contentrefresh: '',
|
||||
contentnomore: '',
|
||||
},
|
||||
readNewsLog:[],
|
||||
udbWhere:''
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.readNewsLog = uni.getStorageSync('readNewsLog')||[];
|
||||
let readNewsLogIds = this.readNewsLog.map(({article_id})=>article_id)
|
||||
console.log(typeof readNewsLogIds,readNewsLogIds);
|
||||
this.udbWhere = `"_id" in ${JSON.stringify(readNewsLogIds)}`
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.$t('newsLog.navigationBarTitle')
|
||||
})
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.refreshData();
|
||||
},
|
||||
onReachBottom() {
|
||||
this.$refs.udb.loadMore()
|
||||
},
|
||||
methods: {
|
||||
refreshData() {
|
||||
this.$refs.udb.loadData({
|
||||
clear: true
|
||||
}, (res) => {
|
||||
uni.stopPullDownRefresh()
|
||||
})
|
||||
},
|
||||
handleItemClick(item) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/list/detail?id=' + item._id + '&title=' + item.title
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.item{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.article-date {
|
||||
color: #C8C7CC;
|
||||
}
|
||||
</style>
|
||||
@@ -1,118 +0,0 @@
|
||||
/**
|
||||
* 判断Push是否开启
|
||||
*/
|
||||
function isTurnedOnPush(){
|
||||
var isOn = undefined;
|
||||
try{
|
||||
if('iOS' == plus.os.name){
|
||||
var types = 0;
|
||||
var app = plus.ios.invoke('UIApplication', 'sharedApplication');
|
||||
var settings = plus.ios.invoke(app, 'currentUserNotificationSettings');
|
||||
if(settings){
|
||||
types = settings.plusGetAttribute('types');
|
||||
plus.ios.deleteObject(settings);
|
||||
}else{
|
||||
types = plus.ios.invoke(app, 'enabledRemoteNotificationTypes');
|
||||
}
|
||||
plus.ios.deleteObject(app);
|
||||
isOn = (0!=types);
|
||||
}else{
|
||||
var main = plus.android.runtimeMainActivity();
|
||||
var manager = plus.android.invoke('com.igexin.sdk.PushManager', 'getInstance');
|
||||
isOn = plus.android.invoke(manager, 'isPushTurnedOn', main);
|
||||
}
|
||||
}catch(e){
|
||||
console.error('exception in isTurnedOnPush@dc-push!!');
|
||||
}
|
||||
return isOn;
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开Push
|
||||
* Android平台 - 打开个推(UniPush)的推送通道
|
||||
* iOS平台 - 如果开启通知功能,则打开应用的设置页面引导用户开启通知
|
||||
*/
|
||||
function turnOnPush(){
|
||||
try{
|
||||
if('iOS' == plus.os.name){
|
||||
// 如果设置中没有开启通知,则打开应用的设置界面
|
||||
if(!isTurnedOnPush()){
|
||||
settingInIos();
|
||||
}
|
||||
}else{
|
||||
var main = plus.android.runtimeMainActivity();
|
||||
var manager = plus.android.invoke('com.igexin.sdk.PushManager', 'getInstance');
|
||||
plus.android.invoke(manager, 'turnOnPush', main);
|
||||
}
|
||||
}catch(e){
|
||||
console.error('exception in turnOnPush@dc-push!!');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭Push
|
||||
* Android平台 - 关闭个推(UniPush)的推送通道
|
||||
* iOS平台 - 不做任何操作
|
||||
*/
|
||||
function trunOffPush(){
|
||||
try{
|
||||
if('iOS' == plus.os.name){
|
||||
// 这里不做任何操作(不引导用户关闭应用的推送能力),应该通知业务服务器不向此用户下发推送消息
|
||||
}else{
|
||||
var main = plus.android.runtimeMainActivity();
|
||||
var manager = plus.android.invoke('com.igexin.sdk.PushManager', 'getInstance');
|
||||
plus.android.invoke(manager, 'turnOffPush', main);
|
||||
}
|
||||
}catch(e){
|
||||
console.error('exception in trunOffPush@dc-push!!');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* iOS平台打开应用设置界面
|
||||
*/
|
||||
function settingInIos(){
|
||||
try{
|
||||
if('iOS' == plus.os.name){
|
||||
var app = plus.ios.invoke('UIApplication', 'sharedApplication');
|
||||
var setting = plus.ios.invoke('NSURL', 'URLWithString:', 'app-settings:');
|
||||
plus.ios.invoke(app, 'openURL:', setting);
|
||||
plus.ios.deleteObject(setting);
|
||||
plus.ios.deleteObject(app);
|
||||
}
|
||||
}catch(e){
|
||||
console.error('exception in settingInIos@dc-push!!');
|
||||
}
|
||||
}
|
||||
/**
|
||||
* android打开应用设置页面
|
||||
*/
|
||||
function settingInAndroid(){
|
||||
if (uni.getSystemInfoSync().platform == "android") {
|
||||
var main = plus.android.runtimeMainActivity();
|
||||
var Intent = plus.android.importClass('android.content.Intent');
|
||||
var Settings = plus.android.importClass('android.provider.Settings');
|
||||
var intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
// 安卓跳转设置页面详细查看(https://ask.dcloud.net.cn/question/14732)
|
||||
main.startActivity(intent);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 打开应用设置界面
|
||||
*/
|
||||
function setting(){
|
||||
if (uni.getSystemInfoSync().platform == "ios") {
|
||||
settingInIos();
|
||||
}
|
||||
if (uni.getSystemInfoSync().platform == "android") {
|
||||
settingInAndroid();
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
isOn: isTurnedOnPush,
|
||||
iosSetting: settingInIos,
|
||||
on: turnOnPush,
|
||||
off: trunOffPush,
|
||||
setting:setting
|
||||
}
|
||||
@@ -1,304 +0,0 @@
|
||||
<template>
|
||||
<view class="content">
|
||||
<!-- 功能列表 -->
|
||||
<uni-list class="mt10" :border="false">
|
||||
<uni-list-item :title="$t('settings.userInfo')" to="/uni_modules/uni-id-pages/pages/userinfo/userinfo" 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 class="mt10" :border="false">
|
||||
<!-- #ifndef H5 -->
|
||||
<!-- #ifdef APP-PLUS -->
|
||||
<!-- 检查push过程未结束不显示,push设置项 -->
|
||||
<uni-list-item :title="$t('settings.clearTmp')" @click="clearTmp" link></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 -->
|
||||
<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="$t('settings.facial')" @click="startSoterAuthentication('facial')" link></uni-list-item>
|
||||
<!-- #endif -->
|
||||
<uni-list-item v-if="i18nEnable" :title="$t('settings.changeLanguage')" @click="changeLanguage" :rightText="currentLanguage" link></uni-list-item>
|
||||
</uni-list>
|
||||
|
||||
<!-- 退出/登录 按钮 -->
|
||||
<view class="bottom-back" @click="changeLoginState">
|
||||
<text class="bottom-back-text" v-if="hasLogin">{{$t('settings.logOut')}}</text>
|
||||
<text class="bottom-back-text" v-else>{{$t('settings.login')}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import pushServer from './dc-push/push.js';
|
||||
import {
|
||||
store,
|
||||
mutations
|
||||
} from '@/uni_modules/uni-id-pages/common/store.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
pushServer:pushServer,
|
||||
supportMode:[],
|
||||
pushIsOn:"wait",
|
||||
currentLanguage:"",
|
||||
userInfo:{}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
hasLogin(){
|
||||
return store.hasLogin
|
||||
},
|
||||
i18nEnable(){
|
||||
return getApp().globalData.config.i18n.enable
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.currentLanguage = uni.getStorageSync('CURRENT_LANG') == "en"?'English':'简体中文'
|
||||
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.$t('settings.navigationBarTitle')
|
||||
})
|
||||
// #ifdef APP || MP-WEIXIN || (APP-HARMONY && uniVersion > 4.31)
|
||||
uni.checkIsSupportSoterAuthentication({
|
||||
success: (res) => {
|
||||
this.supportMode = res.supportMode
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log(err);
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
},
|
||||
onShow() {
|
||||
// 检查手机端获取推送是否开启
|
||||
//#ifdef APP-PLUS
|
||||
setTimeout(()=>{
|
||||
this.pushIsOn = pushServer.isOn();
|
||||
},300)
|
||||
//#endif
|
||||
},
|
||||
methods: {
|
||||
async changeLoginState(){
|
||||
if(this.hasLogin){
|
||||
await mutations.logout()
|
||||
}else{
|
||||
uni.redirectTo({
|
||||
// 默认使用账号密码登录页
|
||||
url: '/uni_modules/uni-id-pages/pages/login/login-withpwd',
|
||||
});
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 开始生物认证
|
||||
*/
|
||||
startSoterAuthentication(checkAuthMode) {
|
||||
console.log(checkAuthMode);
|
||||
let title = {"fingerPrint":this.$t('settings.fingerPrint'),"facial":this.$t('settings.facial')}[checkAuthMode]
|
||||
// 检查是否开启认证
|
||||
this.checkIsSoterEnrolledInDevice({checkAuthMode,title})
|
||||
.then(() => {
|
||||
console.log(checkAuthMode,title);
|
||||
// 开始认证
|
||||
uni.startSoterAuthentication({
|
||||
requestAuthModes: [checkAuthMode],
|
||||
challenge: '123456', // 微信端挑战因子
|
||||
authContent: this.$t('settings.please')+ " " + `${title}`,
|
||||
complete: (res) => {
|
||||
console.log(res);
|
||||
},
|
||||
success: (res) => {
|
||||
console.log(res);
|
||||
if (res.errCode == 0) {
|
||||
/**
|
||||
* 验证成功后开启自己的业务逻辑
|
||||
*
|
||||
* app端以此为依据 验证成功
|
||||
*
|
||||
* 微信小程序需要再次通过后台验证resultJSON与resultJSONSignature获取最终结果
|
||||
*/
|
||||
return uni.showToast({
|
||||
title: `${title}`+this.$t('settings.successText'),
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
uni.showToast({
|
||||
title:this.$t('settings.failTip'),
|
||||
icon: 'none'
|
||||
});
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log(err);
|
||||
console.log(`认证失败:${err.errCode}`);
|
||||
uni.showToast({
|
||||
title:this.$t('settings.authFailed'),
|
||||
// title: `认证失败`,
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
checkIsSoterEnrolledInDevice({checkAuthMode,title}) {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.checkIsSoterEnrolledInDevice({
|
||||
checkAuthMode,
|
||||
success: (res) => {
|
||||
console.log(res);
|
||||
if (res.isEnrolled) {
|
||||
return resolve(res);
|
||||
}
|
||||
uni.showToast({
|
||||
title: this.$t('settings.deviceNoOpen')+ `${title}`,
|
||||
icon: 'none'
|
||||
});
|
||||
reject(res);
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log(err);
|
||||
uni.showToast({
|
||||
title: `${title}` + this.$t('settings.fail'),
|
||||
icon: 'none'
|
||||
});
|
||||
reject(err);
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
clearTmp() {
|
||||
uni.showLoading({
|
||||
title: this.$t('settings.clearing'),
|
||||
mask: true
|
||||
});
|
||||
/*
|
||||
任何临时存储或删除不直接影响程序运行逻辑(清除缓存必定造成业务逻辑的变化,如:打开页面的图片不从缓存中读取而从网络请求)的内容都可以视为缓存。主要有storage、和file写入。
|
||||
缓存分为三部分
|
||||
原生层(如:webview、x5播放器的、第三方sdk的、地图组件等)
|
||||
前端框架(重启就会自动清除)
|
||||
开发者自己的逻辑(如:
|
||||
本示例的 检测更新功能下载了apk安装包,
|
||||
其他逻辑需要根据开发者自己的业务设计
|
||||
比如:有聊天功能的应用,聊天记录是否视为缓存,还是单独提供清除聊天记录的功能由开发者自己设计
|
||||
)
|
||||
*/
|
||||
uni.getSavedFileList({
|
||||
success:res=>{
|
||||
if (res.fileList.length > 0) {
|
||||
uni.removeSavedFile({
|
||||
filePath: res.fileList[0].filePath,
|
||||
complete:res=>{
|
||||
console.log(res);
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: this.$t('settings.clearedSuccessed'),
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
}else{
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: this.$t('settings.clearedSuccessed'),
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
},
|
||||
complete: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: () => {}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/* #ifndef APP-NVUE */
|
||||
page {
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
uni-button:after {
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
}
|
||||
/* #endif */
|
||||
.content {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
/* #endif */
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
background-color: #F9F9F9;
|
||||
}
|
||||
|
||||
.bottom-back {
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-top: 10px;
|
||||
width: 750rpx;
|
||||
height: 44px;
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
width: 100%;
|
||||
border: none;
|
||||
/* #endif */
|
||||
border-width: 0;
|
||||
border-radius: 0;
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
.bottom-back-text {
|
||||
font-size: 33rpx;
|
||||
}
|
||||
|
||||
.mt10 {
|
||||
margin-top: 10px;
|
||||
}
|
||||
/* #ifndef APP-NVUE || VUE3 */
|
||||
.content ::v-deep .uni-list {
|
||||
background-color: #F9F9F9;
|
||||
}
|
||||
.content ::v-deep .uni-list-item--disabled,.list-item {
|
||||
height: 50px;
|
||||
margin-bottom: 1px;
|
||||
}
|
||||
/* #endif */
|
||||
|
||||
</style>
|
||||
@@ -97,8 +97,10 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// #ifdef APP
|
||||
import checkUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update';
|
||||
import callCheckVersion from '@/uni_modules/uni-upgrade-center-app/utils/call-check-version';
|
||||
// #endif
|
||||
// #ifdef APP
|
||||
import UniShare from '@/uni_modules/uni-share/js_sdk/uni-share.js';
|
||||
const uniShare = new UniShare()
|
||||
@@ -110,7 +112,7 @@
|
||||
import {
|
||||
store,
|
||||
mutations
|
||||
} from '@/uni_modules/uni-id-pages/common/store.js'
|
||||
} from '@/common/store.js'
|
||||
import { put, get } from '@/common/request.js'
|
||||
import DeviceBindPopup from './components/DeviceBindPopup.vue'
|
||||
import DeviceListPopup from './components/DeviceListPopup.vue'
|
||||
@@ -188,13 +190,13 @@
|
||||
],
|
||||
[{
|
||||
"title": this.$t('mine.settings'),
|
||||
"to": '/pages/ucenter/settings/settings',
|
||||
"to": '/pages-subpackage/ucenter/settings/settings',
|
||||
"icon": "gear"
|
||||
}],
|
||||
// #ifdef APP
|
||||
[{
|
||||
"title": this.$t('mine.about'),
|
||||
"to": '/pages/ucenter/about/about',
|
||||
"to": '/pages-subpackage/ucenter/about/about',
|
||||
"icon": "info"
|
||||
}]
|
||||
// #endif
|
||||
@@ -327,7 +329,7 @@
|
||||
},
|
||||
toSettings() {
|
||||
uni.navigateTo({
|
||||
url: "/pages/ucenter/settings/settings"
|
||||
url: "/pages-subpackage/ucenter/settings/settings"
|
||||
})
|
||||
},
|
||||
signIn() { //普通签到
|
||||
@@ -344,7 +346,7 @@
|
||||
this[item.event]();
|
||||
} else if (item.to) {
|
||||
// 如果是 tabBar 页面,使用 switchTab
|
||||
const tabBarPages = ['/pages/reception/reception', '/pages/customer/customer', '/pages/team/team', '/pages/champion/champion']
|
||||
const tabBarPages = ['/pages/furniture_reception/furniture_reception', '/pages/furniture_customer/furniture_customer', '/pages/furniture_top_sales/furniture_top_sales', '/pages/ucenter/ucenter']
|
||||
if (tabBarPages.includes(item.to)) {
|
||||
uni.switchTab({
|
||||
url: item.to
|
||||
@@ -465,7 +467,7 @@
|
||||
content: { //公共的分享类型(type)、链接(herf)、标题(title)、summary(描述)、imageUrl(缩略图)
|
||||
type: 0,
|
||||
href: this.appConfig.h5.url +
|
||||
`/#/pages/ucenter/invite/invite?code=uniInvitationCode:${myInviteCode}`,
|
||||
`/#/pages-subpackage/ucenter/invite/invite?code=uniInvitationCode:${myInviteCode}`,
|
||||
title: appName,
|
||||
summary: slogan,
|
||||
imageUrl: logo +
|
||||
|
||||
Reference in New Issue
Block a user