diff --git a/App.vue b/App.vue index e7d157f..9d3e00f 100644 --- a/App.vue +++ b/App.vue @@ -16,11 +16,7 @@ export default { onLaunch: function(options) { this.$store.dispatch('InitArea') - if (options.query.token) { - uni.reLaunch({ - url: '/pages/login/blank?token=' + options.query.token - }) - } else if (this.$store.state.user.token) { + if (this.$store.state.user.token) { this.$store.dispatch('startRefreshTokenTimer') this.$store.dispatch('startRefreshNewsTimer') this.$store.dispatch('refreshAuthState') diff --git a/components/companyList/applyList.vue b/components/companyList/applyList.vue index 32b97d2..6df46a4 100644 --- a/components/companyList/applyList.vue +++ b/components/companyList/applyList.vue @@ -1,230 +1,254 @@ - - - - - \ No newline at end of file diff --git a/components/companyList/collectionList.vue b/components/companyList/collectionList.vue index ea2e6e4..48357b8 100644 --- a/components/companyList/collectionList.vue +++ b/components/companyList/collectionList.vue @@ -1,244 +1,268 @@ - - - - - \ No newline at end of file diff --git a/components/uMapView/uMapView.vue b/components/uMapView/uMapView.vue index 4410e73..c6336a7 100644 --- a/components/uMapView/uMapView.vue +++ b/components/uMapView/uMapView.vue @@ -5,46 +5,6 @@ \ No newline at end of file diff --git a/components/uMapView/uMapViewcopy.vue b/components/uMapView/uMapViewcopy.vue new file mode 100644 index 0000000..4410e73 --- /dev/null +++ b/components/uMapView/uMapViewcopy.vue @@ -0,0 +1,410 @@ + + + + + \ No newline at end of file diff --git a/config.js b/config.js index 604a21e..204c55a 100644 --- a/config.js +++ b/config.js @@ -3,7 +3,7 @@ module.exports = { // 图片地址 imageUrl: '', // 天地图tk - apiKey: 'e4266a5e84fe6c10f60c559967f0a03f', + apiKey: 'aa9b92683ff22363aa17baa16599cff8', // 显示标题 showTitle: false, // map 1、黑色模块 2、白色模块 diff --git a/main.js b/main.js index a7b2196..b690daf 100644 --- a/main.js +++ b/main.js @@ -16,6 +16,10 @@ import { import empty from '@/components/empty/empty.vue' +function haslogin() { + return !!store.state.user.token +} + function navTo(url, needLogin) { console.log(url) if (needLogin) { @@ -46,11 +50,12 @@ Vue.component('jl-button', JlButton) Vue.component('jl-form', JlForm) Vue.component('jl-form-item', JlFormItem) Vue.component('cs-button', CSButton) -Vue.component('super-map', superMapView) +// Vue.component('super-map', superMapView) Vue.component('empty', empty) Vue.prototype.$api = { msg, - sleep + sleep, + haslogin } Vue.prototype.tools = tools Vue.prototype.$config = config diff --git a/manifest.json b/manifest.json index 70d7780..eb8d4d8 100644 --- a/manifest.json +++ b/manifest.json @@ -65,11 +65,7 @@ }, "h5": { "sdkConfigs": { - "maps": { - "qqmap": { - "key": "FW3BZ-6JTK6-GCUS5-MZCRR-3GPR5-HJFEI" - } - } + "maps": {} }, "template": "index.html", "router": { diff --git a/pageMy/myProject/myCollection.vue b/pageMy/myProject/myCollection.vue index c761745..4217cfa 100644 --- a/pageMy/myProject/myCollection.vue +++ b/pageMy/myProject/myCollection.vue @@ -1,153 +1,158 @@ - - - - - + + + + + \ No newline at end of file diff --git a/pageMy/myProject/myProject.vue b/pageMy/myProject/myProject.vue index e3f787a..5d37e52 100644 --- a/pageMy/myProject/myProject.vue +++ b/pageMy/myProject/myProject.vue @@ -1,153 +1,158 @@ - - - - - + + + + + \ No newline at end of file diff --git a/pages/login/login.vue b/pages/login/login.vue index d844c69..f6ebafe 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -12,10 +12,10 @@ 立即登录 立即登录 - + + 手机注册 + 忘记密码 + @@ -74,8 +74,8 @@ }, login(e) { if (this.validate) { - this.userChecked = true; - console.log(this.userChecked) + // this.userChecked = true; + // console.log(this.userChecked) // if (!this.userChecked) { // uni.showToast({ // title:'请先阅读并同意《服务及隐私协议》', @@ -169,4 +169,15 @@ } /* #endif */ + .changeLogintype { + margin: 0 auto; + font-family: PingFangSC-Regular; + font-size: 14px; + color: #1B66FF; + margin-top: 15px; + display: flex; + align-items: center; + justify-content: space-between; + + } \ No newline at end of file diff --git a/pages/login/template.vue b/pages/login/template.vue index 95b9c31..762fd74 100644 --- a/pages/login/template.vue +++ b/pages/login/template.vue @@ -1,106 +1,113 @@ - - - - - + + + + + \ No newline at end of file diff --git a/pages/mapSeach/mapSeach.vue b/pages/mapSeach/mapSeach.vue index f06e685..4110adc 100644 --- a/pages/mapSeach/mapSeach.vue +++ b/pages/mapSeach/mapSeach.vue @@ -133,7 +133,7 @@ getLocation: function() { var that = this; uni.getLocation({ - type: 'gcj02', + type: 'wgs84', success: function(res) { //初始化当前点 var point = { diff --git a/pages/project/map.vue b/pages/project/map.vue index 879058d..7e90da2 100644 --- a/pages/project/map.vue +++ b/pages/project/map.vue @@ -1,404 +1,417 @@ - - - - - \ No newline at end of file + + + + + diff --git a/pages/project/newProject.vue b/pages/project/newProject.vue index da2bb84..0d9c7e1 100644 --- a/pages/project/newProject.vue +++ b/pages/project/newProject.vue @@ -31,7 +31,7 @@ - + @@ -51,7 +51,7 @@ - + @@ -109,7 +109,9 @@ getcoder } from "@/api/map.js"; import verticalMenu from '@/components/vertical-menu/vertical-menu.vue'; - + import { + mapGetters + } from 'vuex' export default { components: { vTabs, @@ -117,15 +119,16 @@ verticalMenu, workList }, - + computed: { + ...mapGetters(['userLocation']), + }, data() { return { policyContentList: [], - activeTab: 0, + activeTab: '0', companyList: [], recommendList: [], newList: [], - nearPage: { current: 1, size: 10, @@ -142,10 +145,7 @@ total: 0 }, currentAddress: '', - currentPoint: { - latitude: 0, - longitude: 0 - }, + key: 'FW3BZ-6JTK6-GCUS5-MZCRR-3GPR5-HJFEI', open: false, showPopUp: false, @@ -157,10 +157,11 @@ if (option.tabIndex) { this.activeTab = option.tabIndex } - this.getData() - this.getPolicy() + this.$store.dispatch('getUserLocation') + this.download() }, onShow: function() { + const enumTitle = { "0": '最新零工岗位', "1": '最新全职岗位', @@ -169,7 +170,7 @@ uni.setNavigationBarTitle({ title: enumTitle[this.activeTab] }) - if (this.$store.state.user.token) { + if (this.$api.haslogin()) { this.$store.dispatch('refreshAuthState').then((e) => { var auth = this.$store.state.auth if (!auth.bankCardState) { @@ -177,7 +178,6 @@ } }) } - const value = uni.getStorageSync('active'); if (value) { this.activeTab = value; @@ -190,13 +190,7 @@ }, /*下拉刷新*/ onPullDownRefresh: function() { - if (!this.$store.state.user.token) { - uni.redirectTo({ - url: "/pages/login/login" - }); - } else { - this.download(); - } + this.download(); }, methods: { step() { @@ -228,30 +222,6 @@ url: '/pageMy/my/resume/addSkill' }) }, - /*定位*/ - getLocation: function() { - var that = this; - uni.getLocation({ - type: 'gcj02', - success: function(res) { - that.currentPoint = { - latitude: res.latitude, - longitude: res.longitude - } - // that.getAddrByPoint(res); - that.getNearList(that.currentPoint) - }, - complete: function(e) {} - }); - }, - /*逆地址解析*/ - getAddrByPoint: function(point) { - var that = this; - var location = point.latitude + ',' + point.longitude - getcoder(location, encodeURI(that.key), 0).then(res => { - that.currentAddress = res.data.result.address - }); - }, goSeach: function() { uni.navigateTo({ url: '../seach/seach' @@ -271,8 +241,8 @@ this.activeTab = e; }, //附近任务; - getNearList: function(point) { - nearMission(this.nearPage.current, this.nearPage.size).then(res => { + getNearList: function() { + nearMission(this.nearPage.current, this.nearPage.size, 1).then(res => { if (this.nearPage.current === 1) { this.companyList = []; } @@ -313,7 +283,7 @@ }, //最新任务; getNewList: function() { - newMissionAll(this.newPage.current, this.newPage.size, '').then(res => { + newMissionAll(this.newPage.current, this.newPage.size, '', 1).then(res => { if (this.newPage.current === 1) { this.newList = []; } @@ -326,32 +296,31 @@ }, //上拉加载 upLoad: function() { - if (this.activeTab === 0) { - if (this.nearPage.current <= Math.ceil(this.nearPage.total / this.nearPage.size)) { - this.getNearList(this.currentPoint); - } else { - uni.showToast({ - icon: "none", - title: '已经是最后一页', - }) - } - return - } - if (this.activeTab === 1) { - if (this.recommendPage.current <= Math.ceil(this.recommendPage.total / this.recommendPage - .size)) { - this.getRecommendList(); - } else { - uni.showToast({ - icon: "none", - title: '已经是最后一页', - }) - } - return - } - if (this.activeTab === 2) { + if (this.activeTab === '0') { if (this.newPage.current <= Math.ceil(this.newPage.total / this.newPage.size)) { - this.getNewList(); + this.getNewList() + } else { + uni.showToast({ + icon: "none", + title: '已经是最后一页', + }) + } + return + } + if (this.activeTab === '1') { + if (this.nearPage.current <= Math.ceil(this.nearPage.total / this.nearPage.size)) { + this.getNearList(); + } else { + uni.showToast({ + icon: "none", + title: '已经是最后一页', + }) + } + return + } + if (this.activeTab === '2') { + if (this.newPage.current <= Math.ceil(this.newPage.total / this.newPage.size)) { + this.getPolicy(); } else { uni.showToast({ icon: "none", @@ -365,25 +334,24 @@ download: function() { console.log(this.activeTab) if (this.activeTab === '0') { - this.nearPage.current = 1; - console.log('123123') - this.getLocation(); + this.newPage.current = 1; + this.getNewList(); setTimeout(function() { uni.stopPullDownRefresh(); }, 1000); return } if (this.activeTab === '1') { - this.recommendPage.current = 1; - this.getRecommendList(); + this.nearPage.current = 1; + this.getNearList(); setTimeout(function() { uni.stopPullDownRefresh(); }, 1000); return } if (this.activeTab === '2') { - this.newPage.current = 1; - this.getNewList(); + // this.newPage.current = 1; + this.getPolicy(); setTimeout(function() { uni.stopPullDownRefresh(); }, 1000); @@ -391,20 +359,13 @@ } }, getData: function() { - if (!this.$store.state.user.token) { - uni.redirectTo({ - url: "/pages/login/login" - }); - } else { - uni.$emit('newsReadChange'); - this.nearPage.current = 1; - this.recommendPage.current = 1; - this.newPage.current = 1; - this.getLocation(); - this.getRecommendList(); - this.getNewList(); - this.getNearList(); - } + uni.$emit('newsReadChange'); + this.nearPage.current = 1; + this.recommendPage.current = 1; + this.newPage.current = 1; + this.getRecommendList(); + this.getNewList(); + this.getNearList(); }, @@ -442,7 +403,8 @@ .content { background-color: #f3f4f8; padding-top: 20rpx; - min-height: 80vh; + /* min-height: 80vh; */ + min-height: calc(100vh - var(--window-top) - var(--status-bar-height) - var(--window-bottom)); } diff --git a/pages/project/project copy.vue b/pages/project/project copy.vue index 004cb9e..3e3bbab 100644 --- a/pages/project/project copy.vue +++ b/pages/project/project copy.vue @@ -1,741 +1,741 @@ - - - - - \ No newline at end of file diff --git a/pages/project/project.vue b/pages/project/project.vue index 601ba51..8d64523 100644 --- a/pages/project/project.vue +++ b/pages/project/project.vue @@ -1,763 +1,726 @@ - - - - - \ No newline at end of file + + + + + diff --git a/pages/projectInfo/projectInfo.vue b/pages/projectInfo/projectInfo.vue index d7064f1..c7d422e 100644 --- a/pages/projectInfo/projectInfo.vue +++ b/pages/projectInfo/projectInfo.vue @@ -101,9 +101,10 @@ 工作地址:{{info.address || '暂无'}} - + :flag-tip="false"> --> + @@ -324,6 +325,8 @@ detail(self.missionNo).then(res => { self.info = res.data.data; self.status = res.data.data.detailStatus; + this.$refs.tMap.open(self.info.lon, self.info.lat) + // AddressToLocation({ // smart_address: res.data.data.address // }).then((result) => { @@ -337,13 +340,18 @@ // self.longitude = self.info.lon; // self.covers[0].latitude = self.info.lat; // self.covers[0].longitude = self.info.lon; - if (!(self.info.lat && self.info.lat === -1)) { - self.$refs.uMap.initMap({ - lat: self.info.lat, - lon: self.info.lon, + if (self.info.lon > 1 && self.info.lat > 1) { + self.$nextTick(() => { + self.$api.sleep(500).then(() => { + this.$refs.tMap.addFeature([{ + id: self.info.id, + label: self.info.missionTitle, + lat: self.info.lat, + lon: self.info.lon, + }]) + }) }) } - self.showDetail = true; self.getCollectStatus(); if (self.type === 1) { diff --git a/pages/projectInfo/userrecruitInfo.vue b/pages/projectInfo/userrecruitInfo.vue index a0536e1..f6116d6 100644 --- a/pages/projectInfo/userrecruitInfo.vue +++ b/pages/projectInfo/userrecruitInfo.vue @@ -105,9 +105,10 @@ - + :flag-tip="false"> --> + @@ -332,14 +333,21 @@ self.info = resData.data.data; self.status = resData.data.data.status; self.missionNo = resData.data.data.missionNo; - self.latitude = self.info.lat; - self.longitude = self.info.lon; - self.covers[0].latitude = self.info.lat; - self.covers[0].longitude = self.info.lon; - if (!(self.info.lat && self.info.lat === -1)) { - self.$refs.uMap.initMap({ - lat: self.info.lat, - lon: self.info.lon, + // self.latitude = self.info.lat; + // self.longitude = self.info.lon; + // self.covers[0].latitude = self.info.lat; + // self.covers[0].longitude = self.info.lon; + this.$refs.tMap.open(self.info.lon, self.info.lat) + if (self.info.lon > 1 && self.info.lat > 1) { + this.$nextTick(() => { + self.$api.sleep(1000).then(() => { + this.$refs.tMap.addFeature([{ + id: self.info.id, + label: self.info.jobName, + lat: self.info.lat, + lon: self.info.lon, + }]) + }) }) } // this.$refs.cMap.open() diff --git a/pages/projectInfo/userrecruitWorkInfo.vue b/pages/projectInfo/userrecruitWorkInfo.vue index eca2105..7510ca6 100644 --- a/pages/projectInfo/userrecruitWorkInfo.vue +++ b/pages/projectInfo/userrecruitWorkInfo.vue @@ -109,9 +109,10 @@ 工作地址:{{info.address || '暂无'}} - + :MapUrl="$config.supperMap" :flag-tip="false"> --> + @@ -338,10 +339,17 @@ self.longitude = self.info.lon; self.covers[0].latitude = self.info.lat; self.covers[0].longitude = self.info.lon; - if (!(self.info.lat && self.info.lat === -1)) { - self.$refs.uMap.initMap({ - lat: self.info.lat, - lon: self.info.lon, + this.$refs.tMap.open(self.info.lon, self.info.lat) + if (self.info.lon > 1 && self.info.lat > 1) { + self.$nextTick(() => { + self.$api.sleep(1000).then(() => { + this.$refs.tMap.addFeature([{ + id: self.info.id, + label: self.info.jobName, + lat: self.info.lat, + lon: self.info.lon, + }]) + }) }) } self.showDetail = true; diff --git a/pages/projectInfo/workInfo.vue b/pages/projectInfo/workInfo.vue index ed665e7..a39b109 100644 --- a/pages/projectInfo/workInfo.vue +++ b/pages/projectInfo/workInfo.vue @@ -106,9 +106,10 @@ 工作地址:{{info.address || '暂无'}} - + :MapUrl="$config.supperMap" :flag-tip="false"> --> + @@ -272,6 +273,7 @@ this.id = option.id; //消息id } }, + mounted() {}, onShow: function() { this.showDetail = true this.getData(); @@ -316,14 +318,22 @@ self.info = res.data.data; self.status = res.data.data.status; self.missionNo = res.data.data.missionNo; - self.latitude = self.info.lat; - self.longitude = self.info.lon; - self.covers[0].latitude = self.info.lat; - self.covers[0].longitude = self.info.lon; - if (!(self.info.lat && self.info.lat === -1)) { - self.$refs.uMap.initMap({ - lat: self.info.lat, - lon: self.info.lon, + this.$refs.tMap.open(self.info.lon, self.info.lat) + + // self.latitude = self.info.lat; + // self.longitude = self.info.lon; + // self.covers[0].latitude = self.info.lat; + // self.covers[0].longitude = self.info.lon; + if (self.info.lon > 1 && self.info.lat > 1) { + self.$nextTick(() => { + self.$api.sleep(1000).then(() => { + this.$refs.tMap.addFeature([{ + id: self.info.id, + label: self.info.jobName, + lat: self.info.lat, + lon: self.info.lon, + }]) + }) }) } self.showDetail = true; diff --git a/pages/recruit/subPage/newsDetail/projectInfo.vue b/pages/recruit/subPage/newsDetail/projectInfo.vue index 7512ec9..5e8b022 100644 --- a/pages/recruit/subPage/newsDetail/projectInfo.vue +++ b/pages/recruit/subPage/newsDetail/projectInfo.vue @@ -87,9 +87,10 @@ 任务地址:{{ info.address }} - + :flag-tip="false"> --> + @@ -282,10 +283,23 @@ recruit_missionDetail(self.missionNo, self.type).then(res => { self.info = res.data.data; self.status = res.data.data.detailStatus; - self.latitude = self.info.lat; - self.longitude = self.info.lon; - self.covers[0].latitude = self.info.lat; - self.covers[0].longitude = self.info.lon; + // self.latitude = self.info.lat; + // self.longitude = self.info.lon; + // self.covers[0].latitude = self.info.lat; + // self.covers[0].longitude = self.info.lon; + this.$refs.tMap.open(self.info.lon, self.info.lat) + if (self.info.lon > 1 && self.info.lat > 1) { + self.$nextTick(() => { + self.$api.sleep(1000).then(() => { + this.$refs.tMap.addFeature([{ + id: self.info.id, + label: self.info.missionTitle, + lat: self.info.lat, + lon: self.info.lon, + }]) + }) + }) + } self.showDetail = true; if (self.type === 1) { // 设置已读 diff --git a/pages/recruit/subPage/newsDetail/userrecruitInfo.vue b/pages/recruit/subPage/newsDetail/userrecruitInfo.vue index 15c8b75..c87b3e9 100644 --- a/pages/recruit/subPage/newsDetail/userrecruitInfo.vue +++ b/pages/recruit/subPage/newsDetail/userrecruitInfo.vue @@ -95,9 +95,10 @@ 岗位地址:{{ info.address }} - + :flag-tip="false"> --> + @@ -263,10 +264,23 @@ self.info = resData.data.data; self.status = resData.data.data.status; self.missionNo = resData.data.data.missionNo; - self.latitude = self.info.lat; - self.longitude = self.info.lon; - self.covers[0].latitude = self.info.lat; - self.covers[0].longitude = self.info.lon; + // self.latitude = self.info.lat; + // self.longitude = self.info.lon; + // self.covers[0].latitude = self.info.lat; + // self.covers[0].longitude = self.info.lon; + this.$refs.tMap.open(self.info.lon, self.info.lat) + if (self.info.lon > 1 && self.info.lat > 1) { + self.$nextTick(() => { + self.$api.sleep(1000).then(() => { + this.$refs.tMap.addFeature([{ + id: self.info.id, + label: self.info.jobName, + lat: self.info.lat, + lon: self.info.lon, + }]) + }) + }) + } self.showDetail = true; } }, diff --git a/pages/recruit/subPage/newsDetail/workInfo.vue b/pages/recruit/subPage/newsDetail/workInfo.vue index 182fb93..73f7b06 100644 --- a/pages/recruit/subPage/newsDetail/workInfo.vue +++ b/pages/recruit/subPage/newsDetail/workInfo.vue @@ -95,9 +95,10 @@ 岗位地址:{{ info.address }} - + :flag-tip="false"> --> + @@ -250,10 +251,23 @@ self.info = res.data.data; self.status = res.data.data.status; self.missionNo = res.data.data.missionNo; - self.latitude = self.info.lat; - self.longitude = self.info.lon; - self.covers[0].latitude = self.info.lat; - self.covers[0].longitude = self.info.lon; + // self.latitude = self.info.lat; + // self.longitude = self.info.lon; + // self.covers[0].latitude = self.info.lat; + // self.covers[0].longitude = self.info.lon; + this.$refs.tMap.open(self.info.lon, self.info.lat) + if (self.info.lon > 1 && self.info.lat > 1) { + self.$nextTick(() => { + self.$api.sleep(1000).then(() => { + this.$refs.tMap.addFeature([{ + id: self.info.id, + label: self.info.jobName, + lat: self.info.lat, + lon: self.info.lon, + }]) + }) + }) + } self.showDetail = true; }, error => { console.log(error); diff --git a/pages/recruit/subPage/task.vue b/pages/recruit/subPage/task.vue index 9b3fbd6..7078e02 100644 --- a/pages/recruit/subPage/task.vue +++ b/pages/recruit/subPage/task.vue @@ -1,868 +1,868 @@ - - - - - - \ No newline at end of file diff --git a/pages/recruit/subPage/work.vue b/pages/recruit/subPage/work.vue index eed2184..0fda1eb 100644 --- a/pages/recruit/subPage/work.vue +++ b/pages/recruit/subPage/work.vue @@ -1,853 +1,1048 @@ - - - - - - \ No newline at end of file + + + + + + diff --git a/store/models/user.js b/store/models/user.js index 4f8990b..c7a4380 100644 --- a/store/models/user.js +++ b/store/models/user.js @@ -1,290 +1,290 @@ -import { - isURL, - validatenull -} from '@/untils/validate.js' -import website from '@/config/website' -import { - loginByUsername, - getUserInfo, - logout, - refreshToken, - mobileIsCms -} from '@/api/user' -import md5 from 'js-md5' -import { - getStore, - setStore -} from '@/untils/store.js' -import { - calcDate -} from '@/untils/date.js' - -let refreshTimer = null; - -function startRefreshToken(dispatch) { - refreshTimer = setInterval(() => { - const token = - getStore({ - name: "token", - debug: true - }) || {}; - const date = calcDate(token.datetime, new Date().getTime()); - if (validatenull(date)) return; - if (date.seconds >= website.tokenTime) { - dispatch("refreshToken") - .then(() => {}) - .catch(() => {}); - } - }, 10000); -} - -function stopRefreshToken() { - clearInterval(refreshTimer) -} - -const user = { - state: { - tenantId: getStore({ - name: 'tenantId' - }) || '', - userInfo: getStore({ - name: 'userInfo' - }) || [], - token: getStore({ - name: 'token' - }) || '', - refreshToken: getStore({ - name: 'refreshToken' - }) || '', - userChecked: getStore({ - name: 'setUserCheckValue' - }) || false, - sendTimes: getStore({ //用户发送短信次数 - name: 'setUserSendTimes' - }) || 0, - seeEnterprise: getStore({ //用户发送短信次数 - name: 'enterprise' - }) || 0, // 0 个体招工 ; 企业招工 - userLocation: null, - userIsCms: false, - }, - actions: { - getMobileIsCms({ - commit, - dispatch - }) { - mobileIsCms().then((res) => { - commit('setIsCms', { - val: res.data.data - }) - }) - }, - getUserLocation({ - commit, - dispatch - }) { - console.log('getUserLocation null1') - // commit('setLocation', { - // latitude: 31.133980, - // longitude: 104.404419, - // }) - uni.getLocation({ - type: 'gcj02', - success: function(res) { - const { - longitude, - latitude - } = res - commit('setLocation', { - longitude, - latitude - }) - }, - fail: function(err) { - commit('setLocation', null) - }, - complete: function(e) {} - }) - }, - //用户点击radio按钮 - UserCheckedBtn({ - commit - }, val) { - commit('SET_USER_CHECKED', val); - }, - //根据用户名登录 - LoginByUsername({ - commit, - dispatch - }, userInfo) { - return new Promise((resolve, reject) => { - loginByUsername(userInfo.tenantId, userInfo.username, md5(userInfo.password), userInfo.type, - userInfo.key, - userInfo.code, userInfo.token).then(res => { - - const data = res.data; - if (data.error_description) { - uni.showToast({ - icon: "none", - title: data.error_description, - }) - } else { - commit('SET_TOKEN', data.access_token); - commit('SET_REFRESH_TOKEN', data.refresh_token); - commit('SET_TENANT_ID', data.tenant_id); - commit('SET_USER_INFO', data); - dispatch('refreshAuthState') - dispatch('startRefreshNewsTimer') - startRefreshToken(); - } - resolve(res); - }).catch(error => { - reject(error); - }) - }) - }, - //根据手机号登录 - LoginByPhone({ - commit - }, userInfo) { - return new Promise((resolve) => { - loginByUsername(userInfo.phone, userInfo.code).then(res => { - const data = res.data.data; - commit('SET_TOKEN', data); - resolve(); - }) - }) - }, - GetUserInfo({ - commit - }) { - return new Promise((resolve, reject) => { - getUserInfo().then((res) => { - const data = res.data.data; - resolve(data); - }).catch(err => { - reject(err); - }) - }) - }, - //刷新token - refreshToken({ - state, - commit, - dispatch - }) { - return new Promise((resolve, reject) => { - refreshToken(state.refreshToken, state.tenantId).then(res => { - const data = res.data; - dispatch('refreshAuthState') - commit('SET_TOKEN', data.access_token); - commit('SET_REFRESH_TOKEN', data.refresh_token); - resolve(); - }).catch(error => { - reject(error) - }) - }) - }, - // 登出 - LogOut({ - dispatch, - commit - }) { - return new Promise((resolve, reject) => { - logout(); - stopRefreshToken(); - commit('SET_TOKEN', ''); - commit('SET_VIPCODE', '0'); - resolve(); - }) - }, - //注销session - FedLogOut({ - commit - }) { - return new Promise(resolve => { - commit('SET_TOKEN', ''); - resolve(); - }) - }, - startRefreshTokenTimer({ - state, - commit, - dispatch - }) { - if (state.token) { - dispatch('refreshToken').then(() => { - startRefreshToken(dispatch); - }) - } - }, - //更新用户接收短信次数 - UpdateUserSendTimes({ - commit - }, data) { - commit('SET_USER_SENDTIMES', data); - }, - }, - mutations: { - setIsCms(state, payload) { - state.userIsCms = payload.val - }, - setLocation(state, val) { - state.userLocation = val - }, - setEnterprise(state, val) { // 0 个体招工 ; 企业招工 - state.seeEnterprise = val; - setStore({ - name: 'enterprise', - content: val, - }) - }, - SET_TOKEN: (state, token) => { - state.token = token; - setStore({ - name: 'token', - content: state.token, - type: 'session' - }) - }, - SET_REFRESH_TOKEN: (state, refreshToken) => { - state.refreshToken = refreshToken; - setStore({ - name: 'refreshToken', - content: state.refreshToken, - type: 'session' - }) - }, - SET_TENANT_ID: (state, tenantId) => { - state.tenantId = tenantId; - setStore({ - name: 'tenantId', - content: state.tenantId, - type: 'session' - }) - }, - SET_USER_INFO: (state, userInfo) => { - state.userInfo = userInfo; - setStore({ - name: 'userInfo', - content: state.userInfo - }) - }, - SET_USER_CHECKED: (state, val) => { - state.userChecked = val; - setStore({ - name: 'setUserCheckValue', - content: state.userChecked - }) - }, - SET_USER_SENDTIMES: (state, val) => { - state.sendTimes = val; - setStore({ - name: 'setUserSendTimes', - content: state.sendTimes - }) - }, - - } -} +import { + isURL, + validatenull +} from '@/untils/validate.js' +import website from '@/config/website' +import { + loginByUsername, + getUserInfo, + logout, + refreshToken, + mobileIsCms +} from '@/api/user' +import md5 from 'js-md5' +import { + getStore, + setStore +} from '@/untils/store.js' +import { + calcDate +} from '@/untils/date.js' + +let refreshTimer = null; + +function startRefreshToken(dispatch) { + refreshTimer = setInterval(() => { + const token = + getStore({ + name: "token", + debug: true + }) || {}; + const date = calcDate(token.datetime, new Date().getTime()); + if (validatenull(date)) return; + if (date.seconds >= website.tokenTime) { + dispatch("refreshToken") + .then(() => {}) + .catch(() => {}); + } + }, 10000); +} + +function stopRefreshToken() { + clearInterval(refreshTimer) +} + +const user = { + state: { + tenantId: getStore({ + name: 'tenantId' + }) || '', + userInfo: getStore({ + name: 'userInfo' + }) || [], + token: getStore({ + name: 'token' + }) || '', + refreshToken: getStore({ + name: 'refreshToken' + }) || '', + userChecked: getStore({ + name: 'setUserCheckValue' + }) || false, + sendTimes: getStore({ //用户发送短信次数 + name: 'setUserSendTimes' + }) || 0, + seeEnterprise: getStore({ //用户发送短信次数 + name: 'enterprise' + }) || 0, // 0 个体招工 ; 企业招工 + userLocation: null, + userIsCms: false, + }, + actions: { + getMobileIsCms({ + commit, + dispatch + }) { + mobileIsCms().then((res) => { + commit('setIsCms', { + val: res.data.data + }) + }) + }, + getUserLocation({ + commit, + dispatch + }) { + console.log('getUserLocation null1') + // commit('setLocation', { + // latitude: 31.133980, + // longitude: 104.404419, + // }) + uni.getLocation({ + type: 'wgs84', + success: function(res) { + const { + longitude, + latitude + } = res + commit('setLocation', { + longitude, + latitude + }) + }, + fail: function(err) { + commit('setLocation', null) + }, + complete: function(e) {} + }) + }, + //用户点击radio按钮 + UserCheckedBtn({ + commit + }, val) { + commit('SET_USER_CHECKED', val); + }, + //根据用户名登录 + LoginByUsername({ + commit, + dispatch + }, userInfo) { + return new Promise((resolve, reject) => { + loginByUsername(userInfo.tenantId, userInfo.username, md5(userInfo.password), userInfo.type, + userInfo.key, + userInfo.code, userInfo.token).then(res => { + + const data = res.data; + if (data.error_description) { + uni.showToast({ + icon: "none", + title: data.error_description, + }) + } else { + commit('SET_TOKEN', data.access_token); + commit('SET_REFRESH_TOKEN', data.refresh_token); + commit('SET_TENANT_ID', data.tenant_id); + commit('SET_USER_INFO', data); + dispatch('refreshAuthState') + dispatch('startRefreshNewsTimer') + startRefreshToken(); + } + resolve(res); + }).catch(error => { + reject(error); + }) + }) + }, + //根据手机号登录 + LoginByPhone({ + commit + }, userInfo) { + return new Promise((resolve) => { + loginByUsername(userInfo.phone, userInfo.code).then(res => { + const data = res.data.data; + commit('SET_TOKEN', data); + resolve(); + }) + }) + }, + GetUserInfo({ + commit + }) { + return new Promise((resolve, reject) => { + getUserInfo().then((res) => { + const data = res.data.data; + resolve(data); + }).catch(err => { + reject(err); + }) + }) + }, + //刷新token + refreshToken({ + state, + commit, + dispatch + }) { + return new Promise((resolve, reject) => { + refreshToken(state.refreshToken, state.tenantId).then(res => { + const data = res.data; + dispatch('refreshAuthState') + commit('SET_TOKEN', data.access_token); + commit('SET_REFRESH_TOKEN', data.refresh_token); + resolve(); + }).catch(error => { + reject(error) + }) + }) + }, + // 登出 + LogOut({ + dispatch, + commit + }) { + return new Promise((resolve, reject) => { + logout(); + stopRefreshToken(); + commit('SET_TOKEN', ''); + commit('SET_VIPCODE', '0'); + resolve(); + }) + }, + //注销session + FedLogOut({ + commit + }) { + return new Promise(resolve => { + commit('SET_TOKEN', ''); + resolve(); + }) + }, + startRefreshTokenTimer({ + state, + commit, + dispatch + }) { + if (state.token) { + dispatch('refreshToken').then(() => { + startRefreshToken(dispatch); + }) + } + }, + //更新用户接收短信次数 + UpdateUserSendTimes({ + commit + }, data) { + commit('SET_USER_SENDTIMES', data); + }, + }, + mutations: { + setIsCms(state, payload) { + state.userIsCms = payload.val + }, + setLocation(state, val) { + state.userLocation = val + }, + setEnterprise(state, val) { // 0 个体招工 ; 企业招工 + state.seeEnterprise = val; + setStore({ + name: 'enterprise', + content: val, + }) + }, + SET_TOKEN: (state, token) => { + state.token = token; + setStore({ + name: 'token', + content: state.token, + type: 'session' + }) + }, + SET_REFRESH_TOKEN: (state, refreshToken) => { + state.refreshToken = refreshToken; + setStore({ + name: 'refreshToken', + content: state.refreshToken, + type: 'session' + }) + }, + SET_TENANT_ID: (state, tenantId) => { + state.tenantId = tenantId; + setStore({ + name: 'tenantId', + content: state.tenantId, + type: 'session' + }) + }, + SET_USER_INFO: (state, userInfo) => { + state.userInfo = userInfo; + setStore({ + name: 'userInfo', + content: state.userInfo + }) + }, + SET_USER_CHECKED: (state, val) => { + state.userChecked = val; + setStore({ + name: 'setUserCheckValue', + content: state.userChecked + }) + }, + SET_USER_SENDTIMES: (state, val) => { + state.sendTimes = val; + setStore({ + name: 'setUserSendTimes', + content: state.sendTimes + }) + }, + + } +} export default user \ No newline at end of file diff --git a/uni_modules/zhuo-tianditu-MultiPoint-Mapper/changelog.md b/uni_modules/zhuo-tianditu-MultiPoint-Mapper/changelog.md new file mode 100644 index 0000000..e69de29 diff --git a/uni_modules/zhuo-tianditu-MultiPoint-Mapper/components/zhuo-tianditu-MultiPoint-Mapper/tianditu-map.vue b/uni_modules/zhuo-tianditu-MultiPoint-Mapper/components/zhuo-tianditu-MultiPoint-Mapper/tianditu-map.vue new file mode 100644 index 0000000..6dc739c --- /dev/null +++ b/uni_modules/zhuo-tianditu-MultiPoint-Mapper/components/zhuo-tianditu-MultiPoint-Mapper/tianditu-map.vue @@ -0,0 +1,226 @@ + + + + + + + + \ No newline at end of file diff --git a/uni_modules/zhuo-tianditu-MultiPoint-Mapper/components/zhuo-tianditu-MultiPoint-Mapper/zhuo-tianditu-MultiPoint-Mapper.vue b/uni_modules/zhuo-tianditu-MultiPoint-Mapper/components/zhuo-tianditu-MultiPoint-Mapper/zhuo-tianditu-MultiPoint-Mapper.vue new file mode 100644 index 0000000..bb743e5 --- /dev/null +++ b/uni_modules/zhuo-tianditu-MultiPoint-Mapper/components/zhuo-tianditu-MultiPoint-Mapper/zhuo-tianditu-MultiPoint-Mapper.vue @@ -0,0 +1,206 @@ + + + + + + \ No newline at end of file diff --git a/uni_modules/zhuo-tianditu-MultiPoint-Mapper/package.json b/uni_modules/zhuo-tianditu-MultiPoint-Mapper/package.json new file mode 100644 index 0000000..18af958 --- /dev/null +++ b/uni_modules/zhuo-tianditu-MultiPoint-Mapper/package.json @@ -0,0 +1,83 @@ +{ + "id": "zhuo-tianditu-MultiPoint-Mapper", + "displayName": "zhuo-tianditu-MultiPoint-Mapper", + "version": "1.0.0", + "description": "zhuo-tianditu-MultiPoint-Mapper", + "keywords": [ + "zhuo-tianditu-MultiPoint-Mapper" +], + "repository": "", + "engines": { + "HBuilderX": "^3.1.0" + }, + "dcloudext": { + "type": "component-vue", + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "", + "data": "", + "permissions": "" + }, + "npmurl": "" + }, + "uni_modules": { + "dependencies": [], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "u", + "aliyun": "u", + "alipay": "u" + }, + "client": { + "Vue": { + "vue2": "u", + "vue3": "u" + }, + "App": { + "app-vue": "u", + "app-nvue": "u", + "app-uvue": "u" + }, + "H5-mobile": { + "Safari": "u", + "Android Browser": "u", + "微信浏览器(Android)": "u", + "QQ浏览器(Android)": "u" + }, + "H5-pc": { + "Chrome": "u", + "IE": "u", + "Edge": "u", + "Firefox": "u", + "Safari": "u" + }, + "小程序": { + "微信": "u", + "阿里": "u", + "百度": "u", + "字节跳动": "u", + "QQ": "u", + "钉钉": "u", + "快手": "u", + "飞书": "u", + "京东": "u" + }, + "快应用": { + "华为": "u", + "联盟": "u" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/zhuo-tianditu-MultiPoint-Mapper/readme.md b/uni_modules/zhuo-tianditu-MultiPoint-Mapper/readme.md new file mode 100644 index 0000000..b39dcd3 --- /dev/null +++ b/uni_modules/zhuo-tianditu-MultiPoint-Mapper/readme.md @@ -0,0 +1 @@ +# zhuo-tianditu-MultiPoint-Mapper \ No newline at end of file diff --git a/uni_modules/zhuo-tianditu-MultiPoint-Mapper/static/point.png b/uni_modules/zhuo-tianditu-MultiPoint-Mapper/static/point.png new file mode 100644 index 0000000..70f1f51 Binary files /dev/null and b/uni_modules/zhuo-tianditu-MultiPoint-Mapper/static/point.png differ diff --git a/uni_modules/zhuo-tianditu-MultiPoint-Mapper/tools.js b/uni_modules/zhuo-tianditu-MultiPoint-Mapper/tools.js new file mode 100644 index 0000000..37f762f --- /dev/null +++ b/uni_modules/zhuo-tianditu-MultiPoint-Mapper/tools.js @@ -0,0 +1,106 @@ +/** + * @param title String,提示的内容 + * @param duration String,提示的延迟时间,单位毫秒,默认:1500 + * @param mask Boolean,是否显示透明蒙层,防止触摸穿透,默认:false + * @param icon String,图标:success、error、fail、exception、loading、none,默认:none + **/ +export function createMessage(title, duration = 1500, mask = false, icon = "none") { + uni.showToast({ + title, + duration: duration, + mask, + icon + }); +} + +/** + * @param url String,请求的地址,默认:none + * @param data Object,请求的参数,默认:{} + * @param method String,请求的方式,默认:GET + * @param loading Boolean,是否需要loading ,默认:false + * @param header Object,headers,默认:{} + * @returns promise + **/ +export function createRequest(url, data = {}, loading = false, method = 'GET', header = {}) { + if (loading) { + uni.showLoading({ + title: '请稍后', + mask: true + }) + } + return new Promise((resolve, reject) => { + uni.request({ + url: url, + method: method, + data: data, + header: header, + success: res => { + if (res.statusCode === 200) { + resolve(res.data) + } else { + if (res.data.msg) { + const str = typeof res.data.resolve === 'string' ? ',' + res.data.resolve : + '' + createMessage(res.data.msg + str) + } + throw new Error('请求错误 ' + url) + reject() + } + }, + fail: (err) => { + reject(err) + }, + complete: () => { + uni.hideLoading(); + } + }); + }) +} + +/** + * 数据格式化 + * @param obj Object,响应的数据 + * @param type Number 0 | 1,处理类型 + * @returns Object {address = string, name = string, location = {lon, lat }, infomation = {}} + */ +export function formatterAdressLocation(obj, type) { + switch (type) { + case 1: + return { + address: obj.formatted_address, + name: '', + location: obj.location, + infomation: obj.addressComponent + } + break; + case 2: + const [lon, lat] = obj.lonlat.split(',') + return { + address: obj.address, + name: obj.name, + location: { + lon, + lat + }, + infomation: obj + } + break + case 3: + return { + address: obj.location.keyWord, + name: '', + location: { + lon: obj.location.lon, + lat: obj.location.lat, + }, + infomation: obj.location + } + default: + break; + } +} +export default { + createMessage, + createRequest, + formatterAdressLocation +} \ No newline at end of file diff --git a/untils/AxiosUtils.js b/untils/AxiosUtils.js index 79738b9..6880398 100644 --- a/untils/AxiosUtils.js +++ b/untils/AxiosUtils.js @@ -190,24 +190,24 @@ export function Promisify(func) { export function GoLogin() { if (showModal) { showModal = false - location.href = "https://dy12333.org.cn/h5/" - // uni.showModal({ - // title: "提示", - // content: "您还未登录,点击确认去登录", - // success({ - // confirm - // }) { - // if (confirm) { - // uni.redirectTo({ - // url: "/pages/login/login" - // }); - // } - // showModal = true - // }, - // fail() { - // showModal = true - // } - // }) + // location.href = "https://dy12333.org.cn/h5/" + uni.showModal({ + title: "提示", + content: "您还未登录,点击确认去登录", + success({ + confirm + }) { + if (confirm) { + uni.redirectTo({ + url: "/pages/login/login" + }); + } + showModal = true + }, + fail() { + showModal = true + } + }) } } diff --git a/vue.config.js b/vue.config.js index c8ae835..025a3f0 100644 --- a/vue.config.js +++ b/vue.config.js @@ -6,7 +6,7 @@ module.exports = { port: 1887, proxy: { '/api': { - target: 'http://10.165.0.173:8000', + target: 'http://39.98.184.58:8000', ws: true, pathRewrite: { '^/api': '/'