detail.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  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(true);
  74. },
  75. methods: {
  76. getDetail(init = false) {
  77. if (!init) return;
  78. this.$Http.basic({
  79. "id": 20240415164302,
  80. "content": {
  81. "sat_sharematerialid": this.sat_sharematerialid
  82. },
  83. }).then(res => {
  84. this.$refs.List.RefreshToComplete()
  85. console.log("获取效果图详情", res)
  86. if (this.cutoff(res.msg)) return;
  87. this.detail = res.data;
  88. this.slides = res.data.attinfos_pic.map(v => {
  89. return {
  90. cover: this.getSpecifiedImage(v.attinfos[0]),
  91. url: v.attinfos[0].url
  92. }
  93. })
  94. uni.setNavigationBarTitle({
  95. title: res.data.title
  96. });
  97. })
  98. },
  99. handleCollect(iscollect) {
  100. this.collectLoading = true;
  101. this.$Http.basic({
  102. "id": 20240416133702,
  103. "content": {
  104. "ownertable": "sat_sharematerial",
  105. "ownerid": this.detail.sat_sharematerialid,
  106. "type": 1
  107. },
  108. }).then(res => {
  109. console.log("收藏", res)
  110. this.collectLoading = false;
  111. if (this.cutoff(res.msg)) return;
  112. this.detail.iscollect = iscollect ? 0 : 1
  113. })
  114. },
  115. saveQrcode() {
  116. let that = this;
  117. that.$refs.painter.canvasToTempFilePathSync({
  118. fileType: "jpg",
  119. // 如果返回的是base64是无法使用 saveImageToPhotosAlbum,需要设置 pathType为url
  120. pathType: 'url',
  121. quality: 1,
  122. success: (res) => {
  123. console.log(res.tempFilePath);
  124. // 非H5 保存到相册
  125. // H5 提示用户长按图另存
  126. uni.saveImageToPhotosAlbum({
  127. filePath: res.tempFilePath,
  128. success: function (e) {
  129. uni.showModal({
  130. title: '提示',
  131. content: '图片已保存到系统相册',
  132. showCancel: false
  133. })
  134. that.loading = false;
  135. },
  136. fail: ({ errMsg }) => {
  137. if (errMsg == 'saveImageToPhotosAlbum:fail auth deny') {
  138. uni.showModal({
  139. title: '提示',
  140. content: '请授权添加到相册权限后再试!',
  141. showCancel: false,
  142. complete: (complete) => {
  143. uni.openSetting({
  144. success: res => {
  145. that.loading = false;
  146. if (res.authSetting['scope.writePhotosAlbum']) {
  147. this.saveTheImage()
  148. } else {
  149. uni.showModal({
  150. title: '提示',
  151. content: '未获取授权!已取消保存',
  152. showCancel: false,
  153. })
  154. }
  155. }
  156. })
  157. },
  158. })
  159. } else {
  160. that.loading = false;
  161. uni.showModal({
  162. title: '提示',
  163. content: '已取消保存',
  164. showCancel: false,
  165. })
  166. }
  167. },
  168. });
  169. },
  170. });
  171. }, getSheraDate() {
  172. let detail = this.detail
  173. return {
  174. title: detail.title, // 标题
  175. path: "/packageCase/imgs/detail?id=" + detail.sat_sharematerialid, // 分享路径
  176. imageUrl: this.detail.attinfos.find(v => v.usetype == "sat_sharematerial").url || ""// 分享图
  177. };
  178. }
  179. },
  180. onShareAppMessage(res) {
  181. return this.getSheraDate()
  182. },
  183. onShareTimeline() {
  184. return this.getSheraDate()
  185. }
  186. }
  187. </script>
  188. <style lang="scss">
  189. .swiper {
  190. width: 375px;
  191. height: 231px;
  192. background: #F5F5F5;
  193. border-radius: 5px;
  194. box-sizing: border-box;
  195. .swiper-item {
  196. position: relative;
  197. width: 100%;
  198. height: 100%;
  199. .image {
  200. width: 100%;
  201. height: 100%;
  202. }
  203. .qrcode {
  204. position: absolute;
  205. display: flex;
  206. align-items: center;
  207. justify-content: center;
  208. top: 10px;
  209. right: 10px;
  210. width: 70px;
  211. height: 25px;
  212. background: rgba($color: #333333, $alpha: 0.5);
  213. font-size: 12px;
  214. color: #FFFFFF;
  215. .iconfont {
  216. margin-right: 4px;
  217. }
  218. }
  219. }
  220. }
  221. .head {
  222. background: #fff;
  223. padding: 8px 10px 15px;
  224. .line1 {
  225. display: flex;
  226. justify-content: space-between;
  227. align-items: flex-end;
  228. .left {
  229. .iconfont {
  230. margin-right: 4px;
  231. font-size: 12px;
  232. }
  233. line-height: 17px;
  234. font-size: 12px;
  235. color: #999999;
  236. }
  237. .right {
  238. display: flex;
  239. align-items: center;
  240. justify-content: center;
  241. width: 80px;
  242. height: 24px;
  243. border-radius: 12px;
  244. border: 1px solid #CCCCCC;
  245. font-family: PingFang SC, PingFang SC;
  246. font-size: 12px;
  247. color: #333333;
  248. .iconfont {
  249. margin-right: 5px;
  250. }
  251. }
  252. }
  253. .title {
  254. line-height: 20px;
  255. font-family: PingFang SC, PingFang SC;
  256. font-weight: bold;
  257. font-size: 14px;
  258. color: #333333;
  259. margin: 10px 0;
  260. }
  261. .subtitle {
  262. line-height: 17px;
  263. font-family: PingFang SC, PingFang SC;
  264. font-size: 12px;
  265. color: #666666;
  266. }
  267. }
  268. .introduce {
  269. background: #fff;
  270. margin-top: 10px;
  271. padding: 0 10px;
  272. &-title {
  273. line-height: 45px;
  274. background: #FFFFFF;
  275. font-family: PingFang SC, PingFang SC;
  276. font-weight: bold;
  277. font-size: 16px;
  278. color: #333333;
  279. }
  280. &-text {
  281. line-height: 20px;
  282. font-family: PingFang SC, PingFang SC;
  283. font-size: 14px;
  284. color: #333333;
  285. padding-bottom: 10px;
  286. }
  287. }
  288. </style>