提交 7344c2ed 编写于 作者: DCloud_JSON's avatar DCloud_JSON 提交者: study夏羽

- 修复登陆成功后响应体包含的问题 - 修改了表的schema中字段username的编辑权限,防止用户通过clientDB绕过用户名不能重复的规则更新用户名的问题

上级 742ddda1
<script>
import initApp from '@/common/appInit.js';
import checkIsAgree from '@/pages/uni-agree/utils/uni-agree.js';
import checkIsAgree from '@/pages/uni-agree/utils/uni-agree.js';
export default {
globalData: {
searchText: '',
appVersion: {},
config: {}
config: {},
$i18n: {},
$t: {}
},
onLaunch: function() {
setup() {
},
onLaunch: function() {
console.log('App Launch')
this.globalData.$i18n = this.$i18n
this.globalData.$t = str => this.$t(str)
initApp();
// #ifdef APP-PLUS
//checkIsAgree(); APP端暂时先用原生默认生成的。目前,自定义方式启动vue界面时,原生层已经请求了部分权限这并不符合国家的法规
// #endif
// #ifdef H5
// checkIsAgree(); // 默认不开启。目前全球,仅欧盟国家有网页端同意隐私权限的需要。如果需要
// #ifdef H5
// checkIsAgree(); // 默认不开启。目前全球,仅欧盟国家有网页端同意隐私权限的需要。如果需要
// #endif
// #ifdef APP-PLUS
......@@ -31,7 +39,25 @@
}
});
}*/
// #endif
console.log("国际化语言检测:" + plus.os.language);
// #endif
let updateTabbar = () => {
this.$t('tabbar').split(',').forEach((text, index) => {
uni.setTabBarItem({
index,
text,
complete: e => {
// console.log("e: " + JSON.stringify(e));
}
})
})
}
updateTabbar()
uni.$on('changeLanguage', e => {
console.log('changeLanguage',e);
updateTabbar()
})
},
onShow: function() {
console.log('App Show')
......
......@@ -56,7 +56,7 @@ export default async function() {
uniStarterConfig.router.login = loginConfig
// uniStarterConfig挂载到getApp().globalData.config
setTimeout(() => {
setTimeout(() => {
getApp({
allowDefault: true
}).globalData.config = uniStarterConfig;
......@@ -77,15 +77,19 @@ export default async function() {
code, // 错误码详见https://uniapp.dcloud.net.cn/uniCloud/clientdb?id=returnvalue
message
}) {
console.log('onDBError');
console.log('onDBError', {
code,
message
});
// 处理错误
console.log(code, message);
console.error(code, message);
if ([
'TOKEN_INVALID_INVALID_CLIENTID',
'TOKEN_INVALID',
'TOKEN_INVALID_TOKEN_EXPIRED',
'TOKEN_INVALID_WRONG_TOKEN',
'TOKEN_INVALID_ANONYMOUS_USER',
].includes(code)) {
uni.navigateTo({
url: '/pages/ucenter/login-page/index/index'
......@@ -115,10 +119,11 @@ export default async function() {
//拦截器封装callFunction
let callFunctionOption;
uniCloud.addInterceptor('callFunction', {
async invoke(option) {
async invoke(option) {
// #ifdef APP-PLUS
// 判断如果是执行登陆(无论是哪种登陆方式),就记录用户的相关设备id
if (option.name == 'uni-id-cf' && (option.data.action == 'register' || option.data.action.slice(0, 5) == 'login')) {
if (option.name == 'uni-id-cf' && (option.data.action == 'register' || option.data.action
.slice(0, 5) == 'login')) {
let oaid = await new Promise((callBack, fail) => {
if (uni.getSystemInfoSync().platform == "android") {
plus.device.getOAID({
......@@ -266,7 +271,7 @@ export default async function() {
tokenExpired
})
}
switch (e.result.code) {
switch (e.result.code) {
case 403:
uni.navigateTo({
url: "/pages/ucenter/login-page/index/index"
......@@ -287,6 +292,20 @@ export default async function() {
default:
console.log('code的值是:' + e.result.code, '可以在这里插入,自动处理响应体');
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;
}
}
})
......@@ -298,8 +317,8 @@ export default async function() {
visitor,
login
}
} = uniStarterConfig //需要登录的页面
} = uniStarterConfig //需要登录的页面
let list = ["navigateTo", "redirectTo", "reLaunch", "switchTab"];
list.forEach(item => { //用遍历的方式分别为,uni.navigateTo,uni.redirectTo,uni.reLaunch,uni.switchTab这4个路由方法添加拦截器
uni.addInterceptor(item, {
......@@ -310,15 +329,16 @@ export default async function() {
tokenExpired = uni.getStorageSync('uni_id_token_expired') < Date.now(),
//获取要跳转的页面路径(url去掉"?"和"?"后的参数)
url = e.url.split('?')[0];
//获取要前往的页面路径(即url去掉"?"和"?"后的参数)
const pages = getCurrentPages();
if(!pages.length){
return e
}
const fromUrl = pages[pages.length - 1].route;
let inLoginPage = fromUrl.split('/')[2] == 'login-page'
//获取要前往的页面路径(即url去掉"?"和"?"后的参数)
const pages = getCurrentPages();
if (!pages.length) {
console.log("首页启动调用了");
return e
}
const fromUrl = pages[pages.length - 1].route;
let inLoginPage = fromUrl.split('/')[2] == 'login-page'
//控制登录优先级
if ( //判断当前窗口是否为登陆页面,如果是则不重定向路由
url == '/pages/ucenter/login-page/index/index' &&
......@@ -332,27 +352,27 @@ export default async function() {
e.url += '?'
} //添加参数之前判断是否带了`?`号如果没有就补上,因为当开发场景本身有参数的情况下是已经带了`?`号
e.url += "type=" + login[0]
}
} else {
}
} else {
//拦截强制登录页面
let pass = true
//pattern
if (needLogin) {
pass = needLogin.every((item) => {
if(typeof(item) == 'object' && item.pattern){
return !item.pattern.test(url)
pass = needLogin.every((item) => {
if (typeof(item) == 'object' && item.pattern) {
return !item.pattern.test(url)
}
return url != item
})
})
// console.log({pass})
}
if (visitor&&!inLoginPage) {
pass = visitor.some((item) => {
if(typeof(item) == 'object' && item.pattern){
return item.pattern.test(url)
if (visitor && !inLoginPage) {
pass = visitor.some((item) => {
if (typeof(item) == 'object' && item.pattern) {
return item.pattern.test(url)
}
return url == item
})
})
// console.log({pass})
}
......@@ -380,8 +400,8 @@ export default async function() {
}
}
})
})
})
// #ifdef APP-PLUS
// 监听并提示设备网络状态变化
uni.onNetworkStatusChange(res => {
......
<template>
<view :style="{width,height}">
<image v-if="cSrc" :style="{width,height}" :src="cSrc" :mode="mode"></image>
</view>
</template>
<script>
export default {
name: "cloud-image",
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.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() {
},
data() {
return {
cSrc:false
};
}
}
</script>
\ No newline at end of file
......@@ -2,17 +2,17 @@
<view style="width: 750rpx;">
<template 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>
<text class="noData" v-else>暂无数据</text>
<text class="noData" v-else>{{$t('loadMore.noData')}}</text>
</template>
<view v-else>
<view class="box" v-if="networkType == 'none'">
<image class="icon-image" src="@/static/uni-load-state/disconnection.png" mode="widthFix"></image>
<text class="tip-text">网络异常</text>
<text class="tip-text">{{$t('loadMore.noNetwork')}}</text>
<view class="btn btn-default" @click="openSettings">
<text class="btn-text">前往设置</text>
<text class="btn-text">{{$t('loadMore.toSet')}}</text>
</view>
</view>
<text class="err" v-else>错误:{{JSON.stringify(state.error)}}</text>
<text class="err" v-else>{{$t('loadMore.error')}}:{{JSON.stringify(state.error)}}</text>
</view>
</view>
</template>
......@@ -121,6 +121,10 @@
.noData{
text-align: center;
padding: 30rpx;
width: 750rpx;
/* #ifndef APP-NVUE */
display: block;
/* #endif */
}
.err{
width: 750rpx;
......
......@@ -52,10 +52,10 @@
reverseTimer: null
};
},
computed: {
computed: {
innerText() {
if (this.reverseNumber == 0) return '获取验证码';
return '重新发送('+this.reverseNumber+'s)';
if (this.reverseNumber == 0) return this.$t('common').getVerifyCode;
return this.$t('smsCode.resendVerifyCode ')+ '('+this.reverseNumber+'s)';
}
},
created() {
......@@ -71,7 +71,7 @@
sendMsg() {
let reg_phone = /^1\d{10}$/;
if(!reg_phone.test(this.phone))return uni.showToast({
title: '手机号格式错误',
title: this.$t('smsCode.phoneErrTip'),
icon: 'none'
});
uniCloud.callFunction({
......@@ -87,7 +87,7 @@
console.log(result);
if(result.code===0){
uni.showToast({
title: "短信验证码发送成功",
title: this.$t('smsCode.sendSuccessTip'),
icon: 'none'
});
this.reverseNumber = Number(this.count);
......
export default {
tabbar:'List,Grid,Mine',
common: {
wechatFriends: "friends",
wechatBbs: "bbs",
weibo: "weibo",
more: "more",
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",
toEvaluate: "To Evaluate",
readArticles: "Read Articles",
myScore: "My Integral",
invite: "Invite Friends",
guestBook: "Guest Book Example",
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",
},
guestbook: {
navigationBarTitle:"Message board",
msgContent: "post message content",
notAvailable: "not available for visitors who are not logged in",
send: "send",
addSucceeded: "Successfully added",
noPermission: "You don't have permission for this operation",
},
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: "APP",
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 langZhCN from './zh-CN'
const messages = {
'en': langEn,
'zh-CN': langZhCN
}
let currentLang = uni.getStorageSync('CURRENT_LANG')
if (!currentLang) {
// 获取设备信息
uni.getSystemInfo({
success: function (res) {
uni.setStorageSync('CURRENT_LANG', res.language)
currentLang = res.language
}
})
}
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
\ No newline at end of file
export default {
tabbar:'列表,宫格,我的',
common:{
wechatFriends: "微信好友",
wechatBbs: "微信朋友圈",
weibo:"微博",
more: "更多",
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: "签到有奖",
toEvaluate: "去评分",
readArticles: "阅读过的文章",
myScore: "我的积分",
invite: "分销推荐",
guestBook: "留言板示例",
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: "错误",
},
guestbook:{
navigationBarTitle:"留言板",
msgContent: "发表留言内容",
notAvailable: "未登陆游客不可用",
send: "发送",
addSucceeded: "新增成功",
noPermission: "你没有该操作权限",
},
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 store from './store'
import store from './store'
import i18n from './lang/i18n'
// #ifndef VUE3
// #ifndef VUE3
import Vue from 'vue'
Vue.config.productionTip = false
Vue.prototype.$store = store
App.mpType = 'app'
const app = new Vue({
const app = new Vue({
i18n,
store,
...App
})
......@@ -16,12 +18,11 @@ app.$mount()
// #ifdef VUE3
import {
createSSRApp
} from 'vue'
import {createSSRApp} from 'vue'
export function createApp() {
const app = createSSRApp(App)
app.use(i18n)
app.use(store)
return {app}
}
......
{
"name": "uni-starter",
"name": "统一应用基本项目",
"appid": "请点击重新获取",
"description": "云端一体应用快速开发模版",
"versionName": "1.0.0",
"versionCode": "100",
"transformPx": false,
"app-plus": {
"locales": {
"en": {
// 英文
"name": "uni-starter", // 应用名称
"android": {
"strings": {
//Android平台自定义字符串
"CustomKey": "CustomValue"
}
},
"ios": {
"privacyDescription": {
//iOS平台隐私访问描述信息
"NSPhotoLibraryUsageDescription": "access to the user’s photo library(read)"
},
"infoPlist": {
//iOS平台自定义InfoPlist.strings
"CustomKey": "CustomValue"
}
}
},
"zh": {
// 中文(简体)
"name": "统一应用基本项目" // 应用名称
}
},
"privacy": {
"prompt": "template",
"template": {
......@@ -192,4 +218,7 @@
},
"_spaceID": "",
"vueVersion": "2"
}
\ No newline at end of file
}
//...
// 中文(简体)
// 应用名称
......@@ -4,11 +4,11 @@
"version": "1.0.48",
"description": "云端一体应用快速开发基本项目模版",
"keywords": [
"login",
"登录",
"搜索",
"uni-id例子"
],
"login",
"登录",
"搜索",
"uni-id例子"
],
"repository": "https://codechina.csdn.net/dcloud/uni-starter.git",
"engines": {
"HBuilderX": "^3.1.20"
......@@ -72,12 +72,14 @@
"快应用": {
"华为": "u",
"联盟": "u"
},
"Vue": {
"vue2": "y",
"vue3": "y"
}
},
"Vue": {
"vue2": "y",
"vue3": "y"
}
}
}
},
"dependencies": {
}
}
......@@ -164,6 +164,37 @@
}
}
,{
"path" : "pages/ucenter/settings/deactivate/deactivate",
"style" :
{
"navigationBarTitleText": "注销提醒",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/ucenter/guestbook/guestbook",
"style" :
{
"navigationBarTitleText": "留言板",
"enablePullDownRefresh": false,
"app-plus":{
"titleNView":{
"buttons":[
{
"text":"切换",
"fontSize":"12px"
},
{
"text":"注销",
"fontSize":"12px"
}
]
}
}
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
......
......@@ -22,8 +22,8 @@
</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">
<uni-grid :column="3" :highlight="true" @change="change">
<template v-for="(item,i) in gridList">
......@@ -52,7 +52,7 @@
},
data() {
return {
gridList: ['所有人可见','所有人可见','所有人可见', '游客不可见', '游客不可见', '游客不可见','管理员可见','管理员可见','管理员可见'],
gridList: [],
current: 0,
swiperDotIndex: 0
}
......@@ -60,12 +60,25 @@
computed: {
...mapGetters({
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: {
change(e) {
uni.showToast({
title: `点击第${e.detail.index}个宫格`,
title:this.$t('grid.clickTip') + " " + `${e.detail.index}` + " " + this.$t('grid.clickTipGrid'),
icon: 'none'
})
},
......@@ -144,6 +157,7 @@
}
.text {
text-align: center;
font-size: 26rpx;
margin-top: 10rpx;
}
......
......@@ -79,7 +79,8 @@
}),
uniStarterConfig() {
return getApp().globalData.config
}
}
},
onLoad(event) {
console.log(event);
......@@ -108,7 +109,7 @@
} else {
uni.showToast({
icon: 'none',
title: '出错了,新闻ID为空'
title: this.$t('listDetail').newsErr
})
}
},
......@@ -172,7 +173,7 @@
*/
followClick() {
uni.showToast({
title: '点击关注',
title:this.$t('listDetail').follow,
icon: 'none'
});
},
......@@ -202,7 +203,7 @@
},
menus: [{
"img": "/static/app-plus/sharemenu/wechatfriend.png",
"text": "微信好友",
"text": this.$t('common').wechatFriends,
"share": {
"provider": "weixin",
"scene": "WXSceneSession"
......@@ -210,7 +211,7 @@
},
{
"img": "/static/app-plus/sharemenu/wechatmoments.png",
"text": "微信朋友圈",
"text": this.$t('common').wechatBbs,
"share": {
"provider": "weixin",
"scene": "WXSenceTimeline"
......@@ -218,7 +219,7 @@
},
{
"img": "/static/app-plus/sharemenu/mp_weixin.png",
"text": "微信小程序",
"text": this.$t('common').wechatApplet,
"share": {
provider: "weixin",
scene: "WXSceneSession",
......@@ -234,7 +235,7 @@
},
{
"img": "/static/app-plus/sharemenu/weibo.png",
"text": "微博",
"text": this.$t('common').weibo,
"share": {
"provider": "sinaweibo"
}
......@@ -248,16 +249,16 @@
},
{
"img": "/static/app-plus/sharemenu/copyurl.png",
"text": "复制",
"text": this.$t('common').copy,
"share": "copyurl"
},
{
"img": "/static/app-plus/sharemenu/more.png",
"text": "更多",
"text": this.$t('common').more,
"share": "shareSystem"
}
],
cancelText: "取消分享",
cancelText: this.$t('common').cancelShare,
}, e => { //callback
// console.log(e);
})
......
......@@ -4,9 +4,8 @@
<statusBar></statusBar>
<!-- #endif -->
<!-- 搜索功能 -->
<uni-search-bar @click="searchClick" class="uni-search-box" v-model="keyword" ref="searchBar" radius="100"
cancelButton="none" disabled />
cancelButton="none" disabled :placeholder="$t('list.inputPlaceholder')" />
<view class="cover-search-bar" @click="searchClick"></view>
......@@ -63,7 +62,7 @@
refreshState: 0,
listHight: 0
}
},
},
watch: {
keyword(keyword, oldValue) {
if (keyword) {
......
......@@ -9,19 +9,19 @@
<!-- #endif -->
<!-- :cancelText="keyBoardPopup ? '取消' : '搜索'" -->
<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" :cancelText="$t('search.cancelText')" cancelButton="always" @clear="clear" @confirm="confirm" @cancel="backPage" />
</view>
</view>
<view class="search-body">
<!-- 搜索历史 -->
<view class="word-container" v-if="localSearchList.length">
<view class="word-container_header">
<text class="word-container_header-text">搜索历史</text>
<text class="word-container_header-text">{{$t('search.searchHistory')}}</text>
<uni-icons v-if="!localSearchListDel" @click="localSearchListDel = true" class="search-icons" style="padding-right: 0;"
:color="iconColor" size="18" type="trash"></uni-icons>
<view v-else class="flex-center flex-row" style="font-weight: 500;justify-content: space-between;">
<text style="font-size: 22rpx;color: #666;padding-top:4rpx;padding-bottom:4rpx;padding-right:20rpx;" @click="LocalSearchListClear">全部删除</text>
<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: #666;padding-top:4rpx;padding-bottom:4rpx;padding-right:20rpx;" @click="LocalSearchListClear">{{$t('search.deleteAll')}}</text>
<text style="font-size: 22rpx;color: #c0402b;padding-top:4rpx;padding-bottom:4rpx;padding-left:20rpx;" @click="localSearchListDel = false">{{$t('search.complete')}}</text>
</view>
</view>
......@@ -37,7 +37,7 @@
<view class="word-container">
<view class="word-container_header">
<view class="flex-center flex-row">
<text class="word-container_header-text">搜索发现</text>
<text class="word-container_header-text">{{$t('search.searchDiscovery')}}</text>
<uni-icons v-if="!netHotListIsHide" class="search-icons" :color="iconColor" size="14" type="reload" @click="searchHotRefresh"></uni-icons>
</view>
<uni-icons class="search-icons" style="padding-right: 0;" :color="iconColor" size="18" :type="netHotListIsHide ? 'eye-slash' : 'eye'"
......@@ -55,7 +55,7 @@
</template>
</template>
<view v-else style="flex:1;">
<text class="word-container_body-info">当前搜索发现已隐藏</text>
<text class="word-container_body-info">{{$t('search.searchHiddenTip')}}</text>
</view>
</view>
</unicloud-db>
......@@ -139,7 +139,6 @@
iconColor: '#999999',
associativeList: [],
keyBoardPopup: false,
hotWorld: 'DCloud', // 搜索热词,如果没有输入即回车,则搜索热词,但是不会加入搜索记录
focus: true, // 是否自动聚焦
speechEngine: 'iFly' // 语音识别引擎 iFly 讯飞 baidu 百度
......@@ -157,6 +156,11 @@
this.searchText = getApp().globalData.searchText;
},
computed: {
associativeShow() {
return this.searchText && this.associativeList.length;
}
},
onLoad() {
//#ifdef APP-PLUS
this.statusBarHeight = `${uni.getSystemInfoSync().statusBarHeight}px`;
......@@ -209,8 +213,8 @@
},
LocalSearchListClear() {
uni.showModal({
content: '确认清空搜索历史吗?',
confirmText: '删除',
content: this.$t('search.deleteTip'),
confirmText: this.$t('search.delete'),
confirmColor: 'red',
cancelColor: '#808080',
success: res => {
......@@ -302,11 +306,7 @@
uni.navigateBack();
}
},
computed: {
associativeShow() {
return this.searchText && this.associativeList.length;
}
},
watch: {
searchText: debounce(function(value) {
if (value) {
......
......@@ -6,12 +6,12 @@
<text class="tip">Version {{version}}</text>
<!--Sansnn-uQRCode组件来源,插件市场:https://ext.dcloud.net.cn/plugin?id=1287 微调后-->
<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 class="copyright">
<view class="agreement-box" v-for="(agreement,index) in about.agreements" :key="index">
<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>
<text class="hint">Copyright © {{year}}</text>
<text class="hint">{{about.company}}</text>
......@@ -30,7 +30,7 @@
uniStarterConfig() {
console.log(getApp());
return getApp().globalData.config
}
}
},
data() {
return {
......@@ -42,7 +42,7 @@
created() {
this.about = this.uniStarterConfig.about
uni.setNavigationBarTitle({
title: '关于' + this.about.appName
title: this.$t('about.about')+ " " + this.about.appName
})
this.year = (new Date).getFullYear()
},
......@@ -63,7 +63,7 @@
},
menus: [{
"img": "/static/app-plus/sharemenu/wechatfriend.png",
"text": "微信好友",
"text": this.$t('common').wechatFriends,
"share": {
"provider": "weixin",
"scene": "WXSceneSession"
......@@ -71,7 +71,7 @@
},
{
"img": "/static/app-plus/sharemenu/wechatmoments.png",
"text": "微信朋友圈",
"text": this.$t('common').wechatBbs,
"share": {
"provider": "weixin",
"scene": "WXSenceTimeline"
......@@ -79,7 +79,7 @@
},
{
"img": "/static/app-plus/sharemenu/weibo.png",
"text": "微博",
"text": this.$t('common').weibo,
"share": {
"provider": "sinaweibo"
}
......@@ -93,16 +93,16 @@
},
{
"img": "/static/app-plus/sharemenu/copyurl.png",
"text": "复制",
"text": this.$t('common').copy,
"share": "copyurl"
},
{
"img": "/static/app-plus/sharemenu/more.png",
"text": "更多",
"text": this.$t('common').more,
"share": "shareSystem"
}
],
cancelText: "取消分享",
cancelText: this.$t('common').cancelShare,
}, e => { //callback
console.log(e);
})
......@@ -131,7 +131,7 @@
}
/* #endif */
.about {
width: 750upx;
width: 750rpx;
flex-direction: column;
}
......@@ -143,15 +143,17 @@
}
.logoImg {
margin-bottom: 10upx;
width: 160upx;
height: 160upx;
margin-bottom: 10rpx;
width: 160rpx;
height: 160rpx;
border-radius: 15px;
}
.tip {
.tip {
text-align: center;
font-size: 24rpx;
margin-top: 10px;
margin-top: 10px;
padding: 10rpx;
}
.appName {
......@@ -161,11 +163,11 @@
}
.qrcode {
margin-top: 50px;
margin-top: 60rpx;
}
.copyright {
width: 750upx;
width: 750rpx;
font-size: 32rpx;
flex-direction: column;
justify-content: center;
......
<template>
<view class="page">
<unicloud-db ref="udb" class="content" v-slot:default="{data,pagination,hasMore, loading, error}"
collection="guestbook,uni-id-users" :where="udbWhere" field="uid.username,uid._id,uid.avatar_file,text,_id,state">
<view v-if="error">{{error.message}}</view>
<view v-else>
<view v-for="(item,index) in data" :key="index" class="item">
<view class="main">
<!-- <uni-file-picker v-if="item.uid[0].avatar_file" v-model="item.uid[0].avatar_file"
fileMediatype="image" :del-icon="false" return-type="object" :image-styles="listStyles" disablePreview
disabled
></uni-file-picker> -->
<cloud-image :src="item.uid[0].avatar_file.url"></cloud-image>
<view>
<text class="username">{{item.uid[0].username}}</text>
<text>{{item.text}}</text>
</view>
</view>
<view class="handle">
<switch :checked="item.state" @change="setState(item,$event)" />
<uni-icons @click="deleteItem(item._id)" type="trash" size="18" color="#c9c3cd" />
</view>
</view>
<uni-load-state :state="{data,pagination,hasMore,loading}"></uni-load-state>
</view>
</unicloud-db>
<view class="submit-box">
<cloud-image class="userImg" width="60rpx" height="60rpx" v-if="userInfo.avatar_file&&userInfo.avatar_file.url" :src="userInfo.avatar_file.url"></cloud-image>
<image class="userImg" v-else src="/static/uni-center/grey.png" mode="widthFix"/>
<input class="input-box" v-model="text" :disabled="!hasLogin" :placeholder="hasLogin?$t('guestbook.msgContent'):$t('guestbook.notAvailable')" />
<button @click="text?send():''" class="btn" :class="{active:text}">{{$t('guestbook.send')}}</button>
</view>
</view>
</template>
<script>
const db = uniCloud.database();
const guestbookTable = db.collection('guestbook')
import {
mapMutations,mapGetters
} from 'vuex';
export default {
computed: {
...mapGetters({
userInfo: 'user/info',
hasLogin: 'user/hasLogin'
}),
udbWhere(){
return this.hasLogin?'':{state:true}
}
},
data() {
return {
text: ""
}
},
onLoad() {
uni.setNavigationBarTitle({
title: this.$t('guestbook.navigationBarTitle')
})
},
methods: {
setState(item, e) {
item.state = e.detail.value
console.log(item, e);
this.$refs.udb.update(item._id,{
state: item.state
},{
needConfirm:false,
toastTitle: this.$t('common').updateSucceeded, // toast提示语
success: (res) => { // 新增成功后的回调
let {code,message} = res
console.log(code,message);
},
fail: (err) => { // 新增失败后的回调
let {message} = err
console.log(err);
// 判断没有权限
uni.showToast({
title:this.$t('guestbook.noPermission'),
icon: 'none'
});
this.$nextTick(() => {
item.state = !e.detail.value
})
},
complete: () => { // 完成后的回调
}
})
},
deleteItem(id) {
this.$refs.udb.remove(id, {
complete: e => {
console.log(e);
}
})
},
send() {
this.$refs.udb.add({
text: this.text
},{
toastTitle:this.$t('guestbook.addSucceeded'), // toast提示语
success: (res) => { // 新增成功后的回调
let {code,message} = res
console.log(code,message);
this.$refs.udb.refresh() //{clear:true}
},
fail: (err) => { // 新增失败后的回调
let {message} = err
console.log(err);
},
complete: () => { // 完成后的回调
}
})
},
...mapMutations({
logout: 'user/logout'
}),
},
onNavigationBarButtonTap(e) {
console.log(e);
if(e.index){
this.logout()
}else{
uni.navigateTo({
url:"/pages/ucenter/login-page/index/index"
})
}
}
}
</script>
<style>
view {
display: flex;
flex-direction: column;
box-sizing: border-box;
}
.content {
padding-bottom: 110px;
}
.item {
flex-direction: row;
justify-content: space-between;
padding: 10rpx;
width: 730rpx;
margin-left: 10rpx;
border-radius: 10px;
margin-top: 10px;
}
.item .main,
.item .handle {
flex-direction: row;
align-items: center;
}
.item .main text {
padding: 0 10rpx;
color: #666666;
font-size: 24rpx;
}
.item .main .username {
font-weight: 600;
}
.item .handle switch {
transform: scale(0.6);
}
.submit-box {
position: fixed;
flex-direction: row;
align-items: center;
bottom: 0;
padding: 20rpx 15rpx;
width: 750rpx;
border-top: solid 1px #efecf2;
background-color: #ffffff;
height: 56px;
}
.userImg {
width: 60rpx;
height: 60rpx;
border-radius: 100px;
background-color: #f0eef4;
}
.submit-box .input-box {
background-color: #f8f8f8;
padding: 15rpx;
flex-grow: 1;
margin: 20rpx;
border-radius: 6px;
font-size: 24rpx;
}
.submit-box .btn {
height: 30px;
line-height: 30px;
font-size: 24rpx;
width: 80rpx;
padding: 0;
color: #888888;
}
.submit-box .btn::after {
display: none;
}
.submit-box .btn.active {
background-color: #007aff;
color: #FFFFFF;
}
</style>
\ No newline at end of file
......@@ -7,7 +7,7 @@
<view @click="download" type="default" 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">下载</text>
<text class="download-text">{{$t('invite.download')}}</text>
</view>
<text class="tip">version {{about.version}}</text>
</view>
......
<template>
<view class="content">
<!-- 顶部文字 -->
<text class="title">登录后即可展示自己</text>
<text class="title">{{$t('login.phoneLogin')}}</text>
<!-- 登录框 -->
<view v-if="['apple','weixin'].includes(type)" class="quickLogin">
<image @click="quickLogin" :src="imgSrc" mode="widthFix" class="quickLoginBtn"></image>
......@@ -9,11 +9,11 @@
</view>
<template v-else>
<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>
<button class="get-code" :disabled="!isPhone" :type="isPhone?'primary':'default'"
@click="sendShortMsg">获取短信验证码</button>
<text class="tip">未注册的手机号验证通过后将自动注册</text>
@click="sendShortMsg">{{$t('login.getVerifyCode')}}</button>
<text class="tip">{{$t('login.phoneLoginTip')}}</text>
</template>
<!-- 快捷登录按钮弹窗 -->
......@@ -40,7 +40,7 @@
},
imgSrc() {
return '/static/login-index/' + this.type + '.png'
}
}
},
onLoad(e) {
this.type = e.type
......@@ -85,7 +85,7 @@
sendShortMsg() {
if (!this.agree) {
return uni.showToast({
title: '你未同意隐私政策协议',
title: this.$t('common').noAgree,
icon: 'none'
});
}
......
<template>
<view class="content">
<!-- 顶部文字 -->
<text class="tit">请输入验证码</text>
<text class="tit">{{$t('common.verifyCodePlaceholder')}}</text>
<text class="tip">{{tipText}}</text>
<uni-forms>
<!-- 登录框 (选择手机号所属国家和地区需要另行实现) -->
<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>
<uni-send-sms-code :phone="phone" ref="sendSmsCode"></uni-send-sms-code>
</template>
</uni-easyinput>
<button class="send-btn" :disabled="!canSubmit" :type="canSubmit?'primary':'default'"
@click="submit">登录</button>
@click="submit">{{$t('common.login')}}</button>
</uni-forms>
<uni-quick-login></uni-quick-login>
</view>
......@@ -29,17 +29,17 @@
},
computed: {
tipText() {
return `验证码已通过短信发送至${this.phone}。`;
return this.$t('common.verifyCodeSend')+ `${this.phone}。`;
},
canSubmit(){
return this.code.length==6;
}
}
},
onLoad({phoneNumber,phoneArea}) {
this.phone = phoneNumber;
},
onReady() {
this.$refs.sendSmsCode.start();
// this.$refs.sendSmsCode.start();
},
methods: {
submit(){ //完成并提交
......@@ -63,7 +63,6 @@
}
}
})
}
}
}
......
<template>
<view class="content">
<!-- 顶部文字 -->
<text class="title">用户名密码登录</text>
<input class="input-box" :inputBorder="false" v-model="username" placeholder="请输入手机号/用户名"/>
<input type="password" class="input-box" :inputBorder="false" v-model="password" placeholder="请输入密码"/>
<text class="title">{{$t('pwdLogin.pwdLogin')}}</text>
<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="$t('pwdLogin.passwordPlaceholder')"/>
<view class="captcha-box" v-if="captchaBase64">
<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>
<uni-agreements @setAgree="agree = $event"></uni-agreements>
<button class="send-btn" :disabled="!canLogin" :type="canLogin?'primary':'default'"
@click="pwdLogin">登录</button>
@click="pwdLogin">{{$t('pwdLogin.login')}}</button>
<!-- 忘记密码 -->
<view class="auth-box">
<text class="link" @click="toRetrievePwd">忘记密码</text>
<text class="link" @click="toRegister">注册账号</text>
<text class="link" @click="toRetrievePwd">{{$t('pwdLogin.forgetPassword')}}</text>
<text class="link" @click="toRegister">{{$t('pwdLogin.register')}}</text>
</view>
<uni-quick-login :agree="agree" ref="uniQuickLogin"></uni-quick-login>
</view>
......@@ -58,7 +58,7 @@
pwdLogin() {
if (!this.agree) {
return uni.showToast({
title: '你未同意隐私政策协议',
title: this.$t('common').noAgree,
icon: 'none'
});
}
......@@ -86,10 +86,10 @@
this.createCaptcha()
}else{
uni.showModal({
title: '错误',
title: this.$t('common').error,
content: result.msg,
showCancel: false,
confirmText: '知道了'
confirmText: this.$t('common').gotIt
});
}
}
......
......@@ -6,11 +6,11 @@
<uni-forms-item name="phone">
<!-- focus规则如果上一页携带来“手机号码”数据就focus验证码输入框,否则focus手机号码输入框 -->
<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 name="code">
<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">
<uni-send-sms-code ref="shortCode" :phone="formData.phone"></uni-send-sms-code>
</template>
......@@ -18,14 +18,14 @@
</uni-forms-item>
<uni-forms-item name="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 name="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>
<button class="send-btn-box" :disabled="!canSubmit" :type="canSubmit?'primary':'default'"
@click="submit">完成</button>
@click="submit">{{$t('common.complete')}}</button>
</uni-forms>
</view>
</template>
......@@ -46,44 +46,44 @@
phone: {
rules: [{
required: true,
errorMessage: '请输入手机号',
errorMessage: this.$t('common.phonePlaceholder'),
},
{
pattern: /^1\d{10}$/,
errorMessage: '手机号格式不正确',
errorMessage: this.$t('common.formatErr'),
}
]
},
code: {
rules: [{
required: true,
errorMessage: '请输入验证码',
errorMessage: this.$t('common.verifyCodePlaceholder'),
},
{
pattern: /^.{6}$/,
errorMessage: '请输入6位验证码',
errorMessage: this.$t('common.sixDigitCode'),
}
]
},
pwd: {
rules: [{
required: true,
errorMessage: '请输入密码',
errorMessage:this.$t('common.newPasswordPlaceholder'),
},
{
pattern: /^.{6,20}$/,
errorMessage: '密码应为6到20位',
errorMessage: this.$t('common.passwordDigits'),
}
]
},
pwd2: {
rules: [{
required: true,
errorMessage: '请确认密码',
errorMessage:this.$t('common.confirmPassword'),
},
{
pattern: /^.{6,20}$/,
errorMessage: '密码应为6到20位',
errorMessage: this.$t('common.passwordDigits'),
},
{
validateFunction: function(rule, value, data, callback) {
......@@ -99,7 +99,7 @@
}
}
},
computed: {
computed: {
canSubmit() {
return this.isPhone && this.isPwd && this.isCode;
},
......@@ -124,6 +124,9 @@
this.formData.phone = event.phoneNumber;
this.lock = true
}
uni.setNavigationBarTitle({
title: this.$t('common.resetNavTitle')
})
},
onReady() {
if (this.formData.phone) {
......
......@@ -2,19 +2,19 @@
<view class="uni-container">
<uni-forms ref="form" :value="formData" :rules="rules" validate-trigger="submit" err-show-type="undertext">
<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 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" />
</uni-forms-item>
<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 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-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>
</view>
</template>
......@@ -39,6 +39,11 @@ import mixin from '../common/login-page.mixin.js';
onReady() {
this.$refs.form.setRules(this.rules)
},
onLoad() {
uni.setNavigationBarTitle({
title: this.$t('register.navigationBarTitle')
})
},
methods: {
/**
* 触发表单提交
......@@ -46,7 +51,7 @@ import mixin from '../common/login-page.mixin.js';
submit() {
if(!this.agree){
return uni.showToast({
title: '你未同意隐私政策协议',
title: this.$t('common').noAgree,
icon: 'none'
});
}
......
......@@ -38,7 +38,10 @@
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)}`
this.udbWhere = `"_id" in ${JSON.stringify(readNewsLogIds)}`
uni.setNavigationBarTitle({
title: this.$t('newsLog.navigationBarTitle')
})
},
onPullDownRefresh() {
this.refreshData();
......
<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>
export default {
data() {
return {
}
},
onLoad() {
uni.setNavigationBarTitle({
title: this.$t('deactivate.navigationBarTitle')
})
uni.showModal({
content: '该功能暂未完全开发完成,敬请期待!',
showCancel: false
});
},
methods: {
cancel(){
uni.navigateBack()
},
nextStep(){
uni.showModal({
content: '已经仔细阅读注销提示,知晓可能带来的后果,并确认要注销',
complete: (e) => {
if(e.confirm){
uni.showToast({
title: '该功能暂未开发完成',
icon: 'none'
});
}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>
......@@ -2,25 +2,30 @@
<view class="content">
<!-- 功能列表 -->
<uni-list class="mt10" :border="false">
<uni-list-item title="个人资料" 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 :title="$t('settings.userInfo')" to="/pages/ucenter/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 -->
<uni-list class="mt10" :border="false">
<!-- #ifdef APP-PLUS -->
<!-- 检查push过程未结束不显示,push设置项 -->
<uni-list-item title="清理缓存" @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 :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="$t('settings.pushServer')" showSwitch :switchChecked="pushIsOn"></uni-list-item>
<!-- #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('facial')" title="人脸解锁" @click="startSoterAuthentication('facial')" 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="$t('settings.facial')" @click="startSoterAuthentication('facial')" link></uni-list-item>
<!-- #endif -->
<uni-list-item :title="$t('settings.changeLanguage')" @click="changeLanguage" :rightText="currentLanguage" link></uni-list-item>
</uni-list>
<!-- #endif -->
<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">
<text class="bottom-back-text" v-if="hasLogin">退出登录</text>
<text class="bottom-back-text" v-else>登录</text>
<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>
......@@ -36,16 +41,22 @@
return {
pushServer:pushServer,
supportMode:[],
pushIsOn:"wait"
pushIsOn:"wait",
currentLanguage:""
}
},
computed: {
...mapGetters({
'userInfo': 'user/info',
'hasLogin': 'user/hasLogin',
})
})
},
onLoad() {
onLoad() {
this.currentLanguage = uni.getStorageSync('CURRENT_LANG') == "en"?'English':'简体中文'
uni.setNavigationBarTitle({
title: this.$t('settings.navigationBarTitle')
})
// #ifdef APP-PLUS || MP-WEIXIN
uni.checkIsSupportSoterAuthentication({
success: (res) => {
......@@ -56,7 +67,7 @@
console.log(err);
}
})
// #endif
// #endif
},
onShow() {
// 检查手机端获取推送是否开启
......@@ -74,6 +85,11 @@
uni.navigateTo({
url: '/pages/ucenter/userinfo/userinfo'
});
},
deactivate(){
uni.navigateTo({
url:"/pages/ucenter/settings/deactivate/deactivate"
})
},
changePwd() {
uni.navigateTo({
......@@ -89,7 +105,7 @@
*/
startSoterAuthentication(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})
.then(() => {
......@@ -98,7 +114,7 @@
uni.startSoterAuthentication({
requestAuthModes: [checkAuthMode],
challenge: '123456', // 微信端挑战因子
authContent: `请用${title}`,
authContent: this.$t('settings.please')+ " " + `${title}`,
complete: (res) => {
console.log(res);
},
......@@ -113,12 +129,12 @@
* 微信小程序需要再次通过后台验证resultJSON与resultJSONSignature获取最终结果
*/
return uni.showToast({
title: `${title}成功`,
title: `${title}`+this.$t('settings.successText'),
icon: 'none'
});
}
uni.showToast({
title: '认证失败请重试',
title:this.$t('settings.failTip'),
icon: 'none'
});
},
......@@ -126,7 +142,8 @@
console.log(err);
console.log(`认证失败:${err.errCode}`);
uni.showToast({
title: `认证失败`,
title:this.$t('settings.authFailed'),
// title: `认证失败`,
icon: 'none'
});
}
......@@ -143,7 +160,7 @@
return resolve(res);
}
uni.showToast({
title: `设备未开启${title}`,
title: this.$t('settings.deviceNoOpen')+ `${title}`,
icon: 'none'
});
reject(res);
......@@ -151,7 +168,7 @@
fail: (err) => {
console.log(err);
uni.showToast({
title: `${title}失败`,
title: `${title}` + this.$t('settings.fail'),
icon: 'none'
});
reject(err);
......@@ -162,10 +179,10 @@
clickLogout() {
if (this.hasLogin) {
uni.showModal({
title: '提示',
content: '是否退出登录',
cancelText: '取消',
confirmText: '确定',
title: this.$t('settings.tips'),
content: this.$t('settings.exitLogin'),
cancelText: this.$t('settings.cancelText'),
confirmText: this.$t('settings.confirmText'),
success: res => {
if (res.confirm) {
this.logout();
......@@ -183,7 +200,7 @@
},
clearTmp() {
uni.showLoading({
title: '清除中',
title: this.$t('settings.clearing'),
mask: true
});
/*
......@@ -206,7 +223,7 @@
console.log(res);
uni.hideLoading()
uni.showToast({
title: '清除成功',
title: this.$t('settings.clearedSuccessed'),
icon: 'none'
});
}
......@@ -214,7 +231,7 @@
}else{
uni.hideLoading()
uni.showToast({
title: '清除成功',
title: this.$t('settings.clearedSuccessed'),
icon: 'none'
});
}
......@@ -223,6 +240,37 @@
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-CN' || res.tapIndex && language=='en'
){
const globalData = getApp().globalData
if (language === 'en') {
language = globalData.locale = 'zh-CN'
} else {
language = globalData.locale = 'en'
}
uni.setStorageSync('CURRENT_LANG', language)
getApp().$i18n.locale = language
this.currentLanguage = res.tapIndex?'简体中文':'English'
uni.reLaunch({
url: '/pages/list/list',
complete: () => {
uni.$emit("changeLanguage",language)
}
})
}
},
fail: () => {},
complete: () => {}
});
}
}
}
......
......@@ -2,13 +2,11 @@
<view class="center">
<uni-sign-in ref="signIn"></uni-sign-in>
<view class="userInfo" @click.capture="toUserInfo">
<uni-file-picker v-if="userInfo.avatar_file&&userInfo.avatar_file.url" v-model="userInfo.avatar_file"
fileMediatype="image" :del-icon="false" return-type="object" :image-styles="listStyles" disablePreview
disabled />
<image v-else class="logo-img" src="/static/uni-center/defaultAvatarUrl.png"></image>
<cloud-image width="150rpx" height="150rpx" v-if="userInfo.avatar_file&&userInfo.avatar_file.url" :src="userInfo.avatar_file.url"></cloud-image>
<image v-else class="logo-img" src="@/static/uni-center/defaultAvatarUrl.png"></image>
<view class="logo-title">
<text class="uer-name" v-if="hasLogin">{{userInfo.nickname||userInfo.username||userInfo.mobile}}</text>
<text class="uer-name" v-else>未登陆</text>
<text class="uer-name" v-else>{{$t('mine.notLogged')}}</text>
</view>
</view>
<uni-grid class="grid" :column="4" :showBorder="false" :square="true">
......@@ -44,65 +42,69 @@
data() {
return {
gridList: [{
"text": "文字1",
"text": this.$t('mine.showText'),
"icon": "chat"
},
{
"text": "文字2",
"text": this.$t('mine.showText'),
"icon": "cloud-upload"
},
{
"text": "文字3",
"text": this.$t('mine.showText'),
"icon": "contact"
},
{
"text": "文字4",
"text": this.$t('mine.showText'),
"icon": "download"
}
],
ucenterList: [
[{
"title": '签到有奖',
"title": this.$t('mine.signIn'),
"event": 'signIn',
"icon": "compose"
},
// #ifdef APP-PLUS
{
"title": '去评分',
"title": this.$t('mine.toEvaluate'),
"event": 'gotoMarket',
"icon": "hand-thumbsup"
},
//#endif
{
"title": '阅读过的文章',
"title":this.$t('mine.readArticles'),
"to": '/pages/ucenter/read-news-log/read-news-log',
"icon": "flag"
},
{
"title": '我的积分',
"title": this.$t('mine.myScore'),
"to": '',
"event": 'getScore',
"icon": "paperplane"
}
// #ifdef APP-PLUS
, {
"title": '分销推荐',
"title": this.$t('mine.invite'),
"event": 'share',
"icon": "redo"
}
// #endif
],
[{
"title": '问题与反馈',
"title": this.$t('mine.guestBook'),
"to": '/pages/ucenter/guestbook/guestbook',
"icon": "chat"
},{
"title": this.$t('mine.feedback'),
"to": '/uni_modules/uni-feedback/pages/uni-feedback/uni-feedback',
"icon": "help"
}, {
"title": '设置',
"title": this.$t('mine.settings'),
"to": '/pages/ucenter/settings/settings',
"icon": "gear"
}],
[{
"title": '关于',
"title": this.$t('mine.about'),
"to": '/pages/ucenter/about/about',
"icon": "info"
}]
......@@ -123,7 +125,7 @@
// console.log(313,this.userInfo,this.hasLogin);
//#ifdef APP-PLUS
this.ucenterList[this.ucenterList.length - 2].unshift({
title: '检查更新',
title:this.$t('mine.checkUpdate'),// this.this.$t('mine.checkUpdate')"检查更新"
rightText: this.appVersion.version + '-' + this.appVersion.versionCode,
event: 'checkVersion',
icon: 'loop',
......@@ -145,7 +147,7 @@
,
appConfig() {
return getApp().globalData.config
}
}
},
methods: {
...mapMutations({
......@@ -186,7 +188,8 @@
},
tapGrid(index) {
uni.showToast({
title: '你点击了,第' + (index + 1) + '',
// title: '你点击了,第' + (index + 1) + '个',
title: this.$t('mine.clicked') + " " + (index + 1) ,
icon: 'none'
});
},
......@@ -215,25 +218,30 @@
*/
getScore() {
if (!this.userInfo) return uni.showToast({
title: '请登录后查看积分',
title: this.$t('mine.checkScore'),
icon: 'none'
});
uni.showLoading({
mask: true
})
db.collection("uni-id-scores").where('"user_id" == $env.uid').field('score,balance').get().then((res) => {
uni.hideLoading()
console.log(res);
const data = res.result.data[0];
let msg = '';
msg = data ? ('当前积分为' + data.score) : '当前无积分';
uni.showToast({
title: msg,
icon: 'none'
});
}).finally(()=>{
uni.hideLoading()
})
db.collection("uni-id-scores")
.where('"user_id" == $env.uid')
.field('score,balance')
.orderBy("create_date", "desc")
.limit(1)
.get()
.then((res) => {
console.log(res);
const data = res.result.data[0];
let msg = '';
msg = data ? (this.$t('mine.currentScore')+ data.balance) : this.$t('mine.noScore');
uni.showToast({
title: msg,
icon: 'none'
});
}).finally(()=>{
uni.hideLoading()
})
},
async share() {
let {
......@@ -266,7 +274,7 @@
},
menus: [{
"img": "/static/app-plus/sharemenu/wechatfriend.png",
"text": "微信好友",
"text": this.$t('common').wechatFriends,
"share": {
"provider": "weixin",
"scene": "WXSceneSession"
......@@ -274,7 +282,7 @@
},
{
"img": "/static/app-plus/sharemenu/wechatmoments.png",
"text": "微信朋友圈",
"text": this.$t('common').wechatBbs,
"share": {
"provider": "weixin",
"scene": "WXSenceTimeline"
......@@ -282,7 +290,7 @@
},
{
"img": "/static/app-plus/sharemenu/weibo.png",
"text": "微博",
"text": this.$t('common').weibo,
"share": {
"provider": "sinaweibo"
}
......@@ -296,16 +304,16 @@
},
{
"img": "/static/app-plus/sharemenu/copyurl.png",
"text": "复制",
"text": this.$t('common').copy,
"share": "copyurl"
},
{
"img": "/static/app-plus/sharemenu/more.png",
"text": "更多",
"text": this.$t('common').more,
"share": "shareSystem"
}
],
cancelText: "取消分享",
cancelText: this.$t('common').cancelShare,
}, e => { //callback
console.log(e);
})
......
......@@ -2,14 +2,14 @@
<view class="box">
<!-- 登录框 (选择手机号所属国家和地区需要另行实现) -->
<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"
placeholder="请输入验证码">
:placeholder="$t('common.verifyCodePlaceholder')">
<template slot="right">
<uni-send-sms-code ref="shortCode" code-type="bind" :phone="formData.phone"></uni-send-sms-code>
</template>
</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>
</template>
<script>
......@@ -27,15 +27,18 @@
}
}
},
computed: {
computed: {
tipText() {
return `验证码已通过短信发送至${this.currenPhoneArea} ${this.formData.phone}。密码为6 - 20位`
return this.$t('common.verifyCodeSend')+ `${this.currenPhoneArea} ${this.formData.phone}。` + this.$t('common.passwordDigits')
},
canSubmit() {
return true//this.isPhone() && this.isCode();
}
},
onLoad(event) {
onLoad(event) {
uni.setNavigationBarTitle({
title:this.$t('bindMobile.navigationBarTitle')
})
},
onReady() {
},
......
......@@ -4,20 +4,20 @@
<uni-list-item class="item">
<template v-slot:body>
<view class="item">
<text>头像</text>
<uni-file-picker @click.native="uploadAvatarImg" @delete="removeAvatar" v-model="avatar_file"
fileMediatype="image" return-type="object" :image-styles="listStyles" disabled />
<text>{{$t('userinfo.ProfilePhoto')}}</text>
<cloud-image @click.native="uploadAvatarImg" v-if="avatar_file" :src="avatar_file.url" width="50px" height="50px"></cloud-image>
<uni-icons v-else class="chooseAvatar" type="plusempty" size="30" color="#dddddd"></uni-icons>
</view>
</template>
</uni-list-item>
<uni-list-item class="item" @click="setNickname('')" title="昵称" :rightText="userInfo.nickname||'未设置'" link>
<uni-list-item class="item" @click="setNickname('')" :title="$t('userinfo.nickname')" :rightText="userInfo.nickname||$t('userinfo.notSet')" link>
</uni-list-item>
<uni-list-item class="item" @click="bindMobileBySmsCode" title="手机号" :rightText="userInfo.mobile||'未绑定'" link>
<uni-list-item class="item" @click="bindMobileBySmsCode" :title="$t('userinfo.phoneNumber')" :rightText="userInfo.mobile||$t('userinfo.notSpecified')" link>
</uni-list-item>
</uni-list>
<uni-popup ref="dialog" type="dialog">
<uni-popup-dialog mode="input" :value="userInfo.nickname" @confirm="setNickname" title="设置昵称"
placeholder="请输入要设置的昵称">
<uni-popup-dialog mode="input" :value="userInfo.nickname" @confirm="setNickname" :title="$t('userinfo.setNickname')"
:placeholder="$t('userinfo.setNicknamePlaceholder')">
</uni-popup-dialog>
</uni-popup>
</view>
......@@ -39,30 +39,27 @@
otherLoginButton: {
"title": "其他号码绑定",
}
},
listStyles: {
"height": 80, // 边框高度
"width": 80, // 边框宽度
"border": { // 如果为 Boolean 值,可以控制边框显示与否
"color": "#eee", // 边框颜色
"width": "1px", // 边框宽度
"style": "solid", // 边框样式
"radius": "10px" // 边框圆角,支持百分比
}
}
}
},
onLoad() {
this.univerifyStyle.authButton.title = this.$t('userinfo.bindPhoneNumber')
this.univerifyStyle.otherLoginButton.title = this.$t('userinfo.bindOtherLogin')
uni.setNavigationBarTitle({
title: this.$t('userinfo.navigationBarTitle')
})
},
computed: {
...mapGetters({
userInfo: 'user/info',
login: 'user/hasLogin'
}),
}),
avatar_file() {
if (this.userInfo.avatar_file && this.userInfo.avatar_file.url) {
if (this.userInfo.avatar_file && this.userInfo.avatar_file.url) {
return this.userInfo.avatar_file
}
}
},
},
methods: {
...mapMutations({
setUserInfo: 'user/login'
......@@ -139,7 +136,7 @@
console.log(e);
if (e.result.updated) {
uni.showToast({
title: '更新成功',
title:this.$t('common.updateSucceeded'),
icon: 'none'
});
this.setUserInfo({
......@@ -147,7 +144,7 @@
});
} else {
uni.showToast({
title: '没有变化',
title: this.$t('userinfo.noChange'),
icon: 'none'
});
}
......@@ -157,18 +154,9 @@
this.$refs.dialog.open()
}
},
removeAvatar() {
this.setAvatarFile({
"extname": "jpg",
"fileType": "image",
"name": "",
"size": 0,
"url": ""
})
},
setAvatarFile(avatar_file) {
uni.showLoading({
title: '设置中',
title: this.$t('userinfo.setting'),
mask: true
});
// 使用 clientDB 提交数据
......@@ -179,12 +167,12 @@
if (avatar_file) {
uni.showToast({
icon: 'none',
title: '设置成功'
title: this.$t('userinfo.setSucceeded')
})
} else {
uni.showToast({
icon: 'none',
title: '删除成功'
title: this.$t('userinfo.deleteSucceeded')
})
}
this.setUserInfo({
......@@ -192,8 +180,7 @@
});
}).catch((err) => {
uni.showModal({
content: err.message ||
'请求服务失败',
content: err.message ||this.$t('userinfo.requestFail'),
showCancel: false
})
}).finally(() => {
......@@ -241,7 +228,7 @@
let cloudPath = this.userInfo._id + '' + Date.now()
avatar_file.name = cloudPath
uni.showLoading({
title: '正在上传',
title:this.$t('userinfo.uploading'),
mask: true
});
let {
......@@ -280,17 +267,11 @@
align-items: center;
}
.avatarUrl {
width: 50px;
height: 50px;
border-radius: 6px;
}
.chooseAvatar {
border: solid 1px #ddd;
border: dotted 1px #ddd;
border-radius: 10px;
width: 130rpx;
height: 130rpx;
line-height: 130rpx;
width: 50px;
height: 50px;
line-height: 50px;
}
</style>
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
......@@ -38,7 +38,8 @@ export default {
{"pattern":/^\/pages\/list.*/}, //支持正则表达式
"/pages/grid/grid",
"/pages/ucenter/ucenter",
"/pages/ucenter/about/about"
"/pages/ucenter/about/about",
"/pages/ucenter/guestbook/guestbook"
],
/*
login:配置登陆类型与优先级
......
// 文档教程: https://uniapp.dcloud.net.cn/uniCloud/schema
{
"bsonType": "object",
"required": [],
"permission": {
"read": "doc.state || auth.uid == doc.uid || 'AUDITOR' in auth.role",
"create": "auth.uid != null",
"update": true,
"delete": "auth.uid == doc.uid"
},
"properties": {
"_id": {
"description": "ID,系统自动生成"
},
"text": {
"bsonType": "string",
"permission":{
"update":"'AUDITOR' in auth.role"
}
},
"uid": {
"forceDefaultValue": {
"$env": "uid"
},
"foreignKey": "uni-id-users._id"
},
"ip": {
"forceDefaultValue": {
"$env": "clientIP"
}
},
"create_time": {
"forceDefaultValue": {
"$env": "now"
}
},
"state": {
"bsonType": "bool",
"forceDefaultValue":false,
"permission":{
"write":"'AUDITOR' in auth.role"
}
}
}
}
\ No newline at end of file
......@@ -2,9 +2,9 @@
"bsonType": "object",
"required": ["user_id", "score", "balance"],
"permission": {
"read": true,
"create": true,
"update": "doc._id == auth.uid",
"read": "doc.user_id == auth.uid",
"create": false,
"update": false,
"delete": false
},
"properties": {
......
## 1.3.1(2021-07-30)
- 优化 vue3下小程序事件警告的问题
## 1.3.0(2021-07-30)
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.3.3(2021-08-17)
- 优化 show-arrow 属性默认为true
## 1.3.2(2021-08-17)
- 新增 show-arrow 属性,控制是否显示右侧箭头
## 1.3.1(2021-07-30)
- 优化 vue3下小程序事件警告的问题
## 1.3.0(2021-07-30)
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.2.2(2021-07-21)
- 修复 由1.2.0版本引起的 change 事件返回 undefined 的Bug
## 1.2.1(2021-07-21)
......
......@@ -12,6 +12,7 @@
</slot>
</view>
<view
v-if="showArrow"
:class="{ 'uni-collapse-item__title-arrow-active': isOpen, 'uni-collapse-item--animation': showAnimation === true }"
class="uni-collapse-item__title-arrow">
<uni-icons :color="disabled?'#ddd':'#bbb'" size="14" type="arrowdown" />
......@@ -38,8 +39,12 @@
* @property {String} title 标题文字
* @property {String} thumb 标题左侧缩略图
* @property {String} name 唯一标志符
* @property {Boolean} open = [true|false] 是否展开组件
* @property {Boolean} titleBorder = [true|false] 是否显示标题分隔线
* @property {Boolean} border = [true|false] 是否显示分隔线
* @property {Boolean} disabled = [true|false] 是否展开面板
* @property {Boolean} showAnimation = [true|false] 开启动画
* @property {Boolean} showArrow = [true|false] 是否显示右侧箭头
*/
export default {
name: 'uniCollapseItem',
......@@ -87,10 +92,13 @@
type: String,
default: 'auto'
},
// 是否显示分隔线
border: {
type: Boolean,
default: true
},
showArrow:{
type: Boolean,
default: true
}
},
data() {
......@@ -118,24 +126,22 @@
created(){
this.collapse = this.getCollapse()
this.oldHeight = 0
},
// #ifndef VUE3
// TODO vue2
destroyed() {
if (this.__isUnmounted) return
this.uninstall()
},
},
// #ifndef VUE3
// TODO vue2
destroyed() {
if (this.__isUnmounted) return
this.uninstall()
},
// #endif
// #ifdef VUE3
// TODO vue3
unmounted() {
this.__isUnmounted = true
this.uninstall()
},
// #ifdef VUE3
// TODO vue3
unmounted() {
this.__isUnmounted = true
this.uninstall()
},
// #endif
mounted() {
if (!this.collapse) return
if (this.name !== '') {
this.nameSync = this.name
......@@ -210,7 +216,7 @@
this.onClick(this.open,'init')
})
.exec()
},
},
getNvueHwight(type) {
const result = dom.getComponentRect(this.$refs['collapse--hook'], option => {
if (option && option.result && option.size) {
......@@ -259,7 +265,7 @@
align-items: center;
transition: border-bottom-color .3s;
// transition-property: border-bottom-color;
// transition-property: border-bottom-color;
// transition-duration: 5s;
&-wrap {
width: 100%;
......@@ -355,7 +361,7 @@
height: 0;
&.is--transition {
// transition: all 0.3s;
// transition: all 0.3s;
transition-property: height, border-bottom-width;
transition-duration: 0.3s;
/* #ifndef APP-NVUE */
......
{
"id": "uni-collapse",
"displayName": "uni-collapse 折叠面板",
"version": "1.3.1",
"version": "1.3.3",
"description": "Collapse 组件,可以折叠 / 展开的内容区域。",
"keywords": [
"uni-ui",
......@@ -77,6 +77,10 @@
"快应用": {
"华为": "u",
"联盟": "u"
},
"Vue": {
"vue2": "y",
"vue3": "u"
}
}
}
......
......@@ -254,6 +254,7 @@ export default {
|show-animation|Boolean|false|开启动画|
|border|Boolean|true|折叠面板内容分隔线|
|title-border|String|auto|折叠面板标题分隔线可选值见下方 **TitleBorder Params**|
|show-arrow|Boolean|true|是否显示右侧箭头|
#### TitleBorder Params
......
{
"name" : "uni-config-center",
"version" : "0.0.2",
"description" : "配置中心",
"main" : "index.js",
"keywords" : [],
"author" : "DCloud",
"license" : "Apache-2.0",
"dependencies" : null
}
"name": "uni-config-center",
"version": "0.0.2",
"description": "配置中心",
"main": "index.js",
"keywords": [],
"author": "DCloud",
"license": "Apache-2.0"
}
\ No newline at end of file
## 0.2.2(2021-07-30)
- 优化 在uni-forms组件,与label不对齐的问题
## 0.2.5(2021-08-23)
- 修复 在uni-forms中 modelValue 中不存在当前字段,当前字段必填写也不参与校验的问题
## 0.2.4(2021-08-17)
- 修复 单选 list 模式下 ,icon 为 left 时,选中图标不显示的问题
## 0.2.3(2021-08-11)
- 修复 在 uni-forms 中重置表单,错误信息无法清除的问题
## 0.2.2(2021-07-30)
- 优化 在uni-forms组件,与label不对齐的问题
## 0.2.1(2021-07-27)
- 修复 单选默认值为0不能选中的Bug
## 0.2.0(2021-07-13)
......
......@@ -159,12 +159,19 @@
this.dataList = this.getDataList(this.getSelectedValue(newVal))
},
value(newVal) {
this.dataList = this.getDataList(newVal)
this.formItem && this.formItem.setValue(newVal)
this.dataList = this.getDataList(newVal)
// fix by mehaotian is_reset 在 uni-forms 中定义
if(!this.is_reset){
this.is_reset = false
this.formItem && this.formItem.setValue(newVal)
}
},
modelValue(newVal) {
this.dataList = this.getDataList(newVal);
this.formItem && this.formItem.setValue(newVal);
if(!this.is_reset){
this.is_reset = false
this.formItem && this.formItem.setValue(newVal)
}
}
},
data() {
......@@ -198,7 +205,12 @@
if (this.formItem) {
this.isTop = 6
if (this.formItem.name) {
if (this.formItem.name) {
// 如果存在name添加默认值,否则formData 中不存在这个字段不校验
if(!this.is_reset){
this.is_reset = false
this.formItem.setValue(this.dataValue)
}
this.rename = this.formItem.name
this.form.inputChildrens.push(this)
}
......@@ -777,7 +789,11 @@
transform: rotate(45deg);
}
}
.radio__inner {
.radio__inner-icon {
opacity: 1;
}
}
.checklist-text {
color: $checked-color;
}
......
{
"id": "uni-data-checkbox",
"displayName": "uni-data-checkbox 数据选择器",
"version": "0.2.2",
"version": "0.2.5",
"description": "通过数据驱动的单选框和复选框",
"keywords": [
"uni-ui",
......@@ -76,6 +76,10 @@
"快应用": {
"华为": "u",
"联盟": "u"
},
"Vue": {
"vue2": "y",
"vue3": "u"
}
}
}
......
## 2.1.0(2021-08-09)
- 新增 适配 vue3
## 2.0.19(2021-08-09)
- 新增 支持作为 uni-forms 子组件相关功能
- 修复 在 uni-forms 中使用时,选择时间报 NAN 错误的 bug
## 2.0.18(2021-08-05)
- 修复 type 属性动态赋值无效的 bug
- 修复 ‘确认’按钮被 tabbar 遮盖 bug
- 修复 组件未赋值时范围选左、右日历相同的 bug
## 2.0.17(2021-08-04)
- 修复 范围选未正确显示当前值的 bug
- 修复 h5 平台(移动端)报错 'cale' of undefined 的 bug
......
......@@ -547,7 +547,7 @@
.uni-calendar--fixed {
position: fixed;
bottom: 0;
bottom: calc(var(--window-bottom));
left: 0;
right: 0;
transition-property: transform;
......
......@@ -149,6 +149,10 @@
value: {
type: [String, Number],
default: ''
},
modelValue: {
type: [String, Number],
default: ''
},
start: {
type: [Number, String],
......@@ -235,17 +239,6 @@
this.checkValue('second', this.second, newVal)
}
},
created() {
this.form = this.getForm('uniForms')
this.formItem = this.getForm('uniFormsItem')
if (this.formItem) {
if (this.formItem.name) {
this.rename = this.formItem.name
this.form.inputChildrens.push(this)
}
}
},
computed: {
// 当前年、月、日、时、分、秒选择范围
years() {
......@@ -435,20 +428,6 @@
return item < 10 ? '0' + item : item
},
/**
* 获取父元素实例
*/
getForm(name = 'uniForms') {
let parent = this.$parent;
let parentName = parent.$options.name;
while (parentName !== name) {
parent = parent.$parent;
if (!parent) return false
parentName = parent.$options.name;
}
return parent;
},
/**
* 解析时分秒字符串,例如:00:00:00
* @param {String} timeString
......@@ -701,13 +680,13 @@
this.time = this.createDomSting()
if (!emit) return
if (this.returnType === 'timestamp' && this.type !== 'time') {
this.formItem && this.formItem.setValue(this.createTimeStamp(this.time))
this.$emit('change', this.createTimeStamp(this.time))
this.$emit('input', this.createTimeStamp(this.time))
this.$emit('input', this.createTimeStamp(this.time))
this.$emit('update:modelValue', this.createTimeStamp(this.time))
} else {
this.formItem && this.formItem.setValue(this.time)
this.$emit('change', this.time)
this.$emit('input', this.time)
this.$emit('input', this.time)
this.$emit('update:modelValue', this.time)
}
},
......@@ -750,9 +729,9 @@
*/
clearTime() {
this.time = ''
this.formItem && this.formItem.setValue(this.time)
this.$emit('change', this.time)
this.$emit('input', this.time)
this.$emit('input', this.time)
this.$emit('update:modelValue', this.time)
this.tiggerTimePicker()
},
......
......@@ -23,7 +23,8 @@
<input class="uni-date__input uni-date-range__input" type="text" v-model="range.endDate"
:placeholder="endPlaceholder" :disabled="true" />
</view>
<view v-show="clearIcon && !disabled && !isPhone && (singleVal || (range.startDate && range.endDate))"
<view
v-show="clearIcon && !disabled && !isPhone && (singleVal || (range.startDate && range.endDate))"
class="uni-date__icon-clear" @click.stop="clear">
<uni-icons type="clear" color="#e1e1e1" size="14"></uni-icons>
</view>
......@@ -39,8 +40,7 @@
placeholder="选择日期" />
<time-picker type="time" v-model="time" :border="false" :disabled="!tempSingleDate"
:start="reactStartTime" :end="reactEndTime">
<input class="uni-date__input uni-date-range__input" type="text" v-model="time"
placeholder="选择时间" :disabled="!tempSingleDate" />
<input class="uni-date__input uni-date-range__input" type="text" v-model="time" placeholder="选择时间" :disabled="!tempSingleDate" />
</time-picker>
</view>
<calendar ref="pcSingle" :showMonth="false" :start-date="caleRange.startDate"
......@@ -170,6 +170,7 @@
popover: null,
isEmitValue: false,
isPhone: false,
isFirstShow: true,
iconBase64: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAABmJLR0QA/wD/AP+gvaeTAAACVklEQVRoge2Zv2vTQRTAP4oWJQQskmolBAnSQVMcSxbp4ubmIEWETu0oIjg5iIOgpLNunfQfMHToUgpOVgfRqRAL4q8WRLQVq4sOdyHPL9/7evfNJReS+8DB433v7r37fl/eu9xBJBKUB0BLt+uDaOOQZb8SUNXyuKuRftg46NeXcBww6M8AC0ANOAycAyb1s7e6+SbNxi/gBfAQ2HadcA7YB/4MUPsKzLos4jzwewAcNy3mhMnx5I/9BiqUAD4DDWAXmAfqWt8Enlq+GBfSbEwAt4AicAxYBO7aTPaGzhu4KvTLQn/Hh9cpmGzcFvqmaXAyaxWE/MGTg93yXsgFUyfbOrJCJ2s8y+tRP21s0fmMTlmih8zT8WnN1GloCmJWaF0CpvrlSAb1/3fJXshNT470hZEIrZeoahqaU8BZ10Exa4XGtiCaKKL+EIHaMX8U81ZEP7ntrwi7n4CfWi7p+UCFdFdh7Rpaps9+mn93rjY2THut0QqtoVlIkpi1QjNyCzEdnl0W+idCXxb6VmKudaGfsbBhRbcHdEWhf5eYt0o6FVR6BjhqYcOKoQkt2y/SAB5rWVbpVeCilmUl3hb6JNeAI1p+ZWEjFzH9hsY2tEwHdHX9DGATWNLyceCeGL/YhY+58LWhy9o0uhJDKw3T4dlr4L6WZab5JvRBGJqs9UPI5R44lQfpx56pUzK0NlA3R6AK1Engu1+/nGhfK7R5bjtwGnXdFfpSJ6190Quz5grqQCC048lFXMhy2nQZWkUVsRowZv8OvLOPCvdHwE5APyKRSMQzfwE22DtT3T5PPwAAAABJRU5ErkJggg=='
}
},
......@@ -181,6 +182,10 @@
value: {
type: [String, Number, Array, Date],
default: ''
},
modelValue: {
type: [String, Number, Array, Date],
default: ''
},
start: {
type: [Number, String],
......@@ -229,6 +234,8 @@
handler(newVal, oldVal) {
if (newVal.indexOf('time') !== -1) {
this.hasTime = true
} else {
this.hasTime = false
}
if (newVal.indexOf('range') !== -1) {
this.isRange = true
......@@ -306,15 +313,39 @@
return this.isRange ? 653 : 301
}
},
created() {
this.form = this.getForm('uniForms')
this.formItem = this.getForm('uniFormsItem')
// if (this.formItem) {
// if (this.formItem.name) {
// this.rename = this.formItem.name
// this.form.inputChildrens.push(this)
// }
// }
},
mounted() {
this.platform()
},
methods: {
/**
* 获取父元素实例
*/
getForm(name = 'uniForms') {
let parent = this.$parent;
let parentName = parent.$options.name;
while (parentName !== name) {
parent = parent.$parent;
if (!parent) return false
parentName = parent.$options.name;
}
return parent;
},
initPicker(newVal) {
if (!newVal || Array.isArray(newVal) && !newVal.length) {
this.$nextTick(() => {
this.clear(false)
})
this.clear(false)
})
return
}
if (!Array.isArray(newVal) && !this.isRange) {
......@@ -339,19 +370,6 @@
this.range.startDate = this.tempRange.startDate = startDate
this.range.endDate = this.tempRange.endDate = endDate
if (!this.isPhone) {
setTimeout(() => {
if (startDate && endDate) {
if (this.diffDate(startDate, endDate) < 30) {
this.$refs.right.next()
}
} else {
this.$refs.right.next()
this.$refs.right.cale.lastHover = false
}
}, 100)
}
if (this.hasTime) {
this.range.startDate = defBefore.defDate + ' ' + defBefore.defTime
this.range.endDate = defAfter.defDate + ' ' + defAfter.defTime
......@@ -407,6 +425,22 @@
}).exec()
setTimeout(() => {
this.popup = !this.popup
if (!this.isPhone && this.isRange && this.isFirstShow) {
this.isFirstShow = false
const {
startDate,
endDate
} = this.range
if (startDate && endDate) {
if (this.diffDate(startDate, endDate) < 30) {
this.$refs.right.next()
}
} else {
this.$refs.right.next()
this.$refs.right.cale.lastHover = false
}
}
}, 20)
},
......@@ -439,8 +473,10 @@
}
}
}
this.formItem && this.formItem.setValue(value)
this.$emit('change', value)
this.$emit('input', value)
this.$emit('update:modelValue', value)
this.isEmitValue = true
},
createTimestamp(date) {
......@@ -601,8 +637,10 @@
this.$refs.pcSingle.setDate()
}
if (needEmit) {
this.formItem && this.formItem.setValue('')
this.$emit('change', '')
this.$emit('input', '')
this.$emit('input', '')
this.$emit('update:modelValue', '')
}
} else {
this.range.startDate = ''
......@@ -631,8 +669,10 @@
this.$refs.right.next()
}
if (needEmit) {
this.formItem && this.formItem.setValue([])
this.$emit('change', [])
this.$emit('input', [])
this.$emit('input', [])
this.$emit('update:modelValue', [])
}
}
},
......
{
"id": "uni-datetime-picker",
"displayName": "uni-datetime-picker 日期选择器",
"version": "2.0.17",
"version": "2.1.0",
"description": "uni-datetime-picker 日期时间选择器,支持日历,支持范围选择",
"keywords": [
"uni-datetime-picker",
......
## 0.1.2(2021-07-30)
- 优化 vue3下事件警告的问题
## 0.1.4(2021-08-20)
- 修复 在 uni-forms 的动态表单中默认值校验不通过的 bug
## 0.1.3(2021-08-11)
- 修复 在 uni-forms 中重置表单,错误信息无法清除的问题
## 0.1.2(2021-07-30)
- 优化 vue3下事件警告的问题
## 0.1.1
- 优化 errorMessage 属性支持 Boolean 类型
## 0.1.0(2021-07-13)
......
......@@ -181,15 +181,18 @@
watch: {
value(newVal) {
if (this.errMsg) this.errMsg = ''
this.val = newVal
if (this.form && this.formItem) {
this.val = newVal
// fix by mehaotian is_reset 在 uni-forms 中定义
if (this.form && this.formItem &&!this.is_reset) {
this.is_reset = false
this.formItem.setValue(newVal)
}
},
modelValue(newVal) {
if (this.errMsg) this.errMsg = ''
this.val = newVal
if (this.form && this.formItem) {
if (this.form && this.formItem &&!this.is_reset) {
this.is_reset = false
this.formItem.setValue(newVal)
}
},
......@@ -209,7 +212,11 @@
this.form = this.getForm('uniForms')
this.formItem = this.getForm('uniFormsItem')
if (this.form && this.formItem) {
if (this.formItem.name) {
if (this.formItem.name) {
if(!this.is_reset){
this.is_reset = false
this.formItem.setValue(this.val)
}
this.rename = this.formItem.name
this.form.inputChildrens.push(this)
}
......
{
"id": "uni-easyinput",
"displayName": "uni-easyinput 增强输入框",
"version": "0.1.2",
"version": "0.1.4",
"description": "Easyinput 组件是对原生input组件的增强",
"keywords": [
"uni-ui",
......@@ -78,6 +78,10 @@
"快应用": {
"华为": "u",
"联盟": "u"
},
"Vue": {
"vue2": "y",
"vue3": "u"
}
}
}
......
<template>
<view class="uni-container">
<uni-forms ref="form" :value="formData" validate-trigger="submit" err-show-type="toast">
<uni-forms-item name="content" label="留言内容" required>
<uni-forms-item name="content" :label="$t('uniFeedback.msgTitle')" required>
<textarea @input="binddata('content', $event.detail.value)" class="uni-textarea-border"
:value="formData.content" trim="right"></textarea>
</uni-forms-item>
<uni-forms-item name="imgs" label="图片列表">
<uni-forms-item name="imgs" :label="$t('uniFeedback.imgTitle')">
<uni-file-picker file-mediatype="image" :limit="6" return-type="array" v-model="formData.imgs" />
</uni-forms-item>
<uni-forms-item name="contact" label="联系人">
<uni-forms-item name="contact" :label="$t('uniFeedback.contacts')">
<uni-easyinput v-model="formData.contact" trim="both" />
</uni-forms-item>
<uni-forms-item name="mobile" label="联系电话">
<uni-forms-item name="mobile" :label="$t('uniFeedback.phone')">
<uni-easyinput v-model="formData.mobile" trim="both" />
</uni-forms-item>
<view class="uni-button-group">
<button type="primary" class="uni-button" @click="submit">提交</button>
<button type="primary" class="uni-button" @click="submit">{{$t('uniFeedback.submit')}}</button>
</view>
</uni-forms>
</view>
......@@ -54,7 +54,12 @@
...getValidator(["content", "imgs", "contact", "mobile"])
}
}
},
},
onLoad() {
uni.setNavigationBarTitle({
title:this.$t('uniFeedback.navigationBarTitle')
})
},
onReady() {
this.$refs.form.setRules(this.rules)
},
......@@ -82,7 +87,7 @@
confirmText:"关闭",
complete:()=>{
this.getOpenerEventChannel().emit('refreshData')
setTimeout(() => uni.navigateBack(), 500)
// setTimeout(() => uni.navigateBack(), 500)
}
});
}).catch((err) => {
......
## 0.2.9(2021-08-03)
- 修复 auto-upload 属性失效的Bug
## 0.2.8(2021-07-31)
- 修复 fileExtname属性不指定值报错的Bug
## 0.2.14(2021-08-23)
- 新增 参数中返回 fileID 字段
## 0.2.13(2021-08-23)
- 修复 腾讯云传入fileID 不能回显的bug
- 修复 选择图片后,不能放大的问题
## 0.2.12(2021-08-17)
- 修复 由于 0.2.11 版本引起的不能回显图片的Bug
## 0.2.11(2021-08-16)
- 新增 clearFiles(index) 方法,可以手动删除指定文件
- 修复 v-model 值设为 null 报错的Bug
## 0.2.10(2021-08-13)
- 修复 return-type="object" 时,无法删除文件的Bug
## 0.2.9(2021-08-03)
- 修复 auto-upload 属性失效的Bug
## 0.2.8(2021-07-31)
- 修复 fileExtname属性不指定值报错的Bug
## 0.2.7(2021-07-31)
- 修复 在某种场景下图片不回显的Bug
## 0.2.6(2021-07-30)
......
......@@ -241,7 +241,6 @@
this.noSpace = true
uniCloud.chooseAndUploadFile = chooseAndUploadFile
}
this.tempData = {}
this.form = this.getForm('uniForms')
this.formItem = this.getForm('uniFormsItem')
if (this.form && this.formItem) {
......@@ -252,31 +251,25 @@
}
},
methods: {
setValue(newVal, oldVal) {
const newData = (v) => {
const files = this.files.find(i => i.url === v.url)
const reg = /cloud:\/\/([\w.]+\/?)\S*/
v.path = v.url
if (reg.test(v.url)) {
this.getTempFileURL(v, v.url)
}
return v
}
// let data = null
if (this.returnType === 'object') {
newData(newData)
} else {
newVal.forEach(v => {
newData(v)
/**
* 公开用户使用,清空文件
* @param {Object} index
*/
clearFiles(index) {
if (index !== 0 && !index) {
this.files = []
this.$nextTick(() => {
this.setEmit()
})
} else {
this.files.splice(index, 1)
}
this.localValue = newVal
this.formItem && this.formItem.setValue(this.localValue)
this.files = [].concat(newVal || [])
this.$nextTick(() => {
this.setEmit()
})
},
/**
* 继续上传
* 公开用户使用,继续上传
*/
upload() {
let files = []
......@@ -285,9 +278,47 @@
files.push(Object.assign({}, v))
}
})
this.uploadFiles(files)
},
async setValue(newVal, oldVal) {
const newData = async (v) => {
const reg = /cloud:\/\/([\w.]+\/?)\S*/
let url = ''
if(v.fileID){
url = v.fileID
}else{
url = v.url
}
if (reg.test(url)) {
v.fileID = url
v.url = await this.getTempFileURL(url)
}
v.path = v.url
return v
}
if (this.returnType === 'object') {
if (newVal) {
await newData(newVal)
} else {
newVal = {}
}
} else {
if (!newVal) newVal = []
for(let i =0 ;i < newVal.length ;i++){
let v = newVal[i]
await newData(v)
}
}
this.localValue = newVal
if (this.form && this.formItem &&!this.is_reset) {
this.is_reset = false
this.formItem.setValue(this.localValue)
}
let filesData = Object.keys(newVal).length > 0 ? newVal : [];
this.files = [].concat(filesData)
},
/**
* 选择文件
*/
......@@ -361,7 +392,7 @@
if (this.limitLength - this.files.length <= 0) break
files[i].uuid = Date.now()
let filedata = await get_file_data(files[i], this.fileMediatype)
filedata.progress = 100
filedata.progress = 0
filedata.status = 'ready'
this.files.push(filedata)
currentData.push({
......@@ -393,7 +424,7 @@
this.setSuccessAndError(result)
})
.catch(err => {
console.log('err', err)
console.log(err)
})
},
......@@ -406,9 +437,9 @@
let tempFilePath = []
let errorTempFilePath = []
for (let i = 0; i < res.length; i++) {
// const index = item.index
const item = res[i]
const index = item.uuid ? this.files.findIndex(p => p.uuid === item.uuid) : item.index
if (index === -1 || !this.files) break
if (item.errMsg === 'request:fail') {
this.files[index].url = item.path
......@@ -419,11 +450,18 @@
errorTempFilePath.push(this.files[index].url)
} else {
this.files[index].errMsg = ''
this.files[index].url = item.url
this.files[index].fileID = item.url
const reg = /cloud:\/\/([\w.]+\/?)\S*/
if (reg.test(item.url)) {
this.files[index].url = await this.getTempFileURL(item.url)
}else{
this.files[index].url = item.url
}
this.files[index].status = 'success'
this.files[index].progress += 1
successData.push(this.files[index])
tempFilePath.push(this.files[index].url)
tempFilePath.push(this.files[index].fileID)
}
}
......@@ -483,7 +521,7 @@
this.setEmit()
})
},
/**
* 获取文件名和后缀
* @param {Object} name
......@@ -535,22 +573,18 @@
name: v.name,
path: v.path,
size: v.size,
fileID:v.fileID,
url: v.url
})
})
return newFilesData
},
async getTempFileURL(file, fileList) {
async getTempFileURL(fileList) {
fileList = {
fileList: [].concat(fileList)
}
const urls = await uniCloud.getTempFileURL(fileList)
file.url = urls.fileList[0].tempFileURL || ''
file.path = file.url
const index = this.files.findIndex(v => v.path === file.path)
if (index !== -1) {
this.$set(this.files, index, file)
}
return urls.fileList[0].tempFileURL || ''
},
/**
* 获取父元素实例
......
......@@ -155,7 +155,7 @@
}
if(this.disablePreview) return
this.filesList.forEach(i => {
urls.push(i.path)
urls.push(i.url)
})
uni.previewImage({
......
{
"id": "uni-file-picker",
"displayName": "uni-file-picker 文件选择上传",
"version": "0.2.9",
"version": "0.2.14",
"description": "文件选择上传组件,可以选择图片、视频等任意文件并上传到当前绑定的服务空间",
"keywords": [
"uni-ui",
......
......@@ -12,6 +12,7 @@
> - 组件需要依赖 `sass` 插件 ,请自行手动安装
> - 如不绑定服务空间,`autoUpload`默认为`false`且不可更改
> - 选择文件目前只支持 `H5` 和 `微信小程序平台` ,且 `微信小程序平台` 使用 `wx.chooseMessageFile()`
> - v-model 值需要自动上传成功后才会绑定值,一般只用来回显数据
> - 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839
......@@ -97,6 +98,8 @@
#### Callback Params
`**注意**:如果绑定的是腾讯云的服务空间 ,tempFilePaths 将返回 fileID`
```json
{
"progress" : Number, // 上传进度 ,仅 @progress 事件包含此字段
......@@ -115,7 +118,8 @@
| 方法称名 | 说明 | 参数 |
| :-: | :-: | :-: |
| upload | 手动上传 ,如`autoUpload``false` ,必须调用此方法| - |
| upload() | 手动上传 ,如`autoUpload``false` ,必须调用此方法| - |
| clearFiles(index:Number) | 清除选择结果| 传如 Number 为删除指定下标的文件 ,不传为删除所有|
### FilePicker Slots
......
## 1.2.3(2021-07-30)
- 优化 vue3下事件警告的问题
## 1.2.7(2021-08-13)
- 修复 没有添加校验规则的字段依然报错的Bug
## 1.2.6(2021-08-11)
- 修复 重置表单错误信息无法清除的问题
## 1.2.5(2021-08-11)
- 优化 组件文档
## 1.2.4(2021-08-11)
- 修复 表单验证只生效一次的问题
## 1.2.3(2021-07-30)
- 优化 vue3下事件警告的问题
## 1.2.2(2021-07-26)
- 修复 vue2 下条件编译导致destroyed生命周期失效的Bug
- 修复 1.2.1 引起的示例在小程序平台报错的Bug
......
......@@ -4,9 +4,10 @@
<view class="uni-forms-item__inner" :class="['is-direction-' + labelPos]">
<view class="uni-forms-item__label" :style="{ width: labelWid , justifyContent: justifyContent }">
<slot name="left">
<text v-if="required" class="is-required">*</text>
<uni-icons v-if="leftIcon" class="label-icon" size="16" :type="leftIcon" :color="iconColor" />
<text class="label-text">{{ label }}</text>
<text v-if="required" class="is-required">*</text>
<view v-if="label" class="label-seat"></view>
</slot>
</view>
......@@ -224,18 +225,16 @@ export default {
this.border = this.form.border;
this.showMsg = errShowType;
let name = this.isArray ? this.arrayField : this.name;
if (formRules) {
if(!name) return
if (formRules && this.rules.length > 0) {
if (!formRules[name]) {
formRules[name] = {
rules: this.rules
}
}
this.formRules = formRules[name];
}
if (this.rules.length > 0) {
validator.updateSchema(formRules);
}
this.formRules = formRules[name] || {};
this.validator = validator;
} else {
this.labelPos = this.labelPosition || 'left';
......@@ -294,8 +293,9 @@ export default {
*/
async triggerCheck(value,formTrigger) {
let promise = null;
this.errMsg = '';
if (!this.validator) return;
this.errMsg = '';
// fix by mehaotian 解决没有检验规则的情况下,抛出错误的问题
if (!this.validator || Object.keys(this.formRules).length === 0) return;
const isNoField = this.isRequired(this.formRules.rules || []);
let isTrigger = this.isTrigger(this.formRules.validateTrigger, this.validateTrigger, this.form.validateTrigger);
let result = null;
......@@ -451,7 +451,9 @@ export default {
// 必填
.is-required {
color: $uni-color-error;
// color: $uni-color-error;
color: #f00;
font-weight: bold;
}
.uni-error-message {
......
......@@ -56,11 +56,7 @@
export default {
name: 'uniForms',
components: {},
model: {
prop: 'modelValue',
event: 'update:modelValue'
},
emits:['update:modelValue','input','reset','validate','submit'],
emits:['input','reset','validate','submit'],
props: {
// 即将弃用
value: {
......@@ -237,8 +233,6 @@
value = this._getValue(example.name, value);
this.formData[name] = value;
example.val = value;
this.$emit('input', Object.assign({}, this.value, this.formData));
this.$emit('update:modelValue', Object.assign({}, this.value, this.formData));
return example.triggerCheck(value, callback);
},
......@@ -251,7 +245,9 @@
item.errMsg = '';
const inputComp = this.inputChildrens.find(child => child.rename === item.name);
if (inputComp) {
inputComp.errMsg = '';
inputComp.errMsg = '';
// fix by mehaotian 不触发其他组件的 setValue
inputComp.is_reset = true
inputComp.$emit('input', inputComp.multiple ? [] : '');
inputComp.$emit('update:modelValue', inputComp.multiple ? [] : '');
}
......@@ -263,8 +259,6 @@
}
});
this.$emit('input', this.formData);
this.$emit('update:modelValue', this.formData);
this.$emit('reset', event);
},
......
{
"id": "uni-forms",
"displayName": "uni-forms 表单",
"version": "1.2.3",
"version": "1.2.7",
"description": "由输入框、选择器、单选框、多选框等控件组成,用以收集、校验、提交数据",
"keywords": [
"uni-ui",
......@@ -78,6 +78,10 @@
"快应用": {
"华为": "u",
"联盟": "u"
},
"Vue": {
"vue2": "y",
"vue3": "u"
}
}
}
......
......@@ -25,6 +25,7 @@ uni-app的内置组件已经有了 `<form>`组件,用于提交表单内容。
> - `resetFields` 方法不会重置原生组件和三方组件的值
> - 如果配置 `validateTrigger` 属性为 `bind` 且表单域组件使用 `input` 事件触发会耗损部分性能,请谨慎使用
> - 组件支持 nvue ,需要在 `manifest.json > app-plus` 节点下配置 `"nvueStyleCompiler" : "uni-app"`
> - uni-forms 中不包含其他表单组件,如需使用 uni-easyinput、uni-data-checkbox 等组件,需要自行引入
> - 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839
......@@ -250,7 +251,7 @@ rules: {
|minimum|Number|-|-| 校验最小值(小于) |
|maxLength|Number|-|-| 校验数据最大长度 |
|errorMessage|String|-|-|校验失败提示信息语,可添加属性占位符,当前表格内属性都可用作占位符|
|trigger|String|blur| blur/change/submit|校验触发时机|
|trigger|String|bind| bind/submit|校验触发时机|
|validateFunction|Function|-|-|自定义校验规则 |
......@@ -605,8 +606,8 @@ export default {
|属性名|类型|默认值|可选值|说明|
|:-:|:-:|:-:|:-:|:-:|
|v-model/value [即将废弃]|Object|-|-| 表单数据|
|v-model/modelValue|Object|-|-| 表单数据|
|value [即将废弃]|Object|-|-| 表单数据|
|modelValue|Object|-|-| 表单数据|
|rules|Object|-|-|表单校验规则|
|validate-trigger|String|submit|bind/submit| 表单校验时机|
|label-position|String|left|top/left|label 位置|
......@@ -642,7 +643,7 @@ export default {
|keepItem|Array|保留不参与校验的字段|
|callback|Function|校验完成返回函数|
校验成功后,校验对象只保留指定了`name`的字段,如果需要保留其他字段,则需要 `keepItem` 属性
校验成功后,校验对象只保留指定了`name`的字段(只要 ``uni-forms-item` 绑定了 `name`,哪怕不校验,也会返回),如果需要保留其他字段,则需要 `keepItem` 属性
```html
......
......@@ -72,7 +72,7 @@ exports.main = async (event, context) => {
}
}
//3.注册成功后创建新用户的积分表方法
// 3.注册成功后触发。
async function registerSuccess(uid) {
//用户接受邀请
if (inviteCode) {
......@@ -86,14 +86,6 @@ exports.main = async (event, context) => {
...deviceInfo,
user_id: uid
})
await db.collection('uni-id-scores').add({
user_id: uid,
score: 1,
type: 1,
balance: 1,
comment: "",
create_date: Date.now()
})
}
//4.记录成功登录的日志方法
const loginLog = async (res = {}) => {
......
......@@ -16,9 +16,6 @@
"uni-config-center": "file:../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
},
"dependencies": {
"uni-captcha": {
"version": "file:../../../../uni-captcha/uniCloud/cloudfunctions/common/uni-captcha"
},
"uni-config-center": {
"version": "file:../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
}
......
## 3.1.1(2021-07-01)
- 使用新的错误码规范,兼容旧版 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id?id=errcode)
- 修复微信登录、绑定时未返回用户accessToken的Bug
## 3.1.0(2021-04-19)
- 增加对用户名、邮箱、密码字段的两端去空格
- 默认忽略用户名、邮箱的大小写 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id?id=case-sensitive)
- 修复 customToken导出async方法报错的Bug
## 3.0.12(2021-04-13)
- 调整bindTokenToDevice默认值为false
## 3.0.11(2021-04-12)
- 修复3.0.7版本引出的多个用户访问时可能出现30201报错的Bug
## 3.0.10(2021-04-08)
- 优化错误提示
## 3.0.9(2021-04-08)
- bindMobile接口支持通过一键登录的方式绑定
- 优化错误提示
## 3.0.8(2021-03-19)
- 修复 3.0.7版本某些情况下生成token报错的Bug
## 3.0.7(2021-03-19)
- 新增 支持uni-config-center,更新uni-id无须再担心配置被覆盖 [详情](https://uniapp.dcloud.io/uniCloud/uni-id?id=uni-config-center)
- 新增 自定义token内容,可以缓存角色权限之外的更多信息到客户端 [详情](https://uniapp.dcloud.io/uniCloud/uni-id?id=custom-token)
- 新增 支持传入context获取uni-id实例,防止单实例多并发时全局context混乱 [详情](https://uniapp.dcloud.io/uniCloud/uni-id?id=create-instance)
## 3.3.5(2021-08-10)
- 修复版本号错误
## 3.3.4(2021-08-10)
- 微信、QQ、支付宝登录新增type参数用于指定当前是登录还是注册
## 3.3.3(2021-08-04)
- 修复使用数组形式的配置文件报错的Bug
## 3.3.2(2021-08-03)
- 修复上3.3.0版本引出的createInstance接口传入配置不生效的Bug 感谢[hmh](https://gitee.com/hmh)
## 3.3.1(2021-07-30)
- 修复 将设置用户允许登录的应用列表时传入空数组报错的Bug
## 3.3.0(2021-07-30)
- 新增 不同端应用配置隔离 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id?id=isolate-config)
- 新增 不同端用户隔离 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id?id=isolate-user)
+ 此版本升级需要开发者处理一下用户数据,请参考 [补齐用户dcloud_appid字段](https://uniapp.dcloud.net.cn/uniCloud/uni-id?id=makeup-dcloud-appid)
- 新增 QQ登录、注册相关功能 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id?id=qq)
- 调整 不再支持绑定手机、邮箱时不填验证码直接绑定
## 3.2.1(2021-07-09)
- 撤销3.2.0版本所做的调整
## 3.2.0(2021-07-09)
- 【重要】支持不同端(管理端、用户端等)用户隔离 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id?id=isolate-user)
- 支持不同端(管理端、用户端等)配置文件隔离 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id?id=isolate-config)
## 3.1.3(2021-07-08)
- 移除插件内误传的node_modules
## 3.1.2(2021-07-08)
- 修复 微信小程序绑定微信账号时报错的Bug
## 3.1.1(2021-07-01)
- 使用新的错误码规范,兼容旧版 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id?id=errcode)
- 修复微信登录、绑定时未返回用户accessToken的Bug
## 3.1.0(2021-04-19)
- 增加对用户名、邮箱、密码字段的两端去空格
- 默认忽略用户名、邮箱的大小写 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id?id=case-sensitive)
- 修复 customToken导出async方法报错的Bug
## 3.0.12(2021-04-13)
- 调整bindTokenToDevice默认值为false
## 3.0.11(2021-04-12)
- 修复3.0.7版本引出的多个用户访问时可能出现30201报错的Bug
## 3.0.10(2021-04-08)
- 优化错误提示
## 3.0.9(2021-04-08)
- bindMobile接口支持通过一键登录的方式绑定
- 优化错误提示
## 3.0.8(2021-03-19)
- 修复 3.0.7版本某些情况下生成token报错的Bug
## 3.0.7(2021-03-19)
- 新增 支持uni-config-center,更新uni-id无须再担心配置被覆盖 [详情](https://uniapp.dcloud.io/uniCloud/uni-id?id=uni-config-center)
- 新增 自定义token内容,可以缓存角色权限之外的更多信息到客户端 [详情](https://uniapp.dcloud.io/uniCloud/uni-id?id=custom-token)
- 新增 支持传入context获取uni-id实例,防止单实例多并发时全局context混乱 [详情](https://uniapp.dcloud.io/uniCloud/uni-id?id=create-instance)
## 3.0.6(2021-03-05)
- 新增[uniID.wxBizDataCrypt](https://uniapp.dcloud.io/uniCloud/uni-id?id=%e5%be%ae%e4%bf%a1%e6%95%b0%e6%8d%ae%e8%a7%a3%e5%af%86)方法
- 优化loginByApple方法,提高接口响应速度
......
{
"id": "uni-id",
"displayName": "uni-id",
"version": "3.1.1",
"description": "简单、统一、可扩展的用户中心",
"keywords": [
"uniid",
"uni-id",
"用户管理",
"用户中心",
"短信验证码"
],
"repository": "https://gitee.com/dcloud/uni-id.git",
"engines": {
"HBuilderX": "^3.1.0"
},
"dcloudext": {
"category": [
"uniCloud",
"云函数模板"
],
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": ""
},
"uni_modules": {
"dependencies": ["uni-config-center"],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
},
"client": {
"App": {
"app-vue": "u",
"app-nvue": "u"
},
"H5-mobile": {
"Safari": "u",
"Android Browser": "u",
"微信浏览器(Android)": "u",
"QQ浏览器(Android)": "u"
},
"H5-pc": {
"Chrome": "u",
"IE": "u",
"Edge": "u",
"Firefox": "u",
"Safari": "u"
},
"小程序": {
"微信": "u",
"阿里": "u",
"百度": "u",
"字节跳动": "u",
"QQ": "u"
},
"快应用": {
"华为": "u",
"联盟": "u"
}
}
}
}
{
"id": "uni-id",
"displayName": "uni-id",
"version": "3.3.5",
"description": "简单、统一、可扩展的用户中心",
"keywords": [
"uniid",
"uni-id",
"用户管理",
"用户中心",
"短信验证码"
],
"repository": "https://gitee.com/dcloud/uni-id.git",
"engines": {
"HBuilderX": "^3.1.0"
},
"dcloudext": {
"category": [
"uniCloud",
"云函数模板"
],
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": ""
},
"uni_modules": {
"dependencies": ["uni-config-center"],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
},
"client": {
"App": {
"app-vue": "u",
"app-nvue": "u"
},
"H5-mobile": {
"Safari": "u",
"Android Browser": "u",
"微信浏览器(Android)": "u",
"QQ浏览器(Android)": "u"
},
"H5-pc": {
"Chrome": "u",
"IE": "u",
"Edge": "u",
"Firefox": "u",
"Safari": "u"
},
"小程序": {
"微信": "u",
"阿里": "u",
"百度": "u",
"字节跳动": "u",
"QQ": "u"
},
"快应用": {
"华为": "u",
"联盟": "u"
},
"Vue": {
"vue2": "y",
"vue3": "u"
}
}
}
}
}
\ No newline at end of file
{
"name": "uni-id",
"version": "3.1.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"uni-config-center": {
"version": "file:../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
}
}
"name": "uni-id",
"version": "3.3.5",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"uni-config-center": {
"version": "file:../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
}
}
}
{
"name": "uni-id",
"version": "3.1.0",
"description": "uni-id for uniCloud",
"main": "index.js",
"homepage": "https://uniapp.dcloud.io/uniCloud/uni-id",
"repository": {
"type": "git",
"url": "git+https://gitee.com/dcloud/uni-id.git"
},
"author": "",
"license": "Apache-2.0",
"dependencies": {
"uni-config-center": "file:../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
}
"name": "uni-id",
"version": "3.3.5",
"description": "uni-id for uniCloud",
"main": "index.js",
"homepage": "https://uniapp.dcloud.io/uniCloud/uni-id",
"repository": {
"type": "git",
"url": "git+https://gitee.com/dcloud/uni-id.git"
},
"author": "",
"license": "Apache-2.0",
"dependencies": {
"uni-config-center": "file:../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
}
}
## 1.0.1(2021-08-23)
调整签到逻辑,支持查出积分的收入支出历史记录
## 1.0.0(2021-08-05)
1.0.0版本发布
{
"id": "uni-sign-in",
"displayName": "签到插件",
"version": "1.0.0",
"version": "1.0.1",
"description": "uni-sign-in",
"keywords": [
"uni-sign-in",
......
......@@ -42,6 +42,17 @@ module.exports = {
return (n*10000 - (date - item.date)/3600/24/1000*10000)/10000 -1
})
//查出来用户当前有多少积分
let {data: [userScore]} = await scoresTable
.where({user_id:state.auth.uid})
.orderBy("create_date", "desc")
.limit(1)
.get()
let balance = 0
if(userScore){
balance = userScore.balance
}
if(state.type == 'create'){
if(n == 7){ //如果已经满一轮就软删除之前的内容
let setIsDeleteRes = await signInTable.where({
......@@ -51,15 +62,16 @@ module.exports = {
console.log({setIsDeleteRes});
}
//给加积分
let addScores = await scoresTable.where({user_id:state.auth.uid}).update({
let score = n==7?60:10 //如果是第七天就多加50分,也就是60分
balance += score
let addScores = await scoresTable.add({
user_id:state.auth.uid,
score:dbCmd.inc(n==7?60:10) //如果是第七天就多加50分,也就是60分
balance,
score,
create_date:Date.now()
})
console.log({addScores});
}
//查出来有多少积分
let {data:[{score}]} = await scoresTable.where({user_id:state.auth.uid}).get()
return {...result,score,signInData,n,days}
return {...result,score:balance,signInData,n,days}
}
}
......@@ -24,7 +24,7 @@
"write":false
}
},
"create_time":{
"create_date":{
"bsonType":"timestamp",
"description":"签到的时间戳",
"forceDefaultValue":{
......
## 1.2.1(2021-07-30)
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
- 修复 跨页面修改组件数据 ,导致不能滑动的问题
## 1.1.10(2021-06-17)
- 修复 按钮点击执行两次的bug
## 1.2.4(2021-08-20)
- 优化 close-all 方法
## 1.2.3(2021-08-20)
- 新增 close-all 方法,关闭所有已打开的组件
## 1.2.2(2021-08-17)
- 新增 resize() 方法,在非微信小程序、h5、app-vue端出现不能滑动的问题的时候,重置组件
- 修复 app 端偶尔出现类似 Page[x][-x,xx;-x,xx,x,x-x] 的问题
- 优化 微信小程序、h5、app-vue 滑动逻辑,避免出现动态新增组件后不能滑动的问题
## 1.2.1(2021-07-30)
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
- 修复 跨页面修改组件数据 ,导致不能滑动的问题
## 1.1.10(2021-06-17)
- 修复 按钮点击执行两次的bug
## 1.1.9(2021-05-12)
- 新增 项目示例地址
## 1.1.8(2021-03-26)
......
// #ifdef APP-NVUE
const BindingX = uni.requireNativePlugin('bindingx');
const dom = uni.requireNativePlugin('dom');
const animation = uni.requireNativePlugin('animation');
......@@ -291,3 +292,9 @@ export default {
}
}
}
// #endif
// #ifndef APP-NVUE
export default {}
// #endif
\ No newline at end of file
......@@ -25,14 +25,6 @@ export default {
this.swipeaction.children.push(this)
}
},
// beforeDestroy() {
// this.swipeaction.children.forEach((item, index) => {
// if (item === this) {
// this.swipeaction.children.splice(index, 1)
// }
// })
// },
mounted() {
this.isopen = false
setTimeout(() => {
......@@ -62,13 +54,6 @@ export default {
})
}
},
// onClick(index, item, position) {
// this.$emit('click', {
// content: item,
// index,
// position
// })
// },
/**
* 移动触发
* @param {Object} e
......
// #ifndef APP-PLUS|| MP-WEIXIN || H5
const MIN_DISTANCE = 10;
export default {
data() {
// TODO 随机生生元素ID,解决百度小程序获取同一个元素位置信息的bug
const elClass = `Uni_${Math.ceil(Math.random() * 10e5).toString(36)}`
return {
uniShow: false,
left: 0,
buttonShow: 'none',
ani: false,
moveLeft:''
moveLeft:'',
elClass
}
},
watch: {
......@@ -30,19 +35,11 @@ export default {
},
mounted() {
this.swipeaction = this.getSwipeAction()
// this.position = {}
if (this.swipeaction.children !== undefined) {
this.swipeaction.children.push(this)
}
this.init()
},
// beforeDestoy() {
// this.swipeaction.children.forEach((item, index) => {
// if (item === this) {
// this.swipeaction.children.splice(index, 1)
// }
// })
// },
methods: {
init(){
clearTimeout(this.timer)
......@@ -53,6 +50,7 @@ export default {
this.left = 0
this.x = 0
},
closeSwipe(e) {
if (!this.autoClose) return
this.swipeaction.closeOther(this)
......@@ -93,8 +91,8 @@ export default {
if (this.direction !== 'horizontal') {
return;
}
this.move(this.x + this.deltaX)
return false
},
touchend() {
if (this.disabled) return
......@@ -235,8 +233,9 @@ export default {
getSelectorQuery() {
const views = uni.createSelectorQuery().in(this)
views
.selectAll('.uni-swipe_button-group')
.selectAll('.'+this.elClass)
.boundingClientRect(data => {
if(data.length === 0) return
let show = 'none'
if (this.autoClose) {
show = 'none'
......@@ -251,3 +250,9 @@ export default {
}
}
}
// #endif
// #ifdef APP-PLUS|| MP-WEIXIN || H5
export default { }
// #endif
\ No newline at end of file
// #ifdef APP-VUE|| MP-WEIXIN || H5
import { isPC } from "./isPC"
export default {
data() {
return {
position: [],
button: {},
btn: "[]"
is_show:'none'
}
},
watch: {
button: {
handler(newVal) {
this.btn = JSON.stringify(newVal)
},
deep: true
},
show(newVal) {
if (this.autoClose) return
if (!this.button) {
this.init()
return
}
this.button.show = newVal
},
leftOptions() {
this.init()
},
rightOptions() {
this.init()
show(newVal){
this.is_show = this.show
}
},
created() {
......@@ -35,20 +17,11 @@ export default {
this.swipeaction.children.push(this)
}
},
mounted() {
this.init()
},
// fixme by mehaotian 在页面激活的时候需要重新获取元素信息
activated(){
this.init()
mounted(){
this.is_show = this.show
},
methods: {
init() {
clearTimeout(this.swipetimer)
this.swipetimer = setTimeout(() => {
this.getButtonSize()
}, 50)
},
// wxs 中调用
closeSwipe(e) {
if (!this.autoClose) return
this.swipeaction.closeOther(this)
......@@ -56,11 +29,9 @@ export default {
change(e) {
this.$emit('change', e.open)
let show = this.button.show
if (show !== e.open) {
this.button.show = e.open
if (this.is_show !== e.open) {
this.is_show = e.open
}
},
appTouchStart(e) {
......@@ -100,24 +71,11 @@ export default {
position
})
// #endif
},
getButtonSize() {
const views = uni.createSelectorQuery().in(this)
views
.selectAll('.uni-swipe_button-group')
.boundingClientRect(data => {
let show = 'none'
if (this.autoClose) {
show = 'none'
} else {
show = this.show
}
this.button = {
data,
show
}
})
.exec()
}
}
}
}
}
// #endif
// #ifndef APP-VUE|| MP-WEIXIN || H5
export default {}
// #endif
\ No newline at end of file
......@@ -19,16 +19,38 @@
this.children = [];
},
methods: {
// 公开给用户使用,重制组件样式
resize(){
// wxs 会自己计算组件大小,所以无需执行下面代码
// #ifndef APP-VUE || H5 || MP-WEIXIN
this.children.forEach(vm=>{
vm.init()
})
// #endif
},
// 公开给用户使用,关闭全部 已经打开的组件
closeAll(){
this.children.forEach(vm=>{
// #ifdef APP-VUE || H5 || MP-WEIXIN
vm.is_show = 'none'
// #endif
// #ifndef APP-VUE || H5 || MP-WEIXIN
vm.close()
// #endif
})
},
closeOther(vm) {
if (this.openItem && this.openItem !== vm) {
// #ifdef APP-VUE || H5 || MP-WEIXIN
this.openItem.button.show = 'none'
this.openItem.is_show = 'none'
// #endif
// #ifndef APP-VUE || H5 || MP-WEIXIN
this.openItem.close()
// #endif
}
// 记录上一个打开的 swipe-action-item ,用于 auto-close
this.openItem = vm
}
}
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -6,4 +6,4 @@
"appid": "__YOUR_APPID__",
"appVersion": "2.2.0",
"wgtVersion": "2.2.2"
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册