Przeglądaj źródła

小程序修改

elis 1 rok temu
rodzic
commit
f6383681e2

+ 3 - 1
nnzwminiapp/app.json

@@ -129,5 +129,7 @@
         "scope.userLocation": {
             "desc": "我们将获取您的定位信息用于地点展示"
         }
-    }
+    },
+    "__usePrivacyCheck__": true
+    
 }

+ 1 - 1
nnzwminiapp/pages/api/canteen-request.js

@@ -69,7 +69,7 @@ function noNeedLogin(data) {
 function showDialog() {
   wx.showModal({
     title: '掌新南岸欢迎您!',
-    content: '使用完整服务需要登录!',
+    content: '登录,体验更完整!',
     confirmText: '登录',
     cancelText:"取消",
     success: function (res) {

+ 1 - 1
nnzwminiapp/pages/api/request.js

@@ -102,7 +102,7 @@ function noNeedLogin(data) {
 function showDialog() {
   wx.showModal({
     title: '掌新南岸欢迎您!',
-    content: '使用完整服务需要登录!',
+    content: '登录,体验更完整!',
     confirmText: '登录',
     cancelText:"取消",
     success: function (res) {

+ 1 - 1
nnzwminiapp/pages/doings/doings.js

@@ -77,7 +77,7 @@ Page({
                             if (result.msg == '请重新登录' && !result.result) {
                               wx.showModal({
                                 title: '掌新南岸欢迎您!',
-                                content: '使用完整服务需要登录!',
+                                content: '登录,体验更完整!',
                                 confirmText: '登录',
                                 cancelText:"取消",
                                 success: function (res) {

+ 1 - 1
nnzwminiapp/pages/index/index.json

@@ -5,6 +5,6 @@
 		"t-empty": "tdesign-miniprogram/empty/empty",
 		"t-icon": "tdesign-miniprogram/icon/icon"
 	},
-	"navigationBarTitleText": "首页",
+  "navigationBarTitleText": "首页",
 	"navigationStyle": "custom"
 }

+ 114 - 13
nnzwminiapp/pages/login/login.js

@@ -22,14 +22,33 @@ Page({
 		canIUse: wx.canIUse('button.open-type.getUserInfo'),
 		showLogin: false,
 		deda: 0,
-		loadText: "登录中...."
+    loadText: "登录中....",
+    showPrivacy:false
 	},
 
 	/**
 	 * 生命周期函数--监听页面加载
 	 */
 	onLoad(options) {
-
+    wx.getPrivacySetting({
+      success: res => {
+        console.log(res) // 返回结果为: res = { needAuthorization: true/false, privacyContractName: '《xxx隐私保护指引》' }
+        if (res.needAuthorization) {
+          // 需要弹出隐私协议
+          this.setData({
+            showPrivacy: true
+          })
+        } else {
+          // 用户已经同意过隐私协议,所以不需要再弹出隐私协议,也能调用已声明过的隐私接口
+          // wx.getUserProfile()
+          // wx.chooseMedia()
+          // wx.getClipboardData()
+          // wx.startRecord()
+        }
+      },
+      fail: () => {},
+      complete: () => {}
+    })
 	},
 
 	/**
@@ -77,19 +96,30 @@ Page({
 			})
 		}
 	},
-
+  handleAgreePrivacyAuthorization() {
+    // 用户同意隐私协议事件回调
+    // 用户点击了同意,之后所有已声明过的隐私接口和组件都可以调用了
+    this.setData({
+      showPrivacy: false
+    })
+  },
+  handleOpenPrivacyContract() {
+    // 打开隐私协议页面
+    wx.openPrivacyContract({
+      success: () => {}, // 打开成功
+      fail: () => {}, // 打开失败
+      complete: () => {}
+    })
+  },
 	getPhoneNumber(e) {
     var that = this
-    console.log(this.data.agree);
-	
-	
-      var phoneCode = e.detail.code
+
       wx.login({
         success(res) {
           if (res.code) {
             let data = {
               code: res.code,
-              phoneCode: phoneCode
+              phoneCode: "1"
             };
             let int = setInterval(function () {
               that.setData({
@@ -123,7 +153,7 @@ Page({
                 // wx.setStorageSync("token", res.data.token)
                 wx.setStorageSync('imgUrl', res.data.imgUrl)
                 wx.setStorageSync('nickName', res.data.nickName)
-                wx.setStorageSync('hlToken', res.data.hlToken)
+                // wx.setStorageSync('hlToken', res.data.hlToken)
                 wx.setStorageSync('userid', res.data.userId)
                 // 返回上一页携带登录标志
                 let pages = getCurrentPages();
@@ -157,14 +187,85 @@ Page({
 		
 		
 
-	},
+  },
+  // getPhoneNumber(e) {
+  //   var that = this
+  //   console.log(this.data.agree);
+  //     var phoneCode = e.detail.code
+  //     wx.login({
+  //       success(res) {
+  //         if (res.code) {
+  //           let data = {
+  //             code: res.code,
+  //             // phoneCode: phoneCode
+  //           };
+  //           let int = setInterval(function () {
+  //             that.setData({
+  //               deda: that.data.deda + 1
+  //             })
+  //             switch (that.data.deda) {
+  //               case 1:
+  //                 that.setData({
+  //                   loadText: "掌新南岸用户数据更新同步中...."
+  //                 })
+  //                 break
+  //               case 7:
+  //                 that.setData({
+  //                   loadText: "初始化静态资源中...."
+  //                 })
+  //                 break
+  //             }
+  //           }, 1000)
+  //           that.setData({
+  //             showLogin: true
+  //           })
+  //           login(data).then(res => {
+  //             that.setData({
+  //               showLogin: false,
+  //               deda: 0,
+  //               loadText: "登录中..."
+  //             })
+  //             clearInterval(int)
+  //             if (res.result) {
+  //               cacheSet('token', res.data.token, 3600 * 24)
+  //               // wx.setStorageSync("token", res.data.token)
+  //               wx.setStorageSync('imgUrl', res.data.imgUrl)
+  //               wx.setStorageSync('nickName', res.data.nickName)
+  //               wx.setStorageSync('hlToken', res.data.hlToken)
+  //               wx.setStorageSync('userid', res.data.userId)
+  //               // 返回上一页携带登录标志
+  //               let pages = getCurrentPages();
+  //               let prevPage = pages[pages.length - 2];
+  //               prevPage.setData({
+  //                 loginReturnFlag: true
+  //               })
+  //               wx.navigateBack({
+  //                 delta: 1
+  //               });
+  //             } else {
+  //               that.setData({
+  //                 showLogin: false
+  //               })
+  //               wx.showModal({
+  //                 title: '登录失败',
+  //                 content: '登录失败,请重试',
+  //                 complete: (res) => { }
+  //               })
+  //             }
+  //           })
+  //         } else {
+  //           console.log('登录失败!' + res.errMsg)
+  //         }
+  //       }
+  //     })
+	// },
 
 	protocolTips() {
     wx.showModal({
       title: '温馨提示',
-      content: '请仔细阅读并同意勾选用户服务协议!',
-      confirmText: '确定',
-      cancelText:"取消",
+      content: '请仔细阅读并勾选用户服务协议!',
+      confirmText: '同意',
+      cancelText:"不同意",
       success: function (res) {
       },
     });

+ 2 - 1
nnzwminiapp/pages/login/login.json

@@ -1,7 +1,8 @@
 {
   "navigationBarTitleText": "登录",
 	"usingComponents": {
-    "t-loading": "tdesign-miniprogram/loading/loading"
+    "t-loading": "tdesign-miniprogram/loading/loading",
+    "t-popup": "tdesign-miniprogram/popup/popup"
 	  },
   "navigationBarBackgroundColor": "#508FF4",
   "navigationBarTextStyle": "white"

+ 13 - 2
nnzwminiapp/pages/login/login.wxml

@@ -27,14 +27,25 @@
     </view>
   </view>
 
+  
+
   <view style="margin-top: 40rpx">
     <button wx:if="{{!agree}}"  type="primary" bindtap="protocolTips" style="width: 80%;display: flex;align-items:center;justify-content: center">
       <text style="padding-left: 15rpx;font-size:27rpx">一键登录</text>
     </button>
-
-    <button  wx:if="{{agree}}"  open-type="getPhoneNumber" type="primary" bindgetphonenumber="getPhoneNumber" style="width: 80%; display: flex; align-items:center;justify-content: center">
+<!-- open-type="getPhoneNumber" -->
+    <button  wx:if="{{agree}}"   type="primary" bindtap="getPhoneNumber" style="width: 80%; display: flex; align-items:center;justify-content: center">
       <text style="padding-left: 15rpx;font-size:27rpx">一键登录</text>
     </button> 
   </view>
+  <t-popup visible="{{showPrivacy}}"  placement="center">
+  <view class="ysbg">
+    <view class="yxtitle">微信用户隐私协议</view>
+    <view class="yscontent">本指引是掌新南岸小程序开发者 "重庆市南岸区人民政府"(以下简称“开发者”)为处理你的个人信息而制定。开发者处理的信息根据法律规定,开发者仅处理实现小程序功能所必要的信息。为了地图信息展示及地点导航,开发者将在获取你的明示同意后,收集你的位置信息。为了登录和注册,开发者将在获取你的明示同意后,收集你的手机号。开发者收集你选中的照片或视频信息,用于印象南岸图片投...</view>
+    <button bindtap="handleOpenPrivacyContract" class="ysbtn">查看完整隐私协议</button>
+    <button class="ysbtn" id="agree-btn" open-type="agreePrivacyAuthorization" bindagreeprivacyauthorization="handleAgreePrivacyAuthorization">同意</button>
+  </view>
+    
+</t-popup>
 
 </view>

+ 30 - 0
nnzwminiapp/pages/login/login.wxss

@@ -10,4 +10,34 @@
     color: #215bc9;
     font-size: 40rpx;
     font-weight: bold;
+}
+
+.ysbg{
+
+  background: #fff;
+  border-radius: 20rpx;
+}
+.yxtitle{
+  width: 600rpx;
+  height: 100rpx;
+  line-height: 100rpx;
+  text-align: center;
+  font-size: 32rpx;
+  
+}
+.yscontent{
+  border-top: 1rpx rgb(114, 114, 114) solid;
+  width: 600rpx;
+  padding: 10rpx;
+  line-height: 60rpx;
+}
+.ysbtn{
+    width: 350rpx;
+    margin-bottom: 10rpx;
+    background: rgb(74, 141, 241);
+    color: #fff;
+}
+.yszybtn{
+  background: rgb(114, 236, 230);
+  color: rgb(247, 134, 134);
 }

+ 1 - 1
nnzwminiapp/pages/ourCanteen/ourCanteen.js

@@ -167,7 +167,7 @@ Page({
 	showDialog() {
 		wx.showModal({
       title: '掌新南岸欢迎您!',
-      content: '使用完整服务需要登录!',
+      content: '登录,体验更完整!',
       confirmText: '登录',
       cancelText:"取消",
       success: function (res) {

+ 1 - 1
nnzwminiapp/pagesPublic/pages/api/request.js

@@ -69,7 +69,7 @@ function noNeedLogin(data) {
 function showDialog() {
   wx.showModal({
     title: '掌新南岸欢迎您!',
-    content: '使用完整服务需要登录!',
+    content: '登录,体验更完整!',
     confirmText: '登录',
     cancelText:"取消",
     success: function (res) {