Răsfoiți Sursa

上传文件

hmp 4 ani în urmă
părinte
comite
2f072520c7

+ 7 - 2
common/http/http.api.js

@@ -3,11 +3,16 @@ let wxInfoUrl = {
 	getUserInfoUrl: '/wx/getUserInfo'
 }
 
+//文件上传
+const uploadFile={
+	submit:p => http.upload('/putObject', {name:'file',filePath:p}),
+}
+
 let activityUrl = {
 	adsListUrl: '/cyzh-ads/ads/list',
 	listUrl: '/cyzh-activity/activity/selectPageWithTag',
 	detailUrl: '/cyzh-activity/activity/detail',
-	rankListUrl: '/cyzh-userActivityStatistical/useractivitystatistical/rank'
+	rankListUrl: '/cyzh-userActivityStatistical/useractivitystatistical/list'
 }
 
 let userUrl = {
@@ -35,7 +40,7 @@ const install = (Vue, vm) => {
 		detail:(params = {}) => vm.$u.post(userUrl.detailUrl, params),
 	}
 	// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
-	vm.$u.api = {wxInfo, activity, user};
+	vm.$u.api = {wxInfo,uploadFile, activity, user};
 }
 
 export default {

+ 4 - 2
common/http/http.interceptor.js

@@ -1,5 +1,7 @@
- let baseUrl = 'https://vote.guosen-fumao.cn/ldt/api'
-   // let baseUrl = 'http://192.168.1.168:9612'
+import Global from '../utils/global.js'
+
+let baseUrl=Global.baseUrl
+
 let tokenUrl = `${baseUrl}/blade-auth/oauth/token?tenantId=000000&username=admin&password=21232f297a57a5a743894a0e4a801fc3&grant_type=password&scope=all&type=account`
 
 let myConfig={}

+ 6 - 0
common/utils/global.js

@@ -0,0 +1,6 @@
+let global = {
+	baseUrl: 'https://vote.guosen-fumao.cn/ldt/api'
+	// baseUrl: 'http://192.168.1.168:9612'
+}
+
+export default global

+ 27 - 0
common/utils/mpi.js

@@ -0,0 +1,27 @@
+import Global from './global.js'
+let mpi = {}
+
+//选择图片 res.tempFilePaths[0]
+mpi.uploadFile = (count=1) => {
+  return new Promise((resolve, reject)=>{
+	uni.chooseFile({
+	  count, //默认100
+	  type:'all',
+	    success: function (res) {
+			uni.uploadFile({
+				url:`${Global.baseUrl}/putObject`, //仅为示例,非真实的接口地址
+				filePath: res.tempFilePaths[0],
+				name: 'file',
+				success: (uploadFileRes) => {
+					resolve(uploadFileRes.data)
+				},
+				fail:()=>{
+					reject(err)
+				}
+			});
+	    }
+	});
+  })
+}
+
+export default mpi

+ 1 - 1
common/utils/utils.js

@@ -8,4 +8,4 @@ export const getUrlParams = (url) => {
 	    }
 	}
 	return theRequest;
-}
+}

+ 6 - 4
components/homeViews/activity-view.vue

@@ -17,7 +17,7 @@
 		<view class="margin-top-sm bg-white flex justify-around align-end" style="height: 350upx;">
 			<view class="second text-center" @click="navWithParm(rankList[1].userId)" v-if="!$u.test.isEmpty(rankList[1])">
 				<view class="margin-top-sm">
-					<u-avatar :src="rankList[1].avatar" size="120"></u-avatar>
+					<u-avatar :src="rankList[1].loginWebVO.avatar" size="120"></u-avatar>
 				</view>
 				<view class="text-bold text-lg text-black">{{rankList[1].totalHotValue}}</view>
 				<view class="flex justify-center">
@@ -29,7 +29,7 @@
 			</view>
 			<view class="first text-center" @click="navWithParm(rankList[0].userId)" v-if="!$u.test.isEmpty(rankList[0])">
 				<view class="margin-top-sm">
-					<u-avatar :src="rankList[0].avatar" size="130"></u-avatar>
+					<u-avatar :src="rankList[0].loginWebVO.avatar" size="130"></u-avatar>
 				</view>
 				<view class="margin-top-xs text-bold text-lg text-black">{{rankList[0].totalHotValue}}</view>
 				<view class="flex justify-center">
