login.vue 5.0 KB

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