login.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <!DOCTYPE html>
  2. <html class="">
  3. <!--STATUS OK-->
  4. <head>
  5. <meta name="referrer" content="always" />
  6. <meta charset='utf-8' />
  7. <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
  8. <meta http-equiv="x-dns-prefetch-control" content="on">
  9. <meta name="description" content="">
  10. <meta name="format-detection" content="telephone=no" />
  11. <link rel="stylesheet" type="text/css" href="../css/css/vant-ui.css" />
  12. <link rel="stylesheet" type="text/css" href="../css/css/iconfont.css">
  13. <link rel="stylesheet" type="text/css" href="../css/css/main.css" />
  14. <title></title>
  15. </head>
  16. <style>
  17. .login .loginFix {
  18. position: absolute;
  19. }
  20. .login-switch-language {
  21. float: right;
  22. line-height: 24px;
  23. }
  24. </style>
  25. <body>
  26. <div id="app" v-cloak>
  27. <div class="login" id="aui-header">
  28. <div class="logo"></div>
  29. <div class="loginBox">
  30. <van-tabs v-model="activeWay" color="#03a9f4" background="transparent">
  31. <van-tab :title="$t('login.accountLogin')" name="userPwd">
  32. <div class="labelTitle flex a-center" style="margin-top: .32rem;">
  33. <b class="i1"></b>
  34. {{ $t('login.account') }}
  35. </div>
  36. <div class="labelValue flex a-center">
  37. <input type="text" :placeholder="$t('login.placeholder1')" key="user" v-model="userCode"/>
  38. </div>
  39. <div class="labelTitle flex a-center" style="margin-top: 0.3rem;">
  40. <b class="i2"></b>
  41. {{ $t('login.password') }}
  42. </div>
  43. <div class="labelValue flex a-center">
  44. <input :type="type?'password':'text'" :placeholder="$t('login.placeholder2')" key="pwd" v-model="userPassword"/>
  45. <div class="labelToolbel flex a-center">
  46. <van-icon name="clear" size="0.3rem" v-if="userPassword.length" @click="userPassword=''"></van-icon>
  47. <div>
  48. <svg @click="type=!type" v-if="type" t="1589111457609" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2189" width="22" height="22">
  49. <path d="M512 209.403241c-201.731514 0-374.009206 125.476783-443.808922 302.596759 69.798692 177.119977 242.077408 302.596759 443.808922 302.596759 201.933105 0 374.010229-125.476783 443.808922-302.596759C886.009206 334.880023 713.933105 209.403241 512 209.403241zM512 713.731514c-111.355157 0-201.731514-90.375334-201.731514-201.731514s90.375334-201.731514 201.731514-201.731514 201.731514 90.375334 201.731514 201.731514S623.355157 713.731514 512 713.731514zM512 390.961296c-66.772776 0-121.038704 54.265928-121.038704 121.038704s54.265928 121.038704 121.038704 121.038704 121.038704-54.265928 121.038704-121.038704S578.772776 390.961296 512 390.961296z" p-id="2190" fill="#00a0ea"></path>
  50. </svg>
  51. <svg @click="type=!type" v-else t="1589111610728" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2762" width="22" height="22">
  52. <path d="M928.312889 267.477333C792.078222 436.906667 655.957333 519.111111 519.651556 519.111111c-136.832 0-278.584889-82.773333-425.031112-252.913778a49.777778 49.777778 0 1 0-75.463111 64.938667C182.826667 521.287111 349.596444 618.666667 519.637333 618.666667c170.609778 0 332.785778-97.934222 486.257778-288.810667a49.777778 49.777778 0 0 0-77.582222-62.378667z" p-id="2763" fill="#00a0ea"></path><path d="M162.730667 469.447111l-94.819556 109.710222a35.555556 35.555556 0 1 0 53.802667 46.506667l94.819555-109.710222a35.555556 35.555556 0 0 0-53.802666-46.506667zM354.247111 598.186667l-37.930667 151.708444a35.555556 35.555556 0 0 0 68.992 17.251556l37.930667-151.708445a35.555556 35.555556 0 0 0-68.992-17.251555zM629.575111 604.387556l53.333333 151.694222a35.555556 35.555556 0 0 0 67.072-23.580445l-53.333333-151.694222a35.555556 35.555556 0 0 0-67.072 23.580445zM823.111111 475.164444l109.710222 109.724445a35.555556 35.555556 0 0 0 50.289778-50.289778l-109.710222-109.710222a35.555556 35.555556 0 0 0-50.289778 50.289778z" p-id="2764" fill="#00a0ea"></path>
  53. </svg>
  54. </div>
  55. </div>
  56. </div>
  57. <div class="loginBtns flex a-center j-center" key="userPwdbtn" v-on:click="login('userPwd')">
  58. {{ $t('login.loginIn') }}
  59. </div>
  60. </van-tab>
  61. <van-tab :title="$t('login.veriLogin')" name="phoneCode">
  62. <div class="labelTitle flex a-center" style="margin-top: .32rem;">
  63. <b class="i1"></b> {{ $t('login.mobile') }}
  64. </div>
  65. <div class="labelValue flex a-center">
  66. <input type="text" :placeholder="$t('login.placeholder3')" key="phone" v-model="userCode" />
  67. </div>
  68. <div class="labelTitle flex a-center" style="margin-top: 0.3rem;">
  69. <b class="i2"></b> {{ $t('login.verificantion') }}
  70. </div>
  71. <div class="labelValue flex a-center">
  72. <input type="text" :placeholder="$t('login.placeholder4')" key="code" v-model="userPassword" />
  73. <div class="labelToolbel a-center getCodeBtn" v-bind:class="wait < 60 ? 'dontSend' : ''"
  74. v-on:click="getPhoneCode">
  75. {{ wait == 60 ? $t('login.getCode') : (wait + "s" + $t('login.tryAgain')) }}
  76. </div>
  77. </div>
  78. <div class="loginBtns flex a-center j-center" key="phoneCodebtn" v-on:click="login('phoneCode')">
  79. {{ $t('login.loginIn') }}
  80. </div>
  81. </van-tab>
  82. </van-tabs>
  83. <!-- 备注:切换多语言 -->
  84. <!-- <div class="login-switch-language" @click="switchLang">{{ $t('common.language') }}</div> -->
  85. </div>
  86. <div class="loginFix">
  87. {{ $t('login.sailun') }}
  88. </div>
  89. </div>
  90. </div>
  91. </body>
  92. <script type="text/javascript" src="../script/api.js"></script>
  93. <script type="text/javascript" src="../script/httpRequest.js"></script>
  94. <script type="text/javascript" src="../script/js/vue.js"></script>
  95. <script type="text/javascript" src="../script/js/vue-i18n.js"></script>
  96. <script type="text/javascript" src="../script/js/vant-ui.js"></script>
  97. <script type="text/javascript" src="../script/vue_plugins.js"></script>
  98. <script type="text/javascript" src="../script/js/main.js"></script>
  99. <script type="text/javascript" src="./pcr/js/zh.js"></script>
  100. <script type="text/javascript" src="./pcr/js/en.js"></script>
  101. <script type="text/javascript">
  102. apiready = function() {
  103. var langType;
  104. var isLang = $api.getStorage('lang')
  105. if (!isLang) {
  106. //备注:屏蔽多语言功能
  107. // langType = navigator.language.toUpperCase().indexOf('EN') != -1 ? 'en' : 'cn'
  108. langType = "cn";
  109. $api.setStorage('lang', langType);
  110. } else {
  111. langType = isLang
  112. }
  113. const i18n = new VueI18n({
  114. locale: langType,//设置语言
  115. messages: {
  116. en: getEn(),
  117. cn: getCn()
  118. }
  119. })
  120. var header = $api.byId('aui-header');
  121. $api.fixStatusBar(header);
  122. var headerPos = $api.offset(header);
  123. if (api.systemType == 'android') {
  124. $api.css($api.byId('aui-header'), 'padding-top:2.1rem');
  125. };
  126. api.closeFrameGroup({
  127. name: 'indexGrouppcr'
  128. });
  129. api.closeFrameGroup({
  130. name: 'indexGrouptbr'
  131. });
  132. new Vue({
  133. el : '#app',
  134. i18n,
  135. data : {
  136. activeWay: "userPwd",
  137. userCode : '', // 用户名
  138. userPassword : '', // 用户密码
  139. loginUrl : 'loginUrl',
  140. getPhoneCodeUrl : 'getPhoneCode',
  141. codeCookie: "",//验证码cookie
  142. checked : false,
  143. type : true,
  144. wait: 60,
  145. },
  146. methods : {
  147. // 点击登录
  148. login : function(params) {
  149. var _this = this;
  150. if (this.userCode == "") {
  151. this.showToast(this.$t('login.tips1'));
  152. return;
  153. }
  154. if (this.userPassword == "") {
  155. this.showToast(this.$t('login.tips2'));
  156. return;
  157. };
  158. var data;
  159. if(params=="userPwd"){
  160. data = {
  161. clientId : this.userCode,
  162. password : this.userPassword,
  163. authCode : "",
  164. url : 'json',
  165. type : 'body'
  166. };
  167. this.$post(this.loginUrl, data, function(ret) {
  168. if (ret.code == 0 || ret.code == '0') {
  169. if(ret.data.data == null){
  170. api.toast({ msg : _this.$t('login.tips3') });
  171. return;
  172. };
  173. _this.showToast(_this.$t('login.tips4'));
  174. // 将loginid 保存到本地
  175. $api.setStorage("token", ret.data.data.token);
  176. $api.setStorage("agentName", ret.data.data.name);
  177. $api.setStorage("kunnr", ret.data.data.kunnr);
  178. $api.setStorage('subRoleName', 'superAdmin');//存储登录的角色
  179. $api.setStorage('showScope', ret.data.data.showScope);
  180. _this.sendEvent("saveUserPwdInfo",ret);
  181. _this.sendEvent('setLang', $api.getStorage('lang'))
  182. // 判断是否进行选择业务场景
  183. if(ret.data.data.showScope){
  184. setTimeout(function() {
  185. api.closeToWin({
  186. name: 'root'
  187. });
  188. }, 500);
  189. // var a = $api.getStorage('lang');
  190. // var jsFun = 'setLang()';
  191. // api.execScript({
  192. // frameName: 'login',
  193. // script: jsFun
  194. // })
  195. }else{
  196. setTimeout(function() {
  197. $api.setStorage('roleScene', ret.data.data.spart);
  198. _this.loginEntrance(ret.data.data.spart,'..');
  199. api.closeWin({});
  200. }, 500);
  201. }
  202. }
  203. });
  204. }else if(params=="phoneCode"){15621010862
  205. data = {
  206. tel : this.userCode,
  207. authCode : this.userPassword,
  208. cookie : this.codeCookie,
  209. url : 'json',
  210. type : 'body'
  211. };
  212. this.$post("salesmanRegister", data, function(ret) {
  213. if (ret.code == 0 || ret.code == '0') {
  214. if(ret.data == null){
  215. api.toast({ msg : _this.$t('login.tips3') });
  216. return;
  217. };
  218. _this.showToast(_this.$t('login.tips4'));
  219. $api.setStorage("pertel", ret.data.userMsg.tel);
  220. $api.setStorage("loginToken", ret.data.loginToken);
  221. $api.setStorage('subRoleName', 'orderPer');
  222. $api.setStorage('showScope', false);
  223. _this.sendEvent('setLang', $api.getStorage('lang'))
  224. setTimeout(function() {
  225. $api.setStorage('roleScene', "500");
  226. _this.loginEntrance("500",'..');
  227. }, 500);
  228. }
  229. });
  230. };
  231. },
  232. // 获取短信验证码
  233. getPhoneCode: function () {
  234. if (this.wait < 60) {
  235. return;
  236. };
  237. var data = "tel=" + this.userCode,_this = this;
  238. var url = "getPhoneCode";
  239. this.$get(url, data, function (ret) {
  240. if (ret.code == 0 || ret.code == '0') {
  241. _this.codeCookie = ret.cookie;
  242. api.toast({
  243. msg: _this.$t('login.tips5')
  244. });
  245. _this.startResod();
  246. }else{
  247. api.toast({
  248. msg: ret.msg
  249. });
  250. }
  251. })
  252. },
  253. // 开始倒计时
  254. startResod: function () {
  255. var _this = this;
  256. if (this.wait == 0) {
  257. this.wait = 60;
  258. } else {
  259. this.wait--;
  260. setTimeout(function () {
  261. _this.startResod();
  262. }, 1000)
  263. }
  264. },
  265. // 切换语言
  266. switchLang: function () {
  267. i18n.locale = i18n.locale == 'en' ? 'cn' : 'en'
  268. $api.setStorage('lang', i18n.locale)
  269. }
  270. },
  271. filters : {
  272. },
  273. mounted : function() {
  274. api.addEventListener({
  275. name : 'keyback'
  276. }, function(ret, err) {
  277. api.closeWidget({
  278. id : 'A6040771020543', //这里是应用id
  279. retData : {
  280. name : 'closeWidget'
  281. },
  282. animation : {
  283. type : 'flip',
  284. subType : 'from_bottom',
  285. duration : 500
  286. }
  287. });
  288. });
  289. }
  290. })
  291. }
  292. </script>
  293. </html>