This commit is contained in:
yanran200730
2022-11-02 10:38:06 +08:00
parent b2ec1d98fb
commit b2c2f89263
6 changed files with 890 additions and 11 deletions

View File

@@ -37,6 +37,7 @@ export default {
const {encryptedData, errMsg, iv} = arg.detail
if (errMsg == 'getPhoneNumber:ok') {
tools.$getLoginCode().then(() => {
console.log(iv, this.code)
this.$instance.post(`/app/appwechatuser/getWechatUserPhone`, {
encryptedData, iv,
code: this.code

View File

@@ -1,15 +1,366 @@
<template>
<div class="Activity">
<div class="photo">
<div class="header" :class="[isFixed ? 'header-active' : '']">
<div class="status-bar" :style="{height: statusBarHeight + 'px'}"></div>
<div class="nav-bar">
<image src="/static/img/left.png" @click="back"/>
<h2>文明倡导</h2>
</div>
</div>
<div class="back-wrapper" @click="back" v-show="!isFixed" :style="{marginTop : statusBarHeight + 'px'}">
<image src="/static/img/left.png"/>
</div>
<div class="photo-header">
<image src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/wm-bg.png" />
<h2>文明倡导</h2>
<p>将文明倡导公益海报分享在微信朋友圈50人以上的微信群微博群即可获得积分奖励</p>
</div>
<div class="phone-wrapper">
<h2>我上传的</h2>
<div class="list">
<div class="item" v-for="(item, index) in 10" :key="index">
<image src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/photo-bg.png" />
<span>待审核</span>
<div class="bottom">
<i>10-15 19:25</i>
<span>积分+5</span>
</div>
</div>
</div>
</div>
<div class="btn-wrapper">
<div class="btn" @click="upload" hover-class="text-hover">上传朋友圈截图</div>
<div class="btn" @click="upload" hover-class="text-hover">上传群聊截图</div>
</div>
<AiLogin ref="login"/>
</div>
</template>
<script>
export default {
appName: '文明倡导'
name: 'Culture',
appName: '文明倡导',
customNavigation: true,
data () {
return {
isFixed: false,
statusBarHeight: 20,
list: [],
hideStatus: false,
pageShow: false
}
},
onLoad () {
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight
},
methods: {
back () {
uni.navigateBack({
delta: 1
})
},
preview (url) {
let imgs = []
this.list.forEach(item => {
imgs = [...imgs, ...item.list.map(v => v.url)]
})
uni.previewImage({
urls: imgs,
current: url
})
},
upload () {
if (!this.token) {
this.$refs.login.show()
return false
}
this.imgList = []
this.hideStatus = false
uni.chooseImage({
count: this.limit,
sizeType: ['compressed'],
sourceType: ['album', 'camera'],
success: (res) => {
if (res.tempFilePaths.length > 9) {
this.$toast(`图片不能超过9张`)
return false
}
this.$loading('上传中')
res.tempFilePaths.forEach((item, index) => {
if (index === res.tempFilePaths.length - 1) {
this.hideStatus = true
}
this.$nextTick(() => {
this.uploadFile(item, res.tempFilePaths.length)
})
})
},
})
},
uploadFile (img, total) {
uni.uploadFile({
url: this.$instance.defaults.baseURL + '/admin/file/add',
filePath: img,
name: 'file',
header: {
'Content-Type': 'multipart/form-data',
Authorization: uni.getStorageSync('token'),
},
success: (res) => {
const data = JSON.parse(res.data)
if (data.code === 0) {
this.imgList.push(data.data[0].split(';')[0])
} else {
this.$toast(data.msg)
}
},
complete: () => {
this.$nextTick(() => {
if (this.imgList.length === total && this.hideStatus) {
this.$instance.post(`/app/appvillagepicturealbum/addPictures`, {
areaName: uni.getStorageSync('areaName'),
areaId: uni.getStorageSync('areaId'),
type: this.type,
urlList: this.imgList
}).then(res => {
if (res.code == 0) {
this.getList(this.type)
this.getTotalInfo(this.type)
uni.$emit('update')
}
this.$hideLoading()
this.hideStatus = false
})
}
})
}
})
},
getList (type) {
this.$instance.post(`/app/appvillagepicturealbum/queryAlbum?areaId=${uni.getStorageSync('areaId')}&type=${type}`).then(res => {
if (res.code === 0) {
this.list = Object.keys(res.data).map(v => {
return {
name: v,
list: res.data[v]
}
})
this.$nextTick(() => {
this.pageShow = true
})
}
this.$hideLoading()
})
}
},
onPageScroll (params) {
this.isFixed = params.scrollTop > 60
}
}
</script>
<style lang="scss" scoped>
<style lang="scss" socped>
.photo {
width: 100vw;
overflow-x: hidden;
padding-bottom: 130px;
div {
box-sizing: border-box;
}
.btn-wrapper {
display: flex;
align-items: center;
justify-content: space-between;
padding: 20px 32px!important;
.btn {
width: 328px;
background: #2D7DFF;
&:first-child {
background: #3BBC37;
}
}
}
.back-wrapper {
position: fixed;
z-index: 11;
left: 20px;
top: 24px;
width: 40px;
height: 40px;
image {
width: 40px;
height: 40px;
}
}
.header {
position: fixed;
left: 0;
top: 0;
z-index: 0;
width: 100%;
opacity: 0;
transition: all 0.2s ease;
&.header-active {
z-index: 1111;
opacity: 1;
background: linear-gradient(180deg, #2D7DFF 0%, #2D7DFF 40%);
}
.nav-bar {
position: relative;
height: 88px;
line-height: 88px;
color: #fff;
font-size: 32px;
text-align: center;
image {
position: absolute;
top: 0;
left: 0;
z-index: 1;
width: 40px;
height: 40px;
padding: 24px 20px 0 20px;
box-sizing: content-box;
}
}
}
.photo-header {
position: relative;
height: 400px;
padding: 150px 48px 0;
image {
position: absolute;
top: 0;
left: 0;
z-index: 1;
width: 100%;
height: 448px;
}
h2 {
position: relative;
z-index: 2;
margin-bottom: 16px;
font-weight: 700;
font-size: 64px;
color: #333333;
}
p {
z-index: 2;
width: 420px;
height: 80px;
line-height: 1.3;
font-size: 28px;
color: #658DC1;
}
}
.phone-wrapper {
margin-top: 90px;
padding: 0 32px;
& > h2 {
margin-bottom: 42px;
font-size: 34px;
font-weight: 600;
color: #333333;
}
.list {
display: flex;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
.item {
position: relative;
width: 336px;
height: 252px;
margin-bottom: 20px;
border-radius: 16px;
overflow: hidden;
& > span {
position: absolute;
top: 16px;
right: 16px;
z-index: 2;
width: 110px;
height: 48px;
line-height: 48px;
font-size: 26px;
text-align: center;
color: #FF883C;
background: rgba($color: #000000, $alpha: 0.8);
border-radius: 8px;
}
.bottom {
display: flex;
position: absolute;
justify-content: space-between;
bottom: 0;
left: 0;
z-index: 2;
width: 100%;
height: 80px;
padding: 28px 16px 0;
background-image: linear-gradient(180deg, rgba(0,0,0,0.00) 0%, #000000 100%);
border-radius: 0 0 16px 16px;
text-align: center;
color: #FF883C;
border-radius: 8px;
i {
font-size: 26px;
color: #FFFFFF;
}
span {
font-size: 26px;
color: #FFB94C;
}
}
image {
position: absolute;
top: 0;
left: 0;
z-index: 1;
width: 100%;
height: 100%;
}
}
}
}
}
</style>

View File

@@ -1,15 +1,353 @@
<template>
<div class="Activity">
<div class="photo">
<div class="header" :class="[isFixed ? 'header-active' : '']">
<div class="status-bar" :style="{height: statusBarHeight + 'px'}"></div>
<div class="nav-bar">
<image src="/static/img/left.png" @click="back"/>
<h2>随手拍</h2>
</div>
</div>
<div class="back-wrapper" @click="back" v-show="!isFixed" :style="{marginTop : statusBarHeight + 'px'}">
<image src="/static/img/left.png"/>
</div>
<div class="photo-header">
<image src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/photo-bg.png" />
<h2>随手拍</h2>
<p>将身边文明或不文明行为拍照上传即可获得积分奖励</p>
</div>
<div class="phone-wrapper">
<h2>我上传的</h2>
<div class="list">
<div class="item" v-for="(item, index) in 10" :key="index">
<image src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/photo-bg.png" />
<span>待审核</span>
<div class="bottom">
<i>10-15 19:25</i>
<span>积分+5</span>
</div>
</div>
</div>
</div>
<div class="btn-wrapper">
<div class="btn" @click="upload" hover-class="text-hover">拍照上传</div>
</div>
<AiLogin ref="login"/>
</div>
</template>
<script>
export default {
appName: '随手拍'
name: 'PhotoReport',
appName: '随手拍',
customNavigation: true,
data () {
return {
isFixed: false,
statusBarHeight: 20,
list: [],
hideStatus: false,
pageShow: false
}
},
onLoad () {
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight
},
methods: {
back () {
uni.navigateBack({
delta: 1
})
},
preview (url) {
let imgs = []
this.list.forEach(item => {
imgs = [...imgs, ...item.list.map(v => v.url)]
})
uni.previewImage({
urls: imgs,
current: url
})
},
upload () {
if (!this.token) {
this.$refs.login.show()
return false
}
this.imgList = []
this.hideStatus = false
uni.chooseImage({
count: this.limit,
sizeType: ['compressed'],
sourceType: ['album', 'camera'],
success: (res) => {
if (res.tempFilePaths.length > 9) {
this.$toast(`图片不能超过9张`)
return false
}
this.$loading('上传中')
res.tempFilePaths.forEach((item, index) => {
if (index === res.tempFilePaths.length - 1) {
this.hideStatus = true
}
this.$nextTick(() => {
this.uploadFile(item, res.tempFilePaths.length)
})
})
},
})
},
uploadFile (img, total) {
uni.uploadFile({
url: this.$instance.defaults.baseURL + '/admin/file/add',
filePath: img,
name: 'file',
header: {
'Content-Type': 'multipart/form-data',
Authorization: uni.getStorageSync('token'),
},
success: (res) => {
const data = JSON.parse(res.data)
if (data.code === 0) {
this.imgList.push(data.data[0].split(';')[0])
} else {
this.$toast(data.msg)
}
},
complete: () => {
this.$nextTick(() => {
if (this.imgList.length === total && this.hideStatus) {
this.$instance.post(`/app/appvillagepicturealbum/addPictures`, {
areaName: uni.getStorageSync('areaName'),
areaId: uni.getStorageSync('areaId'),
type: this.type,
urlList: this.imgList
}).then(res => {
if (res.code == 0) {
this.getList(this.type)
this.getTotalInfo(this.type)
uni.$emit('update')
}
this.$hideLoading()
this.hideStatus = false
})
}
})
}
})
},
getList (type) {
this.$instance.post(`/app/appvillagepicturealbum/queryAlbum?areaId=${uni.getStorageSync('areaId')}&type=${type}`).then(res => {
if (res.code === 0) {
this.list = Object.keys(res.data).map(v => {
return {
name: v,
list: res.data[v]
}
})
this.$nextTick(() => {
this.pageShow = true
})
}
this.$hideLoading()
})
}
},
onPageScroll (params) {
this.isFixed = params.scrollTop > 60
}
}
</script>
<style lang="scss" scoped>
<style lang="scss" socped>
.photo {
width: 100vw;
overflow-x: hidden;
padding-bottom: 130px;
div {
box-sizing: border-box;
}
.btn {
background: #2D7DFF;
}
.back-wrapper {
position: fixed;
z-index: 11;
left: 20px;
top: 24px;
width: 40px;
height: 40px;
image {
width: 40px;
height: 40px;
}
}
.header {
position: fixed;
left: 0;
top: 0;
z-index: 0;
width: 100%;
opacity: 0;
transition: all 0.2s ease;
&.header-active {
z-index: 1111;
opacity: 1;
background: linear-gradient(180deg, #2D7DFF 0%, #2D7DFF 40%);
}
.nav-bar {
position: relative;
height: 88px;
line-height: 88px;
color: #fff;
font-size: 32px;
text-align: center;
image {
position: absolute;
top: 0;
left: 0;
z-index: 1;
width: 40px;
height: 40px;
padding: 24px 20px 0 20px;
box-sizing: content-box;
}
}
}
.photo-header {
position: relative;
height: 400px;
padding: 150px 48px 0;
image {
position: absolute;
top: 0;
left: 0;
z-index: 1;
width: 100%;
height: 448px;
}
h2 {
position: relative;
z-index: 2;
margin-bottom: 16px;
font-weight: 700;
font-size: 64px;
color: #333333;
}
p {
z-index: 2;
width: 420px;
height: 80px;
line-height: 1.3;
font-size: 28px;
color: #658DC1;
}
}
.phone-wrapper {
margin-top: 90px;
padding: 0 32px;
& > h2 {
margin-bottom: 42px;
font-size: 34px;
font-weight: 600;
color: #333333;
}
.list {
display: flex;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
.item {
position: relative;
width: 336px;
height: 252px;
margin-bottom: 20px;
border-radius: 16px;
overflow: hidden;
& > span {
position: absolute;
top: 16px;
right: 16px;
z-index: 2;
width: 110px;
height: 48px;
line-height: 48px;
font-size: 26px;
text-align: center;
color: #FF883C;
background: rgba($color: #000000, $alpha: 0.8);
border-radius: 8px;
}
.bottom {
display: flex;
position: absolute;
justify-content: space-between;
bottom: 0;
left: 0;
z-index: 2;
width: 100%;
height: 80px;
padding: 28px 16px 0;
background-image: linear-gradient(180deg, rgba(0,0,0,0.00) 0%, #000000 100%);
border-radius: 0 0 16px 16px;
text-align: center;
color: #FF883C;
border-radius: 8px;
i {
font-size: 26px;
color: #FFFFFF;
}
span {
font-size: 26px;
color: #FFB94C;
}
}
image {
position: absolute;
top: 0;
left: 0;
z-index: 1;
width: 100%;
height: 100%;
}
}
}
}
}
</style>

View File

@@ -2,10 +2,14 @@
<div class="my">
<div class="user">
<image src="https://jisheng-xiaochengxu.oss-cn-hangzhou.aliyuncs.com/admin/5bad9165-fa6e-4c81-894d-2beae426260b.png" />
<div class="right">
<div class="right" v-if="isLogin">
<h2>张三</h2>
<p>文明天府星市民 Lv.1</p>
</div>
<div class="right" v-else @click="toLogin">
<h2>登录</h2>
<p>点击进行登录</p>
</div>
</div>
<div class="info">
<div class="info-item">
@@ -37,14 +41,190 @@
</template>
<script>
import { mapActions, mapState } from 'vuex'
export default {
appName: '我的',
name: 'AppMy'
name: 'AppMy',
data () {
return {
}
},
computed: {
...mapState(['user', 'token']),
isLogin () {
return !!this.user.id
}
},
onLoad () {
console.log(this.user)
console.log(this.token)
},
methods: {
...mapActions(['autoLogin', 'getUserInfo', 'getToken', 'getCode']),
login () {
return new Promise(function (resolve, reject) {
uni.login({
success: function (res) {
if (res.code) {
resolve(res)
} else {
reject(res)
}
},
fail: function () {
reject(false)
}
})
})
},
toLogin () {
wx.getUserProfile({
desc: '用于完善会员资料',
lang: 'zh_CN',
success: data => {
this.$loading()
this.getCode().then(res => {
this.getToken({
...data.userInfo,
code: res
}).then(e => {
console.log(e)
this.$hideLoading()
}).catch(() => {
this.$hideLoading()
})
})
}
})
}
}
}
</script>
<style lang="scss" scoped>
.my {
padding-top: 32px;
padding-bottom: 30px;
.user, .info {
display: flex;
align-items: center;
padding: 0 48px;
}
.user {
line-height: 1;
margin-bottom: 48px;
image {
width: 112px;
height: 112px;
margin-right: 32px;
border-radius: 50%;
border: 4px solid #FFFFFF;
}
p {
color: #8891A1;
font-size: 26px;
}
h2 {
margin-bottom: 18px;
font-weight: 600;
font-size: 34px;
color: #1D2229;
}
}
.my-list {
padding: 0 32px;
& > h2 {
margin-bottom: 42px;
font-weight: 600;
font-size: 34px;
color: #333333;
}
.item {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 24px;
padding: 24px;
background: #FFFFFF;
box-shadow: 0 0 8px 0 rgba(0,0,0,0.02);
border-radius: 16px;
.right {
display: flex;
align-items: baseline;
line-height: 1;
i {
color: #FFB94C;
font-size: 32px;
}
span {
color: #FFB94C;
font-size: 40px;
}
em {
font-size: 26px;
color: #999999;
}
}
.left {
flex: 1;
margin-right: 20px;
h2 {
line-height: 1.3;
margin-bottom: 10px;
font-size: 34px;
color: #333333;
}
p {
font-size: 26px;
color: #999999;
}
}
}
}
.info {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 58px;
.info-item {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 28px;
width: 192px;
height: 112px;
color: #4D5596;
div:last-child {
color: #316568;
}
}
}
}
</style>

View File

@@ -5,6 +5,15 @@ import instance from "dvcp-wui/utils/http";
instance.defaults.baseURL = setting.baseUrl
instance.interceptors.request.use(config => {
if (config.baseURL === 'http://192.168.1.87:12421') {
config.url = '/api' + config.url.replace(/(app|auth|admin)\//, "")
}
console.log(config)
return config
})
instance.interceptors.response.use(response => {
util.$hideLoading();
if (response.data.code === 1) {

View File

@@ -16,7 +16,7 @@ const configs = {
dev: {
areaId: '341021104000',
areaName: '郑村镇',
baseUrl: 'http://192.168.1.87:9000'
baseUrl: 'http://192.168.1.87:12421'
}
}
// 当前选中配置