login.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <view class="column" style="height: 100vh;">
  3. <view class="content flex-1" >
  4. <view class="login pt14">
  5. <view class="head">
  6. <image :src="imgPath+'/app/image/logo.png'" ></image>
  7. <p class="title">销售管理端</p>
  8. <p class="desc">客户沟通更智能</p>
  9. </view>
  10. <view class="logins">
  11. <view class="login-item">
  12. <!-- <text>帐号</text> -->
  13. <view class="input-account">
  14. <input v-model="account"
  15. placeholder="请输入帐号/手机号" type="text" ></input>
  16. </view>
  17. </view>
  18. <view class="login-item">
  19. <!-- <text>密码</text> -->
  20. <view class="input-pwd">
  21. <input v-model="password"
  22. placeholder="请输入密码" password type="text"></input>
  23. </view>
  24. </view>
  25. <view class="btns">
  26. <view class="login-btn" @click="login">登录</view>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. <!-- <view class="footer-tips">重庆云联融智提供技术支持</view> -->
  32. </view>
  33. </template>
  34. <script>
  35. import { login } from '@/api/manageCompany.js'
  36. export default {
  37. data() {
  38. return {
  39. account:"",
  40. password:"",
  41. }
  42. },
  43. computed: {
  44. imgPath() {
  45. return this.$store.state.imgpath
  46. },
  47. appid() {
  48. return this.$store.state.appid
  49. },
  50. },
  51. onLoad(option) {
  52. },
  53. mounted() {
  54. },
  55. onShow() {
  56. console.log(this.$store.state.imgpath+'/app/images/card_icon.png')
  57. },
  58. methods: {
  59. login(){
  60. if (this.utils.isEmpty(this.account)) {
  61. uni.showToast({
  62. title: "请输入帐号",
  63. icon: 'none',
  64. });
  65. return
  66. }
  67. if (this.utils.isEmpty(this.password)) {
  68. uni.showToast({
  69. title: "请输入密码",
  70. icon: 'none',
  71. });
  72. return
  73. }
  74. var data = {
  75. account:this.account,
  76. password: this.password,
  77. appId:this.appid
  78. };
  79. var that=this;
  80. uni.showLoading({
  81. title:"处理中..."
  82. })
  83. login(data).then(
  84. res => {
  85. uni.hideLoading()
  86. if(res.code==200){
  87. uni.setStorageSync('ManageToken',res.data.token);
  88. uni.setStorageSync('companyUserId',res.data.user.userId);
  89. uni.setStorageSync('companyUserInfo',JSON.stringify(res.data.user));
  90. uni.$emit('initSocket');
  91. uni.reLaunch({
  92. // url: '../user/index',
  93. url: "/pages_manage/index",
  94. animationType: 'pop-in',
  95. animationDuration: 100
  96. })
  97. }
  98. else{
  99. uni.showToast({
  100. title: res.msg,
  101. icon: 'none'
  102. })
  103. }
  104. },
  105. rej => {}
  106. );
  107. }
  108. },
  109. }
  110. </script>
  111. <style lang="scss" scoped>
  112. page{
  113. background-color: #ffffff;
  114. }
  115. .footer-tips {
  116. margin-top: 14rpx;
  117. text-align: center;
  118. font-family: PingFang SC,PingFang SC;
  119. font-weight: 500;
  120. font-size: 12px;
  121. color: #bbb;
  122. }
  123. .content{
  124. background-color: #ffffff;
  125. display: flex;
  126. flex-direction: column;
  127. align-items: center;
  128. justify-content: center;
  129. // height: calc(100vh);
  130. overflow-y: auto;
  131. width: 100%;
  132. .login{
  133. width: 100%;
  134. padding-bottom: 50rpx;
  135. .head{
  136. text-align: center;
  137. image{
  138. padding: 20rpx;
  139. width: 120rpx;
  140. height: 120rpx;
  141. border-radius: 10rpx;
  142. box-shadow:0px 0px 20rpx rgba(0,0,0,0.2);
  143. }
  144. .title{
  145. color: #141414;
  146. margin:50upx 0upx 30upx 0rpx;
  147. font-size: 38rpx;
  148. font-weight: 500;
  149. }
  150. .desc{
  151. color: #686866;
  152. padding:0 0 30rpx 0rpx;
  153. font-size: 28rpx;
  154. }
  155. }
  156. .logins{
  157. // width: 100%;
  158. padding: 30rpx 50rpx;
  159. .login-item{
  160. margin-bottom: 30rpx;
  161. text-align: left;
  162. .input-account{
  163. margin-top: 20rpx;
  164. margin-bottom: 20rpx;
  165. border-radius:40rpx;
  166. border:solid 1rpx #e4e4e4;
  167. height: 80rpx;
  168. width: 100%;
  169. background:url('@/static/account.png') no-repeat 0 center;
  170. background-size: 30rpx 30rpx;
  171. background-position: 30rpx;
  172. input{
  173. margin-left: 80rpx;
  174. height: 80rpx;
  175. line-height: 80rpx
  176. }
  177. }
  178. .input-pwd{
  179. margin-top: 20rpx;
  180. margin-bottom: 20rpx;
  181. border-radius:40rpx;
  182. border:solid 1rpx #e4e4e4;
  183. height: 80rpx;
  184. width: 100%;
  185. background:url('@/static/password.png') no-repeat 0 center;
  186. background-size: 30rpx 30rpx;
  187. background-position: 30rpx;
  188. input{
  189. margin-left: 80rpx;
  190. height: 80rpx;
  191. line-height: 80rpx
  192. }
  193. }
  194. }
  195. .btns{
  196. margin: 60rpx 0rpx;
  197. .login-btn {
  198. display: flex;
  199. align-items: center;
  200. justify-content: center;
  201. width: 100%;
  202. height: 80rpx;
  203. // background: linear-gradient(to bottom, #cfe3ff, #cabbfd);
  204. background: #5c82ff;
  205. box-shadow: 0px 7rpx 6rpx 0px rgba(0, 0, 0, 0.2);
  206. border-radius: 40rpx;
  207. font-size: 30rpx;
  208. font-family: PingFang SC;
  209. font-weight: 500;
  210. color: rgba(255, 255, 255, 1.0);
  211. }
  212. }
  213. }
  214. }
  215. }
  216. .footer{
  217. color: #686866;
  218. width: 100%;
  219. position: sticky;
  220. text-align: center;
  221. bottom: 60upx;
  222. z-index: 1;
  223. font-size: 28rpx;
  224. }
  225. </style>