login.2.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template>
  2. <view class="content">
  3. <view class="login-bg">
  4. <view class="login-card">
  5. <view class="uni-media-image">
  6. <image class="uni-media-loading" src="/static/theme/default/app.png" />
  7. </view>
  8. <view class="login-head">&nbsp;&nbsp;</view>
  9. <label class="uni-list-cell uni-list-cell-pd" >
  10. <label class="label-2-text" >
  11. <text>账号</text>
  12. </label>
  13. <view >
  14. <input type="text" class="uni-input" placeholder="趣聊号/手机号/邮箱" v-model="form.username" />
  15. </view>
  16. <view class="uni-icon uni-active"><text>&nbsp;&nbsp;</text></view>
  17. </label>
  18. <label class="uni-list-cell uni-list-cell-pd" >
  19. <label class="label-2-text" >
  20. <text>密码</text>
  21. </label>
  22. <view>
  23. <input class="uni-input" placeholder=" 请输入密码(6-16位)" :password="showPassword" v-model="form.password"/>
  24. </view>
  25. <view class="uni-icon uni-icon-eye" :class="[showPassword ? '' : 'uni-active']" @click="changePassword"></view>
  26. </label>
  27. </view>
  28. <view class="login-btn">
  29. <button class="landing" type="primary" @tap="subLongin">登 录</button>
  30. <!-- <view :class="['landing',checkIn ? 'landing_true' : 'landing_false']" @tap="subLongin">登 陆</view> -->
  31. </view>
  32. <view>
  33. <view class="login-function">
  34. <view class="login-forget" @click="go_forget"><text>&nbsp;&nbsp;</text>忘记密码</view>
  35. <view class="login-register" @click="go_register">快速注册<text>&nbsp;&nbsp;</text></view>
  36. </view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. export default {
  42. data() {
  43. return {
  44. showPassword: true,
  45. form: {
  46. username: '',
  47. password: '',
  48. }
  49. }
  50. },
  51. onLoad() {
  52. uni.getSystemInfo({
  53. success: function (res) {
  54. console.log("model:",res.model);
  55. console.log("pixelRatio:",res.pixelRatio);
  56. console.log("windowWidth:",res.windowWidth);
  57. console.log("windowHeight:",res.windowHeight);
  58. console.log("language:",res.language);
  59. console.log("version:",res.version);
  60. console.log("platform:",res.platform);
  61. }
  62. });
  63. },
  64. computed: {
  65. checkIn(){
  66. return this.form.password != '' && this.form.username != '' && this.form.password.length > 5;
  67. }
  68. },
  69. methods: {
  70. changePassword() {
  71. this.showPassword = !this.showPassword;
  72. },
  73. subLongin(){
  74. let _this = this;
  75. if(!_this.checkIn){
  76. return;
  77. }
  78. _this.$httpSend({
  79. path: '/im/in/login',
  80. data: _this.form,
  81. success: (data) => {
  82. try {
  83. uni.setStorageSync('token',data.token);
  84. }catch (e) {
  85. uni.showModal({
  86. content: '本地存储数据不可用!',
  87. });
  88. }
  89. uni.reLaunch({
  90. url: '../chat/index',
  91. });
  92. }
  93. });
  94. },
  95. go_forget(){
  96. uni.navigateTo({
  97. url: '../../pages/in/forget'
  98. })
  99. },
  100. go_register(){
  101. uni.navigateTo({
  102. url: '../../pages/in/reg'
  103. })
  104. }
  105. }
  106. }
  107. </script>
  108. <style>
  109. .uni-media-image{
  110. padding: 10upx 10upx;
  111. margin-top: 10upx;
  112. text-align: center;
  113. }
  114. .uni-media-loading {
  115. width:150upx;
  116. height:150upx;
  117. }
  118. .landing {
  119. height: 84upx;
  120. line-height: 84upx;
  121. color: #FFFFFF;
  122. font-size: 32upx;
  123. bordor: none;
  124. border-radius: 10upx;
  125. }
  126. .landing_true {
  127. background-color: #b2e281;
  128. }
  129. .landing_false {
  130. background-color: #d8d8d8;
  131. }
  132. .uni-button[type=primary] {
  133. background-color: #b2e281;
  134. }
  135. .login-btn{
  136. padding: 10upx 20upx;
  137. margin-top: 100upx;
  138. text-align: center;
  139. }
  140. .login-function{
  141. overflow: auto;
  142. margin-top: 0upx;
  143. padding: 40upx 50upx;
  144. }
  145. .login-forget{
  146. float: left;
  147. font-size: 26upx;
  148. color: #999;
  149. }
  150. .login-register{
  151. color: #666;
  152. float: right;
  153. font-size: 26upx;
  154. }
  155. .login-input input{
  156. background: #F2F5F6;
  157. font-size: 28upx;
  158. padding: 10upx 25upx;
  159. height: 62upx;
  160. line-height: 62upx;
  161. border-radius: 8upx;
  162. }
  163. .login-margin-b{
  164. margin-bottom: 25upx;
  165. }
  166. .login-input{
  167. padding: 20upx 20upx;
  168. }
  169. .login-head{
  170. font-size: 34upx;
  171. text-align: center;
  172. padding: 25upx 10upx 55upx 10upx;
  173. }
  174. .login-card{
  175. background: #fff;
  176. border-radius: 12upx;
  177. padding: 10upx 25upx;
  178. /* box-shadow: 0 6upx 18upx rgba(0,0,0,0.12); */
  179. position: relative;
  180. margin-top: 100upx;
  181. }
  182. .login-bg {
  183. /* height: 260upx;
  184. padding: 25upx;
  185. background: linear-gradient(#FF978D, #FFBB69); */
  186. }
  187. page {
  188. background-color: #FFFFFF;
  189. }
  190. .uni-form-item .with-fun .uni-icon {
  191. text-align: center;
  192. }
  193. </style>