issue.vue 6.0 KB

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