issue.vue 6.0 KB

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