123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- // pages/my/postJob/detail.js
- var app = getApp();
- var util = require("../../utils/util.js")
- let wxparse = require("../../wxParse/wxParse.js");
- let pageid = ""
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- bottomLeft: app.bottomLeft,
- appAssetsUrl: app.appAssetsUrl,
- vipid: util.getUserId(),
- detail: {},
- workContent: '',
- vipMsg: '',
- arrayPrice: [],
- heightList: [],
- priceUnit: null,
- heightUnit: null,
- sex: null
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- this.setData({
- detail: wx.getStorageSync('workDetail'),
- user: wx.getStorageSync('USER')
- })
- // this.ready()
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- //获得popup组件
- this.popup = this.selectComponent("#popup0");
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- this.getUnit()
- this.getHeightList()
- this.sex()
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {},
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- showShareMenu: function () {},
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {},
- // 预览图片
- previewImage(e) {
- wx.previewImage({
- urls: e.currentTarget.dataset.images,
- current: e.currentTarget.dataset.images[e.currentTarget.dataset.index]
- })
- },
- getUnit() {
- app._post_form('bizlibrary/infoList/workUnit', '', {}, res => {
- if (res.code === 0) {
- let priceUnit
- for (let i = 0; i < res.dictList.length; i++) {
- if (res.dictList[i].itemcode == this.data.detail.unit) {
- priceUnit = res.dictList[i].itemname
- break
- }
- }
- this.setData({
- priceUnit: priceUnit,
- arrayPrice: res.dictList
- })
- }
- })
- },
- getHeightList() {
- app._post_form('bizlibrary/infoList/workHeightLimit', '', {}, res => {
- if (res.code === 0) {
- let heightUnit
- for (let i = 0; i < res.dictList.length; i++) {
- if (res.dictList[i].itemcode == this.data.detail.unit) {
- heightUnit = res.dictList[i].itemname
- break
- }
- }
- this.setData({
- heightUnit: heightUnit,
- heightList: res.dictList
- })
- }
- })
- },
- sex() {
- console.log(app.sexList, 111)
- let sex
- for (let i = 0; i < app.sexList.length; i++) {
- if (app.sexList[i].itemcode == this.data.detail.sexlimit) {
- sex = app.sexList[i].itemname
- break
- }
- }
- this.setData({
- sex: sex,
- })
- },
- submit() {
- app._post_form('work/saveWork', '', this.data.detail, res => {
- if (res.code === 0) {
- wx.showToast({
- title: '添加成功',
- })
- wx.removeStorageSync('workDetail')
- wx.switchTab({
- url: '/pages/home/index/index',
- })
- }
- }, err => {}, complete => {
- setTimeout(() => {
- wx.hideLoading()
- }, 300)
- })
- },
- // 查看二维码
- seeCode() {
- this.popup.showPopup();
- },
- // 查看地图
- goLocal() {
- let that = this
- let [latitude, longitude] = [this.data.detail.coordinate.split(',')[0], this.data.detail.coordinate.split(',')[1]]
- console.log(Number(latitude), Number(longitude))
- wx.openLocation({
- latitude: Number(longitude),
- longitude: Number(latitude),
- name: that.data.detail.title,
- address: that.data.detail.address,
- success: function () {
- console.log("success");
- },
- });
- },
- // 会员必读
- ready() {
- let _this = this;
- app._post_form('wgfillinfo/apiSelectwgfillinfo', 'application/json',
- null,
- function (res) {
- if (res.code === 0) {
- // _this.setData({
- // vipMsg: res.wgFillInfo.vipMessage
- // })
- wxparse.wxParse('vipMsg', 'html', res.wgFillInfo.vipMessage, _this, 0);
- }
- }
- )
- },
- //取消事件
- _error(e) {
- this.popup.hidePopup();
- },
- //确认事件
- _success(e) {
- this.popup.hidePopup();
- },
- onUnload: function () {
- clearInterval(this.data.timer)
- }
- })
|