wangxin před 2 roky
rodič
revize
2991f5357d

+ 1 - 0
app.json

@@ -1,4 +1,5 @@
 {
+  "__usePrivacyCheck__": true,
   "permission": {
     "scope.userLocation": {
       "desc": "您的位置信息将用于获取当地职位列表、打卡等功能"

+ 86 - 0
components/privacy-popup/privacy-popup.js

@@ -0,0 +1,86 @@
+// component/privacy-popup/privacy-popup.ts
+Component({
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+    initCheck: {
+      type: Boolean,
+      value: false
+    }
+  },
+  observers: {
+    show: function (value) {
+      if (!this.properties.initCheck) {
+        if (value) {
+          wx.hideTabBar()
+        } else {
+          wx.showTabBar()
+        }
+      }
+    }
+  },
+  pageLifetimes: {
+    show() {
+      if (this.properties.initCheck) {
+        this.check()
+      }
+    }
+  },
+  /**
+   * 组件的初始数据
+   */
+  data: {
+    show: false,
+    needAuthorization: false,
+    privacyContractName: ''
+  },
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    check() {
+      if (wx.canIUse('getPrivacySetting')) {
+        wx.getPrivacySetting({
+          success: res => {
+            console.log(res)
+            this.setData({
+              ...res,
+              show: res.needAuthorization
+            })
+            if (!res.needAuthorization) {
+              this.privacySubmit()
+            }
+          }
+        })
+      } else {
+        this.privacySubmit()
+      }
+    },
+    handleAgreePrivacyAuthorization() {
+      this.privacySubmit(true)
+    },
+    privacySubmit(status = false) {
+      this.triggerEvent('privacySubmit', {
+        status
+      })
+      this.hidden()
+    },
+    hidden() {
+      this.setData({
+        show: false
+      })
+    },
+    cancel() {
+      this.triggerEvent('cancel')
+      this.hidden()
+    },
+    openPrivacyContract() {
+      wx.openPrivacyContract({
+        success() {
+          console.log('打开隐私协议')
+        }
+      })
+    }
+  }
+})

+ 4 - 0
components/privacy-popup/privacy-popup.json

@@ -0,0 +1,4 @@
+{
+	"component": true,
+	"usingComponents": {}
+}

+ 24 - 0
components/privacy-popup/privacy-popup.wxml

@@ -0,0 +1,24 @@
+<!--component/privacy-popup/privacy-popup.wxml-->
+<view class="privacy-container" wx:if="{{show}}" bind:tap="hidden">
+  <view class="privacy-content" catchtap>
+    <view class="privacy-title">用户隐私保护提示</view>
+    <view class="content">
+      感谢您使用本产品,您使用本产品前应当阅读并同意
+      <text class="name" style="color: blue" catchtap="openPrivacyContract">{{ privacyContractName }}</text>
+      当您点击同意并开始时用本产品服务时,即表示你已理解并同意该条款内容,该条款将对您产生法律约束力。如您拒绝,将无法使用本产品。
+    </view>
+    <view class="button-container">
+          <view class="button cancel" catchtap="cancel">取消</view>
+          <view class="button">
+            确定
+            <button
+              class="btn"
+              open-type="agreePrivacyAuthorization"
+              bindagreeprivacyauthorization="handleAgreePrivacyAuthorization"
+            >同意
+            </button>
+          </view>
+        </view>
+  </view>
+</view>
+<slot bind:tap="check"></slot>

+ 74 - 0
components/privacy-popup/privacy-popup.wxss

@@ -0,0 +1,74 @@
+/* component/privacy-popup/privacy-popup.wxss */
+.privacy-container {
+  height: 100vh;
+  width: 100vw;
+  background: rgba(0, 0, 0, 0.6);
+  position: fixed;
+  left: 0;
+  top: 0;
+  z-index: 999;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+
+.privacy-content {
+  width: 640rpx;
+  font-size: 32rpx;
+  font-family: PingFang SC-Bold, PingFang SC;
+  color: #333333;
+  text-align: center;
+  padding: 40rpx;
+  box-sizing: border-box;
+  background: #FFFFFF;
+  border-radius: 16rpx 16rpx 16rpx 16rpx;
+}
+
+.privacy-title {
+  font-weight: bolder;
+}
+
+.content {
+  padding: 40rpx 0;
+  box-sizing: border-box;
+  text-indent: 64rpx;
+}
+
+.button-container {
+  display: flex;
+  align-items: center;
+  justify-content: space-around;
+}
+
+.button {
+  flex: 1;
+  height: 64rpx;
+  max-width: 326rpx;
+  font-size: 32rpx;
+  font-family: PingFang SC-Medium, PingFang SC;
+  font-weight: 500;
+  color: #FFFFFF;
+  background: #1890ff;
+  border-radius: 62rpx 62rpx 62rpx 62rpx;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  position: relative;
+}
+
+.btn {
+  height: 100%;
+  width: 100%;
+  position: absolute;
+  left: 0;
+  top: 0;
+  opacity: 0;
+}
+
+.button+.button {
+  margin-left: 48rpx;
+}
+
+.cancel {
+  background: #E6E6E6;
+}

+ 39 - 33
pages/index/index.js

@@ -5,34 +5,34 @@ import {
 import {
   imgServerUrl
 } from '../../config/config.js'
-
+const app = getApp()
 Page({
   data: {
     //banner图
     imgList: [],
     activity: [{
-      src: imgServerUrl + "/images/happyjob/quanzhi.png",
-      text: "全职工作"
-    },
-    {
-      src: imgServerUrl + "/images/happyjob/jianzhi.png",
-      text: "兼职工作"
-    },
-    {
-      src: imgServerUrl + "/images/happyjob/fanxian.png",
-      text: "入职奖励"
-    },
-    {
-      src: imgServerUrl + "/images/happyjob/jipin.png",
-      text: "高薪急聘"
-    }
+        src: imgServerUrl + "/images/happyjob/quanzhi.png",
+        text: "全职工作"
+      },
+      {
+        src: imgServerUrl + "/images/happyjob/jianzhi.png",
+        text: "兼职工作"
+      },
+      {
+        src: imgServerUrl + "/images/happyjob/fanxian.png",
+        text: "入职奖励"
+      },
+      {
+        src: imgServerUrl + "/images/happyjob/jipin.png",
+        text: "高薪急聘"
+      }
     ],
     activity_two: [{
-      src: imgServerUrl + "/images/happyjob/fuli.png"
-    },
-    {
-      src: imgServerUrl + "/images/happyjob/quanmin.png"
-    }
+        src: imgServerUrl + "/images/happyjob/fuli.png"
+      },
+      {
+        src: imgServerUrl + "/images/happyjob/quanmin.png"
+      }
     ],
     cityCode: '',
     keyWord: '',
@@ -79,18 +79,18 @@ Page({
     this.fetchList();
   },
   onShow: function () {
-		if (wx.getStorageSync('city') !== this.data.cityName) {
-			this.setData({
-				cityName: wx.getStorageSync('city') || '无锡',
-				cityCode: wx.getStorageSync('cityCode') || '320200',
-				pageNo: 1, //当前分页
-				isScroll: true, //是否可以滚动
-				filter: -1, //岗位类型
-				list: [],
-			}, _ => {
-				this.start();
-			})
-		}
+    if (wx.getStorageSync('city') !== this.data.cityName) {
+      this.setData({
+        cityName: wx.getStorageSync('city') || '无锡',
+        cityCode: wx.getStorageSync('cityCode') || '320200',
+        pageNo: 1, //当前分页
+        isScroll: true, //是否可以滚动
+        filter: -1, //岗位类型
+        list: [],
+      }, _ => {
+        this.start();
+      })
+    }
   },
   //下拉刷新
   onPullDownRefresh: function () {
@@ -279,5 +279,11 @@ Page({
         wx.setStorageSync('disclaimer', true)
       }
     })
+  },
+  privacySubmit(e) {
+    console.log('privacySubmit', e)
+    if (e.detail.status) {
+      app.init()
+    }
   }
 })

+ 2 - 1
pages/index/index.json

@@ -2,7 +2,8 @@
   "usingComponents": {
     "i-tag": "../../ui/tag/index",
     "kefu": "../../components/kefu/kefu",
-    "list": "../../components/position/position"
+    "list": "../../components/position/position",
+    "privacy-popup": "/components/privacy-popup/privacy-popup"
   },
   "navigationBarTextStyle": "white",
   "navigationBarBackgroundColor": "#0177FF",

+ 61 - 60
pages/index/index.wxml

@@ -2,22 +2,22 @@
 <wxs src="./index.wxs" module="Tools"></wxs>
 
 <view class='app-header'>
-	<view class='map' bindtap='toCity'>
-		<text class='cityname'>{{cityName}}</text>
-		<view class='location'>
-			<image src='/images/happyjob/index_position.png'></image>
-		</view>
-		<!-- <i-icon class="arrow-down" type="play_fill" /> -->
-	</view>
-	<view class='search' bindtap='toSearch'>
-		<view class="search-content">
-			<view class='i_search'>
-				<image src='/images/happyjob/search.png'></image>
-			</view>
-			<text class='search-input'>搜索你想要的好岗位</text>
-		</view>
-		<!-- <view class="btn-search"><text>搜索</text></view> -->
-	</view>
+  <view class='map' bindtap='toCity'>
+    <text class='cityname'>{{cityName}}</text>
+    <view class='location'>
+      <image src='/images/happyjob/index_position.png'></image>
+    </view>
+    <!-- <i-icon class="arrow-down" type="play_fill" /> -->
+  </view>
+  <view class='search' bindtap='toSearch'>
+    <view class="search-content">
+      <view class='i_search'>
+        <image src='/images/happyjob/search.png'></image>
+      </view>
+      <text class='search-input'>搜索你想要的好岗位</text>
+    </view>
+    <!-- <view class="btn-search"><text>搜索</text></view> -->
+  </view>
 </view>
 <!-- 轮播 -->
 <!-- <view class="swiper">
@@ -31,71 +31,72 @@
 </view> -->
 <!-- 滚动 -->
 <view class='marquee'>
-	<view class='broadcast'>
-		<image src='/images/happyjob/index_hot.png'></image>
-		<text>开心头条:</text>
-	</view>
-	<!-- 跑马灯 暂未调好速度问题 -->
-	<!-- <view class='swip'>
+  <view class='broadcast'>
+    <image src='/images/happyjob/index_hot.png'></image>
+    <text>开心头条:</text>
+  </view>
+  <!-- 跑马灯 暂未调好速度问题 -->
+  <!-- <view class='swip'>
     <marquee text="{{broadcastText}}"></marquee>
   </view> -->
-	<swiper class='swip' autoplay="true" interval="4000" duration="600" circular="true" vertical="true">
-		<block wx:for="{{broadcastList}}" wx:key="bo">
-			<swiper-item>
-				<view>{{item}}</view>
-			</swiper-item>
-		</block>
-	</swiper>
+  <swiper class='swip' autoplay="true" interval="4000" duration="600" circular="true" vertical="true">
+    <block wx:for="{{broadcastList}}" wx:key="bo">
+      <swiper-item>
+        <view>{{item}}</view>
+      </swiper-item>
+    </block>
+  </swiper>
 </view>
 
 <!-- 岗位 -->
 <view class="activity-box">
-	<view class="activity">
-		<block wx:for="{{activity}}" wx:key="text">
-			<view class="activity-item" bindtap='changeList' data-index="{{index}}" hover-class="none">
-				<image src="{{item.src}}" mode="scaleToFill"></image>
-				<text>{{item.text}}</text>
-			</view>
-		</block>
-	</view>
+  <view class="activity">
+    <block wx:for="{{activity}}" wx:key="text">
+      <privacy-popup class="activity-item" bind:privacySubmit='changeList' data-index="{{index}}" hover-class="none">
+        <image src="{{item.src}}" mode="scaleToFill"></image>
+        <text>{{item.text}}</text>
+      </privacy-popup>
+    </block>
+  </view>
 </view>
 <!-- 岗位2 -->
 <view class="activity-box2">
-	<view class="activity2">
-		<block wx:for="{{activity_two}}" wx:key="text">
-			<view class="activity-item2" bindtap='changeList2' data-index="{{index}}" hover-class="none">
-				<image src="{{item.src}}" mode="scaleToFill"></image>
-			</view>
-		</block>
-	</view>
+  <view class="activity2">
+    <block wx:for="{{activity_two}}" wx:key="text">
+      <view class="activity-item2" bindtap='changeList2' data-index="{{index}}" hover-class="none">
+        <image src="{{item.src}}" mode="scaleToFill"></image>
+      </view>
+    </block>
+  </view>
 </view>
 
 <!-- 热门岗位 -->
 <view class='box-body safe_area'>
-	<view class='box_title'>为您推荐:</view>
-	<list list='{{list}}' isScroll='{{isScroll}}' showNoMore='{{showNoMore}}' bind:action='toDetail' />
+  <view class='box_title'>为您推荐:</view>
+  <list list='{{list}}' isScroll='{{isScroll}}' showNoMore='{{showNoMore}}' bind:action='toDetail' />
 </view>
 <!-- <view class="loading_no" hidden='{{isScroll}}'>{{showNoMore}}</view> -->
 <!-- 客服 -->
 <kefu />
 <!-- 公众号组件 -->
 <view class='office'>
-	<official-account></official-account>
+  <official-account></official-account>
 </view>
 <view class="no_data" wx:if='{{!list.length&&offline}}'>
-	<image src="/images/happyjob/index_offline.png"></image>
-	<view class="no_text">
-		<text>无网络连接</text>
-		<text class="text">请在地球有信号的地方使用</text>
-	</view>
-	<view class="reload" bindtap="reload">刷新试试</view>
+  <image src="/images/happyjob/index_offline.png"></image>
+  <view class="no_text">
+    <text>无网络连接</text>
+    <text class="text">请在地球有信号的地方使用</text>
+  </view>
+  <view class="reload" bindtap="reload">刷新试试</view>
 </view>
 
 <view class="disclaimer" wx:if='{{disclaimer}}'>
-	<image class="disclaimer-image" src="{{imgServerUrl}}/images/happyjob/disclaimer.png"></image>
-	<view class="disclaimer-button-content">
-		<view class="disclaimer-button" bindtap="knowDisclaimer">
-			<text>我已知晓,进入开心工作</text>
-		</view>
-	</view>
-</view>
+  <image class="disclaimer-image" src="{{imgServerUrl}}/images/happyjob/disclaimer.png"></image>
+  <view class="disclaimer-button-content">
+    <view class="disclaimer-button" bindtap="knowDisclaimer">
+      <text>我已知晓,进入开心工作</text>
+    </view>
+  </view>
+</view>
+<privacy-popup initCheck bind:privacySubmit='privacySubmit'> </privacy-popup>

+ 5 - 1
pages/login/login.js

@@ -167,6 +167,10 @@ Page({
         disabled: false
       })
     }, 1000)
