Forráskód Böngészése

处理授权逻辑

306132416@qq.com 4 éve%!(EXTRA string=óta)
szülő
commit
c955f0cfff
3 módosított fájl, 58 hozzáadás és 35 törlés
  1. 11 6
      pages/auth/index.vue
  2. 13 14
      pages/index/index.vue
  3. 34 15
      pages/policy/policy_deatil.vue

+ 11 - 6
pages/auth/index.vue

@@ -24,15 +24,15 @@
 			return {
 				iv:'',
 				encryptedData:'',
-				isNeedPhone:Boolean,
-			    isAuth:Boolean
+				isNeedPhone:getApp().globalData.user_phone,
+			    isAuth:getApp().globalData.isAuth
 			}
 		},
 		onLoad() {
-			this.getUserInfo() 
+			this.getUserInfoData() 
 		},
 		methods:{
-			getUserInfo(){
+			getUserInfoData(){
 				let md5Sign = md5("method="+'user'+"&timestamp="+getApp().globalData.globalTimestamp+"&secret="+getApp().globalData.secret)
 				let url = getApp().globalData.shareUrl+'api/api.php'+'?method=user&action=info_by_openid&timestamp='+getApp().globalData.globalTimestamp +'&sign='+md5Sign
 				uni.request({
@@ -47,9 +47,12 @@
 					success: (res) => {
 						if(res.data.code === 200){
 								if(res.data.data.nickname){
+									getApp().globalData.isAuth = true;
+									getApp().globalData.user_phone = false;
 									this.isAuth = true;
 									this.isNeedPhone = false;
 								}else{
+									getApp().globalData.isAuth = false;
 									this.isAuth = false;
 								}
 						}
@@ -116,8 +119,10 @@
 					success: (res) => {
 						console.log(res)
 						if(res.data.code === 200){
-							getApp().globalData.user_phone = res.data.phoneNumber;
-							that.refuseBtn();
+							getApp().globalData.user_phone = res.data.data;
+							setTimeout(()=>{
+								that.refuseBtn();
+							},300)
 						}
 					},
 					fail: () => {

+ 13 - 14
pages/index/index.vue

@@ -379,18 +379,18 @@ export default {
         // },
       ],
       attractList: [
-        // {
-        //   url: "/static/attract/1.png",
-        //   title: "工业互联网",
-        //   subtitle: "工业互联网是全球工业系统与高级计算、分析、...",
-        //   time: "2021-09-05",
-        // },
-        // {
-        //   url: "/static/attract/2.png",
-        //   title: "生产性服务业",
-        //   subtitle: "生产性服务业是指为保持工业生产过程的连续性...",
-        //   time: "2021-09-05",
-        // },
+        {
+          url: "/static/attract/1.png",
+          title: "工业互联网",
+          subtitle: "工业互联网是全球工业系统与高级计算、分析、...",
+          time: "2021-09-05",
+        },
+        {
+          url: "/static/attract/2.png",
+          title: "生产性服务业",
+          subtitle: "生产性服务业是指为保持工业生产过程的连续性...",
+          time: "2021-09-05",
+        },
       ],
       activityList: [
         {
@@ -421,8 +421,7 @@ export default {
     this.getSwiperList();
     this.getPark();
     this.getNotice();
-    this.getAttract();
-    //   this.loginLoad();
+    //this.getAttract(); //招商接口
   },
   onShareAppMessage() {
     url: "/pages/index/index";

+ 34 - 15
pages/policy/policy_deatil.vue

@@ -33,18 +33,15 @@
           </p>
           <p class="table-item">
             <span>申报状态:</span>
-            <span
-              >剩
+            <span>剩
               {{
-                new Date(
+                Math.floor(new Date(
                   new Date(infoObj.project_end_date).getTime() -
-                    new Date(infoObj.project_start_date).getTime()
+                    new Date().getTime()
                 ).getTime() /
-                  (1 * 24 * 60 * 60 * 1000) +
-                1
+                  (1 * 24 * 60 * 60 * 1000)) + 1
               }}
-              天</span
-            >
+              天</span>
           </p>
         </div>
       </div>
@@ -207,7 +204,14 @@ export default {
     let id = option.id;
     this.getDetailInfo(id);
   },
+  onShow() {
+  },
   methods: {
+	goAuthPage(){
+		uni.navigateTo({
+			url:'../auth/index'
+		})
+	},
     getDetailInfo(ids) {
       let md5Sign = md5(
         "method=" +
@@ -330,6 +334,10 @@ export default {
       });
     },
     collectionPage() {
+	if(!getApp().globalData.user_phone){
+				this.goAuthPage();
+				return
+	   }
       let md5Sign = md5(
         "method=" +
           "user" +
@@ -415,13 +423,24 @@ export default {
     },
     sharePage() {
       let that = this;
-      uni.showShareMenu({
-        title: that.infoObj.title,
-        path: "pages/policy/policy_detail?id=" + that.infoObj.id,
-        success(res) {
-          that.shareRequest();
-        },
-      });
+	  uni.showShareMenu({
+	    title: that.infoObj.title,
+	    path: "pages/policy/policy_detail?id=" + that.infoObj.id,
+	    success(res) {
+	      that.shareRequest();
+	    },
+	  });
+	  // if(!getApp().globalData.user_phone){
+	  // 			that.goAuthPage();
+	  // 		}else {
+			// 	// uni.showShareMenu({
+			// 	//   title: that.infoObj.title,
+			// 	//   path: "pages/policy/policy_detail?id=" + that.infoObj.id,
+			// 	//   success(res) {
+			// 	//     that.shareRequest();
+			// 	//   },
+			// 	// });
+			// }
     },
     changeScroll(height) {
       //点的时候触发这个函数 height 是之前的高度