Commit b616278a authored by linwenqing's avatar linwenqing

refactor:弹窗样式修改

parent 7f883aff
......@@ -177,7 +177,10 @@ export default {
},
onShow: function(param) {
if (!this.vuex_token) {
this.$u.toast('请先登录')
this.$refs.uToast.show({
title: '请先登录',
type: 'error',
})
let that = this
setTimeout(function(){
that.$u.route({
......@@ -185,13 +188,6 @@ export default {
})
}, 1000)
}
// try {
// if (param.tabs) {
// this.current = param.tabs
// this.swiperCurrent = param.tabs
// }
// } catch (e) {}
// this.tabsChange(this.current)
},
onUnload(){
uni.hideLoading()
......@@ -199,11 +195,19 @@ export default {
methods: {
submit(){
if(!this.certId){
this.$u.toast('请填写证件号码!')
this.$refs.uToast.show({
title: '请填写证件号码!',
type: 'error',
duration: 2000
})
return
}
if(!this.certName){
this.$u.toast('请填写姓名!')
this.$refs.uToast.show({
title: '请填写姓名!',
type: 'error',
duration: 2000
})
return
}
let param = {
......@@ -216,7 +220,11 @@ export default {
this.$u.api.getCertFromOut(param).then((res) => {
uni.hideLoading()
if(!res){
this.$u.toast('证书暂未公布')
this.$refs.uToast.show({
title: '未查询到相关记录,请稍后再试',
type: 'warning',
duration: 2000
})
return
}
let data = []
......
......@@ -44,7 +44,9 @@ export default {
},
},
onLoad(params) {
this.returnUrl = decodeURIComponent(params?.path)
if (params && params.path) {
this.returnUrl = decodeURIComponent(params.path)
}
},
methods: {
wxLogin() {
......
......@@ -70,6 +70,7 @@
</u-cell-item>
</u-cell-group>
</view>
<u-toast ref="uToast" />
</view>
</template>
......@@ -129,7 +130,10 @@ export default {
!this.student.identityNumber ||
!this.student.certificateValidityDate
) {
this.$u.toast('请上传身份证正反面信息')
this.$refs.uToast.show({
title: '请上传身份证正反面信息',
type: 'error',
})
return
}
this.$u.api
......@@ -141,7 +145,11 @@ export default {
name: this.student.name,
})
.then((res) => {
this.$u.toast('认证成功')
this.$refs.uToast.show({
title: '认证成功',
type: 'success',
duration: 2000,
})
this.student.isCertify = true
setTimeout(() => {
this.$u.route({
......@@ -169,9 +177,13 @@ export default {
})
.catch((data) => {
uni.hideLoading()
uni.hideToast()
this.student.name = ''
this.student.identityNumber = ''
this.$u.toast('识别身份证信息错误')
this.$refs.uToast.show({
title: '识别身份证信息错误',
type: 'error',
})
})
})
},
......@@ -192,8 +204,13 @@ export default {
})
.catch((data) => {
uni.hideLoading()
uni.hideToast()
this.student.certificateValidityDate = ''
this.$u.toast('识别身份证信息错误')
this.$refs.uToast.show({
title: '识别身份证信息错误',
type: 'error',
duration: 2000,
})
})
})
},
......
......@@ -20,6 +20,7 @@
</view>
<button @click="submit" class="sub-input">提交</button>
</view>
<u-toast ref="uToast" />
</view>
</template>
......@@ -53,7 +54,11 @@ export default {
})
.then((res) => {
this.isNotSet = false
this.$u.toast('保存成功')
this.$refs.uToast.show({
title: '保存成功',
type: 'success',
duration: 2000,
})
setTimeout(() => {
this.$u.route({
type: 'back',
......
......@@ -74,12 +74,12 @@
></u-cell-item>
</u-cell-group>
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>
import upload from '@/common/upload'
import login from '@/common/login'
export default {
data() {
return {
......@@ -118,12 +118,10 @@ export default {
},
onLoad() {
this.refleshCode()
this.$u.api
.getQiNiuToken({ bucketName: 'wsy-exam' })
.then((res) => {
this.qiToken = res
getApp().globalData.qiNiuToken = res
})
this.$u.api.getQiNiuToken({ bucketName: 'wsy-exam' }).then((res) => {
this.qiToken = res
getApp().globalData.qiNiuToken = res
})
this.$u.api.getUserInfo().then((res) => {
if (res) {
res.isCertify =
......@@ -160,11 +158,19 @@ export default {
iv: e.detail.iv,
}
} else {
this.$u.toast(e.detail.errMsg)
this.$refs.uToast.show({
title: e.detail.errMsg,
type: 'error',
duration: 2000,
})
return
}
} else {
this.$u.toast('授权失败,请重新授权')
this.$refs.uToast.show({
title: '授权失败,请重新授权',
type: 'error',
duration: 2000,
})
return
}
this.syncUserinfo(params)
......@@ -212,11 +218,19 @@ export default {
phoneNumber: res.phoneNumber,
})
.then((ret) => {
this.$u.toast('绑定成功!')
this.$refs.uToast.show({
title: '绑定成功!',
type: 'success',
duration: 2000,
})
})
})
.catch((err) => {
this.$u.toast('请登录后再绑定')
this.$refs.uToast.show({
title: '请登录后再绑定',
type: 'warning',
duration: 2000,
})
this.$u.route({
url: 'pages/login/index',
params: {
......@@ -246,7 +260,11 @@ export default {
})
},
toLogin() {
this.$u.toast('登录信息已失效,请重新登录')
this.$refs.uToast.show({
title: '登录信息已失效,请重新登录',
type: 'warning',
duration: 2000,
})
setTimeout(() => {
uni.navigateTo({
url: 'pages/login/index',
......
......@@ -9,6 +9,7 @@
></u-cell-item>
</u-cell-group>
<view class="logout" @tap="logout">退出登录</view>
<u-toast ref="uToast" />
</view>
</template>
......@@ -23,22 +24,25 @@ export default {
onLoad() {},
methods: {
upgrade: function() {
wx.showToast({
let that = this
uni.showLoading({
title: '正在更新版本...',
icon: 'loading',
})
const um = wx.getUpdateManager()
um.onCheckForUpdate(function(res) {
uni.hideLoading()
if (res.hasUpdate) {
um.onUpdateReady(function() {
um.applyUpdate()
wx.showToast({
that.$refs.uToast.show({
title: '更新完成',
type: 'success',
})
})
} else {
wx.showToast({
that.$refs.uToast.show({
title: '已是最新版本',
type: 'success',
})
}
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment