123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310 |
- <template>
- <view>
- <u-navbar title="发布内容" back-icon-name="close" ref="refNavbar" >
- <view class="slot-wrap"
- :class="{
- 'slot-wrap-a':true,
- 'slot-wrap-b':subForm.synopsis&&itemshare.label
- }"
- @click="selectvideo()">
- 发布
- </view>
- </u-navbar>
-
- <textarea placeholder="记录点滴生活..."
- v-model="subForm.synopsis"
- name="" id="" cols="30" rows="10"></textarea>
-
- <view class="upload">
-
- <u-upload-file ref="uUpload" :action="action"
- :max-size="50 * 1024 * 1024"
- :form-data="formData" :header="header"
- :file-list="fileList" ></u-upload-file>
- </view>
-
- <view class="select">
- <view class="join">
- <text class="sign">#</text>
- <text class="text">参与活动</text>
- </view>
- <view class="choose" @click="selectshare" >
- <text >{{itemshare.label?itemshare.label:'选择活动'}}</text>
- <u-icon name="arrow-right"></u-icon>
- </view>
- </view>
- <view class="bottom" v-if="false" >
- <button>发布作品</button>
- </view>
- <u-select v-model="showshare" :default-value=[itemshare.index?itemshare.index:0] @confirm="confirmshare"
- value-name="index" label-name="title"
- :list="listshare"></u-select>
- </view>
- </template>
- <script>
- import * as API from '@/apis/pagejs/activity.js'
- import * as API_share from '@/apis/pagejs/share.js'
-
- export default {
- data() {
- return {
- listshare:[],
- itemshare:{},
- showshare:false,
- action:"",
- formData:{},
- fileList:[],
- header:{
-
- },
- nic:0,
- listForm:{
- pageIndex:1,
- pageSize:50,
- status:'7d69d622-3785-470e-b36c-d0f155b79dfa',
-
- },
- subForm:{
-
- },
- }
- },onLoad(op) {
- this.action=process.car.BASE_URL+"uploadPicture"
-
- this.formData.subFolder="mineissue"
- //接口应该免登陆
- var token=this.carhelp.getToken()
-
- this.header={
-
- 'Authorization':token
- }
- // //获取微信配置
- // WxJsApi.getWxConfig(['getLocation','addEventListener']).then((res)=>{
-
- // this.isReady=true;
- // //(res)
-
- // }).catch(error => {
- // //(res)
- // })
- if(op.id){
- this.itemshare.id=op.id;
- this.itemshare.index=-1;
- }
- if(op.nic){
- this.nic=op.nic;
- }
- this.getShareList()
- },
- methods:{
- confirmshare(es){
-
- var e=es[0]
- this.itemshare=e
- this.itemshare.index=e.value;
- },
- getShareList(){
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
-
- API.pageList(this.listForm).then((res) => {
-
- uni.hideLoading();
- this.listshare = res.data.data;
-
- for(var i in this.listshare){
- var item=this.listshare[i]
- item.index=i;
- if(this.itemshare.index==-1){
-
- if(item.id==this.itemshare.id){
- this.confirmshare([{value:i,label:item.title}])
-
- }
- }
- }
-
-
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- selectshare(){
- this.showshare=true;
- },
- selectvideo(){
- if(this.subForm.synopsis&&this.itemshare.label){
-
- }else{
- return
- }
- this.subForm.activityId=this.listshare[this.itemshare.value].id;
- var lists = this.$refs.uUpload.lists;
- console.log(lists)
- var urls=[]
- var isPics=[]
-
- for(var i in lists){
- var p =lists[i].response.data;
- var fileName=p.fileName
- urls.push(p.fileUrl)
- if(fileName.indexOf('.mp4')>=0){
- isPics.push(false)
- }else{
- isPics.push(true)
- }
- }
- this.subForm.urls=urls.join()
- this.subForm.isPics=isPics.join()
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
-
- API_share.addShare(this.subForm).then((res) => {
-
- uni.hideLoading();
- if(this.nic){
- uni.showModal({
- showCancel:false,
- title:"提示",
- content:"操作成功",
-
- cancelText:"确定",
- success: res1 => {
- this.carhelp.set("addShare",1);
- this.$refs.refNavbar.goBack()
-
- }})
- }else{
- uni.showModal({
-
- title:"提示",
- content:"操作成功",
- confirmText:"前往分享空间",
- cancelText:"返回",
- success: res1 => {
- this.carhelp.set("addShare",1);
- if (res1.confirm) {
- uni.redirectTo({
- url:"/pages/staffHome/filesonic"
- })
- }else{
- this.$refs.refNavbar.goBack()
- }
-
-
-
- }})
- }
-
-
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .bottom{
- padding: 16rpx 32rpx;
- background-color: #fff;
- position: fixed;
- bottom: 0;
- left: 0;
- right: 0;
- uni-button{
- border-radius: 8px;
- background-color: rgba(31, 74, 153, 1);
- color: rgba(255, 255, 255, 1);
- font-size: 16px;
- line-height: 40px;
-
- }
-
- }
- page{
- background-color: #fff;
- font-family: 'Regular';
- }
- /deep/.u-slot-content {
- display: block;
- text-align: right !important;
- margin-right: 16px;
- color: #333333;
-
- }
- /deep/.uicon-close{
- font-size: 32rpx !important;
- color: #101010 !important;
- }
- .slot-wrap-a{
-
- }
- .slot-wrap-b{
- background-color: #03a9f4 !important;
- }
-
- .slot-wrap{
- background-color: rgba(204, 204, 204, 1);
- width: 104rpx;
- height:56rpx;
- line-height:56rpx ;
- border-radius: 8px;
-
- color: #fff;
- text-align: center;
- position: absolute;
- top: 50%;
- right: 32rpx;
- transform: translateY(-50%);
- }
- uni-textarea{
- width: 100%;
- text-indent: 28rpx;
- padding-top:28rpx;
- font-family: Microsoft Yahei;
- }
- .upload{
- padding: 32rpx;
- /deep/.u-add-tips{
- display: none;
- }
- }
- .select{
- display: flex;
- justify-content: space-between;
- padding: 0 32rpx;
- height: 56px;
- line-height: 56px;
- .join{
-
- color: rgba(16, 16, 16, 1);
- font-size: 16px;
- .sign{
- color: #1F4A99;
- margin-right: 8rpx;
- }
-
- }
- .choose{
- text{
- margin-right: 8rpx;
- }
- color: rgba(153, 153, 153, 1);
- }
- }
- </style>
|