【报Bug】急救!!升级到最新版本后。自定义导航不能用了!!!!
麻烦加急处理!!一升级后,进行云打包。结果自定义导航变成如图的样子。布局都乱了。
- 发布:2019-04-15 16:24
- 更新:2019-04-17 18:08
- 阅读:987
shenxianyan (作者) - weex先发
<template>
<div style="display: flex;">
<div style="flex: 1;">
<image style="flex:1;" resize="cover" src="../../static/images/bg.png"></image>
</div>
<!--toast提示-->
<div class="toast" ref="toast">
<image resize="cover" style="width:40px;height:40px;margin-right:10px;" :src='toast_img'></image>
<text style="color:#666;font-size: 32px;">{{toast_content}}</text>
</div>
<div ref="loginview" class="login-content">
<div class="logo-div">
<image @click="identification" class="logo" resize="cover" src="../../static/images/logo.png"></image>
</div>
<div class="input-view">
<input upriseOffset="0" hideDoneButton="true" type="tel" ref="telephone" @input="inputTelephone" class="input" max-length="20" placeholder="手机号码" />
</div>
<div class="hr"></div>
<div class="input-view">
<input hideDoneButton="true" type="tel" ref="code" @input="inputCode" class="input" max-length="20" placeholder="验证码" />
</div>
<div class="hr"></div>
<div class="mz">
<text class="mz-text" @click="usersservice">注册即同意《服务与使用协议》</text>
</div>
</div>
</div>
</template>
<script>
const project_url = ''
const stream = weex.requireModule('stream');
const animation = weex.requireModule('animation')
const storage = weex.requireModule('storage')
const modal = weex.requireModule('modal')
export default {
data() {
return {
userInfo: {},
toast_ready: false,
toast_img: "",
toast_content: "",
input: '',
telephone: '',
code: "",
device: {},
latitude: '',
longitude: '',
location: false
}
},
created: function() {
setTimeout(() => {
var that = this
uni.getLocation({
type: 'wgs84',
success: function(resp_data) {
that.latitude = resp_data.latitude
that.longitude = resp_data.longitude
that.location = true
},
fail: function(e) {}
})
uni.getStorage({
key: 'device',
success(res) {
var device = JSON.parse(res.data)
var back = false
that.device = device
}
})
uni.getStorage({
key: 'userInfo',
success(res) {
var userInfo = res.data
userInfo = JSON.parse(userInfo)
if (userInfo && userInfo.build == true) {
that.userInfo = userInfo
}
}
})
},
100)
},
mounted: function() {
var that = this
that.login_view_up()
},
methods: {
identification: function() {
uni.navigateTo({
url: '/pages/identification/identification'
})
},
login_view_up: function() {
var that = this
var loginview = that.$refs.loginview
animation.transition(loginview, {
styles: {
transform: 'translate(0, -500px)',
},
duration: 1000, //ms
timingFunction: 'ease-in-out',
delay: 200 //ms
}, function() {
//modal.toast({ message: 'animation finished.' })
})
},
/**
- 输入验证码
*/
inputCode(event) {
var that = this
var code = event.value
if (code.length == 6) {
if (that.code == code) {
//跳转完善资料
that.$refs['code'].blur()
//创建帐号
var userInfo = {}
//{"session":"","cover":"","nickname":"","gender":"女","province":"","city":"","longitude":,"latitude":}
userInfo.telephone = that.telephone
userInfo.longitude = that.longitude
userInfo.latitude = that.latitude
that.userInfo = userInfo
that.setUserInfoToServer()
}
}
},
/** - 创建用户
*/
setUserInfoToServer: function() {
var that = this
var req_param = {}
req_param.telephone = that.userInfo.telephone
req_param.longitude = that.longitude
req_param.latitude = that.latitude
req_param.address = ''
req_param.apns_token = that.device.apns_token
uni.request({
url: project_url + '/app/app_regist/set_user_account',
data: req_param,
header: {
'content-type': 'application/json'
},
dataType: "json",
success: function(res) {
var resp_data = (res.data.Response)
var userInfo = that.userInfo
if (resp_data.opt == 1) {
//新用户,跳转到开启服务页面
userInfo.session = resp_data.session
userInfo.pay = resp_data.pay
userInfo.no = resp_data.no
userInfo.real_status = resp_data.real_status
uni.postMessage({
type: 'storage',
key: 'userInfo',
value: JSON.stringify(userInfo)
});
uni.navigateTo({
url: '/pages/identification/identification'
})
}
if (resp_data.opt == 2) {
userInfo.session = resp_data.session
userInfo.pay = resp_data.pay
userInfo.no = resp_data.no
userInfo.real_status = resp_data.real_status
userInfo.nickname = resp_data.nickname
userInfo.cover = resp_data.cover
userInfo.mini_cover = resp_data.mini_cover
userInfo.gender = resp_data.gender
userInfo.build = resp_data.build
userInfo.check_times = resp_data.check_times
uni.postMessage({
type: 'storage',
key: 'userInfo',
value: JSON.stringify(userInfo)
});
//已经存在的用户
if (resp_data.real_status == 0) {
//未实名认证
uni.navigateTo({
url: '/pages/identification/identification'
})
} else {
//已实名认证
if (resp_data.build == 0) {
//未完善用户信息,上传头像及昵称
uni.navigateTo({
url: '/pages/step/step'
})
} else {
//已正常使用用户直接进入
uni.reLaunch({
url: '/pages/index/index'
})
}
}
}
}
})
},
/** -
输入手机号码
*/
inputTelephone(event) {
var telephone = event.value
var that = this
if (that.location == false) {
uni.getLocation({
type: 'wgs84',
success: function(resp_data) {
that.latitude = resp_data.latitude
that.longitude = resp_data.longitude
that.location = true
},
fail: function(e) {
uni.showModal({
title: '温馨提示',
content: '需要获取您的定位,以便推送更多优质的用户给您。',
success: function(res) {}
})
}
})
return;
}
that.telephone = telephone
var reg = /^1[0-9]{10}$/;
var isTelephone = reg.test(telephone)
if (isTelephone) {
var req_param = {}
req_param.telephone = telephone
stream.fetch({
method: 'GET',
url: "" + telephone,
type: 'json',
header: {
'content-type': 'application/json'
},
}, function(ret) {
var resp_data = ret.data.Response
if (resp_data.opt == 0) {} else { that.code = resp_data.code that.tip = resp_data.message that.$refs['telephone'].blur() //that.$refs['code'].focus() } }) } }, /**
-
服务协议
*/
usersservice: function() {
uni.navigateTo({
url: '/pages/usersservice/usersservice'
})
},
toast: function() {
var that = this
var toast = that.$refs.toast
animation.transition(toast, {
styles: {
transform: 'translate(0, 100px)',
},
duration: 500, //ms
timingFunction: 'ease',
needLayout: false,
delay: 0 //ms
}, function() {
animation.transition(toast, {
styles: {
transform: 'translate(0, -100px)',
},
duration: 500, //ms
timingFunction: 'cubic-bezier(.02,.6,0,.99)',
needLayout: false,
delay: 3000 //ms
}, function() {})
})} },
}
</script>
<style>
page {
width: 750px;
height: 100%;
}.logo-div {
margin-top: 50px;
display: flex;
justify-content: center;
align-items: center;
}.logo {
width: 80px;
height: 80px;
}.toast {
display: flex;
flex-direction: row;
position: absolute;
width: 750px;
height: 80px;
background-color: white;
justify-content: center;
align-items: center;
top: -80px;
}.input-view {
margin-top: 30px;
margin-left: 175px
}.hr {
width: 400px;
margin-left: 175px;
height: 1px;
background-color: #394151;
}.input {
width: 400px;
height: 100px;
text-align: center;
font-size: 36px;
color: #727384;
}.login-content {
display: flex;
position: absolute;
bottom: -500px;
height: 500px;
width: 750px;
background-color: white;
z-index: 999999;
}.toast {
width: 750px;
height: 100px;
position: fixed;
top: -100px;
z-index: 999;
background-color: #394151;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
}.mz {
margin-top: 50px;
width: 750px;
height: 50px;
display: flex;
flex-direction: row;
justify-content: center;
text-align: center;
}.mz-text {
font-size: 22px;
color: #727384;
text-align: center;
}
</style>
shenxianyan (作者) - weex先发
{
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/root/root",
"style": {
"navigationBarTitleText": ""
}
},
{
"path": "pages/tip/tip",
"style": {
"navigationBarTitleText": "消息助手"
}
}, {
"path": "pages/web/web",
"style": {
"navigationBarTitleText": ""
}
}, {
"path": "pages/filter/filter",
"style": {
"app-plus": {
"titleNView": false,
"navigationStyle": "custom"
}
}
}, {
"path": "pages/pair/pair",
"style": {
"app-plus": {
"titleNView": false,
"navigationStyle": "custom"
}
}
}, {
"path": "pages/chat/chat",
"style": {
"app-plus": {
"titleNView": false,
"navigationStyle": "custom"
}
}
}, {
"path": "pages/other/other",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#ffffff",
"app-plus": {
"titleNView": false,
"navigationStyle": "custom"
}
}
}, {
"path": "pages/identification/identification",
"style": {
"app-plus": {
"titleNView": false,
"navigationStyle": "custom"
}
}
}, {
"path": "pages/identification/identification",
"style": {
"navigationBarTitleText": "开启服务"
}
}, {
"path": "pages/editnote/editnote",
"style": {
"navigationBarTitleText": "编辑内心独白"
}
}, {
"path": "pages/step/step",
"style": {
"navigationBarTitleText": "完善信息"
}
}, {
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#ffffff",
"app-plus": {
"titleNView": false,
"navigationStyle": "custom"
}
}
}, {
"path": "pages/checkidcard/checkidcard",
"style": {
"navigationBarTitleText": "实名认证"
}
}, {
"path": "pages/step/step",
"style": {
"navigationBarTitleText": "完善信息"
}
},
{
"path": "pages/usersservice/usersservice",
"style": {
"navigationBarTitleText": "服务与使用协议"
}
},
{
"path": "pages/applogin/applogin",
"style": {
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#ffffff",
"app-plus": {
"titleNView": false,
"navigationStyle": "custom"
}
}
},
{
"path": "pages/load/load",
"style": {
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#ffffff",
"app-plus": {
"titleNView": false,
"navigationStyle": "custom"
}
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "#FFFFFF",
"backgroundColor": "#F3F3F3"
}
}