login.vue 5.1 KB

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