Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

yinzhongmalogin.vue 7.0 KiB

3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. <template>
  2. <view class="content">
  3. <view class="head">
  4. <view class="text">
  5. <view class="text1">
  6. <view style="color: #666666;">输入短信验证码</view>
  7. <view style="color: #303030;margin-top: 20rpx;">短信已发送至{{phone}},请在下方输入框内输入4位数字验证码</view>
  8. </view>
  9. </view>
  10. </view>
  11. <view class="sction">
  12. <view class="mama">
  13. <view class="mamaz">
  14. <input type="text" v-model="msg" maxlength="4" placeholder="请输入验证码" placeholder-class="input-class" class="input" />
  15. </view>
  16. <view class="mamay">
  17. <view class="sada" v-if="sendAuthCode" style="font-size: 35rpx;" @click="getAuthCode">获取验证码</view>
  18. <text class="sada" v-if="!sendAuthCode">
  19. 重新发送
  20. <text>({{ auth_time }})</text>
  21. </text>
  22. </view>
  23. </view>
  24. <view class="login-btn" :style="{ background: msg == '' ? '#F2F2F2' : '#2671E2' }" @click="denglu"><text
  25. class="">登录</text></view>
  26. <view class="code-login" @click="passwordlogin"><text>密码登录</text></view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. var util = require("../../utils/util.js");
  32. var config = require("../../config");
  33. var app = getApp();
  34. var WXB_SESSION_LOGIN_DATA = 'weapp_session_login_data';
  35. export default {
  36. data() {
  37. return {
  38. sendAuthCode: true,
  39. auth_time: 0,
  40. msg: '',
  41. phonecet: '',
  42. role:'',
  43. phone:''
  44. };
  45. },
  46. onLoad: function(options) {
  47. var phonese = options.username;
  48. var phonexxz = phonese.substring(0, 3) + '****' + phonese.substring(7);
  49. this.phone = phonexxz,
  50. this.phonecet = options.username,
  51. this.role = options.role
  52. this.sendAuthCode = false;
  53. this.auth_time = 60;
  54. var auth_timetimer = setInterval(() => {
  55. this.auth_time--;
  56. if (this.auth_time <= 0) {
  57. this.sendAuthCode = true;
  58. clearInterval(auth_timetimer);
  59. }
  60. }, 1000);
  61. },
  62. methods: {
  63. //跳转密码登录页面
  64. passwordlogin() {
  65. uni.reLaunch({
  66. url: '/pages/login/index',
  67. })
  68. },
  69. //获取验证码
  70. getAuthCode() {
  71. uni.request({
  72. url: config.service.sendCode + "?mobile=" + this.phonecet,
  73. method: "GET",
  74. header: {
  75. 'content-type': 'application/json',
  76. 'Access-Token': uni.getStorageSync('weapp_session_login_data').token
  77. },
  78. success: (data) => {
  79. console.log(data)
  80. // 成功地响应会话信息
  81. if (data.data.code == 10000) {
  82. util.showSuccess('发送成功');
  83. this.sendAuthCode = false;
  84. this.auth_time = 60;
  85. var auth_timetimer = setInterval(() => {
  86. this.auth_time--;
  87. if (this.auth_time <= 0) {
  88. this.sendAuthCode = true;
  89. clearInterval(auth_timetimer);
  90. }
  91. }, 1000);
  92. } else {
  93. util.showNone(data.data.message);
  94. return false;
  95. }
  96. },
  97. })
  98. },
  99. //登录
  100. denglu() {
  101. if (this.msg=='') {
  102. uni.showToast({
  103. title: '验证码不能为空',
  104. icon: 'none'
  105. });
  106. return
  107. }
  108. if (this.msg.length == 4) {
  109. let porme = {
  110. loginName: this.phonecet,
  111. password: this.msg
  112. }
  113. uni.request({
  114. url: config.service.plogin,
  115. method: "POST",
  116. data: porme,
  117. header: {
  118. 'content-type': 'application/json',
  119. 'Access-Token': uni.getStorageSync('weapp_session_login_data').token
  120. },
  121. success: (data) => {
  122. // 成功地响应会话信息
  123. if (data.data.code == 10000) {
  124. util.showSuccess('登录成功');
  125. var token = {
  126. 'token': data.data.data
  127. };
  128. uni.setStorageSync(WXB_SESSION_LOGIN_DATA, token); //写入缓存
  129. this.getMenu()
  130. this.getUser()
  131. } else {
  132. util.showNone(data.data.message);
  133. return false;
  134. }
  135. },
  136. })
  137. } else {
  138. uni.showToast({
  139. title: '验证码位数不正确',
  140. icon: 'none'
  141. });
  142. }
  143. },
  144. getMenu(){
  145. this.$u.get("/user/getMenu").then(data => {
  146. uni.setStorageSync("weapp_session_Menu_data", data)
  147. })
  148. },
  149. getUser(){
  150. util.getRequestPromise(config.service.getUser, {}, false, "GET").then(data => {
  151. if (data.zkProperties) {
  152. } else {
  153. data.zkProperties = [{
  154. id: "",
  155. propertyName: ''
  156. }]
  157. }
  158. let lopan = {
  159. id: data.zkProperties[0].id,
  160. name: data.zkProperties[0].propertyName
  161. }
  162. uni.setStorageSync("fendianindex", 0); //写入缓存
  163. uni.setStorageSync("weapp_session_userInfo_data", data); //写入缓存
  164. uni.setStorageSync("buildingID", lopan); //楼盘id写入缓存
  165. uni.switchTab({
  166. url: '/pages/index/index'
  167. });
  168. });
  169. }
  170. }
  171. };
  172. </script>
  173. <style lang="scss">
  174. .head {
  175. width: 750rpx;
  176. height:400rpx;
  177. position: relative;
  178. .text{
  179. width: 100%;
  180. position: absolute;
  181. top: 180rpx;
  182. left: 0rpx;
  183. .text1{
  184. width: 80%;
  185. margin: 0 auto;
  186. }
  187. }
  188. }
  189. .mama {
  190. width: 620rpx;
  191. display: flex;
  192. border-bottom: 1px solid #E1E1E1;
  193. margin: 60rpx auto;
  194. }
  195. .sadsadasdasdsadasd {
  196. font-size: 34rpx;
  197. font-family: PingFangSC-Medium, PingFang SC;
  198. font-weight: 500;
  199. color: #008EF2;
  200. width: 100%;
  201. text-align: center;
  202. padding-top: 340rpx;
  203. }
  204. .mamaz {
  205. width: 50%;
  206. height: 90rpx;
  207. }
  208. .mamay {
  209. width: 50%;
  210. height: 90rpx;
  211. }
  212. .input {
  213. width: 350rpx;
  214. color: #78DFB0;
  215. height: 100%;
  216. line-height: 90rpx;
  217. font-size: 17px;
  218. color: #171717;
  219. }
  220. .sada {
  221. width: 70%;
  222. line-height: 90rpx;
  223. color: #2B6EFF;
  224. text-align: right;
  225. font-size: 35rpx;
  226. margin-left: 100rpx;
  227. display: block;
  228. }
  229. .content {
  230. margin: 0;
  231. padding: 0;
  232. border-top: 1rpx solid #E0E0E0;
  233. }
  234. .login-text {
  235. font-size: 60rpx;
  236. font-family: PingFang SC;
  237. font-weight: 500;
  238. color: rgba(23, 23, 23, 1);
  239. letter-spacing: 8rpx;
  240. margin-left: 75rpx;
  241. font-weight: bold;
  242. }
  243. .login-input {
  244. border-bottom: 1px solid #e1e1e1;
  245. color: #c9cac9;
  246. margin: 98rpx 64rpx 200rpx 75rpx;
  247. font-size: 17px;
  248. }
  249. .login-btn {
  250. margin: 0 auto;
  251. margin-top: 240rpx;
  252. width: 630rpx;
  253. height: 86rpx;
  254. border-radius: 49rpx;
  255. font-size: 17px;
  256. font-weight: bold;
  257. border: none;
  258. display: flex;
  259. justify-content: center;
  260. align-items: center;
  261. color: #ffffff;
  262. }
  263. .code-login {
  264. display: flex;
  265. justify-content: center;
  266. margin-top: 40rpx;
  267. color: #D6D7D6;
  268. margin-bottom: 200rpx;
  269. font-size: 30rpx;
  270. }
  271. .log-box {
  272. display: flex;
  273. flex-direction: row;
  274. justify-content: center;
  275. align-items: center;
  276. font-size: 28rpx;
  277. color: #bfc0bf;
  278. margin-bottom: 65rpx;
  279. }
  280. .hengx {
  281. margin: 0 20rpx 0 20rpx;
  282. height: 2rpx;
  283. width: 232rpx;
  284. background: #e1e1e1;
  285. }
  286. .wechat {
  287. display: flex;
  288. justify-content: center;
  289. align-items: center;
  290. width: 93rpx;
  291. height: 93rpx;
  292. background: rgba(255, 255, 255, 1);
  293. box-shadow: 0px 10rpx 30rpx rgba(120, 223, 176, 0.22);
  294. border-radius: 50%;
  295. margin: 0 auto;
  296. }
  297. .btn-get {
  298. width: 250rpx;
  299. font-size: 17px;
  300. color: #c9cac9;
  301. position: relative;
  302. top: -290rpx;
  303. right: -450rpx;
  304. }
  305. .input-class {
  306. color: #D6D7D6;
  307. font-size: 17px;
  308. letter-spacing: 1rpx;
  309. }
  310. </style>