setting.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. <template>
  2. <view>
  3. <!-- 设置 -->
  4. <u-card :border="false" padding="30" box-shadow="0px 1px 10px rgba(0,0,0,0.2)" border-radius="20" :show-foot="false"
  5. :show-head="false" @click="tishi">
  6. <view slot="body">
  7. <view class="u-flex u-row-between">
  8. <view class="">
  9. <u-image width="130rpx" height="130rpx" :src="userInfo.storeImageUrl" :lazy-load="true" shape="circle" :show-loading="true">
  10. <u-loading slot="loading"></u-loading>
  11. <view slot="error" style="font-size: 24rpx" :fade="true" duration="450">加载失败
  12. </view>
  13. </u-image>
  14. </view>
  15. <view class="u-flex">
  16. <!-- <view class="u-m-r-50" style="color: #0d79ec; font-size: 32rpx">修改门头照</view> -->
  17. <u-icon name="arrow-right" color="#0D79EC" size="28"></u-icon>
  18. </view>
  19. </view>
  20. </view>
  21. </u-card>
  22. <u-card :border="false" padding="20" box-shadow="0px 1px 10px rgba(0,0,0,0.2)" border-radius="20" :show-foot="false"
  23. :show-head="false">
  24. <view slot="body">
  25. <template>
  26. <u-cell-group :border="false">
  27. <u-cell-item title="收货地址管理" @click="tishi">
  28. <u-icon slot="icon" size="42" name="location-o" custom-prefix="van-icon" color="#0095FF" style="margin-right: 10rpx"></u-icon>
  29. </u-cell-item>
  30. <u-cell-item title="门店名称" :value="userInfo.storeName" :arrow="false">
  31. <u-icon slot="icon" size="42" name="shop-o" custom-prefix="van-icon" color="#0095FF" style="margin-right: 10rpx"></u-icon>
  32. </u-cell-item>
  33. <u-cell-item title="门店联系人" :value="userInfo.contactName" :arrow="false">
  34. <u-icon slot="icon" size="42" name="contact" custom-prefix="van-icon" color="#0095FF" style="margin-right: 10rpx"></u-icon>
  35. </u-cell-item>
  36. <u-cell-item title="联系电话" :value="userInfo.storePhone" :arrow="false">
  37. <u-icon slot="icon" size="42" name="phone-o" custom-prefix="van-icon" color="#0095FF" style="margin-right: 10rpx"></u-icon>
  38. </u-cell-item>
  39. <u-cell-item title="用户协议">
  40. <u-icon slot="icon" size="42" name="friends-o" custom-prefix="van-icon" color="#0095FF" style="margin-right: 10rpx"></u-icon>
  41. </u-cell-item>
  42. <u-cell-item title="隐私政策">
  43. <u-icon slot="icon" size="42" name="info-o" custom-prefix="van-icon" color="#0095FF" style="margin-right: 10rpx"></u-icon>
  44. </u-cell-item>
  45. <u-cell-item title="版本检测" :value="edition_s" :arrow="false" :border-bottom="false" @click="edition">
  46. <u-icon slot="icon" size="42" name="setting-o" custom-prefix="van-icon" color="#0095FF" style="margin-right: 10rpx"></u-icon>
  47. </u-cell-item>
  48. </u-cell-group>
  49. </template>
  50. </view>
  51. </u-card>
  52. <u-button type="primary" @click="exit" style="margin: 20rpx">安全退出</u-button>
  53. <luo-version-upgrade v-if="show_s == true" version="1.0.1" :url="url" :is_force="is_force" :describe="Copywriting"></luo-version-upgrade>
  54. </view>
  55. </template>
  56. <script>
  57. import {
  58. mapMutations
  59. } from "vuex";
  60. import {
  61. request
  62. } from "../../../common/request/request";
  63. require("promise.prototype.finally").shim();
  64. export default {
  65. data() {
  66. return {
  67. userInfo: {},
  68. edition_s: '',
  69. show_s: false,
  70. url: '',
  71. is_force: false,
  72. Copywriting: ''
  73. };
  74. },
  75. created() {
  76. this.getMyinfo();
  77. plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
  78. console.log(wgtinfo);
  79. // console.log(wgtinfo.version); //版本号
  80. this.edition_s = wgtinfo.version
  81. })
  82. },
  83. methods: {
  84. ...mapMutations(["logout"]),
  85. exit() {
  86. this.logout();
  87. this.$u.route({
  88. url: "pages/login/index",
  89. type: "reLaunch",
  90. });
  91. },
  92. edition() {
  93. uni.getSystemInfo({
  94. success: res => {
  95. console.log(res.platform);
  96. },
  97. complete: err => {
  98. if (err.platform == 'android') {
  99. this.onLaunch_s()
  100. } else if (err.platform == 'ios') {
  101. console.log("暂无数据")
  102. this.iosstartup()
  103. }
  104. }
  105. });
  106. },
  107. iosstartup(){
  108. request({
  109. url: '/baseReq/apkUpgrade',
  110. method: 'get',
  111. params: {
  112. osType: 1
  113. }
  114. }).then(res => {
  115. console.log(res)
  116. console.log(res.data.code)
  117. console.log(res.data.forceVersion) //最低版本
  118. console.log(res.data.msg) //更新文案
  119. console.log(res.data.version) //最新版本
  120. plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
  121. console.log(wgtinfo);
  122. console.log(wgtinfo.version); //版本号
  123. if (wgtinfo.version == res.data.version) {
  124. this.show_s = true
  125. uni.showToast({
  126. icon: 'none',
  127. title: '已是最新版本',
  128. position: "bottom"
  129. })
  130. console.log("已是最新版本")
  131. } else if (wgtinfo.version != res.data.forceVersion) {
  132. console.log("强制版本更新")
  133. res.data.msg = res.data.msg.replace(/\\n/g,"\n")
  134. uni.showModal({
  135. title: "发现新版本",
  136. content: res.data.msg,
  137. showCancel: false,
  138. confirmText: "立即去AppStore更新",
  139. success: function(res) {
  140. if (res.confirm) {
  141. console.log('用户点击确定');
  142. let appleId = 1518555723
  143. plus.runtime.launchApplication({
  144. action: `itms-apps://itunes.apple.com/cn/app/id${appleId}?mt=8`
  145. }, function(e) {
  146. console.log('Open system default browser failed: ' + e.message);
  147. });
  148. } else if (res.cancel) {
  149. console.log('用户点击取消');
  150. }
  151. }
  152. })
  153. } else if (wgtinfo.version == res.data.forceVersion) {
  154. console.log("最低版本更新")
  155. res.data.msg = res.data.msg.replace(/\\n/g,"\n")
  156. uni.showModal({
  157. title: "发现新版本",
  158. content: res.data.msg,
  159. showCancel: true,
  160. confirmText: "立即去AppStore更新",
  161. success: function(res) {
  162. if (res.confirm) {
  163. console.log('用户点击确定');
  164. let appleId = 1518555723
  165. plus.runtime.launchApplication({
  166. action: `itms-apps://itunes.apple.com/cn/app/id${appleId}?mt=8`
  167. }, function(e) {
  168. console.log('Open system default browser failed: ' + e.message);
  169. });
  170. } else if (res.cancel) {
  171. console.log('用户点击取消');
  172. }
  173. }
  174. })
  175. }
  176. })
  177. }).catch(err => {
  178. console.log(err)
  179. })
  180. .finally(() => {
  181. // Loading.close()
  182. })
  183. },
  184. onLaunch_s() {
  185. //升级调用的接口
  186. if (this.show_s == true) {
  187. this.show_s = false
  188. }
  189. console.log(this.show_s)
  190. request({
  191. url: '/baseReq/apkUpgrade',
  192. method: 'get',
  193. params: {
  194. osType: 0
  195. }
  196. }).then(res => {
  197. console.log(res)
  198. console.log(res.data.forceVersion) //最低版本
  199. console.log(res.data.msg) //更新文案
  200. console.log(res.data.url) //下载最新版地址
  201. console.log(res.data.version) //最新版本
  202. plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
  203. console.log(wgtinfo);
  204. console.log(wgtinfo.version); //版本号
  205. if (wgtinfo.version == res.data.version) {
  206. this.show_s = false
  207. uni.showToast({
  208. icon: 'none',
  209. title: '已经是最新版本了',
  210. position: "bottom"
  211. })
  212. this.closeModal();
  213. console.log("已经是最新版本了")
  214. } else if (wgtinfo.version != res.data.forceVersion) {
  215. console.log("必须强制更新")
  216. this.Copywriting = res.data.msg
  217. this.show_s = true
  218. console.log(res.data.url)
  219. this.url = res.data.url
  220. this.is_force = true
  221. } else if (wgtinfo.version == res.data.forceVersion) {
  222. console.log("达到最低版本")
  223. this.Copywriting = res.data.msg
  224. console.log(this.Copywriting)
  225. this.is_force = false
  226. this.show_s = true
  227. console.log(this.show_s)
  228. this.url = res.data.url
  229. }
  230. })
  231. }).catch(err => {
  232. console.log(err)
  233. })
  234. .finally(() => {
  235. // Loading.close()
  236. })
  237. },
  238. getMyinfo() {
  239. request({
  240. url: "/myapp/selectStore",
  241. method: "post",
  242. data: {
  243. storeId: this.$store.state.storeInfo.storeId,
  244. },
  245. })
  246. .then((res) => {
  247. this.userInfo = res.data.data;
  248. // console.log(this.userInfo);
  249. })
  250. .catch((err) => {
  251. console.log(err);
  252. })
  253. .finally(() => {
  254. this.loading = false;
  255. uni.hideLoading();
  256. });
  257. },
  258. tishi() {
  259. this.$u.toast('此功能暂不开放');
  260. }
  261. },
  262. };
  263. </script>
  264. <style>
  265. </style>