123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244 |
- <template>
- <My_listbox ref="List" :pullDown="false">
- <view class="painter-box" v-if="userMsg.userid" style="">
- <view>
- <l-painter ref="painter" css="position: relative;width: 280px; height: 426px">
- <l-painter-image
- src="https://yossys06593.obs.cn-east-3.myhuaweicloud.com:443/202405151715764356769B1a729abd.webp"
- css="width: 280px; height: 426px;position: absolute;" />
- <l-painter-image
- :src="userMsg.headpic || 'https://yossys06593.obs.cn-east-3.myhuaweicloud.com:443/202406011717209838416B6150695f.webp'"
- css="width: 56px; height:56px;border-radius: 50%;position: absolute;top:20px;left:20px;z-index:2;"
- object-fit="fill" />
- <l-painter-text :text="name"
- css="width:180px;line-height:24px;height:24px;position: absolute;left:86px;top:21px;z-index:2;font-family: Source Han Sans SC, Source Han Sans SC;font-weight: 500;font-size: 16px;color: #333333; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;" />
- <l-painter-text :text="userMsg.areaname"
- css="width:180px;line-height:20px;height:20px;position: absolute;left:86px;top:55px;z-index:2;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;font-family: Source Han Sans SC, Source Han Sans SC;font-size: 14px;color: #666666;" />
- <l-painter-text text="扫码进入店铺"
- css="width:96px;line-height:17px;position: absolute;left:50%;bottom:269px;z-index:2;margin-left:-48px;font-size: 12px;color: #666666;font-family: PingFang SC, PingFang SC;" />
- <l-painter-qrcode :text="qrCode + 'getStore?id=' + storeid"
- css="width: 200px; height: 200px;position: absolute;left:50%;bottom:55px;z-index:2;margin-left:-100px;" />
- </l-painter>
- </view>
- </view>
- <view style="height: 70px;" />
- <view class="footer">
- <view class="add" hover-class="navigator-hover" @click="saveTheImage()">
- <block>
- 保存图片
- </block>
- </view>
- </view>
- </My_listbox>
- </template>
- <script>
- import lPainter from "../../uni_modules/lime-painter/components/l-painter/l-painter.vue"
- import lPainterView from "../../uni_modules/lime-painter/components/l-painter-view/l-painter-view.vue"
- import lPainterText from "../../uni_modules/lime-painter/components/l-painter-text/l-painter-text.vue"
- import lPainterImage from "../../uni_modules/lime-painter/components/l-painter-image/l-painter-image.vue"
- import lPainterQrcode from "../../uni_modules/lime-painter/components/l-painter-qrcode/l-painter-qrcode.vue"
- import contact from "../../components/contact"
- export default {
- components: { lPainter, lPainterView, lPainterText, lPainterImage, lPainterQrcode, contact },
- data() {
- return {
- userMsg: {
- userid: 0
- },
- qrCode: this.qrCodePrefix,
- name: "",
- storeid: uni.getStorageSync('shop').sa_storeid
- }
- },
- onLoad() {
- uni.setNavigationBarTitle({
- title: '店铺码',
- })
- this.getUserMsg()
- },
- methods: {
- getUserMsg() {
- this.$Http.basic({
- "id": 20240510104102,
- "content": {},
- }).then(res => {
- console.log("获取个人信息", res)
- if (this.cutoff(res.msg)) return;
- res.data.headpic = res.data.attinfos.find(v => v.usetype == "headportrait") && res.data.attinfos.find(v => v.usetype == "headportrait").url || '';
- this.userMsg = res.data;
- this.name = res.data.name ? res.data.name + ',邀请您加入' : '邀请您加入'
- })
- },
- saveTheImage() {
- let that = this;
- this.loading = true;
- this.$refs.painter.canvasToTempFilePathSync({
- fileType: "jpg",
- // 如果返回的是base64是无法使用 saveImageToPhotosAlbum,需要设置 pathType为url
- pathType: 'url',
- quality: 1,
- success: (res) => {
- // 非H5 保存到相册
- // H5 提示用户长按图另存
- uni.saveImageToPhotosAlbum({
- filePath: res.tempFilePath,
- success: function (e) {
- uni.showModal({
- title: '提示',
- content: '图片已保存到系统相册',
- showCancel: false
- })
- that.loading = false;
- that.$Http.basic({
- "id": 20240319142702,
- "content": {
- sat_sharematerialid: that.detail.sat_sharematerialid, type: 1
- }
- }).then(res => {
- console.log(type, '记录', res)
- })
- },
- fail: ({ errMsg }) => {
- if (errMsg == 'saveImageToPhotosAlbum:fail auth deny') {
- uni.showModal({
- title: '提示',
- content: '请授权添加到相册权限后再试!',
- showCancel: false,
- complete: (complete) => {
- uni.openSetting({
- success: res => {
- that.loading = false;
- if (res.authSetting['scope.writePhotosAlbum']) {
- this.saveTheImage()
- } else {
- uni.showModal({
- title: '提示',
- content: '未获取授权!已取消保存',
- showCancel: false,
- })
- }
- }
- })
- },
- })
- } else {
- that.loading = false;
- uni.showModal({
- title: '提示',
- content: '已取消保存',
- showCancel: false,
- })
- }
- },
- });
- },
- });
- },
- onBack() {
- uni.navigateBack();
- },
- getSheraDate() {
- return {
- title: this.name, // 标题
- path: "/team/team/getInvite?id=" + this.userMsg.sys_enterpriseid, // 分享路径
- imageUrl: ""// 分享图
- };
- }
- },
- onShareAppMessage(res) {
- return this.getSheraDate()
- },
- onShareTimeline() {
- return this.getSheraDate()
- }
- }
- </script>
- <style lang="scss" scoped>
- .head {
- position: relative;
- width: 100vw;
- .custom {
- position: absolute;
- width: 100vw;
- display: flex;
- justify-content: center;
- align-items: center;
- font-family: PingFang SC, PingFang SC;
- font-weight: 500;
- font-size: 17px;
- color: #FFFFFF;
- .back {
- position: absolute;
- padding: 0 10px;
- left: 0;
- color: #fff;
- font-size: 12px;
- transform: rotateY(180deg);
- }
- }
- }
- .painter-box {
- display: flex;
- justify-content: center;
- margin-top: 25px;
- }
- .share {
- display: flex;
- justify-content: space-around;
- width: 275px;
- margin: 30px auto 0;
- .item {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 48px;
- height: 48px;
- border-radius: 50%;
- background: rgba(255, 255, 255, 0.3);
- overflow: hidden;
- .iconfont {
- font-size: 28px;
- color: #fff;
- }
- }
- }
- .footer {
- position: fixed;
- bottom: 0;
- width: 100vw;
- height: 65px;
- background: #FFFFFF;
- box-shadow: 0px -2px 6px 1px rgba(0, 0, 0, 0.16);
- box-sizing: border-box;
- padding: 5px 10px;
- .add {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 100%;
- height: 45px;
- background: #C30D23;
- border-radius: 5px;
- font-family: PingFang SC, PingFang SC;
- font-size: 14px;
- color: #FFFFFF;
- }
- }
- </style>
|