临时登录凭证错误

来源:5-5 实现注册超级管理员功能(Web层)

weixin_慕村5576657

2022-03-01

图片描述
图片描述
图片描述

<template>
	<view>
		<image src="../../static/logo-2.png" mode="widthFix" class="logo"></image>
		<view class="register-container">
			<input type="text" placeholder="输入你的邀请码" class="register-code"
			maxlength="6" v-model="registerCode"/>
			<view class="register-desc">管理员创建员工证账号之后,你可以从你的个人邮箱中获得注册邀请码</view>
			<button class="register-btn" open-type="getUserInfo" @tap="register()">执行注册</button>
		</view>
	</view>
</template>

<script>
	export default {
	    data() {
	        return {
	            registerCode: '',
	            code: null
	        };
	    },
	    methods: {
	        register: function() {
	            let that = this;
	            // if (that.registerCode == null || that.registerCode.length == 0) {
	            //     uni.showToast({
	            //         icon: 'none',
	            //         title: '邀请码不能为空'
	            //     });
	            //     return;
	            // } else if (/^[0-9]{6}$/.test(that.registerCode) == false) {
	                // uni.showToast({
	                //     icon: 'none',
	                //     title: '邀请码必须是6位数字'
	                // });
	                // return;
	            // }
	            uni.login({
	                provider: 'weixin',
	                success: function(resp) {
	                    let code = resp.code;
						
	                    that.code = code;
						console.log(code);
	                }
	            });
	            uni.getUserProfile({
	                desc: '获取用户信息',
	                success: function(resp) {
	                    let nickName = resp.userInfo.nickName;
	                    let avatarUrl = resp.userInfo.avatarUrl;
	                    console.log(nickName);
	                    console.log(avatarUrl);
	                    let data = {
	                        code: that.code,
	                        nickname: nickName,
	                        photo: avatarUrl,
	                        registerCode: that.registerCode
	                    };
	                    // that.ajax(that.url.register, 'POST', data, function(resp) {
	                    //     let permission = resp.data.permission;
	                    //     let token = resp.data.token;
	                    //     uni.setStorageSync('token', token);
	                    //     uni.setStorageSync('permission', permission);
	                    //     uni.switchTab({
	                    //         url: '../index/index'
	                    //     });
	                    // });
	                }
	            });
	        }
	    }
	};

</script>

<style lang="less">
	@import url("register.less");
</style>

老师你好,我看了其他同学的问题尝试注解了好多种办法,可还是报错,请问是这里的代码问题吗,如果是,请告诉我哪里有问题,幸苦老师了。

写回答

1回答

神思者

2022-03-01

你要用Swagger测试,就要把移动端提交code的代码注释掉,要不然code提交给Web方法用过之后code就过期了,你的code就没办法测试。

1
0

SpringBoot 在线协同办公小程序开发 全栈式项目实战

未来趋势型业务 + 前后端综合技术栈 + 惊艳的细节打磨

1812 学习 · 1924 问题

查看课程