+  },
+  cancel(){
+    wx.switchTab({
+      url: '/pages/index/index',
+    })
   }
-
 })

+ 2 - 1
pages/login/login.json

@@ -1,6 +1,7 @@
 {
   "usingComponents": {
-    "phone-input": "../../components/phone-input/phone-input"
+    "phone-input": "../../components/phone-input/phone-input",
+    "privacy-popup": "/components/privacy-popup/privacy-popup"
   },
   "navigationBarTitleText": "登录"
 }

+ 2 - 1
pages/login/login.wxml

@@ -13,4 +13,5 @@
 		微信授权
 	</button>
 
-</view>
+</view>
+<privacy-popup initCheck bind:cancel="cancel"></privacy-popup>

+ 18 - 21
project.config.json

@@ -1,18 +1,5 @@
 {
 	"description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
-	"packOptions": {
-		"ignore": [
-			{
-				"value": ".less",
-				"type": "suffix"
-			},
-			{
-				"value": ".css",
-				"type": "suffix"
-			}
-		],
-		"include": []
-	},
 	"setting": {
 		"urlCheck": true,
 		"es6": true,
@@ -26,14 +13,12 @@
 		"autoAudits": true,
 		"showShadowRootInWxmlPanel": true,
 		"scopeDataCheck": false,
-		"uglifyFileName": false,
+		"uglifyFileName": true,
 		"checkInvalidKey": true,
 		"checkSiteMap": true,
 		"uploadWithSourceMap": true,
 		"compileHotReLoad": false,
 		"useMultiFrameRuntime": true,
-		"useApiHook": true,
-		"useApiHostProcess": true,
 		"babelSetting": {
 			"ignore": [],
 			"disablePlugins": [],
@@ -51,12 +36,10 @@
 		"minifyWXML": true,
 		"lazyloadPlaceholderEnable": false,
 		"useStaticServer": true,
-		"ignoreUploadUnusedFiles": true
+		"ignoreUploadUnusedFiles": true,
+		"condition": true
 	},
 	"compileType": "miniprogram",
-	"libVersion": "2.11.2",
-	"appid": "wx1e8ed93850777ffb",
-	"projectname": "kaixin",
 	"simulatorType": "wechat",
 	"simulatorPluginLibVersion": {},
 	"condition": {
@@ -374,5 +357,19 @@
 	"editorSetting": {
 		"tabIndent": "tab",
 		"tabSize": 2
-	}
+	},
+	"packOptions": {
+		"ignore": [
+			{
+				"value": ".less",
+				"type": "suffix"
+			},
+			{
+				"value": ".css",
+				"type": "suffix"
+			}
+		],
+		"include": []
+	},
+	"appid": "wx1e8ed93850777ffb"
 }

+ 1 - 1
project.private.config.json

@@ -330,5 +330,5 @@
 	},
 	"projectname": "Mina",
 	"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
-	"libVersion": "2.16.1"
+	"libVersion": "3.0.1"
 }