index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  1. <!-- 用户-首页 -->
  2. <template>
  3. <view style="padding-bottom: 20upx;">
  4. <view class="top_box">
  5. <!-- 轮播图 -->
  6. <view class="swiper_box">
  7. <swiper circular style="height: 520upx;" class="swiper" autoplay>
  8. <swiper-item :key="index" v-for="(item, index) in banner_data">
  9. <view @click="banner_href(item)" class="swiper-item uni-bg-red">
  10. <image style="width:750upx;height: 520upx;" :src="serverUrl+item.slideshowImg"></image>
  11. </view>
  12. </swiper-item>
  13. </swiper>
  14. </view>
  15. <!-- 头部区域 -->
  16. <view style="position: absolute;top: 80upx;left: 0;">
  17. <image style="width: 260upx;height: 70upx;margin-left: 3%;" :src="serverUrlImg4"></image>
  18. <view class="main_width top_search">
  19. <navigator url="./city">
  20. <view class="pos_box">
  21. <image style="width: 20upx;height: 30upx;" src="../../static/position_index.png"></image>
  22. <view class="nowrap" style="color: #ffffff;margin-left: 12upx;width: 150upx;">
  23. {{currentSelectCity}}
  24. </view>
  25. </view>
  26. </navigator>
  27. <view class="search_box">
  28. <view class="search_box_in">
  29. <image style="width: 27upx;height: 26upx;margin-left: 20upx;"
  30. src="../../static/search_index.png">
  31. </image>
  32. <input @confirm="get_data()" @input="ipt_change" style="" placeholder="服务生" />
  33. </view>
  34. <view @click="get_data()" style="color: #FFFFFF;margin-right: 30upx;">搜索</view>
  35. </view>
  36. </view>
  37. </view>
  38. <!-- 中间头像区域 -->
  39. <view class="index_bot" :style="'background-image: url('+serverUrlImg3+');'">
  40. <view @click="to_order"
  41. style="color: #666666;display: flex;align-items: center;margin-right: 30upx;font-size: 24upx;margin-left: 15upx;">
  42. 已完成{{user_info.ss_finishedTotal||0}}次兼职任务<image
  43. style="width: 10upx;height: 22upx;margin-left: 15upx;margin-top: 2upx;"
  44. src="../../static/arrow_grey2.png"></image>
  45. </view>
  46. </view>
  47. <view style="position: absolute;left: 40upx;top: 410upx;display: flex;align-items: center;">
  48. <view @click="to_perInfo">
  49. <view
  50. style="box-shadow: 3px 3px 7px #c9c9c9;width: 100upx;height: 100upx;border: 4upx solid #ffffff;border-radius: 100upx;">
  51. <image style="width: 100upx;height: 100upx;border-radius: 50%;"
  52. :src="user_info.profile_photo||'../../static/user.png'"></image>
  53. </view>
  54. <view style="color: #333333;text-align: center;margin-top: 4upx;font-size: 24upx;max-width: 150upx;"
  55. class="nowrap">
  56. {{user_info.true_name?user_info.true_name:user_info.nickname?user_info.nickname:'会员名称'}}
  57. </view>
  58. </view>
  59. <view style="color: #5D5D5D;font-size: 28upx;margin-top: 70upx;margin-left: 20upx;">
  60. 越努力 越幸运</view>
  61. </view>
  62. </view>
  63. <!-- 切换【完工即结】和【今日零工】 -->
  64. <view style="margin-top: 30upx;height: 120upx;position: relative;">
  65. <image style="width: 100%;" mode="widthFix" :src="is_nowUrgent?serverUrl_tab_nav2:serverUrl_tab_nav1">
  66. </image>
  67. <view @click="change_is_nowUrgent(false)" class="serverUrl_tab_nav" style="left: 0;"></view>
  68. <view @click="change_is_nowUrgent(true)" class="serverUrl_tab_nav" style="right: 0;"></view>
  69. </view>
  70. <view :class="is_nowUrgent?'tab_nav_next2':'tab_nav_next1'">
  71. <!-- 数据筛选排序足迹tab栏 -->
  72. <view class="sort main_width">
  73. <view class="sort1 sort0" :style="'background-image: url('+serverUrlImg+');'" @click="open_modal"
  74. :data-type="0">筛选</view>
  75. <view class="sort2 sort0" :style="'background-image: url('+serverUrlImg+');'" @click="change_filter"
  76. :data-type="1">
  77. {{itemList[orderby]}}
  78. </view>
  79. <view class="sort3 sort0"
  80. :style="'background-size: 20upx 20upx;color:'+(traceMode==1?'#ff633a':'#1e2130')+';background-image: url('+(traceMode==1?serverUrlImg2_1: serverUrlImg2)+');'"
  81. @click="footprint">
  82. 足迹</view>
  83. </view>
  84. <!-- 主数据 -->
  85. <view class="loading_text" v-if="loading">加载中...</view>
  86. <view v-else>
  87. <view :key="index" v-for="(item, index) in data">
  88. <indexItem :index="index" type='index' :dataSource="item"></indexItem>
  89. </view>
  90. </view>
  91. <view class="loading_text" v-if="!loading&&data.length==0">暂无数据</view>
  92. </view>
  93. <view @click="toRecruit" style="width: 120upx;position: fixed;right: -10upx;bottom: 150upx;">
  94. <image style="width: 100%;" mode="widthFix" :src="serverUrl_release_index"></image>
  95. </view>
  96. <!-- 数据筛选模态层 -->
  97. <uni-popup ref="popup" :mask-click="true">
  98. <view style="width: 100%;background-color: #ffffff;">
  99. <view style="padding-top: 70upx;" class="filter_title">选择区域</view>
  100. <view class="filter_con">
  101. <view @click="change_district(index)"
  102. :class="district_index_arr.indexOf(index)!=-1?'dis_item dis_item_focus': 'dis_item'"
  103. :key="index" v-for="(item,index) in district">{{item}}</view>
  104. </view>
  105. <view style="clear: both;height: 30upx;"></view>
  106. <view class="filter_title"></view>
  107. <view class="filter_con">
  108. <view @click="change_settlement(index)" :key="index" v-for="(item,index) in settlement"
  109. :class="settlement_index==index?'dis_item dis_item_focus': 'dis_item'">{{item}}</view>
  110. </view>
  111. <view style="clear: both;height: 30upx;"></view>
  112. <view class="filter_title"></view>
  113. <view class="filter_con">
  114. <view @click="change_gender(index)" :key="index" v-for="(item,index) in gender"
  115. :class="gender_index==index?'dis_item dis_item_focus': 'dis_item'">
  116. {{item}}
  117. </view>
  118. </view>
  119. <view style="clear: both;height: 30upx;"></view>
  120. <view class="filter_btn_box">
  121. <view @click="reset_filter()" style="width: 30%;background-color: #f8f8f8;color: #808080;">重置</view>
  122. <view @click="confirm_filter()"
  123. style="width: 65%;margin-left: 5%;background-color: #39d9b5;color: #ffffff;">确定</view>
  124. </view>
  125. </view>
  126. </uni-popup>
  127. </view>
  128. </template>
  129. <script>
  130. import commonFun from '../../commonFun.js'
  131. import indexItem from '../order/indexItem.vue'
  132. export default {
  133. data() {
  134. return {
  135. is_nowUrgent: false, //是否为今日零工-当日急活儿
  136. serverUrl: this.serverUrlReq,
  137. serverUrl_tab_nav1: this.serverUrl + 'tab_nav1.png',
  138. serverUrl_tab_nav2: this.serverUrl + 'tab_nav2.png',
  139. serverUrlImg: this.serverUrl + 'index_arrow.png',
  140. serverUrlImg2: this.serverUrl + 'index_clock.png',
  141. serverUrlImg2_1: this.serverUrl + 'index_clock_orange.png',
  142. serverUrlImg3: this.serverUrl + 'index_bottom.png',
  143. serverUrlImg4: this.serverUrl + 'show/logo.png',
  144. serverUrl_release_index: this.serverUrl + 'release_index.png',
  145. itemList: ['最新发布', '离我最近', '薪资最高'], //排序方式数组
  146. orderby: 0, //排序方式索引
  147. key_words: '', //关键词
  148. loading: true, //加载中
  149. settlement_index: 0, //当前所选结算方式
  150. settlement: ['结算方式不限', '次结', '完工结'], //结算方式数组
  151. gender_index: 0, //当前所选性别
  152. gender: ['性别不限', '男生', '女生'], //性别要求数组
  153. district_index_arr: [], //当前所选区域
  154. currentSelectCity: '天津市', //当前选择城市名称
  155. district: ['和平区', '河东区', '河西区', '南开区', '河北区', '红桥区', '东丽区', '西青区', '津南区', '北辰区', '武清区', '宝坻区', '滨海新区',
  156. '宁河区', '静海区', '蓟州区'
  157. ], //区域
  158. traceMode: 0, //是否正在查看足迹
  159. banner_data: [], // 轮播数据
  160. data: [], // 招聘信息列表
  161. user_info: {
  162. profile_photo: '',
  163. true_name: '',
  164. }, //个人信息
  165. latitude: '39.0351862510659',
  166. longitude: '117.68898010253906',
  167. }
  168. },
  169. components: {
  170. indexItem
  171. },
  172. onShow() {},
  173. onPullDownRefresh() {
  174. this.get_data(this.get_banner(this.get_info()))
  175. },
  176. onLoad(e) {
  177. // 存在被分享的情况下执行
  178. if (e.scene) {
  179. console.log('onload获取分享参数', e.scene)
  180. const scene = decodeURIComponent(e.scene);
  181. var arry = scene.split(':');
  182. setTimeout(() => {
  183. uni.navigateTo({
  184. url: '/pages/order/detail?id=' + arry[1] + '&share=' + arry[2]
  185. })
  186. }, 1000)
  187. }
  188. this.get_position_index()
  189. },
  190. methods: {
  191. // 获取个人信息
  192. get_info() {
  193. commonFun.get_user_info(res => {
  194. if (res.status) {
  195. this.user_info = res.data.Result
  196. console.log('首页获取个人信息', this.user_info)
  197. commonFun.init_go_easy(this.user_info, 'user_')
  198. setTimeout(() => {
  199. commonFun.get_message_data()
  200. }, 2000)
  201. uni.setStorageSync('USER_INFO', this.user_info)
  202. }
  203. })
  204. },
  205. // 获取轮播图
  206. get_banner(callback = () => {}) {
  207. commonFun.requestUrl('&WsAjaxBiz=Public&WsAjaxAction=entityDataHandle', {
  208. bizCatalog: 'CyclePicShowEntity',
  209. handleMode: 'fetchall'
  210. }, res => {
  211. if (res.status) {
  212. this.banner_data = res.data.Result
  213. }
  214. callback()
  215. })
  216. },
  217. // 首页获取位置信息
  218. get_position_index(callback = () => {}) {
  219. let currentSelectCity = uni.getStorageSync('currentSelectCity') //获取缓存城市名称
  220. console.log('获取缓存城市名称', currentSelectCity)
  221. commonFun.getPositionLocal(res => {
  222. console.log('首页获取位置', res)
  223. if (res.status) {
  224. // 设置经纬度
  225. this.latitude = res.latitude
  226. this.longitude = res.longitude
  227. // 如果无存城市名称
  228. if (currentSelectCity == '') {
  229. this.currentSelectCity = res.city
  230. } else {
  231. this.currentSelectCity = currentSelectCity
  232. //当前选择城市名称对应的所有区县市
  233. const currentSelectDistrict = uni.getStorageSync('currentSelectDistrict') ? JSON.parse(
  234. uni
  235. .getStorageSync(
  236. 'currentSelectDistrict')) : []
  237. // 城市区县市数组
  238. let district = []
  239. for (let i in currentSelectDistrict) {
  240. district.push(currentSelectDistrict[i])
  241. }
  242. this.district = district
  243. }
  244. }
  245. this.get_data(this.get_banner(this.get_info()))
  246. })
  247. },
  248. // 获取主数据
  249. get_data(callback = () => {}) {
  250. this.loading = true
  251. uni.showLoading({
  252. title: '加载中...',
  253. mask: true
  254. })
  255. let params = {
  256. bizCatalog: 'RecruitEntity',
  257. handleMode: 'fetchall',
  258. pageIndex: 1,
  259. pageSize: 1000,
  260. orderby: this.traceMode == 1 ? 92 : this.orderby,
  261. nowLngLat: this.longitude + ',' + this.latitude,
  262. query: {
  263. nowUrgent: this.is_nowUrgent ? 1 : 2,
  264. title: this.key_words,
  265. traceMode: this.traceMode,
  266. settleType: this.settlement_index,
  267. genderMode: this.gender_index,
  268. workArea: this.district_index_arr.map((item, index) => this.district[item]),
  269. workCity: this.currentSelectCity,
  270. },
  271. }
  272. console.log('首页主数据请求参数', params)
  273. commonFun.requestUrl('&WsAjaxBiz=' + (this.traceMode == 1 ? 'Worker' : 'Public') +
  274. '&WsAjaxAction=fetchPageData', params, res => {
  275. if (res.status) {
  276. this.data = res.data.Result.pageData
  277. console.log('首页主数据获取', this.data)
  278. }
  279. this.loading = false
  280. uni.hideLoading()
  281. uni.stopPullDownRefresh()
  282. callback()
  283. })
  284. },
  285. // 轮播跳转
  286. banner_href(item) {
  287. if (item.catalog == 3) { //跳转到宣传图
  288. uni.navigateTo({
  289. url: '../login/web?index=12&id=' + item.id
  290. })
  291. } else if (item.catalog == 2) { //跳转到活动详情
  292. uni.navigateTo({
  293. url: '../activity/detail?id=' + item.biz_recruitid
  294. })
  295. } else {
  296. uni.navigateTo({ //跳转到招聘详情
  297. url: '../order/detail?id=' + item.biz_recruitid
  298. })
  299. }
  300. },
  301. // 跳转到商家小程序
  302. toRecruit() {
  303. uni.navigateToMiniProgram({
  304. appId: 'wx8c230ea00ceb8676',
  305. path: 'pages/merchant/index',
  306. })
  307. },
  308. // 切换是否今日零工
  309. change_is_nowUrgent(value) {
  310. this.is_nowUrgent = value
  311. this.get_data()
  312. },
  313. // 去我的工单
  314. to_order() {
  315. uni.navigateTo({
  316. url: this.user_info.id ? "/pages/order/index?status=3" : "/pages/login/index"
  317. })
  318. },
  319. // 去个人信息
  320. to_perInfo() {
  321. uni.navigateTo({
  322. url: this.user_info.id ? "../personal/perInfo" : "/pages/login/index"
  323. })
  324. },
  325. // 点击足迹
  326. footprint() {
  327. this.traceMode = this.traceMode == 0 ? 1 : 0
  328. this.get_data()
  329. },
  330. // 点击排序
  331. change_filter(e) {
  332. const type = e.currentTarget.dataset.type
  333. uni.showActionSheet({
  334. itemList: this.itemList,
  335. success: (res) => {
  336. this.orderby = res.tapIndex
  337. this.get_data()
  338. },
  339. fail: function(res) {}
  340. });
  341. },
  342. //输入招聘信息标题名称
  343. ipt_change(e) {
  344. this.key_words = e.target.value
  345. },
  346. // 确定筛选
  347. confirm_filter() {
  348. this.$refs.popup.close('top')
  349. this.get_data()
  350. },
  351. // 重置筛选
  352. reset_filter() {
  353. this.settlement_index = 0
  354. this.gender_index = 0
  355. this.district_index_arr = []
  356. this.$refs.popup.close('top')
  357. this.get_data()
  358. },
  359. // 筛选-区域选择
  360. change_district(index) {
  361. this.district_index_arr = commonFun.select_from_arr([this.district, this.district_index_arr], index)
  362. },
  363. // 筛选-结算方式选择
  364. change_settlement(index) {
  365. this.settlement_index = index
  366. },
  367. // 筛选-性别选择
  368. change_gender(index) {
  369. this.gender_index = index
  370. },
  371. // 点击筛选弹出遮罩
  372. open_modal() {
  373. this.$refs.popup.open('top')
  374. },
  375. }
  376. }
  377. </script>
  378. <style>
  379. @import url("index.css");
  380. </style>