detail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. <template>
  2. <My_listbox ref="List" @getlist="getDetail">
  3. <swiper class="swiper" v-if="slides.length" :indicator-dots="slides.length > 1" indicator-color="#DC808B"
  4. indicator-active-color="#C30D23">
  5. <swiper-item class="swiper-item" v-for="item in slides" :key="item.url">
  6. <image class="image" :src="item.cover" mode="aspectFill" lazy-load="true" />
  7. <view class="qrcode" @click="saveQrcode">
  8. <text class="iconfont icon-xiazai" />
  9. 二维码
  10. </view>
  11. </swiper-item>
  12. </swiper>
  13. <view class="head">
  14. <view class="line1">
  15. <view class="left">
  16. <text class="iconfont icon-biaoqian" />
  17. {{ detail.renderingstype }}
  18. </view>
  19. <view class="right" hover-class="navigator-hover"
  20. @click="collectLoading ? '' : handleCollect(detail.iscollect)">
  21. <u-loading-icon v-if="collectLoading" size="20" />
  22. <block v-else>
  23. <text v-if="detail.iscollect == 0" class="iconfont icon-weishoucang" />
  24. <text v-else class="iconfont icon-yishoucang" style="color: #FFC300;" />
  25. 收藏
  26. </block>
  27. </view>
  28. </view>
  29. <view class="title">{{ detail.title }}</view>
  30. <view class="subtitle" v-if="detail.subtitle">{{ detail.subtitle }}</view>
  31. </view>
  32. <view class="introduce">
  33. <view class="introduce-title">
  34. 产品介绍
  35. </view>
  36. <view class="introduce-text">
  37. {{ detail.notes }}
  38. </view>
  39. </view>
  40. <bottom1 />
  41. <view style="position: absolute;z-index: -999;top: 0;">
  42. <l-painter ref="painter" hidden css="padding:10px;background:#fff;width: 148px;">
  43. <l-painter-view>
  44. <l-painter-view css="margin: 0 auto;width: 128px;">
  45. <l-painter-qrcode :text="detail.appleturl" css="width: 128px; height: 128px;color:#000;" />
  46. </l-painter-view>
  47. <l-painter-view css="width: 108px;text-align: center;margin: 10px auto 0;">
  48. <l-painter-text :text="detail.title" />
  49. </l-painter-view>
  50. </l-painter-view>
  51. </l-painter>
  52. </view>
  53. </My_listbox>
  54. </template>
  55. <script>
  56. import bottom1 from "../../components/bottomModules/bottom1.vue"
  57. import lPainter from "../../uni_modules/lime-painter/components/l-painter/l-painter.vue"
  58. import lPainterText from "../../uni_modules/lime-painter/components/l-painter-text/l-painter-text.vue"
  59. import lPainterView from "../../uni_modules/lime-painter/components/l-painter-view/l-painter-view.vue"
  60. import lPainterQrcode from "../../uni_modules/lime-painter/components/l-painter-qrcode/l-painter-qrcode.vue"
  61. export default {
  62. components: { bottom1, lPainter, lPainterQrcode, lPainterText, lPainterView },
  63. data() {
  64. return {
  65. sat_sharematerialid: null,
  66. detail: {},
  67. slides: [],
  68. collectLoading: false
  69. }
  70. },
  71. onLoad(options) {
  72. this.sat_sharematerialid = options.id;
  73. this.getDetail();
  74. },
  75. methods: {
  76. getDetail() {
  77. this.$Http.basic({
  78. "id": 20240415164302,
  79. "content": {
  80. "sat_sharematerialid": this.sat_sharematerialid
  81. },
  82. }).then(res => {
  83. this.$refs.List.RefreshToComplete()
  84. console.log("获取效果图详情", res)
  85. if (this.cutoff(res.msg)) return;
  86. this.detail = res.data;
  87. this.slides = res.data.attinfos_pic.map(v => {
  88. return {
  89. cover: this.getSpecifiedImage(v.attinfos[0]),
  90. url: v.attinfos[0].url
  91. }
  92. })
  93. uni.setNavigationBarTitle({
  94. title: res.data.title
  95. });
  96. })
  97. },
  98. handleCollect(iscollect) {
  99. this.collectLoading = true;
  100. this.$Http.basic({
  101. "id": 20240416133702,
  102. "content": {
  103. "ownertable": "sat_sharematerial",
  104. "ownerid": this.detail.sat_sharematerialid,
  105. "type": 1
  106. },
  107. }).then(res => {
  108. console.log("收藏", res)
  109. this.collectLoading = false;
  110. if (this.cutoff(res.msg)) return;
  111. this.detail.iscollect = iscollect ? 0 : 1
  112. })
  113. },
  114. saveQrcode() {
  115. let that = this;
  116. that.$refs.painter.canvasToTempFilePathSync({
  117. fileType: "jpg",
  118. // 如果返回的是base64是无法使用 saveImageToPhotosAlbum,需要设置 pathType为url
  119. pathType: 'url',
  120. quality: 1,
  121. success: (res) => {
  122. console.log(res.tempFilePath);
  123. // 非H5 保存到相册
  124. // H5 提示用户长按图另存
  125. uni.saveImageToPhotosAlbum({
  126. filePath: res.tempFilePath,
  127. success: function (e) {
  128. uni.showModal({
  129. title: '提示',
  130. content: '图片已保存到系统相册',
  131. showCancel: false
  132. })
  133. that.loading = false;
  134. this.$Http.basic({
  135. "id": 20240319142702,
  136. "content": {
  137. sat_sharematerialid: that.detail.sat_sharematerialid, type: 1
  138. }
  139. }).then(res => {
  140. console.log(type, '记录', res)
  141. })
  142. },
  143. fail: ({ errMsg }) => {
  144. if (errMsg == 'saveImageToPhotosAlbum:fail auth deny') {
  145. uni.showModal({
  146. title: '提示',
  147. content: '请授权添加到相册权限后再试!',
  148. showCancel: false,
  149. complete: (complete) => {
  150. uni.openSetting({
  151. success: res => {
  152. that.loading = false;
  153. if (res.authSetting['scope.writePhotosAlbum']) {
  154. this.saveTheImage()
  155. } else {
  156. uni.showModal({
  157. title: '提示',
  158. content: '未获取授权!已取消保存',
  159. showCancel: false,
  160. })
  161. }
  162. }
  163. })
  164. },
  165. })
  166. } else {
  167. that.loading = false;
  168. uni.showModal({
  169. title: '提示',
  170. content: '已取消保存',
  171. showCancel: false,
  172. })
  173. }
  174. },
  175. });
  176. },
  177. });
  178. }, getSheraDate() {
  179. let detail = this.detail
  180. return {
  181. title: detail.title, // 标题
  182. path: "/packageCase/imgs/detail?id=" + detail.sat_sharematerialid, // 分享路径
  183. imageUrl: this.detail.attinfos.find(v => v.usetype == "sat_sharematerial").url || ""// 分享图
  184. };
  185. }
  186. },
  187. onShareAppMessage(res) {
  188. return this.getSheraDate()
  189. },
  190. onShareTimeline() {
  191. return this.getSheraDate()
  192. }
  193. }
  194. </script>
  195. <style lang="scss">
  196. .swiper {
  197. width: 375px;
  198. height: 231px;
  199. background: #F5F5F5;
  200. border-radius: 5px;
  201. box-sizing: border-box;
  202. .swiper-item {
  203. position: relative;
  204. width: 100%;
  205. height: 100%;
  206. .image {
  207. width: 100%;
  208. height: 100%;
  209. }
  210. .qrcode {
  211. position: absolute;
  212. display: flex;
  213. align-items: center;
  214. justify-content: center;
  215. top: 10px;
  216. right: 10px;
  217. width: 70px;
  218. height: 25px;
  219. background: rgba($color: #333333, $alpha: 0.5);
  220. font-size: 12px;
  221. color: #FFFFFF;
  222. .iconfont {
  223. margin-right: 4px;
  224. }
  225. }
  226. }
  227. }
  228. .head {
  229. background: #fff;
  230. padding: 8px 10px 15px;
  231. .line1 {
  232. display: flex;
  233. justify-content: space-between;
  234. align-items: flex-end;
  235. .left {
  236. .iconfont {
  237. margin-right: 4px;
  238. font-size: 12px;
  239. }
  240. line-height: 17px;
  241. font-size: 12px;
  242. color: #999999;
  243. }
  244. .right {
  245. display: flex;
  246. align-items: center;
  247. justify-content: center;
  248. width: 80px;
  249. height: 24px;
  250. border-radius: 12px;
  251. border: 1px solid #CCCCCC;
  252. font-family: PingFang SC, PingFang SC;
  253. font-size: 12px;
  254. color: #333333;
  255. .iconfont {
  256. margin-right: 5px;
  257. }
  258. }
  259. }
  260. .title {
  261. line-height: 20px;
  262. font-family: PingFang SC, PingFang SC;
  263. font-weight: bold;
  264. font-size: 14px;
  265. color: #333333;
  266. margin: 10px 0;
  267. }
  268. .subtitle {
  269. line-height: 17px;
  270. font-family: PingFang SC, PingFang SC;
  271. font-size: 12px;
  272. color: #666666;
  273. }
  274. }
  275. .introduce {
  276. background: #fff;
  277. margin-top: 10px;
  278. padding: 0 10px;
  279. &-title {
  280. line-height: 45px;
  281. background: #FFFFFF;
  282. font-family: PingFang SC, PingFang SC;
  283. font-weight: bold;
  284. font-size: 16px;
  285. color: #333333;
  286. }
  287. &-text {
  288. line-height: 20px;
  289. font-family: PingFang SC, PingFang SC;
  290. font-size: 14px;
  291. color: #333333;
  292. padding-bottom: 10px;
  293. }
  294. }
  295. </style>