Browse Source

no message

yanjie 4 năm trước cách đây
mục cha
commit
ed2e8cba6b
4 tập tin đã thay đổi với 69 bổ sung3 xóa
  1. 1 1
      common/env.js
  2. 1 1
      pages.json
  3. 43 0
      pages/index/index.vue
  4. 24 1
      pages/login/login.vue

+ 1 - 1
common/env.js

xqd
@@ -1,3 +1,3 @@
-export const envHost = 'https://t5.9026.com'; //开发环境
+export const envHost = 'http://182.92.112.142/'; //开发环境
 // export const imgHost='https://www.juyinzhengxin.com/';
 export const imgHost = 'https://zhengda.oss-cn-chengdu.aliyuncs.com/juyin';

+ 1 - 1
pages.json

xqd
@@ -70,7 +70,7 @@
 		"list": [
 			{
 				"name": "test", //模式名称
-				"path": "pages/login/doctorRenzheng", //启动页面,必选
+				"path": "pages/login/login", //启动页面,必选
 				"query": "" //启动参数,在页面的onLoad函数里面得到
 			}
 		]

+ 43 - 0
pages/index/index.vue

xqd
@@ -134,7 +134,50 @@
 </template>
 
 <script>
+	import {
+		mapState,
+		mapMutations,
+		mapGetters,
+		mapActions
+	} from 'vuex';
+	export default {
+		computed: {
+			...mapGetters({
+				hasLogin: 'verifyJwt'
+			}),
+			...mapState(['user'])
+		},
+		data() {
+			return {
 
+			}
+		},
+		onShow() {
+			uni.showModal({
+				title: "提示",
+				content: "尚未登录,请前往登录",
+				confirmText: "去登录",
+				showCancel: false,
+				success() {
+					uni.login({
+						success(res) {
+							if (res.errMsg == "login:ok") {
+								uni.setStorageSync("code", res.code)
+								uni.navigateTo({
+									url: "../login/login"
+								})
+							}
+						}
+					})
+
+				}
+			})
+		},
+		mounted() {
+
+		},
+		methods: {}
+	}
 </script>
 
 <style scoped>

+ 24 - 1
pages/login/login.vue

xqd xqd
@@ -16,7 +16,7 @@
 
 			<wButton class="wbutton" text="登 录" :rotate="isRotate" @click.native="startReg()"></wButton>
 			<button style="margin-top: 20rpx;" :class="['buttonBorder',!istrue?'dlbutton':'dlbutton_loading']" open-type="getUserInfo"
-			 @getuserinfo="">
+			 @getuserinfo="getinfo">
 				<view :class="istrue?'rotate_loop':''">
 					<text v-if="istrue" class="cuIcon cuIcon-loading1 "></text>
 					<view v-if="!istrue">
@@ -146,6 +146,29 @@
 			},
 			ispwd() {
 				this.ispwdlogin = !this.ispwdlogin
+			},
+			getinfo: async function(e) {
+				let event = e
+				console.log(event)
+				let res = await this.$request.post("api/v2/common/wxLogin", {
+					wechat_code: uni.getStorageSync("code"),
+					nickname: event.detail.userInfo.nickName,
+					avatar: event.detail.userInfo.avatarUrl
+				})
+				console.log(event.detail.iv)
+				console.log(event.detail.encryptedData)
+				console.log(res.data.session_key)
+				console.log(res.data.openid)
+				// console.log(res)
+				// if (res.status == 0) {
+				// 	let data = await this.$request.post("api/v2/common/getPhoneNumber", {
+				// 		iv: event.detail.iv,
+				// 		encryptedData: event.detail.encryptedData,
+				// 		session_key: res.data.session_key,
+				// 		openid: res.data.openid
+				// 	})
+				// 	console.log(data)
+				// }
 			}
 		}
 	}