提交 75bde22a 编写于 作者: DCloud_JSON's avatar DCloud_JSON 提交者: study夏羽

重新整理后第1次提交

上级 c40982b1
......@@ -53,6 +53,7 @@
};
},
computed: {
innerText() {
if (this.reverseNumber == 0) return this.$t('common.getVerifyCode');
return this.$t('smsCode.resendVerifyCode')+ '('+this.reverseNumber+'s)';
......@@ -84,77 +85,48 @@
"type": this.codeType
},
},
}).then(({result})=>{
console.log(result);
if (result.code === 0) {
uni.showToast({
title: this.$t('smsCode.sendSuccessTip'),
icon: 'none'
});
this.reverseNumber = Number(this.count);
this.getCode();
this.$emit('getCode');
} else {
uni.showModal({
content: result.msg,
showCancel: false
});
success: ({result}) => {
console.log(result);
if(result.code===0){
uni.showToast({
title: this.$t('smsCode.sendSuccessTip'),
icon: 'none'
});
this.reverseNumber = Number(this.count);
this.getCode();
this.$emit('getCode');
}else{
uni.showModal({
content: result.msg,
showCancel: false
});
}
}
return result
})
// uniCloud.callFunction({
// name:'uni-id-cf',
// data:{
// action:'sendSmsCode',
// params:{
// "mobile": this.phone,
// "type": this.codeType
// },
// },
// success: ({result}) => {
// console.log(result);
// if(result.code===0){
// uni.showToast({
// title: this.$t('smsCode.sendSuccessTip'),
// icon: 'none'
// });
// this.reverseNumber = Number(this.count);
// this.getCode();
// this.$emit('getCode');
// }else{
// uni.showModal({
// content: result.msg,
// showCancel: false
// });
// }
// }
// })
},
getCode() {
if (this.reverseNumber == 0) {
clearTimeout(this.reverseTimer);
this.reverseTimer = null;
return;
},
getCode() {
if (this.reverseNumber == 0) {
clearTimeout(this.reverseTimer);
this.reverseTimer = null;
return;
}
this.reverseNumber--;
this.reverseTimer = setTimeout(() => {
this.getCode();
}, 1000)
}
this.reverseNumber--;
this.reverseTimer = setTimeout(() => {
this.getCode();
}, 1000)
}
}
}
</script>
<style lang="scss" scoped>
/* #ifndef APP-NVUE */
view {
display: flex;
box-sizing: border-box;
flex-direction: column;
}
/* #endif */
/* #ifndef APP-NVUE */
view{
display: flex;
box-sizing: border-box;
flex-direction: column;
}
/* #endif */
.short-code-btn {
width: 200rpx;
height: 85rpx;
......@@ -164,12 +136,10 @@
justify-content: center;
align-items: center;
}
.inner-text {
font-size: 28rpx;
color: #AAAAAA;
}
.inner-text-active {
color: #007aff;
}
......
{
"name": "统一应用基本项目",
"name": "uuuu",
"appid": "请点击重新获取",
"description": "云端一体应用快速开发模版",
"versionName": "1.0.0",
......@@ -8,28 +8,23 @@
"app-plus": {
"locales": {
"en": {
// 英文
"name": "uni-starter", // 应用名称
"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": "统一应用基本项目" // 应用名称
"name": "统一应用基本项目"
}
},
"privacy": {
......@@ -224,3 +219,4 @@
"_spaceID": "",
"vueVersion": "2"
}
......@@ -2,39 +2,39 @@
<view class="warp">
<!-- #ifdef APP-PLUS -->
<status-bar />
<!-- #endif -->
<!-- #endif -->
<!-- banner -->
<unicloud-db ref="bannerdb" v-slot:default="{data, loading, error, options}" collection="opendb-banner"
field="_id,bannerfile,open_url,title" @load="onqueryload">
<!-- 当无banner数据时显示占位图 -->
<image v-if="!(loading||data.length)" class="banner-image" src="/static/grid/empty.png" mode="aspectFill" :draggable="false" />
<uni-swiper-dot v-else class="uni-swiper-dot-box" @clickItem="clickItem" :info="data"
:current="current" field="content">
<swiper class="swiper-box" @change="changeSwiper" :current="swiperDotIndex">
<swiper-item v-for="(item, index) in data" :key="item._id">
<view class="swiper-item" @click="clickBannerItem(item)">
<image class="banner-image" :src="item.bannerfile.url" mode="aspectFill" :draggable="false" />
</view>
</swiper-item>
</swiper>
</uni-swiper-dot>
</unicloud-db>
<!-- banner -->
<unicloud-db ref="bannerdb" v-slot:default="{data, loading, error, options}" collection="opendb-banner"
field="_id,bannerfile,open_url,title" @load="onqueryload">
<!-- 当无banner数据时显示占位图 -->
<image v-if="!(loading||data.length)" class="banner-image" src="/static/grid/empty.png" mode="aspectFill" :draggable="false" />
<uni-swiper-dot v-else class="uni-swiper-dot-box" @clickItem="clickItem" :info="data"
:current="current" field="content">
<swiper class="swiper-box" @change="changeSwiper" :current="swiperDotIndex">
<swiper-item v-for="(item, index) in data" :key="item._id">
<view class="swiper-item" @click="clickBannerItem(item)">
<image class="banner-image" :src="item.bannerfile.url" mode="aspectFill" :draggable="false" />
</view>
</swiper-item>
</swiper>
</uni-swiper-dot>
</unicloud-db>
<!-- 宫格 -->
<!-- 宫格 -->
<uni-section :title="$t('grid.grid')" style="margin: 0;" type="line"></uni-section>
<view class="example-body">
<uni-grid class="uni-grid-box" :column="3" :highlight="true" @change="change">
<template v-for="(item,i) in gridList">
<uni-grid-item :index="i" :key="i"
v-if="i<3 || i>2&&i<6&&hasLogin || i>5&&uniIDHasRole('admin')"
>
<view class="grid-item-box" style="background-color: #fff;">
<image :src="'/static/grid/c'+(i+1)+'.png'" class="image" mode="aspectFill" />
<text class="text">{{item}}</text>
</view>
</uni-grid-item>
<uni-grid class="uni-grid-box" :column="3" :highlight="true" @change="change">
<template v-for="(item,i) in gridList">
<uni-grid-item :index="i" :key="i"
v-if="i<3 || i>2&&i<6&&hasLogin || i>5&&uniIDHasRole('admin')"
>
<view class="grid-item-box" style="background-color: #fff;">
<image :src="'/static/grid/c'+(i+1)+'.png'" class="image" mode="aspectFill" />
<text class="text">{{item}}</text>
</view>
</uni-grid-item>
</template>
</uni-grid>
</view>
......@@ -60,25 +60,24 @@
computed: {
...mapGetters({
hasLogin: 'user/hasLogin'
})
},
})
},
onLoad() {
console.log(uni.getStorageSync('uni_id_token'),"00000000000000000000");
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
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) {
// console.log("e: ",e);
uni.showToast({
title:this.$t('grid.clickTip') + " " + `${e.detail.index}` + " " + this.$t('grid.clickTipGrid'),
icon: 'none'
......@@ -87,7 +86,7 @@
/**
* banner加载后触发的回调
*/
onqueryload(data) {
onqueryload(data) {
},
changeSwiper(e) {
this.current = e.detail.current
......@@ -221,4 +220,4 @@
.uni-input-placeholder {
font-size: 28rpx;
}
</style>
</style>
......@@ -22,7 +22,6 @@
<!-- #ifdef APP-NVUE -->
<refreshBox @refresh="refresh" :loading="loading"></refreshBox>
<!-- #endif -->
<!-- 列表渲染 -->
<uni-list-item :to="'/pages/list/detail?id='+item._id+'&title='+item.title" v-for="(item,index) in data"
:key="index">
......@@ -40,9 +39,8 @@
format="yyyy-MM-dd" :threshold="[60000, 2592000000]" />
</view>
</view>
</template>
</template>
</uni-list-item>
<!-- 加载状态:上拉加载更多,加载中,没有更多数据了,加载错误 -->
<uni-list-item>
<template v-slot:body>
......@@ -116,8 +114,12 @@
// title:"获取定位中"
// });
//默认h5端不获取定位
// let location = await gps.getLocation({geocode:true})
// console.log(location);
// #ifndef H5
let location = await gps.getLocation({
geocode: true
})
console.log(location);
// #endif
// if(location){
// uni.showToast({
// title: JSON.stringify(location),
......@@ -150,6 +152,7 @@
// #ifdef APP-NVUE
this.showRefresh = false
// #endif
console.log('end');
})
console.log('refresh');
......@@ -240,3 +243,4 @@
/* #endif */
}
</style>
......@@ -2,7 +2,7 @@
<view class="content">
<!-- 顶部文字 -->
<text class="tit">{{$t('common.verifyCodePlaceholder')}}</text>
<text class="tip">{{tipText}}</text>
<text class="tip">{{tipText}}</text>
<uni-forms>
<!-- 登录框 (选择手机号所属国家和地区需要另行实现) -->
<uni-easyinput type="number" class="easyinput" :inputBorder="false"
......@@ -33,13 +33,13 @@
},
canSubmit(){
return this.code.length==6;
}
}
},
onLoad({phoneNumber,phoneArea}) {
this.phone = phoneNumber;
},
onReady() {
// this.$refs.sendSmsCode.start();
onReady() {
// this.$refs.sendSmsCode.start();
},
methods: {
async submit(){ //完成并提交
......@@ -64,27 +64,26 @@
return result
})
// uniCloud.callFunction({
// name:'uni-id-cf',
// data:{
// action:'loginBySms',
// params:{
// uniCloud.callFunction({
// name:'uni-id-cf',
// data:{
// action:'loginBySms',
// params:{
// "mobile":this.phone,
// "code":this.code
// },
// },
// success: ({result}) => {
// if(result.code === 0){
// this.loginSuccess(result)
// }else{
// uni.showModal({
// content: result.msg,
// showCancel: false
// });
// }
// }
// "code":this.code
// },
// },
// success: ({result}) => {
// if(result.code === 0){
// this.loginSuccess(result)
// }else{
// uni.showModal({
// content: result.msg,
// showCancel: false
// });
// }
// }
// })
}
}
}
......
......@@ -7,7 +7,7 @@
<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="$t('pwdLogin.verifyCodePlaceholder')"/>
</view>
</view>
<uni-agreements @setAgree="agree = $event"></uni-agreements>
<button class="send-btn" :disabled="!canLogin" :type="canLogin?'primary':'default'"
@click="pwdLogin">{{$t('pwdLogin.login')}}</button>
......@@ -98,59 +98,59 @@
}
return result
})
// 下边是可以登录
// uniCloud.callFunction({
// name:'uni-id-cf',
// data:{
// action:'login',
// params:{
// "username": this.username,
// "password": this.password,
// "captcha":this.captcha
// },
// },
// success: ({result}) => {
// console.log(result);
// if (result.code === 0) {
// this.loginSuccess(result)
// } else {
// if (result.needCaptcha) {
// uni.showToast({
// title: result.msg,
// icon: 'none'
// });
// this.createCaptcha()
// }else{
// uni.showModal({
// title: this.$t('common').error,
// content: result.msg,
// showCancel: false,
// confirmText: this.$t('common').gotIt
// });
// }
// }
// }
// })
// 下边是可以登录
// uniCloud.callFunction({
// name:'uni-id-cf',
// data:{
// action:'login',
// params:{
// "username": this.username,
// "password": this.password,
// "captcha":this.captcha
// },
// },
// success: ({result}) => {
// console.log(result);
// if (result.code === 0) {
// this.loginSuccess(result)
// } else {
// if (result.needCaptcha) {
// uni.showToast({
// title: result.msg,
// icon: 'none'
// });
// this.createCaptcha()
// }else{
// uni.showModal({
// title: this.$t('common').error,
// content: result.msg,
// showCancel: false,
// confirmText: this.$t('common').gotIt
// });
// }
// }
// }
// })
},
createCaptcha(){
uniCloud.callFunction({
name:'uni-id-cf',
data:{
action:'createCaptcha',
params:{
scene: "login"
},
},
success: ({result}) => {
if (result.code === 0) {
this.captchaBase64 = result.captchaBase64
uniCloud.callFunction({
name:'uni-id-cf',
data:{
action:'createCaptcha',
params:{
scene: "login"
},
},
success: ({result}) => {
if (result.code === 0) {
this.captchaBase64 = result.captchaBase64
}else{
uni.showModal({
content: result.msg,
showCancel: false
});
}
}
}
}
})
},
/* 前往注册 */
......
......@@ -35,8 +35,8 @@
export default {
mixins: [mixin],
data() {
return {
lock:false,
return {
lock:false,
formData: {
"phone": "",
'pwd': '',
......@@ -99,7 +99,7 @@
}
}
},
computed: {
computed: {
canSubmit() {
return this.isPhone && this.isPwd && this.isCode;
},
......@@ -121,7 +121,7 @@
},
onLoad(event) {
if (event && event.phoneNumber) {
this.formData.phone = event.phoneNumber;
this.formData.phone = event.phoneNumber;
this.lock = true
}
uni.setNavigationBarTitle({
......@@ -162,28 +162,28 @@
return result
})
// uniCloud.callFunction({
// name:'uni-id-cf',
// data:{
// action:'resetPwdBySmsCode',
// params:{
// "mobile": this.formData.phone,
// "code": this.formData.code,
// "password": this.formData.pwd
// },
// },
// success: ({result}) => {
// console.log(result);
// uni.showToast({
// title: result.msg,
// icon: 'none'
// });
// if (result.code === 0) {
// uni.navigateBack()
// }
// }
// uniCloud.callFunction({
// name:'uni-id-cf',
// data:{
// action:'resetPwdBySmsCode',
// params:{
// "mobile": this.formData.phone,
// "code": this.formData.code,
// "password": this.formData.pwd
// },
// },
// success: ({result}) => {
// console.log(result);
// uni.showToast({
// title: result.msg,
// icon: 'none'
// });
// if (result.code === 0) {
// uni.navigateBack()
// }
// }
// })
})
})
}
}
}
......
......@@ -43,7 +43,7 @@ import mixin from '../common/login-page.mixin.js';
uni.setNavigationBarTitle({
title: this.$t('register.navigationBarTitle')
})
},
},
methods: {
/**
* 触发表单提交
......@@ -90,23 +90,23 @@ import mixin from '../common/login-page.mixin.js';
console.log(result);
return result
})
// uniCloud.callFunction({
// name:'uni-id-cf',
// data:{
// action:'register',
// params,
// },
// success: ({result}) => {
// console.log(result);
// if(result.code === 0){
// this.loginSuccess(result)
// uniCloud.callFunction({
// name:'uni-id-cf',
// data:{
// action:'register',
// params,
// },
// success: ({result}) => {
// console.log(result);
// if(result.code === 0){
// this.loginSuccess(result)
// }else{
// uni.showModal({
// content: result.msg,
// showCancel: false
// });
// }
// }
// }
// }
// })
}
}
......@@ -120,8 +120,8 @@ import mixin from '../common/login-page.mixin.js';
}
.send-btn{
margin-top: 5px;
}
.uni-container ::v-deep .uni-forms-item__label{
width: 15px !important;
}
.uni-container ::v-deep .uni-forms-item__label{
width: 15px !important;
}
</style>
......@@ -50,9 +50,9 @@
...mapGetters({
'userInfo': 'user/info',
'hasLogin': 'user/hasLogin',
}),
i18nEnable(){
return getApp().globalData.config.i18n.enable
}),
i18nEnable(){
return getApp().globalData.config.i18n.enable
}
},
onLoad() {
......
......@@ -23,26 +23,26 @@
return {
currenPhoneArea: '',
formData: {
phone: "",
code: ""
phone:"",
code:""
}
}
},
computed: {
tipText() {
return this.$t('common.verifyCodeSend') + `${this.currenPhoneArea} ${this.formData.phone}。` + this.$t(
'common.passwordDigits')
return this.$t('common.verifyCodeSend')+ `${this.currenPhoneArea} ${this.formData.phone}。` + this.$t('common.passwordDigits')
},
canSubmit() {
return true //this.isPhone() && this.isCode();
return true//this.isPhone() && this.isCode();
}
},
onLoad(event) {
uni.setNavigationBarTitle({
title: this.$t('bindMobile.navigationBarTitle')
title:this.$t('bindMobile.navigationBarTitle')
})
},
onReady() {},
onReady() {
},
methods: {
...mapMutations({
setUserInfo: 'user/login'
......@@ -116,13 +116,11 @@
padding: 50rpx;
padding-top: 10px;
}
/* #ifndef APP-NVUE || VUE3 */
/* #ifndef APP-NVUE || VUE3 */
.box /deep/ .uni-easyinput__content {
height: 50px;
}
/* #endif */
/* #endif */
.input-box {
width: 100%;
margin-top: 16px;
......@@ -136,4 +134,4 @@
width: 650rpx;
margin-top: 15px;
}
</style>
</style>
......@@ -6,21 +6,21 @@
<view class="item">
<text>{{$t('userinfo.ProfilePhoto')}}</text>
<cloud-image @click="uploadAvatarImg" v-if="avatar_file" :src="avatar_file.url" width="50px" height="50px"></cloud-image>
<uni-icons @click="uploadAvatarImg" v-else class="chooseAvatar" type="plusempty" size="30" color="#dddddd"></uni-icons>
<uni-icons @click="uploadAvatarImg" 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="$t('userinfo.nickname')" :rightText="userInfo.nickname||$t('userinfo.notSet')" link>
</uni-list-item>
<uni-list-item class="item" @click="bindMobile" :title="$t('userinfo.phoneNumber')" :rightText="userInfo.mobile||$t('userinfo.notSpecified')" link>
</uni-list-item>
</uni-list>
<uni-list-item class="item" @click="bindMobile" :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="$t('userinfo.setNickname')"
:placeholder="$t('userinfo.setNicknamePlaceholder')">
</uni-popup-dialog>
</uni-popup>
<uni-bindMobileByMpWeixin ref="uni-bindMobileByMpWeixin"></uni-bindMobileByMpWeixin>
</uni-popup>
<uni-bindMobileByMpWeixin ref="uni-bindMobileByMpWeixin"></uni-bindMobileByMpWeixin>
</view>
</template>
<script>
......@@ -43,12 +43,12 @@
},
uniToken:''
}
},
},
onLoad() {
this.uniToken = uni.getStorageSync('uni_id_token')
console.log("uniToken: ",this.uniToken);
this.univerifyStyle.authButton.title = this.$t('userinfo.bindPhoneNumber')
this.univerifyStyle.authButton.title = this.$t('userinfo.bindPhoneNumber')
this.univerifyStyle.otherLoginButton.title = this.$t('userinfo.bindOtherLogin')
uni.setNavigationBarTitle({
title: this.$t('userinfo.navigationBarTitle')
......@@ -58,17 +58,17 @@
...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: {
},
methods: {
...mapMutations({
setUserInfo: 'user/login'
}),
}),
bindMobile() {
// #ifdef APP-PLUS
uni.preLogin({
......@@ -80,13 +80,13 @@
this.bindMobileBySmsCode()
}
})
// #endif
// #ifdef MP-WEIXIN
this.$refs['uni-bindMobileByMpWeixin'].open()
// #endif
// #endif
// #ifdef MP-WEIXIN
this.$refs['uni-bindMobileByMpWeixin'].open()
// #endif
// #ifdef H5
// #ifdef H5
//...去用验证码绑定
this.bindMobileBySmsCode()
// #endif
......@@ -132,7 +132,7 @@
}
})
},
bindMobileBySmsCode() {
bindMobileBySmsCode() {
uni.navigateTo({
url: '/pages/ucenter/userinfo/bind-mobile/bind-mobile'
})
......@@ -280,10 +280,10 @@
.chooseAvatar {
border: dotted 1px #ddd;
border-radius: 10px;
border-radius: 10px;
text-align: center;
width: 50px;
height: 50px;
line-height: 50px;
}
</style>
</style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册