login.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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="login">
  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. if(uni.getStorageSync('ManageToken')){
  57. uni.navigateTo({
  58. url:'/pages_manage/index'
  59. })
  60. }
  61. console.log(this.$store.state.imgpath+'/app/images/card_icon.png')
  62. },
  63. methods: {
  64. login(){
  65. if (this.utils.isEmpty(this.account)) {
  66. uni.showToast({
  67. title: "请输入帐号",
  68. icon: 'none',
  69. });
  70. return
  71. }
  72. if (this.utils.isEmpty(this.password)) {
  73. uni.showToast({
  74. title: "请输入密码",
  75. icon: 'none',
  76. });
  77. return
  78. }
  79. var data = {
  80. account:this.account,
  81. password: this.password,
  82. appId:this.appid
  83. };
  84. var that=this;
  85. uni.showLoading({
  86. title:"处理中..."
  87. })
  88. login(data).then(
  89. res => {
  90. uni.hideLoading()
  91. if(res.code==200){
  92. uni.setStorageSync('ManageToken',res.data.token);
  93. uni.setStorageSync('companyUserId',res.data.user.userId);
  94. uni.setStorageSync('companyUserInfo',JSON.stringify(res.data.user));
  95. uni.$emit('initSocket');
  96. uni.reLaunch({
  97. // url: '../user/index',
  98. url: "/pages_manage/index",
  99. animationType: 'pop-in',
  100. animationDuration: 100
  101. })
  102. }
  103. else{
  104. uni.showToast({
  105. title: res.msg,
  106. icon: 'none'
  107. })
  108. }
  109. },
  110. rej => {}
  111. );
  112. }
  113. },
  114. }
  115. </script>
  116. <style lang="scss" scoped>
  117. page{
  118. background-color: #ffffff;
  119. }
  120. .footer-tips {
  121. margin-top: 14rpx;
  122. text-align: center;
  123. font-family: PingFang SC,PingFang SC;
  124. font-weight: 500;
  125. font-size: 12px;
  126. color: #bbb;
  127. }
  128. .content{
  129. background-color: #ffffff;
  130. display: flex;
  131. flex-direction: column;
  132. align-items: center;
  133. justify-content: center;
  134. // height: calc(100vh);
  135. overflow-y: auto;
  136. width: 100%;
  137. .login{
  138. width: 100%;
  139. padding-bottom: 50rpx;
  140. .head{
  141. text-align: center;
  142. image{
  143. padding: 20rpx;
  144. width: 120rpx;
  145. height: 120rpx;
  146. border-radius: 10rpx;
  147. box-shadow:0px 0px 20rpx rgba(0,0,0,0.2);
  148. }
  149. .title{
  150. color: #141414;
  151. margin:50upx 0upx 30upx 0rpx;
  152. font-size: 38rpx;
  153. font-weight: 500;
  154. }
  155. .desc{
  156. color: #686866;
  157. padding:0 0 30rpx 0rpx;
  158. font-size: 28rpx;
  159. }
  160. }
  161. .login{
  162. width: 100%;
  163. padding: 30rpx 50rpx;
  164. .login-item{
  165. margin-bottom: 30rpx;
  166. text-align: left;
  167. .input-account{
  168. margin-top: 20rpx;
  169. margin-bottom: 20rpx;
  170. border-radius:40rpx;
  171. border:solid 1rpx #e4e4e4;
  172. height: 80rpx;
  173. width: 100%;
  174. background:url('@/static/account.png') no-repeat 0 center;
  175. background-size: 30rpx 30rpx;
  176. background-position: 30rpx;
  177. input{
  178. margin-left: 80rpx;
  179. height: 80rpx;
  180. line-height: 80rpx
  181. }
  182. }
  183. .input-pwd{
  184. margin-top: 20rpx;
  185. margin-bottom: 20rpx;
  186. border-radius:40rpx;
  187. border:solid 1rpx #e4e4e4;
  188. height: 80rpx;
  189. width: 100%;
  190. background:url('@/static/password.png') no-repeat 0 center;
  191. background-size: 30rpx 30rpx;
  192. background-position: 30rpx;
  193. input{
  194. margin-left: 80rpx;
  195. height: 80rpx;
  196. line-height: 80rpx
  197. }
  198. }
  199. }
  200. .btns{
  201. margin: 60rpx 0rpx;
  202. .login-btn {
  203. display: flex;
  204. align-items: center;
  205. justify-content: center;
  206. width: 100%;
  207. height: 80rpx;
  208. // background: linear-gradient(to bottom, #cfe3ff, #cabbfd);
  209. background: #5c82ff;
  210. box-shadow: 0px 7rpx 6rpx 0px rgba(0, 0, 0, 0.2);
  211. border-radius: 40rpx;
  212. font-size: 30rpx;
  213. font-family: PingFang SC;
  214. font-weight: 500;
  215. color: rgba(255, 255, 255, 1.0);
  216. }
  217. }
  218. }
  219. }
  220. }
  221. .footer{
  222. color: #686866;
  223. width: 100%;
  224. position: sticky;
  225. text-align: center;
  226. bottom: 60upx;
  227. z-index: 1;
  228. font-size: 28rpx;
  229. }
  230. </style>