@@ -41,7 +41,7 @@
 			</view>
 			<view class="third text-center" @click="navWithParm(rankList[2].userId)" v-if="!$u.test.isEmpty(rankList[2])">
 				<view class="margin-top-sm">
-					<u-avatar :src="rankList[2].avatar" size="120"></u-avatar>
+					<u-avatar :src="rankList[2].loginWebVO.avatar" size="120"></u-avatar>
 				</view>
 				<view class="text-bold text-lg text-black">{{rankList[2].totalHotValue}}</view>
 				<view class="flex justify-center">
@@ -57,7 +57,7 @@
 				<view class="flex justify-around align-center">
 					<view class="padding-right text-black text-bold">{{index + 4}}</view>
 					<view class="padding-right">
-						<u-avatar :src="item.avatar" size="130"></u-avatar>
+						<u-avatar :src="item.loginWebVO.avatar" size="130"></u-avatar>
 					</view>
 					<view>
 						<view class="text-bold text-black">{{item.name}}</view>
@@ -117,12 +117,14 @@
 		methods: {
 			getActivityDetail() {
 				this.$u.api.activity.detail({id: this.activityId}).then(res => {
+					console.log(res);
 					this.activity = res;
 				})
 			},
 			getRankList() {
 				this.$u.api.activity.rankList({activityId: this.activityId}).then(res => {
 					this.rankList = res.records;
+					console.log(this.rankList);
 				})
 			},
 			navByIcon(path, index) {

+ 8 - 0
main.js

@@ -6,6 +6,14 @@ Vue.use(uView);
 
 Vue.config.productionTip = false
 
+// 微信函数封装
+import mpi from './common/utils/mpi.js'
+Vue.prototype.$mpi = mpi
+
+//全局变量
+import Global from './common/utils/global.js'
+Vue.prototype.$global = Global
+
 App.mpType = 'app'
 
 const app = new Vue({

+ 11 - 4
pages/activityList/activity/signUp.vue

@@ -1,6 +1,6 @@
 <template>
 	<view>
-		<view class="image-container">
+		<view class="image-container" @click="upload">
 			<view class="cuIcon-roundaddfill theme-color" style="font-size: 80upx;padding: 100upx 0 30upx 0;"></view>
 			<view class="text-black text-bold text-sm">添加图片或视频</view>
 		</view>
@@ -15,21 +15,21 @@
 				</block>
 			</view>
 			<view class="padding-sm">
-				<text class="text-black text-bold text-lg padding-left-sm">歌手名字</text>
+				<text class="text-black text-bold text-lg padding-left-sm">{{detail.personTitle}}</text>
 				<view style="padding: 30upx 20upx;">
 					<u-input v-model="name" placeholder="请输入歌手名字" />
 				</view>
 				<view style="padding: 0 20upx 40upx 20upx;">
 					<u-line color="#e3e3e3" />
 				</view>
-				<text class="text-black text-bold text-lg padding-left-sm">歌曲名称</text>
+				<text class="text-black text-bold text-lg padding-left-sm">{{detail.productionTitle}}</text>
 				<view style="padding: 30upx 20upx;">
 					<u-input v-model="music" placeholder="请输入歌曲名称" />
 				</view>
 				<view style="padding: 0 20upx 40upx 20upx;">
 					<u-line color="#e3e3e3" />
 				</view>
-				<text class="text-black text-bold text-lg padding-left-sm">个人简介</text>
+				<text class="text-black text-bold text-lg padding-left-sm">{{detail.introductionTitle}}</text>
 				<view style="padding: 30upx 20upx 0 20upx;">
 					<u-input v-model="introduction" type="textarea" :clearable="false" height="140" :autoHeight="false" maxlength="60" placeholder="请输入个人简介" />
 				</view>
@@ -49,6 +49,7 @@
 	export default {
 		data() {
 			return {
+				detail:{},
 				current: 0,
 				classification: [],
 				name: '',
@@ -60,8 +61,14 @@
 			this.getActivityDetail(options.activityId);
 		},
 		methods: {
+			upload(){
+				this.$mpi.uploadFile().then(res=>{
+					console.log(res.data);
+				})
+			},
 			getActivityDetail(id) {
 				this.$u.api.activity.detail({id: id}).then(res => {
+					this.detail=res
 					this.classification = res.classification.split(',');
 				})
 			},