You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

setting.vue 6.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <!-- <view v-if="source=='WECHAT'"> -->
  3. <view>
  4. <template v-for="(col,index) in list" :key="index">
  5. <view class="title">{{col.title}}</view>
  6. <u-cell-group>
  7. <u-cell-item :title="item.title" v-for="(item,i) in col.columns" :key="i" @click="itemClick(item)"
  8. :titleStyle="titleStyle" borderBottom></u-cell-item>
  9. </u-cell-group>
  10. </template>
  11. </view>
  12. <!-- <view v-else>
  13. <template v-for="(col,index) in listALI" :key="index">
  14. <view class="title">{{col.title}}</view>
  15. <u-cell-group>
  16. <u-cell-item :title="item.title" v-for="(item,i) in col.columns" :key="i" @click="itemClick(item)"
  17. :titleStyle="titleStyle" borderBottom></u-cell-item>
  18. </u-cell-group>
  19. </template>
  20. </view> -->
  21. <button class="action" @click="loginOut">退出登录</button>
  22. </template>
  23. <script setup lang="ts">
  24. import { source } from "@/utils/network/difference";
  25. import { useUserStore } from '@/stores/user';
  26. import { msg, navTo } from '@/utils/utils';
  27. const userStore = useUserStore();
  28. const { loginOut } = userStore;
  29. import {
  30. request
  31. } from "@/utils/network/request.js";
  32. import {
  33. infoQuery, envs
  34. } from "@/utils/network/api.js";
  35. import {
  36. stringToJson
  37. } from "@/utils/network/encryption.js";
  38. const titleStyle = { fontSize: '28rpx', color: '#333333' };
  39. const basePath = "/subpackage/personal-center/setting/";
  40. const list = [
  41. {
  42. title: '个人信息管理',
  43. columns: [
  44. { title: '个人信息更正', path: 'personal-information/corrections', login: true },
  45. { title: '个人信息删除', path: 'information-deletion', login: true },
  46. { title: '权限管理', path: 'permission-management', login: true },
  47. // {title:'撤销权限管理',path:'revoke-permission',login:true}, //无 UI
  48. { title: '信息副本导出', path: 'info-export', login: true }, //无 UI
  49. { title: '注销账户', path: 'account-cancellation', login: true },
  50. { title: '车辆信息管理', path: '/subpackage/personal-center/vehicle-information', login: true }, //无 UI
  51. { title: '收货地址管理', path: 'addressManager', login: true }, //有 UI 无界面
  52. // {title:'银行卡',path:'bank-card/bank-card',login:true},//有 UI 无界面
  53. ]
  54. },
  55. {
  56. title: '隐私',
  57. columns: [
  58. { title: '用户协议', path: 'user-agreement', login: true },//无 UI
  59. { title: '隐私政策', path: 'conceal-agreement', login: true },//无 UI
  60. { title: '风险提示告知书', path: 'risk-agreement', login: true },//无 UI
  61. { title: '个人信息收集清单', path: 'info_connect', login: true },//无 UI
  62. { title: '权限使用说明', path: 'usage-instructions', login: true }//无 UI
  63. ]
  64. },
  65. ]
  66. const listALI = [
  67. {
  68. title: '个人信息管理',
  69. columns: [
  70. { title: '收货地址管理', path: 'addressManager', login: true }, //有 UI 无界面
  71. // {title:'银行卡',path:'bank-card/bank-card',login:true},//有 UI 无界面
  72. ]
  73. },
  74. {
  75. title: '隐私',
  76. columns: [
  77. { title: '用户协议', path: 'user-agreement', login: true },//无 UI
  78. { title: '隐私政策', path: 'conceal-agreement', login: true },//无 UI
  79. { title: '风险提示告知书', path: 'risk-agreement', login: true },//无 UI
  80. { title: '个人信息收集清单', path: 'info_connect', login: true },//无 UI
  81. { title: '权限使用说明', path: 'usage-instructions', login: true }//无 UI
  82. ]
  83. },
  84. ]
  85. /* item点击 */
  86. const itemClick = (item) => {
  87. console.log("item", item)
  88. if (!item.path) {
  89. msg('找不到该界面哦!');
  90. return;
  91. }
  92. if (item.title == '车辆信息管理') {
  93. navTo(item.path, item.login);
  94. } else if (item.title == '用户协议' || item.title == '隐私政策' || item.title == '风险提示告知书' || item.title == '权限使用说明') {
  95. let type = ""
  96. if (item.title == '用户协议') {
  97. type = "USER_AGREEMENT"
  98. } else if (item.title == '隐私政策') {
  99. type = "PRIVACY_POLICY"
  100. } else if (item.title == '风险提示告知书') {
  101. type = "RISK_NOTIFICATION"
  102. } else if (item.title == '权限使用说明') {
  103. type = "PRIVILEGE_USE"
  104. }
  105. getInfo(type).then((data) => {
  106. console.log("data", data)
  107. if (data.textType == "URL") {
  108. previewPdf(envs[process.env.NODE_ENV].baseUrl + data.text)
  109. } else {
  110. console.log("basePath + item.path", basePath + item.path)
  111. const params = encodeURIComponent(JSON.stringify(data.text))
  112. uni.navigateTo({
  113. url: `${basePath}${item.path}?params=${params}`
  114. })
  115. }
  116. })
  117. } else {
  118. navTo(basePath + item.path, item.login);
  119. }
  120. }
  121. const getInfo = (type) => {
  122. //参数说明
  123. let options = {
  124. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  125. data: {
  126. businessType: type
  127. }, //请求参数
  128. method: "POST", //提交方式(默认POST)
  129. showLoading: true, //是否显示加载中(默认显示)
  130. };
  131. return new Promise(async (resolve, reject) => {
  132. const res = await request(infoQuery, options);
  133. const data = stringToJson(res.bizContent);
  134. resolve(data);
  135. }).catch((error) => {
  136. reject(error);
  137. });
  138. }
  139. const previewPdf = (urll) => {
  140. const that = this
  141. let url = urll
  142. uni.showLoading({
  143. title: '加载中'
  144. });
  145. uni.downloadFile({
  146. url,
  147. success: ({
  148. tempFilePath: filePath
  149. }) => {
  150. uni.openDocument({
  151. filePath,
  152. fail: (err) => {
  153. console.log('这是打开报错值:' + err)
  154. },
  155. complete: () => {
  156. uni.hideLoading()
  157. }
  158. })
  159. },
  160. fail: (err) => {
  161. console.log('这是请求报错:', err)
  162. uni.hideLoading()
  163. }
  164. })
  165. }
  166. </script>
  167. <style>
  168. page {
  169. background: #EEF7F7;
  170. padding-bottom: 100rpx;
  171. }
  172. </style>
  173. <style lang="scss" scoped>
  174. .title {
  175. font-size: 26rpx;
  176. font-family: Microsoft YaHei;
  177. font-weight: 400;
  178. color: #666666;
  179. height: 80rpx;
  180. padding-top: 30rpx;
  181. padding-left: 30rpx
  182. }
  183. .action {
  184. margin-top: 30rpx;
  185. font-size: 28rpx;
  186. font-family: Microsoft YaHei;
  187. font-weight: 400;
  188. color: #333333;
  189. line-height: 88rpx;
  190. height: 88rpx;
  191. background: #FFFFFF;
  192. box-shadow: 0rpx 4rpx 11rpx 1rpx rgba(223, 223, 223, 0.5);
  193. }
  194. </style>