p***@163.com
p***@163.com
  • 发布:2022-02-18 20:54
  • 更新:2023-04-09 10:25
  • 阅读:6137

uniapp编译后代码还原

分类:uni-app

项目工程代码丢失,只剩下发布后的小程序源代码,请问可以还原吗?

2022-02-18 20:54 负责人:无 分享
已邀请:
4***@qq.com

4***@qq.com

一楼的代码还原后如下:因为没有上下文,恢复可能会存在一点小问题。

<template>  
  <view class="content">  
    <button @tap="handleCreateChat">创建对话</button>  
    <list>  
      <item v-for="(item, index) in chatLists" :key="index" @tap="gotoChatRoom(index)">{{ item.doctorName }}  
      </item>  
    </list>  
  </view>  
</template>  
<script>  
import {mapState, mapActions, mapMutations} from 'vuex'  
import List from "../../components/list/index";  
import Item from "../../components/list/item";  

export default {  
  components: {  
    List,  
    Item  
  },  
  data() {  
    return {  
      detail: {}  
    };  
  },  
  computed: {  
    ...mapState(),  
    currentChat(data) {  
      return data.chat.currentChat;  
    },  
    chatLists(data) {  
      return data.chat.rootChat;  
    }  
  },  
  methods: {  
    ...mapMutations(["setRootChat", "setCurrentChat"]),  
    ...mapActions(["createChat"]),  
    async handleCreateChat() {  
      try {  
        const result = await this.createChat();  
        const data = result.data;  
        const chatLists = this.chatLists.filter(item => item._id === data);  
        const [index] = chatLists;  
        await wx.requestSubscribeMessage({  
          tmplIds: ["xxxx", "xxxx"]  
        });  
        this.gotoChatRoom(index)  
      } catch (err) {  

      }  
    },  
    gotoChatRoom(index) {  
      this.setCurrentChat(index);  
      wx.requestSubscribeMessage({  
        tmplIds: ["xxxxx", "xxxx"],  
        success: res => {  
        }  
      });  
      uni.navigateTo({  
        url: "./pages/chatRoom/index?extra=".concat(encodeURIComponent(JSON.stringify(index))).concat("&iq=41835478")  
      });  
    }  
  }  
}  
</script>
BoredApe

BoredApe - 有问题就会有答案。

可以还原。有过相同经历。花点时间和耐心是可以恢复过来的。
反编译后的小程序代码也是保留了基本的页面组成。

<template>  
<view class="content">  
    <button @tap="__e" :data-event-opts="[ [ 'tap',[ [ 'handleCreateChat',['$event'] ] ] ] ]">创建对话</button>  
    <list @__l="__l" vueId="214c3072-1" :vueSlots="['default']">  
        <item @__l="__l" @tap="__e" :data-event-opts="[ [ '^tap',[ [ 'gotoChatRoom',['$0'],[ [ ['chatLists','',index] ] ] ] ] ] ]" :vueId="'214c3072-'+index+','+'214c3072-1'" :vueSlots="['default']" v-for="(item, index) in chatLists" :key="index">{{''+item.doctorName+''}}</item>  
    </list>  
</view>  
</template>

js差不多是这样

Object.defineProperty(e, "__esModule", {  
                value: !0  
            }), e.default = void 0;  
            var m = r(n("a34a")), p = r(n("13ea")), b = n("2f62"), y = n("55a7"), g = {  
                components: {  
                    List: function() {  
                        Promise.all([ n.e("common/vendor"), n.e("components/list/index") ]).then(function() {  
                            return resolve(n("0536"));  
                        }.bind(null, n)).catch(n.oe);  
                    },  
                    Item: function() {  
                        Promise.all([ n.e("common/vendor"), n.e("components/list/item") ]).then(function() {  
                            return resolve(n("a6cc"));  
                        }.bind(null, n)).catch(n.oe);  
                    }  
                },  
                data: function() {  
                    return {  
                        detail: {}  
                    };  
                },  
                computed: h({}, (0, b.mapState)({  
                    currentChat: function(t) {  
                        return t.chat.currentChat;  
                    },  
                    chatLists: function(t) {  
                        return t.chat.rootChat;  
                    }  
                })),  
                methods: h(h(h({}, (0, b.mapMutations)([ "setRootChat", "setCurrentChat" ])), (0,   
                b.mapActions)([ "createChat" ])), {}, {  
                    handleCreateChat: function() {  
                        var t = this;  
                        return l(m.default.mark(function e() {  
                            var n, r, a, c, u;  
                            return m.default.wrap(function(e) {  
                                for (;;) switch (e.prev = e.next) {  
                                  case 0:  
                                    return e.prev = 0, e.next = 3, t.createChat();  

                                  case 3:  
                                    return n = e.sent, r = n.data, a = t.chatLists.filter(function(t) {  
                                        return t._id === r;  
                                    }), c = o(a, 1), u = c[0], e.next = 8, wx.requestSubscribeMessage({  
                                        tmplIds: [ "xxxx", "xxxx" ]  
                                    });  

                                  case 8:  
                                    t.gotoChatRoom(u), e.next = 13;  
                                    break;  

                                  case 11:  
                                    e.prev = 11, e.t0 = e.catch(0);  

                                  case 13:  
                                  case "end":  
                                    return e.stop();  
                                }  
                            }, e, null, [ [ 0, 11 ] ]);  
                        }))();  
                    },  
                    gotoChatRoom: function(e) {  
                        this.setCurrentChat(e), wx.requestSubscribeMessage({  
                            tmplIds: [ "xxxxx", "xxxx" ],  
                            success: function(t) {}  
                        }), t.navigateTo({  
                            url: "./pages/chatRoom/index?extra=".concat(encodeURIComponent(JSON.stringify(e)))  
                        });  
                    }  
                })  
            };

你可以使用这个工具先把小程序代码转换为Uni-app代码miniprogram-to-uniapp v2
然后根据转换后的代码再粘贴恢复

p***@163.com

p***@163.com (作者) - 前端爱好者

转换失败,提示“检测到当前项目可能是uniapp发布后的小程序项目,不支持转换!”

i***@qq.com

i***@qq.com

转换失败,提示“检测到当前项目可能是uniapp发布后的小程序项目,不支持转换!”

请问如何解?在线等?

  • 4***@qq.com

    miniprogram-to-uniapp v2只能辅助一下,很多代码需要手动还原

    2022-09-19 11:22

  • 哈土豆源码

    回复 4***@qq.com: 你好,可以做uniapp小程序还原uniapp代码不,能做加我微信jintaocms

    2023-04-09 10:25

  • wuyanzu

    回复 4***@qq.com: 如果可以,请联系我,有偿

    2023-04-19 11:34

  • 落魄实习生

    其实可以找到源码注释掉就行,在hbuilderx的目录下的plugins目录下找到miniprogram-to-uniapp的项目,然后进去src下的main.js里面就有判断是否是uniapp编译的小程序项目,注释掉再重新打开hbuilderx就能转换了,不过特别慢

    2024-12-24 11:58

哈土豆源码

哈土豆源码

你好,可以做uniapp小程序还原uniapp代码不,能做加我微信jintaocms

要回复问题请先登录注册