302 satır
6.4 KiB

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