You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

299 lines
6.1 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. <!-- 登录页面 -->
  2. <template>
  3. <view class="login bx">
  4. <div class="language">
  5. <image @click="showSelectLanguageProp" src="@/static/login/language.png" mode="aspectFit"></image>
  6. </div>
  7. <!-- 背景图片 -->
  8. <view class="logo-box">
  9. <image class="logo content" :src="image" mode="widthFix"></image>
  10. </view>
  11. <!-- 加载效果 -->
  12. <loading :loading="loading" @close="closeLoading"></loading>
  13. <view v-if="!loading" class="main">
  14. <!-- 登录标题 -->
  15. <view class="login-title">
  16. <view class="title">{{ $t('page.login.title') }}</view>
  17. <view class="shop-desc">{{ $t('page.login.please-enter') }}</view>
  18. </view>
  19. <!-- 输入框列表 -->
  20. <view class="input-list">
  21. <input v-model="form.account" type="text" :placeholder="$t('page.login.phone-placeholder')" />
  22. <input v-model="form.pass" type="password" :placeholder="$t('page.login.password-placeholder')" />
  23. </view>
  24. <!-- 按钮组 -->
  25. <view class="btns">
  26. <view @click="Login" class="now-login-btn content">{{ $t('page.login.title') }}</view>
  27. <view class="now-login-btn content">
  28. <text @click="toRegister">{{ $t('page.login.register-now') }}</text>
  29. </view>
  30. </view>
  31. <view @click="revealServiceList" class="forget-password content">Forget the password?</view>
  32. </view>
  33. <!-- 切换语言 -->
  34. <changeLanguage :show.sync="showSelectLanguage" @close="closeSelectLanguageProp"></changeLanguage>
  35. <!-- 客服列表 -->
  36. <serviceList :show="showService" :serverList="serverList" @close="closeServiceList"></serviceList>
  37. <!-- 初始页面 -->
  38. <!-- <pageInit></pageInit> -->
  39. </view>
  40. </template>
  41. <script>
  42. import changeLanguage from '../../components/changeLanguage/changeLanguage.vue';
  43. import serviceList from '@/components/serviceList/serviceList.vue';
  44. import pageInit from '@/components/pageInit/pageInit.vue'
  45. import loading from '@/components/pageInit/loading.vue'
  46. export default {
  47. components: {
  48. changeLanguage,
  49. serviceList,
  50. pageInit,
  51. loading
  52. },
  53. data() {
  54. return {
  55. form: {
  56. account: '',
  57. pass: '',
  58. loginIp: ''
  59. },
  60. showSelectLanguage: false,
  61. showService: false,
  62. serverList: [],
  63. loading: false,
  64. image : '',///static/login/logo.png
  65. }
  66. },
  67. created() {
  68. this.getImage()
  69. },
  70. methods: {
  71. //登录
  72. Login() {
  73. this.$play()
  74. let _self = this;
  75. let {
  76. account,
  77. pass
  78. } = this.form
  79. if (account.trim() == '') {
  80. return uni.showToast({
  81. title: this.$t('page.login.accountEmpty'),
  82. icon: 'none'
  83. });
  84. }
  85. if (pass.trim() == '') {
  86. return uni.showToast({
  87. title: this.$t('page.login.passEmpty'),
  88. icon: 'none'
  89. });
  90. }
  91. return uni.request({
  92. url: 'https://api.ipify.org?format=json',
  93. success: function(res) {
  94. _self.form.loginIp = res.data.ip;
  95. _self.request('login', {}, _self.form).then(res => {
  96. if (res.code == 200) {
  97. localStorage.setItem("userInfo", JSON.stringify(res.result.userInfo))
  98. localStorage.setItem("token", res.result.token)
  99. uni.removeStorageSync('clickPopUp'); //删除此key会登录成功后首页会显示弹框
  100. uni.navigateTo({
  101. url: '/pages/home/home'
  102. })
  103. }
  104. })
  105. }
  106. });
  107. },
  108. getImage(){
  109. this.request('getImage').then(res => {
  110. if(res.code == 200){
  111. this.image = res.result.title
  112. }
  113. })
  114. },
  115. //跳转注册页面
  116. toRegister() {
  117. this.$play()
  118. uni.navigateTo({
  119. url: '/pages/register/register'
  120. })
  121. },
  122. //显示选择语言弹框
  123. showSelectLanguageProp() {
  124. this.$play()
  125. this.showSelectLanguage = true
  126. },
  127. //关闭语言选择弹框
  128. closeSelectLanguageProp() {
  129. this.showSelectLanguage = false
  130. },
  131. //显示客服列表
  132. revealServiceList() {
  133. this.$play()
  134. this.showService = true;
  135. },
  136. //关闭客服列表
  137. closeServiceList() {
  138. this.showService = false;
  139. },
  140. //关闭加载效果
  141. closeLoading() {
  142. this.loading = false;
  143. },
  144. //忘记密码
  145. forgetPass() {
  146. this.request('forgetPass').then(res => {
  147. if (res.code == 200) {
  148. this.serverList = res.result
  149. this.revealServiceList()
  150. }
  151. })
  152. }
  153. }
  154. }
  155. </script>
  156. <style lang="scss" scoped>
  157. .login {
  158. width: 750rpx;
  159. height: 100vh;
  160. margin: 0px auto;
  161. background: linear-gradient(to bottom, #fcedff 0%, #ffffff 100%);
  162. background-size: 100%;
  163. background-repeat: no-repeat;
  164. box-sizing: border-box;
  165. .content {
  166. width: 96%;
  167. margin: 0rpx auto;
  168. }
  169. .language {
  170. display: flex;
  171. justify-content: flex-end;
  172. align-items: center;
  173. height: 160rpx;
  174. image {
  175. width: 60rpx;
  176. height: 60rpx;
  177. }
  178. }
  179. .logo-box {
  180. display: flex;
  181. align-items: center;
  182. justify-content: center;
  183. margin-bottom: 40rpx;
  184. .logo {
  185. border-radius: 10rpx;
  186. }
  187. }
  188. .login-title {
  189. padding: 0rpx 10rpx;
  190. box-sizing: border-box;
  191. text-align: center;
  192. .title {
  193. font-size: 60rpx;
  194. color: $uni-bg-color-app;
  195. margin-bottom: 10rpx;
  196. font-weight: bold;
  197. }
  198. .shop-desc {
  199. font-size: 28rpx;
  200. color: #333;
  201. margin-bottom: 20rpx;
  202. font-weight: bold;
  203. }
  204. }
  205. .input-list {
  206. padding: 0rpx 10rpx;
  207. box-sizing: border-box;
  208. margin: 40rpx 0rpx;
  209. input {
  210. display: block;
  211. width: 90%;
  212. margin: 0rpx auto;
  213. color: $uni-bg-color-app;
  214. border: 1px solid #eeeeee;
  215. height: 80rpx;
  216. border-radius: 40rpx;
  217. background: #fff;
  218. margin-bottom: 20rpx;
  219. text-align: center;
  220. text-indent: 1em;
  221. padding: 0rpx 15rpx;
  222. &:focus {
  223. border-color: #6d00be !important;
  224. background: pink !important;
  225. }
  226. }
  227. }
  228. .btns {
  229. padding: 0rpx 10rpx;
  230. margin-top: 40rpx;
  231. color: $uni-bg-color;
  232. .now-login-btn {
  233. background: $uni-bg-color-app;
  234. border-radius: 60rpx;
  235. display: flex;
  236. align-items: center;
  237. justify-content: center;
  238. margin-bottom: 20rpx;
  239. font-weight: bold;
  240. height: 90rpx;
  241. font-size: 40rpx;
  242. }
  243. .now-register-btn {
  244. display: flex;
  245. justify-content: center;
  246. align-items: center;
  247. color: $uni-bg-color-app;
  248. }
  249. }
  250. .forget-password{
  251. color: red;
  252. font-weight: bold;
  253. box-sizing: border-box;
  254. padding-left: 20rpx;
  255. }
  256. }
  257. </style>