Commit d471713a authored by liwei's avatar liwei

对接了部分接口,修改了上传接口

parent 6d0fd306
import {request} from '../../util/api'
// 活动列表
export function activityList(query) {
export function activityList(data) {
return request({
url:'/app/cmsActivity/queryCmsActivityByPagination',
data: query,
url:'/app/open/cmsActivity/queryCmsActivityByPagination',
data: data,
method: 'GET',
})
}
......@@ -12,7 +12,7 @@ export function activityList(query) {
//活动详情
export function activityDetail(id) {
return request({
url:'/app/cmsActivity/detail/'+id,
url:'/app/open/cmsActivity/detail/'+id,
method: 'GET',
})
}
......
import {request} from '../../util/api'
......@@ -3,7 +3,7 @@ import {request} from '../../util/api'
// banner列表
export function bannerList(query) {
return request({
url: '/app/cmsbanner/queryCmsBannerByPagination',
url: '/app/open/cmsBanner/queryCmsBannerByPagination',
data: query,
method: 'GET',
})
......
......@@ -3,7 +3,7 @@ import {request} from '../../util/api'
// 公告列表
export function noticeList(query) {
return request({
url:'/app/cmsNotice/queryCmsNoticeByPagination',
url:'/app/open/cmsNotice/queryCmsNoticeByPagination',
data:query,
method: 'GET',
})
......@@ -12,7 +12,7 @@ export function noticeList(query) {
// 公告详情
export function noticeDetail(id) {
return request({
url:'/app/cmsNotice/detail/'+id,
url:'/app/open/cmsNotice/detail/'+id,
method: 'GET',
})
}
import {request} from '../../util/api'
/**
* 用户列表
*/
export function userList(data){
return request({
method: "get",
url: '/app/open/memInfo/list',
data
});
}
......@@ -12,7 +12,7 @@
<view class="card" v-for="(item,index) in activityList" :key="index" @click="gotopage(item)">
<view class="contentBody">
<view class="leftlist">
<image :src="baseUrl+'/index/gonggao.png'" class="leftlistimage"/>
<image :src="item.path" class="leftlistimage"/>
</view>
<view class="rightlist">
<view class="rightlist-title">{{item.title}}</view>
......@@ -119,12 +119,12 @@ export default {
//获取公告列表
getBannerList() {
const query = {
page:this.queryParam.page,
rows:this.queryParam.rows
page: this.queryParam.page,
rows: this.queryParam.rows
}
bannerList(query).then(res =>{
//将res.data.rows集合里的bannerPicture取出来,放到集合中
this.bannerList = res.data.data.map(item => item.bannerPicture)
//将res.data.rows集合里的bannerPicture取出来,放到集合中 将\替换成/
this.bannerList = res.data.data.map(item => item.path.replace(/\\/g, '/'));
}).catch(e => {
console.log(e)
})
......@@ -136,7 +136,11 @@ export default {
rows:this.queryParam.rows
}
activityList(query).then(res =>{
this.activityList = res.data.data
console.log('res.data.data:',res.data.data)
this.activityList = res.data.data.map(item => ({
...item, // 复制对象中的所有属性
path: item.path != null ? item.path.replace(/\\/g, '/') : ''// 替换 avatarUrl 中的所有 \ 为 /
}));
}).catch(e => {
console.log(e)
})
......
This diff is collapsed.
......@@ -26,6 +26,7 @@
<script>
import ELM from '@/components/elm-toast/index.vue';
import {uploadPublic} from '../api/article/index'
export default {
components: {
ELM
......@@ -50,45 +51,23 @@
}
},
methods: {
//发布
submit() {
this.form.img = this.fileList.map(item => {
return item.url
})
this.form.img = this.fileList.map(item => item.url )
if (!this.form.content && !this.fileList.length) {
this.tipMsg = '请输入内容或上传图片后再点击发布'
this.$refs.elm.showDialog();
return;
}
// this.$myRequest({
// url: 'nostalgia/article/add',
// data: this.form,
// withToken: true,
// withLoading: true,
// method: 'post',
// }).then(res => {
// if (res.data.code == "200") {
// uni.setStorageSync("isRefresh", true)
// uni.navigateBack({
// delta: 1
// })
// } else if (res.data.code == "10006") {
// this.isLoginPop=true
// } else {
// this.tipMsg = res.data.msg
// this.$refs.elm.showDialog();
// return;
// }
// })
},
// 删除图片
deletePic(event) {
this[`fileList${event.name}`].splice(event.index, 1)
},
// 新增图片
async afterRead(event) {
afterRead(event) {
// 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
let lists = [].concat(event.file)
console.log(lists, "lists");
let fileListLen = this.fileList.length
lists.map((item) => {
this.fileList.push({
......@@ -97,9 +76,8 @@
message: '上传中'
})
})
console.log(lists, "lists");
for (let i = 0; i < lists.length; i++) {
const result = await this.uploadFilePromise(lists[i])
const result = this.uploadFilePromise(lists[i])
let item = this.fileList[fileListLen]
this.fileList.splice(fileListLen, 1, Object.assign(item, {
status: 'success',
......@@ -109,16 +87,19 @@
fileListLen++
}
},
//上传图片
uploadFilePromise(file) {
let self = this
return new Promise((resolve, reject) => {
let arr = file.url.split('.')
uni.uploadFile({
url: self.$BASE_URL + '/file/lasting/upload',
url: this.$BASE_URL + '/common/fileUpload',
filePath: file.url,
header: {
Authorization: uni.getStorageSync("token"),
},
formData: {
file: file,//你要传的临时文件
temp: 'opmArticle'
},
header: {
Authorization: 'Bearer ' + uni.getStorageSync("token"),
},
name: 'file',
success: (uploadFileRes) => {
let data = JSON.parse(uploadFileRes.data)
......@@ -138,117 +119,6 @@
this.h = 0
this.focus = false
},
getUserInfo(e) {
if (e == 0) {
this.isLoginPop = false;
return;
}
// #ifdef MP-WEIXIN
try {
wx.getUserProfile({
desc: '用于完善会员资料',
success: resinfo => {
wx.login({
success: res => {
if (res.code) {
console.log(res.code, resinfo);
this.setCode(res.code, resinfo);
} else {}
},
fail: err => {}
});
},
fail: errinfo => {
this.setCode(this.generateRandomString(10), 'null');
}
});
} catch {
wx.getUserInfo({
success: resinfo => {
wx.login({
success: res => {
if (res.code) {
console.log(res.code, resinfo);
this.setCode(res.code, resinfo);
} else {}
},
fail: err => {}
});
},
fail: errinfo => {}
});
}
// #endif
// #ifndef MP-WEIXIN
this.setCode("ip", 'null');
// #endif
},
async setCode(code, resinfo) {
const res = await this.$myRequest({
url: 'token/wxAppletLogin',
data: {
code: code
},
method: 'POST'
});
console.log(res, 'delshoucang');
var obj = {
code: code,
state: res.data.code,
nickName: resinfo != 'null' ? resinfo.userInfo.nickName : "匿名用户"
};
uni.setStorageSync('verification', obj);
if (res.data.code == 200) {
this.isLoginPop = false;
this.isConfirm = true;
this.tipMsg = "登录成功";
this.$refs.elm.showDialog();
var info = {
birthday: res.data.data.info.birthday,
city: res.data.data.info.city,
gender: res.data.data.info.gender,
headPortrait: res.data.data.info.headPortrait,
id: res.data.data.info.id,
nickName: res.data.data.info.nickName
};
uni.setStorageSync('info', info);
uni.setStorageSync('token', res.data.data.token);
} else if (res.data.code == 11002) {
this.isLoginPop = false;
uni.reLaunch({
url: '/pagesintroduction/selfIntroduction?code=' + code
});
} else {
this.tipMsg = res.data.msg;
this.$refs.elm.showDialog();
}
},
generateRandomString(length) {
let result = uni.getStorageSync('touristopenid');
if (result != null&&result!="") {
return result;
}else{
result='';
}
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; // 包含大小写字母和数字的所有字符集合
for (let i = 0; i < length; i++) {
const randomIndex = Math.floor(Math.random() * characters.length);
result += characters[randomIndex];
}
var now = new Date();
var year = now.getFullYear(); // 年份
var month = (now.getMonth() + 1).toString().padStart(2, '0'); // 月份(注意要加上1)
var day = now.getDate().toString().padStart(2, '0'); // 天数
var hours = now.getHours().toString().padStart(2, '0'); // 小时
var minutes = now.getMinutes().toString().padStart(2, '0'); // 分钟
var seconds = now.getSeconds().toString().padStart(2, '0'); // 秒数
result = "touristopenid" + result + (+year + month + day + hours + minutes + seconds);
uni.setStorageSync('touristopenid', result);
return result;
}
}
}
</script>
......
<template>
<view class="annocumentdetail">
<view class="title">{{form.title}}</view>
<view class="title">{{noticeDetail.title}}</view>
<view class="body">
<view class="time">{{form.publishDate}}</view>
<view class="time">{{noticeDetail.publishDate}}</view>
<!-- <view class="body-num">-->
<!-- <image class="image" src=""/>-->
<!-- <view class="num" v-if="form.viewNum">{{form.viewNum}}人浏览</view>-->
<!-- <view class="num" v-if="noticeDetail.viewNum">{{noticeDetail.viewNum}}人浏览</view>-->
<!-- <view class="num" v-else>0人浏览</view>-->
<!-- </view>-->
</view>
<view>
<view v-html="form.details" class="detail-box"></view>
<view v-html="noticeDetail.details" class="detail-box"></view>
</view>
</view>
</template>
......@@ -24,7 +24,7 @@
//公告id
noticeId:'',
//公告详情
form: {
noticeDetail: {
title:'',
pushTime:'',
details:''
......@@ -43,7 +43,9 @@
getNoticeDetail() {
const id = this.noticeId
noticeDetail(id).then(res =>{
this.form = res.data.data
this.noticeDetail = res.data.data
this.noticeDetail.details = res.data.data.details.replace(/\<img/gi,
'<img style="max-width:100%;height:auto;border-radius: 12px 12px 12px 12px;" ')
}).catch(e => {
console.log(e)
})
......
This diff is collapsed.
......@@ -9,19 +9,19 @@
<view class="card">
<view class="recommendation-card" v-for="item in userList" @click="gotoDetail(item)">
<view class="card-image">
<image class="img" src="https://cdn.uviewui.com/uview/album/1.jpg"/>
<image class="img" :src="item.avatarUrl"/>
</view>
<view class="card-bottom">
<view class="bottom-left">
<view class="bottom-info">
{{item.nickName}}
<image v-if="item.gender == 'MALE'" class="gender" src="../static/images/like/male.png" mode=""/>
{{item.memNickName}}
<image v-if="item.memSex == '0'" class="gender" src="../static/images/like/male.png" mode=""/>
<image v-else class="gender" src="../static/images/like/famale.png" mode=""/>
</view>
<view class="bottom-info">
{{item.age}}
{{ 18 }}
<text style="margin-left: 10rpx;margin-right: 10rpx;color: #BBB9B9FF;">|</text>
{{item.height}}cm
{{item.memHeight}}cm
</view>
<view class="bottom-address">{{item.address}}</view>
</view>
......@@ -33,61 +33,19 @@
</template>
<script>
import {userList} from "../api/user";
let util = require('@/util/means.js');
export default {
data() {
return {
//分页查询参数
queryParam:{
page:1,
rows:10
},
//用户列表
userList:[
{
businessId:'1',
nickName:'暖洋洋',
gender:'FEMALE',
age:'21',
height:'165',
address:'重庆市'
},
{
businessId:'2',
nickName:'暖洋洋',
gender:'MALE',
age:'21',
height:'165',
address:'重庆市'
},
{
businessId:'3',
nickName:'暖洋洋',
gender:'MALE',
age:'21',
height:'165',
address:'重庆市'
},
{
businessId:'4',
nickName:'暖洋洋',
gender:'FEMALE',
age:'21',
height:'165',
address:'重庆市'
},
{
businessId:'5',
nickName:'暖洋洋',
gender:'FEMALE',
age:'21',
height:'165',
address:'重庆市'
},
{
businessId:'6',
nickName:'暖洋洋',
gender:'FEMALE',
age:'21',
height:'165',
address:'重庆市'
},
],
userList:[],
//是否有数据
isdata: false,
//页面数据的数量
......@@ -116,6 +74,7 @@ export default {
this.navHeight = (height + statusBarHeight + (margin * 3)) //导航栏总高
}
})
//获取用户信息
this.getUserList()
},
methods: {
......@@ -125,53 +84,22 @@ export default {
url: '/pagesUser/userInfo?id='+item.businessId
})
},
//加载数据
getUserList(){
const list = [
{
nickName:'暖洋洋',
gender:'FEMALE',
age:'21',
height:'165',
address:'重庆市'
},
{
nickName:'暖洋洋',
gender:'MALE',
age:'21',
height:'165',
address:'重庆市'
},
{
nickName:'暖洋洋',
gender:'MALE',
age:'21',
height:'165',
address:'重庆市'
},
{
nickName:'暖洋洋',
gender:'FEMALE',
age:'21',
height:'165',
address:'重庆市'
},
{
nickName:'暖洋洋',
gender:'FEMALE',
age:'21',
height:'165',
address:'重庆市'
},
{
nickName:'暖洋洋',
gender:'FEMALE',
age:'21',
height:'165',
address:'重庆市'
},
]
this.userList = list
getUserList() {
const query = {
page: this.queryParam.page,
rows: this.queryParam.rows
}
userList(query).then(res =>{
// 假设 res.data.data 是从服务器接收到的数据
this.userList = res.data.data.map(item => ({
...item, // 复制对象中的所有属性
avatarUrl: item.avatarUrl.replace(/\\/g, '/') // 替换 avatarUrl 中的所有 \ 为 /
}));
console.log('this.userList:',this.userList)
}).catch(e => {
console.log(e)
})
},
backbar() {
uni.navigateBack({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment