代码更新

This commit is contained in:
jia 2023-09-02 21:05:37 +08:00
parent df8132a504
commit 4cedd8415d
9 changed files with 383 additions and 355 deletions

15
App.vue
View File

@ -10,6 +10,7 @@
// +----------------------------------------------------------------------
// #ifdef APP-PLUS
let jpushModule = uni.requireNativePlugin("JG-JPush");
const mp = uni.requireNativePlugin('uniMP');
// #endif
import {
checkLogin
@ -74,7 +75,18 @@
},
onLaunch: function(option) {
this.globalData.statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
this.globalData.uid = this.$store.state.app.uid
this.globalData.uid = this.$store.state.app.uid;
//uni
mp.onUniMPEventReceive(ret=>{
console.log('小程序事件: ', ret);
if(ret.event=='closeApp'){
mp.closeUniMP(ret.fromAppid, (ret)=>{
console.log('closeUniMP: '+JSON.stringify(ret));
});
}
});
let that = this;
// #ifdef MP
if (HTTP_REQUEST_URL == '') {
@ -188,7 +200,6 @@
},
onShow() {
let that = this

View File

@ -26,9 +26,7 @@
<script>
import WaterfallsFlowItem from '../WaterfallsFlowItem/WaterfallsFlowItems.vue'
import {
getUserInfo
} from '@/api/user.js';
export default {
components: {
WaterfallsFlowItem
@ -110,7 +108,7 @@ export default {
deep:true
},
mounted(){
console.log('1111111111')
this.getUserInfo()
},
@ -122,22 +120,9 @@ export default {
}
}
},
mounted(){
this.getUserInfo()
},
methods: {
/**
* 获取个人用户信息
*/
getUserInfo: function() {
console.log('111111111')
let that = this;
getUserInfo().then(res => {
// that.userInfo = res.data;
console.log(res.data)
});
},
//
waterFall() {
const i = this.mark;

View File

@ -71,16 +71,17 @@
type: Object,
default: () => ({})
},
show: {
type: Boolean,
town: {
type:String,
default: false
},
},
data() {
return {
defaInd: [0, 0],
street: '',
streeta: '',
showPicker: false,
styleConfig: [],
columnData: [],
@ -101,12 +102,9 @@
}
},
watch:{
street(newval, val) {
// console.log(newval, val)
this.street = newval
// console.log(newval, val)
street(nval,val) {
this.street=nval
}
},
created() {
@ -117,17 +115,13 @@
},
mounted() {
uni.$on('init', function(data) {
console.log('init data ', data);
uni.$on('add', (res)=> {
this.street=res.split(',')[0]
})
this.$bus.$on('value-updated', (newValue) => {
//
this.street = newValue.split(',')[0]
});
let arr = uni.getStorageSync('ADRESS_LOCATION')
if (arr.length > 0) {
this.street = arr.split(',')[0]
} else {
this.appLocation()
}
},
methods: {
@ -141,42 +135,7 @@
this.isSelectPlace ? this.showPicker = true : ''
},
appLocation() {
uni.getLocation({
type: 'wgs84',
timeout: '10',
success: (res) => {
// console.log(res)
let latitude, longitude;
latitude = res.latitude.toString();
longitude = res.longitude.toString();
getGeocoder({
lat: latitude,
long: longitude
}).then(res => {
let town = res.data.address_reference.town.title
let street_id = res.data.address_reference.town.id
this.street = res.data.address_component.street
}).catch(err => {
uni.showToast({
title: err,
icon: 'none'
})
})
},
fail: (err) => {
uni.showToast({
title: "获取定位超时",
icon: 'none',
duration: 2000
});
}
});
},
confirm(e) {
this.showPicker = false
@ -184,11 +143,11 @@
this.$emit('change', e)
this.street = e.value[1].name
uni.setStorageSync('ADRESS_LOCATION',
uni.$emit('add',e.value[1].name+','+e.value[1].code)
this.$bus.$emit('value-updated',
e.value[1].name + ',' +
e.value[1].code);
e.value[1].code
)
},
changeHandler(e) {
const {

View File

@ -23,7 +23,7 @@ Vue.prototype.$util = util;
Vue.prototype.$Cache = Cache;
Vue.prototype.$eventHub = new Vue();
Vue.config.productionTip = false
Vue.prototype.$bus = new Vue();
// #ifdef H5
import { parseQuery } from "./utils";
import Auth from './libs/wechat';

View File

@ -14,7 +14,7 @@
</view>
</view> -->
<zbpSwiper :isSelectPlace="true" :location_Arr="locationArr" @kkchange='kkchange'></zbpSwiper>
<zbpSwiper :isSelectPlace="true" :location_Arr="locationArr" :town='street' @kkchange='kkchange'></zbpSwiper>
<u-empty :show="jurisdiction" marginTop="260" mode="permission" :text="emptyText"
icon="http://cdn.uviewui.com/uview/empty/permission.png"></u-empty>
<view class="business com special_work">
@ -33,7 +33,8 @@
</view>
</u-transition>
</block>
<view v-else-if="!editFlag" @click="editFlag = true" style="text-align: center;width: 100%;color: #aaa;">还没有应用,点我添加应用</view>
<view v-else-if="!editFlag" @click="editFlag = true"
style="text-align: center;width: 100%;color: #aaa;">还没有应用,点我添加应用</view>
</view>
</view>
<view v-if="editFlag" class="business com special_work edit_card">
@ -119,8 +120,7 @@
//
editFlag: false,
//
AllMenuList: [
{
AllMenuList: [{
name: '商户平台',
icon: 'spgl.png',
data: '/pages/moreProject/moreProject',
@ -133,7 +133,7 @@
type: 1,
},
],
nowMenuList: []
nowMenuList: [],
street: '',
showPicker: false,
columnData: []
@ -157,7 +157,7 @@
this.jurisdiction = true
}
this.getUserInfo()
this.appLocation()
},
onPullDownRefresh() {
@ -165,12 +165,19 @@
uni.stopPullDownRefresh()
},
mounted() {
this.appLocation()
if(this.street.length<=0){
this.selfLocation()
}
// #ifdef H5
//
window.addEventListener("scroll", this.scrolling);
// #endif
this.$bus.$on('value-updated', (newValue) => {
//
this.street = newValue.split(',')[0]
});
},
// #ifdef APP-PLUS
@ -200,8 +207,12 @@
},
clickMenu(e, data) {
switch (e) {
case 1: this.getUniMp(data);break;
case 2: this.navigator(data);break;
case 1:
this.getUniMp(data);
break;
case 2:
this.navigator(data);
break;
}
},
//
@ -235,7 +246,6 @@
title: 'H5不支持打开小程序'
})
},
appLocation() {
changeHandler(e) {
const {
columnIndex,
@ -251,8 +261,8 @@
this.$refs.uPicker.setColumnValues(1, res.data);
});
}
}
},
Area() {
getArea({
city_code: 510500
@ -294,12 +304,11 @@
lat: latitude,
long: longitude
}).then(res => {
this.town = res.data.address_reference.town.title
this.street_id = res.data.address_reference.town.id
let town = res.data.address_reference.town.title
let street_id = res.data.address_reference.town.id
this.street = res.data.address_component.street
uni.setStorageSync('ADRESS_LOCATION',
this.town + ',' + this.town + ',' +
this.street_id)
uni.$emit('add',town+','+street_id)
}).catch(err => {
uni.showToast({
title: err,
@ -483,14 +492,17 @@
display: flex;
justify-content: space-between;
align-items: flex-end;
.edit {
font-size: 26rpx;
font-weight: 400;
&::after {
content: '>';
margin-left: 10rpx;
}
}
.edit2 {
font-size: 26rpx;
font-weight: 400;

View File

@ -23,7 +23,8 @@
</view>
<zbpSwiper ref='list' :isSelectPlace="true" :show='show' :location_Arr="locationArr" @kkchange='kkchange' @change='dchange'>
<zbpSwiper ref='list' :isSelectPlace="true" :town='street' :show='show' :location_Arr="locationArr" @kkchange='kkchange'
@change='dchange'>
</zbpSwiper>
@ -143,7 +144,7 @@
import zbpSwiper from '@/components/zbpSwiper'
import easyLoadimage from '@/components/easy-loadimage/easy-loadimage.vue';
import WaterfallsFlow from '@/components/WaterfallsFlow/WaterfallsFlows.vue'
import Cache from '@/utils/cache';
import {
getSlideAPI
} from '@/api/lihai.js'
@ -236,7 +237,7 @@
this.getCateList()
this.getArticle()
this.getGoods()
this.selfLocation()
this.Area()
this.setPermissions()
@ -262,12 +263,17 @@
this.getGoods()
},
mounted() {
this.selfLocation()
// #ifdef H5
//
window.addEventListener("scroll", this.scrolling);
// #endif
this.$bus.$on('value-updated', (newValue) => {
//
this.street = newValue.split(',')[0]
});
},
// #ifdef APP-PLUS
onPageScroll(e) {
@ -441,7 +447,6 @@
},
gogogo(item) {
if (item.video_link.length > 0) {
uni.navigateTo({
// #ifdef MP || H5
url: `/pages/short_video/nvueSwiper/index?id=${item.community_id}`
@ -528,7 +533,7 @@
type: 'wgs84',
timeout: '10',
success: (res) => {
// console.log(res)
this.isshow = false
let latitude, longitude;
latitude = res.latitude.toString();
@ -537,7 +542,13 @@
lat: latitude,
long: longitude
}).then(res => {
let town = res.data.address_reference.town.title
let street_id = res.data.address_reference.town.id
this.street = res.data.address_component.street
// console.log(this.street)
uni.$emit('add',town+','+street_id)
}).catch(err => {
uni.showToast({
title: err,

View File

@ -343,6 +343,7 @@
import mentioned from '../components/mentioned/mentioned.vue'
import authorize from '@/components/Authorize';
import {
deoList,
videoList,
myVideoList,
graphicStartApi,
@ -689,28 +690,10 @@
let that = this;
if (!that.loadVideo) return
that.loadVideo = true
that.isUser ?
myVideoList(that.userUid, {
page: that.page,
limit: that.limit,
is_star: that.isSatrt,
community_id: that.videoID
}).then(res => {
deoList(that.videoID).then(res => {
that.loadVideo = false
that.getVideoData(res.data.list);
}).catch(err => {
return uni.showToast({
title: err,
icon: 'none',
duration: 2000
});
}) :
graphicLstApi({
page: that.page,
limit: that.limit,
category_id: -1
}).then(res => {
that.getVideoData(res.data.list);
that.getVideoData([res.data]);
}).catch(err => {
return uni.showToast({
title: err,
@ -718,6 +701,35 @@
duration: 2000
});
})
// that.isUser ?
// myVideoList(that.userUid, {
// page: that.page,
// limit: that.limit,
// is_star: that.isSatrt,
// community_id: that.videoID
// }).then(res => {
// that.loadVideo = false
// that.getVideoData(res.data.list);
// }).catch(err => {
// return uni.showToast({
// title: err,
// icon: 'none',
// duration: 2000
// });
// }) :
// graphicLstApi({
// page: that.page,
// limit: that.limit,
// category_id: -1
// }).then(res => {
// that.getVideoData(res.data.list);
// }).catch(err => {
// return uni.showToast({
// title: err,
// icon: 'none',
// duration: 2000
// });
// })
},
getFocusList() {
let that = this;
@ -869,16 +881,12 @@
// if(!this.loadVideo) return
this.loadVideo = true
// 这个方法主要就是用来第一次进入视频播放时用来处理的
this.isUser ?
myVideoList(this.userUid, {
page: this.page,
limit: this.limit,
is_star: this.isSatrt,
community_id: this.videoID
}).then(async (res) => {
deoList(this.videoID).then(async (res) => {
this.loadVideo = false
this.page = this.page + 1;
var msg = res.data.list;
this.page = 1;
var msg = [res.data];
for (let i = 0; i < msg.length; i++) {
msg[i]['isMore'] = false
msg[i]['playIng'] = false
@ -898,29 +906,62 @@
icon: 'none',
duration: 2000
});
}) :
graphicLstApi({
page: this.page,
limit: this.limit,
category_id: -1
}).then(async (res) => {
this.page = this.page + 1;
var msg = res.data.list;
for (let i = 0; i < msg.length; i++) {
msg[i]['isMore'] = false
msg[i]['playIng'] = false
msg[i]['state'] = false
msg[i]['isplay'] = false
msg[i]['community_id'] = msg[i]['community_id'].toString()
}
this.dataList = msg;
}).catch(err => {
return uni.showToast({
title: err,
icon: 'none',
duration: 2000
});
})
// this.isUser ?
// myVideoList(this.userUid, {
// page: this.page,
// limit: this.limit,
// is_star: this.isSatrt,
// community_id: this.videoID
// }).then(async (res) => {
// this.loadVideo = false
// this.page = this.page + 1;
// var msg = res.data.list;
// for (let i = 0; i < msg.length; i++) {
// msg[i]['isMore'] = false
// msg[i]['playIng'] = false
// msg[i]['state'] = false
// msg[i]['isplay'] = false
// msg[i]['loading'] = false
// msg[i]['community_id'] = msg[i]['community_id'].toString()
// }
// this.dataList = msg;
// if (this.dataList.length !== 0) {
// this.dataList[this.k].state = 'play';
// uni.createVideoContext(this.dataList[this.k].community_id, this).play()
// }
// }).catch(err => {
// return uni.showToast({
// title: err,
// icon: 'none',
// duration: 2000
// });
// }) :
// graphicLstApi({
// page: this.page,
// limit: this.limit,
// category_id: -1
// }).then(async (res) => {
// this.page = this.page + 1;
// var msg = res.data.list;
// for (let i = 0; i < msg.length; i++) {
// msg[i]['isMore'] = false
// msg[i]['playIng'] = false
// msg[i]['state'] = false
// msg[i]['isplay'] = false
// msg[i]['community_id'] = msg[i]['community_id'].toString()
// }
// this.dataList = msg;
// }).catch(err => {
// return uni.showToast({
// title: err,
// icon: 'none',
// duration: 2000
// });
// })
},
onpullingdown() {
this.refreshing = true

View File

@ -15,7 +15,7 @@
<!-- 头部导航 -->
<view v-if="!isUser" class="header" :style="{backgroundColor:currentNav==1?'':'#ffffff'}">
<!-- <view v-if="!isUser" class="header" :style="{backgroundColor:currentNav==1?'':'#ffffff'}">
<view class="tool-bar">
<view class='iconfont icon-xiangzuo' @tap='goBack'></view>
@ -29,7 +29,7 @@
<view class="items" @click.stop="navTap(3)">
<text class="tName" :class="currentNav==3?'on':''">列表</text>
</view>
</view>
</view> -->
<swiper v-show="currentNav !== 3" :style="'width: '+ windowWidth +'px; height: '+ windowHeight +'px;'"
:vertical="true" @animationfinish="animationfinish" @change="change" :current="k" :indicator-dots="false">
<swiper-item v-for="(list,index) in dataList">
@ -420,6 +420,7 @@
watch: {
k(new_k, old_k) {
const max = new_k + 2;
if (this.max < max) {
this.max = max;
}
@ -427,6 +428,7 @@
this.oldCurrent = this.currentNav
return false
}
this.dataList[old_k].playIng = false //如果视频暂停,就加载封面
this.dataList[old_k].isplay = true
this.dataList[old_k].state = 'pause'
@ -819,16 +821,21 @@
msg[i]['isplay'] = true
msg[i]['loading'] = false
that.dataList.push(msg[i])
{console.log(i,that.k)}
//#ifndef H5
if (i == 0 && that.k == 0) {
this.dataList[0].isplay = false
this.dataList[0].playIng = true
this.dataList[0].state = 'play'
this.dataList[0].loading = false
console.log('32')
uni.createVideoContext(that.dataList[0].community_id + '' + 0, that).play()
}
//#endif
}
//#ifdef MP
if (this.k == 0) {
this.videoShare(this.dataList[0]);

View File

@ -3,10 +3,10 @@
<view class="circle_friends_wrapper">
<view>
<view @click="selectLocation">
<view class="site-box flex_a_c_j_sb" :style="{'background-color':backColor}">
<view :class="['place_wrapper','flex_a_c',isFshow?'sitebox':'']" @click="selectLocation">
<view :class="['place_wrapper','flex_a_c',isFshow?'sitebox':'']" >
<view :class="['iconfont','icon-weizhi',isFshow?'sitebox':'']" style="margin-left: 20rpx;">
</view>
<view class="town_name">{{street}}</view>
@ -24,9 +24,11 @@
<zbpSwiper :isSelectPlace="true" :location_Arr="locationArr" @kkchange='kkchange' @change='dchange'>
<zbpSwiper :isSelectPlace="true" :town='street' :streetname='street' :location_Arr="locationArr"
@change='dchange'>
</zbpSwiper>
<view class="list">
<navigator hover-class="none"
:url="`/pages/nongKe/supply_chain/supplier?type_id=10&street_id=${street_id}`">
@ -249,20 +251,15 @@
},
onPullDownRefresh() {
this.cateGoods = []
this.list()
this.Area()
uni.stopPullDownRefresh()
},
onLoad() {
this.getArticle()
this.selfLocation()
this.Area()
this.setPermissions()
@ -288,11 +285,19 @@
this.list()
},
mounted() {
// #ifdef H5
//
window.addEventListener("scroll", this.scrolling);
// #endif
this.$bus.$on('value-updated', (newValue) => {
//
this.street = newValue.split(',')[0]
});
if(this.street.length<=0){
this.selfLocation()
}
},
// #ifdef APP-PLUS
@ -315,7 +320,6 @@
// #endif
methods: {
list() {
spuInfo('510502106', this.where1).then(res => {
// console.log(res)
@ -364,9 +368,7 @@
},
kkchange(e) {
this.bgColor = e
},
@ -415,7 +417,6 @@
},
confirm(e) {
this.street = e.value[1].name
this.street_id = e.value[1].code
this.town = e.value[1].name
@ -530,9 +531,10 @@
this.town = res.data.address_reference.town.title
this.street_id = res.data.address_reference.town.id
this.street = res.data.address_component.street
uni.setStorageSync('ADRESS_LOCATION',
this.town + ',' +this.street_id)
this.list()
uni.$emit('add',this.town+','+this.street_id)
// uni.setStorageSync('ADRESS_LOCATION',
// this.town + ',' + this.street_id)
// this.list()
}).catch(err => {
uni.showToast({
title: err,