video.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976
  1. <template>
  2. <view class="content">
  3. <header-title :title="'视频'+$test.$test"></header-title>
  4. <view class="main-video">
  5. <view class="">
  6. <form @submit="Submit">
  7. <view class="main-home-video">
  8. <view class="box-pack-between ft32 item flex-y-center border-b">
  9. <text>视频{{$test.$test}}<text class="red">*</text></text>
  10. <view class="ft24 item-off flex">
  11. <view class="flex-grow-1 flex-center" @click="bindchecks" :data-index="index" v-for="(item,index) of switch_list"
  12. :key="index" :class="index==act_index?'act':''">{{item.name}}</view>
  13. </view>
  14. </view>
  15. <view>
  16. <view v-if="video_url" class="video_content">
  17. <video :src="video_url" controls></video>
  18. <image @click="delUrl" class="video_content_del" src="../../static/images/shanchu.png" mode=""></image>
  19. </view>
  20. <view v-else class="video_content flex-center" @click="chooseVideo">
  21. <image class="video_content_add" src="../../static/images/add-video.png" mode=""></image>
  22. </view>
  23. </view>
  24. </view>
  25. <FlowPool :thismoshi="moshi" :rule_arr_val="ruleArr" :this_moshi_type="moshi_type" :list_way="list_way" @ondel="binddel"
  26. @oncheck="bindcheck" @onTime='bindtime' @confirm="bindConfirm" @bindlevel="bindlevel"></FlowPool>
  27. <view class="main-home-video" v-if="moshi==1">
  28. <view class="box-pack-between ft32 item">
  29. <text>{{$test.$test}}场景</text>
  30. <picker class="flex-center add-home ft24" @change="bindPickerChange" :value="index" :range-key="'name'" :range="allwayList">
  31. 添加
  32. </picker>
  33. </view>
  34. <view class="item-bg" v-if="arr.length>0">
  35. <view class="box-pack-between mar64 flex-y-center" :key='index' v-for="(item,index) of arr">
  36. <view class="flex-y-center flex-grow-1 pdr-20">
  37. <text style="margin-right: 10rpx;">{{item.name}}</text>
  38. <input class="flex-grow-1" type="text" @input="getScene" :data-index="index" placeholder="请填写链接或内容" :value="item.way_power"
  39. maxlength="5000" />
  40. </view>
  41. <image class="item-del" @click="delScene" :data-index='index' src="../../static/images/del.png" mode=""></image>
  42. </view>
  43. </view>
  44. </view>
  45. <view class="main-home-video">
  46. <view class="box-pack-between ft32 item">
  47. <text>视频内容</text>
  48. <view class="flex-center ft24">
  49. <switch :checked="video_state==1?true:false" name="video_state" @change="switch1" style="transform:scale(0.7)" />
  50. </view>
  51. </view>
  52. <view class="item-bg" v-if="video_state==1">
  53. <view class="box-pack-between mgr57">
  54. <view class="flex-row flex-grow-1">
  55. <text class="item-bg-32">视频标题</text>
  56. <input class="flex-grow-1" type="text" :value="info.video_title" name="video_title" placeholder="请填写视频标题" />
  57. </view>
  58. </view>
  59. <view class="box-pack-between mgr57">
  60. <view class="flex-row flex-grow-1">
  61. <text class="item-bg-32">视频描述</text>
  62. <input class="flex-grow-1" type="text" :value="info.video_desc" name="video_desc" placeholder="请填写视频描述" />
  63. </view>
  64. </view>
  65. <view class="box-pack-between mgr57">
  66. <view class="flex-row flex-grow-1">
  67. <text class="item-bg-32">点赞数量</text>
  68. <input type="number" class="flex-grow-1" maxlength="9" :value="info.video_zan" name="video_zan" placeholder="请填写视频点赞数量" />
  69. </view>
  70. </view>
  71. <view class="box-pack-between mgr57">
  72. <view class="flex-row flex-grow-1">
  73. <text class="item-bg-32">评论数量</text>
  74. <input class="flex-grow-1" type="number" maxlength="9" :value="info.video_ping" name="video_ping" placeholder="请填写视频评论数量" />
  75. </view>
  76. </view>
  77. <view class="box-pack-between mgr57">
  78. <view class="flex-row flex-grow-1">
  79. <text class="item-bg-32">联系电话</text>
  80. <input class="flex-grow-1" type="number" maxlength="11" :value="info.video_tel " name="video_tel" placeholder="请填写联系电话" />
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. <view class="main-home-video">
  86. <view class="box-pack-between ft32 item">
  87. <text>跳转广告</text>
  88. <view class=" flex-center ft24">
  89. <switch name="jump_state" :checked="jump_state==1?true:false" @change="switch2" style="transform:scale(0.7)" />
  90. </view>
  91. </view>
  92. <view class="item-bg" v-if="jump_state==1">
  93. <view class="box-pack-between ft32 flex-y-center flex-grow-1" style="margin-bottom: 57rpx;">
  94. <text>跳转平台</text>
  95. <view class="ft24 item-off flex">
  96. <view class="flex-grow-1 flex-center" @click="bindjump(item.type)" :data-index="index"
  97. v-for="(item,index) of xcx_list"
  98. :key="index" :class="item.type==jump_type?'act':''">{{item.name}}</view>
  99. </view>
  100. </view>
  101. <view v-if="jump_type==1" class="box-pack-between mgr57">
  102. <view class="flex-row flex-grow-1">
  103. <text class="item-bg-32">广告网址 </text>
  104. <input class="flex-grow-1" type="text" name="jump_web" placeholder="请填写http/https开头的网址"
  105. :value="info.jump_web" />
  106. </view>
  107. </view>
  108. <block v-else>
  109. <view class="box-pack-between mgr57">
  110. <view class="flex-row flex-grow-1">
  111. <text class="item-bg-32">原始id</text>
  112. <input class="flex-grow-1" type="text" name="xcx_original_id" placeholder="请填写微信小程序原始id"
  113. :value="info.xcx_original_id" />
  114. </view>
  115. </view>
  116. <view class=" mgr57">
  117. <view class="box-pack-between">
  118. <view class="flex-row flex-grow-1">
  119. <view class="item-bg-32 flex-y-center" style="margin-right: 10rpx;"> <text>跳转路径 </text>
  120. <image class="zhiyin" @click="look" src="../../static/images/tip.png"
  121. mode=""></image> </view>
  122. <input class="flex-grow-1" type="text" name="xcx_link" placeholder="小程序路径(不填默认跳转首页)" :value="info.xcx_link" />
  123. </view>
  124. </view>
  125. <!-- <view class="ft22" style="text-align: right;"></view> -->
  126. </view>
  127. </block>
  128. <view class=" flex-row mgr57 flex-grow-1">
  129. <text class="item-bg-32 ">广告标题</text>
  130. <input class="flex-grow-1" type="text" name="jump_title" placeholder="请填写广告标题" :value="info.jump_title" />
  131. </view>
  132. <view class=" flex-row mgr57 flex-grow-1">
  133. <text class="item-bg-32">广告描述</text>
  134. <input class="flex-grow-1" type="text" name="jump_cont" placeholder="请填写广告描述" :value="info.jump_cont" />
  135. </view>
  136. <view class="box-pack-between flex-y-center">
  137. <text class="item-bg-32">广告内容</text>
  138. <image v-if="jump_img" @click="ChooseImage" :data-type="1" class="upimg" :src="URL+jump_img" mode="">
  139. </image>
  140. <image v-else @click="ChooseImage" :data-type="1" class="upimg" src="../../static/images/upimg.png" mode="">
  141. </image>
  142. </view>
  143. </view>
  144. </view>
  145. <view class="main-home-video">
  146. <view class="box-pack-between ft32 item">
  147. <text>配置微信文章分享</text>
  148. <view class=" flex-center ft24">
  149. <switch name="wx_state" :checked="wx_state==1?true:false" @change="switch3" style="transform:scale(0.7)" />
  150. </view>
  151. </view>
  152. <view class="item-bg" v-if="wx_state==1">
  153. <view class="box-pack-between mgr57">
  154. <view class="flex-row flex-grow-1">
  155. <text class="item-bg-32">分享标题 </text>
  156. <input class="flex-grow-1" type="text" name="wx_title" placeholder="请填写分享标题" :value="info.wx_title" />
  157. </view>
  158. </view>
  159. <view class=" flex-row mgr57 flex-grow-1">
  160. <text class="item-bg-32">分享描述</text>
  161. <input class="flex-grow-1" type="text" name="wx_desc" placeholder="请填写分享描述" :value="info.wx_desc" />
  162. </view>
  163. <view class="box-pack-between flex-y-center">
  164. <text class="item-bg-32">分享图标</text>
  165. <image v-if="wx_img" @click="ChooseImage" :data-type="2" class="upimg" :src="URL+wx_img" mode="">
  166. </image>
  167. <image v-else @click="ChooseImage" :data-type="2" class="upimg" src="../../static/images/upimg.png" mode="">
  168. </image>
  169. </view>
  170. </view>
  171. </view>
  172. <!-- <view class="box-pack-between ft32 item">
  173. <text>开启遮盖指引</text>
  174. <view class="flex-center ft24">
  175. <switch :checked="hj_state==1?true:false" name="hj_state" style="transform:scale(0.7)" />
  176. </view>
  177. </view> -->
  178. <view class="box-pack-between ft32 item main-home-video">
  179. <view class="flex-center">
  180. <text>加入换量记录池</text>
  181. </view>
  182. <view class=" flex-center ft24">
  183. <switch name="is_exchange" :checked="is_exchange=='Y'?true:false" style="transform:scale(0.7)" />
  184. </view>
  185. </view>
  186. <view class="box-pack-between ft32 item main-home-video">
  187. <view class="flex-center">
  188. <text>加入视频专区交流</text>
  189. </view>
  190. <view class=" flex-center ft24">
  191. <switch name="is_interflow" :checked="is_interflow==1?true:false" style="transform:scale(0.7)" />
  192. </view>
  193. </view>
  194. <view class="bottom-bar">
  195. <block v-if="card_num">
  196. <button form-type="submit" data-status="2" class="btn2 flex-center">
  197. 确定修改
  198. </button>
  199. </block>
  200. <block v-else>
  201. <button form-type="submit" data-status="2" class="btn1 flex-center">
  202. {{$test.$test}}视频
  203. </button>
  204. </block>
  205. </view>
  206. </form>
  207. </view>
  208. </view>
  209. </view>
  210. </template>
  211. <script>
  212. import HeaderTitle from '@/components/header/header-title.vue';
  213. import FlowPool from '@/components/flow-pool/flow-pool.vue';
  214. export default {
  215. components: {
  216. HeaderTitle,
  217. FlowPool,
  218. },
  219. data() {
  220. return {
  221. $test: this.$test.$test,
  222. switch_list: [{
  223. name: "本地上传"
  224. }, {
  225. name: "智能抓取"
  226. }, ],
  227. xcx_list: [{
  228. name: "网站",
  229. type: 1,
  230. }, {
  231. name: "小程序",
  232. type: 2,
  233. }, ],
  234. jump_type: 1,
  235. act_index: 0,
  236. arr: [],
  237. allwayList: [],
  238. index: 0,
  239. video_state: 1,
  240. // video_title:"",// 视频标题
  241. // video_desc:"" ,//视频描述
  242. // video_zan:"" , //视频点赞
  243. // video_ping:"", //视频评论
  244. // video_tel:"", //视频电话
  245. hj_state: 1,
  246. URL: getApp().globalData.URL,
  247. jump_state: 1,
  248. jump_img: "",
  249. wx_state: 1,
  250. wx_img: '',
  251. info: {},
  252. video_url: "",
  253. card_num: "",
  254. is_video: 1,
  255. is_exchange: 'N', is_interflow:0,
  256. video_otherurl: "",
  257. moshi: 1,
  258. moshi_type: 2,
  259. list_way: [],
  260. ruleArr: [],
  261. powerpool_id: "",
  262. level_arr: [1, 2, 3],
  263. level: "",
  264. rule: "",
  265. }
  266. },
  267. onLoad(e) {
  268. uni.removeStorageSync("list_way");
  269. this.level = this.level_arr.join(",");
  270. this.card_num = e.card_num;
  271. uni.setNavigationBarTitle({
  272. title: `视频${this.$test.$test}`
  273. })
  274. this.allways();
  275. },
  276. onShow() {
  277. var that = this,
  278. is_video, video_otherurl;
  279. is_video = this.is_video;
  280. video_otherurl = this.video_otherurl;
  281. // #ifdef MP-WEIXIN
  282. var pages = getCurrentPages();
  283. var currPage = pages[pages.length - 1]; //当前页面
  284. is_video = currPage.data.is_video;
  285. video_otherurl = currPage.data.video_otherurl;
  286. // #endif
  287. // console.log(is_video,"is_video",video_otherurl)
  288. if (is_video == 2) {
  289. var video = uni.getStorageSync("video_url") || "";
  290. this.is_video = is_video;
  291. this.act_index = video ? 1 : 0;
  292. this.video_url = video;
  293. this.video_otherurl = video_otherurl;
  294. }
  295. if (uni.getStorageSync("list_way")) {
  296. this.list_way = uni.getStorageSync("list_way");
  297. if (this.way_index == 3) {
  298. for (let i of this.list_way) {
  299. if (i.checked) {
  300. this.powerpool_id = i.id
  301. }
  302. }
  303. }
  304. }
  305. },
  306. onUnload() {
  307. this.is_video == 2 ? "" : uni.removeStorageSync("video_url")
  308. },
  309. onHide() {
  310. this.is_video == 2 ? "" : uni.removeStorageSync("video_url")
  311. },
  312. methods: {
  313. look() {
  314. uni.showModal({
  315. title: '温馨提示',
  316. content: '微信小程序页面路径必须添加.html后缀,如pages/home/index.html',
  317. showCancel: false,
  318. cancelText: '',
  319. confirmText: '好的',
  320. success: res => {},
  321. fail: () => {},
  322. complete: () => {}
  323. });
  324. },
  325. // 跳转小程序选择
  326. bindjump(index) {
  327. this.jump_type = index;
  328. },
  329. // 流量池
  330. bindcheck(index) {
  331. uni.removeStorageSync("list_way");
  332. this.moshi = index;
  333. },
  334. binddel(index) {
  335. this.list_way.splice(index, 1);
  336. },
  337. bindtime(index) {
  338. console.log("000", index)
  339. this.list_way = [];
  340. uni.removeStorageSync("list_way");
  341. this.moshi_type = index == 1 ? 1 : 2;
  342. this.way_index = index;
  343. if (index == 1) {
  344. uni.navigateTo({
  345. url: "../public/index"
  346. })
  347. }
  348. // 默认流量池
  349. if (index == 3) {
  350. uni.navigateTo({
  351. url: "../public/index?type=2"
  352. })
  353. }
  354. },
  355. // 获取时间
  356. bindConfirm(rule) {
  357. console.log(rule, "aff")
  358. this.rule = rule;
  359. },
  360. bindlevel(e) {
  361. console.log(e, "bindlevel")
  362. var level = [];
  363. for (var i of e) {
  364. level.push(i.level)
  365. }
  366. this.level = level.join(",");
  367. },
  368. // 流量池end
  369. delUrl(e) {
  370. this.video_url = "";
  371. uni.removeStorageSync("video_url")
  372. },
  373. getVideo(e) {
  374. this.video_url = e.detail.value;
  375. },
  376. getup(e) {
  377. this.request({
  378. url: "videofuneng/video_down",
  379. data: {
  380. url: this.video_url,
  381. },
  382. }).then(res => {
  383. console.log(res, "res")
  384. if (res.code === '200') {
  385. this.video_url = res.data.video_url
  386. }
  387. }).catch((res) => {});
  388. },
  389. switch1(e) {
  390. this.video_state = e.target.value ? 1 : 2;
  391. },
  392. switch2(e) {
  393. this.jump_state = e.target.value ? 1 : 2;
  394. },
  395. switch3(e) {
  396. this.wx_state = e.target.value ? 1 : 2;
  397. },
  398. chooseVideo(e) {
  399. // 上传视频
  400. uni.chooseVideo({
  401. maxDuration: 60,
  402. sourceType: ['album', 'camera'],
  403. success: (responent) => {
  404. let videoFile = responent.tempFilePath;
  405. this.Upload({
  406. url: "videofuneng/video_upload",
  407. data: {
  408. url: videoFile,
  409. type: 0,
  410. token: uni.getStorageSync("token"),
  411. }
  412. }).then(res => {
  413. console.log(res, "res")
  414. this.video_url = res.video_url;
  415. this.is_video = 1;
  416. }).catch({
  417. });
  418. }
  419. })
  420. },
  421. bindchecks(e) {
  422. var index = e.currentTarget.dataset.index;
  423. this.act_index = index;
  424. if (index == 1) {
  425. uni.navigateTo({
  426. url: "/pages/jihuo/getVideo"
  427. })
  428. } else {
  429. // this.video_otherurl = "";
  430. uni.removeStorageSync("video_url")
  431. }
  432. },
  433. getScene(e) {
  434. var index = e.currentTarget.dataset.index;
  435. this.arr[index].way_power = e.detail.value
  436. },
  437. delScene(e) {
  438. var index = e.currentTarget.dataset.index;
  439. this.arr.splice(index, 1)
  440. },
  441. bindPickerChange: function(e) {
  442. if (this.arr.length > 0) {
  443. for (let i of this.arr) {
  444. if (i.id == this.allwayList[e.target.value].id) {
  445. uni.showToast({
  446. title: "场景重复",
  447. icon: 'none'
  448. })
  449. return
  450. }
  451. }
  452. }
  453. this.arr.push({
  454. id: this.allwayList[e.target.value].id,
  455. name: this.allwayList[e.target.value].name,
  456. super_id: this.allwayList[e.target.value].super_id,
  457. });
  458. },
  459. allways() {
  460. this.request({
  461. url: "funeng/allways",
  462. data: {},
  463. }).then(res => {
  464. console.log(res, "res")
  465. if (res.code === '200') {
  466. this.allwayList = res.data;
  467. this.arr.push({
  468. id: res.data[0].id,
  469. name: res.data[0].name,
  470. super_id: res.data[0].super_id,
  471. });
  472. if (this.card_num) {
  473. this.edit_detail();
  474. }
  475. }
  476. }).catch((res) => {});
  477. },
  478. edit_detail(e) {
  479. this.request({
  480. url: "videofuneng/funeng_detailnew",
  481. data: {
  482. card_num: this.card_num,
  483. token: uni.getStorageSync("token"),
  484. },
  485. }).then(res => {
  486. console.log(res, "res")
  487. if (res.code === '200') {
  488. if (res.data.video_otherurl) {
  489. this.getup(res.data.video_otherurl);
  490. } else {
  491. this.video_url = res.data.video_url;
  492. }
  493. this.hj_state = res.data.hj_state;
  494. this.info = res.data;
  495. this.mid_img = res.data.mid_img;
  496. this.arr = res.data.funeng;
  497. this.jump_img = res.data.jump_img; //跳转图片
  498. this.jump_state = res.data.jump_state;
  499. this.wx_state = res.data.wx_state;
  500. this.wx_img = res.data.wx_img;
  501. this.jump_type= res.data.jump_type;
  502. this.video_state = res.data.video_state;
  503. this.hj_state = res.data.hj_state;
  504. this.id = res.data.id;
  505. // console.log(res.data.video_url, "res.data.video_url")
  506. // this.video_url = res.data.video_url;
  507. this.is_exchange = res.data.is_exchange;
  508. this.is_interflow= res.data.is_interflow;
  509. this.is_video = res.data.video_otherurl ? 2 : 1;
  510. this.video_otherurl = res.data.video_otherurl;
  511. this.moshi = res.data.moshi;
  512. this.moshi_type = res.data.moshi_type;
  513. this.ruleArr = res.data.rule_arr;
  514. if (this.moshi == 2) {
  515. if (this.moshi_type == 2) {
  516. var a = []
  517. for (let i of res.data.rule_arr) {
  518. a.push(i.type)
  519. }
  520. // 去除重复的数
  521. var b = []
  522. for (var i = 0; i < a.length; i++) {
  523. if (b.indexOf(a[i]) === -1) {
  524. b.push(a[i])
  525. }
  526. }
  527. this.level = b.join(",");
  528. this.powerpool_id = res.data.powerpool_id;
  529. }
  530. for (let i of res.data.powerpool) {
  531. i.checked = true;
  532. }
  533. this.list_way = res.data.powerpool;
  534. }
  535. }
  536. }).catch((res) => {});
  537. },
  538. getup(url) {
  539. this.request({
  540. url: "videofuneng/video_down",
  541. data: {
  542. url: url,
  543. },
  544. }).then(res => {
  545. console.log(res, "res")
  546. if (res.code === '200') {
  547. this.video_url = res.data.video_url;
  548. this.video_face = res.data.video_face;
  549. this.video_index = res.data.video_index;
  550. }
  551. }).catch((res) => {
  552. uni.showToast({
  553. title: res.message,
  554. icon: 'none'
  555. })
  556. });
  557. },
  558. Choose_img(e) {
  559. var url = e.currentTarget.dataset.url
  560. // 预览图片
  561. uni.previewImage({
  562. urls: [url],
  563. })
  564. },
  565. ChooseImage(e) {
  566. console.log(e, "eeeeeee")
  567. let type = e.currentTarget.dataset.type;
  568. uni.chooseImage({
  569. count: 1, //默认9
  570. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  571. sourceType: ['album'], //从相册选择
  572. success: (res) => {
  573. console.log(res)
  574. // type==1?this.descURL1 = res.tempFilePaths[0]:this.descURL2 = res.tempFilePaths[0]
  575. var tempFilesSize = res.tempFiles[0].size; //获取图片的大小,单位B
  576. if (type == 2 && tempFilesSize > 1000000) { //图片小于或者等于2M时 可以执行获取图片
  577. uni.showToast({
  578. title: '上传图片不能大于1M!', //标题
  579. icon: 'none' //图标 none不使用图标,详情看官方文档
  580. })
  581. return
  582. }
  583. var path;
  584. // #ifdef MP-WEIXIN
  585. path = res.tempFiles[0].path;
  586. // #endif
  587. // #ifdef H5
  588. path = res.tempFiles[0].name;
  589. // #endif
  590. var formatImage = path.split(".")[(path.split(".")).length - 1];
  591. if (type == 2) {
  592. if (formatImage != "png" && formatImage != "jpg" && formatImage != "jpeg") {
  593. uni.showToast({
  594. title: '只能上传png、jpg、jpeg格式',
  595. icon: 'none',
  596. duration: 2000,
  597. mask: true,
  598. })
  599. return
  600. }}
  601. res.tempFilePaths.forEach((v, i) => {
  602. console.log(v)
  603. this.Upload({
  604. url: "Spread/upload_img",
  605. data: {
  606. url: v,
  607. type: 0,
  608. token: uni.getStorageSync("token"),
  609. }
  610. }).then(res => {
  611. console.log(res, "res")
  612. type == 1 ? (
  613. this.jump_img = res.file
  614. ) : (
  615. this.wx_img = res.file
  616. )
  617. }).catch(err => {
  618. uni.showToast({
  619. title: err.message,
  620. icon: 'none'
  621. })
  622. });
  623. })
  624. },
  625. });
  626. },
  627. Submit(e) {
  628. console.log(e, this.is_video, this.video_otherurl, "ggg")
  629. let arr = this.arr,
  630. way_id = [],
  631. way_power = [];
  632. for (let i of arr) {
  633. way_id.push(i.id);
  634. way_power.push(i.way_power)
  635. }
  636. if (way_id.length <= 0) {
  637. uni.showToast({
  638. title: "场景为空",
  639. icon: 'none'
  640. })
  641. return
  642. }
  643. if (this.moshi == 2 && this.moshi_type == 2 && !this.rule) {
  644. uni.showToast({
  645. title: "请设置规则",
  646. icon: 'none'
  647. })
  648. return
  649. }
  650. if (e.detail.value.wx_state==1&&!e.detail.value.wx_title) {
  651. uni.showToast({
  652. title: "分享标题不能为空",
  653. icon: 'none'
  654. })
  655. return
  656. }
  657. if (e.detail.value.video_state==1&&!e.detail.value.video_title) {
  658. uni.showToast({
  659. title: "标题不能为空",
  660. icon: 'none'
  661. })
  662. return
  663. }
  664. if (e.detail.value.jump_state&&this.jump_type==1 && !e.detail.value.jump_web) {
  665. uni.showToast({
  666. title: "请填写网址链接",
  667. icon: 'none'
  668. })
  669. return
  670. }
  671. if (e.detail.value.jump_state&&this.jump_type==2 && !e.detail.value.xcx_original_id) {
  672. uni.showToast({
  673. title: "请填写原始id",
  674. icon: 'none'
  675. })
  676. return
  677. }
  678. var powerpool_id = "";
  679. if (this.moshi_type == 1) {
  680. var powerpool_arr = [];
  681. for (let i of this.list_way) {
  682. if (i.checked) {
  683. powerpool_arr.push(i.id);
  684. }
  685. }
  686. powerpool_id = powerpool_arr.join(",");
  687. } else {
  688. powerpool_id = this.powerpool_id;
  689. }
  690. let data = e.detail.value;
  691. data.id = this.id;
  692. data.video_otherurl = this.is_video == 2 ? this.video_otherurl : '';
  693. data.token = uni.getStorageSync("token");
  694. data.video_url = this.video_url; //视频地址,
  695. data.way_id = way_id.join(","); //通道id
  696. data.way_power = way_power.join(","); //赋能内容
  697. data.jump_img = this.jump_img; //跳转图片
  698. data.wx_img = this.wx_img; //分享图片
  699. data.type = 6;
  700. data.save_type = 2;
  701. data.video_state = e.detail.value.video_state ? 1 : 2;
  702. data.hj_state = 1; //1开启2不开启
  703. data.jump_state = e.detail.value.jump_state ? 1 : 2;
  704. data.wx_state = e.detail.value.wx_state ? 1 : 2;
  705. data.is_exchange = e.detail.value.is_exchange ? 'Y' : 'N';
  706. data.is_interflow = e.detail.value.is_interflow?1:0;
  707. data.jump_type=this.jump_type;
  708. data.moshi = this.moshi;
  709. data.moshi_type = this.moshi_type;
  710. data.powerpool_id = powerpool_id;
  711. data.level = this.level;
  712. data.rule = this.rule;
  713. let url;
  714. this.card_num ? (data.code = this.info.code, url = "videofuneng/save_edit") : url = "videofuneng/video";
  715. this.request({
  716. url,
  717. data,
  718. }).then(res => {
  719. console.log(res, "res")
  720. if (res.code === '200') {
  721. this.card_num ? (
  722. uni.showToast({
  723. title: "设置成功",
  724. icon: 'none'
  725. }),
  726. setTimeout(() => {
  727. uni.navigateBack({
  728. delta: 1
  729. })
  730. }, 2e3)
  731. ) : (
  732. uni.showToast({
  733. title: res.message,
  734. icon: 'none'
  735. }),
  736. uni.redirectTo({
  737. url: "code?type=6" + '&card_num=' + res.data.card_num
  738. })
  739. )
  740. }
  741. }).catch((res) => {
  742. uni.showToast({
  743. title: res.message,
  744. icon: 'none'
  745. })
  746. });
  747. }
  748. },
  749. }
  750. </script>
  751. <style>
  752. .zhiyin {
  753. width: 40rpx;
  754. height: 40rpx;
  755. }
  756. .item {
  757. padding: 32rpx 0rpx;
  758. }
  759. .border-b {}
  760. .red {
  761. color: red;
  762. }
  763. .main-home-video {
  764. width: 670rpx;
  765. margin: 0 auto;
  766. }
  767. .item-off {
  768. width: 252rpx;
  769. height: 54rpx;
  770. background: #fff;
  771. border-radius: 8rpx;
  772. color: #3387ff;
  773. border: 2rpx solid #3387ff;
  774. }
  775. .item-off .act {
  776. background: #3387ff;
  777. color: #FFFFFF;
  778. }
  779. .video_content {
  780. width: 670rpx;
  781. height: 320rpx;
  782. margin: 32rpx 0;
  783. position: relative;
  784. }
  785. .video_content .video_content_del {
  786. width: 50rpx;
  787. height: 50rpx;
  788. position: absolute;
  789. top: 0;
  790. right: -2rpx;
  791. z-index: 999;
  792. }
  793. .video_content video {
  794. width: 100%;
  795. height: 100%;
  796. }
  797. .video_content .video_content_add {
  798. width: 250rpx;
  799. height: 160rpx;
  800. }
  801. .item-bg {
  802. width: 670rpx;
  803. background: #f6f8fe;
  804. border-radius: 12rpx;
  805. margin: 0 auto;
  806. font-size: 28rpx;
  807. font-family: PingFang SC, PingFang SC-Regular;
  808. font-weight: 400;
  809. color: #333333;
  810. padding: 36rpx 32rpx;
  811. }
  812. .item-del {
  813. width: 40rpx;
  814. height: 40rpx;
  815. }
  816. .item-bg-32 {
  817. margin-right: 32rpx;
  818. }
  819. .mgr57 {
  820. margin-bottom: 57rpx;
  821. }
  822. .item-bg .mgr57:last-child {
  823. margin-bottom: 0rpx;
  824. }
  825. .add-home {
  826. color: #FFFFFF;
  827. width: 126rpx;
  828. height: 54rpx;
  829. background: linear-gradient(315deg, #3387ff 2%, #569bff 99%);
  830. border-radius: 8rpx;
  831. box-shadow: 0px 0px 8rpx 0px rgba(51, 135, 255, 0.2);
  832. }
  833. .upimg {
  834. width: 126rpx;
  835. height: 126rpx;
  836. }
  837. .bottom-bar {
  838. margin-top: 30rpx;
  839. }
  840. .mar64 {
  841. margin-bottom: 30rpx;
  842. }
  843. .item-bg .mar64:last-child {
  844. margin-bottom: 0rpx;
  845. }
  846. .btm-btn {
  847. width: 670rpx;
  848. height: 98rpx;
  849. background: linear-gradient(315deg, #3387ff 2%, #569bff 99%);
  850. border-radius: 8rpx;
  851. box-shadow: 0px 0px 8rpx 0px rgba(51, 135, 255, 0.2);
  852. font-size: 32rpx;
  853. font-weight: 500;
  854. text-align: center;
  855. color: #fff;
  856. line-height: 98rpx;
  857. margin: 0 auto;
  858. margin-top: 30rpx;
  859. }
  860. .getVideo {
  861. width: 670rpx;
  862. }
  863. .getVideo textarea {
  864. background: #ffffff;
  865. border-radius: 8rpx;
  866. box-shadow: 0px 0px 14rpx 0px rgba(162, 180, 203, 0.25);
  867. height: 250rpx;
  868. width: 100%;
  869. padding: 20rpx;
  870. }
  871. </style>