|
[云开发]
安卓手机正常,苹果手机账号录入不了但是密码可以正常...
[复制链接]
本帖最后由 app定制 于 2022-8-10 11:36 编辑
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
- <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
- <title>登录</title>
- <link rel="stylesheet" type="text/css" href="../../css/api.css" />
- <link rel="stylesheet" type="text/css" href="../../css/style.css" />
- <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
- <link rel="stylesheet" type="text/css" href="../../css/index.css" />
- <style>
- html,
- body {
- background-color: #fff;
- }
- .l_title {
- display: block;
- /*height:6rem;*/
- padding: 3.5rem;
- font-size: 1.5rem;
- text-align: center;
- color: #fff;
- background-image: url(../../image/icon/dbg.png);
- background-position: center;
- background-size: 100% 100%;
- background-repeat: no-repeat;
- }
- .l_list {
- display: block;
- padding: 3rem 2rem;
- }
- .l_img {
- display: block;
- width: 1rem;
- height: 1.2rem;
- }
- .li_b {
- border-bottom: 1px solid #ccc !important;
- }
- .aui-btn-block {
- margin: auto;
- margin-top: 3rem;
- margin-bottom: 1rem;
- width: 80%;
- border-radius: 1rem;
- text-align: center;
- }
- .aui-list .aui-list-item-label,
- .aui-list .aui-list-item-label-icon {
- width: 10% !important;
- }
- .aui-list-item{
- display: flex;
- }
- </style>
- </head>
- <body>
- <div class="aui-content" id="vue">
- <div class="l_title">登录</div>
- <div class="l_list">
- <div class="aui-content aui-margin-b-15">
- <ul class="aui-list aui-form-list" style="background-size:100% 0px;">
- <div class="ms-login">
- <li class="aui-list-item">
- <div class="aui-list-item-label">
- <img class="l_img" src="../../image/icon/yonghu.png" alt="">
- </div>
- <div prop="username" style="line-height: 2.5rem;width:90%;">
- <input v-model="ruleForm.username" placeholder="账号"></input>
- </div>
- </li>
- <li class="aui-list-item">
- <div class="aui-list-item-label">
- <img class="l_img" src="../../image/icon/mi.png" alt="">
- </div>
- <div prop="password" style="line-height: 2.5rem;width:90%;">
- <input type="password" placeholder="密码" v-model="ruleForm.password" @keyup.enter.native="submitForm('ruleForm')"></input>
- </div>
- </li>
- <!-- `checked` 为 true 或 false -->
- <li class="" style="padding-top:1rem;display:flex;justify-content: flex-end;">
- <input type="checkbox" v-model="checked" style="width:1rem;height:1rem;margin:0.1rem .5rem;background-color:#fff;">
- <span>记住密码</span>
- </li>
- <div class="login-btn">
- <button type="primary" class="aui-btn aui-btn-info aui-btn-block aui-btn-sm" @click="submitForm('ruleForm')">登录</button>
- </div>
- </div>
- </ul>
- </div>
- </div>
- </div>
- </body>
- </html>
- <script type="text/javascript" src="../../script/api.js"></script>
- <script type="text/javascript" src="../../script/jquery-2.1.1.min.js"></script>
- <script type="text/javascript" src="../../script/common.js"></script>
- <script type="text/javascript" src="../../script/vue.js"></script>
- <script type="text/javascript" src="../../script/vant.min.js"></script>
- <script type="text/javascript">
- var vm = new Vue({
- el: "#vue",
- data: {
- ruleForm: {
- username: '',
- password: ''
- },
- checked: true,
- },
- mounted() { //在mounted里面获取cookie
- this.getCookie();
- },
- methods: {
- submitForm(formName) {
- //判断复选框是否被勾选 勾选则调用配置cookie方法
- if (vm.checked == true) {
- // console.log("checked == true");
- //传入账号名,密码,和保存天数3个参数
- vm.setCookie(vm.ruleForm.username, vm.ruleForm.password, 30);
- } else {
- // console.log("清空Cookie");
- //清空Cookie
- vm.clearCookie();
- }
- //与后端请求代码,本功能不需要与后台交互所以省略
- if (vm.ruleForm.username != '' && vm.ruleForm.password != '') {
- api.showProgress({
- style: 'default',
- animationType: 'fade',
- title: '',
- text: '',
- modal: false
- });
- api.ajax({
- url: '' + csAppip + 'appUser/login.do',
- method: 'post',
- timeout: 30,
- cache: true,
- dataType: 'json',
- returnAll: false,
- data: {
- values: {
- USERNAME: vm.ruleForm.username,
- PASSWORD: vm.ruleForm.password
- }
- }
- }, function(ret, err) {
- if (ret) {
- if ("200" == ret.code) {
- console.log(JSON.stringify(ret.data));
- // open_toast('登录成功!');
- $api.setStorage('USERNAME', ret.data.USERNAME);
- $api.setStorage("msLogin", 'OK');
- if ("" == ret.data.LAST_LOGIN) { //初次登录强制修改密码
- $api.setStorage("msFirst", 'YES');
- all_win_vue('修改密码', 'personal/xiugaimima', '初次登录,强制修改初始密码', '1')
- } else {
- var calling = api.require('tencentTrtcCalling');
- calling.init({}, function(ret, err) {
- if (ret) {
- // alert(JSON.stringify(ret));
- console.log(JSON.stringify(ret));
- } else {
- console.log(JSON.stringify(err));
- }
- });
- var sdkAppId = 1400673358;
- var userId = ret.data.USER_ID;
- var userSig = ret.data.USERSIG;
- calling.login({
- sdkAppId: sdkAppId,
- userId: userId,
- userSig: userSig
- }, function(ret, err) {
- if (ret) {
- // alert(JSON.stringify(ret));
- console.log(JSON.stringify(ret));
- } else {
- console.log(JSON.stringify(err));
- }
- });
- $api.setStorage("USERSIG", ret.data.USERSIG);
- $api.setStorage("USER_ID", ret.data.USER_ID);
- $api.setStorage("ROLE_NAME", ret.data.ROLE_NAME);
- $api.setStorage("ROLE_ID", ret.data.ROLE_ID);
- $api.setStorage("BUMEN_ID", ret.data.BUMEN_ID);
- $api.setStorage("BUMEN_NAME", ret.data.BUMEN_NAME);
- $api.setStorage('NAME', ret.data.NAME);
- $api.setStorage('USERPHOTO', ret.data.USERPHOTO);
- $api.setStorage('PHONE', ret.data.PHONE);
- $api.setStorage('EMAIL', ret.data.EMAIL);
- $api.setStorage('COUNTY', ret.data.COUNTY);
- $api.setStorage('COUNTYNAME', ret.data.COUNTYNAME);
- $api.setStorage('TOWN', ret.data.TOWN);
- $api.setStorage('TOWNNAME', ret.data.TOWNNAME);
- $api.setStorage('VILLAGE', ret.data.VILLAGE);
- $api.setStorage('VILLAGENAME', ret.data.VILLAGENAME);
- $api.setStorage('QUYU', ret.data.QUYU);
- $api.setStorage('LONGITUDE', ret.data.LONGITUDE);
- $api.setStorage('LATITUDE', ret.data.LATITUDE);
- $api.setStorage('RADIUS', ret.data.RADIUS);
- $api.setStorage('msToken', ret.data.TOKEN);
- //新增宣传部
- $api.setStorage('msUNIT1', ret.data.UNIT1);
- $api.setStorage('msUNIT2', ret.data.UNIT2);
- $api.setStorage('msUNIT3', ret.data.UNIT3);
- $api.setStorage('msUNIT1NAME', ret.data.UNIT1NAME);
- $api.setStorage('msUNIT2NAME', ret.data.UNIT2NAME);
- $api.setStorage('msUNIT3NAME', ret.data.UNIT3NAME);
- $api.setStorage('msTYPE', ret.data.TYPE);
- api.sendEvent({
- name: 'denglu',
- });
- setTimeout(function() {
- api.closeWin();
- }, 200);
- jpush = api.require('ajpush');
- if (api.systemType != 'ios') {
- initJPush();
- }
- var param = {
- alias: ret.data.USER_ID,
- tags: [ret.data.BUMEN_ID, ret.data.PHONE]
- };
- jpush.getRegistrationId(function(res) {
- console.log('getRegistrationId=====' + JSON.stringify(res))
- pst(res.id);
- });
- jpush.bindAliasAndTags(param, function(ret, err) {
- if (ret) {
- if (ret.statusCode == 0) {
- console.log('成功!别名')
- } else {
- console.log('绑定别名失败!')
- }
- } else {
- console.log(JSON.stringify(err))
- }
- });
- }
- } else {
- open_toast(ret.msg);
- }
- } else {
- open_toast('请检查您的网络denglu');
- };
- api.hideProgress();
- return
- });
- } else {
- open_toast('请将信息填写完整!');
- }
- // console.log("登陆成功");
- },
- //设置cookie
- setCookie(c_name, c_pwd, exdays) {
- var exdate = new Date(); //获取时间
- exdate.setTime(exdate.getTime() + 24 * 60 * 60 * 1000 * exdays); //保存的天数
- //字符串拼接cookie
- window.document.cookie = "userName" + "=" + c_name + ";path=/;expires=" + exdate.toGMTString();
- window.document.cookie = "userPwd" + "=" + c_pwd + ";path=/;expires=" + exdate.toGMTString();
- },
- //读取cookie
- getCookie: function() {
- if (document.cookie.length > 0) {
- var arr = document.cookie.split('; '); //这里显示的格式需要切割一下自己可输出看下
- for (var i = 0; i < arr.length; i++) {
- var arr2 = arr[i].split('='); //再次切割
- //判断查找相对应的值
- if (arr2[0] == 'userName') {
- this.ruleForm.username = arr2[1]; //保存到保存数据的地方
- } else if (arr2[0] == 'userPwd') {
- this.ruleForm.password = arr2[1];
- }
- }
- }
- },
- //清除cookie
- clearCookie: function() {
- this.setCookie("", "", -1); //修改2值都为空,天数为负1天就好了
- },
- all_win_vue(msName, msUrl, msLink, msValue, msValue1, msValue2, msValue3, msValue4, msValue5) {
- all_win_vue(msName, msUrl, msLink, msValue, msValue1, msValue2, msValue3, msValue4, msValue5);
- },
- }
- });
- apiready = function() {
- var timer = 0
- api.addEventListener({
- name: 'keyback'
- }, function(ret, err) {
- var currentTime = new Date().getTime()
- api.historyBack(function(ret, err) {
- if (!ret.status) {
- if ((currentTime - timer) > 2000) {
- timer = currentTime;
- open_toast('再按一次返回键退出app')
- } else {
- api.closeWidget({
- id: 'A6021379356643', //这里改成自己的应用ID
- retData: {
- name: 'closeWidget'
- },
- silent: true
- })
- }
- }
- })
- })
- }
- </script>
复制代码 安卓手机正常,苹果手机账号录入不了但是密码可以正常录入 |
|