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.

280 lines
5.6 KiB

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