issue.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <template>
  2. <view>
  3. <u-navbar title="发布内容" back-icon-name="close" ref="refNavbar" >
  4. <view class="slot-wrap"
  5. :class="{
  6. 'slot-wrap-a':true,
  7. 'slot-wrap-b':subForm.synopsis&&itemshare.label
  8. }"
  9. @click="selectvideo()">
  10. 发布
  11. </view>
  12. </u-navbar>
  13. <textarea placeholder="记录点滴生活..."
  14. v-model="subForm.synopsis"
  15. name="" id="" cols="30" rows="10"></textarea>
  16. <view class="upload">
  17. <u-upload-file ref="uUpload" :action="action" :form-data="formData" :header="header"
  18. :file-list="fileList" ></u-upload-file>
  19. </view>
  20. <view class="select">
  21. <view class="join">
  22. <text class="sign">#</text>
  23. <text class="text">参与活动</text>
  24. </view>
  25. <view class="choose" @click="selectshare" >
  26. <text >{{itemshare.label?itemshare.label:'选择活动'}}</text>
  27. <u-icon name="arrow-right"></u-icon>
  28. </view>
  29. </view>
  30. <view class="bottom" v-if="false" >
  31. <button>发布作品</button>
  32. </view>
  33. <u-select v-model="showshare" :default-value=[itemshare.index?itemshare.index:0] @confirm="confirmshare"
  34. value-name="index" label-name="title"
  35. :list="listshare"></u-select>
  36. </view>
  37. </template>
  38. <script>
  39. import * as API from '@/apis/pagejs/activity.js'
  40. import * as API_share from '@/apis/pagejs/share.js'
  41. export default {
  42. data() {
  43. return {
  44. listshare:[],
  45. itemshare:{},
  46. showshare:false,
  47. action:"",
  48. formData:{},
  49. fileList:[],
  50. header:{
  51. },
  52. listForm:{
  53. pageIndex:1,
  54. pageSize:50,
  55. status:'7d69d622-3785-470e-b36c-d0f155b79dfa',
  56. },
  57. subForm:{
  58. },
  59. }
  60. },onLoad(op) {
  61. this.action=process.car.BASE_URL+"uploadPicture"
  62. this.formData.subFolder="mineissue"
  63. //接口应该免登陆
  64. var token=this.carhelp.getToken()
  65. this.header={
  66. 'Authorization':token
  67. }
  68. // //获取微信配置
  69. // WxJsApi.getWxConfig(['getLocation','addEventListener']).then((res)=>{
  70. // this.isReady=true;
  71. // //(res)
  72. // }).catch(error => {
  73. // //(res)
  74. // })
  75. if(op.id){
  76. this.itemshare.id=op.id;
  77. this.itemshare.index=-1;
  78. }
  79. this.getShareList()
  80. },
  81. methods:{
  82. confirmshare(es){
  83. var e=es[0]
  84. this.itemshare=e
  85. this.itemshare.index=e.value;
  86. },
  87. getShareList(){
  88. uni.showLoading({
  89. title: "加载中",
  90. mask: true,
  91. })
  92. API.pageList(this.listForm).then((res) => {
  93. uni.hideLoading();
  94. this.listshare = res.data.data;
  95. for(var i in this.listshare){
  96. var item=this.listshare[i]
  97. item.index=i;
  98. if(this.itemshare.index==-1){
  99. if(item.id==this.itemshare.id){
  100. this.confirmshare([{value:i,label:item.title}])
  101. }
  102. }
  103. }
  104. }).catch(error => {
  105. uni.showToast({
  106. title: error,
  107. icon: "none"
  108. })
  109. })
  110. },
  111. selectshare(){
  112. this.showshare=true;
  113. },
  114. selectvideo(){
  115. if(this.subForm.synopsis&&this.itemshare.label){
  116. }else{
  117. return
  118. }
  119. this.subForm.activityId=this.listshare[this.itemshare.value].id;
  120. var lists = this.$refs.uUpload.lists;
  121. console.log(lists)
  122. var urls=[]
  123. var isPics=[]
  124. for(var i in lists){
  125. var p =lists[i].response.data;
  126. var fileName=p.fileName
  127. urls.push(p.fileUrl)
  128. if(fileName.indexOf('.mp4')>=0){
  129. isPics.push(false)
  130. }else{
  131. isPics.push(true)
  132. }
  133. }
  134. this.subForm.urls=urls.join()
  135. this.subForm.isPics=isPics.join()
  136. uni.showLoading({
  137. title: "加载中",
  138. mask: true,
  139. })
  140. API_share.addShare(this.subForm).then((res) => {
  141. uni.hideLoading();
  142. uni.showModal({
  143. title:"提示",
  144. content:"操作成功",
  145. confirmText:"前往分享空间",
  146. cancelText:"返回",
  147. success: res1 => {
  148. this.carhelp.set("addShare",1);
  149. if (res1.confirm) {
  150. uni.redirectTo({
  151. url:"/pages/staffHome/filesonic"
  152. })
  153. }else{
  154. this.$refs.refNavbar.goBack()
  155. }
  156. }})
  157. }).catch(error => {
  158. uni.showToast({
  159. title: error,
  160. icon: "none"
  161. })
  162. })
  163. }
  164. }
  165. }
  166. </script>
  167. <style scoped lang="scss">
  168. .bottom{
  169. padding: 16rpx 32rpx;
  170. background-color: #fff;
  171. position: fixed;
  172. bottom: 0;
  173. left: 0;
  174. right: 0;
  175. uni-button{
  176. border-radius: 8px;
  177. background-color: rgba(31, 74, 153, 1);
  178. color: rgba(255, 255, 255, 1);
  179. font-size: 16px;
  180. line-height: 40px;
  181. }
  182. }
  183. page{
  184. background-color: #fff;
  185. }
  186. /deep/.u-slot-content {
  187. display: block;
  188. text-align: right !important;
  189. margin-right: 16px;
  190. color: #333333;
  191. }
  192. /deep/.uicon-close{
  193. font-size: 32rpx !important;
  194. color: #101010 !important;
  195. }
  196. .slot-wrap-a{
  197. }
  198. .slot-wrap-b{
  199. background-color: #03a9f4 !important;
  200. }
  201. .slot-wrap{
  202. background-color: rgba(204, 204, 204, 1);
  203. width: 104rpx;
  204. height:56rpx;
  205. line-height:56rpx ;
  206. border-radius: 8px;
  207. color: #fff;
  208. text-align: center;
  209. position: absolute;
  210. top: 50%;
  211. right: 32rpx;
  212. transform: translateY(-50%);
  213. }
  214. uni-textarea{
  215. width: 100%;
  216. text-indent: 28rpx;
  217. padding-top:28rpx;
  218. }
  219. .upload{
  220. padding: 32rpx;
  221. /deep/.u-add-tips{
  222. display: none;
  223. }
  224. }
  225. .select{
  226. display: flex;
  227. justify-content: space-between;
  228. padding: 0 32rpx;
  229. height: 56px;
  230. line-height: 56px;
  231. .join{
  232. color: rgba(16, 16, 16, 1);
  233. font-size: 16px;
  234. .sign{
  235. color: #1F4A99;
  236. margin-right: 8rpx;
  237. }
  238. }
  239. .choose{
  240. text{
  241. margin-right: 8rpx;
  242. }
  243. color: rgba(153, 153, 153, 1);
  244. }
  245. }
  246. </style>