Cee Yang 3 lat temu
rodzic
commit
dc35544689
4 zmienionych plików z 64 dodań i 17 usunięć
  1. 12 0
      api/api.js
  2. 21 0
      api/environments.js
  3. 0 8
      main.js
  4. 31 9
      pages/login/index.vue

+ 12 - 0
api/api.js

@@ -0,0 +1,12 @@
+import Environments from "./environments.js"
+
+class Api {
+	
+	static defaultEnv = Environments.dev
+	
+	// var currentEnv = 
+	
+	static login = `${Api.defaultEnv.url}/api/v1/sso_v2/app_login`
+}
+
+export default Api

+ 21 - 0
api/environments.js

@@ -0,0 +1,21 @@
+/// 环境枚举
+const Environments = {
+	release: {
+	  index: 0,
+	  url: "https://api-eschool-slb.i2edu.net/api/v1"
+	},
+	test: {
+	  index: 1,
+	  url: "http://api-test-eschool-slb.i2edu.net:31103"
+	},
+  dev: {
+    index: 2,
+    url: "http://api-test-eschool-slb.i2edu.net:31103"
+  },
+	custom: {
+	  index: 3,
+	  url: ""
+	},
+}
+
+export default Environments

+ 0 - 8
main.js

@@ -8,14 +8,6 @@ import i18n from './i18n/index.js'
 
 
 Vue.component('cu-custom',cuCustom)
 Vue.component('cu-custom',cuCustom)
 Vue.use(uView)
 Vue.use(uView)
-// const i18n = new VueI18n({
-//     // locale: localStorage.getItem('lang') || 'zn',
-// 		locale: 'zh',
-//     messages: {
-//         'zh': require('./i18n/zh.js'), //自定义的中文文件
-//         'en': require('./i18n/en.js')  //自定义的英文文件
-//     }
-// })
 Vue.config.productionTip = false
 Vue.config.productionTip = false
 App.mpType = 'app'
 App.mpType = 'app'
 const app = new Vue({
 const app = new Vue({

+ 31 - 9
pages/login/index.vue

@@ -46,17 +46,18 @@
 </template>
 </template>
 
 
 <script>
 <script>
+	import Api from '../../api/api.js'
 	export default {
 	export default {
 		data() {
 		data() {
 			return {
 			return {
 				loading: false,
 				loading: false,
 				loginStr: '登录',
 				loginStr: '登录',
 				user: {
 				user: {
-					account: '',
-					password: '',
+					account: 'lishuming',
+					password: '12345',
 				},
 				},
 				animation: '',
 				animation: '',
-				aggred: false,
+				aggred: true,
 			}
 			}
 		},
 		},
 		methods: {
 		methods: {
@@ -78,13 +79,34 @@
 				})
 				})
 				
 				
 				this.loading = true
 				this.loading = true
-				setTimeout(() => {
-					this.loading = false
-					uni.navigateTo({
-						url:'../index/index'
-					})
-				}, 2.0*1000);
+				let _this = this
+				uni.request({
+					url: Api.login,
+				  data: this.user,
+				  method:"POST",
+				  header : {'content-type':'application/json'},
+				  success: function (res) {
+				    console.log(res.data);
+				  },
+					fail: (e) => {
+						console.log('fail')
+						console.log(e)
+					},
+					complete() {
+						console.log('complete')
+						_this.loading = false
+					}
+				});
+				
+				// setTimeout(() => {
+				// 	this.loading = false
+				// 	uni.navigateTo({
+				// 		url:'../index/index'
+				// 	})
+				// }, 2.0*1000);
 			},
 			},
+			
+			
 			changeToEnglish() {
 			changeToEnglish() {
 				let locale = this.$i18n.locale
 				let locale = this.$i18n.locale
 				locale === 'zh' ? this.$i18n.locale = 'en' : this.$i18n.locale = 'zh'
 				locale === 'zh' ? this.$i18n.locale = 'en' : this.$i18n.locale = 'zh'